diff options
author | George Hazan <ghazan@miranda.im> | 2019-02-17 23:04:21 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-02-19 19:24:16 +0300 |
commit | 2e125090810014fa46cd9bb27b2e4daea32ba2f4 (patch) | |
tree | 6b8d6ea72c0adeb7c9ba2a6e01490d6437fa94f6 | |
parent | b04db4768abe18ae03e3f9b6f9d7be569d9f14a9 (diff) |
MIME types are of type char, not wchar_t
-rw-r--r-- | include/m_core.h | 4 | ||||
-rw-r--r-- | protocols/Discord/src/avatars.cpp | 8 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/utils.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/proto_utils.cpp | 26 |
4 files changed, 20 insertions, 20 deletions
diff --git a/include/m_core.h b/include/m_core.h index a13d9fc118..65a24c3eab 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -324,10 +324,10 @@ MIR_APP_DLL(int) ProtoGetAvatarFormat(const wchar_t *ptszFileName); MIR_APP_DLL(int) ProtoGetAvatarFileFormat(const wchar_t *ptszFileName);
// returns the mime type according to a picture type (PA_*) passed
-MIR_APP_DLL(const wchar_t*) ProtoGetAvatarMimeType(int iFileType);
+MIR_APP_DLL(const char*) ProtoGetAvatarMimeType(int iFileType);
// returns the picture type (PA_*) according to a mime type passed
-MIR_APP_DLL(int) ProtoGetAvatarFormatByMimeType(const wchar_t *pwszMimeType);
+MIR_APP_DLL(int) ProtoGetAvatarFormatByMimeType(const char *pwszMimeType);
// returns the image format and extension by the first bytes of picture
// ptszExtension might be NULL
diff --git a/protocols/Discord/src/avatars.cpp b/protocols/Discord/src/avatars.cpp index 150bc39ac6..19a8adc158 100644 --- a/protocols/Discord/src/avatars.cpp +++ b/protocols/Discord/src/avatars.cpp @@ -71,7 +71,7 @@ LBL_Error: for (int i = 0; i < reply->headersCount; i++) if (!mir_strcmp(reply->headers[i].szName, "Content-Type")) { - ai.format = ProtoGetAvatarFormatByMimeType(_A2T(reply->headers[i].szValue)); + ai.format = ProtoGetAvatarFormatByMimeType(reply->headers[i].szValue); break; } @@ -170,12 +170,12 @@ INT_PTR CDiscordProto::SetMyAvatar(WPARAM, LPARAM lParam) CMStringA szPayload("data:"); - const wchar_t *wszMimeType = ProtoGetAvatarMimeType(ProtoGetAvatarFileFormat(pwszFilename)); - if (wszMimeType == nullptr) { + const char *szMimeType = ProtoGetAvatarMimeType(ProtoGetAvatarFileFormat(pwszFilename)); + if (szMimeType == nullptr) { debugLogA("invalid file format for avatar %S", pwszFilename); return 1; } - szPayload.AppendFormat("%S;base64,", wszMimeType); + szPayload.AppendFormat("%s;base64,", szMimeType); FILE *in = _wfopen(pwszFilename, L"rb"); if (in == nullptr) { debugLogA("cannot open avatar file %S for reading", pwszFilename); diff --git a/protocols/ICQ-WIM/src/utils.cpp b/protocols/ICQ-WIM/src/utils.cpp index bbb0faef31..7467ffee31 100644 --- a/protocols/ICQ-WIM/src/utils.cpp +++ b/protocols/ICQ-WIM/src/utils.cpp @@ -223,7 +223,7 @@ INT_PTR __cdecl CIcqProto::SetAvatar(WPARAM, LPARAM lParam) return 3; } - pReq->AddHeader("Content-Type", _T2A(ProtoGetAvatarMimeType(iAvatarType))); + pReq->AddHeader("Content-Type", ProtoGetAvatarMimeType(iAvatarType)); } Push(pReq); diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp index 9e575e3d00..12d6ac1202 100644 --- a/src/mir_app/src/proto_utils.cpp +++ b/src/mir_app/src/proto_utils.cpp @@ -371,29 +371,29 @@ MIR_APP_DLL(int) ProtoGetAvatarFileFormat(const wchar_t *ptszFileName) /////////////////////////////////////////////////////////////////////////////////////////
// mime type functions
-static wchar_t *wszMimeTypes[] =
-{
- L"application/octet-stream", // PA_FORMAT_UNKNOWN
- L"image/png", // PA_FORMAT_PNG
- L"image/jpeg", // PA_FORMAT_JPEG
- L"image/icon", // PA_FORMAT_ICON
- L"image/bmp", // PA_FORMAT_BMP
- L"image/gif", // PA_FORMAT_GIF
- L"image/swf", // PA_FORMAT_SWF
- L"application/xml" // PA_FORMAT_XML
+static char *wszMimeTypes[] =
+{
+ "application/octet-stream", // PA_FORMAT_UNKNOWN
+ "image/png", // PA_FORMAT_PNG
+ "image/jpeg", // PA_FORMAT_JPEG
+ "image/icon", // PA_FORMAT_ICON
+ "image/bmp", // PA_FORMAT_BMP
+ "image/gif", // PA_FORMAT_GIF
+ "image/swf", // PA_FORMAT_SWF
+ "application/xml" // PA_FORMAT_XML
};
-MIR_APP_DLL(const wchar_t*) ProtoGetAvatarMimeType(int iFileType)
+MIR_APP_DLL(const char*) ProtoGetAvatarMimeType(int iFileType)
{
if (iFileType >= 0 && iFileType < _countof(wszMimeTypes))
return wszMimeTypes[iFileType];
return nullptr;
}
-MIR_APP_DLL(int) ProtoGetAvatarFormatByMimeType(const wchar_t *pwszMimeType)
+MIR_APP_DLL(int) ProtoGetAvatarFormatByMimeType(const char *pwszMimeType)
{
for (int i = 0; i < _countof(wszMimeTypes); i++)
- if (!mir_wstrcmp(pwszMimeType, wszMimeTypes[i]))
+ if (!mir_strcmp(pwszMimeType, wszMimeTypes[i]))
return i;
return PA_FORMAT_UNKNOWN;
|