msvcrt: Added _fread_nolock() implementation.
This commit is contained in:
parent
a71f25d239
commit
206ea48f20
|
@ -832,7 +832,7 @@
|
|||
@ cdecl _fputchar(long) MSVCRT__fputchar
|
||||
@ stub _fputwc_nolock
|
||||
@ cdecl _fputwchar(long) MSVCRT__fputwchar
|
||||
@ stub _fread_nolock
|
||||
@ cdecl _fread_nolock(ptr long long ptr) MSVCRT__fread_nolock
|
||||
@ stub _fread_nolock_s
|
||||
@ cdecl _free_locale(ptr) MSVCRT__free_locale
|
||||
@ stub _freea
|
||||
|
|
|
@ -1180,7 +1180,7 @@
|
|||
@ cdecl _fputchar(long) MSVCRT__fputchar
|
||||
@ stub _fputwc_nolock
|
||||
@ cdecl _fputwchar(long) MSVCRT__fputwchar
|
||||
@ stub _fread_nolock
|
||||
@ cdecl _fread_nolock(ptr long long ptr) MSVCRT__fread_nolock
|
||||
@ stub _fread_nolock_s
|
||||
@ cdecl _free_locale(ptr) MSVCRT__free_locale
|
||||
@ stub _freea
|
||||
|
|
|
@ -499,7 +499,7 @@
|
|||
@ cdecl _fputchar(long) MSVCRT__fputchar
|
||||
@ stub _fputwc_nolock
|
||||
@ cdecl _fputwchar(long) MSVCRT__fputwchar
|
||||
@ stub _fread_nolock
|
||||
@ cdecl _fread_nolock(ptr long long ptr) MSVCRT__fread_nolock
|
||||
@ stub _fread_nolock_s
|
||||
@ cdecl _free_locale(ptr) MSVCRT__free_locale
|
||||
@ stub _freea
|
||||
|
|
|
@ -481,7 +481,7 @@
|
|||
@ cdecl _fputchar(long) MSVCRT__fputchar
|
||||
@ stub _fputwc_nolock
|
||||
@ cdecl _fputwchar(long) MSVCRT__fputwchar
|
||||
@ stub _fread_nolock
|
||||
@ cdecl _fread_nolock(ptr long long ptr) MSVCRT__fread_nolock
|
||||
@ stub _fread_nolock_s
|
||||
@ cdecl _free_locale(ptr) MSVCRT__free_locale
|
||||
@ stub _freea
|
||||
|
|
|
@ -3956,6 +3956,20 @@ int CDECL MSVCRT__fputchar(int c)
|
|||
* fread (MSVCRT.@)
|
||||
*/
|
||||
MSVCRT_size_t CDECL MSVCRT_fread(void *ptr, MSVCRT_size_t size, MSVCRT_size_t nmemb, MSVCRT_FILE* file)
|
||||
{
|
||||
int ret;
|
||||
|
||||
MSVCRT__lock_file(file);
|
||||
ret = MSVCRT__fread_nolock(ptr, size, nmemb, file);
|
||||
MSVCRT__unlock_file(file);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* _fread_nolock (MSVCRT.@)
|
||||
*/
|
||||
MSVCRT_size_t CDECL MSVCRT__fread_nolock(void *ptr, MSVCRT_size_t size, MSVCRT_size_t nmemb, MSVCRT_FILE* file)
|
||||
{
|
||||
MSVCRT_size_t rcnt=size * nmemb;
|
||||
MSVCRT_size_t read=0;
|
||||
|
@ -3964,8 +3978,6 @@ MSVCRT_size_t CDECL MSVCRT_fread(void *ptr, MSVCRT_size_t size, MSVCRT_size_t nm
|
|||
if(!rcnt)
|
||||
return 0;
|
||||
|
||||
MSVCRT__lock_file(file);
|
||||
|
||||
/* first buffered data */
|
||||
if(file->_cnt>0) {
|
||||
int pcnt= (rcnt>file->_cnt)? file->_cnt:rcnt;
|
||||
|
@ -3979,7 +3991,6 @@ MSVCRT_size_t CDECL MSVCRT_fread(void *ptr, MSVCRT_size_t size, MSVCRT_size_t nm
|
|||
if(file->_flag & MSVCRT__IORW) {
|
||||
file->_flag |= MSVCRT__IOREAD;
|
||||
} else {
|
||||
MSVCRT__unlock_file(file);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -4028,7 +4039,6 @@ MSVCRT_size_t CDECL MSVCRT_fread(void *ptr, MSVCRT_size_t size, MSVCRT_size_t nm
|
|||
if (i < 1) break;
|
||||
}
|
||||
read+=pread;
|
||||
MSVCRT__unlock_file(file);
|
||||
return read / size;
|
||||
}
|
||||
|
||||
|
|
|
@ -925,6 +925,7 @@ void __cdecl MSVCRT_abort(void);
|
|||
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*);
|
||||
int __cdecl MSVCRT_fclose(MSVCRT_FILE*);
|
||||
int __cdecl MSVCRT__fclose_nolock(MSVCRT_FILE*);
|
||||
void __cdecl MSVCRT_terminate(void);
|
||||
|
|
|
@ -127,9 +127,11 @@ int __cdecl _vsnprintf(char*,size_t,const char*,__ms_va_list);
|
|||
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*);
|
||||
int __cdecl _fclose_nolock(FILE*);
|
||||
|
||||
void __cdecl clearerr(FILE*);
|
||||
int __cdecl fclose(FILE*);
|
||||
int __cdecl _fclose_nolock(FILE*);
|
||||
int __cdecl feof(FILE*);
|
||||
int __cdecl ferror(FILE*);
|
||||
int __cdecl fflush(FILE*);
|
||||
|
|
Loading…
Reference in New Issue