summaryrefslogtreecommitdiff
path: root/plugins/PackUpdater/Src/Utils.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-01-10 12:11:16 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-01-10 12:11:16 +0300
commit730c132f369842cd219388905cf981c2e90f98b3 (patch)
treee347546e613854070cfd3da32eb0e2e8d30b3b91 /plugins/PackUpdater/Src/Utils.cpp
parente688d75e8db7616d7e6d6fb3ed3c892e4fbe8a97 (diff)
code cleaning
Diffstat (limited to 'plugins/PackUpdater/Src/Utils.cpp')
-rw-r--r--plugins/PackUpdater/Src/Utils.cpp14
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;