diff options
author | George Hazan <george.hazan@gmail.com> | 2024-01-10 12:11:16 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-01-10 12:11:16 +0300 |
commit | 730c132f369842cd219388905cf981c2e90f98b3 (patch) | |
tree | e347546e613854070cfd3da32eb0e2e8d30b3b91 /plugins/PackUpdater/Src/Utils.cpp | |
parent | e688d75e8db7616d7e6d6fb3ed3c892e4fbe8a97 (diff) |
code cleaning
Diffstat (limited to 'plugins/PackUpdater/Src/Utils.cpp')
-rw-r--r-- | plugins/PackUpdater/Src/Utils.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp index 7c3212388e..17b9f100f1 100644 --- a/plugins/PackUpdater/Src/Utils.cpp +++ b/plugins/PackUpdater/Src/Utils.cpp @@ -116,17 +116,9 @@ BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) nlhr.AddHeader("Pragma", "no-cache");
bool ret = false;
- NLHR_PTR pReply(Netlib_HttpTransaction(hNetlibUser, &nlhr));
- if (pReply) {
- if (200 == pReply->resultCode && !pReply->body.IsEmpty()) {
- HANDLE hFile = CreateFile(tszLocal, GENERIC_READ | GENERIC_WRITE, NULL, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
- DWORD dwBytes;
- WriteFile(hFile, pReply->body, pReply->body.GetLength(), &dwBytes, nullptr);
- ret = true;
- if (hFile)
- CloseHandle(hFile);
- }
- }
+ NLHR_PTR pReply(Netlib_DownloadFile(hNetlibUser, &nlhr, tszLocal));
+ if (pReply && pReply->resultCode == 200)
+ ret = true;
DlgDld = ret;
return ret;
|