MSVCRT: Correct return value of fsetpos

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Sun May 15 17:40:03 CDT 2005


Changelog
	 wine/dlls/msvcrt/file.c: fsetpos
	 Correct return value and test case

This lest the MINGW compiled WinAVR avr-gcc produce output for the -c
option.

-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/msvcrt/file.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/file.c,v
retrieving revision 1.85
diff -u -r1.85 file.c
--- wine/dlls/msvcrt/file.c	12 May 2005 09:55:02 -0000	1.85
+++ wine/dlls/msvcrt/file.c	15 May 2005 22:24:11 -0000
@@ -2570,7 +2570,7 @@
         file->_flag &= ~(MSVCRT__IOREAD|MSVCRT__IOWRT);
   }
 
-  return _lseeki64(file->_file,*pos,SEEK_SET);
+  return (_lseeki64(file->_file,*pos,SEEK_SET)== -1)?-1:0;
 }
 
 /*********************************************************************
Index: wine/dlls/msvcrt/tests/file.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/tests/file.c,v
retrieving revision 1.14
diff -u -r1.14 file.c
--- wine/dlls/msvcrt/tests/file.c	31 Mar 2005 19:06:10 -0000	1.14
+++ wine/dlls/msvcrt/tests/file.c	15 May 2005 22:24:11 -0000
@@ -58,6 +58,7 @@
     WCHAR wbuffer[256];
     int fd;
     FILE *file;
+    fpos_t pos;
 
     fd = open ("fdopen.tst", O_WRONLY | O_CREAT | O_BINARY, _S_IREAD |_S_IWRITE);
     write (fd, outbuffer, sizeof (outbuffer));
@@ -75,6 +76,15 @@
     ok(fgets(buffer,sizeof(outbuffer),file) !=0,"fgets failed unexpected\n");
     ok(strlen(buffer) == 1,"fgets dropped chars\n");
     ok(buffer[0] == outbuffer[strlen(outbuffer)-1],"fgets exchanged chars\n");
+
+    rewind(file);
+    ok(fgetpos(file,&pos) == 0, "fgetpos failed unexpected\n");
+    ok(pos == 0, "Unexpected result of fgetpos 0x%Lx\n", pos);
+    pos = (ULONGLONG)sizeof (outbuffer);
+    ok(fsetpos(file, &pos) == 0, "fsetpos failed unexpected\n");
+    ok(fgetpos(file,&pos) == 0, "fgetpos failed unexpected\n");
+    ok(pos == (ULONGLONG)sizeof (outbuffer), "Unexpected result of fgetpos 0x%Lx\n", pos);
+
     fclose (file);
     fd = open ("fdopen.tst", O_RDONLY | O_TEXT);
     file = fdopen (fd, "rt"); /* open in TEXT mode */



More information about the wine-patches mailing list