diff options
Diffstat (limited to 'plugins/PluginUpdater')
-rw-r--r-- | plugins/PluginUpdater/src/DlgListNew.cpp | 20 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/DlgUpdate.cpp | 60 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Notifications.cpp | 2 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Options.cpp | 36 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/PluginUpdater.cpp | 2 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Services.cpp | 2 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Utils.cpp | 16 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/stdafx.h | 4 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/unzipfile.cpp | 6 |
9 files changed, 74 insertions, 74 deletions
diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp index 89ccf41904..7f28faab29 100644 --- a/plugins/PluginUpdater/src/DlgListNew.cpp +++ b/plugins/PluginUpdater/src/DlgListNew.cpp @@ -55,10 +55,10 @@ static void ApplyDownloads(void *param) //create needed folders after escalating priviledges. Folders creates when we actually install updates
wchar_t tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH];
- mir_sntprintf(tszFileBack, L"%s\\Backups", g_tszRoot);
+ mir_snwprintf(tszFileBack, L"%s\\Backups", g_tszRoot);
SafeCreateDirectory(tszFileBack);
- mir_sntprintf(tszFileTemp, L"%s\\Temp", g_tszRoot);
+ mir_snwprintf(tszFileTemp, L"%s\\Temp", g_tszRoot);
SafeCreateDirectory(tszFileTemp);
VARST tszMirandaPath(L"%miranda_path%");
@@ -116,7 +116,7 @@ static LRESULT CALLBACK PluginListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LP wchar_t *p = wcschr(tszFileName, L'.'); *p = 0;
wchar_t link[MAX_PATH];
- mir_sntprintf(link, PLUGIN_INFO_URL, tszFileName);
+ mir_snwprintf(link, PLUGIN_INFO_URL, tszFileName);
Utils_OpenUrlT(link);
}
}
@@ -362,8 +362,8 @@ static FILEINFO* ServerEntryToFileInfo(const ServListEntry &hash, const wchar_t* tp = wcschr(tszRelFileName, L'\\'); if (tp) tp++; else tp = tszRelFileName;
wcslwr(tp);
- mir_sntprintf(FileInfo->File.tszDiskPath, L"%s\\Temp\\%s.zip", g_tszRoot, tszFileName);
- mir_sntprintf(FileInfo->File.tszDownloadURL, L"%s/%s.zip", tszBaseUrl, tszRelFileName);
+ mir_snwprintf(FileInfo->File.tszDiskPath, L"%s\\Temp\\%s.zip", g_tszRoot, tszFileName);
+ mir_snwprintf(FileInfo->File.tszDownloadURL, L"%s/%s.zip", tszBaseUrl, tszRelFileName);
for (tp = wcschr(FileInfo->File.tszDownloadURL, '\\'); tp != 0; tp = wcschr(tp, '\\'))
*tp++ = '/';
FileInfo->File.CRCsum = hash.m_crc;
@@ -385,7 +385,7 @@ static void GetList(void *) if (tszTempPath[dwLen-1] == '\\')
tszTempPath[dwLen-1] = 0;
- ptrT updateUrl( GetDefaultUrl()), baseUrl;
+ ptrW updateUrl( GetDefaultUrl()), baseUrl;
SERVLIST hashes(50, CompareHashes);
if (!ParseHashes(updateUrl, baseUrl, hashes)) {
hListThread = NULL;
@@ -399,7 +399,7 @@ static void GetList(void *) ServListEntry &hash = hashes[i];
wchar_t tszPath[MAX_PATH];
- mir_sntprintf(tszPath, L"%s\\%s", dirname, hash.m_name);
+ mir_snwprintf(tszPath, L"%s\\%s", dirname, hash.m_name);
if (GetFileAttributes(tszPath) == INVALID_FILE_ATTRIBUTES) {
FILEINFO *FileInfo = ServerEntryToFileInfo(hash, baseUrl, tszPath);
@@ -462,14 +462,14 @@ static INT_PTR ParseUriService(WPARAM, LPARAM lParam) return 1;
wchar_t pluginPath[MAX_PATH];
- mir_tstrcpy(pluginPath, p + 1);
+ mir_wstrcpy(pluginPath, p + 1);
p = wcschr(pluginPath, '/');
if (p) *p = '\\';
if (GetFileAttributes(pluginPath) != INVALID_FILE_ATTRIBUTES)
return 0;
- ptrT updateUrl(GetDefaultUrl()), baseUrl;
+ ptrW updateUrl(GetDefaultUrl()), baseUrl;
SERVLIST hashes(50, CompareHashes);
if (!ParseHashes(updateUrl, baseUrl, hashes)) {
hListThread = NULL;
@@ -482,7 +482,7 @@ static INT_PTR ParseUriService(WPARAM, LPARAM lParam) VARST dirName(L"%miranda_path%");
wchar_t tszPath[MAX_PATH];
- mir_sntprintf(tszPath, L"%s\\%s", dirName, hash->m_name);
+ mir_snwprintf(tszPath, L"%s\\%s", dirName, hash->m_name);
FILEINFO *fileInfo = ServerEntryToFileInfo(*hash, baseUrl, tszPath);
FILELIST *fileList = new FILELIST(1);
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 27f8377952..9f02de304d 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -61,9 +61,9 @@ static void ApplyUpdates(void *param) HWND hwndList = GetDlgItem(hDlg, IDC_LIST_UPDATES);
//create needed folders after escalating priviledges. Folders creates when we actually install updates
wchar_t tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH];
- mir_sntprintf(tszFileBack, L"%s\\Backups", g_tszRoot);
+ mir_snwprintf(tszFileBack, L"%s\\Backups", g_tszRoot);
SafeCreateDirectory(tszFileBack);
- mir_sntprintf(tszFileTemp, L"%s\\Temp", g_tszRoot);
+ mir_snwprintf(tszFileTemp, L"%s\\Temp", g_tszRoot);
SafeCreateDirectory(tszFileTemp);
// 2) Download all plugins
@@ -103,7 +103,7 @@ static void ApplyUpdates(void *param) if (p.bDeleteOnly) {
// we need only to backup the old file
wchar_t *ptszRelPath = p.tszNewName + wcslen(tszMirandaPath) + 1, tszBackFile[MAX_PATH];
- mir_sntprintf(tszBackFile, L"%s\\%s", tszFileBack, ptszRelPath);
+ mir_snwprintf(tszBackFile, L"%s\\%s", tszFileBack, ptszRelPath);
BackupFile(p.tszNewName, tszBackFile);
}
else {
@@ -111,8 +111,8 @@ static void ApplyUpdates(void *param) // otherwise it would be replaced by unzip
if ( wcsicmp(p.tszOldName, p.tszNewName)) {
wchar_t tszSrcPath[MAX_PATH], tszBackFile[MAX_PATH];
- mir_sntprintf(tszSrcPath, L"%s\\%s", tszMirandaPath, p.tszOldName);
- mir_sntprintf(tszBackFile, L"%s\\%s", tszFileBack, p.tszOldName);
+ mir_snwprintf(tszSrcPath, L"%s\\%s", tszMirandaPath, p.tszOldName);
+ mir_snwprintf(tszBackFile, L"%s\\%s", tszFileBack, p.tszOldName);
BackupFile(tszSrcPath, tszBackFile);
}
@@ -125,7 +125,7 @@ static void ApplyUpdates(void *param) #if MIRANDA_VER < 0x0A00
// 4) Change title of clist
- ptrT title(db_get_tsa(NULL, "CList", "TitleText"));
+ ptrW title(db_get_tsa(NULL, "CList", "TitleText"));
if (!lstrcmpi(title, L"Miranda IM"))
db_set_ts(NULL, "CList", "TitleText", L"Miranda NG");
#endif
@@ -143,7 +143,7 @@ static void ApplyUpdates(void *param) db_unset(NULL, MODNAME, DB_SETTING_CHANGEPLATFORM);
}
else {
- ptrT oldbin(db_get_tsa(NULL, MODNAME, "OldBin2"));
+ ptrW oldbin(db_get_tsa(NULL, MODNAME, "OldBin2"));
if (oldbin) {
SafeDeleteFile(oldbin);
db_unset(NULL, MODNAME, "OldBin2");
@@ -165,9 +165,9 @@ static void ApplyUpdates(void *param) wchar_t mirstartpath[MAX_PATH];
#ifdef _WIN64
- mir_sntprintf(mirstartpath, L"%s\\miranda32.exe", tszMirandaPath);
+ mir_snwprintf(mirstartpath, L"%s\\miranda32.exe", tszMirandaPath);
#else
- mir_sntprintf(mirstartpath, L"%s\\miranda64.exe", tszMirandaPath);
+ mir_snwprintf(mirstartpath, L"%s\\miranda64.exe", tszMirandaPath);
#endif
CallServiceSync(MS_SYSTEM_RESTART, bRestartCurrentProfile, (LPARAM)mirstartpath);
}
@@ -412,10 +412,10 @@ static void DlgUpdateSilent(void *param) //create needed folders after escalating priviledges. Folders creates when we actually install updates
wchar_t tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH];
- mir_sntprintf(tszFileBack, L"%s\\Backups", g_tszRoot);
+ mir_snwprintf(tszFileBack, L"%s\\Backups", g_tszRoot);
SafeCreateDirectory(tszFileBack);
- mir_sntprintf(tszFileTemp, L"%s\\Temp", g_tszRoot);
+ mir_snwprintf(tszFileTemp, L"%s\\Temp", g_tszRoot);
SafeCreateDirectory(tszFileTemp);
// 2) Download all plugins
@@ -453,7 +453,7 @@ static void DlgUpdateSilent(void *param) if (p.bDeleteOnly) {
// we need only to backup the old file
wchar_t *ptszRelPath = p.tszNewName + wcslen(tszMirandaPath) + 1, tszBackFile[MAX_PATH];
- mir_sntprintf(tszBackFile, L"%s\\%s", tszFileBack, ptszRelPath);
+ mir_snwprintf(tszBackFile, L"%s\\%s", tszFileBack, ptszRelPath);
BackupFile(p.tszNewName, tszBackFile);
}
else {
@@ -461,8 +461,8 @@ static void DlgUpdateSilent(void *param) // otherwise it would be replaced by unzip
if (wcsicmp(p.tszOldName, p.tszNewName)) {
wchar_t tszSrcPath[MAX_PATH], tszBackFile[MAX_PATH];
- mir_sntprintf(tszSrcPath, L"%s\\%s", tszMirandaPath, p.tszOldName);
- mir_sntprintf(tszBackFile, L"%s\\%s", tszFileBack, p.tszOldName);
+ mir_snwprintf(tszSrcPath, L"%s\\%s", tszMirandaPath, p.tszOldName);
+ mir_snwprintf(tszBackFile, L"%s\\%s", tszFileBack, p.tszOldName);
BackupFile(tszSrcPath, tszBackFile);
}
@@ -477,7 +477,7 @@ static void DlgUpdateSilent(void *param) #if MIRANDA_VER < 0x0A00
// 4) Change title of clist
- ptrT title = db_get_tsa(NULL, "CList", "TitleText");
+ ptrW title = db_get_tsa(NULL, "CList", "TitleText");
if (!wcsicmp(title, L"Miranda IM"))
db_set_ts(NULL, "CList", "TitleText", L"Miranda NG");
#endif
@@ -493,7 +493,7 @@ static void DlgUpdateSilent(void *param) // 5) Prepare Restart
wchar_t tszTitle[100];
- mir_sntprintf(tszTitle, TranslateT("%d component(s) was updated"), count);
+ mir_snwprintf(tszTitle, TranslateT("%d component(s) was updated"), count);
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1)) {
ShowPopup(tszTitle,TranslateT("You need to restart your Miranda to apply installed updates."),POPUP_TYPE_MSG);
@@ -515,7 +515,7 @@ static void DlgUpdateSilent(void *param) if (!notified) {
// Error, let's try to show MessageBox as last way to inform user about successful update
wchar_t tszText[200];
- mir_sntprintf(tszText, L"%s\n\n%s", TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
+ mir_snwprintf(tszText, L"%s\n\n%s", TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
if (MessageBox(NULL, tszText, tszTitle, MB_ICONINFORMATION | MB_YESNO) == IDYES)
#if MIRANDA_VER >= 0x0A00
@@ -606,7 +606,7 @@ static renameTable[] = static bool CheckFileRename(const wchar_t *ptszOldName, wchar_t *pNewName)
{
for (int i = 0; i < _countof(renameTable); i++) {
- if (wildcmpit(ptszOldName, renameTable[i].oldName)) {
+ if (wildcmpiw(ptszOldName, renameTable[i].oldName)) {
wchar_t *ptszDest = renameTable[i].newName;
if (ptszDest == NULL)
*pNewName = 0;
@@ -642,7 +642,7 @@ static bool isValidDirectory(const wchar_t *ptszDirName) static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t *tszBaseUrl, SERVLIST& hashes, OBJLIST<FILEINFO> *UpdateFiles, int level = 0)
{
wchar_t tszBuf[MAX_PATH];
- mir_sntprintf(tszBuf, L"%s\\*", tszFolder);
+ mir_snwprintf(tszBuf, L"%s\\*", tszFolder);
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(tszBuf, &ffd);
@@ -656,7 +656,7 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
// Scan recursively all subfolders
if (isValidDirectory(ffd.cFileName)) {
- mir_sntprintf(tszBuf, L"%s\\%s", tszFolder, ffd.cFileName);
+ mir_snwprintf(tszBuf, L"%s\\%s", tszFolder, ffd.cFileName);
count += ScanFolder(tszBuf, cbBaseLen, tszBaseUrl, hashes, UpdateFiles, level + 1);
}
}
@@ -666,17 +666,17 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t if (CheckFileRename(ffd.cFileName, tszNewName)) {
Netlib_LogfT(hNetlibUser, L"File %s will be renamed to %s.", ffd.cFileName, tszNewName);
// Yes, we need the old file name, because this will be hashed later
- mir_sntprintf(tszBuf, L"%s\\%s", tszFolder, ffd.cFileName);
+ mir_snwprintf(tszBuf, L"%s\\%s", tszFolder, ffd.cFileName);
}
else {
if (level == 0) {
// Rename Miranda*.exe
- wcsncpy_s(tszNewName, opts.bChangePlatform && !mir_tstrcmpi(ffd.cFileName, OLD_FILENAME) ? NEW_FILENAME : ffd.cFileName, _TRUNCATE);
- mir_sntprintf(tszBuf, L"%s\\%s", tszFolder, tszNewName);
+ wcsncpy_s(tszNewName, opts.bChangePlatform && !mir_wstrcmpi(ffd.cFileName, OLD_FILENAME) ? NEW_FILENAME : ffd.cFileName, _TRUNCATE);
+ mir_snwprintf(tszBuf, L"%s\\%s", tszFolder, tszNewName);
}
else {
- mir_sntprintf(tszNewName, L"%s\\%s", tszFolder + cbBaseLen, ffd.cFileName);
- mir_sntprintf(tszBuf, L"%s\\%s", tszFolder, ffd.cFileName);
+ mir_snwprintf(tszNewName, L"%s\\%s", tszFolder + cbBaseLen, ffd.cFileName);
+ mir_snwprintf(tszBuf, L"%s\\%s", tszFolder, ffd.cFileName);
}
}
@@ -698,13 +698,13 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t // remove trailing w or W and try again
int iPos = int(p - tszNewName) - 1;
- strdelt(p - 1, 1);
+ strdelw(p - 1, 1);
if ((item = hashes.find((ServListEntry*)&pName)) == NULL) {
Netlib_LogfT(hNetlibUser, L"File %s: Not found on server, skipping", ffd.cFileName);
continue;
}
- strdelt(tszNewName + iPos, 1);
+ strdelw(tszNewName + iPos, 1);
}
#if MIRANDA_VER >= 0x0A00
@@ -761,8 +761,8 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t p = (p) ? p + 1 : tszBuf;
wcslwr(p);
- mir_sntprintf(FileInfo->File.tszDiskPath, L"%s\\Temp\\%s.zip", g_tszRoot, p);
- mir_sntprintf(FileInfo->File.tszDownloadURL, L"%s/%s.zip", tszBaseUrl, tszBuf);
+ mir_snwprintf(FileInfo->File.tszDiskPath, L"%s\\Temp\\%s.zip", g_tszRoot, p);
+ mir_snwprintf(FileInfo->File.tszDownloadURL, L"%s/%s.zip", tszBaseUrl, tszBuf);
for (p = wcschr(FileInfo->File.tszDownloadURL, '\\'); p != 0; p = wcschr(p, '\\'))
*p++ = '/';
@@ -797,7 +797,7 @@ static void CheckUpdates(void *) if (!opts.bSilent)
ShowPopup(TranslateT("Plugin Updater"), TranslateT("Checking for new updates..."), POPUP_TYPE_INFO);
- ptrT updateUrl(GetDefaultUrl()), baseUrl;
+ ptrW updateUrl(GetDefaultUrl()), baseUrl;
SERVLIST hashes(50, CompareHashes);
bool success = ParseHashes(updateUrl, baseUrl, hashes);
if (success) {
diff --git a/plugins/PluginUpdater/src/Notifications.cpp b/plugins/PluginUpdater/src/Notifications.cpp index 5741de81bd..819cf521e3 100644 --- a/plugins/PluginUpdater/src/Notifications.cpp +++ b/plugins/PluginUpdater/src/Notifications.cpp @@ -71,7 +71,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hPopup, UINT uMsg, WPARAM wParam, LPAR static void _stdcall RestartPrompt(void *)
{
wchar_t tszText[200];
- mir_sntprintf(tszText, L"%s\n\n%s", TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
+ mir_snwprintf(tszText, L"%s\n\n%s", TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
if (MessageBox(0, tszText, TranslateT("Plugin Updater"), MB_YESNO | MB_ICONQUESTION | MB_TOPMOST) == IDYES)
CallService(MS_SYSTEM_RESTART, db_get_b(NULL, MODNAME, "RestartCurrentProfile", 1) ? 1 : 0, 0);
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp index 5d54e559fe..38dd4d5802 100644 --- a/plugins/PluginUpdater/src/Options.cpp +++ b/plugins/PluginUpdater/src/Options.cpp @@ -33,7 +33,7 @@ static int GetUpdateMode() // Check if there is url for custom mode
if (UpdateMode == UPDATE_MODE_CUSTOM) {
- ptrT url(db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL));
+ ptrW url(db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL));
if (url == NULL || !wcslen(url)) {
// No url for custom mode, reset that setting so it will be determined automatically
db_unset(NULL, MODNAME, DB_SETTING_UPDATE_MODE);
@@ -56,14 +56,14 @@ wchar_t* GetDefaultUrl() wchar_t url[MAX_PATH];
switch (GetUpdateMode()) {
case UPDATE_MODE_STABLE:
- mir_sntprintf(url, DEFAULT_UPDATE_URL, opts.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
- return mir_tstrdup(url);
+ mir_snwprintf(url, DEFAULT_UPDATE_URL, opts.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
+ return mir_wstrdup(url);
case UPDATE_MODE_TRUNK:
- mir_sntprintf(url, DEFAULT_UPDATE_URL_TRUNK, opts.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
- return mir_tstrdup(url);
+ mir_snwprintf(url, DEFAULT_UPDATE_URL_TRUNK, opts.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
+ return mir_wstrdup(url);
case UPDATE_MODE_TRUNK_SYMBOLS:
- mir_sntprintf(url, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS, opts.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
- return mir_tstrdup(url);
+ mir_snwprintf(url, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS, opts.bChangePlatform ? DEFAULT_OPP_BITS : DEFAULT_BITS);
+ return mir_wstrdup(url);
default:
return db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL);
}
@@ -121,17 +121,17 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar switch (GetUpdateMode()) {
case UPDATE_MODE_STABLE:
- mir_sntprintf(defurl, DEFAULT_UPDATE_URL, GetBits(hwndDlg));
+ mir_snwprintf(defurl, DEFAULT_UPDATE_URL, GetBits(hwndDlg));
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
CheckDlgButton(hwndDlg, IDC_STABLE, BST_CHECKED);
break;
case UPDATE_MODE_TRUNK:
- mir_sntprintf(defurl, DEFAULT_UPDATE_URL_TRUNK, GetBits(hwndDlg));
+ mir_snwprintf(defurl, DEFAULT_UPDATE_URL_TRUNK, GetBits(hwndDlg));
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
CheckDlgButton(hwndDlg, IDC_TRUNK, BST_CHECKED);
break;
case UPDATE_MODE_TRUNK_SYMBOLS:
- mir_sntprintf(defurl, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS, GetBits(hwndDlg));
+ mir_snwprintf(defurl, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS, GetBits(hwndDlg));
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
CheckDlgButton(hwndDlg, IDC_TRUNK_SYMBOLS, BST_CHECKED);
break;
@@ -140,7 +140,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE_PLATFORM), FALSE);
- ptrT url(db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL));
+ ptrW url(db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL));
if (url == NULL)
url = GetDefaultUrl();
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, url);
@@ -181,7 +181,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar case IDC_TRUNK_SYMBOLS:
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE_PLATFORM), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
- mir_sntprintf(defurl, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS, GetBits(hwndDlg));
+ mir_snwprintf(defurl, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS, GetBits(hwndDlg));
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -189,7 +189,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar case IDC_TRUNK:
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE_PLATFORM), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
- mir_sntprintf(defurl, DEFAULT_UPDATE_URL_TRUNK, GetBits(hwndDlg));
+ mir_snwprintf(defurl, DEFAULT_UPDATE_URL_TRUNK, GetBits(hwndDlg));
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -197,7 +197,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar case IDC_STABLE:
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE_PLATFORM), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
- mir_sntprintf(defurl, DEFAULT_UPDATE_URL, GetBits(hwndDlg));
+ mir_snwprintf(defurl, DEFAULT_UPDATE_URL, GetBits(hwndDlg));
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
@@ -206,7 +206,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE_PLATFORM), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), TRUE);
{
- ptrT url(db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL));
+ ptrW url(db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL));
if (url == NULL)
url = GetDefaultUrl();
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, url);
@@ -227,15 +227,15 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar case IDC_CHANGE_PLATFORM:
if (IsDlgButtonChecked(hwndDlg, IDC_STABLE)) {
- mir_sntprintf(defurl, DEFAULT_UPDATE_URL, GetBits(hwndDlg));
+ mir_snwprintf(defurl, DEFAULT_UPDATE_URL, GetBits(hwndDlg));
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
}
else if (IsDlgButtonChecked(hwndDlg, IDC_TRUNK)) {
- mir_sntprintf(defurl, DEFAULT_UPDATE_URL_TRUNK, GetBits(hwndDlg));
+ mir_snwprintf(defurl, DEFAULT_UPDATE_URL_TRUNK, GetBits(hwndDlg));
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
}
else if (IsDlgButtonChecked(hwndDlg, IDC_TRUNK_SYMBOLS)) {
- mir_sntprintf(defurl, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS, GetBits(hwndDlg));
+ mir_snwprintf(defurl, DEFAULT_UPDATE_URL_TRUNK_SYMBOLS, GetBits(hwndDlg));
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, defurl);
}
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp index d5b1b23564..3a2a2fdb1d 100644 --- a/plugins/PluginUpdater/src/PluginUpdater.cpp +++ b/plugins/PluginUpdater/src/PluginUpdater.cpp @@ -132,7 +132,7 @@ extern "C" __declspec(dllexport) int Load(void) #if MIRANDA_VER >= 0x0A00
// Upgrade old settings
if (-1 == db_get_b(0, MODNAME, DB_SETTING_UPDATE_MODE, -1)) {
- ptrT dbvUpdateURL(db_get_tsa(0, MODNAME, DB_SETTING_UPDATE_URL));
+ ptrW dbvUpdateURL(db_get_tsa(0, MODNAME, DB_SETTING_UPDATE_URL));
if (dbvUpdateURL) {
if (!wcscmp(dbvUpdateURL, _A2W(DEFAULT_UPDATE_URL_OLD))) {
db_set_b(0, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
diff --git a/plugins/PluginUpdater/src/Services.cpp b/plugins/PluginUpdater/src/Services.cpp index bd12b68f17..698fac6021 100644 --- a/plugins/PluginUpdater/src/Services.cpp +++ b/plugins/PluginUpdater/src/Services.cpp @@ -27,7 +27,7 @@ static INT_PTR srvParseHashes(WPARAM wParam, LPARAM lParam) return NULL;
SERVLIST *pList = new SERVLIST(50, CompareHashes);
- ptrT baseUrl;
+ ptrW baseUrl;
if ( ParseHashes(ptszUrl, baseUrl, *pList)) {
wcsncpy(ptszBaseUrl, baseUrl, MAX_PATH);
return (INT_PTR)pList;
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index 00009c75d1..26b395a1c4 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -128,7 +128,7 @@ int CompareHashes(const ServListEntry *p1, const ServListEntry *p2) return wcsicmp(p1->m_name, p2->m_name);
}
-bool ParseHashes(const wchar_t *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes)
+bool ParseHashes(const wchar_t *ptszUrl, ptrW &baseUrl, SERVLIST &arHashes)
{
REPLACEVARSARRAY vars[2];
#if MIRANDA_VER >=0x0A00
@@ -152,8 +152,8 @@ bool ParseHashes(const wchar_t *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes) // Download version info
FILEURL pFileUrl;
- mir_sntprintf(pFileUrl.tszDownloadURL, L"%s/hashes.zip", baseUrl);
- mir_sntprintf(pFileUrl.tszDiskPath, L"%s\\hashes.zip", g_tszTempPath);
+ mir_snwprintf(pFileUrl.tszDownloadURL, L"%s/hashes.zip", baseUrl);
+ mir_snwprintf(pFileUrl.tszDiskPath, L"%s\\hashes.zip", g_tszTempPath);
pFileUrl.CRCsum = 0;
HANDLE nlc;
@@ -177,7 +177,7 @@ bool ParseHashes(const wchar_t *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes) DeleteFile(pFileUrl.tszDiskPath);
wchar_t tszTmpIni[MAX_PATH] = {0};
- mir_sntprintf(tszTmpIni, L"%s\\hashes.txt", g_tszTempPath);
+ mir_snwprintf(tszTmpIni, L"%s\\hashes.txt", g_tszTempPath);
FILE *fp = _wfopen(tszTmpIni, L"r");
if (!fp) {
Netlib_LogfT(hNetlibUser,L"Opening %s failed", g_tszTempPath);
@@ -243,7 +243,7 @@ bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc) #endif
nlhr.requestType = REQUEST_GET;
nlhr.nlc = nlc;
- char *szUrl = mir_t2a(pFileURL->tszDownloadURL);
+ char *szUrl = mir_u2a(pFileURL->tszDownloadURL);
nlhr.szUrl = szUrl;
nlhr.headersCount = 4;
nlhr.headers=(NETLIBHTTPHEADER*)mir_alloc(sizeof(NETLIBHTTPHEADER)*nlhr.headersCount);
@@ -285,7 +285,7 @@ bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc) else {
// try to write it via PU stub
wchar_t tszTempFile[MAX_PATH];
- mir_sntprintf(tszTempFile, L"%s\\pulocal.tmp", g_tszTempPath);
+ mir_snwprintf(tszTempFile, L"%s\\pulocal.tmp", g_tszTempPath);
hFile = CreateFile(tszTempFile, GENERIC_READ | GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE) {
DWORD dwBytes;
@@ -502,7 +502,7 @@ bool PrepareEscalation() else {
// Elevate the process. Create a pipe for a stub first
wchar_t tszPipeName[MAX_PATH];
- mir_sntprintf(tszPipeName, L"\\\\.\\pipe\\Miranda_Pu_%d", GetCurrentProcessId());
+ mir_snwprintf(tszPipeName, L"\\\\.\\pipe\\Miranda_Pu_%d", GetCurrentProcessId());
hPipe = CreateNamedPipe(tszPipeName, PIPE_ACCESS_DUPLEX, PIPE_READMODE_BYTE | PIPE_WAIT, 1, 1024, 1024, NMPWAIT_USE_DEFAULT_WAIT, NULL);
if (hPipe == INVALID_HANDLE_VALUE) {
hPipe = NULL;
@@ -512,7 +512,7 @@ bool PrepareEscalation() GetModuleFileName(NULL, szPath, ARRAYSIZE(szPath));
if ((p = wcsrchr(szPath, '\\')) != 0)
wcscpy(p+1, L"pu_stub.exe");
- mir_sntprintf(cmdLine, L"%d", GetCurrentProcessId());
+ mir_snwprintf(cmdLine, L"%d", GetCurrentProcessId());
// Launch a stub
SHELLEXECUTEINFO sei = { sizeof(sei) };
diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h index 2fa09762b7..096ef9e247 100644 --- a/plugins/PluginUpdater/src/stdafx.h +++ b/plugins/PluginUpdater/src/stdafx.h @@ -188,7 +188,7 @@ public: struct ServListEntry
{
ServListEntry(const char* _name, const char* _hash, int _crc) :
- m_name( mir_a2t(_name)),
+ m_name( mir_a2u(_name)),
m_crc(_crc)
{
strncpy(m_szHash, _hash, sizeof(m_szHash));
@@ -225,7 +225,7 @@ void UnloadNetlib(); void BackupFile(wchar_t *ptszSrcFileName, wchar_t *ptszBackFileName);
-bool ParseHashes(const wchar_t *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes);
+bool ParseHashes(const wchar_t *ptszUrl, ptrW &baseUrl, SERVLIST &arHashes);
int CompareHashes(const ServListEntry *p1, const ServListEntry *p2);
wchar_t* GetDefaultUrl();
diff --git a/plugins/PluginUpdater/src/unzipfile.cpp b/plugins/PluginUpdater/src/unzipfile.cpp index 979dcd289e..7698e056a0 100644 --- a/plugins/PluginUpdater/src/unzipfile.cpp +++ b/plugins/PluginUpdater/src/unzipfile.cpp @@ -32,7 +32,7 @@ extern "C" static void PrepareFileName(wchar_t *dest, size_t destSize, const wchar_t *ptszPath, const wchar_t *ptszFileName)
{
- mir_sntprintf(dest, destSize, L"%s\\%s", ptszPath, ptszFileName);
+ mir_snwprintf(dest, destSize, L"%s\\%s", ptszPath, ptszFileName);
for (wchar_t *p = dest; *p; ++p)
if (*p == '/')
@@ -57,9 +57,9 @@ bool extractCurrentFile(unzFile uf, wchar_t *ptszDestPath, wchar_t *ptszBackPath return true;
wchar_t tszDestFile[MAX_PATH], tszBackFile[MAX_PATH];
- wchar_t *ptszNewName = mir_utf8decodeT(filename);
+ wchar_t *ptszNewName = mir_utf8decodeW(filename);
if (ptszNewName == NULL)
- ptszNewName = mir_a2t(filename);
+ ptszNewName = mir_a2u(filename);
if (!(file_info.external_fa & FILE_ATTRIBUTE_DIRECTORY)) {
err = unzOpenCurrentFile(uf);
|