On Mon, 20 Oct 2025, Pali Rohár wrote:

On Monday 20 October 2025 15:13:27 Martin Storsjö wrote:
On Sun, 5 Oct 2025, Pali Rohár wrote:

diff --git a/mingw-w64-crt/stdio/ftruncate64.c 
b/mingw-w64-crt/stdio/mingw_ftruncate64.c
similarity index 98%
rename from mingw-w64-crt/stdio/ftruncate64.c
rename to mingw-w64-crt/stdio/mingw_ftruncate64.c
index ab50ad763fed..57a6b8476261 100644
--- a/mingw-w64-crt/stdio/ftruncate64.c
+++ b/mingw-w64-crt/stdio/mingw_ftruncate64.c
@@ -239,7 +239,7 @@ checkfreespace (const HANDLE f, const ULONGLONG 
requiredspace)
  return 0;
}

-int ftruncate64(int __fd, _off64_t __length) {
+int __cdecl __mingw_ftruncate64(int __fd, _off64_t __length) {
  HANDLE f;
  LARGE_INTEGER quad;
  DWORD check;
@@ -306,6 +306,10 @@ int ftruncate64(int __fd, _off64_t __length) {
  return -1;
}

+#ifdef TEST_FTRUNCATE64
+#define ftruncate64 __mingw_ftruncate64
+#endif
+
#if (TEST_FTRUNCATE64 == 1)

Why is this a separate "#ifdef" block above, why not just add the #define
into the existing block?

// Martin

There is:

#if (TEST_FTRUNCATE64 == 1)
/* ftruncate64() call */
#endif

#if (TEST_FTRUNCATE64 == 2)
/* ftruncate64() call */
#endif

#if (TEST_FTRUNCATE64 == 3)
/* ftruncate64() call */
#endif

And the "#define ftruncate64" is needed for all 3 test cases to ensure
that every test case would call that __mingw_ftruncate64 implementation.

Therefore I added above #ifdef TEST_FTRUNCATE64 which will cover all 3 test 
cases.

Ah, I see - ok, that sounds reasonable.

// Martin

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to