From 5077d8c1371fe3e8e263119a6cc05d0e9766cdba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Matellanes?= Date: Wed, 15 Oct 2014 16:47:07 +0200 Subject: [PATCH] msvcrt: Added _fseeki64_nolock implementation. --- dlls/msvcr100/msvcr100.spec | 2 +- dlls/msvcr110/msvcr110.spec | 2 +- dlls/msvcr80/msvcr80.spec | 2 +- dlls/msvcr90/msvcr90.spec | 2 +- dlls/msvcrt/file.c | 18 +++++++++++++++--- dlls/msvcrt/msvcrt.h | 1 + include/msvcrt/stdio.h | 1 + 7 files changed, 21 insertions(+), 7 deletions(-) diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index 50e2420c751..280d1886266 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -842,7 +842,7 @@ @ varargs _fscanf_s_l(ptr str ptr) MSVCRT__fscanf_s_l @ stub _fseek_nolock @ cdecl _fseeki64(ptr int64 long) MSVCRT__fseeki64 -@ stub _fseeki64_nolock +@ cdecl _fseeki64_nolock(ptr int64 long) MSVCRT__fseeki64_nolock @ cdecl _fsopen(str str long) MSVCRT__fsopen @ cdecl _fstat32(long ptr) MSVCRT__fstat32 @ stub _fstat32i64 diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index f2d2f30fec1..5b74e9ccfef 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -1190,7 +1190,7 @@ @ varargs _fscanf_s_l(ptr str ptr) MSVCRT__fscanf_s_l @ stub _fseek_nolock @ cdecl _fseeki64(ptr int64 long) MSVCRT__fseeki64 -@ stub _fseeki64_nolock +@ cdecl _fseeki64_nolock(ptr int64 long) MSVCRT__fseeki64_nolock @ cdecl _fsopen(str str long) MSVCRT__fsopen @ cdecl _fstat32(long ptr) MSVCRT__fstat32 @ stub _fstat32i64 diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 77a03c485b0..9d695cd39b8 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -509,7 +509,7 @@ @ varargs _fscanf_s_l(ptr str ptr) MSVCRT__fscanf_s_l @ stub _fseek_nolock @ cdecl _fseeki64(ptr int64 long) MSVCRT__fseeki64 -@ stub _fseeki64_nolock +@ cdecl _fseeki64_nolock(ptr int64 long) MSVCRT__fseeki64_nolock @ cdecl _fsopen(str str long) MSVCRT__fsopen @ cdecl _fstat32(long ptr) MSVCRT__fstat32 @ stub _fstat32i64 diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 59fba3dc72d..45ea0f98a9c 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -491,7 +491,7 @@ @ varargs _fscanf_s_l(ptr str ptr) MSVCRT__fscanf_s_l @ stub _fseek_nolock @ cdecl _fseeki64(ptr int64 long) MSVCRT__fseeki64 -@ stub _fseeki64_nolock +@ cdecl _fseeki64_nolock(ptr int64 long) MSVCRT__fseeki64_nolock @ cdecl _fsopen(str str long) MSVCRT__fsopen @ cdecl _fstat32(long ptr) MSVCRT__fstat32 @ stub _fstat32i64 diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 49cb14d8d9f..9f7da57ce9f 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -1245,17 +1245,30 @@ int CDECL MSVCRT__locking(int fd, int mode, LONG nbytes) * _fseeki64 (MSVCRT.@) */ int CDECL MSVCRT__fseeki64(MSVCRT_FILE* file, __int64 offset, int whence) +{ + int ret; + + MSVCRT__lock_file(file); + ret = MSVCRT__fseeki64_nolock(file, offset, whence); + MSVCRT__unlock_file(file); + + return ret; +} + +/********************************************************************* + * _fseeki64_nolock (MSVCRT.@) + */ +int CDECL MSVCRT__fseeki64_nolock(MSVCRT_FILE* file, __int64 offset, int whence) { int ret; - MSVCRT__lock_file(file); /* Flush output if needed */ if(file->_flag & MSVCRT__IOWRT) msvcrt_flush_buffer(file); if(whence == SEEK_CUR && file->_flag & MSVCRT__IOREAD ) { whence = SEEK_SET; - offset += MSVCRT__ftelli64(file); + offset += MSVCRT__ftelli64_nolock(file); } /* Discard buffered input */ @@ -1269,7 +1282,6 @@ int CDECL MSVCRT__fseeki64(MSVCRT_FILE* file, __int64 offset, int whence) file->_flag &= ~MSVCRT__IOEOF; ret = (MSVCRT__lseeki64(file->_file,offset,whence) == -1)?-1:0; - MSVCRT__unlock_file(file); return ret; } diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index 41f36320caa..85484bc069f 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -919,6 +919,7 @@ int __cdecl MSVCRT_fgetc(MSVCRT_FILE*); int __cdecl MSVCRT_ungetc(int,MSVCRT_FILE*); MSVCRT_wint_t __cdecl MSVCRT_fgetwc(MSVCRT_FILE*); MSVCRT_wint_t __cdecl MSVCRT_ungetwc(MSVCRT_wint_t,MSVCRT_FILE*); +int __cdecl MSVCRT__fseeki64_nolock(MSVCRT_FILE*,__int64,int); __int64 __cdecl MSVCRT__ftelli64(MSVCRT_FILE* file); __int64 __cdecl MSVCRT__ftelli64_nolock(MSVCRT_FILE*); void __cdecl MSVCRT__exit(int); diff --git a/include/msvcrt/stdio.h b/include/msvcrt/stdio.h index dbe92311d01..1e816cec33e 100644 --- a/include/msvcrt/stdio.h +++ b/include/msvcrt/stdio.h @@ -130,6 +130,7 @@ int __cdecl _vsprintf_p_l(char*,size_t,const char*,_locale_t,__ms_va_list); size_t __cdecl _fread_nolock(void*,size_t,size_t,FILE*); size_t __cdecl _fwrite_nolock(const void*,size_t,size_t,FILE*); int __cdecl _fclose_nolock(FILE*); +int __cdecl _fseeki64_nolock(FILE*,__int64,int); __msvcrt_long __cdecl _ftell_nolock(FILE*); __int64 __cdecl _ftelli64_nolock(FILE*);