summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--updater/extern.cpp67
-rw-r--r--updater/scan.cpp7
-rw-r--r--updater/services.cpp1
-rw-r--r--updater/updater_9.vcproj1
-rw-r--r--updater/version.h2
5 files changed, 45 insertions, 33 deletions
diff --git a/updater/extern.cpp b/updater/extern.cpp
index 4e73301..48b1e94 100644
--- a/updater/extern.cpp
+++ b/updater/extern.cpp
@@ -208,71 +208,86 @@ void MoveFiles(HANDLE hLogFile, TCHAR *src_folder, TCHAR *dst_folder, TCHAR *bac
WIN32_FIND_DATA findData;
HANDLE hFileSearch = FindFirstFile(szFilesPath, &findData);
- if(hFileSearch != INVALID_HANDLE_VALUE)
+ if (hFileSearch != INVALID_HANDLE_VALUE)
{
- do {
- if(findData.cFileName[0] != _T('.')) {
+ do
+ {
+ if (findData.cFileName[0] != '.')
+ {
_sntprintf(szOldFileName, SIZEOF(szOldFileName), _T("%s\\%s"), src_folder, findData.cFileName);
szOldFileName[SIZEOF(szOldFileName) - 1] = 0;
- if(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
+ if(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ {
// use szNewFileName as destination and new root folder
- _tcscpy(szNewFileName, root_folder);
- if (_tcslen(findData.cFileName) < _tcslen(ROOT_FILES_FOLDER) || _tcsicmp(findData.cFileName, ROOT_FILES_FOLDER)) {
- _tcscat(szNewFileName, _T("\\"));
- _tcscat(szNewFileName, findData.cFileName);
+ if (_tcslen(findData.cFileName) < SIZEOF(ROOT_FILES_FOLDER) - 1 || _tcsicmp(findData.cFileName, ROOT_FILES_FOLDER))
+ {
+ _sntprintf(szNewFileName, SIZEOF(szNewFileName), _T("%s\\%s"), root_folder, findData.cFileName);
+ szNewFileName[SIZEOF(szNewFileName) - 1] = 0;
}
+ else
+ _tcscpy(szNewFileName, root_folder);
// recurse
MoveFiles(hLogFile, szOldFileName, szNewFileName, backup_folder, szNewFileName);
- } else {
- _tcscpy(szNewFileName, dst_folder);
-
+ }
+ else
+ {
// exception for langpack files - move to root_folder
// exception for dbtool.exe (e.g. translated) - move to root_folder
if((_tcsnicmp(findData.cFileName, _T("dbtool.exe"), _tcslen(_T("dbtool.exe"))) == 0)
|| (_tcsnicmp(findData.cFileName, _T("langpack_"), _tcslen(_T("langpack_"))) == 0))
{
- _tcscpy(szNewFileName, root_folder);
+ _sntprintf(szNewFileName, SIZEOF(szNewFileName), _T("%s\\%s"), root_folder, findData.cFileName);
+ szNewFileName[SIZEOF(szNewFileName) - 1] = 0;
+ }
+ else
+ {
+ _sntprintf(szNewFileName, SIZEOF(szNewFileName), _T("%s\\%s"), dst_folder, findData.cFileName);
+ szNewFileName[SIZEOF(szNewFileName) - 1] = 0;
}
-
- _tcscat(szNewFileName, _T("\\"));
- _tcscat(szNewFileName, findData.cFileName);
move_file = false;
- if(do_backups) {
- _sntprintf(szBackupFileName, SIZEOF(szBackupFileName), _T("%s\\%s"),
- backup_folder, findData.cFileName);
+ if (do_backups)
+ {
+ _sntprintf(szBackupFileName, SIZEOF(szBackupFileName), _T("%s\\%s"), backup_folder, findData.cFileName);
szBackupFileName[SIZEOF(szBackupFileName) - 1] = 0;
move_file = true;
DeleteFile(szBackupFileName);
- if(!MoveFile(szNewFileName, szBackupFileName)) {
+ if(!MoveFile(szNewFileName, szBackupFileName))
+ {
// MessageBox(0, szNewFileName, "Could not backup!", MB_OK | MB_ICONWARNING);
}
- } else {
+ }
+ else
+ {
move_file = true;
- if(!DeleteFile(szNewFileName)) {
+ if (!DeleteFile(szNewFileName))
+ {
// MessageBox(0, szNewFileName, "Could not delete!", MB_OK | MB_ICONWARNING);
}
}
- if(move_file) {
- if(!MoveFile(szOldFileName, szNewFileName)) {
+ if (move_file)
+ {
+ if (!MoveFile(szOldFileName, szNewFileName))
+ {
//MessageBox(0, szOldFileName, "Could not move!", MB_OK | MB_ICONWARNING);
// try a copy - possibly win98 etc. will not move the updater.dll when it is being used by this process
CopyFile(szOldFileName, szNewFileName, TRUE);
DeleteFile(szOldFileName); // docs say it is marked for delete and actually removed when the last handle is closed...hmm
}
- } else {
+ }
+ else
DeleteFile(szOldFileName);
- }
}
}
- } while(FindNextFile(hFileSearch, &findData));
+ }
+ while(FindNextFile(hFileSearch, &findData));
FindClose(hFileSearch);
}
diff --git a/updater/scan.cpp b/updater/scan.cpp
index ff86172..8c25c6b 100644
--- a/updater/scan.cpp
+++ b/updater/scan.cpp
@@ -53,7 +53,7 @@ void ScanPlugins(FilenameMap *fn_map, UpdateList *update_list)
DWORD mirandaVersion = (DWORD)CallService(MS_SYSTEM_GETVERSION, 0, 0);
PLUGININFO *pluginInfo;
- GetModuleFileName(0, mir_exe, MAX_PATH);
+ GetModuleFileName(NULL, mir_exe, MAX_PATH);
// get plugin folder
_tcscpy(plugins_folder, mir_exe);
@@ -194,11 +194,10 @@ void ScanLangpacks(FilenameMap *fn_map, UpdateList *update_list)
TCHAR mir_folder[MAX_PATH], langpack_path[MAX_PATH], *langpack_name;
- GetModuleFileName(0, mir_folder, MAX_PATH);
+ GetModuleFileName(NULL, mir_folder, MAX_PATH);
// get program folder
- TCHAR *p = _tcsrchr(mir_folder, _T('\\'));
- if(p) *p = 0;
+ TCHAR *p = _tcsrchr(mir_folder, '\\'); if(p) *p = 0;
_tcscat(mir_folder, _T("\\"));
_tcscpy(langpack_path, mir_folder);
diff --git a/updater/services.cpp b/updater/services.cpp
index 76f39b2..309f3d8 100644
--- a/updater/services.cpp
+++ b/updater/services.cpp
@@ -44,7 +44,6 @@ bool DownloadUpdates(UpdateList &todo, FilenameMap *map, bool dlls_only) {
PostMessage(hwndProgress, WM_SETTEXT, 0, (LPARAM)TranslateT("Progress - Downloading updates..."));
PostMessage(hwndProgress, WMU_SETMESSAGE, (WPARAM)TranslateT("Downloading"), 0);
-
}
TCHAR msg[512];
diff --git a/updater/updater_9.vcproj b/updater/updater_9.vcproj
index 7eea5c0..a6952e5 100644
--- a/updater/updater_9.vcproj
+++ b/updater/updater_9.vcproj
@@ -78,7 +78,6 @@
Name="VCLinkerTool"
AdditionalDependencies="comctl32.lib zlib.lib"
OutputFile="c:\miranda im 32\plugins\$(ProjectName).dll"
- LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="zbin/x32"
ModuleDefinitionFile="updater.def"
diff --git a/updater/version.h b/updater/version.h
index 54f7e5e..78e1c41 100644
--- a/updater/version.h
+++ b/updater/version.h
@@ -5,7 +5,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 6
#define __RELEASE_NUM 0
-#define __BUILD_NUM 7
+#define __BUILD_NUM 8
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM