Commit 88aeeb9f authored by Duane Clark's avatar Duane Clark Committed by Alexandre Julliard

msvcrt: Fix _getw.

parent b44ea808
...@@ -1675,21 +1675,6 @@ int CDECL _read(int fd, void *buf, unsigned int count) ...@@ -1675,21 +1675,6 @@ int CDECL _read(int fd, void *buf, unsigned int count)
} }
/********************************************************************* /*********************************************************************
* _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.@) * _setmode (MSVCRT.@)
*/ */
int CDECL _setmode(int fd,int mode) int CDECL _setmode(int fd,int mode)
...@@ -2226,6 +2211,25 @@ MSVCRT_wint_t CDECL MSVCRT_fgetwc(MSVCRT_FILE* file) ...@@ -2226,6 +2211,25 @@ MSVCRT_wint_t CDECL MSVCRT_fgetwc(MSVCRT_FILE* file)
} }
/********************************************************************* /*********************************************************************
* _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.@) * getwc (MSVCRT.@)
*/ */
MSVCRT_wint_t CDECL MSVCRT_getwc(MSVCRT_FILE* file) MSVCRT_wint_t CDECL MSVCRT_getwc(MSVCRT_FILE* file)
......
...@@ -227,7 +227,7 @@ static void test_readmode( BOOL ascii_mode ) ...@@ -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); ok(fgets(buffer,MSVCRT_BUFSIZ+256,file) !=0,"padding line fgets failed unexpected in %s\n", IOMODE);
i = _getw(file); i = _getw(file);
ip = (int *)outbuffer; 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++) for (fp=0; fp<strlen(outbuffer); fp++)
if (outbuffer[fp] == '\n') break; if (outbuffer[fp] == '\n') break;
fp++; fp++;
...@@ -239,7 +239,7 @@ static void test_readmode( BOOL ascii_mode ) ...@@ -239,7 +239,7 @@ static void test_readmode( BOOL ascii_mode )
} }
i = _getw(file); i = _getw(file);
ip = (int *)buffer; 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); fclose (file);
unlink ("fdopen.tst"); unlink ("fdopen.tst");
......
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