From c2c8016a4f56b10299b279c64370e304265e7c3b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 30 Sep 2012 11:50:38 +0000 Subject: source code unification git-svn-id: http://svn.miranda-ng.org/main/trunk@1726 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/PluginUpdater/src/Utils.cpp | 44 ++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 8 deletions(-) (limited to 'plugins/PluginUpdater/src/Utils.cpp') diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index 1886d02c01..737df21960 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -19,12 +19,10 @@ Boston, MA 02111-1307, USA. #include "Common.h" -//vector Files; BOOL DlgDld; int Number = 0; TCHAR tszDialogMsg[2048] = {0}; FILEINFO* pFileInfo = NULL; -//FILEURL* pFileUrl = NULL; HANDLE CheckThread = NULL, hNetlibUser = NULL; POPUP_OPTIONS PopupOptions = {0}; aPopups PopupsList[POPUPS]; @@ -128,7 +126,11 @@ BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) DWORD dwBytes; NETLIBHTTPREQUEST nlhr = {0}; - nlhr.cbSize = sizeof(nlhr); + #if MIRANDA_VER < 0x0A00 + nlhr.cbSize = NETLIBHTTPREQUEST_V1_SIZE; + #else + nlhr.cbSize = sizeof(nlhr); + #endif nlhr.requestType = REQUEST_GET; nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11; char* szUrl = mir_t2a(tszURL); @@ -164,13 +166,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 +225,33 @@ void InitTimer() SetWaitableTimer(Timer, &li, interval, TimerAPCProc, NULL, 0); } } + +#if MIRANDA_VER < 0x0A00 +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 = '\\'; +} +#endif -- cgit v1.2.3