summaryrefslogtreecommitdiff
path: root/plugins/Weather
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-07-26 09:20:25 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-07-26 09:20:25 +0000
commit6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac (patch)
tree2e8bb660c908b54914abd562af8aafa4a486c846 /plugins/Weather
parenta61c8728b379057fe7f0a0d86fe0b037598229dd (diff)
less TCHARs:
- TCHAR is replaced with wchar_t everywhere; - LPGENT replaced with either LPGENW or LPGEN; - fixes for ANSI plugins that improperly used _t functions; - TCHAR *t removed from MAllStrings; - ptszGroup, ptszTitle & ptszTab in OPTIONSDIALOGPAGE replaced with pwsz* git-svn-id: http://svn.miranda-ng.org/main/trunk@17133 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Weather')
-rw-r--r--plugins/Weather/src/stdafx.h104
-rw-r--r--plugins/Weather/src/weather.cpp6
-rw-r--r--plugins/Weather/src/weather_addstn.cpp90
-rw-r--r--plugins/Weather/src/weather_contacts.cpp46
-rw-r--r--plugins/Weather/src/weather_conv.cpp118
-rw-r--r--plugins/Weather/src/weather_data.cpp56
-rw-r--r--plugins/Weather/src/weather_http.cpp8
-rw-r--r--plugins/Weather/src/weather_info.cpp36
-rw-r--r--plugins/Weather/src/weather_ini.cpp34
-rw-r--r--plugins/Weather/src/weather_mwin.cpp16
-rw-r--r--plugins/Weather/src/weather_opt.cpp54
-rw-r--r--plugins/Weather/src/weather_popup.cpp28
-rw-r--r--plugins/Weather/src/weather_svcs.cpp22
-rw-r--r--plugins/Weather/src/weather_update.cpp38
-rw-r--r--plugins/Weather/src/weather_userinfo.cpp10
15 files changed, 333 insertions, 333 deletions
diff --git a/plugins/Weather/src/stdafx.h b/plugins/Weather/src/stdafx.h
index a0bced3797..73a3eb9a60 100644
--- a/plugins/Weather/src/stdafx.h
+++ b/plugins/Weather/src/stdafx.h
@@ -187,19 +187,19 @@ struct MYOPTIONS
WORD pUnit;
WORD dUnit;
WORD eUnit;
- TCHAR DegreeSign[4];
+ wchar_t DegreeSign[4];
BYTE DoNotAppendUnit;
BYTE NoFrac;
// texts
- TCHAR *cText;
- TCHAR *bTitle;
- TCHAR *bText;
- TCHAR *nText;
- TCHAR *eText;
- TCHAR *hText;
- TCHAR *xText;
- TCHAR *sText;
+ wchar_t *cText;
+ wchar_t *bTitle;
+ wchar_t *bText;
+ wchar_t *nText;
+ wchar_t *eText;
+ wchar_t *hText;
+ wchar_t *xText;
+ wchar_t *sText;
// advanced
BYTE DisCondIcon;
@@ -224,11 +224,11 @@ struct MYOPTIONS
DWORD pDelay;
// popup texts
- TCHAR *pTitle;
- TCHAR *pText;
+ wchar_t *pTitle;
+ wchar_t *pText;
// other misc stuff
- TCHAR Default[64];
+ wchar_t Default[64];
MCONTACT DefStn;
};
@@ -253,12 +253,12 @@ void DestroyUpdateList(void);
#define WID_BREAK 2
typedef struct {
- TCHAR *Name;
- TCHAR *Start;
- TCHAR *End;
- TCHAR *Unit;
+ wchar_t *Name;
+ wchar_t *Start;
+ wchar_t *End;
+ wchar_t *Unit;
char *Url;
- TCHAR *Break;
+ wchar_t *Break;
int Type;
} WIDATAITEM;
@@ -272,27 +272,27 @@ typedef struct WITEMLIST WIDATAITEMLIST;
typedef struct {
BOOL Available;
char *SearchURL;
- TCHAR *NotFoundStr;
+ wchar_t *NotFoundStr;
WIDATAITEM Name;
} WIIDSEARCH;
typedef struct {
BOOL Available;
- TCHAR *First;
+ wchar_t *First;
WIDATAITEM Name;
WIDATAITEM ID;
} WINAMESEARCHTYPE;
typedef struct {
char *SearchURL;
- TCHAR *NotFoundStr;
- TCHAR *SingleStr;
+ wchar_t *NotFoundStr;
+ wchar_t *SingleStr;
WINAMESEARCHTYPE Single;
WINAMESEARCHTYPE Multiple;
} WINAMESEARCH;
struct STRLIST {
- TCHAR *Item;
+ wchar_t *Item;
struct STRLIST *Next;
};
@@ -304,22 +304,22 @@ typedef struct {
} WICONDLIST;
typedef struct {
- TCHAR *FileName;
- TCHAR *ShortFileName;
+ wchar_t *FileName;
+ wchar_t *ShortFileName;
BOOL Enabled;
// header
- TCHAR *DisplayName;
- TCHAR *InternalName;
- TCHAR *Description;
- TCHAR *Author;
- TCHAR *Version;
+ wchar_t *DisplayName;
+ wchar_t *InternalName;
+ wchar_t *Description;
+ wchar_t *Author;
+ wchar_t *Version;
int InternalVer;
size_t MemUsed;
// default
char *DefaultURL;
- TCHAR *DefaultMap;
+ wchar_t *DefaultMap;
char *UpdateURL;
char *UpdateURL2;
char *UpdateURL3;
@@ -371,8 +371,8 @@ extern BOOL ThreadRunning;
INT_PTR WeatherAddToList(WPARAM wParam,LPARAM lParam);
BOOL CheckSearch();
-int IDSearch(TCHAR *id, const int searchId);
-int NameSearch(TCHAR *name, const int searchId);
+int IDSearch(wchar_t *id, const int searchId);
+int NameSearch(wchar_t *name, const int searchId);
INT_PTR WeatherBasicSearch(WPARAM wParam,LPARAM lParam);
INT_PTR WeatherCreateAdvancedSearchUI(WPARAM wParam, LPARAM lParam);
@@ -391,36 +391,36 @@ int ContactDeleted(WPARAM wParam,LPARAM lParam);
BOOL IsMyContact(MCONTACT hContact);
// functions in weather_conv.c
-void GetTemp(TCHAR *tempchar, TCHAR *unit, TCHAR *str);
-void GetSpeed(TCHAR *tempchar, TCHAR *unit, TCHAR *str);
-void GetPressure(TCHAR *tempchar, TCHAR *unit, TCHAR *str);
-void GetDist(TCHAR *tempchar, TCHAR *unit, TCHAR *str);
-void GetElev(TCHAR *tempchar, TCHAR *unit, TCHAR *str);
-
-WORD GetIcon(const TCHAR* cond, WIDATA *Data);
-void CaseConv(TCHAR *str);
+void GetTemp(wchar_t *tempchar, wchar_t *unit, wchar_t *str);
+void GetSpeed(wchar_t *tempchar, wchar_t *unit, wchar_t *str);
+void GetPressure(wchar_t *tempchar, wchar_t *unit, wchar_t *str);
+void GetDist(wchar_t *tempchar, wchar_t *unit, wchar_t *str);
+void GetElev(wchar_t *tempchar, wchar_t *unit, wchar_t *str);
+
+WORD GetIcon(const wchar_t* cond, WIDATA *Data);
+void CaseConv(wchar_t *str);
void TrimString(char *str);
void TrimString(WCHAR *str);
void ConvertBackslashes(char *str);
char *GetSearchStr(char *dis);
-TCHAR *GetDisplay(WEATHERINFO *w, const TCHAR *dis, TCHAR* str);
+wchar_t *GetDisplay(WEATHERINFO *w, const wchar_t *dis, wchar_t* str);
INT_PTR GetDisplaySvcFunc(WPARAM wParam, LPARAM lParam);
-void GetSvc(TCHAR *pszID);
-void GetID(TCHAR *pszID);
+void GetSvc(wchar_t *pszID);
+void GetID(wchar_t *pszID);
-TCHAR *GetError(int code);
+wchar_t *GetError(int code);
// functions in weather_data.c
-void GetStationID(MCONTACT hContact, TCHAR* id, int idlen);
+void GetStationID(MCONTACT hContact, wchar_t* id, int idlen);
WEATHERINFO LoadWeatherInfo(MCONTACT Change);
int DBGetData(MCONTACT hContact, char *setting, DBVARIANT *dbv);
void EraseAllInfo(void);
-void GetDataValue(WIDATAITEM *UpdateData, TCHAR *Data, TCHAR** szInfo);
-void ConvertDataValue(WIDATAITEM *UpdateData, TCHAR *Data);
+void GetDataValue(WIDATAITEM *UpdateData, wchar_t *Data, wchar_t** szInfo);
+void ConvertDataValue(WIDATAITEM *UpdateData, wchar_t *Data);
void wSetData(char **Data, const char *Value);
void wSetData(WCHAR **Data, const char *Value);
void wSetData(WCHAR **Data, const WCHAR *Value);
@@ -430,14 +430,14 @@ void wfree(WCHAR **Data);
void DBDataManage(MCONTACT hContact, WORD Mode, WPARAM wParam, LPARAM lParam);
// functions in weather_http.c
-int InternetDownloadFile (char *szUrl, char *cookie, char *userAgent, TCHAR** szData);
+int InternetDownloadFile (char *szUrl, char *cookie, char *userAgent, wchar_t** szData);
void NetlibInit();
void NetlibHttpDisconnect(void);
// functions in weather_ini.c
-WIDATA* GetWIData(TCHAR *pszServ);
+WIDATA* GetWIData(wchar_t *pszServ);
-bool IsContainedInCondList(const TCHAR *pszStr, WICONDLIST *List);
+bool IsContainedInCondList(const wchar_t *pszStr, WICONDLIST *List);
void DestroyWIList();
bool LoadWIData(bool dial);
@@ -445,7 +445,7 @@ bool LoadWIData(bool dial);
INT_PTR CALLBACK DlgPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
// functions in weather_info.c
-void GetINIInfo(TCHAR *pszSvc);
+void GetINIInfo(wchar_t *pszSvc);
void MoreVarList();
@@ -460,7 +460,7 @@ int OptInit(WPARAM wParam,LPARAM lParam);
// functions in weather_popup.c
int WeatherPopup(WPARAM wParam, LPARAM lParam);
int WeatherError(WPARAM wParam, LPARAM lParam);
-int WPShowMessage(TCHAR* lpzText, WORD kind);
+int WPShowMessage(wchar_t* lpzText, WORD kind);
LRESULT CALLBACK PopupWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp
index 00d6b0baee..188bd35fe3 100644
--- a/plugins/Weather/src/weather.cpp
+++ b/plugins/Weather/src/weather.cpp
@@ -226,11 +226,11 @@ extern "C" int __declspec(dllexport) Load(void)
InitServices();
// add sound event
- SkinAddNewSoundExT("weatherupdated", _T(WEATHERPROTONAME), LPGENT("Weather Condition Changed"));
- SkinAddNewSoundExT("weatheralert", _T(WEATHERPROTONAME), LPGENT("Weather Alert Issued"));
+ SkinAddNewSoundExT("weatherupdated", _T(WEATHERPROTONAME), LPGENW("Weather Condition Changed"));
+ SkinAddNewSoundExT("weatheralert", _T(WEATHERPROTONAME), LPGENW("Weather Alert Issued"));
// window needed for popup commands
- TCHAR SvcFunc[100];
+ wchar_t SvcFunc[100];
mir_sntprintf(SvcFunc, L"%s__PopupWindow", _T(WEATHERPROTONAME));
hPopupWindow = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", SvcFunc, 0, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, hInst, NULL);
diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp
index 304f1d2641..bf999c9dea 100644
--- a/plugins/Weather/src/weather_addstn.cpp
+++ b/plugins/Weather/src/weather_addstn.cpp
@@ -26,7 +26,7 @@ to the contact list. Contain code for both name and ID search.
// variables used for weather_addstn.c
static int sttSearchId = -1;
-static TCHAR name1[256];
+static wchar_t name1[256];
// ============ ADDING NEW STATION ============
@@ -35,7 +35,7 @@ static TCHAR name1[256];
INT_PTR WeatherAddToList(WPARAM, LPARAM lParam)
{
PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam;
- if (!psr || !psr->email.t)
+ if (!psr || !psr->email.w)
return 0;
// search for existing contact
@@ -45,7 +45,7 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam)
DBVARIANT dbv;
// check ID to see if the contact already exist in the database
if (!db_get_ts(hContact, WEATHERPROTONAME, "ID", &dbv)) {
- if (!mir_tstrcmpi(psr->email.t, dbv.ptszVal)) {
+ if (!mir_tstrcmpi(psr->email.w, dbv.ptszVal)) {
// remove the flag for not on list and hidden, thus make the contact visible
// and add them on the list
if (db_get_b(hContact, "CList", "NotOnList", 1)) {
@@ -69,11 +69,11 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam)
CallService(MS_IGNORE_IGNORE, hContact, IGNOREEVENT_USERONLINE);
// set contact info and settings
- TCHAR svc[256];
- _tcsncpy(svc, psr->email.t, _countof(svc)); svc[_countof(svc) - 1] = 0;
+ wchar_t svc[256];
+ wcsncpy(svc, psr->email.w, _countof(svc)); svc[_countof(svc) - 1] = 0;
GetSvc(svc);
// set settings by obtaining the default for the service
- if (psr->lastName.t[0] != 0) {
+ if (psr->lastName.w[0] != 0) {
WIDATA *sData = GetWIData(svc);
db_set_ts(hContact, WEATHERPROTONAME, "MapURL", sData->DefaultMap);
db_set_s(hContact, WEATHERPROTONAME, "InfoURL", sData->DefaultURL);
@@ -83,14 +83,14 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam)
db_set_s(hContact, WEATHERPROTONAME, "InfoURL", "");
}
// write the other info and settings to the database
- db_set_ts(hContact, WEATHERPROTONAME, "ID", psr->email.t);
- db_set_ts(hContact, WEATHERPROTONAME, "Nick", psr->nick.t);
+ db_set_ts(hContact, WEATHERPROTONAME, "ID", psr->email.w);
+ db_set_ts(hContact, WEATHERPROTONAME, "Nick", psr->nick.w);
db_set_w(hContact, WEATHERPROTONAME, "Status", ID_STATUS_OFFLINE);
AvatarDownloaded(hContact);
- TCHAR str[256];
- mir_sntprintf(str, TranslateT("Current weather information for %s."), psr->nick.t);
+ wchar_t str[256];
+ mir_sntprintf(str, TranslateT("Current weather information for %s."), psr->nick.w);
db_set_ts(hContact, WEATHERPROTONAME, "About", str);
// make the last update tags to something invalid
@@ -134,7 +134,7 @@ BOOL CheckSearch()
// ============ BASIC ID SEARCH ============
-static TCHAR sttSID[32];
+static wchar_t sttSID[32];
// A timer process for the ID search (threaded)
static void __cdecl BasicSearchTimerProc(LPVOID)
@@ -156,7 +156,7 @@ static void __cdecl BasicSearchTimerProc(LPVOID)
INT_PTR WeatherBasicSearch(WPARAM, LPARAM lParam)
{
if (sttSearchId != -1) return 0; //only one search at a time
- _tcsncpy(sttSID, (TCHAR*)lParam, _countof(sttSID));
+ wcsncpy(sttSID, (wchar_t*)lParam, _countof(sttSID));
sttSID[_countof(sttSID) - 1] = 0;
sttSearchId = 1;
// create a thread for the ID search
@@ -225,22 +225,22 @@ INT_PTR WeatherAdvancedSearch(WPARAM, LPARAM lParam)
// searchId = -1
// sData = the ID search data for that particular weather service
// svcname = the name of the weather service that is currently searching (ie. Yahoo Weather)
-int IDSearchProc(TCHAR *sID, const int searchId, WIIDSEARCH *sData, TCHAR *svc, TCHAR *svcname)
+int IDSearchProc(wchar_t *sID, const int searchId, WIIDSEARCH *sData, wchar_t *svc, wchar_t *svcname)
{
- TCHAR str[MAX_DATA_LEN], newID[MAX_DATA_LEN];
+ wchar_t str[MAX_DATA_LEN], newID[MAX_DATA_LEN];
if (sData->Available) {
char loc[255];
- TCHAR *szData = NULL;
+ wchar_t *szData = NULL;
// load the page
mir_snprintf(loc, sData->SearchURL, sID);
BOOL bFound = (InternetDownloadFile(loc, NULL, NULL, &szData) == 0);
if (bFound) {
- TCHAR* szInfo = szData;
+ wchar_t* szInfo = szData;
// not found
- if (_tcsstr(szInfo, sData->NotFoundStr) == NULL)
+ if (wcsstr(szInfo, sData->NotFoundStr) == NULL)
GetDataValue(&sData->Name, str, &szInfo);
}
@@ -250,16 +250,16 @@ int IDSearchProc(TCHAR *sID, const int searchId, WIIDSEARCH *sData, TCHAR *svc,
}
// give no station name but only ID if the search is unavailable
- else _tcsncpy(str, TranslateT("<Enter station name here>"), MAX_DATA_LEN - 1);
+ else wcsncpy(str, TranslateT("<Enter station name here>"), MAX_DATA_LEN - 1);
mir_sntprintf(newID, L"%s/%s", svc, sID);
// set the search result and broadcast it
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.nick.t = str;
- psr.firstName.t = L" ";
- psr.lastName.t = svcname;
- psr.email.t = newID;
+ psr.nick.w = str;
+ psr.firstName.w = L" ";
+ psr.lastName.w = svcname;
+ psr.email.w = newID;
ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr);
return 0;
@@ -269,7 +269,7 @@ int IDSearchProc(TCHAR *sID, const int searchId, WIIDSEARCH *sData, TCHAR *svc,
// sID: the ID to search for
// searchId: don't change
// return 0 if no error
-int IDSearch(TCHAR *sID, const int searchId)
+int IDSearch(wchar_t *sID, const int searchId)
{
// for a normal ID search (ID != #)
if (mir_tstrcmp(sID, L"#")) {
@@ -287,10 +287,10 @@ int IDSearch(TCHAR *sID, const int searchId)
// return an empty contact on "#"
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.nick.t = TranslateT("<Enter station name here>"); // to be entered
- psr.firstName.t = L" ";
- psr.lastName.t = L"";
- psr.email.t = TranslateT("<Enter station ID here>"); // to be entered
+ psr.nick.w = TranslateT("<Enter station name here>"); // to be entered
+ psr.firstName.w = L" ";
+ psr.lastName.w = L"";
+ psr.email.w = TranslateT("<Enter station ID here>"); // to be entered
ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr);
}
@@ -304,21 +304,21 @@ int IDSearch(TCHAR *sID, const int searchId)
// searchId = -1
// sData = the name search data for that particular weather service
// svcname = the name of the weather service that is currently searching (ie. Yahoo Weather)
-int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR *svc, TCHAR *svcname)
+int NameSearchProc(wchar_t *name, const int searchId, WINAMESEARCH *sData, wchar_t *svc, wchar_t *svcname)
{
- TCHAR Name[MAX_DATA_LEN], str[MAX_DATA_LEN], sID[MAX_DATA_LEN], *szData = NULL, *search;
+ wchar_t Name[MAX_DATA_LEN], str[MAX_DATA_LEN], sID[MAX_DATA_LEN], *szData = NULL, *search;
// replace spaces with %20
char loc[256];
T2Utf szSearchName(name);
mir_snprintf(loc, sData->SearchURL, ptrA(mir_urlEncode(szSearchName)));
if (InternetDownloadFile(loc, NULL, NULL, &szData) == 0) {
- TCHAR* szInfo = szData;
- search = _tcsstr(szInfo, sData->NotFoundStr); // determine if data is available
+ wchar_t* szInfo = szData;
+ search = wcsstr(szInfo, sData->NotFoundStr); // determine if data is available
if (search == NULL) { // if data is found
// test if it is single result
if (sData->Single.Available && sData->Multiple.Available)
- search = _tcsstr(szInfo, sData->SingleStr);
+ search = wcsstr(szInfo, sData->SingleStr);
// for single result
if (sData->Single.Available && (search != NULL || !sData->Multiple.Available)) { // single result
// if station ID appears first in the downloaded data
@@ -344,16 +344,16 @@ int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR *
// if can't get the name, use the search string as name
if (Name[0] == 0)
- _tcsncpy(Name, name, _countof(Name));
+ wcsncpy(Name, name, _countof(Name));
// set the data and broadcast it
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.nick.t = Name;
- psr.firstName.t = L" ";
- psr.lastName.t = svcname;
- psr.email.t = sID;
- psr.id.t = sID;
+ psr.nick.w = Name;
+ psr.firstName.w = L" ";
+ psr.lastName.w = svcname;
+ psr.email.w = sID;
+ psr.id.w = sID;
ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr);
mir_free(szData);
return 0;
@@ -383,15 +383,15 @@ int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR *
// if can't get the name, use the search string as name
if (Name[0] == 0)
- _tcsncpy(Name, name, _countof(Name));
+ wcsncpy(Name, name, _countof(Name));
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.nick.t = Name;
- psr.firstName.t = L"";
- psr.lastName.t = svcname;
- psr.email.t = sID;
- psr.id.t = sID;
+ psr.nick.w = Name;
+ psr.firstName.w = L"";
+ psr.lastName.w = svcname;
+ psr.email.w = sID;
+ psr.id.w = sID;
ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr);
}
}
@@ -409,7 +409,7 @@ int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR *
// name: the station name to search for
// searchId: don't change
// return 0 if no error
-int NameSearch(TCHAR *name, const int searchId)
+int NameSearch(wchar_t *name, const int searchId)
{
WIDATALIST *Item = WIHead;
diff --git a/plugins/Weather/src/weather_contacts.cpp b/plugins/Weather/src/weather_contacts.cpp
index 447837c76e..77ecbb11cd 100644
--- a/plugins/Weather/src/weather_contacts.cpp
+++ b/plugins/Weather/src/weather_contacts.cpp
@@ -25,9 +25,9 @@ the contact.
#include "stdafx.h"
-static void OpenUrl(TCHAR* format, TCHAR* id)
+static void OpenUrl(wchar_t* format, wchar_t* id)
{
- TCHAR loc[512];
+ wchar_t loc[512];
GetID(id);
mir_sntprintf(loc, format, id);
Utils_OpenUrlT(loc);
@@ -56,7 +56,7 @@ INT_PTR ViewLog(WPARAM wParam, LPARAM lParam)
// wParam = current contact
INT_PTR LoadForecast(WPARAM wParam, LPARAM)
{
- TCHAR id[256], loc2[256];
+ wchar_t id[256], loc2[256];
GetStationID(wParam, id, _countof(id));
if (id[0] != 0) {
// check if the complte forecast URL is set. If it is not, display warning and quit
@@ -74,7 +74,7 @@ INT_PTR LoadForecast(WPARAM wParam, LPARAM)
// wParam = current contact
INT_PTR WeatherMap(WPARAM wParam, LPARAM)
{
- TCHAR id[256], loc2[256];
+ wchar_t id[256], loc2[256];
GetStationID(wParam, id, _countof(id));
if (id[0] != 0) {
// check if the weather map URL is set. If it is not, display warning and quit
@@ -106,7 +106,7 @@ typedef struct
static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
DBVARIANT dbv;
- TCHAR str[MAX_DATA_LEN], str2[256], city[256], filter[256], *pfilter, *chop;
+ wchar_t str[MAX_DATA_LEN], str2[256], city[256], filter[256], *pfilter, *chop;
char loc[512];
OPENFILENAME ofn; // common dialog box structure
MCONTACT hContact;
@@ -145,13 +145,13 @@ static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
SendDlgItemMessage(hwndDlg, IDC_RESET2, BUTTONSETASFLATBTN, TRUE, 0);
// set tooltip for the buttons
- SendDlgItemMessage(hwndDlg, IDC_GETNAME, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Get city name from ID"), BATF_TCHAR);
- SendDlgItemMessage(hwndDlg, IDC_SVCINFO, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Weather INI information"), BATF_TCHAR);
- SendDlgItemMessage(hwndDlg, IDC_BROWSE, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Browse"), BATF_TCHAR);
- SendDlgItemMessage(hwndDlg, IDC_VIEW1, BUTTONADDTOOLTIP, (WPARAM)LPGENT("View webpage"), BATF_TCHAR);
- SendDlgItemMessage(hwndDlg, IDC_RESET1, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Reset to default"), BATF_TCHAR);
- SendDlgItemMessage(hwndDlg, IDC_VIEW2, BUTTONADDTOOLTIP, (WPARAM)LPGENT("View webpage"), BATF_TCHAR);
- SendDlgItemMessage(hwndDlg, IDC_RESET2, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Reset to default"), BATF_TCHAR);
+ SendDlgItemMessage(hwndDlg, IDC_GETNAME, BUTTONADDTOOLTIP, (WPARAM)LPGENW("Get city name from ID"), BATF_TCHAR);
+ SendDlgItemMessage(hwndDlg, IDC_SVCINFO, BUTTONADDTOOLTIP, (WPARAM)LPGENW("Weather INI information"), BATF_TCHAR);
+ SendDlgItemMessage(hwndDlg, IDC_BROWSE, BUTTONADDTOOLTIP, (WPARAM)LPGENW("Browse"), BATF_TCHAR);
+ SendDlgItemMessage(hwndDlg, IDC_VIEW1, BUTTONADDTOOLTIP, (WPARAM)LPGENW("View webpage"), BATF_TCHAR);
+ SendDlgItemMessage(hwndDlg, IDC_RESET1, BUTTONADDTOOLTIP, (WPARAM)LPGENW("Reset to default"), BATF_TCHAR);
+ SendDlgItemMessage(hwndDlg, IDC_VIEW2, BUTTONADDTOOLTIP, (WPARAM)LPGENW("View webpage"), BATF_TCHAR);
+ SendDlgItemMessage(hwndDlg, IDC_RESET2, BUTTONADDTOOLTIP, (WPARAM)LPGENW("Reset to default"), BATF_TCHAR);
// save the handle for the contact
WindowList_Add(hWindowList, hwndDlg, hContact);
@@ -205,7 +205,7 @@ static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
// check if there are 2 parts in the ID (svc/id) seperated by "/"
// if not, don't let user change the setting
GetDlgItemText(hwndDlg, IDC_ID, str, _countof(str));
- chop = _tcsstr(str, L"/");
+ chop = wcsstr(str, L"/");
if (chop == NULL)
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), FALSE);
else
@@ -236,10 +236,10 @@ static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
// load the page
mir_snprintf(loc, sData->IDSearch.SearchURL, str);
str[0] = 0;
- TCHAR *pData = NULL;
+ wchar_t *pData = NULL;
if (InternetDownloadFile(loc, NULL, sData->UserAgent, &pData) == 0) {
- TCHAR *szInfo = pData;
- TCHAR* search = _tcsstr(szInfo, sData->IDSearch.NotFoundStr);
+ wchar_t *szInfo = pData;
+ wchar_t* search = wcsstr(szInfo, sData->IDSearch.NotFoundStr);
// if the page is found (ie. valid ID), get the name of the city
if (search == NULL)
@@ -271,15 +271,15 @@ static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
ofn.lpstrFile = str;
ofn.nMaxFile = _countof(str);
// set filters
- _tcsncpy(filter, TranslateT("Text Files"), _countof(filter) - 1);
+ wcsncpy(filter, TranslateT("Text Files"), _countof(filter) - 1);
mir_tstrncat(filter, L" (*.txt)", _countof(filter) - mir_tstrlen(filter));
pfilter = filter + mir_tstrlen(filter) + 1;
- _tcsncpy(pfilter, L"*.txt", _countof(filter) - 1);
+ wcsncpy(pfilter, L"*.txt", _countof(filter) - 1);
pfilter = pfilter + mir_tstrlen(pfilter) + 1;
- _tcsncpy(pfilter, TranslateT("All Files"), _countof(filter) - 1);
+ wcsncpy(pfilter, TranslateT("All Files"), _countof(filter) - 1);
mir_tstrncat(pfilter, L" (*.*)", _countof(filter) - mir_tstrlen(filter));
pfilter = pfilter + mir_tstrlen(pfilter) + 1;
- _tcsncpy(pfilter, L"*.*", _countof(filter) - 1);
+ wcsncpy(pfilter, L"*.*", _countof(filter) - 1);
pfilter = pfilter + mir_tstrlen(pfilter) + 1;
*pfilter = '\0';
ofn.lpstrFilter = filter;
@@ -452,12 +452,12 @@ int ContactDeleted(WPARAM wParam, LPARAM)
// if the station is not a default station, set it as the new default station
// this is the first weather station encountered from the search
if (mir_tstrcmp(opt.Default, tszID)) {
- _tcsncpy_s(opt.Default, tszID, _TRUNCATE);
+ wcsncpy_s(opt.Default, tszID, _TRUNCATE);
opt.DefStn = hContact;
ptrT tszNick(db_get_tsa(hContact, WEATHERPROTONAME, "Nick"));
if (tszNick != NULL) {
- TCHAR str[255];
- mir_sntprintf(str, TranslateT("%s is now the default weather station"), (TCHAR*)tszNick);
+ wchar_t str[255];
+ mir_sntprintf(str, TranslateT("%s is now the default weather station"), (wchar_t*)tszNick);
MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONINFORMATION);
}
db_set_ts(NULL, WEATHERPROTONAME, "Default", opt.Default);
diff --git a/plugins/Weather/src/weather_conv.cpp b/plugins/Weather/src/weather_conv.cpp
index ec5cd06521..31b0e1b93a 100644
--- a/plugins/Weather/src/weather_conv.cpp
+++ b/plugins/Weather/src/weather_conv.cpp
@@ -30,7 +30,7 @@ string conversions, display text parsing, etc
// see if a string is a number
// s = the string to be determined
// return value = true if the string is a number, false if it isn't
-BOOL is_number(TCHAR *s)
+BOOL is_number(wchar_t *s)
{
BOOL tag = FALSE;
// looking character by character
@@ -47,7 +47,7 @@ BOOL is_number(TCHAR *s)
return FALSE;
}
-static void numToStr(double num, TCHAR *str, size_t strSize)
+static void numToStr(double num, wchar_t *str, size_t strSize)
{
int i = (int)(num * (opt.NoFrac ? 10 : 100));
int u = abs(i);
@@ -75,15 +75,15 @@ static void numToStr(double num, TCHAR *str, size_t strSize)
// tempchar = the string containing the temperature value
// unit = the unit for temperature
// return value = the converted temperature with degree sign and unit; if fails, return N/A
-void GetTemp(TCHAR *tempchar, TCHAR *unit, TCHAR* str)
+void GetTemp(wchar_t *tempchar, wchar_t *unit, wchar_t* str)
{
// unit can be C, F
double temp;
- TCHAR tstr[20];
+ wchar_t tstr[20];
TrimString(tempchar);
if (tempchar[0] == '-' && tempchar[1] == ' ')
- memmove(&tempchar[1], &tempchar[2], sizeof(TCHAR)*(mir_tstrlen(&tempchar[2]) + 1));
+ memmove(&tempchar[1], &tempchar[2], sizeof(wchar_t)*(mir_tstrlen(&tempchar[2]) + 1));
// quit if the value obtained is N/A or not a number
if (!mir_tstrcmp(tempchar, NODATA) || !mir_tstrcmp(tempchar, L"N/A")) {
@@ -108,7 +108,7 @@ void GetTemp(TCHAR *tempchar, TCHAR *unit, TCHAR* str)
// rounding
numToStr((temp - 32) / 9 * 5, tstr, _countof(tstr));
if (opt.DoNotAppendUnit)
- _tcsncpy_s(str, MAX_DATA_LEN, tstr, _TRUNCATE);
+ wcsncpy_s(str, MAX_DATA_LEN, tstr, _TRUNCATE);
else
mir_sntprintf(str, MAX_DATA_LEN, L"%s%sC", tstr, opt.DegreeSign);
break;
@@ -116,7 +116,7 @@ void GetTemp(TCHAR *tempchar, TCHAR *unit, TCHAR* str)
case 2:
numToStr(temp, tstr, _countof(tstr));
if (opt.DoNotAppendUnit)
- _tcsncpy_s(str, MAX_DATA_LEN, tstr, _TRUNCATE);
+ wcsncpy_s(str, MAX_DATA_LEN, tstr, _TRUNCATE);
else
mir_sntprintf(str, MAX_DATA_LEN, L"%s%sF", tstr, opt.DegreeSign);
break;
@@ -127,7 +127,7 @@ void GetTemp(TCHAR *tempchar, TCHAR *unit, TCHAR* str)
// tempchar = the string containing the pressure value
// unit = the unit for pressure
// return value = the converted pressure with unit; if fail, return the original string
-void GetPressure(TCHAR *tempchar, TCHAR *unit, TCHAR* str)
+void GetPressure(wchar_t *tempchar, wchar_t *unit, wchar_t* str)
{
// unit can be kPa, hPa, mb, in, mm, torr
double tempunit = 0, output;
@@ -184,11 +184,11 @@ void GetPressure(TCHAR *tempchar, TCHAR *unit, TCHAR* str)
// tempchar = the string containing the speed value
// unit = the unit for speed
// return value = the converted speed with unit; if fail, return _T(""
-void GetSpeed(TCHAR *tempchar, TCHAR *unit, TCHAR *str)
+void GetSpeed(wchar_t *tempchar, wchar_t *unit, wchar_t *str)
{
// unit can be km/h, mph, m/s, knots
double tempunit;
- TCHAR tstr[20];
+ wchar_t tstr[20];
str[0] = 0;
@@ -233,7 +233,7 @@ void GetSpeed(TCHAR *tempchar, TCHAR *unit, TCHAR *str)
// tempchar = the string containing the distance value
// unit = the unit for distance
// return value = the converted distance with unit; if fail, return original string
-void GetDist(TCHAR *tempchar, TCHAR *unit, TCHAR *str)
+void GetDist(wchar_t *tempchar, wchar_t *unit, wchar_t *str)
{
// unit can be km, miles
double tempunit = 0, output;
@@ -273,7 +273,7 @@ void GetDist(TCHAR *tempchar, TCHAR *unit, TCHAR *str)
// tempchar = the string containing the elevation value
// unit = the unit for elevation
// return value = the converted elevation with unit; if fail, return original string
-void GetElev(TCHAR *tempchar, TCHAR *unit, TCHAR *str)
+void GetElev(wchar_t *tempchar, wchar_t *unit, wchar_t *str)
{
// unit can be ft, m
double tempunit = 0, output;
@@ -316,10 +316,10 @@ void GetElev(TCHAR *tempchar, TCHAR *unit, TCHAR *str)
// cond = the string for weather condition
// return value = status for the icon (ONLINE, OFFLINE, etc)
-static const TCHAR *statusStr[10] = { L"Lightning", L"Fog", L"Snow Shower", L"Snow", L"Rain Shower", L"Rain", L"Partly Cloudy", L"Cloudy", L"Sunny", L"N/A" };
+static const wchar_t *statusStr[10] = { L"Lightning", L"Fog", L"Snow Shower", L"Snow", L"Rain Shower", L"Rain", L"Partly Cloudy", L"Cloudy", L"Sunny", L"N/A" };
static const WORD statusValue[10] = { LIGHT, FOG, SSHOWER, SNOW, RSHOWER, RAIN, PCLOUDY, CLOUDY, SUNNY, NA };
-WORD GetIcon(const TCHAR* cond, WIDATA *Data)
+WORD GetIcon(const wchar_t* cond, WIDATA *Data)
{
// set the icon using ini
for (int i = 0; i < 10; i++)
@@ -328,72 +328,72 @@ WORD GetIcon(const TCHAR* cond, WIDATA *Data)
// internal detection
if (
- _tcsstr(cond, L"mainy sunny") != NULL ||
- _tcsstr(cond, L"mainy clear") != NULL ||
- _tcsstr(cond, L"partly cloudy") != NULL ||
- _tcsstr(cond, L"mostly") != NULL ||
- _tcsstr(cond, L"clouds") != NULL) {
+ wcsstr(cond, L"mainy sunny") != NULL ||
+ wcsstr(cond, L"mainy clear") != NULL ||
+ wcsstr(cond, L"partly cloudy") != NULL ||
+ wcsstr(cond, L"mostly") != NULL ||
+ wcsstr(cond, L"clouds") != NULL) {
return PCLOUDY;
}
else if (
- _tcsstr(cond, L"sunny") != NULL ||
- _tcsstr(cond, L"clear") != NULL ||
- _tcsstr(cond, L"fair") != NULL) {
+ wcsstr(cond, L"sunny") != NULL ||
+ wcsstr(cond, L"clear") != NULL ||
+ wcsstr(cond, L"fair") != NULL) {
return SUNNY;
}
else if (
- _tcsstr(cond, L"thunder") != NULL ||
- _tcsstr(cond, L"t-storm") != NULL) {
+ wcsstr(cond, L"thunder") != NULL ||
+ wcsstr(cond, L"t-storm") != NULL) {
return LIGHT;
}
else if (
- _tcsstr(cond, L"cloud") != NULL ||
- _tcsstr(cond, L"overcast") != NULL) {
+ wcsstr(cond, L"cloud") != NULL ||
+ wcsstr(cond, L"overcast") != NULL) {
return CLOUDY;
}
else if (
- _tcsstr(cond, L"fog") != NULL ||
- _tcsstr(cond, L"mist") != NULL ||
- _tcsstr(cond, L"smoke") != NULL ||
- _tcsstr(cond, L"sand") != NULL ||
- _tcsstr(cond, L"dust") != NULL ||
- _tcsstr(cond, L"haze") != NULL) {
+ wcsstr(cond, L"fog") != NULL ||
+ wcsstr(cond, L"mist") != NULL ||
+ wcsstr(cond, L"smoke") != NULL ||
+ wcsstr(cond, L"sand") != NULL ||
+ wcsstr(cond, L"dust") != NULL ||
+ wcsstr(cond, L"haze") != NULL) {
return FOG;
}
else if (
- (_tcsstr(cond, L"shower") != NULL && _tcsstr(cond, L"snow") != NULL) ||
- _tcsstr(cond, L"flurries") != NULL) {
+ (wcsstr(cond, L"shower") != NULL && wcsstr(cond, L"snow") != NULL) ||
+ wcsstr(cond, L"flurries") != NULL) {
return SSHOWER;
}
else if (
- _tcsstr(cond, L"rain shower") != NULL ||
- _tcsstr(cond, L"shower") != NULL) {
+ wcsstr(cond, L"rain shower") != NULL ||
+ wcsstr(cond, L"shower") != NULL) {
return RSHOWER;
}
else if (
- _tcsstr(cond, L"snow") != NULL ||
- _tcsstr(cond, L"ice") != NULL ||
- _tcsstr(cond, L"freezing") != NULL ||
- _tcsstr(cond, L"wintry") != NULL) {
+ wcsstr(cond, L"snow") != NULL ||
+ wcsstr(cond, L"ice") != NULL ||
+ wcsstr(cond, L"freezing") != NULL ||
+ wcsstr(cond, L"wintry") != NULL) {
return SNOW;
}
else if (
- _tcsstr(cond, L"drizzle") != NULL ||
- _tcsstr(cond, L"rain") != NULL) {
+ wcsstr(cond, L"drizzle") != NULL ||
+ wcsstr(cond, L"rain") != NULL) {
return RAIN;
}
// set the icon using langpack
for (int i = 0; i < 9; i++) {
- TCHAR LangPackStr[64], LangPackStr1[128];
+ wchar_t LangPackStr[64], LangPackStr1[128];
int j = 0;
do {
j++;
// using the format _T("# Weather <condition name> <counter> #"
mir_sntprintf(LangPackStr, L"# Weather %s %i #", statusStr[i], j);
- _tcsncpy_s(LangPackStr1, TranslateTS(LangPackStr), _TRUNCATE);
+ wcsncpy_s(LangPackStr1, TranslateTS(LangPackStr), _TRUNCATE);
CharLowerBuff(LangPackStr1, (DWORD)mir_tstrlen(LangPackStr1));
- if (_tcsstr(cond, LangPackStr1) != NULL)
+ if (wcsstr(cond, LangPackStr1) != NULL)
return statusValue[i];
// loop until the translation string exists (ie, the translated string is differ from original)
} while (mir_tstrcmp(TranslateTS(LangPackStr), LangPackStr));
@@ -405,18 +405,18 @@ WORD GetIcon(const TCHAR* cond, WIDATA *Data)
//============ STRING CONVERSIONS ============
//
// this function convert the string to the format with 1 upper case followed by lower case char
-void CaseConv(TCHAR *str)
+void CaseConv(wchar_t *str)
{
BOOL nextUp = TRUE;
CharLowerBuff(str, (DWORD)mir_tstrlen(str));
- for (TCHAR *pstr = str; *pstr; pstr++) {
+ for (wchar_t *pstr = str; *pstr; pstr++) {
if (*pstr == ' ' || *pstr == '-')
nextUp = TRUE;
else {
- TCHAR ch = *pstr;
+ wchar_t ch = *pstr;
if (nextUp)
- *pstr = (TCHAR)CharUpper((LPTSTR)ch);
+ *pstr = (wchar_t)CharUpper((LPTSTR)ch);
nextUp = FALSE;
}
}
@@ -485,9 +485,9 @@ char *GetSearchStr(char *dis)
// w = WEATHERINFO data to be parsed
// dis = the string to parse
// return value = the parsed string
-TCHAR* GetDisplay(WEATHERINFO *w, const TCHAR *dis, TCHAR* str)
+wchar_t* GetDisplay(WEATHERINFO *w, const wchar_t *dis, wchar_t* str)
{
- TCHAR lpzDate[32], chr;
+ wchar_t lpzDate[32], chr;
char name[256], temp[2];
DBVARIANT dbv;
size_t i;
@@ -566,11 +566,11 @@ TCHAR* GetDisplay(WEATHERINFO *w, const TCHAR *dis, TCHAR* str)
return str;
}
-TCHAR svcReturnText[MAX_TEXT_SIZE];
+wchar_t svcReturnText[MAX_TEXT_SIZE];
INT_PTR GetDisplaySvcFunc(WPARAM wParam, LPARAM lParam)
{
WEATHERINFO winfo = LoadWeatherInfo(wParam);
- return (INT_PTR)GetDisplay(&winfo, (TCHAR*)lParam, svcReturnText);
+ return (INT_PTR)GetDisplay(&winfo, (wchar_t*)lParam, svcReturnText);
}
//============ ID MANAGEMENT ============
@@ -578,9 +578,9 @@ INT_PTR GetDisplaySvcFunc(WPARAM wParam, LPARAM lParam)
// get service data module internal name
// mod/id <- the mod part
// pszID = original 2-part id, return the service internal name
-void GetSvc(TCHAR *pszID)
+void GetSvc(wchar_t *pszID)
{
- TCHAR *chop = _tcsstr(pszID, L"/");
+ wchar_t *chop = wcsstr(pszID, L"/");
if (chop != NULL) *chop = '\0';
else pszID[0] = 0;
}
@@ -588,9 +588,9 @@ void GetSvc(TCHAR *pszID)
// get the id use for update without the service internal name
// mod/id <- the id part
// pszID = original 2-part id, return the single part id
-void GetID(TCHAR *pszID)
+void GetID(wchar_t *pszID)
{
- TCHAR *chop = _tcsstr(pszID, L"/");
+ wchar_t *chop = wcsstr(pszID, L"/");
if (chop != NULL) mir_tstrcpy(pszID, chop + 1);
else pszID[0] = 0;
}
@@ -601,9 +601,9 @@ void GetID(TCHAR *pszID)
// code = the error code obtained when updating weather
// str = the string for the error
//
-TCHAR *GetError(int code)
+wchar_t *GetError(int code)
{
- TCHAR *str, str2[100];
+ wchar_t *str, str2[100];
switch (code) {
case 10: str = E10; break;
case 11: str = E11; break;
diff --git a/plugins/Weather/src/weather_data.cpp b/plugins/Weather/src/weather_data.cpp
index 2fdd74ec15..88e9ca12e4 100644
--- a/plugins/Weather/src/weather_data.cpp
+++ b/plugins/Weather/src/weather_data.cpp
@@ -30,7 +30,7 @@ saving individual weather data for a weather contact.
// hContact = the current contact handle
// return value = the string for station ID
//
-void GetStationID(MCONTACT hContact, TCHAR* id, int idlen)
+void GetStationID(MCONTACT hContact, wchar_t* id, int idlen)
{
// accessing the database
if (db_get_tstatic(hContact, WEATHERPROTONAME, "ID", id, idlen))
@@ -50,35 +50,35 @@ WEATHERINFO LoadWeatherInfo(MCONTACT hContact)
GetStationID(hContact, winfo.id, _countof(winfo.id));
if (db_get_tstatic(hContact, WEATHERPROTONAME, "Nick", winfo.city, _countof(winfo.city)))
- _tcsncpy(winfo.city, NODATA, _countof(winfo.city) - 1);
+ wcsncpy(winfo.city, NODATA, _countof(winfo.city) - 1);
if (db_get_tstatic(hContact, WEATHERCONDITION, "Update", winfo.update, _countof(winfo.update)))
- _tcsncpy(winfo.update, NODATA, _countof(winfo.update) - 1);
+ wcsncpy(winfo.update, NODATA, _countof(winfo.update) - 1);
if (db_get_tstatic(hContact, WEATHERCONDITION, "Condition", winfo.cond, _countof(winfo.cond)))
- _tcsncpy(winfo.cond, NODATA, _countof(winfo.cond) - 1);
+ wcsncpy(winfo.cond, NODATA, _countof(winfo.cond) - 1);
if (db_get_tstatic(hContact, WEATHERCONDITION, "Temperature", winfo.temp, _countof(winfo.temp)))
- _tcsncpy(winfo.temp, NODATA, _countof(winfo.temp) - 1);
+ wcsncpy(winfo.temp, NODATA, _countof(winfo.temp) - 1);
if (db_get_tstatic(hContact, WEATHERCONDITION, "High", winfo.high, _countof(winfo.high)))
- _tcsncpy(winfo.high, NODATA, _countof(winfo.high) - 1);
+ wcsncpy(winfo.high, NODATA, _countof(winfo.high) - 1);
if (db_get_tstatic(hContact, WEATHERCONDITION, "Low", winfo.low, _countof(winfo.low)))
- _tcsncpy(winfo.low, NODATA, _countof(winfo.low) - 1);
+ wcsncpy(winfo.low, NODATA, _countof(winfo.low) - 1);
if (db_get_tstatic(hContact, WEATHERCONDITION, "Sunset", winfo.sunset, _countof(winfo.sunset)))
- _tcsncpy(winfo.sunset, NODATA, _countof(winfo.sunset) - 1);
+ wcsncpy(winfo.sunset, NODATA, _countof(winfo.sunset) - 1);
if (db_get_tstatic(hContact, WEATHERCONDITION, "Sunrise", winfo.sunrise, _countof(winfo.sunrise)))
- _tcsncpy(winfo.sunrise, NODATA, _countof(winfo.sunrise) - 1);
+ wcsncpy(winfo.sunrise, NODATA, _countof(winfo.sunrise) - 1);
if (db_get_tstatic(hContact, WEATHERCONDITION, "Wind Speed", winfo.wind, _countof(winfo.wind)))
- _tcsncpy(winfo.wind, NODATA, _countof(winfo.wind) - 1);
+ wcsncpy(winfo.wind, NODATA, _countof(winfo.wind) - 1);
if (db_get_tstatic(hContact, WEATHERCONDITION, "Wind Direction", winfo.winddir, _countof(winfo.winddir)))
- _tcsncpy(winfo.winddir, NODATA, _countof(winfo.winddir) - 1);
+ wcsncpy(winfo.winddir, NODATA, _countof(winfo.winddir) - 1);
if (db_get_tstatic(hContact, WEATHERCONDITION, "Dewpoint", winfo.dewpoint, _countof(winfo.dewpoint)))
- _tcsncpy(winfo.dewpoint, NODATA, _countof(winfo.dewpoint) - 1);
+ wcsncpy(winfo.dewpoint, NODATA, _countof(winfo.dewpoint) - 1);
if (db_get_tstatic(hContact, WEATHERCONDITION, "Pressure", winfo.pressure, _countof(winfo.pressure)))
- _tcsncpy(winfo.pressure, NODATA, _countof(winfo.pressure) - 1);
+ wcsncpy(winfo.pressure, NODATA, _countof(winfo.pressure) - 1);
if (db_get_tstatic(hContact, WEATHERCONDITION, "Visibility", winfo.vis, _countof(winfo.vis)))
- _tcsncpy(winfo.vis, NODATA, _countof(winfo.vis) - 1);
+ wcsncpy(winfo.vis, NODATA, _countof(winfo.vis) - 1);
if (db_get_tstatic(hContact, WEATHERCONDITION, "Humidity", winfo.humid, _countof(winfo.humid)))
- _tcsncpy(winfo.humid, NODATA, _countof(winfo.humid) - 1);
+ wcsncpy(winfo.humid, NODATA, _countof(winfo.humid) - 1);
if (db_get_tstatic(hContact, WEATHERCONDITION, "Feel", winfo.feel, _countof(winfo.feel)))
- _tcsncpy(winfo.feel, NODATA, _countof(winfo.feel) - 1);
+ wcsncpy(winfo.feel, NODATA, _countof(winfo.feel) - 1);
winfo.status = (WORD)db_get_w(hContact, WEATHERPROTONAME, "StatusIcon", ID_STATUS_OFFLINE);
return winfo;
@@ -107,7 +107,7 @@ int DBGetData(MCONTACT hContact, char *setting, DBVARIANT *dbv)
// lastver = the last used version number in dword (using PLUGIN_MAKE_VERSION)
void EraseAllInfo()
{
- TCHAR str[255];
+ wchar_t str[255];
int ContactCount = 0;
MCONTACT LastContact = NULL;
DBVARIANT dbv;
@@ -164,7 +164,7 @@ void EraseAllInfo()
// in case where the default station is missing
if (opt.DefStn == NULL && ContactCount != 0) {
if (!db_get_ts(LastContact, WEATHERPROTONAME, "ID", &dbv)) {
- _tcsncpy(opt.Default, dbv.ptszVal, _countof(opt.Default) - 1);
+ wcsncpy(opt.Default, dbv.ptszVal, _countof(opt.Default) - 1);
db_free(&dbv);
}
opt.DefStn = LastContact;
@@ -178,9 +178,9 @@ void EraseAllInfo()
db_set_ts(NULL, WEATHERPROTONAME, "Default", opt.Default);
}
-void ConvertDataValue(WIDATAITEM *UpdateData, TCHAR *Data)
+void ConvertDataValue(WIDATAITEM *UpdateData, wchar_t *Data)
{
- TCHAR str[MAX_DATA_LEN];
+ wchar_t str[MAX_DATA_LEN];
// convert the unit
if (mir_tstrcmp(Data, TranslateT("<Error>")) && mir_tstrcmp(Data, NODATA) && mir_tstrcmp(Data, TranslateTS(NODATA))) {
@@ -245,12 +245,12 @@ void ConvertDataValue(WIDATAITEM *UpdateData, TCHAR *Data)
// Data = the string containing weather data obtained from UpdateData
// global var. used: szInfo = the downloaded string
//
-void GetDataValue(WIDATAITEM *UpdateData, TCHAR *Data, TCHAR** szData)
+void GetDataValue(WIDATAITEM *UpdateData, wchar_t *Data, wchar_t** szData)
{
- TCHAR last = 0, current, *start, *end;
+ wchar_t last = 0, current, *start, *end;
unsigned startloc = 0, endloc = 0, respos = 0;
BOOL tag = FALSE, symb = FALSE;
- TCHAR *szInfo = *szData;
+ wchar_t *szInfo = *szData;
Data[0] = 0;
// parse the data if available
@@ -258,7 +258,7 @@ void GetDataValue(WIDATAITEM *UpdateData, TCHAR *Data, TCHAR** szData)
start = szInfo;
// the start string must be found
if (UpdateData->Start[0] != 0) {
- start = _tcsstr(szInfo, UpdateData->Start);
+ start = wcsstr(szInfo, UpdateData->Start);
if (start != NULL) {
// set the starting location for getting data
start += mir_tstrlen(UpdateData->Start);
@@ -268,9 +268,9 @@ void GetDataValue(WIDATAITEM *UpdateData, TCHAR *Data, TCHAR** szData)
// the end string must be found too
if (UpdateData->End[0] != 0)
- end = _tcsstr(szInfo, UpdateData->End);
+ end = wcsstr(szInfo, UpdateData->End);
else
- end = _tcsstr(szInfo, L" ");
+ end = wcsstr(szInfo, L" ");
if (end != NULL) {
// set the ending location
@@ -291,7 +291,7 @@ void GetDataValue(WIDATAITEM *UpdateData, TCHAR *Data, TCHAR** szData)
(szInfo[startloc + 1] == ';' || szInfo[startloc + 2] == ';' || szInfo[startloc + 3] == ';' ||
szInfo[startloc + 4] == ';' || szInfo[startloc + 5] == ';' || szInfo[startloc + 6] == ';')) {
// ...but do NOT strip &minus;
- if ((endloc - startloc) > 7 && _tcsncmp(szInfo + startloc, L"&minus;", 7) == 0) {
+ if ((endloc - startloc) > 7 && wcsncmp(szInfo + startloc, L"&minus;", 7) == 0) {
Data[respos++] = '-';
startloc += 7;
continue;
@@ -319,7 +319,7 @@ void GetDataValue(WIDATAITEM *UpdateData, TCHAR *Data, TCHAR** szData)
mir_sntprintf(Data, MAX_DATA_LEN, TranslateT("Error when obtaining data: %s"), UpdateData->Name);
WPShowMessage(Data, SM_WARNING);
}
- _tcsncpy(Data, TranslateT("<Error>"), MAX_DATA_LEN);
+ wcsncpy(Data, TranslateT("<Error>"), MAX_DATA_LEN);
last = ' ';
respos = MAX_DATA_LEN - 1;
break;
diff --git a/plugins/Weather/src/weather_http.cpp b/plugins/Weather/src/weather_http.cpp
index 429f8f654c..5567dff83f 100644
--- a/plugins/Weather/src/weather_http.cpp
+++ b/plugins/Weather/src/weather_http.cpp
@@ -44,7 +44,7 @@ static int findHeader(const NETLIBHTTPREQUEST *nlhrReply, const char *hdr)
// return value = 0 for success, 1 or HTTP error code for failure
// global var used: szData, szInfo = containing the retrieved data
//
-int InternetDownloadFile(char *szUrl, char *cookie, char *userAgent, TCHAR **szData)
+int InternetDownloadFile(char *szUrl, char *cookie, char *userAgent, wchar_t **szData)
{
if (userAgent == NULL || userAgent[0] == 0)
userAgent = NETLIB_USER_AGENT;
@@ -77,7 +77,7 @@ int InternetDownloadFile(char *szUrl, char *cookie, char *userAgent, TCHAR **szD
NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUser, (LPARAM)&nlhr);
if (nlhrReply == 0) {
// if the data does not downloaded successfully (ie. disconnected), then return 1000 as error code
- *szData = (TCHAR*)mir_alloc(512);
+ *szData = (wchar_t*)mir_alloc(512);
// store the error code in szData
mir_tstrcpy(*szData, L"NetLib error occurred!!");
hNetlibHttp = NULL;
@@ -124,7 +124,7 @@ int InternetDownloadFile(char *szUrl, char *cookie, char *userAgent, TCHAR **szD
}
}
- TCHAR *retVal = NULL;
+ wchar_t *retVal = NULL;
if (bIsUtf)
retVal = mir_utf8decodeT(nlhrReply->pData);
if (retVal == NULL)
@@ -135,7 +135,7 @@ int InternetDownloadFile(char *szUrl, char *cookie, char *userAgent, TCHAR **szD
}
// return error code if the recieved code is neither 200 OK nor 302 Moved
else {
- *szData = (TCHAR*)mir_alloc(512);
+ *szData = (wchar_t*)mir_alloc(512);
// store the error code in szData
mir_sntprintf(*szData, 512, L"Error occured! HTTP Error: %i\n", nlhrReply->resultCode);
result = nlhrReply->resultCode;
diff --git a/plugins/Weather/src/weather_info.cpp b/plugins/Weather/src/weather_info.cpp
index 3372d4d3ce..f0b3ca4eac 100644
--- a/plugins/Weather/src/weather_info.cpp
+++ b/plugins/Weather/src/weather_info.cpp
@@ -32,7 +32,7 @@ regrading the loading of ini contents
// List INI Information for all loaded INI files
static void INIInfo(HWND hwndDlg)
{
- TCHAR str[16];
+ wchar_t str[16];
size_t memused = 0;
@@ -67,7 +67,7 @@ static void INIInfo(HWND hwndDlg)
}
ListView_SetItem(hIniList, &lvi);
lvi.iSubItem = 4;
- lvi.pszText = _ltot(Item->Data.UpdateDataCount, str, 10);
+ lvi.pszText = _ltow(Item->Data.UpdateDataCount, str, 10);
ListView_SetItem(hIniList, &lvi);
lvi.iSubItem = 5;
lvi.pszText = Item->Data.DisplayName;
@@ -80,24 +80,24 @@ static void INIInfo(HWND hwndDlg)
++lvi.iItem;
}
- SetDlgItemText(hwndDlg, IDC_INICOUNT, _itot(lvi.iItem, str, 10));
- SetDlgItemText(hwndDlg, IDC_MEMUSED, _ltot((long)memused, str, 10));
+ SetDlgItemText(hwndDlg, IDC_INICOUNT, _itow(lvi.iItem, str, 10));
+ SetDlgItemText(hwndDlg, IDC_MEMUSED, _ltow((long)memused, str, 10));
}
static const struct tag_Columns
{
- const TCHAR *name;
+ const wchar_t *name;
unsigned size;
}
columns[] =
{
- { LPGENT("Name"), 70 },
- { LPGENT("Author"), 100 },
- { LPGENT("File Version"), 70 },
- { LPGENT("INI Version"), 70 },
- { LPGENT("Items"), 40 },
- { LPGENT("Display Name"), 200 },
- { LPGENT("File Name"), 150 },
+ { LPGENW("Name"), 70 },
+ { LPGENW("Author"), 100 },
+ { LPGENW("File Version"), 70 },
+ { LPGENW("INI Version"), 70 },
+ { LPGENW("Items"), 40 },
+ { LPGENW("Display Name"), 200 },
+ { LPGENW("File Name"), 150 },
};
@@ -141,9 +141,9 @@ INT_PTR CALLBACK DlgProcINIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
// get the info of individual ini file
// pszSvc = the internal name of the service to get the data
-void GetINIInfo(TCHAR *pszSvc)
+void GetINIInfo(wchar_t *pszSvc)
{
- TCHAR str2[2048];
+ wchar_t str2[2048];
WIDATA *sData = GetWIData(pszSvc);
// if the service does not exist among the loaded INI's
if (sData == NULL) {
@@ -207,10 +207,10 @@ void GetINIInfo(TCHAR *pszSvc)
// can be found when click on "More" in text option dialog
void MoreVarList(void)
{
- TCHAR str[10240], tempstr[1024];
+ wchar_t str[10240], tempstr[1024];
// heading
- _tcsncpy(str, VARS_LIST, _countof(str) - 1);
+ wcsncpy(str, VARS_LIST, _countof(str) - 1);
mir_tstrncat(str, L"\n\n", _countof(str) - mir_tstrlen(str));
// loop through all weather services to find custom variables
for (WIDATALIST *Item = WIHead; Item != NULL; Item = Item->next) {
@@ -220,7 +220,7 @@ void MoreVarList(void)
// ignore the "hi" item and hidden items
if (mir_tstrcmp(WItem->Item.Name, L"Ignore") && WItem->Item.Name[0] != '#') {
mir_sntprintf(tempstr, L"%c[%s]", '%', WItem->Item.Name);
- TCHAR *find = _tcsstr(str, tempstr);
+ wchar_t *find = wcsstr(str, tempstr);
// if the custom variable does not exist in the list, add it to the list
if (find == NULL) {
mir_tstrncat(str, tempstr, _countof(str) - mir_tstrlen(str));
@@ -230,7 +230,7 @@ void MoreVarList(void)
}
}
// remove the last comma in the list
- TCHAR* find = _tcsrchr(str, ',');
+ wchar_t* find = wcsrchr(str, ',');
if (find != NULL)
*find = '\0';
diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp
index df49fe4d80..f3af9cb3f6 100644
--- a/plugins/Weather/src/weather_ini.cpp
+++ b/plugins/Weather/src/weather_ini.cpp
@@ -48,7 +48,7 @@ static void WIListAdd(WIDATA Data)
// get the service data (from loaded ini file) by internal name
// pszServ = internal name for the service
// return value = the matching WIDATA struct for pszServ, NULL if no match found
-WIDATA* GetWIData(TCHAR *pszServ)
+WIDATA* GetWIData(wchar_t *pszServ)
{
// loop through the list to find matching internal name
for (WIDATALIST *Item = WIHead; Item != NULL; Item = Item->next)
@@ -76,7 +76,7 @@ void WIItemListAdd(WIDATAITEM *DataItem, WIDATA *Data)
// reset the data item by using empty string
// Item = the item to set
// name = the string to store in the "name" field
-void ResetDataItem(WIDATAITEM *Item, const TCHAR *name)
+void ResetDataItem(WIDATAITEM *Item, const wchar_t *name)
{
Item->Name = mir_tstrdup(name);
Item->Start = L"";
@@ -121,12 +121,12 @@ void WICondListAdd(char *str, WICONDLIST *List)
}
// check if the condition string matched for the assignment
-bool IsContainedInCondList(const TCHAR *pszStr, WICONDLIST *List)
+bool IsContainedInCondList(const wchar_t *pszStr, WICONDLIST *List)
{
// loop through the list to find matching internal name
for (WICONDITEM *Item = List->Head; Item != NULL; Item = Item->Next) {
// if internal name found, return true indicating that the data is found
- if (_tcsstr(pszStr, Item->Item))
+ if (wcsstr(pszStr, Item->Item))
return true;
}
@@ -178,13 +178,13 @@ static INT_PTR CALLBACK DlgProcSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
case IDC_STEP2:
{
- TCHAR szPath[1024];
+ wchar_t szPath[1024];
GetModuleFileName(GetModuleHandle(NULL), szPath, _countof(szPath));
- TCHAR *chop = _tcsrchr(szPath, '\\');
+ wchar_t *chop = wcsrchr(szPath, '\\');
if (chop) {
*chop = '\0';
mir_tstrncat(szPath, L"\\Plugins\\weather\\", _countof(szPath) - mir_tstrlen(szPath));
- if (_tmkdir(szPath) == 0)
+ if (_wmkdir(szPath) == 0)
ShellExecute((HWND)lParam, L"open", szPath, L"", L"", SW_SHOW);
}
break;
@@ -222,7 +222,7 @@ static INT_PTR CALLBACK DlgProcSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
// pszFile = the file name + path for the ini file to be loaded
// pszShortFile = the file name of the ini file, but not including the path
// Data = the struct to load the ini content to, and return to previous function
-static void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data)
+static void LoadStationData(wchar_t *pszFile, wchar_t *pszShortFile, WIDATA *Data)
{
WIDATAITEM DataItem;
char *Group, *Temp;
@@ -269,7 +269,7 @@ static void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data)
else if (!mir_strcmp(Line, "[Weather 0.3.x Update Data 1.5]"))
Data->InternalVer = 7;
else {
- TCHAR str[4096];
+ wchar_t str[4096];
mir_sntprintf(str, TranslateT("Invalid ini format for: %s"), pszFile);
MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK | MB_ICONERROR);
fclose(pfile);
@@ -323,7 +323,7 @@ static void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data)
// initialize the linked list for update items
Data->UpdateDataCount = 0;
- Data->MemUsed = sizeof(WIDATA) + sizeof(WIDATALIST) + (mir_tstrlen(pszShortFile) + mir_tstrlen(pszFile) + 20)*sizeof(TCHAR);
+ Data->MemUsed = sizeof(WIDATA) + sizeof(WIDATALIST) + (mir_tstrlen(pszShortFile) + mir_tstrlen(pszFile) + 20)*sizeof(wchar_t);
Data->UpdateData = NULL;
Data->UpdateDataTail = NULL;
@@ -446,11 +446,11 @@ static void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data)
else if (!_stricmp(ValName, "URL")) wSetData(&Data->UpdateDataTail->Item.Url, Value);
else if (!_stricmp(ValName, "HIDDEN")) {
if (!_stricmp(Value, "TRUE")) {
- TCHAR *nm = Data->UpdateDataTail->Item.Name;
+ wchar_t *nm = Data->UpdateDataTail->Item.Name;
size_t len = mir_tstrlen(nm) + 1;
- Data->UpdateDataTail->Item.Name = nm = (TCHAR*)mir_realloc(nm, sizeof(TCHAR)*(len + 3));
- memmove(nm + 1, nm, len*sizeof(TCHAR));
+ Data->UpdateDataTail->Item.Name = nm = (wchar_t*)mir_realloc(nm, sizeof(wchar_t)*(len + 3));
+ memmove(nm + 1, nm, len*sizeof(wchar_t));
*nm = '#';
}
}
@@ -485,14 +485,14 @@ bool LoadWIData(bool dial)
WIHead = WITail;
// find all *.ini file in the plugin\weather directory
- TCHAR szSearchPath[MAX_PATH], FileName[MAX_PATH];
+ wchar_t szSearchPath[MAX_PATH], FileName[MAX_PATH];
GetModuleFileName(GetModuleHandle(NULL), szSearchPath, _countof(szSearchPath));
- TCHAR *chop = _tcsrchr(szSearchPath, '\\');
+ wchar_t *chop = wcsrchr(szSearchPath, '\\');
if (chop == NULL)
return false;
*chop = '\0';
mir_tstrncat(szSearchPath, L"\\Plugins\\Weather\\*.ini", _countof(szSearchPath) - mir_tstrlen(szSearchPath));
- _tcsncpy(FileName, szSearchPath, MAX_PATH - 1);
+ wcsncpy(FileName, szSearchPath, MAX_PATH - 1);
WIN32_FIND_DATA fd;
HANDLE hFind = FindFirstFile(szSearchPath, &fd);
@@ -501,7 +501,7 @@ bool LoadWIData(bool dial)
// load the content of the ini file into memory
if (hFind != INVALID_HANDLE_VALUE) {
do {
- chop = _tcsrchr(FileName, '\\');
+ chop = wcsrchr(FileName, '\\');
chop[1] = '\0';
mir_tstrncat(FileName, fd.cFileName, _countof(FileName) - mir_tstrlen(FileName));
if (mir_tstrcmpi(fd.cFileName, L"SAMPLE_INI.INI")) {
diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp
index 61f323d8d9..fdd83c3d94 100644
--- a/plugins/Weather/src/weather_mwin.cpp
+++ b/plugins/Weather/src/weather_mwin.cpp
@@ -159,10 +159,10 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
{
FontIDT fntid = { 0 };
mir_tstrcpy(fntid.group, _T(WEATHERPROTONAME));
- mir_tstrcpy(fntid.name, LPGENT("Frame Font"));
+ mir_tstrcpy(fntid.name, LPGENW("Frame Font"));
fntc = CallService(MS_FONT_GETT, (WPARAM)&fntid, (LPARAM)&lfnt);
- mir_tstrcpy(fntid.name, LPGENT("Frame Title Font"));
+ mir_tstrcpy(fntid.name, LPGENW("Frame Title Font"));
fntc1 = CallService(MS_FONT_GETT, (WPARAM)&fntid, (LPARAM)&lfnt1);
}
@@ -197,7 +197,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
HFONT hfnt = CreateFontIndirect(&lfnt1);
HFONT hfntold = (HFONT)SelectObject(hdc, hfnt);
- TCHAR *nick = (TCHAR*)pcli->pfnGetContactDisplayName(data->hContact, 0);
+ wchar_t *nick = (wchar_t*)pcli->pfnGetContactDisplayName(data->hContact, 0);
SIZE fontSize;
GetTextExtentPoint32(hdc, L"|", 1, &fontSize);
@@ -241,7 +241,7 @@ static void addWindow(MCONTACT hContact)
if (db_get_ts(hContact, WEATHERPROTONAME, "Nick", &dbv))
return;
- TCHAR winname[512];
+ wchar_t winname[512];
mir_sntprintf(winname, L"Weather: %s", dbv.ptszVal);
db_free(&dbv);
@@ -328,7 +328,7 @@ void InitMwin(void)
colourid.cbSize = sizeof(ColourIDT);
mir_strcpy(colourid.dbSettingsGroup, WEATHERPROTONAME);
mir_strcpy(colourid.setting, "ColorMwinFrame");
- mir_tstrcpy(colourid.name, LPGENT("Frame Background"));
+ mir_tstrcpy(colourid.name, LPGENW("Frame Background"));
mir_tstrcpy(colourid.group, _T(WEATHERPROTONAME));
colourid.defcolour = GetSysColor(COLOR_3DFACE);
ColourRegisterT(&colourid);
@@ -338,7 +338,7 @@ void InitMwin(void)
fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID;
mir_strcpy(fontid.dbSettingsGroup, WEATHERPROTONAME);
mir_tstrcpy(fontid.group, _T(WEATHERPROTONAME));
- mir_tstrcpy(fontid.name, LPGENT("Frame Font"));
+ mir_tstrcpy(fontid.name, LPGENW("Frame Font"));
mir_strcpy(fontid.prefix, "fnt0");
HDC hdc = GetDC(NULL);
@@ -348,11 +348,11 @@ void InitMwin(void)
fontid.deffontsettings.charset = DEFAULT_CHARSET;
mir_tstrcpy(fontid.deffontsettings.szFace, L"Verdana");
mir_tstrcpy(fontid.backgroundGroup, _T(WEATHERPROTONAME));
- mir_tstrcpy(fontid.backgroundName, LPGENT("Frame Background"));
+ mir_tstrcpy(fontid.backgroundName, LPGENW("Frame Background"));
FontRegisterT(&fontid);
fontid.deffontsettings.style = DBFONTF_BOLD;
- mir_tstrcpy(fontid.name, LPGENT("Frame Title Font"));
+ mir_tstrcpy(fontid.name, LPGENW("Frame Title Font"));
mir_strcpy(fontid.prefix, "fnt1");
FontRegisterT(&fontid);
diff --git a/plugins/Weather/src/weather_opt.cpp b/plugins/Weather/src/weather_opt.cpp
index 48d275e12b..ea567ff901 100644
--- a/plugins/Weather/src/weather_opt.cpp
+++ b/plugins/Weather/src/weather_opt.cpp
@@ -33,46 +33,46 @@ int RedrawFrame(WPARAM wParam, LPARAM lParam);
// in = string to determine which field to set default "CBNEHXPp"
void SetTextDefault(const char* in)
{
- TCHAR str[MAX_TEXT_SIZE];
+ wchar_t str[MAX_TEXT_SIZE];
if (strchr(in, 'C') != NULL) {
- _tcsncpy(str, C_DEFAULT, MAX_TEXT_SIZE - 1);
+ wcsncpy(str, C_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.cText, str);
}
if (strchr(in, 'b') != NULL) {
- _tcsncpy(str, b_DEFAULT, MAX_TEXT_SIZE - 1);
+ wcsncpy(str, b_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.bTitle, str);
}
if (strchr(in, 'B') != NULL) {
- _tcsncpy(str, B_DEFAULT, MAX_TEXT_SIZE - 1);
+ wcsncpy(str, B_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.bText, str);
}
if (strchr(in, 'N') != NULL) {
- _tcsncpy(str, N_DEFAULT, MAX_TEXT_SIZE - 1);
+ wcsncpy(str, N_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.nText, str);
}
if (strchr(in, 'E') != NULL) {
- _tcsncpy(str, E_DEFAULT, MAX_TEXT_SIZE - 1);
+ wcsncpy(str, E_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.eText, str);
}
if (strchr(in, 'H') != NULL) {
- _tcsncpy(str, H_DEFAULT, MAX_TEXT_SIZE - 1);
+ wcsncpy(str, H_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.hText, str);
}
if (strchr(in, 'X') != NULL) {
- _tcsncpy(str, X_DEFAULT, MAX_TEXT_SIZE - 1);
+ wcsncpy(str, X_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.xText, str);
}
if (strchr(in, 'P') != NULL) {
- _tcsncpy(str, P_DEFAULT, MAX_TEXT_SIZE - 1);
+ wcsncpy(str, P_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.pTitle, str);
}
if (strchr(in, 'p') != NULL) {
- _tcsncpy(str, p_DEFAULT, MAX_TEXT_SIZE - 1);
+ wcsncpy(str, p_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.pText, str);
}
if (strchr(in, 'S') != NULL) {
- _tcsncpy(str, s_DEFAULT, MAX_TEXT_SIZE - 1);
+ wcsncpy(str, s_DEFAULT, MAX_TEXT_SIZE - 1);
wSetData(&opt.sText, str);
}
}
@@ -115,7 +115,7 @@ void LoadOptions(void)
opt.eUnit = db_get_w(NULL, WEATHERPROTONAME, "eUnit", 2);
ptrT szValue(db_get_tsa(NULL, WEATHERPROTONAME, "DegreeSign"));
- _tcsncpy_s(opt.DegreeSign, (szValue == NULL) ? L"" : szValue, _TRUNCATE);
+ wcsncpy_s(opt.DegreeSign, (szValue == NULL) ? L"" : szValue, _TRUNCATE);
opt.DoNotAppendUnit = db_get_b(NULL, WEATHERPROTONAME, "DoNotAppendUnit", 0);
opt.NoFrac = db_get_b(NULL, WEATHERPROTONAME, "NoFractions", 0);
@@ -191,7 +191,7 @@ void LoadOptions(void)
// misc
if (szValue = db_get_tsa(NULL, WEATHERPROTONAME, "Default"))
- _tcsncpy_s(opt.Default, szValue, _TRUNCATE);
+ wcsncpy_s(opt.Default, szValue, _TRUNCATE);
else
opt.Default[0] = 0;
}
@@ -255,14 +255,14 @@ void SaveOptions(void)
// weather options
static INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
- TCHAR str[512];
+ wchar_t str[512];
switch (msg) {
case WM_INITDIALOG:
opt_startup = TRUE;
TranslateDialogDefault(hdlg);
// load settings
- _ltot(opt.UpdateTime, str, 10);
+ _ltow(opt.UpdateTime, str, 10);
SetDlgItemText(hdlg, IDC_UPDATETIME, str);
SetDlgItemText(hdlg, IDC_DEGREE, opt.DegreeSign);
@@ -335,7 +335,7 @@ static INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l
// get update time and remove the old timer
GetDlgItemText(hdlg, IDC_UPDATETIME, str, _countof(str));
- opt.UpdateTime = (WORD)_ttoi(str);
+ opt.UpdateTime = (WORD)_wtoi(str);
if (opt.UpdateTime < 1) opt.UpdateTime = 1;
KillTimer(NULL, timerId);
timerId = SetTimer(NULL, 0, opt.UpdateTime * 60000, timerProc);
@@ -417,14 +417,14 @@ static void FreeTextVar(void)
static const char *varname[8] = { "C", "b", "B", "N", "X", "E", "H", "S" };
static const int cname[8] = { IDC_CTEXT, IDC_BTITLE, IDC_BTEXT, IDC_NTEXT, IDC_XTEXT, IDC_ETEXT, IDC_HTEXT, IDC_BTITLE2 };
-static TCHAR* const *var[8] = { &opt.cText, &opt.bTitle, &opt.bText, &opt.nText, &opt.xText, &opt.eText, &opt.hText, &opt.sText };
+static wchar_t* const *var[8] = { &opt.cText, &opt.bTitle, &opt.bText, &opt.nText, &opt.xText, &opt.eText, &opt.hText, &opt.sText };
static INT_PTR CALLBACK DlgProcText(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
RECT rc, pos;
HWND button;
HMENU hMenu, hMenu1;
- TCHAR str[4096];
+ wchar_t str[4096];
switch (msg) {
case WM_INITDIALOG:
opt_startup = TRUE;
@@ -433,7 +433,7 @@ static INT_PTR CALLBACK DlgProcText(HWND hdlg, UINT msg, WPARAM wParam, LPARAM l
SetWindowPos(hdlg, HWND_TOPMOST, rc.left, rc.top, 0, 0, SWP_NOSIZE);
TranslateDialogDefault(hdlg);
// generate the display text for variable list
- _tcsncpy(str, VAR_LIST_OPT, _countof(str) - 1);
+ wcsncpy(str, VAR_LIST_OPT, _countof(str) - 1);
SetDlgItemText(hdlg, IDC_VARLIST, str);
// make the more variable and other buttons flat
@@ -498,7 +498,7 @@ static INT_PTR CALLBACK DlgProcText(HWND hdlg, UINT msg, WPARAM wParam, LPARAM l
case ID_MRESET:
unsigned varo = LOWORD(wParam) - IDC_TM1;
// remove the old setting from db and free memory
- TCHAR* vartmp = *var[varo];
+ wchar_t* vartmp = *var[varo];
wfree(&vartmp);
SetTextDefault(varname[varo]);
SetDlgItemText(hdlg, cname[varo], *var[varo]);
@@ -535,7 +535,7 @@ static INT_PTR CALLBACK DlgProcText(HWND hdlg, UINT msg, WPARAM wParam, LPARAM l
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
// save the option
- TCHAR textstr[MAX_TEXT_SIZE];
+ wchar_t textstr[MAX_TEXT_SIZE];
// free memory for old settings
FreeTextVar();
// save new settings to memory
@@ -577,25 +577,25 @@ int OptInit(WPARAM wParam, LPARAM)
odp.position = 95600;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.pfnDlgProc = OptionsProc;
- odp.ptszGroup = LPGENT("Network");
- odp.ptszTitle = _T(WEATHERPROTOTEXT);
- odp.ptszTab = LPGENT("General");
+ odp.pwszGroup = LPGENW("Network");
+ odp.pwszTitle = _T(WEATHERPROTOTEXT);
+ odp.pwszTab = LPGENW("General");
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
Options_AddPage(wParam, &odp);
// text options
odp.pszTemplate = MAKEINTRESOURCEA(IDD_TEXTOPT);
odp.pfnDlgProc = DlgProcText;
- odp.ptszTab = LPGENT("Display");
+ odp.pwszTab = LPGENW("Display");
Options_AddPage(wParam, &odp);
// if popup service exists, load the weather popup options
if ((ServiceExists(MS_POPUP_ADDPOPUPT))) {
odp.position = 100000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP);
- odp.ptszGroup = LPGENT("Popups");
+ odp.pwszGroup = LPGENW("Popups");
odp.groupPosition = 910000000;
- odp.ptszTab = NULL;
+ odp.pwszTab = NULL;
odp.pfnDlgProc = DlgPopupOpts;
Options_AddPage(wParam, &odp);
}
diff --git a/plugins/Weather/src/weather_popup.cpp b/plugins/Weather/src/weather_popup.cpp
index fcd891e70c..4e721a07a5 100644
--- a/plugins/Weather/src/weather_popup.cpp
+++ b/plugins/Weather/src/weather_popup.cpp
@@ -40,7 +40,7 @@ int WeatherError(WPARAM wParam, LPARAM lParam)
if (!opt.UsePopup)
return 0;
- TCHAR* tszMsg = (TCHAR*)wParam;
+ wchar_t* tszMsg = (wchar_t*)wParam;
if ((DWORD)lParam == SM_WARNING)
PUShowMessageT(tszMsg, SM_WARNING);
@@ -48,19 +48,19 @@ int WeatherError(WPARAM wParam, LPARAM lParam)
PUShowMessageT(tszMsg, SM_NOTIFY);
else if ((DWORD)lParam == SM_WEATHERALERT) {
POPUPDATAT ppd = { 0 };
- TCHAR str1[512], str2[512];
+ wchar_t str1[512], str2[512];
// get the 2 strings
- _tcsncpy(str1, tszMsg, _countof(str1) - 1);
- _tcsncpy(str2, tszMsg, _countof(str2) - 1);
- TCHAR *chop = _tcschr(str1, 255);
+ wcsncpy(str1, tszMsg, _countof(str1) - 1);
+ wcsncpy(str2, tszMsg, _countof(str2) - 1);
+ wchar_t *chop = wcschr(str1, 255);
if (chop != NULL)
*chop = '\0';
else
str1[0] = 0;
- chop = _tcschr(str2, 255);
+ chop = wcschr(str2, 255);
if (chop != NULL)
- _tcsncpy(str2, chop + 1, _countof(str2) - 1);
+ wcsncpy(str2, chop + 1, _countof(str2) - 1);
else
str2[0] = 0;
@@ -81,7 +81,7 @@ int WeatherError(WPARAM wParam, LPARAM lParam)
// (threaded)
// lpzText = error text
// kind = display type (see m_popup.h)
-int WPShowMessage(TCHAR* lpzText, WORD kind)
+int WPShowMessage(wchar_t* lpzText, WORD kind)
{
NotifyEventHooks(hHookWeatherError, (WPARAM)lpzText, (LPARAM)kind);
return 0;
@@ -211,8 +211,8 @@ static void SelectMenuItem(HMENU hMenu, int Check)
// but does not write to the database
void ReadPopupOpt(HWND hdlg)
{
- TCHAR text[MAX_TEXT_SIZE];
- TCHAR str[512];
+ wchar_t text[MAX_TEXT_SIZE];
+ wchar_t str[512];
// popup colour
opt.TextColour = SendDlgItemMessage(hdlg, IDC_TEXTCOLOUR, CPM_GETCOLOUR, 0, 0);
@@ -220,7 +220,7 @@ void ReadPopupOpt(HWND hdlg)
// get delay time
GetDlgItemText(hdlg, IDC_DELAY, str, _countof(str));
- int num = _ttoi(str);
+ int num = _wtoi(str);
opt.pDelay = num;
// other options
@@ -244,7 +244,7 @@ void ReadPopupOpt(HWND hdlg)
INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
int ID;
- TCHAR str[512];
+ wchar_t str[512];
HMENU hMenu, hMenu1;
RECT pos;
HWND button;
@@ -273,7 +273,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
SetDlgItemText(hdlg, IDC_PText, opt.pText);
SetDlgItemText(hdlg, IDC_PTitle, opt.pTitle);
// setting popup delay option
- _ltot(opt.pDelay, str, 10);
+ _ltow(opt.pDelay, str, 10);
SetDlgItemText(hdlg, IDC_DELAY, str);
if (opt.pDelay == -1)
CheckRadioButton(hdlg, IDC_PD1, IDC_PD3, IDC_PD2);
@@ -394,7 +394,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
case IDC_VAR3:
// display variable list
- _tcsncpy(str, L" \n", _countof(str) - 1); // to make the message box wider
+ wcsncpy(str, L" \n", _countof(str) - 1); // to make the message box wider
mir_tstrncat(str, VAR_LIST_POPUP, _countof(str) - mir_tstrlen(str));
mir_tstrncat(str, L"\n", _countof(str) - mir_tstrlen(str));
mir_tstrncat(str, CUSTOM_VARS, _countof(str) - mir_tstrlen(str));
diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp
index 753c91c1e8..cd283324bb 100644
--- a/plugins/Weather/src/weather_svcs.cpp
+++ b/plugins/Weather/src/weather_svcs.cpp
@@ -123,17 +123,17 @@ INT_PTR WeatherGetInfo(WPARAM, LPARAM lParam)
}
// avatars
-static const TCHAR *statusStr[] = { L"Light", L"Fog", L"SShower", L"Snow", L"RShower", L"Rain", L"PCloudy", L"Cloudy", L"Sunny", L"NA" };
+static const wchar_t *statusStr[] = { L"Light", L"Fog", L"SShower", L"Snow", L"RShower", L"Rain", L"PCloudy", L"Cloudy", L"Sunny", L"NA" };
static const WORD statusValue[] = { LIGHT, FOG, SSHOWER, SNOW, RSHOWER, RAIN, PCLOUDY, CLOUDY, SUNNY, NA };
INT_PTR WeatherGetAvatarInfo(WPARAM, LPARAM lParam)
{
- TCHAR szSearchPath[MAX_PATH], *chop;
+ wchar_t szSearchPath[MAX_PATH], *chop;
unsigned i;
PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION*)lParam;
GetModuleFileName(GetModuleHandle(NULL), szSearchPath, _countof(szSearchPath));
- chop = _tcsrchr(szSearchPath, '\\');
+ chop = wcsrchr(szSearchPath, '\\');
if (chop) *chop = '\0';
else szSearchPath[0] = 0;
@@ -148,12 +148,12 @@ INT_PTR WeatherGetAvatarInfo(WPARAM, LPARAM lParam)
pai->format = PA_FORMAT_PNG;
mir_sntprintf(pai->filename, L"%s\\Plugins\\Weather\\%s.png", szSearchPath, statusStr[i]);
- if (_taccess(pai->filename, 4) == 0)
+ if (_waccess(pai->filename, 4) == 0)
return GAIR_SUCCESS;
pai->format = PA_FORMAT_GIF;
mir_sntprintf(pai->filename, L"%s\\Plugins\\Weather\\%s.gif", szSearchPath, statusStr[i]);
- if (_taccess(pai->filename, 4) == 0)
+ if (_waccess(pai->filename, 4) == 0)
return GAIR_SUCCESS;
pai->format = PA_FORMAT_UNKNOWN;
@@ -225,11 +225,11 @@ void UpdateMenu(BOOL State)
db_set_b(NULL, WEATHERPROTONAME, "AutoUpdate", (BYTE)State);
if (State) { // to enable auto-update
- Menu_ModifyItem(hEnableDisableMenu, LPGENT("Auto Update Enabled"), GetIconHandle("main"));
+ Menu_ModifyItem(hEnableDisableMenu, LPGENW("Auto Update Enabled"), GetIconHandle("main"));
opt.AutoUpdate = 1;
}
else { // to disable auto-update
- Menu_ModifyItem(hEnableDisableMenu, LPGENT("Auto Update Disabled"), GetIconHandle("disabled"));
+ Menu_ModifyItem(hEnableDisableMenu, LPGENW("Auto Update Disabled"), GetIconHandle("disabled"));
opt.AutoUpdate = 0;
}
@@ -243,9 +243,9 @@ void UpdatePopupMenu(BOOL State)
db_set_b(NULL, WEATHERPROTONAME, "UsePopup", (BYTE)opt.UsePopup);
if (State) // to enable popup
- Menu_ModifyItem(hEnableDisablePopupMenu, LPGENT("Disable &weather notification"), GetIconHandle("popup"));
+ Menu_ModifyItem(hEnableDisablePopupMenu, LPGENW("Disable &weather notification"), GetIconHandle("popup"));
else // to disable popup
- Menu_ModifyItem(hEnableDisablePopupMenu, LPGENT("Enable &weather notification"), GetIconHandle("nopopup"));
+ Menu_ModifyItem(hEnableDisablePopupMenu, LPGENW("Enable &weather notification"), GetIconHandle("nopopup"));
}
// update the weather auto-update menu item when click on it
@@ -326,7 +326,7 @@ void AddMenuItems(void)
Menu_AddContactMenuItem(&mi, WEATHERPROTONAME);
// adding main menu items
- mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Weather"), 500099000);
+ mi.root = Menu_CreateRoot(MO_MAIN, LPGENW("Weather"), 500099000);
Menu_ConfigureItem(mi.root, MCI_OPT_UID, "82809D2F-2CF0-4E15-9350-D257A7748552");
SET_UID(mi, 0x5ad16188, 0xe0a0, 0x4c31, 0x85, 0xc3, 0xe4, 0x85, 0x79, 0x7e, 0x4b, 0x9c);
@@ -361,7 +361,7 @@ void AddMenuItems(void)
mi.name.a = LPGEN("Weather Notification");
mi.hIcolibItem = GetIconHandle("popup");
mi.position = 0;
- mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Popups"), 0);
+ mi.root = Menu_CreateRoot(MO_MAIN, LPGENW("Popups"), 0);
mi.pszService = WEATHERPROTONAME "/PopupMenu";
hEnableDisablePopupMenu = Menu_AddMainMenuItem(&mi);
UpdatePopupMenu(opt.UsePopup);
diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp
index 6a6403dbdd..65c814dee1 100644
--- a/plugins/Weather/src/weather_update.cpp
+++ b/plugins/Weather/src/weather_update.cpp
@@ -34,7 +34,7 @@ UPDATELIST *UpdateListHead, *UpdateListTail;
// hContact = current contact
int UpdateWeather(MCONTACT hContact)
{
- TCHAR str[256], str2[MAX_TEXT_SIZE];
+ wchar_t str[256], str2[MAX_TEXT_SIZE];
DBVARIANT dbv;
BOOL Ch = FALSE;
@@ -59,7 +59,7 @@ int UpdateWeather(MCONTACT hContact)
mir_sntprintf(str, _countof(str) - 105,
TranslateT("Unable to retrieve weather information for %s"), dbv.ptszVal);
mir_tstrncat(str, L"\n", _countof(str) - mir_tstrlen(str));
- TCHAR *tszError = GetError(code);
+ wchar_t *tszError = GetError(code);
mir_tstrncat(str, tszError, _countof(str) - mir_tstrlen(str));
WPShowMessage(str, SM_WARNING);
mir_free(tszError);
@@ -172,12 +172,12 @@ int UpdateWeather(MCONTACT hContact)
DeleteFile(dbv.ptszVal);
// open the file and set point to the end of file
- FILE *file = _tfopen(dbv.ptszVal, L"a");
+ FILE *file = _wfopen(dbv.ptszVal, L"a");
db_free(&dbv);
if (file != NULL) {
// write data to the file and close
GetDisplay(&winfo, opt.eText, str2);
- _fputts(str2, file);
+ fputws(str2, file);
fclose(file);
}
}
@@ -379,17 +379,17 @@ INT_PTR UpdateAllRemove(WPARAM, LPARAM)
int GetWeatherData(MCONTACT hContact)
{
// get each part of the id's
- TCHAR id[256];
+ wchar_t id[256];
GetStationID(hContact, id, _countof(id));
// test ID format
- TCHAR* szInfo = _tcschr(id, '/');
+ wchar_t* szInfo = wcschr(id, '/');
if (szInfo == NULL)
return INVALID_ID_FORMAT;
GetID(id);
- TCHAR Svc[256];
+ wchar_t Svc[256];
GetStationID(hContact, Svc, _countof(Svc));
GetSvc(Svc);
@@ -431,13 +431,13 @@ int GetWeatherData(MCONTACT hContact)
continue;
// download the html file from the internet
- TCHAR* szData = NULL;
+ wchar_t* szData = NULL;
int retval = InternetDownloadFile(loc, Data->Cookie, Data->UserAgent, &szData);
if (retval != 0) {
mir_free(szData);
return retval;
}
- if (_tcsstr(szData, L"Document Not Found") != NULL) {
+ if (wcsstr(szData, L"Document Not Found") != NULL) {
mir_free(szData);
return DOC_NOT_FOUND;
}
@@ -452,21 +452,21 @@ int GetWeatherData(MCONTACT hContact)
continue;
}
- TCHAR DataValue[MAX_DATA_LEN];
+ wchar_t DataValue[MAX_DATA_LEN];
switch (Item->Item.Type) {
case WID_NORMAL:
// if it is a normal item with start= and end=, then parse through the downloaded string
// to get a data value.
GetDataValue(&Item->Item, DataValue, &szInfo);
if (mir_tstrcmp(Item->Item.Name, L"Condition") && mir_tstrcmpi(Item->Item.Unit, L"Cond"))
- _tcsncpy(DataValue, TranslateTS(DataValue), MAX_DATA_LEN - 1);
+ wcsncpy(DataValue, TranslateTS(DataValue), MAX_DATA_LEN - 1);
break;
case WID_SET:
{
// for the "Set Data=" operation
DBVARIANT dbv;
- TCHAR *chop, *str, str2[MAX_DATA_LEN];
+ wchar_t *chop, *str, str2[MAX_DATA_LEN];
BOOL hasvar = FALSE;
size_t stl;
@@ -476,12 +476,12 @@ int GetWeatherData(MCONTACT hContact)
// go through each part of the operation string seperated by the & operator
do {
// the end of the string, last item
- chop = _tcsstr(str, L" & ");
+ chop = wcsstr(str, L" & ");
if (chop == NULL)
- chop = _tcschr(str, '\0');
+ chop = wcschr(str, '\0');
stl = min(sizeof(str2) - 1, (unsigned)(chop - str - 2));
- _tcsncpy(str2, str + 1, stl);
+ wcsncpy(str2, str + 1, stl);
str2[stl] = 0;
switch (str[0]) {
@@ -512,7 +512,7 @@ int GetWeatherData(MCONTACT hContact)
// for the "Break Data=" operation
DBVARIANT dbv;
if (!DBGetData(hContact, _T2A(Item->Item.Start), &dbv)) {
- _tcsncpy(DataValue, dbv.ptszVal, _countof(DataValue));
+ wcsncpy(DataValue, dbv.ptszVal, _countof(DataValue));
DataValue[_countof(DataValue) - 1] = 0;
db_free(&dbv);
}
@@ -522,7 +522,7 @@ int GetWeatherData(MCONTACT hContact)
}
// generate the strings
- TCHAR* end = _tcsstr(DataValue, Item->Item.Break);
+ wchar_t* end = wcsstr(DataValue, Item->Item.Break);
if (end == NULL) {
DataValue[0] = 0;
break; // exit if break string is not found
@@ -552,7 +552,7 @@ int GetWeatherData(MCONTACT hContact)
if (!mir_tstrcmp(Svc, opt.Default))
db_set_ts(NULL, DEFCURRENTWEATHER, _T2A(Item->Item.Name), DataValue);
if (!mir_tstrcmp(Item->Item.Name, L"Condition")) {
- TCHAR buf[128], *cbuf;
+ wchar_t buf[128], *cbuf;
mir_sntprintf(buf, L"#%s Weather", DataValue);
cbuf = TranslateTS(buf);
if (cbuf[0] == '#')
@@ -562,7 +562,7 @@ int GetWeatherData(MCONTACT hContact)
cond = GetIcon(DataValue, Data);
}
else if (mir_tstrcmpi(Item->Item.Unit, L"Cond") == 0) {
- TCHAR buf[128], *cbuf;
+ wchar_t buf[128], *cbuf;
mir_sntprintf(buf, L"#%s Weather", DataValue);
cbuf = TranslateTS(buf);
if (cbuf[0] == '#')
diff --git a/plugins/Weather/src/weather_userinfo.cpp b/plugins/Weather/src/weather_userinfo.cpp
index b1538f332e..b4adc2bf28 100644
--- a/plugins/Weather/src/weather_userinfo.cpp
+++ b/plugins/Weather/src/weather_userinfo.cpp
@@ -55,13 +55,13 @@ static int BriefDlgResizer(HWND, LPARAM, UTILRESIZECONTROL *urc)
static void LoadBriefInfoText(HWND hwndDlg, MCONTACT hContact)
{
WEATHERINFO winfo;
- TCHAR str[4096];
+ wchar_t str[4096];
// load weather information from the contact into the WEATHERINFO struct
winfo = LoadWeatherInfo(hContact);
// check if data exist. If not, display error message box
if (!(BOOL)db_get_b(hContact, WEATHERPROTONAME, "IsUpdated", FALSE))
- _tcsncpy(str, WEATHER_NO_INFO, _countof(str) - 1);
+ wcsncpy(str, WEATHER_NO_INFO, _countof(str) - 1);
else
// set the display text and show the message box
GetDisplay(&winfo, opt.bText, str);
@@ -210,7 +210,7 @@ static INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, L
case WM_LBUTTONUP:
TEXTRANGE tr;
tr.chrg = enlink->chrg;
- tr.lpstrText = (LPTSTR)mir_alloc(sizeof(TCHAR)*(tr.chrg.cpMax - tr.chrg.cpMin + 8));
+ tr.lpstrText = (LPTSTR)mir_alloc(sizeof(wchar_t)*(tr.chrg.cpMax - tr.chrg.cpMin + 8));
SendMessage(pNmhdr->hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
Utils_OpenUrlT(tr.lpstrText);
mir_free(tr.lpstrText);
@@ -239,7 +239,7 @@ static INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, L
static INT_PTR CALLBACK DlgProcUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
WEATHERINFO w;
- TCHAR str[MAX_TEXT_SIZE];
+ wchar_t str[MAX_TEXT_SIZE];
MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
@@ -316,7 +316,7 @@ int UserInfoInit(WPARAM wParam, LPARAM lParam)
OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = hInst;
odp.position = 100000000;
- odp.ptszTitle = _T(WEATHERPROTONAME);
+ odp.pwszTitle = _T(WEATHERPROTONAME);
if (lParam == 0) {
odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO);