diff options
author | Ladislav Zezula <ladislav.zezula@avg.com> | 2015-05-28 13:49:23 +0200 |
---|---|---|
committer | Ladislav Zezula <ladislav.zezula@avg.com> | 2015-05-28 13:49:23 +0200 |
commit | 1b38ceb0d4bb4ae32cb93c295e3ef493b91f9a78 (patch) | |
tree | 5634e1d3fd17386975db1c0d4e95176db098bc1f /src/FileStream.cpp | |
parent | c26e12c79f2a5e0c092de4a62565bdae4bf5a7dd (diff) |
+ Fixed defects found by Coverity (well, most of them)
Diffstat (limited to 'src/FileStream.cpp')
-rw-r--r-- | src/FileStream.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/FileStream.cpp b/src/FileStream.cpp index 53740fa..a367db6 100644 --- a/src/FileStream.cpp +++ b/src/FileStream.cpp @@ -618,19 +618,16 @@ static bool BaseHttp_Open(TFileStream * pStream, const TCHAR * szFileName, DWORD // Don't connect to the internet if(!InternetGetConnectedState(&dwTemp, 0)) - nError = GetLastError(); + return false; // Initiate the connection to the internet - if(nError == ERROR_SUCCESS) - { - pStream->Base.Http.hInternet = InternetOpen(_T("StormLib HTTP MPQ reader"), - INTERNET_OPEN_TYPE_PRECONFIG, - NULL, - NULL, - 0); - if(pStream->Base.Http.hInternet == NULL) - nError = GetLastError(); - } + pStream->Base.Http.hInternet = InternetOpen(_T("StormLib HTTP MPQ reader"), + INTERNET_OPEN_TYPE_PRECONFIG, + NULL, + NULL, + 0); + if(pStream->Base.Http.hInternet == NULL) + return false; // Connect to the server if(nError == ERROR_SUCCESS) @@ -649,7 +646,10 @@ static bool BaseHttp_Open(TFileStream * pStream, const TCHAR * szFileName, DWORD dwFlags, 0); if(pStream->Base.Http.hConnect == NULL) - nError = GetLastError(); + { + InternetCloseHandle(pStream->Base.Http.hInternet); + return false; + } } // Now try to query the file size |