From 0afd3fae06d577b2f5a277597bd94d300b56e2b6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 11 Aug 2015 22:45:42 +0000 Subject: adaptation of UInfoEx for new functions git-svn-id: http://svn.miranda-ng.org/main/trunk@14919 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/UserInfoEx/src/classMAnnivDate.cpp | 11 +-- plugins/UserInfoEx/src/classMAnnivDate.h | 4 +- plugins/UserInfoEx/src/classMTime.cpp | 12 +-- plugins/UserInfoEx/src/classMTime.h | 99 +++++++++++----------- plugins/UserInfoEx/src/classPsTree.cpp | 2 +- plugins/UserInfoEx/src/classPsTreeItem.cpp | 2 +- .../UserInfoEx/src/ex_import/dlg_ExImModules.cpp | 2 +- plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp | 2 +- plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp | 2 +- plugins/UserInfoEx/src/mir_string.h | 6 -- plugins/UserInfoEx/src/psp_options.cpp | 2 +- plugins/UserInfoEx/src/psp_options.h | 13 +-- plugins/UserInfoEx/src/svc_timezone_old.cpp | 2 + 13 files changed, 79 insertions(+), 80 deletions(-) (limited to 'plugins/UserInfoEx') diff --git a/plugins/UserInfoEx/src/classMAnnivDate.cpp b/plugins/UserInfoEx/src/classMAnnivDate.cpp index 6663f4a275..9aa6ba77f0 100644 --- a/plugins/UserInfoEx/src/classMAnnivDate.cpp +++ b/plugins/UserInfoEx/src/classMAnnivDate.cpp @@ -73,7 +73,7 @@ void MAnnivDate::Clear() * param: none * return: nothing **/ -void MAnnivDate::SetDate(SYSTEMTIME &st) +void MAnnivDate::SetDate(const SYSTEMTIME &st) { ZeroDate(); Year(st.wYear); @@ -88,7 +88,7 @@ void MAnnivDate::SetDate(SYSTEMTIME &st) * param: none * return: nothing **/ -void MAnnivDate::SetDate(MAnnivDate &mda) +void MAnnivDate::SetDate(const MAnnivDate &mda) { SetDate(mda.SystemTime()); _wID = mda.Id(); @@ -210,9 +210,10 @@ int MAnnivDate::Age(MTime *pNow) * return: structure, holding zodiac information **/ -struct { - const WORD startDays; - const WORD endDays; +struct +{ + WORD startDays; + WORD endDays; LPCTSTR szZodiac; LPCSTR szZodiacIcon; } diff --git a/plugins/UserInfoEx/src/classMAnnivDate.h b/plugins/UserInfoEx/src/classMAnnivDate.h index bca4cd22c2..14246f79f6 100644 --- a/plugins/UserInfoEx/src/classMAnnivDate.h +++ b/plugins/UserInfoEx/src/classMAnnivDate.h @@ -112,8 +112,8 @@ public: int BackupBirthday (MCONTACT hContact, LPSTR pszProto = NULL, const BYTE bDontIgnoreAnything = FALSE, PWORD lastAnswer = NULL); // setting values - void SetDate(SYSTEMTIME &st); - void SetDate(MAnnivDate &mda); + void SetDate(const SYSTEMTIME &st); + void SetDate(const MAnnivDate &mda); BYTE operator == (const SYSTEMTIME &st) { return IsEqual(st); }; BYTE operator == (const MAnnivDate &mda) { return IsEqual(mda); }; diff --git a/plugins/UserInfoEx/src/classMTime.cpp b/plugins/UserInfoEx/src/classMTime.cpp index ac8eee269a..9a357172a3 100644 --- a/plugins/UserInfoEx/src/classMTime.cpp +++ b/plugins/UserInfoEx/src/classMTime.cpp @@ -38,19 +38,19 @@ MTime::MTime() ZeroDate(); } -MTime::MTime(SYSTEMTIME &st, const BYTE bIsLocal) +MTime::MTime(SYSTEMTIME &st, bool bIsLocal) { _SysTime = st; _isLocal = bIsLocal != FALSE; } -MTime::MTime(FILETIME &ft, const BYTE bIsLocal) +MTime::MTime(FILETIME &ft, bool bIsLocal) { ZeroDate(); Set(ft, bIsLocal); } -MTime::MTime(LARGE_INTEGER &li, const BYTE bIsLocal) +MTime::MTime(LARGE_INTEGER &li, bool bIsLocal) { ZeroDate(); Set(li, bIsLocal); @@ -405,14 +405,14 @@ void MTime::FromStampAsLocal(const DWORD dwTimeStamp) UTCToLocal(); } -void MTime::Set(LARGE_INTEGER liFileTime, const BYTE bIsLocal) +void MTime::Set(LARGE_INTEGER liFileTime, bool bIsLocal) { if (liFileTime.QuadPart < 0i64) liFileTime.QuadPart = 0; FileTimeToSystemTime((LPFILETIME)&liFileTime, &_SysTime); _isLocal = bIsLocal != FALSE; } -void MTime::Set(FILETIME &ftFileTime, const BYTE bIsLocal) +void MTime::Set(const FILETIME &ftFileTime, bool bIsLocal) { FileTimeToSystemTime(&ftFileTime, &_SysTime); _isLocal = bIsLocal != FALSE; @@ -423,7 +423,7 @@ void MTime::Set(const MTime &mt) Set(mt.SystemTime(), mt.IsLocal()); } -void MTime::Set(SYSTEMTIME &st, const BYTE bIsLocal) +void MTime::Set(const SYSTEMTIME &st, bool bIsLocal) { memcpy(&_SysTime, &st, sizeof(SYSTEMTIME)); _isLocal = bIsLocal != FALSE; diff --git a/plugins/UserInfoEx/src/classMTime.h b/plugins/UserInfoEx/src/classMTime.h index 2964a0dc3c..78ff1b23dd 100644 --- a/plugins/UserInfoEx/src/classMTime.h +++ b/plugins/UserInfoEx/src/classMTime.h @@ -22,22 +22,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma once class MTime { - SYSTEMTIME _SysTime; - BYTE _isLocal; + SYSTEMTIME _SysTime; + bool _isLocal; - LONG _Offset(TIME_ZONE_INFORMATION *tzi); + LONG _Offset(TIME_ZONE_INFORMATION *tzi); public: // contruction MTime(); - MTime(SYSTEMTIME &st, const BYTE bIsLocal); - MTime(FILETIME &ft, const BYTE bIsLocal); - MTime(LARGE_INTEGER &li, const BYTE bIsLocal); + MTime(SYSTEMTIME &st, bool bIsLocal); + MTime(FILETIME &ft, bool bIsLocal); + MTime(LARGE_INTEGER &li, bool bIsLocal); MTime(DWORD dwStamp); MTime(const MTime& mtime); // checks - __inline BYTE IsLocal() const { return _isLocal; }; + __inline bool IsLocal() const { return _isLocal; } BYTE IsValid() const; BYTE IsLeapYear() const; @@ -49,60 +49,61 @@ public: // get value from class LARGE_INTEGER LargeInt() const; - FILETIME FileTime() const; - DWORD TimeStamp() const; - SYSTEMTIME SystemTime() const { return _SysTime; }; - WORD DaysInMonth(const WORD &wMonth) const; - WORD DaysInYear(BYTE bIgnoreLeap = FALSE) const; - WORD DayOfYear() const; - WORD AdjustYear(const int nDiffDays); - - WORD TimeFormat(LPTSTR ptszTimeFormat, WORD cchTimeFormat); - WORD TimeFormat(tstring& str); - WORD DateFormat(LPTSTR ptszTimeFormat, WORD cchTimeFormat); - WORD DateFormatAlt(LPTSTR ptszTimeFormat, WORD cchTimeFormat); - WORD DateFormatLong(LPTSTR ptszTimeFormat, WORD cchTimeFormat); + FILETIME FileTime() const; + DWORD TimeStamp() const; + SYSTEMTIME SystemTime() const { return _SysTime; } + + WORD DaysInMonth(const WORD &wMonth) const; + WORD DaysInYear(BYTE bIgnoreLeap = FALSE) const; + WORD DayOfYear() const; + WORD AdjustYear(const int nDiffDays); + + WORD TimeFormat(LPTSTR ptszTimeFormat, WORD cchTimeFormat); + WORD TimeFormat(tstring& str); + WORD DateFormat(LPTSTR ptszTimeFormat, WORD cchTimeFormat); + WORD DateFormatAlt(LPTSTR ptszTimeFormat, WORD cchTimeFormat); + WORD DateFormatLong(LPTSTR ptszTimeFormat, WORD cchTimeFormat); // return single attributes - __inline WORD DayOfWeek() const { return _SysTime.wDayOfWeek; }; - __inline WORD Day() const { return _SysTime.wDay; }; - __inline WORD Month() const { return _SysTime.wMonth; }; - __inline WORD Year() const { return _SysTime.wYear; }; - __inline WORD Hour() const { return _SysTime.wHour; }; - __inline WORD Minute() const { return _SysTime.wMinute; }; - __inline WORD Second() const { return _SysTime.wSecond; }; + __inline WORD DayOfWeek() const { return _SysTime.wDayOfWeek; } + __inline WORD Day() const { return _SysTime.wDay; } + __inline WORD Month() const { return _SysTime.wMonth; } + __inline WORD Year() const { return _SysTime.wYear; } + __inline WORD Hour() const { return _SysTime.wHour; } + __inline WORD Minute() const { return _SysTime.wMinute; } + __inline WORD Second() const { return _SysTime.wSecond; } // set single values - __inline void Minute(const WORD wMinute) { if (wMinute <= 59) _SysTime.wMinute = wMinute; }; - __inline void Hour(const WORD wHour) { if (wHour <= 24) _SysTime.wHour = wHour; }; - __inline void Day(const WORD wDay) { if (wDay <= 31) _SysTime.wDay = wDay; }; - __inline void Month(const WORD wMonth) { if (wMonth <= 12) _SysTime.wMonth = wMonth; }; - __inline void Year(const WORD wYear) { _SysTime.wYear = wYear; }; + __inline void Minute(const WORD wMinute) { if (wMinute <= 59) _SysTime.wMinute = wMinute; } + __inline void Hour(const WORD wHour) { if (wHour <= 24) _SysTime.wHour = wHour; } + __inline void Day(const WORD wDay) { if (wDay <= 31) _SysTime.wDay = wDay; } + __inline void Month(const WORD wMonth) { if (wMonth <= 12) _SysTime.wMonth = wMonth; } + __inline void Year(const WORD wYear) { _SysTime.wYear = wYear; } // set value to class - void ZeroDate(); - void FromStampAsUTC(const DWORD dwTimeStamp); - void FromStampAsLocal(const DWORD dwTimeStamp); - void Set(FILETIME &ftFileTime, const BYTE bIsLocal); - void Set(LARGE_INTEGER liFileTime, const BYTE bIsLocal); - void Set(SYSTEMTIME &st, const BYTE bIsLocal); - void Set(const MTime &mt); + void ZeroDate(); + void FromStampAsUTC(const DWORD dwTimeStamp); + void FromStampAsLocal(const DWORD dwTimeStamp); + void Set(const FILETIME &ftFileTime, bool bIsLocal); + void Set(LARGE_INTEGER liFileTime, bool bIsLocal); + void Set(const SYSTEMTIME &st, bool bIsLocal); + void Set(const MTime &mt); // get current time - void GetTimeUTC(); - void GetLocalTime(); - void GetLocalTime(MCONTACT hContact); + void GetTimeUTC(); + void GetLocalTime(); + void GetLocalTime(MCONTACT hContact); // conversions - void UTCToLocal(); - void UTCToTzSpecificLocal(int tzh); - void UTCToTzSpecificLocal(TIME_ZONE_INFORMATION *tzi); - void LocalToUTC(); - void TzSpecificLocalToUTC(TIME_ZONE_INFORMATION *tzi); + void UTCToLocal(); + void UTCToTzSpecificLocal(int tzh); + void UTCToTzSpecificLocal(TIME_ZONE_INFORMATION *tzi); + void LocalToUTC(); + void TzSpecificLocalToUTC(TIME_ZONE_INFORMATION *tzi); // read and write from and to db - int DBGetStamp(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting); - int DBWriteStamp(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting); + int DBGetStamp(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting); + int DBWriteStamp(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting); // operatoren void operator = (DWORD& dwTimeStamp) { FromStampAsUTC(dwTimeStamp); }; diff --git a/plugins/UserInfoEx/src/classPsTree.cpp b/plugins/UserInfoEx/src/classPsTree.cpp index 2a1b12d2ea..3f49b202e5 100644 --- a/plugins/UserInfoEx/src/classPsTree.cpp +++ b/plugins/UserInfoEx/src/classPsTree.cpp @@ -584,7 +584,7 @@ void CPsTree::DBResetState() { s = Settings[i]; - if (s && *s == '{' && !mir_strnicmp(s + 1, p, c)) + if (s && *s == '{' && !mir_strncmpi(s + 1, p, c)) { db_unset(NULL, MODNAME, s); } diff --git a/plugins/UserInfoEx/src/classPsTreeItem.cpp b/plugins/UserInfoEx/src/classPsTreeItem.cpp index 1ab4e27610..331c672567 100644 --- a/plugins/UserInfoEx/src/classPsTreeItem.cpp +++ b/plugins/UserInfoEx/src/classPsTreeItem.cpp @@ -281,7 +281,7 @@ HICON CPsTreeItem::ProtoIcon() int ProtoCount; Proto_EnumAccounts(&ProtoCount, &pa); for (int i = 0; i < ProtoCount; i++) { - if (!mir_tcsnicmp(pa[i]->tszAccountName, _A2T(_pszName), mir_tstrlen(pa[i]->tszAccountName))) { + if (!mir_tstrncmpi(pa[i]->tszAccountName, _A2T(_pszName), mir_tstrlen(pa[i]->tszAccountName))) { CHAR szIconID[MAX_PATH]; mir_snprintf(szIconID, _countof(szIconID), "core_status_%s1", pa[i]->szModuleName); HICON hIco = IcoLib_GetIcon(szIconID); diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp index a0cac027d1..2041202d80 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp @@ -301,7 +301,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar case EXIM_GROUP: break; case EXIM_SUBGROUP: - if (mir_tcsncmp(pDat->ExImContact->ptszName, DB::Setting::GetTString(hContact, "CList", "Group"), mir_tstrlen(pDat->ExImContact->ptszName))) { + if (mir_tstrncmp(pDat->ExImContact->ptszName, DB::Setting::GetTString(hContact, "CList", "Group"), mir_tstrlen(pDat->ExImContact->ptszName))) { continue; } break; diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp index a3010a90c5..f909c7a44d 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp @@ -325,7 +325,7 @@ int ImportSetting(MCONTACT hContact, LPCSTR pszModule, LPSTR &strLine) LPSTR pszLine = strLine; // check Module and filter "Protocol" - if (!pszModule || !*pszModule || mir_strncmp(pszModule,"Protocol",8) == 0) + if (!pszModule || !*pszModule || mir_strncmp(pszModule, "Protocol", 8) == 0) return 1; if ((end = value = mir_strchr(pszLine, '=')) == NULL) return 1; diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp index 687e596e13..c7f473e83f 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp @@ -164,7 +164,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName) // dont export meta subcontacts by default and // export only contact with selectet group name if (!db_mc_isSub(hContact) && - mir_tcsncmp(ExImContact->ptszName, DB::Setting::GetTString(hContact, "CList", "Group"), mir_tstrlen(ExImContact->ptszName))== 0) + mir_tstrncmp(ExImContact->ptszName, DB::Setting::GetTString(hContact, "CList", "Group"), mir_tstrlen(ExImContact->ptszName))== 0) { if (vContact.fromDB(hContact)) { vContact.Export(xmlfile, &Modules); diff --git a/plugins/UserInfoEx/src/mir_string.h b/plugins/UserInfoEx/src/mir_string.h index 82f0dcaf69..573985052f 100644 --- a/plugins/UserInfoEx/src/mir_string.h +++ b/plugins/UserInfoEx/src/mir_string.h @@ -22,20 +22,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _MIR_STRING_H_INCLUDED_ #define _MIR_STRING_H_INCLUDED_ -#define mir_tcsncmp mir_wcsncmp -#define mir_tcsnicmp mir_wcsnicmp #define mir_tcschr mir_wcschr #define mir_tcsrchr mir_wcsrchr #define mir_tcsncat_c mir_wcsncat_c #define mir_IsEmpty mir_IsEmptyW -#define mir_strncmp(s1,s2,n) ((s1)==0||(s2)==0||strncmp((s1),(s2),(n))) -#define mir_strnicmp(s1,s2,n) ((s1)==0||(s2)==0||_strnicmp((s1),(s2),(n))) #define mir_strchr(s,c) (((s)!=0)?strchr((s),(c)):0) #define mir_strrchr(s,c) (((s)!=0)?strrchr((s),(c)):0) -#define mir_wcsncmp(s1,s2,n) ((s1)==0||(s2)==0||wcsncmp((s1),(s2),(n))) -#define mir_wcsnicmp(s1,s2,n) ((s1)==0||(s2)==0||_wcsnicmp((s1),(s2),(n))) #define mir_wcschr(s,c) (((s)!=0)?wcschr((s),(c)):0) #define mir_wcsrchr(s,c) (((s)!=0)?wcsrchr((s),(c)):0) diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index 287b0bbdec..50819e7922 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -459,7 +459,7 @@ static INT_PTR CALLBACK DlgProc_AdvancedOpts(HWND hDlg, UINT uMsg, WPARAM wParam if (!Settings.EnumSettings(NULL, "SkinIcons")) for (int i = 0; i < Settings.getCount(); i++) { LPSTR s = Settings[i]; - if (mir_strnicmp(s, "UserInfoEx", 10) == 0) + if (mir_strncmpi(s, "UserInfoEx", 10) == 0) db_unset(NULL, "SkinIcons", s); } diff --git a/plugins/UserInfoEx/src/psp_options.h b/plugins/UserInfoEx/src/psp_options.h index 599610d427..ab6c05c733 100644 --- a/plugins/UserInfoEx/src/psp_options.h +++ b/plugins/UserInfoEx/src/psp_options.h @@ -22,12 +22,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _UINFOEX_OPTIONS_H_INCLUDED_ #define _UINFOEX_OPTIONS_H_INCLUDED_ -struct MenuOptionsList { - LPCSTR pszKey; - const int idCheckbox; - const int idNONE; - const int idALL; - const int idEXIMPORT; +struct MenuOptionsList +{ + LPCSTR pszKey; + int idCheckbox; + int idNONE; + int idALL; + int idEXIMPORT; }; void OptionsLoadModule(); diff --git a/plugins/UserInfoEx/src/svc_timezone_old.cpp b/plugins/UserInfoEx/src/svc_timezone_old.cpp index 0ad0da33b8..fea63f3996 100644 --- a/plugins/UserInfoEx/src/svc_timezone_old.cpp +++ b/plugins/UserInfoEx/src/svc_timezone_old.cpp @@ -119,6 +119,8 @@ public: class CTzMgr : public LIST { + CTzMgr& operator=(const CTzMgr&); + CTzBias _bias; static int sortFunc(const CTimeZone *tz1, const CTimeZone *tz2) -- cgit v1.2.3