From d55f17dea8734cfb458fd8fcbac684d141b181af Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 19 Jun 2015 16:19:57 +0000 Subject: various quirks during MS_DB_TIME_TIMESTAMPTOSTRINGT calls git-svn-id: http://svn.miranda-ng.org/main/trunk@14265 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AvatarHistory/src/AvatarDlg.cpp | 2 +- plugins/IEView/src/ScriverHTMLBuilder.cpp | 2 -- plugins/Msg_Export/src/utils.cpp | 24 +----------------------- plugins/UserInfoEx/src/ctrl_tzcombo.cpp | 20 ++------------------ plugins/UserInfoEx/src/ctrl_tzcombo.h | 2 +- plugins/Utils/mir_buffer.h | 2 +- plugins/Variables/src/parse_miranda.cpp | 2 +- 7 files changed, 7 insertions(+), 47 deletions(-) diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp index a6e8a24029..dd425345d6 100644 --- a/plugins/AvatarHistory/src/AvatarDlg.cpp +++ b/plugins/AvatarHistory/src/AvatarDlg.cpp @@ -441,7 +441,7 @@ int FillAvatarListFromDB(HWND list, MCONTACT hContact) DBTIMETOSTRINGT tts = {0}; tts.szFormat = _T("d s"); tts.szDest = date; - tts.cbDest = sizeof(date); + tts.cbDest = SIZEOF(date); CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)dbei.timestamp, (LPARAM)&tts); // Get file in disk diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp index ec87e8877c..7e98f6a877 100644 --- a/plugins/IEView/src/ScriverHTMLBuilder.cpp +++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp @@ -169,9 +169,7 @@ char *ScriverHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mod mir_strcat(format, (dwFlags & SMF_LOG_SHOWSECONDS) ? "s" : "t"); } if (format[0] != '\0') { - // CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, check, (LPARAM) & dbtts); CallService(MS_DB_TIME_TIMESTAMPTOSTRING, check, (LPARAM)& dbtts); - //mir_tstrncat(szResult, str, 500); mir_strncat(szResult, str, SIZEOF(szResult) - mir_strlen(szResult)); } mir_strncpy(szResult, ptrA(mir_utf8encode(szResult)), 500); diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index acee271fea..755193bddd 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -1135,7 +1135,7 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei) dbei.flags & DBEF_SENT ? sLocalUser.c_str() : sRemoteUser.c_str()); DBTIMETOSTRINGT dbtts; - dbtts.cbDest = sizeof(szTemp) - nIndent - 2; + dbtts.cbDest = SIZEOF(szTemp) - nIndent - 2; dbtts.szDest = &szTemp[nIndent]; dbtts.szFormat = (TCHAR*)sTimeFormat.c_str(); @@ -1168,28 +1168,6 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei) } mir_free(msg); break; - /* - const char *pszData = (const char*)dbei.pBlob; - bool bConvertedToUtf8 = false; - if (bWriteUTF8Format )// Write UTF-8 format in file ? - { - int nAnsiLen = mir_strlen((char *) dbei.pBlob)+1; - if (nAnsiLen < (int)dbei.cbBlob ) - { - // Message is also encoded in unicode UTF-16/UCS-2, little endian. - if (WideCharToMultiByte( CP_UTF8, 0, (wchar_t*)&dbei.pBlob[ nAnsiLen ], nAnsiLen, szTemp, sizeof(szTemp), 0, 0)) - { - pszData = szTemp; - bConvertedToUtf8 = true; - } - } - // We need to write in UTF8 format so we have to convert ansi string to UTF8 - } - if ( !bWriteIndentedToFile( hFile, nIndent, pszData, bWriteUTF8Format)) - { - DisplayErrorDialog( _T("Failed to write message to the file :\n"), sFilePath, &dbei); - } - break;*/ } case EVENTTYPE_URL: case EVENTTYPE_FILE: diff --git a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp index ab1fc0064c..7159718a51 100644 --- a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp +++ b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp @@ -273,23 +273,7 @@ void CTzCombo::OnChangedByUser(WORD wChangedMsg) * * @return nothing **/ -void CTzCombo::GetTime(LPTSTR szTime, WORD cchTime) +void CTzCombo::GetTime(LPTSTR szTime, int cchTime) { - //use new core tz interface - if (tmi.printDateTime) { - tmi.printDateTime((HANDLE)ComboBox_GetItemData(_hwnd, _curSel), _T("t"), szTime, cchTime, 0); - } - //fallback use old UIEX method - else { - const CTimeZone *pTimeZone = (CTimeZone*)ComboBox_GetItemData(_hwnd, _curSel); - if (PtrIsValid(pTimeZone)) { - MTime now; - TIME_ZONE_INFORMATION tzi = *pTimeZone; - - now.GetTimeUTC(); - now.UTCToTzSpecificLocal(&tzi); - now.TimeFormat(szTime, cchTime); - } - else mir_tstrcpy(szTime, _T("--:--")); - } + tmi.printDateTime((HANDLE)ComboBox_GetItemData(_hwnd, _curSel), _T("t"), szTime, cchTime, 0); } diff --git a/plugins/UserInfoEx/src/ctrl_tzcombo.h b/plugins/UserInfoEx/src/ctrl_tzcombo.h index 08e5ef092d..4402a54375 100644 --- a/plugins/UserInfoEx/src/ctrl_tzcombo.h +++ b/plugins/UserInfoEx/src/ctrl_tzcombo.h @@ -50,7 +50,7 @@ public: virtual void OnApply(MCONTACT hContact, LPCSTR pszProto); virtual void OnChangedByUser(WORD wChangedMsg); - void GetTime(LPTSTR szTime, WORD cchTime); + void GetTime(LPTSTR szTime, int cchTime); }; #endif /* _UI_CTRL_TZ_COMBO_INCLUDE_ */ \ No newline at end of file diff --git a/plugins/Utils/mir_buffer.h b/plugins/Utils/mir_buffer.h index 5391b1bcf4..eb7b084579 100644 --- a/plugins/Utils/mir_buffer.h +++ b/plugins/Utils/mir_buffer.h @@ -470,7 +470,7 @@ static void ReplaceVars(Buffer *buffer, MCONTACT hContact, TCHAR **variab DBTIMETOSTRINGT tst = {0}; tst.szFormat = _T("d s"); tst.szDest = tmp; - tst.cbDest = 128; + tst.cbDest = SIZEOF(tmp); CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM) time(NULL), (LPARAM) &tst); buffer->replace(j, i + 1, tmp); } diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index 0457611215..2710effbf0 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -715,7 +715,7 @@ static TCHAR *parseMirDateString(ARGUMENTSINFO *ai) DBTIMETOSTRINGT tst = { 0 }; tst.szFormat = _T("d s"); tst.szDest = ret; - tst.cbDest = 128; + tst.cbDest = SIZEOF(ret); if (CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)time(NULL), (LPARAM)&tst)) return NULL; -- cgit v1.2.3