From 2e91047d7333f7795cbda482fb3dc22c1b1096b3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 22 Jul 2024 14:47:52 +0300 Subject: Tipper: old helpers removed --- plugins/TipperYM/src/bitmap_func.cpp | 14 ++-- plugins/TipperYM/src/message_pump.cpp | 2 +- plugins/TipperYM/src/mir_smileys.cpp | 2 +- plugins/TipperYM/src/options.cpp | 6 +- plugins/TipperYM/src/popwin.cpp | 18 +++-- plugins/TipperYM/src/str_utils.cpp | 126 +--------------------------------- plugins/TipperYM/src/str_utils.h | 30 -------- plugins/TipperYM/src/subst.cpp | 14 ++-- plugins/TipperYM/src/translations.cpp | 43 ++++++------ 9 files changed, 51 insertions(+), 204 deletions(-) (limited to 'plugins/TipperYM/src') diff --git a/plugins/TipperYM/src/bitmap_func.cpp b/plugins/TipperYM/src/bitmap_func.cpp index 1cfad4ac46..a9fb0c4444 100644 --- a/plugins/TipperYM/src/bitmap_func.cpp +++ b/plugins/TipperYM/src/bitmap_func.cpp @@ -150,7 +150,7 @@ void CreateFromBitmaps(bool bServiceTip) if (i == SKIN_ITEM_SIDEBAR && (!opt.iSidebarWidth || bServiceTip)) continue; - wchar_t* tszFileName = opt.szImgFile[i]; + wchar_t *tszFileName = opt.szImgFile[i]; if (tszFileName && *tszFileName != 0) { FIBITMAP *fib = nullptr; if (!skin.bCached) { @@ -551,9 +551,9 @@ static __forceinline COLOR32 geta(COLOR32 c) void PremultipleChannels() { for (int i = 0; i < skin.iWidth * skin.iHeight; i++) - skin.colBits[i] = rgba(getr(skin.colBits[i])*geta(skin.colBits[i]) / 255, - getg(skin.colBits[i])*geta(skin.colBits[i]) / 255, - getb(skin.colBits[i])*geta(skin.colBits[i]) / 255, + skin.colBits[i] = rgba(getr(skin.colBits[i]) * geta(skin.colBits[i]) / 255, + getg(skin.colBits[i]) * geta(skin.colBits[i]) / 255, + getb(skin.colBits[i]) * geta(skin.colBits[i]) / 255, geta(skin.colBits[i])); } @@ -588,9 +588,9 @@ void ColorizeBitmap() skin.colBits[i] = (cl > 128) ? rgba( - PU_DIV255((koef1r * cl + br)*alpha), - PU_DIV255((koef1g * cl + bg)*alpha), - PU_DIV255((koef1b * cl + bb)*alpha), + PU_DIV255((koef1r * cl + br) * alpha), + PU_DIV255((koef1g * cl + bg) * alpha), + PU_DIV255((koef1b * cl + bb) * alpha), alpha) : rgba( PU_DIV255(koef2r * cl * alpha), diff --git a/plugins/TipperYM/src/message_pump.cpp b/plugins/TipperYM/src/message_pump.cpp index ec252d07a3..a0e29c2735 100644 --- a/plugins/TipperYM/src/message_pump.cpp +++ b/plugins/TipperYM/src/message_pump.cpp @@ -245,7 +245,7 @@ INT_PTR ShowTip(WPARAM wParam, LPARAM lParam) if (wParam) // wParam is char pointer containing text - e.g. status bar tooltip { - clcit2->swzText = a2t((char *)wParam); + clcit2->swzText = mir_a2u((char *)wParam); GetCursorPos(&clcit2->ptCursor); } diff --git a/plugins/TipperYM/src/mir_smileys.cpp b/plugins/TipperYM/src/mir_smileys.cpp index 72c6369148..a3c2575efc 100644 --- a/plugins/TipperYM/src/mir_smileys.cpp +++ b/plugins/TipperYM/src/mir_smileys.cpp @@ -284,7 +284,7 @@ void DrawTextSmiley(HDC hdcMem, RECT free_rc, const wchar_t *szText, int len, SM RestoreAlpha(&free_rc, pBits); } -void DestroySmileyList(SortedList* p_list) +void DestroySmileyList(SortedList *p_list) { if (p_list == nullptr) return; diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index 175e9d1ded..14845f77c9 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -148,7 +148,7 @@ PRESETSUBST* GetPresetSubstByName(const char *szName) { if (!szName) return nullptr; - + for (auto &it : presetSubsts) if (mir_strcmp(it.szID, szName) == 0) return ⁢ @@ -354,14 +354,14 @@ void SaveDI(DISPLAYITEM *di, int index) mir_snprintf(setting, "DILabel%d", index); if (db_set_ws(0, MODULE_ITEMS, setting, di->swzLabel)) { char buff[LABEL_LEN]; - t2a(di->swzLabel, buff, LABEL_LEN); + w2a(di->swzLabel, buff, LABEL_LEN); db_set_s(0, MODULE_ITEMS, setting, buff); } mir_snprintf(setting, "DIValue%d", index); if (db_set_ws(0, MODULE_ITEMS, setting, di->swzValue)) { char buff[VALUE_LEN]; - t2a(di->swzValue, buff, VALUE_LEN); + w2a(di->swzValue, buff, VALUE_LEN); db_set_s(0, MODULE_ITEMS, setting, buff); } diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp index 28eb6e4f4b..db7fd0b039 100644 --- a/plugins/TipperYM/src/popwin.cpp +++ b/plugins/TipperYM/src/popwin.cpp @@ -77,7 +77,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (pa->IsLocked()) mir_snwprintf(pwd->swzTitle, TranslateT("%s (locked)"), pwd->swzTitle); } - else a2t(pwd->clcit.szProto, pwd->swzTitle, TITLE_TEXT_LEN); + else a2w(pwd->clcit.szProto, pwd->swzTitle, TITLE_TEXT_LEN); // protocol status int wStatus = Proto_GetStatus(pwd->clcit.szProto); @@ -258,7 +258,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa buff[iBuffPos] = 0; if (iBuffPos) { - pwd->rows = (RowData *)mir_realloc(pwd->rows, sizeof(RowData)* (pwd->iRowCount + 1)); + pwd->rows = (RowData *)mir_realloc(pwd->rows, sizeof(RowData) * (pwd->iRowCount + 1)); pwd->rows[pwd->iRowCount].bValueNewline = false; pwd->rows[pwd->iRowCount].swzLabel = mir_wstrdup(buff); if (pwd->iRowCount == 1 && bTopMessage) @@ -662,7 +662,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (pwd->rows[i].iValueHeight) { if (pwd->rows[i].bValueNewline || !pwd->rows[i].iLabelHeight) tr.top += opt.iTextPadding; - if (pwd->rows[i].iLabelHeight > pwd->rows[i].iValueHeight && pwd->bIsTextTip&& pwd->rows[i].bIsTitle) + if (pwd->rows[i].iLabelHeight > pwd->rows[i].iValueHeight && pwd->bIsTextTip && pwd->rows[i].bIsTitle) tr.top = tr.bottom - pwd->rows[i].iValueHeight - 2; else tr.bottom = tr.top + iRowHeight; @@ -1030,7 +1030,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa mir_free(pwd->rows[pwd->iRowCount].swzValue); Smileys_FreeParse(pwd->rows[pwd->iRowCount].spi); //prevent possible mem leak } - else pwd->rows = (RowData *)mir_realloc(pwd->rows, sizeof(RowData)* (pwd->iRowCount + 1)); + else pwd->rows = (RowData *)mir_realloc(pwd->rows, sizeof(RowData) * (pwd->iRowCount + 1)); char *szProto = Proto_GetBaseAccountName(pwd->hContact); @@ -1597,12 +1597,10 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa } wchar_t *swzNick = Clist_GetContactDisplayName(hContact); - if (opt.iFavoriteContFlags & FAVCONT_APPEND_PROTO) { - wchar_t *swzProto = a2t(proto); - mir_snwprintf(swzName, L"%s (%s)", swzNick, swzProto); - mir_free(swzProto); - } - else mir_wstrcpy(swzName, swzNick); + if (opt.iFavoriteContFlags & FAVCONT_APPEND_PROTO) + mir_snwprintf(swzName, L"%s (%S)", swzNick, proto); + else + mir_wstrcpy(swzName, swzNick); AddRow(pwd, swzName, swzStatus, nullptr, false, false, false); } diff --git a/plugins/TipperYM/src/str_utils.cpp b/plugins/TipperYM/src/str_utils.cpp index b15abbf5fc..4c2f05ab54 100644 --- a/plugins/TipperYM/src/str_utils.cpp +++ b/plugins/TipperYM/src/str_utils.cpp @@ -50,7 +50,7 @@ bool a2utf(const char *as, char *buff, int bufflen) { if (!as) return false; - wchar_t *ws = a2w(as); + wchar_t *ws = mir_a2u(as); if (ws) WideCharToMultiByte(CP_UTF8, 0, ws, -1, buff, bufflen, nullptr, nullptr); mir_free(ws); return true; @@ -60,134 +60,12 @@ bool utf2a(const char *us, char *buff, int bufflen) { if (!us) return false; - wchar_t *ws = utf2w(us); + wchar_t *ws = mir_utf8decodeW(us); if (ws) WideCharToMultiByte(iCodePage, 0, ws, -1, buff, bufflen, nullptr, nullptr); mir_free(ws); return true; } - -bool t2w(const wchar_t *ts, wchar_t *buff, int bufflen) -{ - wcsncpy(buff, ts, bufflen); - return true; -} - -bool w2t(const wchar_t *ws, wchar_t *buff, int bufflen) -{ - wcsncpy(buff, ws, bufflen); - return true; -} - -bool t2a(const wchar_t *ts, char *buff, int bufflen) -{ - return w2a(ts, buff, bufflen); -} - -bool a2t(const char *as, wchar_t *buff, int bufflen) -{ - return a2w(as, buff, bufflen); -} - -bool t2utf(const wchar_t *ts, char *buff, int bufflen) -{ - return w2utf(ts, buff, bufflen); -} - -bool utf2t(const char *us, wchar_t *buff, int bufflen) -{ - return utf2w(us, buff, bufflen); -} - -wchar_t *utf2w(const char *us) -{ - if (us) { - int size = MultiByteToWideChar(CP_UTF8, 0, us, -1, nullptr, 0); - wchar_t *buff = (wchar_t *)mir_alloc(size * sizeof(wchar_t)); - MultiByteToWideChar(CP_UTF8, 0, us, -1, buff, size); - return buff; - } - else { - return nullptr; - } -} - -char *w2utf(const wchar_t *ws) -{ - if (ws) { - int size = WideCharToMultiByte(CP_UTF8, 0, ws, -1, nullptr, 0, nullptr, nullptr); - char *buff = (char *)mir_alloc(size); - WideCharToMultiByte(CP_UTF8, 0, ws, -1, buff, size, nullptr, nullptr); - return buff; - } - else { - return nullptr; - } -} - -wchar_t *a2w(const char *as) -{ - int size = MultiByteToWideChar(iCodePage, 0, as, -1, nullptr, 0); - wchar_t *buff = (wchar_t *)mir_alloc(size * sizeof(wchar_t)); - MultiByteToWideChar(iCodePage, 0, as, -1, buff, size); - return buff; -} - -char *w2a(const wchar_t *ws) -{ - int size = WideCharToMultiByte(iCodePage, 0, ws, -1, nullptr, 0, nullptr, nullptr); - char *buff = (char *)mir_alloc(size); - WideCharToMultiByte(iCodePage, 0, ws, -1, buff, size, nullptr, nullptr); - return buff; -} - -char *utf2a(const char *utfs) -{ - wchar_t *ws = utf2w(utfs); - char *ret = w2a(ws); - mir_free(ws); - return ret; -} - -char *a2utf(const char *as) -{ - wchar_t *ws = a2w(as); - char *ret = w2utf(ws); - mir_free(ws); - return ret; -} - -wchar_t *w2t(const wchar_t *ws) -{ - return mir_wstrdup(ws); -} - -wchar_t *t2w(const wchar_t *ts) -{ - return mir_wstrdup(ts); -} - - -char *t2a(const wchar_t *ts) -{ - return w2a(ts); -} - -wchar_t *a2t(const char *as) -{ - return a2w(as); -} - -wchar_t *utf2t(const char *utfs) -{ - return utf2w(utfs); -} - -char *t2utf(const wchar_t *ts) -{ - return w2utf(ts); -} - wchar_t *myfgets(wchar_t *Buf, int MaxCount, FILE *File) { fgetws(Buf, MaxCount, File); diff --git a/plugins/TipperYM/src/str_utils.h b/plugins/TipperYM/src/str_utils.h index 4beca4e51b..1c6cf364c5 100644 --- a/plugins/TipperYM/src/str_utils.h +++ b/plugins/TipperYM/src/str_utils.h @@ -21,8 +21,6 @@ Boston, MA 02111-1307, USA. #ifndef _STR_UTILS_INC #define _STR_UTILS_INC -void set_codepage(); - bool a2w(const char *as, wchar_t *buff, int bufflen); bool w2a(const wchar_t *ws, char *buff, int bufflen); @@ -32,34 +30,6 @@ bool w2utf(const wchar_t *ws, char *buff, int bufflen); bool a2utf(const char *as, char *buff, int bufflen); bool utf2a(const char *ws, char *buff, int bufflen); -bool t2w(const wchar_t *ts, wchar_t *buff, int bufflen); -bool w2t(const wchar_t *ws, wchar_t *buff, int bufflen); - -bool t2a(const wchar_t *ts, char *buff, int bufflen); -bool a2t(const char *as, wchar_t *buff, int bufflen); - -bool t2utf(const wchar_t *ts, char *buff, int bufflen); -bool utf2t(const char *us, wchar_t *buff, int bufflen); - -// remember to free return value -wchar_t *a2w(const char *as); -char *w2a(const wchar_t *ws); - -wchar_t *utf2w(const char *us); -char *w2utf(const wchar_t *ws); - -char *utf2a(const char *us); -char *a2utf(const char *as); - -wchar_t *t2w(const wchar_t *ts); -wchar_t *w2t(const wchar_t *ws); - -wchar_t *utf2t(const char *us); -char *t2utf(const wchar_t *ts); - -char *t2a(const wchar_t *ts); -wchar_t *a2t(const char *as); - wchar_t *myfgets(wchar_t *Buf, int MaxCount, FILE *File); #endif diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index 54a6f9bd5e..55661ecf0f 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -40,11 +40,11 @@ bool DBGetContactSettingAsString(MCONTACT hContact, const char *szModuleName, co _ltow(dbv.dVal, buff, 10); break; case DBVT_ASCIIZ: - if (dbv.pszVal) a2t(dbv.pszVal, buff, bufflen); + if (dbv.pszVal) a2w(dbv.pszVal, buff, bufflen); buff[bufflen - 1] = 0; break; case DBVT_UTF8: - if (dbv.pszVal) utf2t(dbv.pszVal, buff, bufflen); + if (dbv.pszVal) utf2w(dbv.pszVal, buff, bufflen); buff[bufflen - 1] = 0; break; @@ -134,7 +134,7 @@ uint32_t LastMessageTimestamp(MCONTACT hContact, bool received) void FormatTimestamp(uint32_t ts, char *szFormat, wchar_t *buff, int bufflen) { wchar_t swzForm[16]; - a2t(szFormat, swzForm, 16); + a2w(szFormat, swzForm, 16); TimeZone_ToStringW(ts, swzForm, buff, bufflen); } @@ -247,7 +247,7 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int if (!mir_wstrcmp(swzRawSpec, L"proto")) { char *szProto = Proto_GetBaseAccountName(hContact); if (szProto) { - a2t(szProto, buff, bufflen); + a2w(szProto, buff, bufflen); return true; } } @@ -525,7 +525,7 @@ bool ApplySubst(MCONTACT hContact, const wchar_t *swzSource, bool parseTipperVar while (p <= last + 1) { len = (int)wcscspn(p, L","); - t2a(p, sproto, len); + w2a(p, sproto, len); sproto[len] = 0; p += len + 1; @@ -549,7 +549,7 @@ bool ApplySubst(MCONTACT hContact, const wchar_t *swzSource, bool parseTipperVar if (mir_wstrlen(p) > 4 && wcsncmp(p, L"raw:", 4) == 0) { // raw db substitution char raw_spec[LABEL_LEN]; p += 4; - t2a(p, raw_spec, LABEL_LEN); + w2a(p, raw_spec, LABEL_LEN); GetRawSubstText(hContact, raw_spec, swzAlt, VALUE_LEN); } else if (mir_wstrlen(p) > 4 && wcsncmp(p, L"sys:", 4) == 0) { // 'system' substitution @@ -582,7 +582,7 @@ bool ApplySubst(MCONTACT hContact, const wchar_t *swzSource, bool parseTipperVar if (v > 4 && wcsncmp(swzVName, L"raw:", 4) == 0) // raw db substitution { char raw_spec[LABEL_LEN]; - t2a(&swzVName[4], raw_spec, LABEL_LEN); + w2a(&swzVName[4], raw_spec, LABEL_LEN); bSubst = GetRawSubstText(hContact, raw_spec, swzRep, VALUE_LEN); } else if (v > 4 && wcsncmp(swzVName, L"sys:", 4) == 0) // 'system' substitution diff --git a/plugins/TipperYM/src/translations.cpp b/plugins/TipperYM/src/translations.cpp index 1d2e59b5c5..ca6c567a50 100644 --- a/plugins/TipperYM/src/translations.cpp +++ b/plugins/TipperYM/src/translations.cpp @@ -147,7 +147,7 @@ void AddTranslation(DBVTranslation *newTrans) mir_free(szName); } -wchar_t *NullTranslation(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) +wchar_t* NullTranslation(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) { if (DBGetContactSettingAsString(hContact, szModuleName, szSettingName, buff, bufflen)) return buff; @@ -210,7 +210,7 @@ wchar_t* TimestampToTimeDifference(MCONTACT hContact, const char *szModuleName, return buff; } -wchar_t *SecondsToTimeDifference(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) +wchar_t* SecondsToTimeDifference(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) { uint32_t diff = db_get_dw(hContact, szModuleName, szSettingName, 0); int d = (diff / 60 / 60 / 24); @@ -226,7 +226,7 @@ wchar_t *SecondsToTimeDifference(MCONTACT hContact, const char *szModuleName, co return buff; } -wchar_t *WordToStatusDesc(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) +wchar_t* WordToStatusDesc(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) { uint16_t wStatus = db_get_w(hContact, szModuleName, szSettingName, ID_STATUS_OFFLINE); wchar_t *szStatus = Clist_GetStatusModeDescription(wStatus, 0); @@ -234,7 +234,7 @@ wchar_t *WordToStatusDesc(MCONTACT hContact, const char *szModuleName, const cha return buff; } -wchar_t *ByteToYesNo(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) +wchar_t* ByteToYesNo(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) { DBVARIANT dbv; if (!db_get(hContact, szModuleName, szSettingName, &dbv)) { @@ -252,7 +252,7 @@ wchar_t *ByteToYesNo(MCONTACT hContact, const char *szModuleName, const char *sz return nullptr; } -wchar_t *ByteToGender(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) +wchar_t* ByteToGender(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) { uint8_t val = (uint8_t)db_get_b(hContact, szModuleName, szSettingName, 0); if (val == 'F') @@ -266,14 +266,15 @@ wchar_t *ByteToGender(MCONTACT hContact, const char *szModuleName, const char *s return buff; } -wchar_t *WordToCountry(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) +wchar_t* WordToCountry(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) { char *szCountryName = nullptr; uint16_t cid = (uint16_t)db_get_w(hContact, szModuleName, szSettingName, (uint16_t)-1); if (cid != (uint16_t)-1 && ServiceExists(MS_UTILS_GETCOUNTRYBYNUMBER) && (szCountryName = (char *)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, cid, 0)) != nullptr) { if (mir_strcmp(szCountryName, "Unknown") == 0) return nullptr; - a2t(szCountryName, buff, bufflen); + + a2w(szCountryName, buff, bufflen); buff[bufflen - 1] = 0; return buff; } @@ -309,7 +310,7 @@ bool GetInt(const DBVARIANT &dbv, int *iVal) return false; } -wchar_t *DayMonthYearToDate(MCONTACT hContact, const char *szModuleName, const char *prefix, wchar_t *buff, int bufflen) +wchar_t* DayMonthYearToDate(MCONTACT hContact, const char *szModuleName, const char *prefix, wchar_t *buff, int bufflen) { DBVARIANT dbv; char szSettingName[256]; @@ -350,7 +351,7 @@ wchar_t *DayMonthYearToDate(MCONTACT hContact, const char *szModuleName, const c return nullptr; } -wchar_t *DayMonthYearToAge(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen) +wchar_t* DayMonthYearToAge(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen) { DBVARIANT dbv; char szSettingName[256]; @@ -393,7 +394,7 @@ wchar_t *DayMonthYearToAge(MCONTACT hContact, const char *szModuleName, const ch return nullptr; } -wchar_t *HoursMinutesSecondsToTime(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen) +wchar_t* HoursMinutesSecondsToTime(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen) { DBVARIANT dbv; char szSettingName[256]; @@ -432,7 +433,7 @@ wchar_t *HoursMinutesSecondsToTime(MCONTACT hContact, const char *szModuleName, return nullptr; } -wchar_t *HoursMinutesToTime(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen) +wchar_t* HoursMinutesToTime(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen) { DBVARIANT dbv; char szSettingName[256]; @@ -464,7 +465,7 @@ wchar_t *HoursMinutesToTime(MCONTACT hContact, const char *szModuleName, const c return nullptr; } -wchar_t *DmyToTimeDifference(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen) +wchar_t* DmyToTimeDifference(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen) { DBVARIANT dbv; char szSettingName[256]; @@ -555,7 +556,7 @@ wchar_t *DmyToTimeDifference(MCONTACT hContact, const char *szModuleName, const return nullptr; } -wchar_t *DayMonthToDaysToNextBirthday(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen) +wchar_t* DayMonthToDaysToNextBirthday(MCONTACT hContact, const char *szModuleName, const char *szPrefix, wchar_t *buff, int bufflen) { DBVARIANT dbv; char szSettingName[256]; @@ -601,7 +602,7 @@ wchar_t *DayMonthToDaysToNextBirthday(MCONTACT hContact, const char *szModuleNam } -wchar_t *EmptyXStatusToDefaultName(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) +wchar_t* EmptyXStatusToDefaultName(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) { wchar_t szDefaultName[1024]; CUSTOM_STATUS xstatus = { 0 }; @@ -639,7 +640,7 @@ wchar_t *EmptyXStatusToDefaultName(MCONTACT hContact, const char *szModuleName, return nullptr; } -wchar_t *TimezoneToTime(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) +wchar_t* TimezoneToTime(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) { int timezone = db_get_b(hContact, szModuleName, szSettingName, 256); if (timezone == 256 || (char)timezone == -100) @@ -664,11 +665,11 @@ wchar_t *TimezoneToTime(MCONTACT hContact, const char *szModuleName, const char return buff; } -wchar_t *ByteToDay(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) +wchar_t* ByteToDay(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) { int iDay = db_get_w(hContact, szModuleName, szSettingName, -1); if (iDay > -1 && iDay < 7) { - a2t(Translate(days[iDay]), buff, bufflen); + a2w(Translate(days[iDay]), buff, bufflen); buff[bufflen - 1] = 0; return buff; } @@ -676,11 +677,11 @@ wchar_t *ByteToDay(MCONTACT hContact, const char *szModuleName, const char *szSe return nullptr; } -wchar_t *ByteToMonth(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) +wchar_t* ByteToMonth(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) { int iMonth = db_get_w(hContact, szModuleName, szSettingName, 0); if (iMonth > 0 && iMonth < 13) { - a2t(Translate(months[iMonth - 1]), buff, bufflen); + a2w(Translate(months[iMonth - 1]), buff, bufflen); buff[bufflen - 1] = 0; return buff; } @@ -688,13 +689,13 @@ wchar_t *ByteToMonth(MCONTACT hContact, const char *szModuleName, const char *sz return nullptr; } -wchar_t *ByteToLanguage(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) +wchar_t* ByteToLanguage(MCONTACT hContact, const char *szModuleName, const char *szSettingName, wchar_t *buff, int bufflen) { int iLang = db_get_b(hContact, szModuleName, szSettingName, 0); if (iLang) { for (auto &it : languages) { if (iLang == it.id) { - a2t(Translate(it.szValue), buff, bufflen); + a2w(Translate(it.szValue), buff, bufflen); buff[bufflen - 1] = 0; return buff; } -- cgit v1.2.3