]> granicus.if.org Git - nethack/commitdiff
Get rid of a compiler warning that has been there forever.
authornethack.allison <nethack.allison>
Tue, 15 Jan 2002 03:37:36 +0000 (03:37 +0000)
committernethack.allison <nethack.allison>
Tue, 15 Jan 2002 03:37:36 +0000 (03:37 +0000)
This finally gets the entire build process warning-free
under MSVC.

util/lev_main.c

index 2634d50dea37db837040bc1ad9a6807e635dc637..bf9aae25da6f64fbb9a0eb7af9f7692ae762a5bc 100644 (file)
@@ -1163,8 +1163,19 @@ specialmaze *maze;
            Write(fd, &(pt->ysize), sizeof(pt->ysize));
            for(j=0;j<pt->ysize;j++) {
                if(!maze->init_lev.init_present ||
-                  pt->xsize > 1 || pt->ysize > 1)
-                   Write(fd, pt->map[j], pt->xsize * sizeof *pt->map[j]);
+                  pt->xsize > 1 || pt->ysize > 1) {
+#ifndef _MSC_VER
+                       Write(fd, pt->map[j], pt->xsize * sizeof *pt->map[j]);
+#else
+                       /*
+                        * On MSVC compiler the Write macro above caused: 
+                        * warning '!=' : signed/unsigned mismatch
+                        */
+                       unsigned reslt, sz = pt->xsize * sizeof *pt->map[j];
+                       reslt = write(fd, (genericptr_t)(pt->map[j]), sz);
+                       if (reslt != sz) return FALSE;
+#endif
+               }
                Free(pt->map[j]);
            }
            Free(pt->map);