在 2025-12-5 01:54, Pali Rohár 写道:
If the file pointer is represented as a `LARGE_INTEGER`, it's probably better to call `SetFilePointerEx()`.I let the call as is. Just wanted to fix the compile warning. And probably the Ex variant requires some minimal Windows version.
Yes, Windows 2003 SDK doc says it requires Windows 2000, but it avoids the complexity. Does the attached patch look good to you?
diff --git a/mingw-w64-crt/testcases/t_fseeko64.c
b/mingw-w64-crt/testcases/t_fseeko64.c
index 7ca96ecf2..23872d1d9 100644
--- a/mingw-w64-crt/testcases/t_fseeko64.c
+++ b/mingw-w64-crt/testcases/t_fseeko64.c
@@ -8,14 +8,11 @@ static const char *writebuf = "TESTVECTORSTRING";
static char szPath[MAX_PATH];
static int writefile(const char *path){
- OVERLAPPED ov;
+ LARGE_INTEGER li = { .QuadPart = 0x100000000 };
DWORD dwResult;
- memset(&ov,0,sizeof(OVERLAPPED));
- ov.Offset = 0x0;
- ov.OffsetHigh = 0x1;
HANDLE fd = CreateFileA(path,GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
if (fd == INVALID_HANDLE_VALUE) return 1;- if (SetFilePointer(fd, ov.Offset, &ov.OffsetHigh, FILE_BEGIN) == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) {
+ if (!SetFilePointerEx(fd, li, NULL, FILE_BEGIN)) {
printf("writefile: seek failed: winerror=%lu\n", GetLastError());
CloseHandle(fd);
return 1;
--
Best regards,
LIU Hao
From bf9144328de4bcadc7ffe6cfe3ab805157b3ebb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]> Date: Mon, 24 Nov 2025 18:48:49 +0100 Subject: [PATCH] =?UTF-8?q?crt:=20test:=20t=5Ffseeko64:=20Fix=20compile=20?= =?UTF-8?q?warning:=20pointer=20targets=20in=20passing=20argument=203=20of?= =?UTF-8?q?=20=E2=80=98SetFilePointer=E2=80=99=20differ=20in=20signedness?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead, call `SetFilePointerEx()` and pass the file offset as a LARGE_INTEGER. Co-authored-by: LIU Hao <[email protected]> Signed-off-by: LIU Hao <[email protected]> --- mingw-w64-crt/testcases/t_fseeko64.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mingw-w64-crt/testcases/t_fseeko64.c b/mingw-w64-crt/testcases/t_fseeko64.c index 7ca96ecf2..23872d1d9 100644 --- a/mingw-w64-crt/testcases/t_fseeko64.c +++ b/mingw-w64-crt/testcases/t_fseeko64.c @@ -8,14 +8,11 @@ static const char *writebuf = "TESTVECTORSTRING"; static char szPath[MAX_PATH]; static int writefile(const char *path){ - OVERLAPPED ov; + LARGE_INTEGER li = { .QuadPart = 0x100000000 }; DWORD dwResult; - memset(&ov,0,sizeof(OVERLAPPED)); - ov.Offset = 0x0; - ov.OffsetHigh = 0x1; HANDLE fd = CreateFileA(path,GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (fd == INVALID_HANDLE_VALUE) return 1; - if (SetFilePointer(fd, ov.Offset, &ov.OffsetHigh, FILE_BEGIN) == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) { + if (!SetFilePointerEx(fd, li, NULL, FILE_BEGIN)) { printf("writefile: seek failed: winerror=%lu\n", GetLastError()); CloseHandle(fd); return 1; -- 2.52.0
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
