ext-array: Use fseeko64 instead of fseeko, if available.
authorBen Pfaff <blp@cs.stanford.edu>
Thu, 5 Jun 2025 20:18:02 +0000 (13:18 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Thu, 5 Jun 2025 20:18:02 +0000 (13:18 -0700)
configure.ac
src/libpspp/ext-array.c

index 40c972d884c399dc571288461a67e1d39c9b71c5..74224b7d2236e7b34c643d9b5848b7c553a361c8 100644 (file)
@@ -293,7 +293,7 @@ AC_C_INLINE
 
 AC_C_BIGENDIAN
 
-AC_CHECK_FUNCS([__setfpucw fork execl isinf isnan finite getpid feholdexcept fpsetmask popen round])
+AC_CHECK_FUNCS([__setfpucw fork execl isinf isnan finite getpid feholdexcept fpsetmask popen round fseeko64])
 
 AC_PROG_LN_S
 
index c03d0c23c01b42cb136467c47f031e6218f85ac9..bb8b91ea2110170dac1607067e297e634c6bbda4 100644 (file)
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
 
+/* fseeko() doesn't work properly on Mingw despite Gnulib, but fseeko64() does,
+   according to Egbert van der Es:
+
+   https://lists.gnu.org/archive/html/bug-gnu-pspp/2025-05/msg00007.html
+   https://lists.gnu.org/archive/html/bug-gnu-pspp/2025-06/msg00001.html
+   https://lists.gnu.org/archive/html/bug-gnu-pspp/2025-06/msg00002.html */
+#if !HAVE_FSEEKO64
+#define fseeko64 fseeko
+#endif
+
 enum op
   {
     OP_WRITE, /* writing */
@@ -97,7 +107,7 @@ do_seek (const struct ext_array *ea_, off_t offset, enum op op)
     {
       if (ea->position == offset && ea->op == op)
         return true;
-      else if (fseeko (ea->file, offset, SEEK_SET) == 0)
+      else if (fseeko64 (ea->file, offset, SEEK_SET) == 0)
         {
           ea->position = offset;
           return true;