make check condition exact

pull/125/head
Jacob Barthelmeh 2018-12-12 14:58:22 -07:00
parent 10c888b855
commit 86344c7e68
1 changed files with 2 additions and 2 deletions

View File

@ -90,7 +90,7 @@ int wPwrite(WFD fd, unsigned char* buf, unsigned int sz, long ofst)
WMEMSET(&offset, 0, sizeof(OVERLAPPED));
offset.Offset = (DWORD)(ofst & 0xFFFFFFFF);
offset.OffsetHigh = (DWORD)((ofst & 0xFFFFFFFF00000000) >> 32);
if (WriteFile((HANDLE)_get_osfhandle(fd), buf, sz, &bytesWritten, &offset) <= 0)
if (WriteFile((HANDLE)_get_osfhandle(fd), buf, sz, &bytesWritten, &offset) == 0)
ret = -1;
else
ret = (int)bytesWritten;
@ -108,7 +108,7 @@ int wPread(WFD fd, unsigned char* buf, unsigned int sz, long ofst)
WMEMSET(&offset, 0, sizeof(OVERLAPPED));
offset.Offset = (DWORD)(ofst & 0xFFFFFFFF);
offset.OffsetHigh = (DWORD)((ofst & 0xFFFFFFFF00000000) >> 32);
if (ReadFile((HANDLE)_get_osfhandle(fd), buf, sz, &bytesRead, &offset) <= 0) {
if (ReadFile((HANDLE)_get_osfhandle(fd), buf, sz, &bytesRead, &offset) == 0) {
if (GetLastError() == ERROR_HANDLE_EOF) {
ret = 0; /* return 0 for end of file */
}