summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-05-31 07:57:03 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-05-31 07:57:03 +0000
commit34572133dc4f3b86f9a3cb9708aa0806f1cfded2 (patch)
tree2bed7c078dd39e6f45287302501332596525f309
parentf6eb47ba8c15005c274a98ab238dafc3f9676c6d (diff)
fix for the temporary file types
git-svn-id: http://svn.miranda-ng.org/main/trunk@13927 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/JabberG/src/jabber.cpp16
-rw-r--r--protocols/JabberG/src/jabber_misc.cpp2
2 files changed, 14 insertions, 4 deletions
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp
index a309320cb7..92b8c8872f 100644
--- a/protocols/JabberG/src/jabber.cpp
+++ b/protocols/JabberG/src/jabber.cpp
@@ -235,11 +235,19 @@ extern "C" int __declspec(dllexport) Unload(void)
DestroyHookableEvent(hDiscoInfoResult);
if (g_nTempFileId != 0) {
- TCHAR tszTempPath[MAX_PATH], tszTempFile[MAX_PATH];
+ TCHAR tszTempPath[MAX_PATH], tszFilePath[MAX_PATH];
GetTempPath(_countof(tszTempPath), tszTempPath);
- for (unsigned i = 1; i <= g_nTempFileId; i++) {
- GetTempFileName(tszTempPath, _T("jab"), i, tszTempFile);
- DeleteFile(tszTempFile);
+ mir_sntprintf(tszFilePath, _countof(tszFilePath), _T("%sjab*.tmp.*"), tszTempPath);
+
+ WIN32_FIND_DATA findData;
+ HANDLE hFind = FindFirstFile(tszFilePath, &findData);
+ if (hFind != INVALID_HANDLE_VALUE) {
+ do {
+ mir_sntprintf(tszFilePath, _countof(tszFilePath), _T("%s%s"), tszTempPath, findData.cFileName);
+ DeleteFile(tszFilePath);
+ } while (FindNextFile(hFind, &findData));
+
+ FindClose(hFind);
}
}
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp
index 21c686a724..06ddbe27ee 100644
--- a/protocols/JabberG/src/jabber_misc.cpp
+++ b/protocols/JabberG/src/jabber_misc.cpp
@@ -526,6 +526,8 @@ CMString CJabberProto::ExtractImage(HXML node)
TCHAR tszTempPath[MAX_PATH], tszTempFile[MAX_PATH];
GetTempPath(_countof(tszTempPath), tszTempPath);
GetTempFileName(tszTempPath, _T("jab"), InterlockedIncrement(&g_nTempFileId), tszTempFile);
+ _tcsncat_s(tszTempFile, _T("."), 1);
+ _tcsncat_s(tszTempFile, image, image.GetLength());
HANDLE h = CreateFile(tszTempFile, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS,