diff options
author | George Hazan <george.hazan@gmail.com> | 2024-01-05 15:54:03 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-01-05 15:54:03 +0300 |
commit | 14c4e44a0a91e1ad701d4ae3c58185d25118e64e (patch) | |
tree | 50f36035466f355c74373e757bc00b6610ce6267 /protocols/SkypeWeb/src/requests | |
parent | 94667140aeb3886d22e4c1301423fe99aaf3fba4 (diff) |
Netlib:
- NETLIBHTTPHEADER & NETLIBHTTPREQUEST obsoleted;
- NETLIBHTTPREQUEST divided into MHttpRequest & MHttpResponse;
- MHttpHeaders now manager headers both for MHttpRequest & MHttpResponse;
Diffstat (limited to 'protocols/SkypeWeb/src/requests')
-rw-r--r-- | protocols/SkypeWeb/src/requests/avatars.h | 12 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/files.h | 12 |
2 files changed, 6 insertions, 18 deletions
diff --git a/protocols/SkypeWeb/src/requests/avatars.h b/protocols/SkypeWeb/src/requests/avatars.h index cdf5ac7b6e..aeffbf8ab0 100644 --- a/protocols/SkypeWeb/src/requests/avatars.h +++ b/protocols/SkypeWeb/src/requests/avatars.h @@ -30,21 +30,15 @@ struct GetAvatarRequest : public AsyncHttpRequest struct SetAvatarRequest : public AsyncHttpRequest
{
- SetAvatarRequest(const uint8_t *data, size_t dataSize, const char *szMime, CSkypeProto *ppro) :
+ SetAvatarRequest(const uint8_t *data, int dataSize, const char *szMime, CSkypeProto *ppro) :
AsyncHttpRequest(REQUEST_PUT, HOST_API, 0, &CSkypeProto::OnSentAvatar)
{
m_szUrl.AppendFormat("/users/%s/profile/avatar", ppro->m_szSkypename.MakeLower().c_str());
AddHeader("Content-Type", szMime);
- pData = (char *)mir_alloc(dataSize);
- memcpy(pData, data, dataSize);
- dataLength = (int)dataSize;
- }
-
- ~SetAvatarRequest()
- {
- mir_free(pData);
+ m_szParam.Truncate(dataSize);
+ memcpy(m_szParam.GetBuffer(), data, dataSize);
}
};
diff --git a/protocols/SkypeWeb/src/requests/files.h b/protocols/SkypeWeb/src/requests/files.h index 72c47b4788..d47b3637f3 100644 --- a/protocols/SkypeWeb/src/requests/files.h +++ b/protocols/SkypeWeb/src/requests/files.h @@ -28,7 +28,7 @@ struct ASMObjectCreateRequest : public AsyncHttpRequest struct ASMObjectUploadRequest : public AsyncHttpRequest { - ASMObjectUploadRequest(CSkypeProto *ppro, const char *szObject, const uint8_t *data, const size_t size, CFileUploadParam *fup) : + ASMObjectUploadRequest(CSkypeProto *ppro, const char *szObject, const uint8_t *data, int size, CFileUploadParam *fup) : AsyncHttpRequest(REQUEST_PUT, HOST_OTHER, 0, &CSkypeProto::OnASMObjectUploaded) { m_szUrl.AppendFormat("https://api.asm.skype.com/v1/objects/%s/content/original", szObject); @@ -37,13 +37,7 @@ struct ASMObjectUploadRequest : public AsyncHttpRequest AddHeader("Authorization", CMStringA(FORMAT, "skype_token %s", ppro->m_szApiToken.get())); AddHeader("Content-Type", "application/octet-stream"); - pData = (char*)mir_alloc(size); - memcpy(pData, data, size); - dataLength = (int)size; - } - - ~ASMObjectUploadRequest() - { - mir_free(pData); + m_szParam.Truncate(size); + memcpy(m_szParam.GetBuffer(), data, size); } }; |