From 7f22e924e0146afa260530c0920c7968d88ddbd9 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 20 May 2012 17:15:16 +0000 Subject: minor fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@102 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/NewAwaySysMod/AwayOpt.cpp | 2 +- plugins/NewAwaySysMod/AwaySys.cpp | 18 +++++++++--------- plugins/NewAwaySysMod/CommonLibs/CString.cpp | 8 +++++--- plugins/NewAwaySysMod/NewAwaySys.vcxproj | 2 ++ plugins/NewAwaySysMod/Notification.cpp | 2 +- 5 files changed, 18 insertions(+), 14 deletions(-) (limited to 'plugins/NewAwaySysMod') diff --git a/plugins/NewAwaySysMod/AwayOpt.cpp b/plugins/NewAwaySysMod/AwayOpt.cpp index 054c212144..cf263c5cfe 100644 --- a/plugins/NewAwaySysMod/AwayOpt.cpp +++ b/plugins/NewAwaySysMod/AwayOpt.cpp @@ -756,7 +756,7 @@ void EnableAutoreplyOptDlgControls() int I; g_AutoreplyOptPage.PageToMem(); int Autoreply = g_AutoreplyOptPage.GetValue(IDC_REPLYDLG_ENABLEREPLY); - int OnlyIdleReply = g_AutoreplyOptPage.GetValue(IDC_REPLYDLG_ONLYIDLEREPLY); + for (I = 0; I < g_AutoreplyOptPage.Items.GetSize(); I++) { switch (g_AutoreplyOptPage.Items[I]->GetParam()) diff --git a/plugins/NewAwaySysMod/AwaySys.cpp b/plugins/NewAwaySysMod/AwaySys.cpp index 497fecc00f..c810368ebf 100644 --- a/plugins/NewAwaySysMod/AwaySys.cpp +++ b/plugins/NewAwaySysMod/AwaySys.cpp @@ -480,13 +480,13 @@ int PreBuildContactMenu(WPARAM wParam, LPARAM lParam) } if ((Flag1 & PF1_MODEMSGSEND && CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iMode)) || ((Flag1 & PF1_IM) == PF1_IM && (I < 0 || !g_AutoreplyOptPage.GetDBValueCopy(StatusModeList[I].DisableReplyCtlID)))) { // the protocol supports status message sending for current status, or autoreplying - _stprintf(szSetStr, TranslateT("Set %s message for the contact"), CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, iMode, GSMDF_TCHAR), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)); + mir_sntprintf(szSetStr, SIZEOF(szSetStr), TranslateT("Set %s message for the contact"), CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, iMode, GSMDF_TCHAR), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)); miSetMsg.ptszName = szSetStr; miSetMsg.flags = CMIM_FLAGS | CMIF_TCHAR | CMIM_NAME; } if (Flag1 & PF1_MODEMSGRECV && CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iContactMode)) { // the protocol supports status message reading for contact's status - _stprintf(szReadStr, TranslateT("Re&ad %s Message"), CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, iContactMode, GSMDF_TCHAR)); + mir_sntprintf(szReadStr, SIZEOF(szReadStr), TranslateT("Re&ad %s Message"), CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, iContactMode, GSMDF_TCHAR)); miReadMsg.ptszName = szReadStr; miReadMsg.flags = CMIM_FLAGS | CMIF_TCHAR | CMIM_NAME | CMIM_ICON; miReadMsg.hIcon = LoadSkinnedProtoIcon(szProto, iContactMode); @@ -693,7 +693,7 @@ static int ContactSettingsInit(WPARAM wParam, LPARAM lParam) if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS)) { - _stprintf(Title, TranslateT("Enable autoreply when you are %s"), (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, StatusMode, GSMDF_TCHAR)); + mir_sntprintf(Title, SIZEOF(Title), TranslateT("Enable autoreply when you are %s"), (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, StatusMode, GSMDF_TCHAR)); csc.ptszTitle = Title; csc.ptszTooltip = TranslateT("\"Store contact autoreply/ignore settings for each status separately\" is enabled, so this setting is per-contact AND per-status."); } else @@ -707,7 +707,7 @@ static int ContactSettingsInit(WPARAM wParam, LPARAM lParam) if (g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_PERSTATUSPERSONALSETTINGS)) { - _stprintf(Title, TranslateT("Don't send status message when you are %s"), (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, StatusMode, GSMDF_TCHAR)); + mir_sntprintf(Title, SIZEOF(Title), TranslateT("Don't send status message when you are %s"), (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, StatusMode, GSMDF_TCHAR)); csc.ptszTitle = Title; csc.ptszTooltip = TranslateT("Ignore status message requests from this contact and don't send an autoreply.\r\n\"Store contact autoreply/ignore settings for each status separately\" is enabled, so this setting is per-contact AND per-status."); } else @@ -756,11 +756,11 @@ int srvVariablesHandler(WPARAM wParam, LPARAM lParam) } } else if (!lstrcmp(ai->targv[0], _T(VAR_REQUESTCOUNT))) { - _stprintf(Result.GetBuffer(16), _T("%d"), DBGetContactSettingWord(ai->fi->hContact, MOD_NAME, DB_REQUESTCOUNT, 0)); + mir_sntprintf(Result.GetBuffer(16), 16, _T("%d"), DBGetContactSettingWord(ai->fi->hContact, MOD_NAME, DB_REQUESTCOUNT, 0)); Result.ReleaseBuffer(); } else if (!lstrcmp(ai->targv[0], _T(VAR_MESSAGENUM))) { - _stprintf(Result.GetBuffer(16), _T("%d"), DBGetContactSettingWord(ai->fi->hContact, MOD_NAME, DB_MESSAGECOUNT, 0)); + mir_sntprintf(Result.GetBuffer(16), 16, _T("%d"), DBGetContactSettingWord(ai->fi->hContact, MOD_NAME, DB_MESSAGECOUNT, 0)); Result.ReleaseBuffer(); } else if (!lstrcmp(ai->targv[0], _T(VAR_TIMEPASSED))) { @@ -774,13 +774,13 @@ int srvVariablesHandler(WPARAM wParam, LPARAM lParam) Result.GetBuffer(256); if (ul_Now.LowPart >= 7200) // more than 2 hours { - _stprintf(Result, TranslateT("%d hours"), ul_Now.LowPart / 3600); + mir_sntprintf(Result, 256, TranslateT("%d hours"), ul_Now.LowPart / 3600); } else if (ul_Now.LowPart >= 120) // more than 2 minutes { - _stprintf(Result, TranslateT("%d minutes"), ul_Now.LowPart / 60); + mir_sntprintf(Result, 256, TranslateT("%d minutes"), ul_Now.LowPart / 60); } else { - _stprintf(Result, TranslateT("%d seconds"), ul_Now.LowPart); + mir_sntprintf(Result, 256, TranslateT("%d seconds"), ul_Now.LowPart); } Result.ReleaseBuffer(); } else if (!lstrcmp(ai->targv[0], _T(VAR_PREDEFINEDMESSAGE))) diff --git a/plugins/NewAwaySysMod/CommonLibs/CString.cpp b/plugins/NewAwaySysMod/CommonLibs/CString.cpp index a021132b14..b2a60cbbec 100644 --- a/plugins/NewAwaySysMod/CommonLibs/CString.cpp +++ b/plugins/NewAwaySysMod/CommonLibs/CString.cpp @@ -177,7 +177,7 @@ TString& TString::Replace(int nIndex, int nCount, const T *szReplaceBy) { return *this; } - T *pCurPos = pBuf; + TString Result; Result.GetBuffer(1)[0] = '\0'; Result.ReleaseBuffer(0); // set the string to ""; we can't do it in a usual way (using a constructor or an assignment) because we don't know whether "" needs to be unicode or ansi @@ -339,9 +339,11 @@ TCString DBGetContactSettingString(HANDLE hContact, const char *szModule, const int DBGetContactSettingString(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) { +#ifdef _DEBUG return DBGetContactSettingString_Helper(hContact, szModule, szSetting, dbv, __FILE__, __LINE__, DBVT_ASCIIZ); - //return DBGetContactSettingString_Helper(hContact, szModule, szSetting, dbv, DBVT_ASCIIZ); - +#else + return DBGetContactSettingString_Helper(hContact, szModule, szSetting, dbv, DBVT_ASCIIZ); +#endif } diff --git a/plugins/NewAwaySysMod/NewAwaySys.vcxproj b/plugins/NewAwaySysMod/NewAwaySys.vcxproj index f6cb308c46..2ab89a2e58 100644 --- a/plugins/NewAwaySysMod/NewAwaySys.vcxproj +++ b/plugins/NewAwaySysMod/NewAwaySys.vcxproj @@ -64,6 +64,7 @@ Level3 true ProgramDatabase + 4100 true @@ -112,6 +113,7 @@ Size + 4100 true diff --git a/plugins/NewAwaySysMod/Notification.cpp b/plugins/NewAwaySysMod/Notification.cpp index 56f94b2ca6..62e8dd5c94 100644 --- a/plugins/NewAwaySysMod/Notification.cpp +++ b/plugins/NewAwaySysMod/Notification.cpp @@ -283,7 +283,7 @@ void ShowLog(TCString &LogFilePath) if (Result <= 32) // Error { TCHAR szError[64]; - _stprintf(szError, TranslateT("Error #%d"), Result); + mir_sntprintf(szError, SIZEOF(szError), TranslateT("Error #%d"), Result); ShowMsg(szError, TranslateT("Can't open log file ") + LogFilePath, true); } } -- cgit v1.2.3