Commit 975a95a2 authored by Iván Matellanes's avatar Iván Matellanes Committed by Alexandre Julliard

msvcrt: Added _fputc_nolock implementation.

parent 9e4590ff
...@@ -830,6 +830,7 @@ ...@@ -830,6 +830,7 @@
@ stub _fprintf_p @ stub _fprintf_p
@ stub _fprintf_p_l @ stub _fprintf_p_l
@ stub _fprintf_s_l @ stub _fprintf_s_l
@ cdecl _fputc_nolock(long ptr) MSVCRT__fputc_nolock
@ cdecl _fputchar(long) MSVCRT__fputchar @ cdecl _fputchar(long) MSVCRT__fputchar
@ stub _fputwc_nolock @ stub _fputwc_nolock
@ cdecl _fputwchar(long) MSVCRT__fputwchar @ cdecl _fputwchar(long) MSVCRT__fputwchar
......
...@@ -1178,6 +1178,7 @@ ...@@ -1178,6 +1178,7 @@
@ stub _fprintf_p @ stub _fprintf_p
@ stub _fprintf_p_l @ stub _fprintf_p_l
@ stub _fprintf_s_l @ stub _fprintf_s_l
@ cdecl _fputc_nolock(long ptr) MSVCRT__fputc_nolock
@ cdecl _fputchar(long) MSVCRT__fputchar @ cdecl _fputchar(long) MSVCRT__fputchar
@ stub _fputwc_nolock @ stub _fputwc_nolock
@ cdecl _fputwchar(long) MSVCRT__fputwchar @ cdecl _fputwchar(long) MSVCRT__fputwchar
......
...@@ -1176,6 +1176,7 @@ ...@@ -1176,6 +1176,7 @@
@ stub _fprintf_p @ stub _fprintf_p
@ stub _fprintf_p_l @ stub _fprintf_p_l
@ stub _fprintf_s_l @ stub _fprintf_s_l
@ cdecl _fputc_nolock(long ptr) MSVCRT__fputc_nolock
@ cdecl _fputchar(long) MSVCRT__fputchar @ cdecl _fputchar(long) MSVCRT__fputchar
@ stub _fputwc_nolock @ stub _fputwc_nolock
@ cdecl _fputwchar(long) MSVCRT__fputwchar @ cdecl _fputwchar(long) MSVCRT__fputwchar
......
...@@ -497,6 +497,7 @@ ...@@ -497,6 +497,7 @@
@ stub _fprintf_p @ stub _fprintf_p
@ stub _fprintf_p_l @ stub _fprintf_p_l
@ stub _fprintf_s_l @ stub _fprintf_s_l
@ cdecl _fputc_nolock(long ptr) MSVCRT__fputc_nolock
@ cdecl _fputchar(long) MSVCRT__fputchar @ cdecl _fputchar(long) MSVCRT__fputchar
@ stub _fputwc_nolock @ stub _fputwc_nolock
@ cdecl _fputwchar(long) MSVCRT__fputwchar @ cdecl _fputwchar(long) MSVCRT__fputwchar
......
...@@ -479,6 +479,7 @@ ...@@ -479,6 +479,7 @@
@ stub _fprintf_p @ stub _fprintf_p
@ stub _fprintf_p_l @ stub _fprintf_p_l
@ stub _fprintf_s_l @ stub _fprintf_s_l
@ cdecl _fputc_nolock(long ptr) MSVCRT__fputc_nolock
@ cdecl _fputchar(long) MSVCRT__fputchar @ cdecl _fputchar(long) MSVCRT__fputchar
@ stub _fputwc_nolock @ stub _fputwc_nolock
@ cdecl _fputwchar(long) MSVCRT__fputwchar @ cdecl _fputwchar(long) MSVCRT__fputwchar
......
...@@ -3980,25 +3980,35 @@ int CDECL MSVCRT__wfopen_s(MSVCRT_FILE** pFile, const MSVCRT_wchar_t *filename, ...@@ -3980,25 +3980,35 @@ int CDECL MSVCRT__wfopen_s(MSVCRT_FILE** pFile, const MSVCRT_wchar_t *filename,
*/ */
int CDECL MSVCRT_fputc(int c, MSVCRT_FILE* file) int CDECL MSVCRT_fputc(int c, MSVCRT_FILE* file)
{ {
int ret;
MSVCRT__lock_file(file);
ret = MSVCRT__fputc_nolock(c, file);
MSVCRT__unlock_file(file);
return ret;
}
/*********************************************************************
* _fputc_nolock (MSVCRT.@)
*/
int CDECL MSVCRT__fputc_nolock(int c, MSVCRT_FILE* file)
{
int res; int res;
MSVCRT__lock_file(file);
if(file->_cnt>0) { if(file->_cnt>0) {
*file->_ptr++=c; *file->_ptr++=c;
file->_cnt--; file->_cnt--;
if (c == '\n') if (c == '\n')
{ {
res = msvcrt_flush_buffer(file); res = msvcrt_flush_buffer(file);
MSVCRT__unlock_file(file);
return res ? res : c; return res ? res : c;
} }
else { else {
MSVCRT__unlock_file(file);
return c & 0xff; return c & 0xff;
} }
} else { } else {
res = MSVCRT__flsbuf(c, file); res = MSVCRT__flsbuf(c, file);
MSVCRT__unlock_file(file);
return res; return res;
} }
} }
......
...@@ -917,6 +917,7 @@ void __cdecl MSVCRT__lock_file(MSVCRT_FILE*); ...@@ -917,6 +917,7 @@ void __cdecl MSVCRT__lock_file(MSVCRT_FILE*);
void __cdecl MSVCRT__unlock_file(MSVCRT_FILE*); void __cdecl MSVCRT__unlock_file(MSVCRT_FILE*);
int __cdecl MSVCRT_fgetc(MSVCRT_FILE*); int __cdecl MSVCRT_fgetc(MSVCRT_FILE*);
int __cdecl MSVCRT__fgetc_nolock(MSVCRT_FILE*); int __cdecl MSVCRT__fgetc_nolock(MSVCRT_FILE*);
int __cdecl MSVCRT__fputc_nolock(int,MSVCRT_FILE*);
int __cdecl MSVCRT_ungetc(int,MSVCRT_FILE*); int __cdecl MSVCRT_ungetc(int,MSVCRT_FILE*);
MSVCRT_wint_t __cdecl MSVCRT_fgetwc(MSVCRT_FILE*); MSVCRT_wint_t __cdecl MSVCRT_fgetwc(MSVCRT_FILE*);
MSVCRT_wint_t __cdecl MSVCRT__fgetwc_nolock(MSVCRT_FILE*); MSVCRT_wint_t __cdecl MSVCRT__fgetwc_nolock(MSVCRT_FILE*);
......
...@@ -132,6 +132,7 @@ size_t __cdecl _fwrite_nolock(const void*,size_t,size_t,FILE*); ...@@ -132,6 +132,7 @@ size_t __cdecl _fwrite_nolock(const void*,size_t,size_t,FILE*);
int __cdecl _fclose_nolock(FILE*); int __cdecl _fclose_nolock(FILE*);
int __cdecl _fflush_nolock(FILE*); int __cdecl _fflush_nolock(FILE*);
int __cdecl _fgetc_nolock(FILE*); int __cdecl _fgetc_nolock(FILE*);
int __cdecl _fputc_nolock(int,FILE*);
int __cdecl _fseek_nolock(FILE*,__msvcrt_long,int); int __cdecl _fseek_nolock(FILE*,__msvcrt_long,int);
int __cdecl _fseeki64_nolock(FILE*,__int64,int); int __cdecl _fseeki64_nolock(FILE*,__int64,int);
__msvcrt_long __cdecl _ftell_nolock(FILE*); __msvcrt_long __cdecl _ftell_nolock(FILE*);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment