From 667ded1639b12b365a009441677d6962642bd914 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 28 Feb 2024 13:15:21 +0300 Subject: code cleaning --- plugins/AVS/src/services.cpp | 24 ++++++++++++------------ plugins/AVS/src/userInfo.cpp | 4 ++-- plugins/AVS/src/utils.cpp | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'plugins') diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp index 11636abe8d..56219f6a70 100644 --- a/plugins/AVS/src/services.cpp +++ b/plugins/AVS/src/services.cpp @@ -337,13 +337,13 @@ void SaveImage(SaveProtocolData &d, char *protocol, int format) return; if (d.max_size != 0 && GetFileSize(d.image_file_name) > d.max_size) { - DeleteFile(d.image_file_name); + DeleteFileW(d.image_file_name); if (format == PA_FORMAT_JPEG) { // Try with lower quality if (!BmpFilterSaveBitmap(d.hBmpProto, d.image_file_name, JPEG_QUALITYGOOD)) { if (GetFileSize(d.image_file_name) > d.max_size) { - DeleteFile(d.image_file_name); + DeleteFileW(d.image_file_name); d.need_smaller_size = TRUE; } else d.saved = TRUE; @@ -365,14 +365,14 @@ static int SetProtoMyAvatar(char *protocol, HBITMAP hBmp, const wchar_t *origina if (!Proto_IsAvatarFormatSupported(protocol, PA_FORMAT_SWF)) return -1; - return CallProtoService(protocol, PS_SETMYAVATAR, (LPARAM)originalFilename); + return CallProtoService(protocol, PS_SETMYAVATAR, 0, (LPARAM)originalFilename); } if (originalFormat == PA_FORMAT_XML) { if (!Proto_IsAvatarFormatSupported(protocol, PA_FORMAT_XML)) return -1; - return CallProtoService(protocol, PS_SETMYAVATAR, (LPARAM)originalFilename); + return CallProtoService(protocol, PS_SETMYAVATAR, 0, (LPARAM)originalFilename); } // Get protocol info @@ -396,7 +396,7 @@ static int SetProtoMyAvatar(char *protocol, HBITMAP hBmp, const wchar_t *origina if (d.hBmpProto == nullptr) { if (d.temp_file[0] != '\0') - DeleteFile(d.temp_file); + DeleteFileW(d.temp_file); return -1; } @@ -405,17 +405,16 @@ static int SetProtoMyAvatar(char *protocol, HBITMAP hBmp, const wchar_t *origina && Proto_IsAvatarFormatSupported(protocol, originalFormat) && (d.max_size == 0 || GetFileSize(originalFilename) < d.max_size)) { if (d.temp_file[0] != '\0') - DeleteFile(d.temp_file); + DeleteFileW(d.temp_file); // Use original image - return CallProtoService(protocol, PS_SETMYAVATAR, (LPARAM)originalFilename); + return CallProtoService(protocol, PS_SETMYAVATAR, 0, (LPARAM)originalFilename); } // Create a temporary file (if was not created already) if (d.temp_file[0] == '\0') { d.temp_file[0] = '\0'; - if (GetTempPath(MAX_PATH, d.temp_file) == 0 - || GetTempFileName(d.temp_file, L"mir_av_", 0, d.temp_file) == 0) { + if (GetTempPathW(MAX_PATH, d.temp_file) == 0 || GetTempFileNameW(d.temp_file, L"mir_av_", 0, d.temp_file) == 0) { DeleteObject(d.hBmpProto); return -1; } @@ -455,13 +454,14 @@ static int SetProtoMyAvatar(char *protocol, HBITMAP hBmp, const wchar_t *origina if (d.saved) { // Call proto service - ret = CallProtoService(protocol, PS_SETMYAVATAR, (LPARAM)d.image_file_name); - DeleteFileW(d.image_file_name); + ret = CallProtoService(protocol, PS_SETMYAVATAR, 0, (LPARAM)d.image_file_name); + if (ret != -1) + DeleteFileW(d.image_file_name); } else ret = -1; if (d.temp_file[0] != '\0') - DeleteFile(d.temp_file); + DeleteFileW(d.temp_file); if (d.hBmpProto != hBmp) DeleteObject(d.hBmpProto); diff --git a/plugins/AVS/src/userInfo.cpp b/plugins/AVS/src/userInfo.cpp index 3b7a4bd129..a77064079c 100644 --- a/plugins/AVS/src/userInfo.cpp +++ b/plugins/AVS/src/userInfo.cpp @@ -203,7 +203,7 @@ public: if (MessageBox(nullptr, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) { DBVARIANT dbv = { 0 }; if (!db_get_ws(m_hContact, "ContactPhoto", "File", &dbv)) { - DeleteFile(dbv.pwszVal); + DeleteFileW(dbv.pwszVal); db_free(&dbv); } } @@ -226,7 +226,7 @@ public: if (MessageBoxW(nullptr, TranslateT("Delete picture file from disk (may be necessary to force a reload, but will delete local pictures)?"), TranslateT("Reset contact picture"), MB_YESNO) == IDYES) { DBVARIANT dbv = { 0 }; if (!db_get_ws(m_hContact, "ContactPhoto", "File", &dbv)) { - DeleteFile(dbv.pwszVal); + DeleteFileW(dbv.pwszVal); db_free(&dbv); } } diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp index 9daf048db9..6c27f50af3 100644 --- a/plugins/AVS/src/utils.cpp +++ b/plugins/AVS/src/utils.cpp @@ -440,7 +440,7 @@ void DeleteGlobalUserAvatar() wchar_t szFilename[MAX_PATH]; MyPathToAbsolute(wszPath, szFilename); - DeleteFile(szFilename); + DeleteFileW(szFilename); g_plugin.delSetting("GlobalUserAvatarFile"); } -- cgit v1.2.3