msvcrt: Added _fwrite_nolock() implementation.

This commit is contained in:
Iván Matellanes 2014-10-09 19:51:59 +02:00 committed by Alexandre Julliard
parent 206ea48f20
commit 25d7a1bbbf
7 changed files with 20 additions and 7 deletions

View File

@ -863,7 +863,7 @@
@ stub _fwprintf_p
@ stub _fwprintf_p_l
@ stub _fwprintf_s_l
@ stub _fwrite_nolock
@ cdecl _fwrite_nolock(ptr long long ptr) MSVCRT__fwrite_nolock
@ varargs _fwscanf_l(ptr wstr ptr) MSVCRT__fwscanf_l
@ varargs _fwscanf_s_l(ptr wstr ptr) MSVCRT__fwscanf_s_l
@ cdecl _gcvt(double long str) MSVCRT__gcvt

View File

@ -1211,7 +1211,7 @@
@ stub _fwprintf_p
@ stub _fwprintf_p_l
@ stub _fwprintf_s_l
@ stub _fwrite_nolock
@ cdecl _fwrite_nolock(ptr long long ptr) MSVCRT__fwrite_nolock
@ varargs _fwscanf_l(ptr wstr ptr) MSVCRT__fwscanf_l
@ varargs _fwscanf_s_l(ptr wstr ptr) MSVCRT__fwscanf_s_l
@ cdecl _gcvt(double long str) MSVCRT__gcvt

View File

@ -530,7 +530,7 @@
@ stub _fwprintf_p
@ stub _fwprintf_p_l
@ stub _fwprintf_s_l
@ stub _fwrite_nolock
@ cdecl _fwrite_nolock(ptr long long ptr) MSVCRT__fwrite_nolock
@ varargs _fwscanf_l(ptr wstr ptr) MSVCRT__fwscanf_l
@ varargs _fwscanf_s_l(ptr wstr ptr) MSVCRT__fwscanf_s_l
@ cdecl _gcvt(double long str) MSVCRT__gcvt

View File

@ -512,7 +512,7 @@
@ stub _fwprintf_p
@ stub _fwprintf_p_l
@ stub _fwprintf_s_l
@ stub _fwrite_nolock
@ cdecl _fwrite_nolock(ptr long long ptr) MSVCRT__fwrite_nolock
@ varargs _fwscanf_l(ptr wstr ptr) MSVCRT__fwscanf_l
@ varargs _fwscanf_s_l(ptr wstr ptr) MSVCRT__fwscanf_s_l
@ cdecl _gcvt(double long str) MSVCRT__gcvt

View File

@ -3706,14 +3706,26 @@ int CDECL MSVCRT__flsbuf(int c, MSVCRT_FILE* file)
* fwrite (MSVCRT.@)
*/
MSVCRT_size_t CDECL MSVCRT_fwrite(const void *ptr, MSVCRT_size_t size, MSVCRT_size_t nmemb, MSVCRT_FILE* file)
{
int ret;
MSVCRT__lock_file(file);
ret = MSVCRT__fwrite_nolock(ptr, size, nmemb, file);
MSVCRT__unlock_file(file);
return ret;
}
/*********************************************************************
* _fwrite_nolock (MSVCRT.@)
*/
MSVCRT_size_t CDECL MSVCRT__fwrite_nolock(const void *ptr, MSVCRT_size_t size, MSVCRT_size_t nmemb, MSVCRT_FILE* file)
{
MSVCRT_size_t wrcnt=size * nmemb;
int written = 0;
if (size == 0)
return 0;
MSVCRT__lock_file(file);
while(wrcnt) {
if(file->_cnt < 0) {
WARN("negative file->_cnt value in %p\n", file);
@ -3761,7 +3773,6 @@ MSVCRT_size_t CDECL MSVCRT_fwrite(const void *ptr, MSVCRT_size_t size, MSVCRT_si
}
}
MSVCRT__unlock_file(file);
return written / size;
}

View File

@ -926,6 +926,7 @@ MSVCRT_ulong* __cdecl MSVCRT___doserrno(void);
int* __cdecl MSVCRT__errno(void);
char* __cdecl MSVCRT_getenv(const char*);
MSVCRT_size_t __cdecl MSVCRT__fread_nolock(void*,MSVCRT_size_t,MSVCRT_size_t,MSVCRT_FILE*);
MSVCRT_size_t __cdecl MSVCRT__fwrite_nolock(const void*,MSVCRT_size_t,MSVCRT_size_t,MSVCRT_FILE*);
int __cdecl MSVCRT_fclose(MSVCRT_FILE*);
int __cdecl MSVCRT__fclose_nolock(MSVCRT_FILE*);
void __cdecl MSVCRT_terminate(void);

View File

@ -128,6 +128,7 @@ int __cdecl _vsnprintf_s(char*,size_t,size_t,const char*,__ms_va_list);
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*);
void __cdecl clearerr(FILE*);