Module: wine Branch: master Commit: 53e76f8370d90ab0e5c900c2644d607bb06ab845 URL: http://source.winehq.org/git/wine.git/?a=commit;h=53e76f8370d90ab0e5c900c264...
Author: Francois Gouget fgouget@free.fr Date: Thu Mar 8 15:29:01 2007 +0100
wininet: Check file handles against INVALID_HANDLE_VALUE, not NULL.
Simplify the file handle handling in FTP_FtpPutFileW().
---
dlls/wininet/ftp.c | 7 +++---- dlls/wininet/tests/ftp.c | 2 -- 2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c index 0931ccc..4373c3c 100644 --- a/dlls/wininet/ftp.c +++ b/dlls/wininet/ftp.c @@ -271,7 +271,7 @@ lend: BOOL WINAPI FTP_FtpPutFileW(LPWININETFTPSESSIONW lpwfs, LPCWSTR lpszLocalFile, LPCWSTR lpszNewRemoteFile, DWORD dwFlags, DWORD dwContext) { - HANDLE hFile = NULL; + HANDLE hFile; BOOL bSuccess = FALSE; LPWININETAPPINFOW hIC = NULL; INT nResCode; @@ -324,8 +324,7 @@ BOOL WINAPI FTP_FtpPutFileW(LPWININETFTPSESSIONW lpwfs, LPCWSTR lpszLocalFile, &iar, sizeof(INTERNET_ASYNC_RESULT)); }
- if (hFile) - CloseHandle(hFile); + CloseHandle(hFile);
return bSuccess; } @@ -1350,7 +1349,7 @@ lend: if (lpwfs->lstnSocket != -1) closesocket(lpwfs->lstnSocket);
- if (hFile) + if (INVALID_HANDLE_VALUE != hFile) CloseHandle(hFile);
hIC = lpwfs->lpAppInfo; diff --git a/dlls/wininet/tests/ftp.c b/dlls/wininet/tests/ftp.c index b12f88b..2eca664 100644 --- a/dlls/wininet/tests/ftp.c +++ b/dlls/wininet/tests/ftp.c @@ -380,7 +380,6 @@ static void test_getfile(void) SetLastError(0xdeadbeef); bRet = FtpGetFileA(hFtp, "welcome.msg", "should_be_non_existing_deadbeef", TRUE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0); ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n"); - todo_wine ok ( GetLastError() == ERROR_FILE_EXISTS, "Expected ERROR_FILE_EXISTS, got %d\n", GetLastError());
@@ -388,7 +387,6 @@ static void test_getfile(void) SetLastError(0xdeadbeef); bRet = FtpGetFileA(hFtp, "should_be_non_existing_deadbeef", "should_be_non_existing_deadbeef", TRUE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0); ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n"); - todo_wine ok ( GetLastError() == ERROR_FILE_EXISTS, "Expected ERROR_FILE_EXISTS, got %d\n", GetLastError());