From 103de9c164934b2393dfcba7011625f90c8a2097 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 24 Jul 2019 14:30:13 +0300 Subject: NLHR_PTR - smart pointers make better code --- plugins/CrashDumper/src/upload.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'plugins/CrashDumper') diff --git a/plugins/CrashDumper/src/upload.cpp b/plugins/CrashDumper/src/upload.cpp index 746567bd28..1e212aa391 100644 --- a/plugins/CrashDumper/src/upload.cpp +++ b/plugins/CrashDumper/src/upload.cpp @@ -122,10 +122,8 @@ bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq) while (result == 0xBADBAD) { // download the page - NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUser, &nlhr); + NLHR_PTR nlhrReply(Netlib_HttpTransaction(hNetlibUser, &nlhr)); if (nlhrReply) { - int i; - // if the recieved code is 200 OK switch (nlhrReply->resultCode) { case 200: @@ -156,7 +154,7 @@ bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq) case 307: // get the url for the new location and save it to szInfo // look for the reply header "Location" - for (i = 0; i < nlhrReply->headersCount; i++) { + for (int i = 0; i < nlhrReply->headersCount; i++) { if (!mir_strcmp(nlhrReply->headers[i].szName, "Location")) { size_t rlen = 0; if (nlhrReply->headers[i].szValue[0] == '/') { @@ -188,8 +186,6 @@ bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq) result = 1; ShowMessage(0, TranslateT("Cannot upload Version Info. Host unreachable.")); } - - Netlib_FreeHttpRequest(nlhrReply); } mir_free(szRedirUrl); -- cgit v1.2.3