diff options
| author | George Hazan <george.hazan@gmail.com> | 2012-09-29 15:16:55 +0000 |
|---|---|---|
| committer | George Hazan <george.hazan@gmail.com> | 2012-09-29 15:16:55 +0000 |
| commit | 1efd80007f65b4676c6c84dc8212d43ec190a311 (patch) | |
| tree | 7e4675007a474c08fde6d8889f6324614872cd6b /tools/IM-NG Updater/src/Utils.cpp | |
| parent | 90f539947aa80022249fd73cc6d72f568803e80b (diff) | |
adaptation for Miranda IM
git-svn-id: http://svn.miranda-ng.org/main/trunk@1723 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'tools/IM-NG Updater/src/Utils.cpp')
| -rw-r--r-- | tools/IM-NG Updater/src/Utils.cpp | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/tools/IM-NG Updater/src/Utils.cpp b/tools/IM-NG Updater/src/Utils.cpp index 1886d02c01..be22f745e4 100644 --- a/tools/IM-NG Updater/src/Utils.cpp +++ b/tools/IM-NG Updater/src/Utils.cpp @@ -128,7 +128,7 @@ BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) DWORD dwBytes;
NETLIBHTTPREQUEST nlhr = {0};
- nlhr.cbSize = sizeof(nlhr);
+ nlhr.cbSize = NETLIBHTTPREQUEST_V1_SIZE;
nlhr.requestType = REQUEST_GET;
nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11;
char* szUrl = mir_t2a(tszURL);
@@ -164,13 +164,9 @@ BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) return ret;
}
-void __stdcall ExitMe(void*)
-{
- CallService("CloseAction", 0, 0);
-}
-
void __stdcall RestartMe(void*)
{
+ CallService("CloseAction", 0, 0);
CallService(MS_SYSTEM_RESTART, 0, 0);
}
@@ -227,3 +223,31 @@ void InitTimer() SetWaitableTimer(Timer, &li, interval, TimerAPCProc, NULL, 0);
}
}
+
+char* rtrim(char* str)
+{
+ if (str == NULL)
+ return NULL;
+
+ char* p = strchr(str, 0);
+ while (--p >= str) {
+ switch (*p) {
+ case ' ': case '\t': case '\n': case '\r':
+ *p = 0; break;
+ default:
+ return str;
+ }
+ }
+ return str;
+}
+
+void CreatePathToFileT(TCHAR* szFilePath)
+{
+ TCHAR* pszLastBackslash = _tcsrchr(szFilePath, '\\');
+ if (pszLastBackslash == NULL)
+ return;
+
+ *pszLastBackslash = '\0';
+ CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)szFilePath);
+ *pszLastBackslash = '\\';
+}
|
