]> granicus.if.org Git - nethack/commitdiff
Revert "attempt to avoid questpgr convert woes on cross-compile by making the int...
authornhmall <nhmall@nethack.org>
Sun, 24 Nov 2019 05:40:00 +0000 (00:40 -0500)
committernhmall <nhmall@nethack.org>
Sun, 24 Nov 2019 05:40:00 +0000 (00:40 -0500)
This reverts commit b8a6d82c57b1e9407223c83ab719bd1fb674d9f8.

include/qtext.h
src/questpgr.c
util/makedefs.c

index efec908e9f6a47d019df9812ddd0b6055c81e34b..29993d29af504c9f9f4ff12b24cd44cc81b422a2 100644 (file)
@@ -5,21 +5,14 @@
 #ifndef QTEXT_H
 #define QTEXT_H
 
-#ifndef INTEGER_H
-#include "integer.h"
-#endif
-
 #define N_HDR 16 /* Maximum number of categories */
 /* (i.e., num roles + 1) */
 #define LEN_HDR 3 /* Maximum length of a category name */
 
-#define QTOFFSIZ int64_t
-#define QT_PREPROC 64
-
 struct qtmsg {
-    int32_t msgnum;
+    int msgnum;
     char delivery;
-    QTOFFSIZ offset, size, summary_size;
+    long offset, size, summary_size;
 };
 
 #if defined(MAKEDEFS_C) || defined(MDLIB_C) /***** MAKEDEFS *****/
@@ -27,14 +20,14 @@ struct qtmsg {
 #define N_MSG 100 /* arbitrary */
 
 struct msghdr {
-    int32_t n_msg;
+    int n_msg;
     struct qtmsg qt_msg[N_MSG];
 };
 
 struct qthdr {
-    int32_t n_hdr;
+    int n_hdr;
     char id[N_HDR][LEN_HDR];
-    QTOFFSIZ offset[N_HDR];
+    long offset[N_HDR];
 };
 
 /* Error message macros */
index 0fb4ce2592ed4757b4f2c4c7ceba9d2151d9112d..f0cf6283f5f6b79e15d7dd5cae065b3c0511f5a9 100644 (file)
 #endif
 
 static void NDECL(dump_qtlist);
-static void FDECL(Fread, (genericptr_t, int32_t, int32_t, dlb *));
-static struct qtmsg *FDECL(construct_qtlist, (QTOFFSIZ));
+static void FDECL(Fread, (genericptr_t, int, int, dlb *));
+static struct qtmsg *FDECL(construct_qtlist, (long));
 static const char *NDECL(intermed);
 static struct obj *FDECL(find_qarti, (struct obj *));
 static const char *NDECL(neminame);
 static const char *NDECL(guardname);
 static const char *NDECL(homebase);
 static void FDECL(qtext_pronoun, (CHAR_P, CHAR_P));
-static struct qtmsg *FDECL(msg_in, (struct qtmsg *, int32_t));
+static struct qtmsg *FDECL(msg_in, (struct qtmsg *, int));
 static void FDECL(convert_arg, (CHAR_P));
 static void FDECL(convert_line, (char *,char *));
 static void FDECL(deliver_by_pline, (struct qtmsg *));
-static void FDECL(deliver_by_window, (struct qtmsg *, int32_t));
+static void FDECL(deliver_by_window, (struct qtmsg *, int));
 static boolean FDECL(skip_pager, (BOOLEAN_P));
 
-#if (QT_PREPROC == 64) && defined(WIN32)
-#define LONGCAST (long)
-#else
-#define LONGCAST
-#endif
-
 /* dump the character msg list to check appearance;
    build with DEBUG enabled and use DEBUGFILES=questpgr.c
    in sysconf file or environment */
@@ -50,7 +44,7 @@ dump_qtlist()
         return;
 
     for (msg = g.qt_list.chrole; msg->msgnum > 0; msg++) {
-        (void) dlb_fseek(g.msg_file, LONGCAST msg->offset, SEEK_SET);
+        (void) dlb_fseek(g.msg_file, msg->offset, SEEK_SET);
         deliver_by_window(msg, NHW_MAP);
     }
 #endif /* DEBUG */
@@ -60,7 +54,7 @@ dump_qtlist()
 static void
 Fread(ptr, size, nitems, stream)
 genericptr_t ptr;
-int32_t size, nitems;
+int size, nitems;
 dlb *stream;
 {
     int cnt;
@@ -73,13 +67,13 @@ dlb *stream;
 
 static struct qtmsg *
 construct_qtlist(hdr_offset)
-QTOFFSIZ hdr_offset;
+long hdr_offset;
 {
     struct qtmsg *msg_list;
-    int32_t n_msgs;
+    int n_msgs;
 
     (void) dlb_fseek(g.msg_file, hdr_offset, SEEK_SET);
-    Fread(&n_msgs, sizeof(int32_t), 1, g.msg_file);
+    Fread(&n_msgs, sizeof(int), 1, g.msg_file);
     msg_list = (struct qtmsg *) alloc((unsigned) (n_msgs + 1)
                                       * sizeof (struct qtmsg));
 
@@ -89,16 +83,16 @@ QTOFFSIZ hdr_offset;
     Fread((genericptr_t) msg_list, n_msgs * sizeof (struct qtmsg), 1,
           g.msg_file);
 
-    msg_list[n_msgs].msgnum = (int32_t) -1;
+    msg_list[n_msgs].msgnum = -1;
     return msg_list;
 }
 
 void
 load_qtlist()
 {
-    int32_t n_classes, i;
+    int n_classes, i;
     char qt_classes[N_HDR][LEN_HDR];
-    QTOFFSIZ qt_offsets[N_HDR];
+    long qt_offsets[N_HDR];
 
     g.msg_file = dlb_fopen(QTEXT_FILE, RDBMODE);
     if (!g.msg_file)
@@ -109,9 +103,9 @@ load_qtlist()
      * each header.
      */
 
-    Fread(&n_classes, sizeof (int32_t), 1, g.msg_file);
+    Fread(&n_classes, sizeof (int), 1, g.msg_file);
     Fread(&qt_classes[0][0], sizeof (char) * LEN_HDR, n_classes, g.msg_file);
-    Fread(qt_offsets, sizeof (QTOFFSIZ), n_classes, g.msg_file);
+    Fread(qt_offsets, sizeof (long), n_classes, g.msg_file);
 
     /*
      * Now construct the message lists for quick reference later
@@ -313,7 +307,7 @@ char who,  /* 'd' => deity, 'l' => leader, 'n' => nemesis, 'o' => artifact */
 static struct qtmsg *
 msg_in(qtm_list, msgnum)
 struct qtmsg *qtm_list;
-int32_t msgnum;
+int msgnum;
 {
     struct qtmsg *qt_msg;
 
@@ -528,9 +522,9 @@ struct qtmsg *qt_msg;
 static void
 deliver_by_window(qt_msg, how)
 struct qtmsg *qt_msg;
-int32_t how;
+int how;
 {
-    QTOFFSIZ size;
+    long size;
     char in_line[BUFSZ], out_line[BUFSZ];
     boolean qtdump = (how == NHW_MAP);
     winid datawin = create_nhwindow(qtdump ? NHW_TEXT : how);
@@ -548,7 +542,7 @@ int32_t how;
         putstr(datawin, 0, "");
     }
 #endif
-    for (size = 0; size < qt_msg->size; size += (QTOFFSIZ) strlen(in_line)) {
+    for (size = 0; size < qt_msg->size; size += (long) strlen(in_line)) {
         (void) dlb_fgets(in_line, sizeof in_line, g.msg_file);
         convert_line(in_line, out_line);
         putstr(datawin, 0, out_line);
@@ -606,7 +600,7 @@ int msgnum;
         return;
     }
 
-    (void) dlb_fseek(g.msg_file, LONGCAST qt_msg->offset, SEEK_SET);
+    (void) dlb_fseek(g.msg_file, qt_msg->offset, SEEK_SET);
     if (qt_msg->delivery == 'p')
         deliver_by_pline(qt_msg);
     else if (msgnum == 1)
@@ -641,7 +635,7 @@ int msgnum;
         return;
     }
 
-    (void) dlb_fseek(g.msg_file, LONGCAST qt_msg->offset, SEEK_SET);
+    (void) dlb_fseek(g.msg_file, qt_msg->offset, SEEK_SET);
     if (qt_msg->delivery == 'p' && strcmp(windowprocs.name, "X11"))
         deliver_by_pline(qt_msg);
     else
index 5dfd5a0cb5fd7f8fc0076150bd2c6eba0c360907..c6a7a8cb44e736499c559c5538080ad103ea2a2d 100644 (file)
@@ -22,7 +22,6 @@
 #include "context.h"
 #include "flag.h"
 #include "dlb.h"
-#include "integer.h"
 
 /* version information */
 #ifdef SHORT_FILENAMES
@@ -2089,7 +2088,7 @@ static void
 adjust_qt_hdrs()
 {
     int i, j;
-    QTOFFSIZ count = 0L, hdr_offset = sizeof(int)
+    long count = 0L, hdr_offset = sizeof(int)
                                   + (sizeof(char) * LEN_HDR + sizeof(long))
                                         * qt_hdr.n_hdr;
 
@@ -2124,15 +2123,7 @@ put_qt_hdrs()
                   qt_hdr.n_hdr, ofp);
     if (debug) {
         for (i = 0; i < qt_hdr.n_hdr; i++)
-#if (QT_PREPROC == 64)
-#ifdef WIN32
-            Fprintf(stderr, "%s @ %I64d, ", qt_hdr.id[i], qt_hdr.offset[i]);
-#else
-            Fprintf(stderr, "%s @ %I64ld, ", qt_hdr.id[i], qt_hdr.offset[i]);
-#endif
-#else
             Fprintf(stderr, "%s @ %ld, ", qt_hdr.id[i], qt_hdr.offset[i]);
-#endif
         Fprintf(stderr, "\n");
     }
 
@@ -2151,28 +2142,12 @@ put_qt_hdrs()
             int j;
 
             for (j = 0; j < msg_hdr[i].n_msg; j++) {
-#if (QT_PREPROC == 64)
-#ifdef WIN32
-                Fprintf(stderr, "msg %d @ %I64d (%I64d)",
-#else
-                Fprintf(stderr, "msg %d @ %I64ld (%I64ld)",
-#endif
-#else
                 Fprintf(stderr, "msg %d @ %ld (%ld)",
-#endif
                         msg_hdr[i].qt_msg[j].msgnum,
                         msg_hdr[i].qt_msg[j].offset,
                         msg_hdr[i].qt_msg[j].size);
                 if (msg_hdr[i].qt_msg[j].summary_size)
-#if (QT_PREPROC == 64)
-#ifdef WIN32
-                    Fprintf(stderr, " [%I64d]",
-#else
-                    Fprintf(stderr, " [%I64ld]",
-#endif
-#else
                     Fprintf(stderr, " [%ld]",
-#endif
                             msg_hdr[i].qt_msg[j].summary_size);
                 Fprintf(stderr, "\n");
             }