[Scummvm-git-logs] scummvm master -> 4fdd1f7cc039c1b9c8f2df2eb4b4691f09d6453b

bluegr noreply at scummvm.org
Mon Jan 8 14:23:04 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4fdd1f7cc0 CONFIGURE: Check if fopen64 is available before using it


Commit: 4fdd1f7cc039c1b9c8f2df2eb4b4691f09d6453b
    https://github.com/scummvm/scummvm/commit/4fdd1f7cc039c1b9c8f2df2eb4b4691f09d6453b
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2024-01-08T16:23:00+02:00

Commit Message:
CONFIGURE: Check if fopen64 is available before using it

Changed paths:
    backends/fs/posix/posix-iostream.cpp
    backends/fs/stdiostream.cpp
    configure


diff --git a/backends/fs/posix/posix-iostream.cpp b/backends/fs/posix/posix-iostream.cpp
index 41f625d8a86..bf70c0ecdbd 100644
--- a/backends/fs/posix/posix-iostream.cpp
+++ b/backends/fs/posix/posix-iostream.cpp
@@ -26,7 +26,7 @@
 #include <sys/stat.h>
 
 PosixIoStream *PosixIoStream::makeFromPath(const Common::String &path, bool writeMode) {
-#if defined(HAS_FSEEKO64)
+#if defined(HAS_FOPEN64)
 	FILE *handle = fopen64(path.c_str(), writeMode ? "wb" : "rb");
 #else
 	FILE *handle = fopen(path.c_str(), writeMode ? "wb" : "rb");
diff --git a/backends/fs/stdiostream.cpp b/backends/fs/stdiostream.cpp
index c24de4f6725..1f76cada6b4 100644
--- a/backends/fs/stdiostream.cpp
+++ b/backends/fs/stdiostream.cpp
@@ -129,7 +129,7 @@ StdioStream *StdioStream::makeFromPath(const Common::String &path, bool writeMod
 	wchar_t *wPath = Win32::stringToTchar(path);
 	FILE *handle = _wfopen(wPath, writeMode ? L"wb" : L"rb");
 	free(wPath);
-#elif defined(HAS_FSEEKO64)
+#elif defined(HAS_FOPEN64)
 	FILE *handle = fopen64(path.c_str(), writeMode ? "wb" : "rb");
 #else
 	FILE *handle = fopen(path.c_str(), writeMode ? "wb" : "rb");
diff --git a/configure b/configure
index 6b6a280211c..a409d01c90c 100755
--- a/configure
+++ b/configure
@@ -270,6 +270,7 @@ _posix=no
 _has_posix_spawn=no
 _has_fseeko_offt_64=no
 _has_fseeko64=no
+_has_fopen64=no
 _endian=unknown
 _need_memalign=yes
 _have_x86=no
@@ -4711,6 +4712,18 @@ EOF
 				if test "$_has_fseeko64" = yes ; then
 					append_var DEFINES "-DHAS_FSEEKO64"
 					append_var CXXFLAGS "-D_LARGEFILE64_SOURCE"
+
+					# On some platforms, fopen64 is required in addition to fseeko64/ftello64
+					echo_n "Checking if fopen64 is supported... "
+					cat > $TMPC << EOF
+#include <stdio.h>
+int main() { FILE *f = fopen64("file", "rb"); return (f != NULL); }
+EOF
+					cc_check_no_clean && _has_fopen64=yes
+					echo $_has_fopen64
+					if test "$_has_fopen64" = yes ; then
+						append_var DEFINES "-DHAS_FOPEN64"
+					fi
 				fi
 			fi
 		fi




More information about the Scummvm-git-logs mailing list