diff options
Diffstat (limited to 'plugins/IEView/src/Utils.cpp')
-rw-r--r-- | plugins/IEView/src/Utils.cpp | 60 |
1 files changed, 2 insertions, 58 deletions
diff --git a/plugins/IEView/src/Utils.cpp b/plugins/IEView/src/Utils.cpp index d9a3f85043..ab30e81e72 100644 --- a/plugins/IEView/src/Utils.cpp +++ b/plugins/IEView/src/Utils.cpp @@ -229,62 +229,6 @@ DWORD Utils::safe_wcslen(wchar_t *msg, DWORD maxLen) { return 0;
}
-char * Utils::UTF8Encode(const wchar_t *wtext) {
- unsigned char *szOut;
- int len, i;
- const wchar_t *w;
-
- if (wtext == NULL) return NULL;
- for (len=0, w=wtext; *w; w++) {
- if (*w < 0x0080) len++;
- else if (*w < 0x0800) len += 2;
- else len += 3;
- }
- szOut = new unsigned char [len+1];
- if (szOut == NULL) return NULL;
-
- for (i=0, w=wtext; *w; w++) {
- if (*w < 0x0080)
- szOut[i++] = (unsigned char) *w;
- else if (*w < 0x0800) {
- szOut[i++] = 0xc0 | ((*w) >> 6);
- szOut[i++] = 0x80 | ((*w) & 0x3f);
- }
- else {
- szOut[i++] = 0xe0 | ((*w) >> 12);
- szOut[i++] = 0x80 | (((*w) >> 6) & 0x3f);
- szOut[i++] = 0x80 | ((*w) & 0x3f);
- }
- }
- szOut[i] = '\0';
- return (char *) szOut;
-}
-
-char *Utils::UTF8Encode(const char *text) {
- wchar_t *wtext = Utils::convertToWCS(text);
- char *atext = UTF8Encode(wtext);
- delete wtext;
- return atext;
-}
-
-void Utils::UTF8Encode(const char *text, char *output, int maxLen) {
- wchar_t *wtext = Utils::convertToWCS(text);
- char *atext = UTF8Encode(wtext);
- int slen = (int)strlen(atext) + 1;
- memcpy(output, atext, slen > maxLen ? maxLen : slen);
- output[maxLen - 1] = '\0';
- delete atext;
- delete wtext;
-}
-
-void Utils::UTF8Encode(const wchar_t *wtext, char *output, int maxLen) {
- char *atext = UTF8Encode(wtext);
- int slen = (int)strlen(atext) + 1;
- memcpy(output, atext, slen > maxLen ? maxLen : slen);
- output[maxLen - 1] = '\0';
- delete atext;
-}
-
int Utils::detectURL(const wchar_t *text) {
int i;
for (i=0;text[i]!='\0';i++) {
@@ -401,9 +345,9 @@ void Utils::destroyServices_Ex() { }
wchar_t *Utils::urlEncode(const wchar_t *text) {
- char *utf8 = UTF8Encode(text);
+ char *utf8 = mir_utf8encodeT(text);
wchar_t *result = urlEncode(utf8);
- delete utf8;
+ mir_free(utf8);
return result;
}
|