diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/path.cpp | 49 | ||||
-rw-r--r-- | src/mir_core/src/path.cpp | 12 |
2 files changed, 14 insertions, 47 deletions
diff --git a/src/mir_app/src/path.cpp b/src/mir_app/src/path.cpp index e0b795574c..1df4dab0ea 100644 --- a/src/mir_app/src/path.cpp +++ b/src/mir_app/src/path.cpp @@ -30,45 +30,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern TCHAR g_profileDir[MAX_PATH], g_shortProfileName[MAX_PATH];
static HANDLE hAvatarFolder;
-static TCHAR tszAvatarRoot[MAX_PATH];
+static TCHAR tszAvatarRoot[MAX_PATH];
-static INT_PTR pathToRelative(WPARAM wParam, LPARAM lParam)
-{
- return PathToRelative((char*)wParam, (char*)lParam);
-}
-
-static INT_PTR pathToAbsolute(WPARAM wParam, LPARAM lParam)
-{
- return PathToAbsolute((char*)wParam, (char*)lParam);
-}
-
-static INT_PTR createDirTree(WPARAM, LPARAM lParam)
-{
- if (lParam == 0)
- return 1;
-
- return CreateDirectoryTree((char*)lParam);
-}
-
-static INT_PTR pathToRelativeW(WPARAM wParam, LPARAM lParam)
-{
- return PathToRelativeW((WCHAR*)wParam, (WCHAR*)lParam );
-}
-
-static INT_PTR pathToAbsoluteW(WPARAM wParam, LPARAM lParam)
-{
- return PathToAbsoluteW((WCHAR*)wParam, (WCHAR*)lParam, NULL);
-}
-
-static INT_PTR createDirTreeW(WPARAM, LPARAM lParam)
-{
- if (lParam == 0)
- return 1;
-
- return CreateDirectoryTreeW((WCHAR*)lParam);
-}
-
-TCHAR *GetContactID(MCONTACT hContact)
+TCHAR* GetContactID(MCONTACT hContact)
{
TCHAR *theValue = {0};
char *szProto = GetContactProto(hContact);
@@ -421,15 +385,6 @@ static INT_PTR replaceVars(WPARAM wParam, LPARAM lParam) int InitPathUtils(void)
{
- CreateServiceFunction(MS_UTILS_PATHTORELATIVE, pathToRelative);
- CreateServiceFunction(MS_UTILS_PATHTORELATIVEW, pathToRelativeW);
-
- CreateServiceFunction(MS_UTILS_PATHTOABSOLUTE, pathToAbsolute);
- CreateServiceFunction(MS_UTILS_PATHTOABSOLUTEW, pathToAbsoluteW);
-
- CreateServiceFunction(MS_UTILS_CREATEDIRTREE, createDirTree);
- CreateServiceFunction(MS_UTILS_CREATEDIRTREEW, createDirTreeW);
-
CreateServiceFunction(MS_UTILS_REPLACEVARS, replaceVars);
return 0;
}
diff --git a/src/mir_core/src/path.cpp b/src/mir_core/src/path.cpp index 6e17eaa53a..e9fb81c672 100644 --- a/src/mir_core/src/path.cpp +++ b/src/mir_core/src/path.cpp @@ -83,6 +83,9 @@ MIR_CORE_DLL(int) PathToAbsolute(const char *pSrc, char *pOut, const char *base) MIR_CORE_DLL(void) CreatePathToFile(char *szFilePath)
{
+ if (szFilePath == NULL)
+ return;
+
char *pszLastBackslash = strrchr(szFilePath, '\\');
if (pszLastBackslash == NULL)
return;
@@ -94,6 +97,9 @@ MIR_CORE_DLL(void) CreatePathToFile(char *szFilePath) MIR_CORE_DLL(int) CreateDirectoryTree(const char *szDir)
{
+ if (szDir == NULL)
+ return 1;
+
char szTestDir[MAX_PATH];
mir_strncpy(szTestDir, szDir, SIZEOF(szTestDir));
@@ -167,6 +173,9 @@ MIR_CORE_DLL(int) PathToAbsoluteW(const WCHAR *pSrc, WCHAR *pOut, const WCHAR *b MIR_CORE_DLL(void) CreatePathToFileW(WCHAR *wszFilePath)
{
+ if (wszFilePath == NULL)
+ return;
+
WCHAR *pszLastBackslash = wcsrchr(wszFilePath, '\\');
if (pszLastBackslash == NULL)
return;
@@ -178,6 +187,9 @@ MIR_CORE_DLL(void) CreatePathToFileW(WCHAR *wszFilePath) MIR_CORE_DLL(int) CreateDirectoryTreeW(const WCHAR *szDir)
{
+ if (szDir == NULL)
+ return 1;
+
WCHAR szTestDir[MAX_PATH];
mir_wstrncpy(szTestDir, szDir, SIZEOF(szTestDir));
|