From 730c132f369842cd219388905cf981c2e90f98b3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 10 Jan 2024 12:11:16 +0300 Subject: code cleaning --- plugins/PackUpdater/Src/Utils.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'plugins/PackUpdater/Src/Utils.cpp') 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; -- cgit v1.2.3