summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2012-05-24 20:22:36 +0000
committerKirill Volinsky <mataes2007@gmail.com>2012-05-24 20:22:36 +0000
commit1274410851b8a636aa82c899e84222e805603836 (patch)
tree2616cb3183d1ebc1e3efc5a7d73a2a45a02210a2 /plugins
parent4afcff92e5b5449bf8c728da9bf3551e614053e2 (diff)
Folders API update
git-svn-id: http://svn.miranda-ng.org/main/trunk@167 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ExternalAPI/m_folders.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/plugins/ExternalAPI/m_folders.h b/plugins/ExternalAPI/m_folders.h
index 02d4d3564e..c6d021d46d 100644
--- a/plugins/ExternalAPI/m_folders.h
+++ b/plugins/ExternalAPI/m_folders.h
@@ -168,6 +168,7 @@ __inline static HANDLE FoldersRegisterCustomPath(const char *section, const char
return (HANDLE) CallService(MS_FOLDERS_REGISTER_PATH, 0, (LPARAM) &fd);
}
+#ifdef _UNICODE
__inline static HANDLE FoldersRegisterCustomPathW(const char *section, const char *name, const wchar_t *defaultPathW)
{
FOLDERSDATA fd = {0};
@@ -181,6 +182,7 @@ __inline static HANDLE FoldersRegisterCustomPathW(const char *section, const cha
fd.flags = FF_UNICODE;
return (HANDLE) CallService(MS_FOLDERS_REGISTER_PATH, 0, (LPARAM) &fd);
}
+#endif //_UNICODE
__inline static INT_PTR FoldersGetCustomPath(HANDLE hFolderEntry, char *path, const int size, const char *notFound)
{
@@ -200,22 +202,25 @@ __inline static INT_PTR FoldersGetCustomPath(HANDLE hFolderEntry, char *path, co
return res;
}
-__inline static INT_PTR FoldersGetCustomPathW(HANDLE hFolderEntry, wchar_t *pathW, const int count, const wchar_t *notFoundW)
+#ifdef _UNICODE
+__inline static INT_PTR FoldersGetCustomPathW(HANDLE hFolderEntry, wchar_t *pathW, const int size, const wchar_t *notFoundW)
{
FOLDERSGETDATA fgd = {0};
INT_PTR res;
fgd.cbSize = sizeof(FOLDERSGETDATA);
- fgd.nMaxPathSize = count;
+ fgd.nMaxPathSize = size;
fgd.szPathW = pathW;
res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
if (res)
{
- wcsncpy(pathW, notFoundW, count);
- pathW[count - 1] = '\0';
+ wchar_t buffer[MAX_PATH];
+ CallService(MS_UTILS_PATHTOABSOLUTEW, (WPARAM) notFoundW, (LPARAM) buffer);
+ mir_sntprintf(pathW, size, _T("%s"), buffer);
}
return res;
}
+#endif //_UNICODE
__inline static INT_PTR FoldersGetCustomPathEx(HANDLE hFolderEntry, char *path, const int size, char *notFound, char *fileName)
{
@@ -247,18 +252,20 @@ __inline static INT_PTR FoldersGetCustomPathEx(HANDLE hFolderEntry, char *path,
return res;
}
-__inline static INT_PTR FoldersGetCustomPathExW(HANDLE hFolderEntry, wchar_t *pathW, const int count, wchar_t *notFoundW, wchar_t *fileNameW)
+#ifdef _UNICODE
+__inline static INT_PTR FoldersGetCustomPathExW(HANDLE hFolderEntry, wchar_t *pathW, const int size, wchar_t *notFoundW, wchar_t *fileNameW)
{
FOLDERSGETDATA fgd = {0};
INT_PTR res;
fgd.cbSize = sizeof(FOLDERSGETDATA);
- fgd.nMaxPathSize = count;
+ fgd.nMaxPathSize = size;
fgd.szPathW = pathW;
res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
if (res)
{
- wcsncpy(pathW, notFoundW, count);
- pathW[count - 1] = '\0';
+ wchar_t buffer[MAX_PATH];
+ CallService(MS_UTILS_PATHTOABSOLUTEW, (WPARAM) notFoundW, (LPARAM) buffer);
+ mir_sntprintf(pathW, size, _T("%s"), buffer);
}
if (wcslen(pathW) > 0)
@@ -276,6 +283,7 @@ __inline static INT_PTR FoldersGetCustomPathExW(HANDLE hFolderEntry, wchar_t *pa
return res;
}
+#endif //_UNICODE
# ifdef _UNICODE
# define FoldersGetCustomPathT FoldersGetCustomPathW