]> granicus.if.org Git - nethack/commitdiff
fix nhl_loadlua() failures on Windows
authornhmall <nhmall@nethack.org>
Sun, 22 Aug 2021 23:15:03 +0000 (19:15 -0400)
committernhmall <nhmall@nethack.org>
Sun, 22 Aug 2021 23:25:13 +0000 (19:25 -0400)
The [dlb_]fopen() requires an RDBMODE argument on Windows.
ftell(), fseek(), and fread() interactions can be problematic otherwise.

doc/fixes37.0
src/nhlua.c

index 404bd63a66d1d750d58786950b2fe5d7a2fab907..eab03e04e35f213be3e7204a918fd5d64f807aed 100644 (file)
@@ -804,6 +804,9 @@ Unix: after lua changes to Makefiles, 'make spotless' for dat subdirectory
        left some generated data files which should have been deleted
 Windows: new tile additions in win/share did not trigger the creation of a new
        NetHackW.res file
+Windows: nhl_loadlua() was missing the RDBMODE argument on the [dlb_]fopen()
+       that is necessary to ensure binary mode for navigating around a file
+       with fseek(), ftell() and fread() reliably
 X11: was still initializing map to 'stone' instead of 'unexplored' after they
        became separate glyphs
 X11: for text map without color, add support for black&white ice; draw it in
index 92b0808eaf3d7074d3abfce57208bbdfe84f4be5..92a942b92512589bb3379ac4ac0d4c4800cbd9e6 100644 (file)
@@ -1244,7 +1244,7 @@ nhl_loadlua(lua_State *L, const char *fname)
        if we did, we could choose between "nhdat(<fname>)" and "<fname>"
        but since we don't, compromise */
     Sprintf(altfname, "(%s)", fname);
-    fh = dlb_fopen(fname, "r");
+    fh = dlb_fopen(fname, RDBMODE);
     if (!fh) {
         impossible("nhl_loadlua: Error loading %s", altfname);
         ret = FALSE;