msvcrt: Fix _getw.

This commit is contained in:
Duane Clark 2006-07-29 15:38:02 -07:00 committed by Alexandre Julliard
parent b44ea8084d
commit 88aeeb9fd8
2 changed files with 21 additions and 17 deletions

View File

@ -1674,21 +1674,6 @@ int CDECL _read(int fd, void *buf, unsigned int count)
return num_read;
}
/*********************************************************************
* _getw (MSVCRT.@)
*/
int CDECL MSVCRT__getw(MSVCRT_FILE* file)
{
int i;
switch (_read(file->_file, &i, sizeof(int)))
{
case 1: return i;
case 0: file->_flag |= MSVCRT__IOEOF; break;
default: file->_flag |= MSVCRT__IOERR; break;
}
return EOF;
}
/*********************************************************************
* _setmode (MSVCRT.@)
*/
@ -2225,6 +2210,25 @@ MSVCRT_wint_t CDECL MSVCRT_fgetwc(MSVCRT_FILE* file)
return (MSVCRT_wint_t)c;
}
/*********************************************************************
* _getw (MSVCRT.@)
*/
int CDECL MSVCRT__getw(MSVCRT_FILE* file)
{
char *ch;
int i, j, k;
ch = (char *)&i;
for (j=0; j<sizeof(int); j++) {
k = MSVCRT_fgetc(file);
if (k == MSVCRT_EOF) {
file->_flag |= MSVCRT__IOEOF;
return EOF;
}
ch[j] = k;
}
return i;
}
/*********************************************************************
* getwc (MSVCRT.@)
*/

View File

@ -227,7 +227,7 @@ static void test_readmode( BOOL ascii_mode )
ok(fgets(buffer,MSVCRT_BUFSIZ+256,file) !=0,"padding line fgets failed unexpected in %s\n", IOMODE);
i = _getw(file);
ip = (int *)outbuffer;
todo_wine ok(i == *ip,"_getw failed, expected %08x got %08x in %s\n", *ip, i, IOMODE);
ok(i == *ip,"_getw failed, expected %08x got %08x in %s\n", *ip, i, IOMODE);
for (fp=0; fp<strlen(outbuffer); fp++)
if (outbuffer[fp] == '\n') break;
fp++;
@ -239,7 +239,7 @@ static void test_readmode( BOOL ascii_mode )
}
i = _getw(file);
ip = (int *)buffer;
todo_wine ok(i == *ip,"_getw failed, expected %08x got %08x in %s\n", *ip, i, IOMODE);
ok(i == *ip,"_getw failed, expected %08x got %08x in %s\n", *ip, i, IOMODE);
fclose (file);
unlink ("fdopen.tst");