From ce94b1c354101242da5f408b822c667f669e5abe Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> Date: Sat, 10 Apr 2010 15:54:56 +0000 Subject: Updated MiniZip to version 1.1 That added support for Unicode files and more compression options git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@505 4f64403b-2f21-0410-a795-97e2b3489a10 --- updater/socket.cpp | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) (limited to 'updater/socket.cpp') diff --git a/updater/socket.cpp b/updater/socket.cpp index 94a52da..0cbe2cd 100644 --- a/updater/socket.cpp +++ b/updater/socket.cpp @@ -1,9 +1,7 @@ #include "common.h" #include "socket.h" - -void ShowAndLogError(TCHAR *message) { -} +void unzip_file(TCHAR* zipfile, TCHAR* dest); bool GetFile(char *url, TCHAR *temp_folder, char *plugin_name, char *version, bool dlls_only, int recurse_count /*=0*/) { if(recurse_count > MAX_REDIRECT_RECURSE) { @@ -34,12 +32,11 @@ bool GetFile(char *url, TCHAR *temp_folder, char *plugin_name, char *version, bo return false; } - _tcscpy(save_file, temp_folder); - _tcscat(save_file, _T("\\")); TCHAR *temp_str = GetTString(plugin_name); - _tcscat(save_file, temp_str); + mir_sntprintf(save_file, SIZEOF(save_file), _T("%s\\%s"), temp_folder, temp_str); mir_free(temp_str); - if(version) { + if (version) + { temp_str = GetTString(version); _tcscat(save_file, _T("_")); _tcscat(save_file, temp_str); @@ -97,24 +94,19 @@ bool GetFile(char *url, TCHAR *temp_folder, char *plugin_name, char *version, bo CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp); resp = 0; - if(ext && *ext && strcmp(ext, ".zip") == 0) { - - if(!options.no_unzip) { - char *ans_save_file = mir_t2a(save_file), *ans_temp_folder = mir_t2a(temp_folder); - //MessageBoxA(0, ans_temp_folder, ans_save_file, MB_OK); - unzip_file(ans_save_file, ans_temp_folder); - mir_free(ans_save_file); - mir_free(ans_temp_folder); - } + if(ext && *ext && strcmp(ext, ".zip") == 0) + { + if(!options.no_unzip) + unzip_file(save_file, temp_folder); - if(options.save_zips) { + if(options.save_zips) + { TCHAR save_archive[MAX_PATH]; - _tcscpy(save_archive, options.zip_folder); - _tcscat(save_archive, _T("\\")); - _tcscat(save_archive, save_file + _tcslen(temp_folder) + 1); + mir_sntprintf(save_archive, SIZEOF(save_archive), _T("%s%s"), options.zip_folder, _tcsrchr(save_file, '\\')); DeleteFile(save_archive); - if(!MoveFile(save_file, save_archive)) { + if (!MoveFile(save_file, save_archive)) + { char buff[128]; mir_snprintf(buff, SIZEOF(buff), "GetFile: could not move file, code: %u", GetLastError()); NLog(buff); -- cgit v1.2.3