From d6964f7bb1c2afc8d67905fa38ac9a3df766b807 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 17 Jun 2015 15:42:14 +0000 Subject: obsolete services extincted git-svn-id: http://svn.miranda-ng.org/main/trunk@14237 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/delphi/m_core.inc | 26 --------- include/delphi/m_utils.inc | 103 ++++++++++++++++----------------- include/m_core.h | 31 ---------- include/m_utils.h | 89 ++++++++++++++++------------ plugins/HistoryStats/src/mu_common.cpp | 17 ------ plugins/HistoryStats/src/mu_common.h | 10 ---- plugins/HistoryStats/src/utils.cpp | 2 +- plugins/Import/src/import.h | 2 +- plugins/Import/src/utils.cpp | 2 +- plugins/Import/src/wizard.cpp | 2 +- plugins/MirLua/src/m_popup.cpp | 2 +- plugins/NewAwaySysMod/src/Path.h | 4 +- plugins/Spamotron/src/bayes.cpp | 2 +- protocols/Steam/src/steam_avatars.cpp | 2 +- protocols/Tox/src/tox_avatars.cpp | 2 +- protocols/Tox/src/tox_icons.cpp | 2 +- protocols/Tox/src/tox_proto.h | 2 +- src/mir_app/src/path.cpp | 49 +--------------- src/mir_core/src/path.cpp | 12 ++++ 19 files changed, 129 insertions(+), 232 deletions(-) diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc index f8884d239a..fb3a57e2be 100644 --- a/include/delphi/m_core.inc +++ b/include/delphi/m_core.inc @@ -387,32 +387,6 @@ function GetInstByAddress(codePtr:pointer):HINST; stdcall; external CoreDLL name 'GetInstByAddress'; -/////////////////////////////////////////////////////////////////////////////// -// path utils - -procedure CreatePathToFile(wszFilePath:PAnsiChar); stdcall; - external CoreDLL name 'CreatePathToFile'; -function CreateDirectoryTree(const szDir:PAnsiChar):int; stdcall; - external CoreDLL name 'CreateDirectoryTree'; -function PathIsAbsolute(const pSrc:PAnsiChar):int; stdcall; - external CoreDLL name 'PathIsAbsolute'; -function PathToAbsolute(const pSrc:PAnsiChar; pOut:PAnsiChar; base:PAnsiChar=nil):int; stdcall; - external CoreDLL name 'PathToAbsolute'; -function PathToRelative(const pSrc:PAnsiChar; pOut:PAnsiChar; base:PAnsiChar=nil):int; stdcall; - external CoreDLL name 'PathToRelative'; - -procedure CreatePathToFileW(wszFilePath:PWideChar); stdcall; - external CoreDLL name 'CreatePathToFileW'; -function CreateDirectoryTreeW(const szDir:PWideChar):int; stdcall; - external CoreDLL name 'CreateDirectoryTreeW'; -function PathIsAbsoluteW(const pSrc:PWideChar):int; stdcall; - external CoreDLL name 'PathIsAbsoluteW'; -function PathToAbsoluteW(const pSrc:PWideChar; pOut:PWideChar; base:PWideChar=nil):int; stdcall; - external CoreDLL name 'PathToAbsoluteW'; -function PathToRelativeW(const pSrc:PWideChar; pOut:PWideChar; base:PWideChar=nil):int; stdcall; - external CoreDLL name 'PathToRelativeW'; - - /////////////////////////////////////////////////////////////////////////////// // print functions diff --git a/include/delphi/m_utils.inc b/include/delphi/m_utils.inc index d241a91aa3..dea6497f48 100644 --- a/include/delphi/m_utils.inc +++ b/include/delphi/m_utils.inc @@ -74,13 +74,6 @@ type ISOcode: array [0..2] of AnsiChar; end; - PWINDOWLISTENTRY = ^TWINDOWLISTENTRY; - TWINDOWLISTENTRY = record - hList : THANDLE; - hWnd : HWND; - hContact: TMCONTACT; - end; - PSAVEWINDOWPOS = ^TSAVEWINDOWPOS; TSAVEWINDOWPOS = record hWnd : HWND; @@ -274,59 +267,61 @@ const MS_UTILS_LOADBITMAP :PAnsiChar = 'Utils/LoadBitmap'; MS_UTILS_LOADBITMAPW:PAnsiChar = 'Utils/LoadBitmapW'; - { - wParam : byte length of buffer (not to be confused with byte range) - lParam : Pointer to buffer - Affect : Get the filter strings for use in the open file dialog, see notes - Returns: 0 on success [non zero] on failure - Notes : See the WINAPI under OPENFILENAME.lpStrFiler for formatting, - an 'All bitmaps' item is alway first, and 'All files' is always last - - - The returned string is always formatted - - - To build this filter, the filter string consists of - filter followed by a descriptive text - followed by more filters and their descriptive texts -- end with double NULL(0) - e.g. *.bmp' #0 'All bitmaps' #0 '*.*' #0 'All Files' #0 #0 - } - MS_UTILS_GETBITMAPFILTERSTRINGS :PAnsiChar = 'Utils/GetBitmapFilterStrings'; - MS_UTILS_GETBITMAPFILTERSTRINGSW:PAnsiChar = 'Utils/GetBitmapFilterStringsW'; - { - wParam : pszPath - lParam : pszNewPath - Affect : Saves a path to a relative path (from the miranda directory) - Only saves as a relative path if the file is in the miranda - directory (or sub directory) - Notes : pszPath is the path to convert and pszNewPath is the buffer that - the new path is copied too. pszNewPath MUST be of the size MAX_PATH. - Returns: numbers of chars copied. - } - MS_UTILS_PATHTORELATIVE :PAnsiChar = 'Utils/PathToRelative'; -//Unicode versions (0.6.2+) - MS_UTILS_PATHTORELATIVEW:PAnsiChar = 'Utils/PathToRelativeW'; +{ + Affect : Saves a path to a relative path (from the miranda directory) + Only saves as a relative path if the file is in the miranda + directory (or sub directory) + Notes : pszPath is the path to convert and pszNewPath is the buffer that + the new path is copied too. pszNewPath MUST be of the size MAX_PATH. + Returns: numbers of chars copied. +} - { - Affect : Saves a path to a absolute path (from the miranda directory) - wParam : pszPath - lParam : pszNewPath - Notes : pszPath is the path to convert and pszNewPath is the buffer that - the new path is copied too. pszNewPath MUST be of the size MAX_PATH. - Returns: numbers of chars copied. - } - MS_UTILS_PATHTOABSOLUTE :PAnsiChar = 'Utils/PathToAbsolute'; -//Unicode versions (0.6.2+) - MS_UTILS_PATHTOABSOLUTEW:PAnsiChar = 'Utils/PathToAbsoluteW'; +function PathToRelative(const pSrc:PAnsiChar; pOut:PAnsiChar; base:PAnsiChar=nil):int; stdcall; + external CoreDLL name 'PathToRelative'; +function PathToRelativeW(const pSrc:PWideChar; pOut:PWideChar; base:PWideChar=nil):int; stdcall; + external CoreDLL name 'PathToRelativeW'; + +{ + Affect : Saves a path to a absolute path (from the miranda directory) + Notes : pszPath is the path to convert and pszNewPath is the buffer that + the new path is copied too. pszNewPath MUST be of the size MAX_PATH. + Returns: numbers of chars copied. +} + +function PathToAbsolute(const pSrc:PAnsiChar; pOut:PAnsiChar; base:PAnsiChar=nil):int; stdcall; + external CoreDLL name 'PathToAbsolute'; +function PathToAbsoluteW(const pSrc:PWideChar; pOut:PWideChar; base:PWideChar=nil):int; stdcall; + external CoreDLL name 'PathToAbsoluteW'; { Creates a directory tree (even more than one directories levels are missing) 0.7.0+ - wParam=0 (unused) - lParam=pszPath - directory to be created Returns 0 on success error code otherwise - Unicode version is available since 0.7.0 } - MS_UTILS_CREATEDIRTREE :PAnsiChar = 'Utils/CreateDirTree'; - MS_UTILS_CREATEDIRTREEW:PAnsiChar = 'Utils/CreateDirTreeW'; + +function CreateDirectoryTree(const szDir:PAnsiChar):int; stdcall; + external CoreDLL name 'CreateDirectoryTree'; +function CreateDirectoryTreeW(const szDir:PWideChar):int; stdcall; + external CoreDLL name 'CreateDirectoryTreeW'; + +{ + Creates all subdirectories required to create a file with the file name given + Returns 0 on success or an error code otherwise +} + +procedure CreatePathToFile(wszFilePath:PAnsiChar); stdcall; + external CoreDLL name 'CreatePathToFile'; +procedure CreatePathToFileW(wszFilePath:PWideChar); stdcall; + external CoreDLL name 'CreatePathToFileW'; +{ + Checks if a file name is absolute or not + returns TRUE if yes or FALSE if not +} + +function PathIsAbsolute(const pSrc:PAnsiChar):int; stdcall; + external CoreDLL name 'PathIsAbsolute'; +function PathIsAbsoluteW(const pSrc:PWideChar):int; stdcall; + external CoreDLL name 'PathIsAbsoluteW'; { Generates Random number of any length @@ -334,6 +329,8 @@ const lParam=(LPARAM)(char*)pszArray - pointer to array to fill with random number Always returns 0 } + +const MS_UTILS_GETRANDOM:PAnsiChar = 'Utils/GetRandom'; //Replace variables in text diff --git a/include/m_core.h b/include/m_core.h index b39b0fd703..5133ecbd6f 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -329,37 +329,6 @@ MIR_CORE_DLL(void) UnregisterModule(HINSTANCE hInst); MIR_CORE_DLL(HINSTANCE) GetInstByAddress(void* codePtr); -/////////////////////////////////////////////////////////////////////////////// -// path utils - -MIR_CORE_DLL(void) CreatePathToFile(char* wszFilePath); -MIR_CORE_DLL(int) CreateDirectoryTree(const char* szDir); -MIR_CORE_DLL(int) PathIsAbsolute(const char *pSrc); - -MIR_CORE_DLL(void) CreatePathToFileW(wchar_t* wszFilePath); -MIR_CORE_DLL(int) CreateDirectoryTreeW(const wchar_t* szDir); -MIR_CORE_DLL(int) PathIsAbsoluteW(const wchar_t *pSrc); - -#if defined( __cplusplus ) - MIR_CORE_DLL(int) PathToAbsolute(const char *pSrc, char *pOut, const char* base=0); - MIR_CORE_DLL(int) PathToAbsoluteW(const wchar_t *pSrc, wchar_t *pOut, const wchar_t* base = 0); - - MIR_CORE_DLL(int) PathToRelative(const char *pSrc, char *pOut, const char* base = 0); - MIR_CORE_DLL(int) PathToRelativeW(const wchar_t *pSrc, wchar_t *pOut, const wchar_t* base = 0); -#else - MIR_CORE_DLL(int) PathToAbsolute(const char *pSrc, char *pOut, const char* base); - MIR_CORE_DLL(int) PathToAbsoluteW(const wchar_t *pSrc, wchar_t *pOut, const wchar_t* base); - - MIR_CORE_DLL(int) PathToRelative(const char *pSrc, char *pOut, const char* base); - MIR_CORE_DLL(int) PathToRelativeW(const wchar_t *pSrc, wchar_t *pOut, const wchar_t* base); -#endif - -#define CreatePathToFileT CreatePathToFileW -#define CreateDirectoryTreeT CreateDirectoryTreeW -#define PathIsAbsoluteT PathIsAbsoluteW -#define PathToAbsoluteT PathToAbsoluteW -#define PathToRelativeT PathToRelativeW - /////////////////////////////////////////////////////////////////////////////// // print functions diff --git a/include/m_utils.h b/include/m_utils.h index 4e779871a5..9d9d689e3a 100644 --- a/include/m_utils.h +++ b/include/m_utils.h @@ -287,58 +287,75 @@ EXTERN_C MIR_CORE_DLL(HBITMAP) Bitmap_Load(const TCHAR *ptszFileName); EXTERN_C MIR_CORE_DLL(void) Bitmap_GetFilter(TCHAR *dest, size_t destLen); ///////////////////////////////////////////////////////////////////////////////////////// -// Saves a path to a relative path (from the miranda directory) +// Converts a path to a relative path // Only saves as a relative path if the file is in the miranda directory (or // sub directory) -// wParam = (WPARAM)(char*)pszPath -// lParam = (LPARAM)(char*)pszNewPath -// pszPath is the path to convert and pszNewPath is the buffer that -// the new path is copied too. pszNewPath MUST be of the size MAX_PATH. -// Returns numbers of chars copied. -// Unicode version is available since 0.6.2 - -#define MS_UTILS_PATHTORELATIVE "Utils/PathToRelative" -#define MS_UTILS_PATHTORELATIVEW "Utils/PathToRelativeW" +// +// [pszSrc] is the path to convert and [pszOut] is the buffer that +// the new path is copied too. pszOut MUST be at least of the size MAX_PATH. +// +// [pszBase] is the folder that is treated as root for 'relativity' +// by default = path to miranda32.exe +// +// Returns number of chars copied. -#ifdef _UNICODE - #define MS_UTILS_PATHTORELATIVET MS_UTILS_PATHTORELATIVEW +#if defined( __cplusplus ) +EXTERN_C MIR_CORE_DLL(int) PathToRelative(const char *pszSrc, char *pszOut, const char* pszBase = 0); +EXTERN_C MIR_CORE_DLL(int) PathToRelativeW(const wchar_t *pwszSrc, wchar_t *pwszOut, const wchar_t* pwszBase = 0); #else - #define MS_UTILS_PATHTORELATIVET MS_UTILS_PATHTORELATIVE +EXTERN_C MIR_CORE_DLL(int) PathToRelative(const char *pszSrc, char *pszOut, const char* pszBase); +EXTERN_C MIR_CORE_DLL(int) PathToRelativeW(const wchar_t *pwszSrc, wchar_t *pwszOut, const wchar_t* pwszBase); #endif +#define PathToRelativeT PathToRelativeW + ///////////////////////////////////////////////////////////////////////////////////////// // Saves a path to a absolute path (from the miranda directory) -// wParam = (WPARAM)(char*)pszPath -// lParam = (LPARAM)(char*)pszNewPath -// pszPath is the path to convert and pszNewPath is the buffer that -// the new path is copied too. pszNewPath MUST be of the size MAX_PATH. +// +// [pszSrc] is the path to convert and [pszOut] is the buffer that +// the new path is copied too. pszOut MUST be of the size MAX_PATH. +// +// [pszBase] is the folder that is treated as root for 'relativity' +// by default = path to miranda32.exe +// // Returns numbers of chars copied. -// Unicode version is available since 0.6.2 -#define MS_UTILS_PATHTOABSOLUTE "Utils/PathToAbsolute" -#define MS_UTILS_PATHTOABSOLUTEW "Utils/PathToAbsoluteW" - -#ifdef _UNICODE - #define MS_UTILS_PATHTOABSOLUTET MS_UTILS_PATHTOABSOLUTEW +#if defined( __cplusplus ) +EXTERN_C MIR_CORE_DLL(int) PathToAbsolute(const char *pszSrc, char *pszOut, const char* pszBase = 0); +EXTERN_C MIR_CORE_DLL(int) PathToAbsoluteW(const wchar_t *pwszSrc, wchar_t *pwszOut, const wchar_t* pwszBase = 0); #else - #define MS_UTILS_PATHTOABSOLUTET MS_UTILS_PATHTOABSOLUTE +EXTERN_C MIR_CORE_DLL(int) PathToAbsolute(const char *pszSrc, char *pszOut, const char* pszBase); +EXTERN_C MIR_CORE_DLL(int) PathToAbsoluteW(const wchar_t *pwszSrc, wchar_t *pwszOut, const wchar_t* pwszBase); #endif +#define PathToAbsoluteT PathToAbsoluteW + ///////////////////////////////////////////////////////////////////////////////////////// -// Creates a directory tree (even more than one directories levels are missing) 0.7.0+ -// wParam = 0 (unused) -// lParam = (LPARAM)(char*)pszPath - directory to be created -// Returns 0 on success error code otherwise -// Unicode version is available since 0.7.0 +// Creates a directory tree (even more than one directories levels are missing) +// Returns 0 on success or an error code otherwise -#define MS_UTILS_CREATEDIRTREE "Utils/CreateDirTree" -#define MS_UTILS_CREATEDIRTREEW "Utils/CreateDirTreeW" +EXTERN_C MIR_CORE_DLL(int) CreateDirectoryTree(const char *pszDir); +EXTERN_C MIR_CORE_DLL(int) CreateDirectoryTreeW(const wchar_t *pwszDir); -#ifdef _UNICODE - #define MS_UTILS_CREATEDIRTREET MS_UTILS_CREATEDIRTREEW -#else - #define MS_UTILS_CREATEDIRTREET MS_UTILS_CREATEDIRTREE -#endif +#define CreateDirectoryTreeT CreateDirectoryTreeW + +///////////////////////////////////////////////////////////////////////////////////////// +// Creates all subdirectories required to create a file with the file name given +// Returns 0 on success or an error code otherwise + +EXTERN_C MIR_CORE_DLL(void) CreatePathToFile(char *wszFilePath); +EXTERN_C MIR_CORE_DLL(void) CreatePathToFileW(wchar_t *wszFilePath); + +#define CreatePathToFileT CreatePathToFileW + +///////////////////////////////////////////////////////////////////////////////////////// +// Checks if a file name is absolute or not +// returns TRUE if yes or FALSE if not + +EXTERN_C MIR_CORE_DLL(int) PathIsAbsolute(const char *pSrc); +EXTERN_C MIR_CORE_DLL(int) PathIsAbsoluteW(const wchar_t *pSrc); + +#define PathIsAbsoluteT PathIsAbsoluteW ///////////////////////////////////////////////////////////////////////////////////////// // Generates Random number of any length diff --git a/plugins/HistoryStats/src/mu_common.cpp b/plugins/HistoryStats/src/mu_common.cpp index 821f1e2c58..39be7c8bd0 100644 --- a/plugins/HistoryStats/src/mu_common.cpp +++ b/plugins/HistoryStats/src/mu_common.cpp @@ -257,23 +257,6 @@ namespace mu } } - /* - * utils - */ - - namespace utils - { - int pathToRelative(const TCHAR* pszPath, TCHAR* pszNewPath) - { - return CallService(MS_UTILS_PATHTORELATIVET, reinterpret_cast(pszPath), reinterpret_cast(pszNewPath)); - } - - int pathToAbsolute(const TCHAR* pszPath, TCHAR* pszNewPath) - { - return CallService(MS_UTILS_PATHTOABSOLUTET, reinterpret_cast(pszPath), reinterpret_cast(pszNewPath)); - } - } - /* * core interface functions */ diff --git a/plugins/HistoryStats/src/mu_common.h b/plugins/HistoryStats/src/mu_common.h index 349c68c218..c249659a1a 100644 --- a/plugins/HistoryStats/src/mu_common.h +++ b/plugins/HistoryStats/src/mu_common.h @@ -122,16 +122,6 @@ namespace mu void registerFL(int fileID, const PLUGININFOEX* pluginInfo); } - /* - * utils - */ - - namespace utils - { - int pathToRelative(const TCHAR* pszPath, TCHAR* pszNewPath); - int pathToAbsolute(const TCHAR* pszPath, TCHAR* pszNewPath); - } - /* * core interface functions */ diff --git a/plugins/HistoryStats/src/utils.cpp b/plugins/HistoryStats/src/utils.cpp index c00fb7a43c..6139ee0b35 100644 --- a/plugins/HistoryStats/src/utils.cpp +++ b/plugins/HistoryStats/src/utils.cpp @@ -895,7 +895,7 @@ namespace utils if (strMirandaPath.empty()) { TCHAR szPath[MAX_PATH] = { 0 }; - mu::utils::pathToAbsolute(_T("x"), szPath); + PathToAbsoluteT(_T("x"), szPath); strMirandaPath = extractPath(szPath); } diff --git a/plugins/Import/src/import.h b/plugins/Import/src/import.h index 1b6d55710e..572ac475f2 100644 --- a/plugins/Import/src/import.h +++ b/plugins/Import/src/import.h @@ -105,6 +105,6 @@ extern int nImportOptions; extern TCHAR importFile[]; extern time_t dwSinceDate; -HICON GetIcon(int iIconId, int size = 0); +HICON GetIcon(int iIconId, bool size = false); HANDLE GetIconHandle(int iIconId); void RegisterIcons(void); diff --git a/plugins/Import/src/utils.cpp b/plugins/Import/src/utils.cpp index 826faa8da7..180294196b 100644 --- a/plugins/Import/src/utils.cpp +++ b/plugins/Import/src/utils.cpp @@ -216,7 +216,7 @@ static IconItem iconList[] = { LPGEN("Import..."), "import_main", IDI_IMPORT } }; -HICON GetIcon(int iIconId, int size) +HICON GetIcon(int iIconId, bool size) { for (int i = 0; i < SIZEOF(iconList); i++) if (iconList[i].defIconID == iIconId) diff --git a/plugins/Import/src/wizard.cpp b/plugins/Import/src/wizard.cpp index 0bd02ced23..86b419365d 100644 --- a/plugins/Import/src/wizard.cpp +++ b/plugins/Import/src/wizard.cpp @@ -100,7 +100,7 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP ShowWindow(hwndPage, SW_SHOW); ShowWindow(hdlg, SW_SHOW); SendMessage(hdlg, WM_SETICON, ICON_SMALL, (LPARAM)GetIcon(IDI_IMPORT)); - SendMessage(hdlg, WM_SETICON, ICON_BIG, (LPARAM)GetIcon(IDI_IMPORT, 32)); + SendMessage(hdlg, WM_SETICON, ICON_BIG, (LPARAM)GetIcon(IDI_IMPORT, true)); return TRUE; case WIZM_GOTOPAGE: diff --git a/plugins/MirLua/src/m_popup.cpp b/plugins/MirLua/src/m_popup.cpp index 8f32889f4f..f76a90b91a 100644 --- a/plugins/MirLua/src/m_popup.cpp +++ b/plugins/MirLua/src/m_popup.cpp @@ -11,7 +11,7 @@ static POPUPDATA2* MakePopupData(lua_State *L) lua_pop(L, 1); if (!(ppd->flags & PU2_TCHAR)) - ppd->flags | PU2_TCHAR; + ppd->flags |= PU2_TCHAR; lua_pushstring(L, "Title"); lua_gettable(L, -2); diff --git a/plugins/NewAwaySysMod/src/Path.h b/plugins/NewAwaySysMod/src/Path.h index e108a919e5..176f08bad7 100644 --- a/plugins/NewAwaySysMod/src/Path.h +++ b/plugins/NewAwaySysMod/src/Path.h @@ -27,7 +27,7 @@ __inline TCString Path_ToRelative(TCString &Path) { TCString Str; Str.GetBuffer(MAX_PATH); - CallService(MS_UTILS_PATHTORELATIVET, (WPARAM)(TCHAR*)Path, (LPARAM)(TCHAR*)Str); + PathToRelativeT(Path, Str); Str.ReleaseBuffer(); return Str; } @@ -37,7 +37,7 @@ __inline TCString Path_ToAbsolute(TCString &Path) { TCString Str; Str.GetBuffer(MAX_PATH); - CallService(MS_UTILS_PATHTOABSOLUTET, (WPARAM)(TCHAR*)Path, (LPARAM)(TCHAR*)Str); + PathToAbsoluteT(Path, Str); Str.ReleaseBuffer(); return Str; } diff --git a/plugins/Spamotron/src/bayes.cpp b/plugins/Spamotron/src/bayes.cpp index b85a4249f0..89de53ef23 100644 --- a/plugins/Spamotron/src/bayes.cpp +++ b/plugins/Spamotron/src/bayes.cpp @@ -56,7 +56,7 @@ int OpenBayes() mir_free(tmp); } - CallService(MS_UTILS_CREATEDIRTREE, 0, (LPARAM)bayesdb_fullpath); + CreateDirectoryTree(bayesdb_fullpath); mir_strcat(bayesdb_fullpath, "\\"BAYESDB_FILENAME); bayesdb_fullpath_utf8 = mir_utf8encode(bayesdb_fullpath); diff --git a/protocols/Steam/src/steam_avatars.cpp b/protocols/Steam/src/steam_avatars.cpp index a8f40e5dde..63554fd630 100644 --- a/protocols/Steam/src/steam_avatars.cpp +++ b/protocols/Steam/src/steam_avatars.cpp @@ -7,7 +7,7 @@ TCHAR* CSteamProto::GetAvatarFilePath(MCONTACT hContact) DWORD dwAttributes = GetFileAttributes(path); if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) - CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)path); + CreateDirectoryTreeT(path); ptrA steamId(getStringA(hContact, "SteamID")); if (steamId != NULL) diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp index 5683415486..c95ebad620 100644 --- a/protocols/Tox/src/tox_avatars.cpp +++ b/protocols/Tox/src/tox_avatars.cpp @@ -7,7 +7,7 @@ std::tstring CToxProto::GetAvatarFilePath(MCONTACT hContact) DWORD dwAttributes = GetFileAttributes(path); if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) - CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)path); + CreateDirectoryTreeT(path); ptrT address(getTStringA(hContact, TOX_SETTINGS_ID)); if (address == NULL) diff --git a/protocols/Tox/src/tox_icons.cpp b/protocols/Tox/src/tox_icons.cpp index 85f2b427bd..e1b00b2688 100644 --- a/protocols/Tox/src/tox_icons.cpp +++ b/protocols/Tox/src/tox_icons.cpp @@ -34,7 +34,7 @@ void CToxProto::InitIcons() } } -HICON CToxProto::GetIcon(const char *name, int size) +HICON CToxProto::GetIcon(const char *name, bool size) { for (size_t i = 0; i < SIZEOF(Icons); i++) if (mir_strcmpi(Icons[i].Name, name) == 0) diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index b0e9ef17a7..b2326dc4d4 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -123,7 +123,7 @@ private: // icons static IconInfo Icons[]; - static HICON GetIcon(const char *name, int size = 0); + static HICON GetIcon(const char *name, bool size = false); static HANDLE GetIconHandle(const char *name); static HANDLE Skin_GetIconHandle(const char *name); 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)); -- cgit v1.2.3