t_fseeko64.c uses wide char functions for just 7-bit ASCII string.
This is not needed and non-wide functions can be used too.

crtdll.dll does not have _wfopen() and _wtempnam() functions, so this test
cannot be currently compiled for crtdll.dll.

Switch wide functions to non-wide functions and allow compiling this test.

With this change, the t_fseeko64 test is passing also for crtdll.dll and
msvcrt10.dll builds.
---
 mingw-w64-crt/testcases/t_fseeko64.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/mingw-w64-crt/testcases/t_fseeko64.c 
b/mingw-w64-crt/testcases/t_fseeko64.c
index 33aed99f9377..234c101b2ba4 100644
--- a/mingw-w64-crt/testcases/t_fseeko64.c
+++ b/mingw-w64-crt/testcases/t_fseeko64.c
@@ -6,15 +6,15 @@
 #include <shlobj.h>
 
 static const char *writebuf = "TESTVECTORSTRING";
-static wchar_t szPath[MAX_PATH];
+static char szPath[MAX_PATH];
 
-static int writefile(wchar_t *path){
+static int writefile(const char *path){
   OVERLAPPED ov;
   DWORD dwResult;
   memset(&ov,0,sizeof(OVERLAPPED));
   ov.Offset = 0x0;
   ov.OffsetHigh = 0x1;
-  HANDLE fd = CreateFileW(path,GENERIC_READ | GENERIC_WRITE, 0, NULL, 
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+  HANDLE fd = CreateFileA(path,GENERIC_READ | GENERIC_WRITE, 0, NULL, 
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
   if (fd == INVALID_HANDLE_VALUE) return 1;
   SetFilePointer (fd, ov.Offset, &ov.OffsetHigh, FILE_BEGIN);
   WriteFile(fd, writebuf, strlen(writebuf), &dwResult, NULL);
@@ -27,7 +27,7 @@ static int writefile(wchar_t *path){
   return 0;
 }
 
-static int testread(wchar_t *path){
+static int testread(const char *path){
   FILE *fd;
   char *readbuff;
   int ret;
@@ -35,7 +35,7 @@ static int testread(wchar_t *path){
   readbuff = calloc(sizeof(char),strlen(writebuf) + 1);
   if (!readbuff) return 1;
 
-  fd = _wfopen(path, L"r+bc");
+  fd = fopen(path, "r+bc");
   if (!fd) {
     printf("fopen failed\n");
     free(readbuff);
@@ -65,11 +65,11 @@ static int testread(wchar_t *path){
 
 int main(int argc, char **argv){
   int check;
-  wchar_t *path;
-  SHGetFolderPathW(NULL,CSIDL_PERSONAL,NULL,0,szPath);
-  path = _wtempnam(szPath, L"mingw-w64-lfs64-test-");
+  char *path;
+  SHGetFolderPathA(NULL,CSIDL_PERSONAL,NULL,0,szPath);
+  path = tempnam(szPath, "mingw-w64-lfs64-test-");
 #ifdef debugtest
-  wprintf(L"Path: %ls\n", path);
+  printf("Path: %s\n", path);
 #endif
   if (!path) return 1;
 
@@ -79,7 +79,7 @@ int main(int argc, char **argv){
 
   err:
 #ifndef debugtest
-  DeleteFileW(path); /* Delete anyway */
+  DeleteFileA(path); /* Delete anyway */
 #endif
   free(path);
   printf ("check: %d\n", check);
-- 
2.20.1



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

Reply via email to