summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorStephan Bergmann <stephan.bergmann@allotropia.de>2024-05-30 13:36:49 +0200
committerStephan Bergmann <stephan.bergmann@allotropia.de>2024-05-31 07:59:17 +0200
commit253bd05e95ae5093e61a4685a9d28f31edc6f585 (patch)
tree15478789661ef1c722a21c260de1fae9c50cba2e /desktop
parent858e9e48ac2439ddc1eebab14d76b493bed352ed (diff)
Consolidate on a single Updater::log overload
Change-Id: Id812788f30ac4a327d450255cfe19181c69ae81e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168257 Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de> Tested-by: Jenkins
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/app/updater.cxx34
-rw-r--r--desktop/source/app/updater.hxx2
2 files changed, 9 insertions, 27 deletions
diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx
index 12bb4969a68c..676cc54f148e 100644
--- a/desktop/source/app/updater.cxx
+++ b/desktop/source/app/updater.cxx
@@ -29,7 +29,9 @@
#include <unotools/tempfile.hxx>
#include <unotools/configmgr.hxx>
#include <o3tl/char16_t2wchar_t.hxx>
+#include <o3tl/runtimetooustring.hxx>
#include <osl/file.hxx>
+#include <osl/thread.h>
#include <rtl/process.h>
#include <sal/log.hxx>
#include <tools/stream.hxx>
@@ -553,7 +555,7 @@ size_t WriteCallbackFile(void *ptr, size_t size,
std::string download_content(const OString& rURL, bool bFile, OUString& rHash)
{
- Updater::log("Download: " + rURL);
+ Updater::log("Download: " + OStringToOUString(rURL, osl_getThreadTextEncoding()));
std::unique_ptr<CURL, std::function<void(CURL *)>> curl(
curl_easy_init(), [](CURL * p) { curl_easy_cleanup(p); });
@@ -729,7 +731,7 @@ void update_checker()
OUString aDownloadCheckURL = aDownloadCheckBaseURL + "update/check/1/" + aProductName +
"/" + aBuildID + "/" + aBuildTarget + "/" + aChannel;
OString aURL = OUStringToOString(aDownloadCheckURL, RTL_TEXTENCODING_UTF8);
- Updater::log("Update check: " + aURL);
+ Updater::log("Update check: " + OStringToOUString(aURL, osl_getThreadTextEncoding()));
try
{
@@ -779,27 +781,27 @@ void update_checker()
catch (const invalid_update_info&)
{
SAL_WARN("desktop.updater", "invalid update information");
- Updater::log(OString("warning: invalid update info"));
+ Updater::log("warning: invalid update info");
}
catch (const error_updater& e)
{
SAL_WARN("desktop.updater", "error during the update check: " << e.what());
- Updater::log(OString("warning: error by the updater") + e.what());
+ Updater::log("warning: error by the updater" + o3tl::runtimeToOUString(e.what()));
}
catch (const invalid_size& e)
{
SAL_WARN("desktop.updater", e.what());
- Updater::log(OString("warning: invalid size"));
+ Updater::log("warning: invalid size");
}
catch (const invalid_hash& e)
{
SAL_WARN("desktop.updater", e.what());
- Updater::log(OString("warning: invalid hash"));
+ Updater::log("warning: invalid hash");
}
catch (...)
{
SAL_WARN("desktop.updater", "unknown error during the update check");
- Updater::log(OString("warning: unknown exception"));
+ Updater::log("warning: unknown exception");
}
}
@@ -849,24 +851,6 @@ void Updater::log(const OUString& rMessage)
aLog.WriteLine(OUStringToOString(rMessage, RTL_TEXTENCODING_UTF8));
}
-void Updater::log(const OString& rMessage)
-{
- SAL_INFO("desktop.updater", rMessage);
- OUString aUpdateLog = getUpdateInfoLog();
- SvFileStream aLog(aUpdateLog, StreamMode::STD_READWRITE);
- aLog.Seek(aLog.Tell() + aLog.remainingSize()); // make sure we are at the end
- aLog.WriteLine(rMessage);
-}
-
-void Updater::log(const char* pMessage)
-{
- SAL_INFO("desktop.updater", pMessage);
- OUString aUpdateLog = getUpdateInfoLog();
- SvFileStream aLog(aUpdateLog, StreamMode::STD_READWRITE);
- aLog.Seek(aLog.Tell() + aLog.remainingSize()); // make sure we are at the end
- aLog.WriteOString(pMessage);
-}
-
OUString Updater::getBuildID()
{
OUString aBuildID("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("version") ":buildid}");
diff --git a/desktop/source/app/updater.hxx b/desktop/source/app/updater.hxx
index 7f1ea920fbe9..2ab4d4ea8eae 100644
--- a/desktop/source/app/updater.hxx
+++ b/desktop/source/app/updater.hxx
@@ -28,8 +28,6 @@ public:
static OUString getUpdateChannel();
static void log(const OUString& rMessage);
- static void log(const OString& rMessage);
- static void log(const char* pMessage);
static void removeUpdateFiles();
};