summaryrefslogtreecommitdiff
path: root/plugins/SendScreenshotPlus
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 /plugins/SendScreenshotPlus
parent541eab20530165d10592a9fda590f435c6a8b4be (diff)
NLHR_PTR - smart pointers make better code
Diffstat (limited to 'plugins/SendScreenshotPlus')
-rw-r--r--plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp5
-rw-r--r--plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp5
-rw-r--r--plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp5
3 files changed, 3 insertions, 12 deletions
diff --git a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp
index cff46d50a5..992979f1e5 100644
--- a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp
+++ b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp
@@ -75,7 +75,7 @@ int CSendHost_ImageShack::Send()
void CSendHost_ImageShack::SendThread()
{
// send DATA and wait for m_nlreply
- NETLIBHTTPREQUEST* reply = Netlib_HttpTransaction(g_hNetlibUser, &m_nlhr);
+ NLHR_PTR reply(Netlib_HttpTransaction(g_hNetlibUser, &m_nlhr));
HTTPFormDestroy(&m_nlhr);
if (reply) {
if (reply->resultCode >= 200 && reply->resultCode < 300 && reply->dataLength) {
@@ -92,7 +92,6 @@ void CSendHost_ImageShack::SendThread()
m_URLthumb.Empty();
svcSendMsgExit(url);
- Netlib_FreeHttpRequest(reply);
return;
}
@@ -107,8 +106,6 @@ void CSendHost_ImageShack::SendThread()
mir_free(err);
}
else Error(SS_ERR_RESPONSE, m_pszSendTyp, reply->resultCode);
-
- Netlib_FreeHttpRequest(reply);
}
else Error(SS_ERR_NORESPONSE, m_pszSendTyp, m_nlhr.resultCode);
diff --git a/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp b/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp
index f4590cdbe5..e6344b5cf3 100644
--- a/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp
+++ b/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp
@@ -59,7 +59,7 @@ void CSendHost_Imgur::SendThread(void* obj)
{
CSendHost_Imgur *self = (CSendHost_Imgur*)obj;
// send DATA and wait for m_nlreply
- NETLIBHTTPREQUEST *reply = Netlib_HttpTransaction(g_hNetlibUser, &self->m_nlhr);
+ NLHR_PTR reply(Netlib_HttpTransaction(g_hNetlibUser, &self->m_nlhr));
self->HTTPFormDestroy(&self->m_nlhr);
if (reply) {
if (reply->dataLength) {
@@ -72,7 +72,6 @@ void CSendHost_Imgur::SendThread(void* obj)
self->m_URLthumb = self->m_URL;
self->m_URLthumb.Insert(idx, 'm');
}
- Netlib_FreeHttpRequest(reply);
self->svcSendMsgExit(self->m_URL); return;
}
else self->Error(SS_ERR_RESPONSE, self->m_pszSendTyp, (*root)["status"].as_int(), 0);
@@ -80,8 +79,6 @@ void CSendHost_Imgur::SendThread(void* obj)
else self->Error(SS_ERR_RESPONSE, self->m_pszSendTyp, reply->resultCode);
}
else self->Error(SS_ERR_RESPONSE, self->m_pszSendTyp, reply->resultCode);
-
- Netlib_FreeHttpRequest(reply);
}
else self->Error(SS_ERR_NORESPONSE, self->m_pszSendTyp, self->m_nlhr.resultCode);
diff --git a/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp b/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp
index da0c5c2707..d750c92554 100644
--- a/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp
+++ b/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp
@@ -64,7 +64,7 @@ void CSendHost_UploadPie::SendThread(void* obj)
{
CSendHost_UploadPie* self = (CSendHost_UploadPie*)obj;
// send DATA and wait for m_nlreply
- NETLIBHTTPREQUEST* reply = Netlib_HttpTransaction(g_hNetlibUser, &self->m_nlhr);
+ NLHR_PTR reply(Netlib_HttpTransaction(g_hNetlibUser, &self->m_nlhr));
self->HTTPFormDestroy(&self->m_nlhr);
if (reply) {
if (reply->resultCode >= 200 && reply->resultCode < 300 && reply->dataLength) {
@@ -86,7 +86,6 @@ void CSendHost_UploadPie::SendThread(void* obj)
if (url) {
self->m_URL = url;
- Netlib_FreeHttpRequest(reply);
self->svcSendMsgExit(url); return;
}
else { // check error mess from server
@@ -99,8 +98,6 @@ void CSendHost_UploadPie::SendThread(void* obj)
}
}
else self->Error(SS_ERR_RESPONSE, self->m_pszSendTyp, reply->resultCode);
-
- Netlib_FreeHttpRequest(reply);
}
else self->Error(SS_ERR_NORESPONSE, self->m_pszSendTyp, self->m_nlhr.resultCode);