diff options
author | George Hazan <ghazan@miranda.im> | 2019-06-03 14:02:02 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-06-03 14:02:02 +0300 |
commit | c1881274c8c431014368f4f5b9b49397e6c579f0 (patch) | |
tree | 35534e17812aab00ec9e63b801ccb99a4ee221e9 | |
parent | 240b4b12c1ec026be8a62b7ecd1f4702736b0e1b (diff) |
Folders: old TCHAR helpers removed
44 files changed, 146 insertions, 245 deletions
diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp index 0b75bd4473..805cba9aff 100644 --- a/plugins/AVS/src/main.cpp +++ b/plugins/AVS/src/main.cpp @@ -323,8 +323,8 @@ static int ModulesLoaded(WPARAM, LPARAM) SetThreadPriority(mir_forkthread(PicLoader), THREAD_PRIORITY_IDLE);
// Folders plugin support
- hMyAvatarsFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("My Avatars"), MIRANDA_USERDATAT L"\\Avatars");
- hGlobalAvatarFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("My Global Avatar Cache"), MIRANDA_USERDATAT L"\\Avatars");
+ hMyAvatarsFolder = FoldersRegisterCustomPathW(LPGEN("Avatars"), LPGEN("My Avatars"), MIRANDA_USERDATAW L"\\Avatars");
+ hGlobalAvatarFolder = FoldersRegisterCustomPathW(LPGEN("Avatars"), LPGEN("My Global Avatar Cache"), MIRANDA_USERDATAW L"\\Avatars");
g_AvatarHistoryAvail = ServiceExists(MS_AVATARHISTORY_ENABLED);
diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp index 729314083c..6498536305 100644 --- a/plugins/AVS/src/services.cpp +++ b/plugins/AVS/src/services.cpp @@ -526,7 +526,7 @@ static int InternalSetMyAvatar(char *protocol, wchar_t *szFinalName, SetMyAvatar // Copy avatar file to store as global one
wchar_t globalFile[1024];
BOOL saved = TRUE;
- if (FoldersGetCustomPathT(hGlobalAvatarFolder, globalFile, _countof(globalFile), L"")) {
+ if (FoldersGetCustomPathW(hGlobalAvatarFolder, globalFile, _countof(globalFile), L"")) {
mir_snwprintf(globalFile, L"%s%s", g_szDataPath, L"GlobalAvatar");
CreateDirectory(globalFile, nullptr);
}
@@ -632,7 +632,7 @@ INT_PTR SetMyAvatar(WPARAM wParam, LPARAM lParam) FilterGetStrings(filter, allAcceptXML, allAcceptSWF);
wchar_t inipath[1024];
- FoldersGetCustomPathT(hMyAvatarsFolder, inipath, _countof(inipath), L".");
+ FoldersGetCustomPathW(hMyAvatarsFolder, inipath, _countof(inipath), L".");
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp index 9d5e39be70..b040b3d37c 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.cpp +++ b/plugins/AvatarHistory/src/AvatarHistory.cpp @@ -227,8 +227,8 @@ static int ModulesLoaded(WPARAM, LPARAM) {
mir_snwprintf(basedir, L"%s\\Avatars History", profilePath);
- hFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("Avatar History"),
- PROFILE_PATHT L"\\" CURRENT_PROFILET L"\\Avatars History");
+ hFolder = FoldersRegisterCustomPathW(LPGEN("Avatars"), LPGEN("Avatar History"),
+ PROFILE_PATHW L"\\" CURRENT_PROFILEW L"\\Avatars History");
InitPopups();
diff --git a/plugins/AvatarHistory/src/utils.cpp b/plugins/AvatarHistory/src/utils.cpp index 9c86cfbc72..3dc10fa840 100644 --- a/plugins/AvatarHistory/src/utils.cpp +++ b/plugins/AvatarHistory/src/utils.cpp @@ -87,7 +87,7 @@ wchar_t* GetExtension(wchar_t *file) wchar_t* GetHistoryFolder(wchar_t *fn)
{
if (fn == nullptr) return nullptr;
- FoldersGetCustomPathT(hFolder, fn, MAX_PATH, basedir);
+ FoldersGetCustomPathW(hFolder, fn, MAX_PATH, basedir);
CreateDirectoryTreeW(fn);
return fn;
}
diff --git a/plugins/BASS_interface/src/Main.cpp b/plugins/BASS_interface/src/Main.cpp index 44b9082d58..0435ef045c 100644 --- a/plugins/BASS_interface/src/Main.cpp +++ b/plugins/BASS_interface/src/Main.cpp @@ -511,7 +511,7 @@ void LoadBassLibrary(const wchar_t *ptszPath) int OnFoldersChanged(WPARAM, LPARAM)
{
- FoldersGetCustomPathT(hBASSFolder, CurrBassPath, MAX_PATH, L"");
+ FoldersGetCustomPathW(hBASSFolder, CurrBassPath, MAX_PATH, L"");
mir_wstrcat(CurrBassPath, L"\\bass.dll");
if (hBass != nullptr) {
@@ -528,8 +528,8 @@ int OnFoldersChanged(WPARAM, LPARAM) int OnModulesLoaded(WPARAM, LPARAM)
{
- if (hBASSFolder = FoldersRegisterCustomPathT(LPGEN("Bass Interface"), LPGEN("Bass library"), PLUGINS_PATHT L"\\BASS")) {
- FoldersGetCustomPathT(hBASSFolder, CurrBassPath, MAX_PATH, L"");
+ if (hBASSFolder = FoldersRegisterCustomPathW(LPGEN("Bass Interface"), LPGEN("Bass library"), PLUGINS_PATHW L"\\BASS")) {
+ FoldersGetCustomPathW(hBASSFolder, CurrBassPath, MAX_PATH, L"");
mir_wstrcat(CurrBassPath, L"\\bass.dll");
}
else {
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 1c23c44009..ad2fe35a51 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -46,7 +46,7 @@ void LoadFavoriteContactMenu(); int ReloadSkinFolder(WPARAM, LPARAM)
{
- FoldersGetCustomPathT(hSkinFolder, SkinsFolder, _countof(SkinsFolder), _A2W(DEFAULT_SKIN_FOLDER));
+ FoldersGetCustomPathW(hSkinFolder, SkinsFolder, _countof(SkinsFolder), _A2W(DEFAULT_SKIN_FOLDER));
return 0;
}
@@ -1559,8 +1559,8 @@ static int clcHookModulesLoaded(WPARAM, LPARAM) HookEvent(ME_AV_AVATARCHANGED, clcHookAvatarChanged);
HookEvent(ME_FOLDERS_PATH_CHANGED, ReloadSkinFolder);
- hSkinFolder = FoldersRegisterCustomPathT(LPGEN("Skins"), LPGEN("Modern contact list"), MIRANDA_PATHT L"\\" _A2W(DEFAULT_SKIN_FOLDER));
- FoldersGetCustomPathT(hSkinFolder, SkinsFolder, _countof(SkinsFolder), _A2W(DEFAULT_SKIN_FOLDER));
+ hSkinFolder = FoldersRegisterCustomPathW(LPGEN("Skins"), LPGEN("Modern contact list"), MIRANDA_PATHW L"\\" _A2W(DEFAULT_SKIN_FOLDER));
+ FoldersGetCustomPathW(hSkinFolder, SkinsFolder, _countof(SkinsFolder), _A2W(DEFAULT_SKIN_FOLDER));
// Get icons
wchar_t szMyPath[MAX_PATH];
diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index 24eb33fd0b..ebad56ebaf 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -167,15 +167,7 @@ INT_PTR ServiceModeLaunch(WPARAM, LPARAM) static int FoldersPathChanged(WPARAM, LPARAM)
{
- FOLDERSGETDATA fgd = {};
- fgd.cbSize = sizeof(FOLDERSGETDATA);
- fgd.nMaxPathSize = MAX_PATH;
- fgd.flags = FF_TCHAR;
- // fgd.szPathT = CrashLogFolder;
- // CallService(MS_FOLDERS_GET_PATH, (WPARAM)hCrashLogFolder, (LPARAM)&fgd);
-
- fgd.szPathT = VersionInfoFolder;
- CallService(MS_FOLDERS_GET_PATH, (WPARAM)hVerInfoFolder, (LPARAM)&fgd);
+ FoldersGetCustomPathW(hVerInfoFolder, VersionInfoFolder, MAX_PATH, L"");
return 0;
}
@@ -216,8 +208,8 @@ static int ModulesLoaded(WPARAM, LPARAM) replaceStrW(profpath, L"%miranda_userdata%");
// Removed because it isn't available on Load()
- // hCrashLogFolder = FoldersRegisterCustomPathT(MODULENAME, LPGEN("Crash Reports"), CrashLogFolder);
- hVerInfoFolder = FoldersRegisterCustomPathT(MODULENAME, LPGEN("Version Information"), VersionInfoFolder);
+ // hCrashLogFolder = FoldersRegisterCustomPathW(MODULENAME, LPGEN("Crash Reports"), CrashLogFolder);
+ hVerInfoFolder = FoldersRegisterCustomPathW(MODULENAME, LPGEN("Version Information"), VersionInfoFolder);
HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersPathChanged);
FoldersPathChanged(0, 0);
diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp index 6ab236f755..6291f9d0c1 100644 --- a/plugins/Db_autobackups/src/main.cpp +++ b/plugins/Db_autobackups/src/main.cpp @@ -81,7 +81,7 @@ static INT_PTR DBSaveAs(WPARAM, LPARAM) static int FoldersGetBackupPath(WPARAM, LPARAM)
{
- FoldersGetCustomPathT(hFolder, g_plugin.folder, _countof(g_plugin.folder), DIR SUB_DIR);
+ FoldersGetCustomPathW(hFolder, g_plugin.folder, _countof(g_plugin.folder), DIR SUB_DIR);
return 0;
}
@@ -121,7 +121,7 @@ static int ModulesLoad(WPARAM, LPARAM) UpdateMenuIcons();
CreateServiceFunction(mi.pszService, &OnTogglePopups);
- if (hFolder = FoldersRegisterCustomPathT(LPGEN("Database backups"), LPGEN("Backup folder"), DIR SUB_DIR)) {
+ if (hFolder = FoldersRegisterCustomPathW(LPGEN("Database backups"), LPGEN("Backup folder"), DIR SUB_DIR)) {
HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersGetBackupPath);
FoldersGetBackupPath(0, 0);
}
diff --git a/plugins/ExternalAPI/m_folders.h b/plugins/ExternalAPI/m_folders.h index c6b26f0d26..1f49cec9c8 100644 --- a/plugins/ExternalAPI/m_folders.h +++ b/plugins/ExternalAPI/m_folders.h @@ -35,66 +35,38 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define PLUGINS_PATHW L"%miranda_path%" L"\\plugins"
#define MIRANDA_USERDATAW L"%miranda_userdata%"
-#ifdef _UNICODE
-#define PROFILE_PATHT PROFILE_PATHW
-#define CURRENT_PROFILET CURRENT_PROFILEW
-#define MIRANDA_PATHT MIRANDA_PATHW
-#define PLUGINS_PATHT PLUGINS_PATHW
-#define MIRANDA_USERDATAT MIRANDA_USERDATAW
-#else
-#define PROFILE_PATHT PROFILE_PATH
-#define CURRENT_PROFILET CURRENT_PROFILE
-#define MIRANDA_PATHT MIRANDA_PATH
-#define PLUGINS_PATHT PLUGINS_PATH
-#define MIRANDA_USERDATAT MIRANDA_USERDATA
-#endif
-
-#define FOLDER_AVATARS PROFILE_PATHT L"\\" CURRENT_PROFILET L"\\avatars"
-#define FOLDER_VCARDS PROFILE_PATHT L"\\" CURRENT_PROFILET L"\\vcards"
-#define FOLDER_LOGS PROFILE_PATHT L"\\" CURRENT_PROFILET L"\\logs"
-#define FOLDER_RECEIVED_FILES PROFILE_PATHT L"\\" CURRENT_PROFILET L"\\received files"
-#define FOLDER_DOCS MIRANDA_PATHT L"\\" L"docs"
-#define FOLDER_CONFIG PLUGINS_PATHT L"\\" L"config"
-#define FOLDER_SCRIPTS MIRANDA_PATHT L"\\" L"scripts"
-#define FOLDER_UPDATES MIRANDA_PATHT L"\\" L"updates"
-
-#define FOLDER_CUSTOMIZE MIRANDA_PATHT L"\\" L"customize"
+#define FOLDER_AVATARS PROFILE_PATHW L"\\" CURRENT_PROFILEW L"\\avatars"
+#define FOLDER_VCARDS PROFILE_PATHW L"\\" CURRENT_PROFILEW L"\\vcards"
+#define FOLDER_LOGS PROFILE_PATHW L"\\" CURRENT_PROFILEW L"\\logs"
+#define FOLDER_RECEIVED_FILES PROFILE_PATHW L"\\" CURRENT_PROFILEW L"\\received files"
+#define FOLDER_DOCS MIRANDA_PATHW L"\\" L"docs"
+#define FOLDER_CONFIG PLUGINS_PATHW L"\\" L"config"
+#define FOLDER_SCRIPTS MIRANDA_PATHW L"\\" L"scripts"
+#define FOLDER_UPDATES MIRANDA_PATHW L"\\" L"updates"
+
+#define FOLDER_CUSTOMIZE MIRANDA_PATHW L"\\" L"customize"
#define FOLDER_CUSTOMIZE_SOUNDS FOLDER_CUSTOMIZE L"\\sounds"
#define FOLDER_CUSTOMIZE_ICONS FOLDER_CUSTOMIZE L"\\icons"
#define FOLDER_CUSTOMIZE_SMILEYS FOLDER_CUSTOMIZE L"\\smileys"
#define FOLDER_CUSTOMIZE_SKINS FOLDER_CUSTOMIZE L"\\skins"
#define FOLDER_CUSTOMIZE_THEMES FOLDER_CUSTOMIZE L"\\themes"
-#define TO_WIDE(x) L ## x
-
-#define FOLDERS_NAME_MAX_SIZE 64 //maximum name and section size
+#define FOLDERS_NAME_MAX_SIZE 64 // maximum name and section size
#define FF_UNICODE 0x00000001
-#if defined (UNICODE)
-#define FF_TCHAR FF_UNICODE
-#else
-#define FF_TCHAR 0
-#endif
-
-typedef struct
+struct FOLDERSDATA
{
- int cbSize; //size of struct
- LPCSTR szSection; //section name, if it doesn't exist it will be created otherwise it will just add this entry to it
- LPCSTR szName; //entry name - will be shown in options
- union {
- const char *szFormat; //default string format. Fallback string in case there's no entry in the database for this folder. This should be the initial value for the path, users will be able to change it later.
- const wchar_t *szFormatW; //String is dup()'d so you can free it later. If you set the unicode string don't forget to set the flag accordingly.
- const TCHAR *szFormatT;
- };
- DWORD flags; //FF_* flags
- union {
- const char *szUserName; //for display purposes. if NULL, plugins gets it as the translated szName
- const wchar_t *szUserNameW; //String is dup()'d so you can free it later. If you set the unicode string don't forget to set the flag accordingly.
- const TCHAR *szUserNameT;
- };
-}
-FOLDERSDATA;
+ int cbSize; // size of struct
+ DWORD flags; // FF_* flags
+ LPCSTR szSection; // section name, if it doesn't exist it will be created otherwise it will just add this entry to it
+ LPCSTR szName; // entry name - will be shown in options
+ MAllCStrings szFormat; // default string format. Fallback string in case there's no entry in the database for this folder.
+ // This should be the initial value for the path, users will be able to change it later.
+ // String is dup()'d so you can free it later. If you set the unicode string don't forget to set the flag accordingly.
+ MAllCStrings szUserName; // for display purposes. if NULL, plugins gets it as the translated szName
+ // String is dup()'d so you can free it later. If you set the unicode string don't forget to set the flag accordingly.
+};
/*Folders/Register/Path service
wParam - not used, must be 0
@@ -105,25 +77,22 @@ FOLDERSDATA; */
#define MS_FOLDERS_REGISTER_PATH "Folders/Register/Path"
-/*Folders/Get/PathSize service
- wParam - (WPARAM) (int) - handle to registered path
- lParam - (LPARAM) (int *) - pointer to the variable that receives the size of the path
- string (not including the null character). Depending on the flags set when creating the path
- it will either call mir_strlen() or mir_wstrlen() to get the length of the string.
- Returns the size of the buffer.
- */
+ /*Folders/Get/PathSize service
+ wParam - (WPARAM) (int) - handle to registered path
+ lParam - (LPARAM) (int *) - pointer to the variable that receives the size of the path
+ string (not including the null character). Depending on the flags set when creating the path
+ it will either call mir_strlen() or mir_wstrlen() to get the length of the string.
+ Returns the size of the buffer.
+ */
#define MS_FOLDERS_GET_SIZE "Folders/Get/PathSize"
-typedef struct{
+struct FOLDERSGETDATA
+{
int cbSize;
- int nMaxPathSize; //maximum size of buffer. This represents the number of characters that can be copied to it (so for unicode strings you don't send the number of bytes but the length of the string).
- union{
- char *szPath; //pointer to the buffer that receives the path without the last "\\"
- wchar_t *szPathW; //unicode version of the buffer.
- TCHAR *szPathT;
- };
- DWORD flags; //FF_* flags
-} FOLDERSGETDATA;
+ int nMaxPathSize; // maximum size of buffer. This represents the number of characters that can be copied to it (so for unicode strings you don't send the number of bytes but the length of the string).
+ MAllStrings szPath; // pointer to the buffer that receives the path without the last "\\"
+ DWORD flags; // FF_* flags
+};
/*Folders/Get/Path service
wParam - (WPARAM) (int) - handle to registered path
@@ -132,11 +101,11 @@ typedef struct{ */
#define MS_FOLDERS_GET_PATH "Folders/Get/Path"
-/*Folders/On/Path/Changed
- wParam - (WPARAM) 0
- lParam - (LPARAM) 0
- Triggered when the folders change, you should reget the paths you registered.
- */
+ /*Folders/On/Path/Changed
+ wParam - (WPARAM) 0
+ lParam - (LPARAM) 0
+ Triggered when the folders change, you should reget the paths you registered.
+ */
#define ME_FOLDERS_PATH_CHANGED "Folders/On/Path/Changed"
__inline static HANDLE FoldersRegisterCustomPath(const char *section, const char *name, const char *defaultPath)
@@ -147,7 +116,7 @@ __inline static HANDLE FoldersRegisterCustomPath(const char *section, const char FOLDERSDATA fd = { sizeof(fd) };
fd.szSection = section;
fd.szName = name;
- fd.szFormat = defaultPath;
+ fd.szFormat.a = defaultPath;
return (HANDLE)CallService(MS_FOLDERS_REGISTER_PATH, 0, (LPARAM)&fd);
}
@@ -160,8 +129,8 @@ __inline static HANDLE FoldersRegisterCustomPathW(const char *section, const cha FOLDERSDATA fd = { sizeof(fd) };
fd.szSection = section;
fd.szName = name;
- fd.szFormatW = defaultPathW;
- fd.szUserNameW = userNameW;
+ fd.szFormat.w = defaultPathW;
+ fd.szUserName.w = userNameW;
fd.flags = FF_UNICODE;
return (HANDLE)CallService(MS_FOLDERS_REGISTER_PATH, 0, (LPARAM)&fd);
}
@@ -171,7 +140,7 @@ __inline static INT_PTR FoldersGetCustomPath(HANDLE hFolderEntry, char *path, co {
FOLDERSGETDATA fgd = { sizeof(fgd) };
fgd.nMaxPathSize = size;
- fgd.szPath = path;
+ fgd.szPath.a = path;
INT_PTR res = CallService(MS_FOLDERS_GET_PATH, (WPARAM)hFolderEntry, (LPARAM)&fgd);
if (res) {
char buffer[MAX_PATH];
@@ -187,7 +156,7 @@ __inline static INT_PTR FoldersGetCustomPathW(HANDLE hFolderEntry, wchar_t *path {
FOLDERSGETDATA fgd = { sizeof(fgd) };
fgd.nMaxPathSize = size;
- fgd.szPathW = pathW;
+ fgd.szPath.w = pathW;
fgd.flags = FF_UNICODE;
INT_PTR res = CallService(MS_FOLDERS_GET_PATH, (WPARAM)hFolderEntry, (LPARAM)&fgd);
if (res) {
@@ -204,7 +173,7 @@ __inline static INT_PTR FoldersGetCustomPathEx(HANDLE hFolderEntry, char *path, {
FOLDERSGETDATA fgd = { sizeof(fgd) };
fgd.nMaxPathSize = size;
- fgd.szPath = path;
+ fgd.szPath.a = path;
INT_PTR res = CallService(MS_FOLDERS_GET_PATH, (WPARAM)hFolderEntry, (LPARAM)&fgd);
if (res) {
char buffer[MAX_PATH];
@@ -226,7 +195,7 @@ __inline static INT_PTR FoldersGetCustomPathExW(HANDLE hFolderEntry, wchar_t *pa {
FOLDERSGETDATA fgd = { sizeof(fgd) };
fgd.nMaxPathSize = size;
- fgd.szPathW = pathW;
+ fgd.szPath.w = pathW;
fgd.flags = FF_UNICODE;
INT_PTR res = CallService(MS_FOLDERS_GET_PATH, (WPARAM)hFolderEntry, (LPARAM)&fgd);
if (res) {
@@ -245,15 +214,4 @@ __inline static INT_PTR FoldersGetCustomPathExW(HANDLE hFolderEntry, wchar_t *pa }
#endif //_UNICODE
-# ifdef _UNICODE
-# define FoldersGetCustomPathT FoldersGetCustomPathW
-# define FoldersGetCustomPathExT FoldersGetCustomPathExW
-# define FoldersRegisterCustomPathT FoldersRegisterCustomPathW
-#else
-# define FoldersGetCustomPathT FoldersGetCustomPath
-# define FoldersGetCustomPathExT FoldersGetCustomPath
-# define FoldersRegisterCustomPathT FoldersRegisterCustomPath
-#endif
-
-
-#endif //M_CUSTOM_FOLDERS_H
\ No newline at end of file +#endif //M_CUSTOM_FOLDERS_H
diff --git a/plugins/Folders/src/folderItem.cpp b/plugins/Folders/src/folderItem.cpp index 69c669153a..f6b96f153f 100644 --- a/plugins/Folders/src/folderItem.cpp +++ b/plugins/Folders/src/folderItem.cpp @@ -47,7 +47,7 @@ void CFolderItem::SetFormat(const wchar_t *newFormat) {
mir_free(m_tszOldFormat);
m_tszOldFormat = m_tszFormat;
- m_tszFormat = mir_wstrdup(*newFormat ? newFormat : MIRANDA_PATHT);
+ m_tszFormat = mir_wstrdup(*newFormat ? newFormat : MIRANDA_PATHW);
}
int CFolderItem::IsEqual(const CFolderItem *other)
diff --git a/plugins/Folders/src/services.cpp b/plugins/Folders/src/services.cpp index a1d01aea9d..3fb2ab07fb 100644 --- a/plugins/Folders/src/services.cpp +++ b/plugins/Folders/src/services.cpp @@ -38,9 +38,9 @@ INT_PTR RegisterPathService(WPARAM, LPARAM lParam) CFolderItem *pNew;
if (data->flags & FF_UNICODE)
- pNew = new CFolderItem(data->szSection, data->szName, data->szFormatW, data->szUserNameW);
+ pNew = new CFolderItem(data->szSection, data->szName, data->szFormat.w, data->szUserName.w);
else
- pNew = new CFolderItem(data->szSection, data->szName, _A2T(data->szFormat), _A2T(data->szUserName));
+ pNew = new CFolderItem(data->szSection, data->szName, _A2T(data->szFormat.a), _A2T(data->szUserName.a));
lstRegisteredFolders.insert(pNew);
return (INT_PTR)pNew;
@@ -69,9 +69,9 @@ INT_PTR GetPathService(WPARAM wParam, LPARAM lParam) CMStringW buf(p->Expand());
if (data->flags & FF_UNICODE)
- wcsncpy_s(data->szPathT, data->nMaxPathSize, buf, _TRUNCATE);
+ wcsncpy_s(data->szPath.w, data->nMaxPathSize, buf, _TRUNCATE);
else
- strncpy_s(data->szPath, data->nMaxPathSize, _T2A(buf), _TRUNCATE);
+ strncpy_s(data->szPath.a, data->nMaxPathSize, _T2A(buf), _TRUNCATE);
return 0;
}
diff --git a/plugins/Folders/src/utils.cpp b/plugins/Folders/src/utils.cpp index 5973546d38..e8da712012 100644 --- a/plugins/Folders/src/utils.cpp +++ b/plugins/Folders/src/utils.cpp @@ -29,10 +29,10 @@ CMStringW ExpandPath(const wchar_t *format) else
res = VARSW(format);
- res.Replace(PROFILE_PATHT, szCurrentProfilePath);
- res.Replace(CURRENT_PROFILET, szCurrentProfile);
- res.Replace(MIRANDA_PATHT, szMirandaPath);
- res.Replace(MIRANDA_USERDATAT, szUserDataPath);
+ res.Replace(PROFILE_PATHW, szCurrentProfilePath);
+ res.Replace(CURRENT_PROFILEW, szCurrentProfile);
+ res.Replace(MIRANDA_PATHW, szMirandaPath);
+ res.Replace(MIRANDA_USERDATAW, szUserDataPath);
res.Trim();
// also remove the trailing slash
diff --git a/plugins/MirLua/src/options.cpp b/plugins/MirLua/src/options.cpp index f96a4a15a3..e196c52f3c 100644 --- a/plugins/MirLua/src/options.cpp +++ b/plugins/MirLua/src/options.cpp @@ -57,7 +57,7 @@ bool CMLuaOptionsMain::OnInitDialog() ImageList_AddIcon(hImageList, g_plugin.getIcon(IDI_COMPILE));
wchar_t scriptDir[MAX_PATH];
- FoldersGetCustomPathT(g_hScriptsFolder, scriptDir, _countof(scriptDir), VARSW(MIRLUA_PATHT));
+ FoldersGetCustomPathW(g_hScriptsFolder, scriptDir, _countof(scriptDir), VARSW(MIRLUA_PATHT));
wchar_t relativeScriptDir[MAX_PATH];
PathToRelativeW(scriptDir, relativeScriptDir, nullptr);
diff --git a/plugins/MirLua/src/plugin.cpp b/plugins/MirLua/src/plugin.cpp index 59756f1d26..e64d52863d 100644 --- a/plugins/MirLua/src/plugin.cpp +++ b/plugins/MirLua/src/plugin.cpp @@ -111,8 +111,8 @@ int CMPlugin::OnOptionsInit(WPARAM wParam, LPARAM) int CMPlugin::OnModulesLoaded(WPARAM, LPARAM) { - g_hCLibsFolder = FoldersRegisterCustomPathT(MODULENAME, "CLibsFolder", MIRLUA_PATHT, TranslateT("C libs folder")); - g_hScriptsFolder = FoldersRegisterCustomPathT(MODULENAME, "ScriptsFolder", MIRLUA_PATHT, TranslateT("Scripts folder")); + g_hCLibsFolder = FoldersRegisterCustomPathW(MODULENAME, "CLibsFolder", MIRLUA_PATHT, TranslateT("C libs folder")); + g_hScriptsFolder = FoldersRegisterCustomPathW(MODULENAME, "ScriptsFolder", MIRLUA_PATHT, TranslateT("Scripts folder")); LoadLuaScripts(); diff --git a/plugins/MirLua/src/script.cpp b/plugins/MirLua/src/script.cpp index 79f30e5399..a02467b6a3 100644 --- a/plugins/MirLua/src/script.cpp +++ b/plugins/MirLua/src/script.cpp @@ -165,7 +165,7 @@ bool CMLuaScript::Compile() Log(L"Compiling script %s", filePath);
wchar_t scriptDir[MAX_PATH];
- FoldersGetCustomPathT(g_hScriptsFolder, scriptDir, _countof(scriptDir), VARSW(MIRLUA_PATHT));
+ FoldersGetCustomPathW(g_hScriptsFolder, scriptDir, _countof(scriptDir), VARSW(MIRLUA_PATHT));
wchar_t fullPath[MAX_PATH];
mir_snwprintf(fullPath, L"%s\\%s.%s", scriptDir, scriptName, LUAPRECSCRIPTEXT);
wchar_t path[MAX_PATH];
diff --git a/plugins/MirLua/src/script_loader.cpp b/plugins/MirLua/src/script_loader.cpp index 1b70d0f039..32ff9346f8 100644 --- a/plugins/MirLua/src/script_loader.cpp +++ b/plugins/MirLua/src/script_loader.cpp @@ -15,12 +15,12 @@ void CMLuaScriptLoader::SetPaths() lua_getglobal(L, LUA_LOADLIBNAME);
- FoldersGetCustomPathT(g_hCLibsFolder, path, _countof(path), VARSW(MIRLUA_PATHT));
+ FoldersGetCustomPathW(g_hCLibsFolder, path, _countof(path), VARSW(MIRLUA_PATHT));
pathA = mir_utf8encodeW(path);
lua_pushfstring(L, "%s\\?.%s", pathA, _T2A(LUACLIBSCRIPTEXT));
lua_setfield(L, -2, "cpath");
- FoldersGetCustomPathT(g_hScriptsFolder, path, _countof(path), VARSW(MIRLUA_PATHT));
+ FoldersGetCustomPathW(g_hScriptsFolder, path, _countof(path), VARSW(MIRLUA_PATHT));
pathA = mir_utf8encodeW(path);
lua_pushfstring(L, "%s\\?.%s;%s\\?.%s", pathA, _T2A(LUATEXTSCRIPTEXT), pathA, _T2A(LUAPRECSCRIPTEXT));
lua_setfield(L, -2, "path");
@@ -60,7 +60,7 @@ void CMLuaScriptLoader::LoadScripts() SetPaths();
wchar_t scriptDir[MAX_PATH];
- FoldersGetCustomPathT(g_hScriptsFolder, scriptDir, _countof(scriptDir), VARSW(MIRLUA_PATHT));
+ FoldersGetCustomPathW(g_hScriptsFolder, scriptDir, _countof(scriptDir), VARSW(MIRLUA_PATHT));
Log(L"Loading scripts from %s", scriptDir);
diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp index c75f71a93a..33847d434f 100644 --- a/plugins/MirOTR/src/options.cpp +++ b/plugins/MirOTR/src/options.cpp @@ -8,7 +8,7 @@ wchar_t g_fingerprint_store_filename[MAX_PATH]; wchar_t g_instag_filename[MAX_PATH]; HANDLE hPATH_MIROTR; Options options; -#define DATA_DIRECTORY MIRANDA_USERDATAT L"\\" _A2W(MODULENAME) +#define DATA_DIRECTORY MIRANDA_USERDATAW L"\\" _A2W(MODULENAME) struct PROTOREGENKEYOPTIONS { HWND refresh; @@ -29,7 +29,7 @@ void SetFilenames(const wchar_t *path) int FoldersChanged(WPARAM, LPARAM) { wchar_t path[MAX_PATH]; - if ( FoldersGetCustomPathT(hPATH_MIROTR, path, _countof(path), L"")) + if ( FoldersGetCustomPathW(hPATH_MIROTR, path, _countof(path), L"")) SetFilenames(VARSW(DATA_DIRECTORY)); else SetFilenames(path); @@ -40,7 +40,7 @@ int FoldersChanged(WPARAM, LPARAM) void LoadFilenames() { - if (hPATH_MIROTR = FoldersRegisterCustomPathT("OTR", LPGEN("Private Data"), DATA_DIRECTORY)) { + if (hPATH_MIROTR = FoldersRegisterCustomPathW("OTR", LPGEN("Private Data"), DATA_DIRECTORY)) { HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersChanged); // get the path - above are only defaults - there may be a different value in the db diff --git a/plugins/PackUpdater/Src/PackUpdater.cpp b/plugins/PackUpdater/Src/PackUpdater.cpp index 0e44174650..aeab719bf1 100644 --- a/plugins/PackUpdater/Src/PackUpdater.cpp +++ b/plugins/PackUpdater/Src/PackUpdater.cpp @@ -51,9 +51,9 @@ int CMPlugin::Load() wchar_t *tszFolder = Utils_ReplaceVarsW(L"%miranda_userdata%\\" DEFAULT_UPDATES_FOLDER);
mir_wstrncpy(tszRoot, tszFolder, _countof(tszRoot));
- hPackUpdaterFolder = FoldersRegisterCustomPathT(MODULEA, LPGEN("Pack Updater"), MIRANDA_USERDATAT L"\\" DEFAULT_UPDATES_FOLDER);
+ hPackUpdaterFolder = FoldersRegisterCustomPathW(MODULEA, LPGEN("Pack Updater"), MIRANDA_USERDATAW L"\\" DEFAULT_UPDATES_FOLDER);
if (hPackUpdaterFolder)
- FoldersGetCustomPathT(hPackUpdaterFolder, tszRoot, MAX_PATH, L"");
+ FoldersGetCustomPathW(hPackUpdaterFolder, tszRoot, MAX_PATH, L"");
mir_free(tszFolder);
LoadOptions();
diff --git a/plugins/PluginUpdater/src/Events.cpp b/plugins/PluginUpdater/src/Events.cpp index 4cde7317ff..3e734f0a0c 100644 --- a/plugins/PluginUpdater/src/Events.cpp +++ b/plugins/PluginUpdater/src/Events.cpp @@ -23,7 +23,7 @@ HANDLE hPluginUpdaterFolder; int OnFoldersChanged(WPARAM, LPARAM)
{
- FoldersGetCustomPathT(hPluginUpdaterFolder, g_tszRoot, MAX_PATH, L"");
+ FoldersGetCustomPathW(hPluginUpdaterFolder, g_tszRoot, MAX_PATH, L"");
size_t len = wcslen(g_tszRoot);
if (g_tszRoot[len-1] == '\\' || g_tszRoot[len-1] == '/')
g_tszRoot[len-1] = 0;
@@ -46,7 +46,7 @@ void EmptyFolder() int ModulesLoaded(WPARAM, LPARAM)
{
- if (hPluginUpdaterFolder = FoldersRegisterCustomPathT(MODULEA, LPGEN("Plugin Updater"), MIRANDA_PATHW L"\\" DEFAULT_UPDATES_FOLDER)) {
+ if (hPluginUpdaterFolder = FoldersRegisterCustomPathW(MODULEA, LPGEN("Plugin Updater"), MIRANDA_PATHW L"\\" DEFAULT_UPDATES_FOLDER)) {
HookEvent(ME_FOLDERS_PATH_CHANGED, OnFoldersChanged);
OnFoldersChanged(0, 0);
}
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 05923e9312..717f160596 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -247,7 +247,7 @@ static int ModulesLoaded(WPARAM, LPARAM) // hook TopToolBar
HookEvent(ME_TTB_MODULELOADED, TTBLoaded);
// Folder plugin support
- folderId = FoldersRegisterCustomPathT(LPGEN("Skins"), LPGEN("Popup Plus"), MIRANDA_PATHT L"\\Skins\\Popup");
+ folderId = FoldersRegisterCustomPathW(LPGEN("Skins"), LPGEN("Popup Plus"), MIRANDA_PATHW L"\\Skins\\Popup");
// load skin
skins.load();
const PopupSkin *skin;
diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp index 477bc9f533..001fdc96d1 100644 --- a/plugins/Popup/src/skin.cpp +++ b/plugins/Popup/src/skin.cpp @@ -1098,7 +1098,7 @@ bool Skins::load() wchar_t dir[1024] = { '\0' };
if (ServiceExists(MS_FOLDERS_GET_PATH)) {
- if (FoldersGetCustomPathT(folderId, dir, _countof(dir), nullptr) != 0)
+ if (FoldersGetCustomPathW(folderId, dir, _countof(dir), nullptr) != 0)
return false;
}
else {
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 010a065109..fb9fcee22b 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -54,7 +54,7 @@ static int onModulesLoaded(WPARAM, LPARAM) {
InitNetlib();
- g_hFolders = FoldersRegisterCustomPathT(LPGEN("SecureIM"), LPGEN("Icons"), MIRANDA_PATH "\\icons");
+ g_hFolders = FoldersRegisterCustomPath(LPGEN("SecureIM"), LPGEN("Icons"), MIRANDA_PATH "\\icons");
InitIcons();
GetFlags();
diff --git a/plugins/SecureIM/src/splitmsg.cpp b/plugins/SecureIM/src/splitmsg.cpp index c44f546ffe..bb63c0ffe9 100644 --- a/plugins/SecureIM/src/splitmsg.cpp +++ b/plugins/SecureIM/src/splitmsg.cpp @@ -1,7 +1,7 @@ #include "commonheaders.h"
// разбивает сообщение szMsg на части длиной iLen, возвращает строку вида PARTzPARTzz
-LPSTR splitMsg(LPSTR szMsg, int iLen)
+LPSTR splitMsg(LPSTR szMsg, size_t iLen)
{
Sent_NetLog("split: msg: -----\n%s\n-----\n", szMsg);
@@ -14,7 +14,7 @@ LPSTR splitMsg(LPSTR szMsg, int iLen) size_t part_all = (len + iLen - 1) / iLen;
for (size_t part_num = 0; part_num<part_all; part_num++) {
- size_t sz = (len>iLen) ? iLen : len;
+ size_t sz = (len > iLen) ? iLen : len;
mir_snprintf(buf, 32, "%s%04X%02X%02X", SIG_SECP, msg_id, part_num, part_all);
memcpy(buf + LEN_SECP + 8, szMsg, sz);
*(buf + LEN_SECP + 8 + sz) = '\0';
diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp index 1e2faa997b..f976b778ce 100644 --- a/plugins/SendScreenshotPlus/src/Main.cpp +++ b/plugins/SendScreenshotPlus/src/Main.cpp @@ -72,7 +72,7 @@ wchar_t* GetCustomPath() wchar_t* pszPath = Utils_ReplaceVarsW(L"%miranda_userdata%\\Screenshots"); if (m_hFolderScreenshot) { wchar_t szPath[1024] = { 0 }; - FoldersGetCustomPathT(m_hFolderScreenshot, szPath, 1024, pszPath); + FoldersGetCustomPathW(m_hFolderScreenshot, szPath, 1024, pszPath); mir_free(pszPath); pszPath = mir_wstrdup(szPath); } @@ -242,7 +242,7 @@ int hook_ModulesLoaded(WPARAM, LPARAM) CtrlButtonLoadModule(); // Folders plugin support - m_hFolderScreenshot = FoldersRegisterCustomPathT(LPGEN("SendSS"), LPGEN("Screenshots"), + m_hFolderScreenshot = FoldersRegisterCustomPathW(LPGEN("SendSS"), LPGEN("Screenshots"), PROFILE_PATHW L"\\" CURRENT_PROFILEW L"\\Screenshots"); return 0; } diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index 206f2f45b1..7276ac40dc 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -219,8 +219,8 @@ bool GetSmileyFile(CMStringW &url, const CMStringW &packstr) int FolderChanged(WPARAM, LPARAM)
{
- FoldersGetCustomPathT(hFolderCache, g_wszCachePath, MAX_PATH, L"");
- FoldersGetCustomPathT(hFolderPacks, g_plugin.wszDefaultPath, MAX_PATH, L"%miranda_path%");
+ FoldersGetCustomPathW(hFolderCache, g_wszCachePath, MAX_PATH, L"");
+ FoldersGetCustomPathW(hFolderPacks, g_plugin.wszDefaultPath, MAX_PATH, L"%miranda_path%");
size_t len = mir_wstrlen(g_plugin.wszDefaultPath);
if (len && g_plugin.wszDefaultPath[len - 1] != '\\')
mir_wstrcpy(g_plugin.wszDefaultPath + len, L"\\");
@@ -235,9 +235,9 @@ void DownloadInit(void) nlu.szDescriptiveName.w = TranslateT("SmileyAdd HTTP connections");
hNetlibUser = Netlib_RegisterUser(&nlu);
- hFolderPacks = FoldersRegisterCustomPathT(LPGEN("SmileyAdd"), LPGEN("Smiley packs' folder"), L"%miranda_path%");
+ hFolderPacks = FoldersRegisterCustomPathW(LPGEN("SmileyAdd"), LPGEN("Smiley packs' folder"), L"%miranda_path%");
if (hFolderPacks) {
- hFolderCache = FoldersRegisterCustomPathT(LPGEN("SmileyAdd"), LPGEN("Smiley cache"), MIRANDA_USERDATAT L"\\SmileyCache");
+ hFolderCache = FoldersRegisterCustomPathW(LPGEN("SmileyAdd"), LPGEN("Smiley cache"), MIRANDA_USERDATAW L"\\SmileyCache");
FolderChanged(0, 0);
HookEvent(ME_FOLDERS_PATH_CHANGED, FolderChanged);
}
diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp index 3a1c9eaea1..703221c471 100644 --- a/plugins/SpellChecker/src/spellchecker.cpp +++ b/plugins/SpellChecker/src/spellchecker.cpp @@ -76,21 +76,21 @@ static int ModulesLoaded(WPARAM, LPARAM) variables_enabled = ServiceExists(MS_VARS_FORMATSTRING); // Folders plugin support - if (hDictionariesFolder = FoldersRegisterCustomPathT(LPGEN("Spell Checker"), LPGEN("Dictionaries"), DICTIONARIES_FOLDER)) { + if (hDictionariesFolder = FoldersRegisterCustomPathW(LPGEN("Spell Checker"), LPGEN("Dictionaries"), DICTIONARIES_FOLDER)) { dictionariesFolder = (wchar_t *)mir_alloc(sizeof(wchar_t) * MAX_PATH); - FoldersGetCustomPathT(hDictionariesFolder, dictionariesFolder, MAX_PATH, L"."); + FoldersGetCustomPathW(hDictionariesFolder, dictionariesFolder, MAX_PATH, L"."); } else dictionariesFolder = Utils_ReplaceVarsW(DICTIONARIES_FOLDER); - if (hCustomDictionariesFolder = FoldersRegisterCustomPathT(LPGEN("Spell Checker"), LPGEN("Custom Dictionaries"), CUSTOM_DICTIONARIES_FOLDER)) { + if (hCustomDictionariesFolder = FoldersRegisterCustomPathW(LPGEN("Spell Checker"), LPGEN("Custom Dictionaries"), CUSTOM_DICTIONARIES_FOLDER)) { customDictionariesFolder = (wchar_t *)mir_alloc(sizeof(wchar_t) * MAX_PATH); - FoldersGetCustomPathT(hCustomDictionariesFolder, customDictionariesFolder, MAX_PATH, L"."); + FoldersGetCustomPathW(hCustomDictionariesFolder, customDictionariesFolder, MAX_PATH, L"."); } else customDictionariesFolder = Utils_ReplaceVarsW(CUSTOM_DICTIONARIES_FOLDER); - if (hFlagsDllFolder = FoldersRegisterCustomPathT(LPGEN("Spell Checker"), LPGEN("Flags DLL"), FLAGS_DLL_FOLDER)) { + if (hFlagsDllFolder = FoldersRegisterCustomPathW(LPGEN("Spell Checker"), LPGEN("Flags DLL"), FLAGS_DLL_FOLDER)) { flagsDllFolder = (wchar_t *)mir_alloc(sizeof(wchar_t) * MAX_PATH); - FoldersGetCustomPathT(hFlagsDllFolder, flagsDllFolder, MAX_PATH, L"."); + FoldersGetCustomPathW(hFlagsDllFolder, flagsDllFolder, MAX_PATH, L"."); } else flagsDllFolder = Utils_ReplaceVarsW(FLAGS_DLL_FOLDER); diff --git a/plugins/StopSpamMod/src/init.cpp b/plugins/StopSpamMod/src/init.cpp index f5bdfe4fc1..2496667941 100755 --- a/plugins/StopSpamMod/src/init.cpp +++ b/plugins/StopSpamMod/src/init.cpp @@ -122,7 +122,7 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) mir_forkthread(&CleanThread);
// Folders plugin support
- hStopSpamLogDirH = FoldersRegisterCustomPathT(LPGEN("StopSpam"), LPGEN("StopSpam Logs"), FOLDER_LOGS);
+ hStopSpamLogDirH = FoldersRegisterCustomPathW(LPGEN("StopSpam"), LPGEN("StopSpam Logs"), FOLDER_LOGS);
return 0;
}
diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index 675e403292..df98a7efbb 100755 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -199,7 +199,7 @@ void LogSpamToFile(MCONTACT hContact, wstring message) wchar_t pszName[MAX_PATH];
if (hStopSpamLogDirH)
- FoldersGetCustomPathT(hStopSpamLogDirH, pszName, MAX_PATH, L"");
+ FoldersGetCustomPathW(hStopSpamLogDirH, pszName, MAX_PATH, L"");
else
mir_wstrncpy(pszName, VARSW(L"%miranda_logpath%"), _countof(pszName));
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 1c2e01e408..9ce2123785 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -60,10 +60,10 @@ int CMimAPI::FoldersPathChanged(WPARAM, LPARAM) void CMimAPI::configureCustomFolders() { - m_hDataPath = FoldersRegisterCustomPathT(LPGEN("TabSRMM"), LPGEN("Data path"), const_cast<wchar_t *>(getDataPath())); - m_hSkinsPath = FoldersRegisterCustomPathT(LPGEN("Skins"), LPGEN("TabSRMM"), const_cast<wchar_t *>(getSkinPath())); - m_hAvatarsPath = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("Saved TabSRMM avatars"), const_cast<wchar_t *>(getSavedAvatarPath())); - m_hChatLogsPath = FoldersRegisterCustomPathT(LPGEN("TabSRMM"), LPGEN("Group chat logs root"), const_cast<wchar_t *>(getChatLogPath())); + m_hDataPath = FoldersRegisterCustomPathW(LPGEN("TabSRMM"), LPGEN("Data path"), const_cast<wchar_t *>(getDataPath())); + m_hSkinsPath = FoldersRegisterCustomPathW(LPGEN("Skins"), LPGEN("TabSRMM"), const_cast<wchar_t *>(getSkinPath())); + m_hAvatarsPath = FoldersRegisterCustomPathW(LPGEN("Avatars"), LPGEN("Saved TabSRMM avatars"), const_cast<wchar_t *>(getSavedAvatarPath())); + m_hChatLogsPath = FoldersRegisterCustomPathW(LPGEN("TabSRMM"), LPGEN("Group chat logs root"), const_cast<wchar_t *>(getChatLogPath())); if (m_hDataPath) HookEvent(ME_FOLDERS_PATH_CHANGED, CMimAPI::FoldersPathChanged); @@ -77,20 +77,20 @@ INT_PTR CMimAPI::foldersPathChanged() if (m_hDataPath) { szTemp[0] = 0; - FoldersGetCustomPathT(m_hDataPath, szTemp, MAX_PATH, const_cast<wchar_t *>(getDataPath())); + FoldersGetCustomPathW(m_hDataPath, szTemp, MAX_PATH, const_cast<wchar_t *>(getDataPath())); wcsncpy_s(m_szProfilePath, szTemp, _TRUNCATE); szTemp[0] = 0; - FoldersGetCustomPathT(m_hSkinsPath, szTemp, MAX_PATH, const_cast<wchar_t *>(getSkinPath())); + FoldersGetCustomPathW(m_hSkinsPath, szTemp, MAX_PATH, const_cast<wchar_t *>(getSkinPath())); wcsncpy_s(m_szSkinsPath, (MAX_PATH - 1), szTemp, _TRUNCATE); Utils::ensureTralingBackslash(m_szSkinsPath); szTemp[0] = 0; - FoldersGetCustomPathT(m_hAvatarsPath, szTemp, MAX_PATH, const_cast<wchar_t *>(getSavedAvatarPath())); + FoldersGetCustomPathW(m_hAvatarsPath, szTemp, MAX_PATH, const_cast<wchar_t *>(getSavedAvatarPath())); wcsncpy_s(m_szSavedAvatarsPath, szTemp, _TRUNCATE); szTemp[0] = 0; - FoldersGetCustomPathT(m_hChatLogsPath, szTemp, MAX_PATH, const_cast<wchar_t *>(getChatLogPath())); + FoldersGetCustomPathW(m_hChatLogsPath, szTemp, MAX_PATH, const_cast<wchar_t *>(getChatLogPath())); wcsncpy_s(m_szChatLogsPath, (MAX_PATH - 1), szTemp, _TRUNCATE); Utils::ensureTralingBackslash(m_szChatLogsPath); } diff --git a/plugins/TipperYM/src/tipper.cpp b/plugins/TipperYM/src/tipper.cpp index 60b9b439a5..82bb2875c5 100644 --- a/plugins/TipperYM/src/tipper.cpp +++ b/plugins/TipperYM/src/tipper.cpp @@ -109,7 +109,7 @@ static int EventDeleted(WPARAM wParam, LPARAM lParam) static int ReloadSkinFolder(WPARAM, LPARAM)
{
- FoldersGetCustomPathT(hSkinFolder, SKIN_FOLDER, _countof(SKIN_FOLDER), DEFAULT_SKIN_FOLDER);
+ FoldersGetCustomPathW(hSkinFolder, SKIN_FOLDER, _countof(SKIN_FOLDER), DEFAULT_SKIN_FOLDER);
return 0;
}
@@ -237,8 +237,8 @@ static int ModulesLoaded(WPARAM, LPARAM) hFolderChanged = HookEvent(ME_FOLDERS_PATH_CHANGED, ReloadSkinFolder);
- hSkinFolder = FoldersRegisterCustomPathT(LPGEN("Skins"), LPGEN("Tipper"), MIRANDA_PATHT L"\\" DEFAULT_SKIN_FOLDER);
- FoldersGetCustomPathT(hSkinFolder, SKIN_FOLDER, _countof(SKIN_FOLDER), DEFAULT_SKIN_FOLDER);
+ hSkinFolder = FoldersRegisterCustomPathW(LPGEN("Skins"), LPGEN("Tipper"), MIRANDA_PATHW L"\\" DEFAULT_SKIN_FOLDER);
+ FoldersGetCustomPathW(hSkinFolder, SKIN_FOLDER, _countof(SKIN_FOLDER), DEFAULT_SKIN_FOLDER);
InitTipperSmileys();
LoadOptions();
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 53aa06b23f..d4ee9c7520 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -72,7 +72,7 @@ GaduProto::GaduProto(const char *pszProtoName, const wchar_t *tszUserName) : wchar_t szPath[MAX_PATH];
mir_snwprintf(szPath, L"%s\\%s\\ImageCache", (wchar_t*)VARSW(L"%miranda_userdata%"), m_tszUserName);
- hImagesFolder = FoldersRegisterCustomPathT(LPGEN("Images"), m_szModuleName, szPath, m_tszUserName);
+ hImagesFolder = FoldersRegisterCustomPathW(LPGEN("Images"), m_szModuleName, szPath, m_tszUserName);
DWORD pluginVersion = getDword(GG_PLUGINVERSION, 0);
if (pluginVersion < pluginInfoEx.version)
diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index 787cb69c56..3790fbb373 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -802,7 +802,7 @@ int GaduProto::img_displayasmsg(MCONTACT hContact, void *img) wchar_t szPath[MAX_PATH], path[MAX_PATH];
size_t tPathLen;
- if (hImagesFolder == nullptr || FoldersGetCustomPathT(hImagesFolder, path, MAX_PATH, L"")) {
+ if (hImagesFolder == nullptr || FoldersGetCustomPathW(hImagesFolder, path, MAX_PATH, L"")) {
wchar_t *tmpPath = Utils_ReplaceVarsW(L"%miranda_userdata%");
tPathLen = mir_snwprintf(szPath, L"%s\\%s\\ImageCache", tmpPath, m_tszUserName);
mir_free(tmpPath);
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index fc9073d73d..cbb853a090 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -93,7 +93,7 @@ void CMsnProto::InitCustomFolders(void) wchar_t folder[MAX_PATH];
mir_snwprintf(folder, L"%%miranda_avatarcache%%\\%S", m_szModuleName);
- hCustomSmileyFolder = FoldersRegisterCustomPathT(LPGEN("Custom Smileys"), m_szModuleName, folder, m_tszUserName);
+ hCustomSmileyFolder = FoldersRegisterCustomPathW(LPGEN("Custom Smileys"), m_szModuleName, folder, m_tszUserName);
InitCstFldRan = true;
}
@@ -289,7 +289,7 @@ void CMsnProto::MSN_GetCustomSmileyFileName(MCONTACT hContact, wchar_t* pszDest, InitCustomFolders();
wchar_t* path = (wchar_t*)alloca(cbLen * sizeof(wchar_t));
- if (hCustomSmileyFolder == nullptr || FoldersGetCustomPathT(hCustomSmileyFolder, path, (int)cbLen, L"")) {
+ if (hCustomSmileyFolder == nullptr || FoldersGetCustomPathW(hCustomSmileyFolder, path, (int)cbLen, L"")) {
wchar_t *tmpPath = Utils_ReplaceVarsW(L"%miranda_userdata%");
wchar_t *tszModuleName = mir_a2u(m_szModuleName);
tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%s\\CustomSmiley", tmpPath, tszModuleName);
diff --git a/protocols/NewsAggregator/Src/Services.cpp b/protocols/NewsAggregator/Src/Services.cpp index 9183607841..eda85edfdc 100644 --- a/protocols/NewsAggregator/Src/Services.cpp +++ b/protocols/NewsAggregator/Src/Services.cpp @@ -25,14 +25,14 @@ HANDLE hTBButton = nullptr, hNewsAggregatorFolder = nullptr; int OnFoldersChanged(WPARAM, LPARAM) { - FoldersGetCustomPathT(hNewsAggregatorFolder, tszRoot, MAX_PATH, L""); + FoldersGetCustomPathW(hNewsAggregatorFolder, tszRoot, MAX_PATH, L""); return 0; } int NewsAggrInit(WPARAM, LPARAM) { - if (hNewsAggregatorFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("News Aggregator"), MIRANDA_USERDATAT L"\\Avatars\\" _A2W(DEFAULT_AVATARS_FOLDER))) - FoldersGetCustomPathT(hNewsAggregatorFolder, tszRoot, MAX_PATH, L""); + if (hNewsAggregatorFolder = FoldersRegisterCustomPathW(LPGEN("Avatars"), LPGEN("News Aggregator"), MIRANDA_USERDATAW L"\\Avatars\\" _A2W(DEFAULT_AVATARS_FOLDER))) + FoldersGetCustomPathW(hNewsAggregatorFolder, tszRoot, MAX_PATH, L""); else mir_wstrncpy(tszRoot, VARSW(L"%miranda_userdata%\\Avatars\\" _A2W(DEFAULT_AVATARS_FOLDER)), _countof(tszRoot)); diff --git a/protocols/Tox/src/main.cpp b/protocols/Tox/src/main.cpp index 219c7a07c6..7b509b9378 100644 --- a/protocols/Tox/src/main.cpp +++ b/protocols/Tox/src/main.cpp @@ -36,7 +36,7 @@ int OnModulesLoaded(WPARAM, LPARAM) { CToxProto::InitIcons(); - hProfileFolderPath = FoldersRegisterCustomPathT("Tox", "ProfilesFolder", MIRANDA_USERDATAT, TranslateT("Profiles folder")); + hProfileFolderPath = FoldersRegisterCustomPathW("Tox", "ProfilesFolder", MIRANDA_USERDATAW, TranslateT("Profiles folder")); if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) { CreateServiceFunction(MODULE "/ParseUri", CToxProto::ParseToxUri); diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp index 57fbb83a18..2b8ef857c5 100644 --- a/protocols/Tox/src/tox_profile.cpp +++ b/protocols/Tox/src/tox_profile.cpp @@ -11,7 +11,7 @@ wchar_t* CToxProto::GetToxProfilePath(const wchar_t *accountName) {
wchar_t *profilePath = (wchar_t*)mir_calloc(MAX_PATH * sizeof(wchar_t) + 1);
wchar_t profileRootPath[MAX_PATH];
- FoldersGetCustomPathT(hProfileFolderPath, profileRootPath, _countof(profileRootPath), VARSW(L"%miranda_userdata%"));
+ FoldersGetCustomPathW(hProfileFolderPath, profileRootPath, _countof(profileRootPath), VARSW(L"%miranda_userdata%"));
mir_snwprintf(profilePath, MAX_PATH, L"%s\\%s.tox", profileRootPath, accountName);
return profilePath;
}
diff --git a/protocols/Twitter/src/contacts.cpp b/protocols/Twitter/src/contacts.cpp index c87dafb226..a64fedb77e 100644 --- a/protocols/Twitter/src/contacts.cpp +++ b/protocols/Twitter/src/contacts.cpp @@ -243,14 +243,10 @@ MCONTACT TwitterProto::AddToClientList(const char *name, const char *status) setWord(hContact, "Status", ID_STATUS_ONLINE);
db_set_utf(hContact, "CList", "StatusMsg", status);
- std::string url = profile_base_url("https://twitter.com/") + http::url_encode(name);
- setString(hContact, "Homepage", url.c_str());
Skin_PlaySound("TwitterNewContact");
- DBVARIANT dbv;
- if (!getWString(TWITTER_KEY_GROUP, &dbv)) {
- db_set_ws(hContact, "CList", "Group", dbv.pwszVal);
- db_free(&dbv);
- }
+ ptrW wszGroup(getWStringA(TWITTER_KEY_GROUP));
+ if (wszGroup)
+ db_set_ws(hContact, "CList", "Group", wszGroup);
return hContact;
}
diff --git a/protocols/Twitter/src/http.cpp b/protocols/Twitter/src/http.cpp deleted file mode 100644 index 200a3d0adb..0000000000 --- a/protocols/Twitter/src/http.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/*
-Copyright © 2012-19 Miranda NG team
-Copyright © 2009 Jim Porter
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-#include "http.h"
-
-std::string http::url_encode(const std::string &s)
-{
- return mir_urlEncode(s.c_str());
-}
diff --git a/protocols/Twitter/src/http.h b/protocols/Twitter/src/http.h index 3568e98c39..b756f4cd71 100644 --- a/protocols/Twitter/src/http.h +++ b/protocols/Twitter/src/http.h @@ -35,6 +35,4 @@ namespace http int code;
std::string data;
};
-
- std::string url_encode(const std::string &);
-}
\ No newline at end of file +}
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 8ff0f75444..3a1b07cc2e 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -228,18 +228,11 @@ INT_PTR TwitterProto::ReplyToTweet(WPARAM wParam, LPARAM) return 0;
}
-INT_PTR TwitterProto::VisitHomepage(WPARAM wParam, LPARAM)
+INT_PTR TwitterProto::VisitHomepage(WPARAM hContact, LPARAM)
{
- MCONTACT hContact = (MCONTACT) wParam;
- DBVARIANT dbv;
- // TODO: remove this
- if (!getString(hContact, TWITTER_KEY_UN, &dbv)) {
- std::string url = profile_base_url("https://twitter.com/") + http::url_encode(dbv.pszVal);
- setString(hContact, "Homepage", url.c_str());
-
- Utils_OpenUrl(url.c_str());
- db_free(&dbv);
- }
+ ptrA szUsername(getStringA(hContact, TWITTER_KEY_UN));
+ if (szUsername)
+ Utils_OpenUrl("https://twitter.com/" + mir_urlEncode(szUsername));
return 0;
}
diff --git a/protocols/Twitter/src/proto.h b/protocols/Twitter/src/proto.h index b7d05b5686..4fc546d547 100644 --- a/protocols/Twitter/src/proto.h +++ b/protocols/Twitter/src/proto.h @@ -135,13 +135,3 @@ struct CMPlugin : public ACCPROTOPLUGIN<TwitterProto> int Load() override;
};
-
-// TODO: remove this
-inline std::string profile_base_url(const std::string &url)
-{
- size_t x = url.find("://");
- if(x == std::string::npos)
- return url.substr(0,url.find('/')+1);
- else
- return url.substr(0,url.find('/',x+3)+1);
-}
\ No newline at end of file diff --git a/protocols/Twitter/src/twitter.cpp b/protocols/Twitter/src/twitter.cpp index f86ceac4bc..1b2b98a2e3 100644 --- a/protocols/Twitter/src/twitter.cpp +++ b/protocols/Twitter/src/twitter.cpp @@ -105,7 +105,7 @@ bool twitter::get_info(const std::string &name, twitter_user *info) if (!info)
return false;
- std::string url = base_url_ + "1.1/users/show/" + http::url_encode(name) + ".json";
+ std::string url = base_url_ + "1.1/users/show/" + mir_urlEncode(name.c_str()).c_str() + ".json";
http::response resp = slurp(url, http::get);
if (resp.code != 200)
@@ -129,7 +129,7 @@ bool twitter::get_info_by_email(const std::string &email, twitter_user *info) if (!info)
return false;
- std::string url = base_url_ + "1.1/users/show.json?email=" + http::url_encode(email);
+ std::string url = base_url_ + "1.1/users/show.json?email=" + mir_urlEncode(email.c_str()).c_str();
http::response resp = slurp(url, http::get);
if (resp.code != 200)
@@ -150,7 +150,7 @@ bool twitter::get_info_by_email(const std::string &email, twitter_user *info) twitter_user twitter::add_friend(const std::string &name)
{
- std::string url = base_url_ + "1.1/friendships/create/" + http::url_encode(name) + ".json";
+ std::string url = base_url_ + "1.1/friendships/create/" + mir_urlEncode(name.c_str()).c_str() + ".json";
http::response resp = slurp(url, http::post);
if (resp.code != 200)
@@ -176,7 +176,7 @@ twitter_user twitter::add_friend(const std::string &name) void twitter::remove_friend(const std::string &name)
{
- std::string url = base_url_ + "1.1/friendships/destroy/" + http::url_encode(name) + ".json";
+ std::string url = base_url_ + "1.1/friendships/destroy/" + mir_urlEncode(name.c_str()).c_str() + ".json";
slurp(url, http::post);
}
@@ -300,10 +300,9 @@ std::vector<twitter_user> twitter::get_direct(twitter_id id) string twitter::urlencode(const string &c)
{
-
string escaped;
size_t max = c.length();
- for (int i = 0; i < max; i++) {
+ for (size_t i = 0; i < max; i++) {
if ((48 <= c[i] && c[i] <= 57) ||//0-9
(65 <= c[i] && c[i] <= 90) ||//ABC...XYZ
(97 <= c[i] && c[i] <= 122) || //abc...xyz
diff --git a/protocols/YAMN/src/main.cpp b/protocols/YAMN/src/main.cpp index d214f5e982..f1434b332e 100644 --- a/protocols/YAMN/src/main.cpp +++ b/protocols/YAMN/src/main.cpp @@ -144,8 +144,8 @@ int SystemModulesLoaded(WPARAM, LPARAM) CheckMenuItems(); - if (hAccountFolder = FoldersRegisterCustomPathT(LPGEN("YAMN"), LPGEN("YAMN Account Folder"), UserDirectory)) - FoldersGetCustomPathT(hAccountFolder, UserDirectory, MAX_PATH, UserDirectory); + if (hAccountFolder = FoldersRegisterCustomPathW(LPGEN("YAMN"), LPGEN("YAMN Account Folder"), UserDirectory)) + FoldersGetCustomPathW(hAccountFolder, UserDirectory, MAX_PATH, UserDirectory); RegisterPOP3Plugin(0, 0); return 0; diff --git a/src/mir_app/src/path.cpp b/src/mir_app/src/path.cpp index cf6f935f07..5b14ac1a3b 100644 --- a/src/mir_app/src/path.cpp +++ b/src/mir_app/src/path.cpp @@ -367,7 +367,7 @@ static int OnFoldersChanged(WPARAM, LPARAM) mir_snwprintf(tszAvatarRoot, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
wchar_t tmpVar[MAX_PATH];
- if (!FoldersGetCustomPathT(hAvatarFolder, tmpVar, _countof(tmpVar), tszAvatarRoot))
+ if (!FoldersGetCustomPathW(hAvatarFolder, tmpVar, _countof(tmpVar), tszAvatarRoot))
wcsncpy_s(tszAvatarRoot, tmpVar, _TRUNCATE);
return 0;
}
@@ -375,9 +375,9 @@ static int OnFoldersChanged(WPARAM, LPARAM) void InitPathVar()
{
mir_snwprintf(tszAvatarRoot, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
- if (hAvatarFolder = FoldersRegisterCustomPathT( LPGEN("Avatars"), LPGEN("Avatars root folder"), tszAvatarRoot)) {
+ if (hAvatarFolder = FoldersRegisterCustomPathW(LPGEN("Avatars"), LPGEN("Avatars root folder"), tszAvatarRoot)) {
wchar_t tmpVar[MAX_PATH];
- if (!FoldersGetCustomPathT(hAvatarFolder, tmpVar, _countof(tmpVar), tszAvatarRoot))
+ if (!FoldersGetCustomPathW(hAvatarFolder, tmpVar, _countof(tmpVar), tszAvatarRoot))
wcsncpy_s(tszAvatarRoot, tmpVar, _TRUNCATE);
HookEvent(ME_FOLDERS_PATH_CHANGED, OnFoldersChanged);
}
|