summaryrefslogtreecommitdiff
path: root/protocols/NewsAggregator/Src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-07-24 14:30:13 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-07-24 14:30:13 +0300
commit103de9c164934b2393dfcba7011625f90c8a2097 (patch)
treef7a4a09afe29398f3b7605d7d0db264638a18150 /protocols/NewsAggregator/Src
parent541eab20530165d10592a9fda590f435c6a8b4be (diff)
NLHR_PTR - smart pointers make better code
Diffstat (limited to 'protocols/NewsAggregator/Src')
-rw-r--r--protocols/NewsAggregator/Src/Utils.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/protocols/NewsAggregator/Src/Utils.cpp b/protocols/NewsAggregator/Src/Utils.cpp
index 80248ba48f..29c2017b66 100644
--- a/protocols/NewsAggregator/Src/Utils.cpp
+++ b/protocols/NewsAggregator/Src/Utils.cpp
@@ -81,7 +81,7 @@ void GetNewsData(wchar_t *tszUrl, char **szData, MCONTACT hContact, CFeedEditor
}
// download the page
- NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUser, &nlhr);
+ NLHR_PTR nlhrReply(Netlib_HttpTransaction(hNetlibUser, &nlhr));
if (nlhrReply) {
// if the recieved code is 200 OK
if (nlhrReply->resultCode == 200 && nlhrReply->dataLength > 0) {
@@ -98,8 +98,6 @@ void GetNewsData(wchar_t *tszUrl, char **szData, MCONTACT hContact, CFeedEditor
GetNewsData(tszUrl, szData, hContact, pEditDlg);
}
else Netlib_LogfW(hNetlibUser, L"Code %d: Failed getting feed data %s.", nlhrReply->resultCode, tszUrl);
-
- Netlib_FreeHttpRequest(nlhrReply);
}
else Netlib_LogfW(hNetlibUser, L"Failed getting feed data %s, no response.", tszUrl);
@@ -242,7 +240,7 @@ bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal)
nlhr.headers[3].szValue = "no-cache";
bool ret = false;
- NETLIBHTTPREQUEST *pReply = Netlib_HttpTransaction(hNetlibUser, &nlhr);
+ NLHR_PTR pReply(Netlib_HttpTransaction(hNetlibUser, &nlhr));
if (pReply) {
if ((200 == pReply->resultCode) && (pReply->dataLength > 0)) {
char *date = nullptr, *size = nullptr;
@@ -294,7 +292,6 @@ bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal)
CloseHandle(hFile);
}
}
- Netlib_FreeHttpRequest(pReply);
}
mir_free(szUrl);