]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - adventure/save.c
Fix merge conflicts
[bsdgames-darwin.git] / adventure / save.c
index 7392c695caf2f972c454f03218fa04e411bd2796..5623d1b0b613e13304bda1003f9f8b7026ecd7eb 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: save.c,v 1.13 2012/01/08 18:16:00 dholland Exp $       */
+/*     $NetBSD: save.c,v 1.15 2021/04/12 09:12:28 mrg Exp $    */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)save.c     8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: save.c,v 1.13 2012/01/08 18:16:00 dholland Exp $");
+__RCSID("$NetBSD: save.c,v 1.15 2021/04/12 09:12:28 mrg Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -54,11 +54,13 @@ __RCSID("$NetBSD: save.c,v 1.13 2012/01/08 18:16:00 dholland Exp $");
 #include "hdr.h"
 #include "extern.h"
 
+#define __arraycount(a) (sizeof(a) / sizeof(*(a)))
+
 struct savefile {
        FILE *f;
        const char *name;
        bool warned;
-       unsigned bintextpos;
+       size_t bintextpos;
        uint32_t key;
        struct crcstate crc;
        unsigned char pad[8];
@@ -77,7 +79,7 @@ static const char header[] = "Adventure save file\n";
  * Map 16 plain values into 90 coded values and back.
  */
 
-static const char coding[90] =
+static const char coding[91] =
        "Db.GOyT]7a6zpF(c*5H9oK~0[WVAg&kR)ml,2^q-1Y3v+"
        "X/=JirZL$C>_N?:}B{dfnsxU<@MQ%8|P!4h`ESt;euwIj"
 ;
@@ -343,7 +345,7 @@ hash(const void *data, size_t datalen, unsigned char *out, size_t outlen)
        for (i=0; i<datalen; i++) {
                val = val ^ 0xbadc0ffee;
                val = (val << 4) | (val >> 60);
-               val += udata[i] ^ 0xbeef;
+               val += udata[i] ^ 0xbeefU;
        }
 
        uval = (unsigned char *)&val;
@@ -454,7 +456,7 @@ savefile_cwrite(struct savefile *sf, const void *data, size_t len)
 
 struct compat_saveinfo {
        void   *address;
-       int     width;
+       size_t  width;
 };
 
 static const struct compat_saveinfo compat_savearray[] =
@@ -530,7 +532,7 @@ compat_restore(const char *infile)
        const struct compat_saveinfo *p;
        char   *s;
        long    sum, cksum = 0;
-       int     i;
+       size_t  i;
        struct crcstate crc;
 
        if ((in = fopen(infile, "rb")) == NULL) {