From 131975945929c21f78de8343e61d89e359d396c0 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> Date: Mon, 5 Apr 2010 02:42:12 +0000 Subject: Converted x64 version to Unicode git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@489 4f64403b-2f21-0410-a795-97e2b3489a10 --- worldtime_protocol/worldtimeproto.cpp | 60 +++++++++++++++++------------------ 1 file changed, 29 insertions(+), 31 deletions(-) (limited to 'worldtime_protocol/worldtimeproto.cpp') diff --git a/worldtime_protocol/worldtimeproto.cpp b/worldtime_protocol/worldtimeproto.cpp index 2c06f53..6645112 100644 --- a/worldtime_protocol/worldtimeproto.cpp +++ b/worldtime_protocol/worldtimeproto.cpp @@ -207,15 +207,15 @@ INT_PTR EditContact(WPARAM wParam, LPARAM lParam) { pa.hContact = (HANDLE)wParam; pa.timezone_list_index = DBGetContactSettingDword(pa.hContact, PROTO, "TimezoneListIndex", -1); - if(!DBGetContactSetting(pa.hContact, PROTO, "Nick", &dbv)) { - strncpy(pa.pszText, dbv.pszVal, MAX_NAME_LENGTH); + if(!DBGetContactSettingTString(pa.hContact, PROTO, "Nick", &dbv)) { + _tcsncpy(pa.pszText, dbv.ptszVal, MAX_NAME_LENGTH); DBFreeVariant(&dbv); } add_edit_item = pa; if(DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG2), hwndList, DlgProcOptsEdit) == IDOK) { pa = add_edit_item; - DBWriteContactSettingString(pa.hContact, PROTO, "Nick", pa.pszText); + DBWriteContactSettingTString(pa.hContact, PROTO, "Nick", pa.pszText); DBWriteContactSettingDword(pa.hContact, PROTO, "TimezoneListIndex", pa.timezone_list_index); DBWriteContactSettingWord(pa.hContact, PROTO, "Status", ID_STATUS_ONLINE); return 0; @@ -246,13 +246,11 @@ void DestroyServiceFunctions() { void replaceStr(TCHAR* str, size_t nchar, TCHAR* rstr) { - size_t lenr = _tcslen(rstr) * sizeof(TCHAR); - size_t lenNew = (_tcslen(str) - nchar + 1) * sizeof(TCHAR) + lenr; + size_t lenr = _tcslen(rstr); + size_t lenNew = (_tcslen(str) - nchar + 1) + lenr; - nchar *= sizeof(TCHAR); - - memmove(str + lenr, str + nchar, lenNew - lenr); - memcpy(str, rstr, lenr); + memmove(str + lenr, str + nchar, (lenNew - lenr) * sizeof(TCHAR)); + memcpy(str, rstr, lenr * sizeof(TCHAR)); } @@ -274,11 +272,11 @@ VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) { HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ); while ( hContact != NULL ) { proto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM )hContact,0 ); - if ( proto && !lstrcmp( PROTO, proto)) { + if ( proto && !strcmp( PROTO, proto)) { pa.hContact = hContact; pa.timezone_list_index = DBGetContactSettingDword(pa.hContact, PROTO, "TimezoneListIndex", -1); - if(!DBGetContactSetting(pa.hContact, PROTO, "Nick", &dbv)) { - strncpy(pa.pszText, dbv.pszVal, MAX_NAME_LENGTH); + if(!DBGetContactSettingTString(pa.hContact, PROTO, "Nick", &dbv)) { + _tcsncpy(pa.pszText, dbv.ptszVal, MAX_NAME_LENGTH); DBFreeVariant(&dbv); } status = DBGetContactSettingWord(pa.hContact, PROTO, "Status", ID_STATUS_ONLINE); @@ -303,17 +301,17 @@ VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) { TCHAR buf[1024]; TCHAR* pos; _tcscpy(buf, clist_format_string); - pos = strstr(buf, "%n"); + pos = _tcsstr(buf, _T("%n")); if (pos != NULL) replaceStr(pos, 2, pa.pszText); - pos = strstr(buf, "%t"); + pos = _tcsstr(buf, _T("%t")); if (pos != NULL) replaceStr(pos, 2, time_buf); - pos = strstr(buf, "%d"); + pos = _tcsstr(buf, _T("%d")); if (pos != NULL) replaceStr(pos, 2, date_buf); - pos = strstr(buf, "%o"); + pos = _tcsstr(buf, _T("%o")); if(pos != NULL) { int other_offset, offset; @@ -338,7 +336,7 @@ VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) { } else other_offset = tzi.Bias; - char temp_buf[8]; + TCHAR temp_buf[8]; unsigned char icq_offset = (unsigned char)((other_offset / 60) * 2) + (other_offset % 60) / 30; @@ -349,34 +347,34 @@ VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) { //if(offset > 12 * 60) offset -= 24 * 60; //if(offset < -12 * 60) offset += 24 * 60; - mir_snprintf(temp_buf, sizeof(temp_buf), "%+g", offset/60.0); + mir_sntprintf(temp_buf, SIZEOF(temp_buf), _T("%+g"), offset/60.0); replaceStr(pos, 2, temp_buf); } - if(!DBGetContactSetting(pa.hContact, "CList", "MyHandle", &dbv)) { + if(!DBGetContactSettingTString(pa.hContact, "CList", "MyHandle", &dbv)) { // only write if times are different - if(strcmp(dbv.pszVal, buf)) - DBWriteContactSettingString(pa.hContact, "CList", "MyHandle", buf); + if(_tcscmp(dbv.ptszVal, buf)) + DBWriteContactSettingTString(pa.hContact, "CList", "MyHandle", buf); DBFreeVariant(&dbv); } else - DBWriteContactSettingString(pa.hContact, "CList", "MyHandle", buf); + DBWriteContactSettingTString(pa.hContact, "CList", "MyHandle", buf); - if(!DBGetContactSetting(pa.hContact, PROTO, "FirstName", &dbv)) { + if(!DBGetContactSettingTString(pa.hContact, PROTO, "FirstName", &dbv)) { // only write if times are different - if(strcmp(dbv.pszVal, time_buf)) - DBWriteContactSettingString(pa.hContact, PROTO, "FirstName", time_buf); + if(_tcscmp(dbv.ptszVal, time_buf)) + DBWriteContactSettingTString(pa.hContact, PROTO, "FirstName", time_buf); DBFreeVariant(&dbv); } else - DBWriteContactSettingString(pa.hContact, PROTO, "FirstName", time_buf); + DBWriteContactSettingTString(pa.hContact, PROTO, "FirstName", time_buf); if(set_format) { - if(!DBGetContactSetting(pa.hContact, PROTO, "LastName", &dbv)) { + if(!DBGetContactSettingTString(pa.hContact, PROTO, "LastName", &dbv)) { // only write if times are different - if(strcmp(dbv.pszVal, date_buf)) - DBWriteContactSettingString(pa.hContact, PROTO, "LastName", date_buf); + if(_tcscmp(dbv.ptszVal, date_buf)) + DBWriteContactSettingTString(pa.hContact, PROTO, "LastName", date_buf); DBFreeVariant(&dbv); } else - DBWriteContactSettingString(pa.hContact, PROTO, "LastName", date_buf); + DBWriteContactSettingTString(pa.hContact, PROTO, "LastName", date_buf); } else DBDeleteContactSetting(pa.hContact, PROTO, "LastName"); @@ -436,7 +434,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { while ( hContact != NULL ) { proto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM )hContact,0 ); - if ( proto && !lstrcmp( PROTO, proto)) { + if ( proto && !strcmp( PROTO, proto)) { CallService(MS_IGNORE_IGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE); DBDeleteContactSetting(hContact, PROTO, "WindowHandle"); } -- cgit v1.2.3