Commit 9a71b483 authored by Duane Clark's avatar Duane Clark Committed by Alexandre Julliard

msvcrt: fgetc needs to use unsigned parameters.

Spotted by and adapted from test written by Tobias Ringström.
parent 7a61a617
......@@ -2127,12 +2127,12 @@ int CDECL MSVCRT__filbuf(MSVCRT_FILE* file)
*/
int CDECL MSVCRT_fgetc(MSVCRT_FILE* file)
{
char *i;
int j;
unsigned char *i;
unsigned int j;
do {
if (file->_cnt>0) {
file->_cnt--;
i = file->_ptr++;
i = (unsigned char *)file->_ptr++;
j = *i;
} else
j = MSVCRT__filbuf(file);
......
......@@ -255,6 +255,24 @@ static WCHAR* AtoW( char* p )
return buffer;
}
static void test_fgetc( void )
{
char* tempf;
FILE *tempfh;
int ich=0xe0, ret;
tempf=_tempnam(".","wne");
tempfh = fopen(tempf,"w+");
fputc(ich, tempfh);
fputc(ich, tempfh);
rewind(tempfh);
ret = fgetc(tempfh);
ok(ich == ret, "First fgetc expected %x got %x\n", ich, ret);
ret = fgetc(tempfh);
ok(ich == ret, "Second fgetc expected %x got %x\n", ich, ret);
fclose(tempfh);
}
static void test_fgetwc( void )
{
#define LLEN 512
......@@ -773,6 +791,7 @@ START_TEST(file)
test_fileops();
test_readmode(FALSE); /* binary mode */
test_readmode(TRUE); /* ascii mode */
test_fgetc();
test_fgetwc();
test_ctrlz();
test_file_put_get();
......
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