summaryrefslogtreecommitdiff
path: root/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-09-04 18:54:25 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-09-04 18:54:25 +0300
commitfa38c0bf4a5fec438cd5d614c69b444e01cc1e3e (patch)
treebc6681520220562eede0e0f7185b3d90f1fca587 /plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp
parenta5ab3760f487dfd5c34ff561a472bda29671f2a4 (diff)
old ugly C-like calls replaced with CMStringA
Diffstat (limited to 'plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp')
-rw-r--r--plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp b/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp
index f9c1bdd40c..6c6dabb716 100644
--- a/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp
+++ b/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp
@@ -70,15 +70,11 @@ void CSendHost_Imgur::SendThread(void* obj)
if (GetJSONBool(reply->pData, reply->dataLength, "success")) {
GetJSONString(reply->pData, reply->dataLength, "data[link]", buf, sizeof(buf));
- mir_free(self->m_URL), self->m_URL = mir_strdup(buf);
- char* ext = strrchr(self->m_URL, '.');
- if (ext) {
- size_t thumblen = mir_strlen(self->m_URL) + 2;
- mir_free(self->m_URLthumb), self->m_URLthumb = (char*)mir_alloc(thumblen);
- thumblen = ext - self->m_URL;
- memcpy(self->m_URLthumb, self->m_URL, thumblen);
- self->m_URLthumb[thumblen] = 'm'; // 320x320, see http://api.imgur.com/models/image
- mir_strcpy(self->m_URLthumb + thumblen + 1, self->m_URL + thumblen);
+ self->m_URL = buf;
+ int idx = self->m_URL.ReverseFind('.');
+ if (idx != -1) {
+ self->m_URLthumb = self->m_URL;
+ self->m_URLthumb.Insert(idx, 'm');
}
Netlib_FreeHttpRequest(reply);
self->svcSendMsgExit(self->m_URL); return;