From 88aeeb9fd838af4bb40669f561506b52785f60bd Mon Sep 17 00:00:00 2001 From: Duane Clark Date: Sat, 29 Jul 2006 15:38:02 -0700 Subject: [PATCH] msvcrt: Fix _getw. --- dlls/msvcrt/file.c | 34 +++++++++++++++++++--------------- dlls/msvcrt/tests/file.c | 4 ++-- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index a1bc07a863..d5d9647dbd 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -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_flag |= MSVCRT__IOEOF; + return EOF; + } + ch[j] = k; + } + return i; +} + /********************************************************************* * getwc (MSVCRT.@) */ diff --git a/dlls/msvcrt/tests/file.c b/dlls/msvcrt/tests/file.c index e3f8ce5d83..b9387ce9d2 100644 --- a/dlls/msvcrt/tests/file.c +++ b/dlls/msvcrt/tests/file.c @@ -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