diff --git a/core/errorhelper.cpp b/core/errorhelper.cpp index dfad37848..381b458ac 100644 --- a/core/errorhelper.cpp +++ b/core/errorhelper.cpp @@ -12,7 +12,7 @@ #endif #if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) -extern void writeToAppLogFile(QString logText); +extern void writeToAppLogFile(const std::string &logText); #endif int verbose; @@ -26,7 +26,7 @@ void report_info(const char *fmt, ...) LOG_MSG("INFO: %s\n", s.c_str()); #if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) - writeToAppLogFile(s.c_str()); + writeToAppLogFile(s); #endif } @@ -41,7 +41,7 @@ int report_error(const char *fmt, ...) LOG_MSG("ERROR: %s\n", s.c_str()); #if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) - writeToAppLogFile(s.c_str()); + writeToAppLogFile(s); #endif /* if there is no error callback registered, don't produce errors */ diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index b7f7f597f..d1e1af4c7 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -1849,20 +1849,20 @@ void QMLManager::setBtEnabled(bool value) #if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) -void writeToAppLogFile(QString logText) +void writeToAppLogFile(const std::string &logText) { // write to storage and flush so that the data doesn't get lost - logText.append("\n"); QMLManager *self = QMLManager::instance(); if (self) { self->writeToAppLogFile(logText); } } -void QMLManager::writeToAppLogFile(QString logText) +void QMLManager::writeToAppLogFile(const std::string &logText) { if (appLogFileOpen) { - appLogFile.write(qPrintable(logText)); + std::string line = logText + "\n"; + appLogFile.write(line.c_str()); appLogFile.flush(); } } diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h index b93bf6b80..857d36801 100644 --- a/mobile-widgets/qmlmanager.h +++ b/mobile-widgets/qmlmanager.h @@ -167,7 +167,7 @@ public: QObject *qmlWindow; #if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) - void writeToAppLogFile(QString logText); + void writeToAppLogFile(const std::string &logText); #endif qPrefCloudStorage::cloud_status oldStatus() const; void setOldStatus(const qPrefCloudStorage::cloud_status value);