diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2013-08-23 12:05:26 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2013-08-23 12:05:26 +0000 |
commit | d3f0f130d7c6eab9c723dcb06d64853bcedd7035 (patch) | |
tree | f7f40fcb7aca760da94251ed46653caf0c180559 /plugins | |
parent | 264e076f02faca0cfd59e5b0929d74ca621119cb (diff) |
use mir_sntprintf
git-svn-id: http://svn.miranda-ng.org/main/trunk@5791 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/YAMN/src/main.cpp | 26 | ||||
-rw-r--r-- | plugins/YAMN/src/main.h | 12 |
2 files changed, 18 insertions, 20 deletions
diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp index ed0ea35794..65aee18a87 100644 --- a/plugins/YAMN/src/main.cpp +++ b/plugins/YAMN/src/main.cpp @@ -258,17 +258,14 @@ void WINAPI g_ReleaseIcon( HICON hIcon ) static void LoadPlugins()
{
- HANDLE hFind;
- WIN32_FIND_DATA fd;
TCHAR szSearchPath[MAX_PATH];
- TCHAR szPluginPath[MAX_PATH];
- lstrcpy(szSearchPath, szMirandaDir);
- lstrcat(szSearchPath, _T("\\Plugins\\YAMN\\*.dll"));
- typedef INT_PTR (*LOADFILTERFCN)(MIRANDASERVICE GetYAMNFcn);
+ mir_sntprintf(szSearchPath, MAX_PATH, _T("%s\\Plugins\\YAMN\\*.dll"), szMirandaDir);
hDllPlugins = NULL;
- if (INVALID_HANDLE_VALUE != (hFind = FindFirstFile(szSearchPath, &fd))) {
+ WIN32_FIND_DATA fd;
+ HANDLE hFind = FindFirstFile(szSearchPath, &fd);
+ if (hFind != INVALID_HANDLE_VALUE) {
do {
//rewritten from Miranda sources... Needed because Win32 API has a bug in FindFirstFile, search is done for *.dlllllll... too
TCHAR *dot = _tcsrchr(fd.cFileName, '.');
@@ -276,21 +273,20 @@ static void LoadPlugins() continue;
// we have a dot
- int len = (int)lstrlen(fd.cFileName); // find the length of the string
+ int len = lstrlen(fd.cFileName); // find the length of the string
TCHAR* end = fd.cFileName+len; // get a pointer to the NULL
int safe = (end-dot)-1; // figure out how many chars after the dot are "safe", not including NULL
if ((safe != 3) || (lstrcmpi(dot+1, _T("dll")) != 0)) //not bound, however the "dll" string should mean only 3 chars are compared
continue;
- HINSTANCE hDll;
- LOADFILTERFCN LoadFilter;
+ TCHAR szPluginPath[MAX_PATH];
+ mir_sntprintf(szPluginPath, MAX_PATH,_T("%s\\Plugins\\YAMN\\%s"), szMirandaDir, fd.cFileName);
+ HINSTANCE hDll = LoadLibrary(szPluginPath);
+ if (hDll == NULL)
+ continue;
- lstrcpy(szPluginPath, szMirandaDir);
- lstrcat(szPluginPath, _T("\\Plugins\\YAMN\\"));
- lstrcat(szPluginPath, fd.cFileName);
- if ((hDll = LoadLibrary(szPluginPath)) == NULL) continue;
- LoadFilter = (LOADFILTERFCN)GetProcAddress(hDll, "LoadFilter");
+ LOADFILTERFCN LoadFilter = (LOADFILTERFCN) GetProcAddress(hDll, "LoadFilter");
if (NULL == LoadFilter) {
FreeLibrary(hDll);
hDll = NULL;
diff --git a/plugins/YAMN/src/main.h b/plugins/YAMN/src/main.h index 7f909df2ca..eacb470e69 100644 --- a/plugins/YAMN/src/main.h +++ b/plugins/YAMN/src/main.h @@ -1,11 +1,11 @@ #ifndef __MAIN_H
#define __MAIN_H
-#define YAMN_NEWMAILSNDDESC LPGEN("YAMN: new mail message") -#define YAMN_CONNECTFAILSNDDESC LPGEN("YAMN: connect failed") -#define YAMN_CONNECTFAILSOUND "YAMN/Sound/ConnectFail" -#define YAMN_NEWMAILSOUND "YAMN/Sound/NewMail" - +#define YAMN_NEWMAILSNDDESC LPGEN("YAMN: new mail message")
+#define YAMN_CONNECTFAILSNDDESC LPGEN("YAMN: connect failed")
+#define YAMN_CONNECTFAILSOUND "YAMN/Sound/ConnectFail"
+#define YAMN_NEWMAILSOUND "YAMN/Sound/NewMail"
+
#define YAMN_DBMODULE "YAMN"
#define YAMN_DBPOSX "MailBrowserWinX"
#define YAMN_DBPOSY "MailBrowserWinY"
@@ -33,5 +33,7 @@ extern unsigned char optDateTime; // Loading Icon and checking for icolib
void LoadIcons();
+typedef INT_PTR (*LOADFILTERFCN)(MIRANDASERVICE GetYAMNFcn);
+
#endif
|