msvcr: Implemented _chsize_s

Andrey Zhezherun zhezherun at yandex.ru
Sun Nov 3 08:48:32 CST 2013


On 1 November 2013 09:37, Piotr Caban <piotr.caban at gmail.com> wrote:
> On 11/01/13 00:40, Andrey Zhezherun wrote:
>> +__int64     __cdecl _chsize_s(int,__int64);
> There should be int (or errno_t) instead of __int64.
Fixed, revised patch is attached.

Regards,
Andrey
-------------- next part --------------
--- wine-1.7.5.orig/dlls/crtdll/crtdll.spec	2013-10-25 18:45:30.000000000 +0100
+++ wine-1.7.5/dlls/crtdll/crtdll.spec	2013-10-30 11:09:56.000000000 +0000
@@ -58,6 +58,7 @@
 @ cdecl _chgsign(double) msvcrt._chgsign
 @ cdecl _chmod(str long) msvcrt._chmod
 @ cdecl _chsize(long long) msvcrt._chsize
+@ cdecl _chsize_s(long int64) msvcrt._chsize_s
 @ cdecl _clearfp() msvcrt._clearfp
 @ cdecl _close(long) msvcrt._close
 @ cdecl _commit(long) msvcrt._commit
--- wine-1.7.5.orig/dlls/msvcr100/msvcr100.spec	2013-10-25 18:45:30.000000000 +0100
+++ wine-1.7.5/dlls/msvcr100/msvcr100.spec	2013-10-30 11:09:56.000000000 +0000
@@ -725,7 +725,7 @@
 @ cdecl -arch=i386 -norelay _chkesp() msvcrt._chkesp
 @ cdecl _chmod(str long) msvcrt._chmod
 @ cdecl _chsize(long long) msvcrt._chsize
-@ stub _chsize_s
+@ cdecl _chsize_s(long int64) msvcrt._chsize_s
 @ cdecl _clearfp() msvcrt._clearfp
 @ cdecl _close(long) msvcrt._close
 @ cdecl _commit(long) msvcrt._commit
--- wine-1.7.5.orig/dlls/msvcr110/msvcr110.spec	2013-10-25 18:45:30.000000000 +0100
+++ wine-1.7.5/dlls/msvcr110/msvcr110.spec	2013-10-30 11:09:56.000000000 +0000
@@ -1073,7 +1073,7 @@
 @ cdecl -arch=i386 -norelay _chkesp() msvcrt._chkesp
 @ cdecl _chmod(str long) msvcrt._chmod
 @ cdecl _chsize(long long) msvcrt._chsize
-@ stub _chsize_s
+@ cdecl _chsize_s(long int64) msvcrt._chsize_s
 @ cdecl _clearfp() msvcrt._clearfp
 @ cdecl _close(long) msvcrt._close
 @ cdecl _commit(long) msvcrt._commit
--- wine-1.7.5.orig/dlls/msvcr70/msvcr70.spec	2013-10-25 18:45:30.000000000 +0100
+++ wine-1.7.5/dlls/msvcr70/msvcr70.spec	2013-10-30 11:09:56.000000000 +0000
@@ -252,6 +252,7 @@
 @ cdecl -arch=i386 -norelay _chkesp() msvcrt._chkesp
 @ cdecl _chmod(str long) msvcrt._chmod
 @ cdecl _chsize(long long) msvcrt._chsize
+@ cdecl _chsize_s(long int64) msvcrt._chsize_s
 @ cdecl _clearfp() msvcrt._clearfp
 @ cdecl _close(long) msvcrt._close
 @ cdecl _commit(long) msvcrt._commit
--- wine-1.7.5.orig/dlls/msvcr71/msvcr71.spec	2013-10-25 18:45:30.000000000 +0100
+++ wine-1.7.5/dlls/msvcr71/msvcr71.spec	2013-10-30 11:09:56.000000000 +0000
@@ -247,6 +247,7 @@
 @ cdecl -arch=i386 -norelay _chkesp() msvcrt._chkesp
 @ cdecl _chmod(str long) msvcrt._chmod
 @ cdecl _chsize(long long) msvcrt._chsize
+@ cdecl _chsize_s(long int64) msvcrt._chsize_s
 @ cdecl _clearfp() msvcrt._clearfp
 @ cdecl _close(long) msvcrt._close
 @ cdecl _commit(long) msvcrt._commit
--- wine-1.7.5.orig/dlls/msvcr80/msvcr80.spec	2013-10-25 18:45:30.000000000 +0100
+++ wine-1.7.5/dlls/msvcr80/msvcr80.spec	2013-10-30 11:09:56.000000000 +0000
@@ -389,7 +389,7 @@
 @ cdecl -arch=i386 -norelay _chkesp() msvcrt._chkesp
 @ cdecl _chmod(str long) msvcrt._chmod
 @ cdecl _chsize(long long) msvcrt._chsize
-@ stub _chsize_s
+@ cdecl _chsize_s(long int64) msvcrt._chsize_s
 @ cdecl _clearfp() msvcrt._clearfp
 @ cdecl _close(long) msvcrt._close
 @ cdecl _commit(long) msvcrt._commit
--- wine-1.7.5.orig/dlls/msvcr90/msvcr90.spec	2013-10-25 18:45:30.000000000 +0100
+++ wine-1.7.5/dlls/msvcr90/msvcr90.spec	2013-10-30 11:09:56.000000000 +0000
@@ -372,7 +372,7 @@
 @ cdecl -arch=i386 -norelay _chkesp() msvcrt._chkesp
 @ cdecl _chmod(str long) msvcrt._chmod
 @ cdecl _chsize(long long) msvcrt._chsize
-@ stub _chsize_s
+@ cdecl _chsize_s(long int64) msvcrt._chsize_s
 @ cdecl _clearfp() msvcrt._clearfp
 @ cdecl _close(long) msvcrt._close
 @ cdecl _commit(long) msvcrt._commit
--- wine-1.7.5.orig/dlls/msvcrt/file.c	2013-10-25 18:45:30.000000000 +0100
+++ wine-1.7.5/dlls/msvcrt/file.c	2013-10-30 11:09:56.000000000 +0000
@@ -1259,15 +1259,15 @@
 }
 
 /*********************************************************************
- *		_chsize (MSVCRT.@)
+ *		_chsize_s (MSVCRT.@)
  */
-int CDECL MSVCRT__chsize(int fd, MSVCRT_long size)
+int CDECL MSVCRT__chsize_s(int fd, __int64 size)
 {
-    LONG cur, pos;
+    __int64 cur, pos;
     HANDLE handle;
     BOOL ret = FALSE;
 
-    TRACE("(fd=%d, size=%d)\n", fd, size);
+    TRACE("(fd=%d, size=%s)\n", fd, wine_dbgstr_longlong(size));
 
     LOCK_FILES();
 
@@ -1275,10 +1275,10 @@
     if (handle != INVALID_HANDLE_VALUE)
     {
         /* save the current file pointer */
-        cur = MSVCRT__lseek(fd, 0, SEEK_CUR);
+        cur = MSVCRT__lseeki64(fd, 0, SEEK_CUR);
         if (cur >= 0)
         {
-            pos = MSVCRT__lseek(fd, size, SEEK_SET);
+            pos = MSVCRT__lseeki64(fd, size, SEEK_SET);
             if (pos >= 0)
             {
                 ret = SetEndOfFile(handle);
@@ -1286,7 +1286,7 @@
             }
 
             /* restore the file pointer */
-            MSVCRT__lseek(fd, cur, SEEK_SET);
+            MSVCRT__lseeki64(fd, cur, SEEK_SET);
         }
     }
 
@@ -1295,6 +1295,14 @@
 }
 
 /*********************************************************************
+ *		_chsize (MSVCRT.@)
+ */
+int CDECL MSVCRT__chsize(int fd, MSVCRT_long size)
+{
+    return MSVCRT__chsize_s( fd, size );
+}
+
+/*********************************************************************
  *		clearerr (MSVCRT.@)
  */
 void CDECL MSVCRT_clearerr(MSVCRT_FILE* file)
--- wine-1.7.5.orig/dlls/msvcrt/msvcrt.spec	2013-10-25 18:45:30.000000000 +0100
+++ wine-1.7.5/dlls/msvcrt/msvcrt.spec	2013-10-30 11:09:56.000000000 +0000
@@ -356,7 +356,7 @@
 @ cdecl -arch=i386 -norelay _chkesp()
 @ cdecl _chmod(str long) MSVCRT__chmod
 @ cdecl _chsize(long long) MSVCRT__chsize
-# stub _chsize_s(long int64)
+@ cdecl _chsize_s(long int64) MSVCRT__chsize_s
 # stub _chvalidator(long long)
 # stub _chvalidator_l(ptr long long)
 @ cdecl _clearfp()
--- wine-1.7.5.orig/dlls/msvcrt20/msvcrt20.spec	2013-10-25 18:45:30.000000000 +0100
+++ wine-1.7.5/dlls/msvcrt20/msvcrt20.spec	2013-10-30 11:09:56.000000000 +0000
@@ -875,6 +875,7 @@
 @ cdecl _chgsign(double) msvcrt._chgsign
 @ cdecl _chmod(str long) msvcrt._chmod
 @ cdecl _chsize(long long) msvcrt._chsize
+@ cdecl _chsize_s(long int64) msvcrt._chsize_s
 @ cdecl _clearfp() msvcrt._clearfp
 @ cdecl _close(long) msvcrt._close
 @ cdecl _commit(long) msvcrt._commit
--- wine-1.7.5.orig/dlls/msvcrt40/msvcrt40.spec	2013-10-25 18:45:30.000000000 +0100
+++ wine-1.7.5/dlls/msvcrt40/msvcrt40.spec	2013-10-30 11:09:56.000000000 +0000
@@ -957,6 +957,7 @@
 @ cdecl _chgsign(double) msvcrt._chgsign
 @ cdecl _chmod(str long) msvcrt._chmod
 @ cdecl _chsize(long long) msvcrt._chsize
+@ cdecl _chsize_s(long int64) msvcrt._chsize_s
 @ cdecl _clearfp() msvcrt._clearfp
 @ cdecl _close(long) msvcrt._close
 @ cdecl _commit(long) msvcrt._commit
--- wine-1.7.5.orig/dlls/msvcrtd/msvcrtd.spec	2013-10-25 18:45:30.000000000 +0100
+++ wine-1.7.5/dlls/msvcrtd/msvcrtd.spec	2013-10-30 11:09:56.000000000 +0000
@@ -235,6 +235,7 @@
 @ cdecl -arch=i386 -norelay _chkesp() msvcrt._chkesp
 @ cdecl _chmod(str long) msvcrt._chmod
 @ cdecl _chsize(long long) msvcrt._chsize
+@ cdecl _chsize_s(long int64) msvcrt._chsize_s
 @ cdecl _clearfp() msvcrt._clearfp
 @ cdecl _close(long) msvcrt._close
 @ cdecl _commit(long) msvcrt._commit
--- wine-1.7.5.orig/include/msvcrt/io.h	2013-10-25 18:45:30.000000000 +0100
+++ wine-1.7.5/include/msvcrt/io.h	2013-11-01 11:47:34.000000000 +0000
@@ -87,6 +87,7 @@
 int         __cdecl _access(const char*,int);
 int         __cdecl _chmod(const char*,int);
 int         __cdecl _chsize(int,__msvcrt_ulong);
+int         __cdecl _chsize_s(int,__int64);
 int         __cdecl _close(int);
 int         __cdecl _commit(int);
 int         __cdecl _creat(const char*,int);
@@ -148,6 +149,7 @@
 static inline int access(const char* path, int mode) { return _access(path, mode); }
 static inline int chmod(const char* path, int mode) { return _chmod(path, mode); }
 static inline int chsize(int fd, __msvcrt_long size) { return _chsize(fd, size); }
+static inline int chsize_s(int fd, __int64 size) { return _chsize_s(fd, size); }
 static inline int close(int fd) { return _close(fd); }
 static inline int creat(const char* path, int mode) { return _creat(path, mode); }
 static inline int dup(int od) { return _dup(od); }


More information about the wine-devel mailing list