wininet: Check file handles against INVALID_HANDLE_VALUE, not NULL!

Francois Gouget fgouget at free.fr
Thu Mar 8 08:29:01 CST 2007


Simplify the file handle handling in FTP_FtpPutFileW().
---
 dlls/wininet/ftp.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c
index 18dad2e..1ebea43 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;
-- 
1.4.4.4




More information about the wine-patches mailing list