From 7cc4b62b028e1a56a4b11e361288ac330a2ce40c Mon Sep 17 00:00:00 2001 From: Arkadiusz Pietraszek Date: Thu, 19 Oct 2017 19:02:47 +0200 Subject: [PATCH] [Common] Fixing expectation of datatypes warnings in Logger methods Either formats %_ corrected to expect correct datatype or dytatype casting while passing it to Logger method. [Verification] Code compiles without warnings regarding datatypes passed to Logger methods. Change-Id: I8bf50728aee0c09b4b998614f3854972ef178aa5 Signed-off-by: Arkadiusz Pietraszek --- src/archive/archive_callback_data.cc | 2 +- src/archive/archive_file.cc | 4 +- src/archive/archive_instance.cc | 2 +- src/archive/filesystem_node.cc | 4 +- src/archive/un_zip.cc | 4 +- src/archive/un_zip_extract_request.cc | 4 +- src/archive/zip_add_request.cc | 8 ++-- src/common/GDBus/proxy.cpp | 2 +- src/common/extension.cc | 2 +- src/common/filesystem/filesystem_storage.cc | 6 +-- src/common/filter-utils.cc | 4 +- src/common/platform_result.cc | 2 +- src/common/tools.cc | 2 +- src/datacontrol/datacontrol_instance.cc | 2 +- src/download/download_instance.cc | 2 +- src/exif/exif_gps_location.cc | 2 +- src/exif/exif_information.cc | 4 +- src/exif/exif_util.cc | 2 +- src/exif/jpeg_file.cc | 40 +++++++++---------- src/exif/rational.cc | 6 +-- src/filesystem/filesystem_file.cc | 8 ++-- .../systeminfo_properties_manager.cc | 8 ++-- 22 files changed, 60 insertions(+), 60 deletions(-) diff --git a/src/archive/archive_callback_data.cc b/src/archive/archive_callback_data.cc index 450d9c0f..7c09c59f 100644 --- a/src/archive/archive_callback_data.cc +++ b/src/archive/archive_callback_data.cc @@ -591,7 +591,7 @@ void ExtractAllProgressCallback::updateOverallProgress(unsigned long bytes_decom m_progress_overall = static_cast(m_overall_decompressed + m_files_extracted) / static_cast(m_expected_decompressed_size + m_files_to_extract); - LoggerD("%s of %s - %f%% (%d/%d files)", bytesToReadableString(m_overall_decompressed).c_str(), + LoggerD("%s of %s - %f%% (%lu/%lu files)", bytesToReadableString(m_overall_decompressed).c_str(), bytesToReadableString(m_expected_decompressed_size).c_str(), m_progress_overall * 100.0, m_files_extracted, m_files_to_extract); } diff --git a/src/archive/archive_file.cc b/src/archive/archive_file.cc index f52da91a..18edb2cc 100644 --- a/src/archive/archive_file.cc +++ b/src/archive/archive_file.cc @@ -106,7 +106,7 @@ gboolean ArchiveFile::openTaskCompleteCB(void* data) { std::string fm_str; PlatformResult result = fileModeToString(archive_file->getFileMode(), &fm_str); if (result.error_code() != ErrorCode::NO_ERROR) { - LoggerE("%s (%d)", result.message().c_str(), result.error_code()); + LoggerE("%s (%d)", result.message().c_str(), static_cast(result.error_code())); delete callback; callback = NULL; return false; @@ -204,7 +204,7 @@ void ArchiveFile::taskManagerThread(gpointer data, gpointer user_data) { delete callback; callback = NULL; } else if (ErrorCode::NO_ERROR != result.error_code()) { - LoggerE("taskManagerThread fails, %d: %s", result.error_code(), result.message().c_str()); + LoggerE("taskManagerThread fails, %d: %s", static_cast(result.error_code()), result.message().c_str()); callback->setError(result.error_code(), result.message().c_str()); if (!g_idle_add(callErrorCallback, static_cast(callback))) { LoggerE("g_idle_add fails"); diff --git a/src/archive/archive_instance.cc b/src/archive/archive_instance.cc index 6c26eda0..b2c324c5 100644 --- a/src/archive/archive_instance.cc +++ b/src/archive/archive_instance.cc @@ -85,7 +85,7 @@ ArchiveInstance::~ArchiveInstance() { void ArchiveInstance::PostError(const PlatformResult& e, double callback_id) { LoggerD("Entered"); - LoggerE("Posting an error: %d, message: %s", e.error_code(), e.message().c_str()); + LoggerE("Posting an error: %d, message: %s", static_cast(e.error_code()), e.message().c_str()); picojson::value val = picojson::value(picojson::object()); picojson::object& obj = val.get(); diff --git a/src/archive/filesystem_node.cc b/src/archive/filesystem_node.cc index ee782666..27ee2e0c 100644 --- a/src/archive/filesystem_node.cc +++ b/src/archive/filesystem_node.cc @@ -132,7 +132,7 @@ PlatformResult Node::resolve(const PathPtr& path, NodePtr* node) { } } - if ((!S_ISDIR(info.st_mode)) & (!S_ISREG(info.st_mode)) && !S_ISLNK(info.st_mode)) { + if ((!S_ISDIR(info.st_mode)) && (!S_ISREG(info.st_mode)) && !S_ISLNK(info.st_mode)) { SLoggerE("File: [%s]", path->getFullPath().c_str()); return LogAndCreateResult(ErrorCode::IO_ERR, "Platform node is of unsupported type."); } @@ -550,7 +550,7 @@ PlatformResult Node::removeAsDirectory(const PathPtr& path, bool recursive) { platform_result = removeAsFile(subPath); } if (platform_result.error_code() != ErrorCode::NO_ERROR) { - LoggerE("Fail: getFullPath() (%d)", platform_result.error_code()); + LoggerE("Fail: getFullPath() (%d)", static_cast(platform_result.error_code())); closedir(dir); return platform_result; } diff --git a/src/archive/un_zip.cc b/src/archive/un_zip.cc index de34b5f6..4a603de7 100644 --- a/src/archive/un_zip.cc +++ b/src/archive/un_zip.cc @@ -125,7 +125,7 @@ PlatformResult UnZip::listEntries(unsigned long* decompressedSize, ("ret: %d", err)); } - LoggerD("file: %s | unc size: %d | comp size: %d", filename_inzip, file_info.uncompressed_size, + LoggerD("file: %s | unc size: %lu | comp size: %lu", filename_inzip, file_info.uncompressed_size, file_info.compressed_size); ArchiveFileEntryPtr entry = ArchiveFileEntryPtr(new ArchiveFileEntry()); @@ -444,7 +444,7 @@ PlatformResult UnZip::updateCallbackWithArchiveStatistics(ExtractAllProgressCall bytesToReadableString(astats.uncompressed_size).c_str()); callback->setNumberOfFilesToExtract(astats.number_of_files); - LoggerD("Number entries to extract: files: %d folders: %d", astats.number_of_files, + LoggerD("Number entries to extract: files: %lu folders: %lu", astats.number_of_files, astats.number_of_folders); return PlatformResult(ErrorCode::NO_ERROR); diff --git a/src/archive/un_zip_extract_request.cc b/src/archive/un_zip_extract_request.cc index e3b7adb4..cbe12b52 100644 --- a/src/archive/un_zip_extract_request.cc +++ b/src/archive/un_zip_extract_request.cc @@ -234,7 +234,7 @@ PlatformResult UnZipExtractRequest::getCurrentFileInfo() { m_output_filepath = removeDuplicatedSlashesFromPath(m_extract_path + "/" + file_path); - LoggerD("Packed: [%s], uncompressed_size: %d, will extract to: [%s]", m_filename_inzip, + LoggerD("Packed: [%s], uncompressed_size: %lu, will extract to: [%s]", m_filename_inzip, m_file_info.uncompressed_size, m_output_filepath.c_str()); std::string path, name; @@ -399,7 +399,7 @@ PlatformResult UnZipExtractRequest::handleFileEntry() { bool marked_as_finished = false; - LoggerD("Started extracting: [%s] uncompressed size: %d - %s", m_filename_inzip, + LoggerD("Started extracting: [%s] uncompressed size: %lu - %s", m_filename_inzip, m_file_info.uncompressed_size, bytesToReadableString(m_file_info.uncompressed_size).c_str()); diff --git a/src/archive/zip_add_request.cc b/src/archive/zip_add_request.cc index d376d7a1..73bbb841 100644 --- a/src/archive/zip_add_request.cc +++ b/src/archive/zip_add_request.cc @@ -152,7 +152,7 @@ PlatformResult ZipAddRequest::run() { bytesToReadableString(size).c_str()); } - LoggerD("m_files_to_compress: %d", m_files_to_compress); + LoggerD("m_files_to_compress: %lu", m_files_to_compress); LoggerD("m_bytes_to_compress: %llu (%s)", m_bytes_to_compress, bytesToReadableString(m_bytes_to_compress).c_str()); @@ -347,7 +347,7 @@ PlatformResult ZipAddRequest::addToZipArchive(filesystem::NodePtr src_file_node) LoggerD("m_bytes_compressed:%llu / m_bytes_to_compress: %llu", m_bytes_compressed, m_bytes_to_compress); - LoggerD("m_files_compressed:%d / m_files_to_compress: %d", m_files_compressed, + LoggerD("m_files_compressed: %lu / m_files_to_compress: %lu", m_files_compressed, m_files_to_compress); if (src_file_node->getType() == filesystem::NT_FILE) { @@ -402,7 +402,7 @@ PlatformResult ZipAddRequest::addToZipArchive(filesystem::NodePtr src_file_node) LoggerD( "Callculatting overall progress: %llu/%llu bytes; " - "%d/%d files; current file: [%s] progress: %d/%d bytes; ", + "%lu/%lu files; current file: [%s] progress: %d/%d bytes; ", m_bytes_compressed, m_bytes_to_compress, m_files_compressed, m_files_to_compress, src_file_path.c_str(), total_bytes_read, in_file_size); @@ -412,7 +412,7 @@ PlatformResult ZipAddRequest::addToZipArchive(filesystem::NodePtr src_file_node) static_cast(m_bytes_to_compress + m_files_to_compress); } - LoggerD("Wrote: %s total progress: %.2f%% %d/%d files", + LoggerD("Wrote: %s total progress: %.2f%% %lu/%lu files", bytesToReadableString(size_read).c_str(), progress * 100.0, m_files_compressed, m_files_to_compress); diff --git a/src/common/GDBus/proxy.cpp b/src/common/GDBus/proxy.cpp index 936a10e5..86d4d6fa 100644 --- a/src/common/GDBus/proxy.cpp +++ b/src/common/GDBus/proxy.cpp @@ -49,7 +49,7 @@ Proxy::Proxy(const std::string& proxy_path, const std::string& proxy_iface, m_signal_iface.c_str()); const gchar* unique_name = g_dbus_connection_get_unique_name(m_conn.getDBus()); - LoggerD("Generated unique name: %d", unique_name); + LoggerD("Generated unique name: %s", unique_name); // path and interface are not obligatory to receive, but // they should be set to send the signals. diff --git a/src/common/extension.cc b/src/common/extension.cc index 983c73a1..64ec6382 100644 --- a/src/common/extension.cc +++ b/src/common/extension.cc @@ -368,7 +368,7 @@ void ParsedInstance::HandleException(const PlatformException& ex) { } void ParsedInstance::HandleError(const PlatformResult& e) { - LoggerE("Error: %s", static_cast(e.error_code())); + LoggerE("Error: %d", static_cast(e.error_code())); picojson::value result = picojson::value(picojson::object()); ReportError(e, &result.get()); SendSyncReply(result.serialize().c_str()); diff --git a/src/common/filesystem/filesystem_storage.cc b/src/common/filesystem/filesystem_storage.cc index a776e698..9c5354a0 100644 --- a/src/common/filesystem/filesystem_storage.cc +++ b/src/common/filesystem/filesystem_storage.cc @@ -42,7 +42,7 @@ Storage::Storage(int id, StorageType type, StorageState state, std::string const break; default: name_ = "unknown"; - LoggerE("Unknown storage type: %d", type); + LoggerE("Unknown storage type: %d", static_cast(type)); break; } name_ += std::to_string(id); @@ -93,7 +93,7 @@ std::string VirtualRoot::ToString(StorageType type) { case StorageType::kMmc: return "EXTERNAL"; default: - LoggerE("Unknown storage type: %d", type); + LoggerE("Unknown storage type: %d", static_cast(type)); return "UNKNOWN"; } } @@ -108,7 +108,7 @@ std::string VirtualRoot::ToString(StorageState state) { case StorageState::kMounted: return "MOUNTED"; default: - LoggerE("Unknown storage state: %d", state); + LoggerE("Unknown storage state: %d", static_cast(state)); return "UNKNOWN"; } } diff --git a/src/common/filter-utils.cc b/src/common/filter-utils.cc index 9bc7441a..d6cefaf0 100644 --- a/src/common/filter-utils.cc +++ b/src/common/filter-utils.cc @@ -37,7 +37,7 @@ PlatformResult AttributeMatchFlagFromString(const std::string &str, } else if (str == "EXISTS") { *filter_match_flag = AttributeMatchFlag::kExists; } else { - LoggerE("Invalid attribute match string: %i", str.c_str()); + LoggerE("Invalid attribute match string: %s", str.c_str()); return PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid attribute match string!"); } @@ -52,7 +52,7 @@ PlatformResult CompositeFilterTypeFromString(const std::string &str, } else if (str == "INTERSECTION") { *comp_filter_type = CompositeFilterType::kIntersection; } else { - LoggerE("Invalid composite type string: %i", str.c_str()); + LoggerE("Invalid composite type string: %s", str.c_str()); return PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid composite type string!"); } diff --git a/src/common/platform_result.cc b/src/common/platform_result.cc index ec3a50de..7181ee24 100644 --- a/src/common/platform_result.cc +++ b/src/common/platform_result.cc @@ -24,7 +24,7 @@ PlatformResult::PlatformResult(const ErrorCode& error_code, const std::string& m LoggerD("Enter"); if (ErrorCode::NO_ERROR != error_code) { - LoggerE("PlatformResult: %d, message: %s", error_code, message.c_str()); + LoggerE("PlatformResult: %d, message: %s", static_cast(error_code), message.c_str()); } } diff --git a/src/common/tools.cc b/src/common/tools.cc index 588663f4..5afef9aa 100644 --- a/src/common/tools.cc +++ b/src/common/tools.cc @@ -62,7 +62,7 @@ void ReportError(const PlatformException& ex, picojson::object& out) { } void ReportError(const PlatformResult& error, picojson::object* out) { - LoggerE("PlatformResult: %d, message: %s", error.error_code(), error.message().c_str()); + LoggerE("PlatformResult: %d, message: %s", static_cast(error.error_code()), error.message().c_str()); out->insert(std::make_pair("status", picojson::value("error"))); out->insert(std::make_pair("error", error.ToJSON())); } diff --git a/src/datacontrol/datacontrol_instance.cc b/src/datacontrol/datacontrol_instance.cc index dbfaae96..da5e7ceb 100644 --- a/src/datacontrol/datacontrol_instance.cc +++ b/src/datacontrol/datacontrol_instance.cc @@ -174,7 +174,7 @@ static bool SQLColumnValue(result_set_cursor cursor, int columnIndex, picojson:: break; } default: { - LoggerE("%th column is undefined column type", columnIndex); + LoggerE("%d column is undefined column type", columnIndex); return false; } } diff --git a/src/download/download_instance.cc b/src/download/download_instance.cc index 208caae3..c689695a 100644 --- a/src/download/download_instance.cc +++ b/src/download/download_instance.cc @@ -236,7 +236,7 @@ gboolean DownloadInstance::OnProgressChanged(void* user_data) { out["receivedSize"] = picojson::value(static_cast(downCbPtr->received)); out["totalSize"] = picojson::value(static_cast(diPtr->file_size)); - LoggerD("OnProgressChanged for callbackId %d Called: Received: %ld", downCbPtr->callbackId, + LoggerD("OnProgressChanged for callbackId %d Called: Received: %llu", downCbPtr->callbackId, downCbPtr->received); picojson::value v = picojson::value(out); diff --git a/src/exif/exif_gps_location.cc b/src/exif/exif_gps_location.cc index 2426cb05..dce7effb 100644 --- a/src/exif/exif_gps_location.cc +++ b/src/exif/exif_gps_location.cc @@ -76,7 +76,7 @@ std::string GCSPosition::toDebugString() const { } GCSPosition GCSPosition::createFromDouble(double value) { - LoggerD("Entered value:%f"); + LoggerD("Entered value:%f", value); if (value < 0) { LoggerW("Trying to create GCSPosition with double < 0: %f", value); return GCSPosition(); diff --git a/src/exif/exif_information.cc b/src/exif/exif_information.cc index 08f7ed95..e0977505 100644 --- a/src/exif/exif_information.cc +++ b/src/exif/exif_information.cc @@ -698,14 +698,14 @@ PlatformResult ExifInformation::updateAttributesInExifData(ExifData* exif_data) AssertMsg(exif_data, "exif_data is NULL"); if (isSet(EXIF_INFORMATION_ATTRIBUTE_WIDTH)) { - LoggerD("Saving width: %d", getWidth()); + LoggerD("Saving width: %lu", getWidth()); ret = ExifTagSaver::saveToExif(getWidth(), EXIF_TAG_IMAGE_WIDTH, exif_data); if (!ret) { return ret; } } if (isSet(EXIF_INFORMATION_ATTRIBUTE_HEIGHT)) { - LoggerD("Saving height: %d", getHeight()); + LoggerD("Saving height: %lu", getHeight()); ret = ExifTagSaver::saveToExif(getHeight(), EXIF_TAG_IMAGE_LENGTH, exif_data); if (!ret) { return ret; diff --git a/src/exif/exif_util.cc b/src/exif/exif_util.cc index 9f9bc90e..8dd08a42 100644 --- a/src/exif/exif_util.cc +++ b/src/exif/exif_util.cc @@ -323,7 +323,7 @@ size_t ExifUtil::getSizeOfExifFormatType(ExifFormat format) { break; default: - LoggerE("output ExifFormat: %d is not supported!"); + LoggerE("output ExifFormat: %d is not supported!", format); return 0; } diff --git a/src/exif/jpeg_file.cc b/src/exif/jpeg_file.cc index b46ed6e2..a7e6f8ab 100644 --- a/src/exif/jpeg_file.cc +++ b/src/exif/jpeg_file.cc @@ -174,7 +174,7 @@ PlatformResult JpegFile::load(const std::string& path) { if (read_bytes != m_in_data_size) { return LogAndCreateResult( ErrorCode::UNKNOWN_ERR, "Could not read JPEG file", - ("Couldn't read all: %d bytes. Read only: %d bytes!", m_in_data_size, read_bytes)); + ("Couldn't read all: %d bytes. Read only: %u bytes!", m_in_data_size, read_bytes)); } if (fclose(m_in_file) == EOF) { @@ -230,7 +230,7 @@ common::PlatformResult JpegFile::generateListOfSections() { m_padding_data_size = 0; for (size_t offset = 0, iterration = 0; offset < m_in_data_size; ++iterration) { - LoggerD("offset:%d | Starting iteration: %d", offset, iterration); + LoggerD("offset:%u | Starting iteration: %u", offset, iterration); const std::size_t search_len = 10; std::size_t search_offset = 0; for (search_offset = 0; search_offset < search_len; ++search_offset) { @@ -243,7 +243,7 @@ common::PlatformResult JpegFile::generateListOfSections() { if (search_len == search_offset) { return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "JPEG file is invalid", - ("offset:%d | Couldn't find marker! RAW DATA:{%s}", offset, + ("offset:%u | Couldn't find marker! RAW DATA:{%s}", offset, getPartOfFile(offset, 0, 10).c_str())); } @@ -251,16 +251,16 @@ common::PlatformResult JpegFile::generateListOfSections() { unsigned char* section_begin = m_in_data + section_offset; offset = section_offset; // Move to section begin - LoggerD("offset:%d | Moved to section begin", offset); + LoggerD("offset:%u | Moved to section begin", offset); if (!isJpegMarker(section_begin[1])) { return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "JPEG file is invalid", - ("offset:%d | Is not valid marker: 0x%x RAW DATA:{%s}", offset, + ("offset:%u | Is not valid marker: 0x%x RAW DATA:{%s}", offset, section_begin[1], getPartOfFile(section_offset, 0, 4).c_str())); } const JpegMarker cur_marker = castToJpegMarker(section_begin[1]); - LoggerD("offset:%d | Found valid marker: 0x%x RAW DATA:{%s}", offset, cur_marker, + LoggerD("offset:%u | Found valid marker: 0x%x RAW DATA:{%s}", offset, cur_marker, getPartOfFile(section_offset, 0, 4).c_str()); offset += 2; // Read 0xffxx marker tag - 2 bytes @@ -279,7 +279,7 @@ common::PlatformResult JpegFile::generateListOfSections() { section->type = cur_marker; m_sections.push_back(section); if (cur_marker == JPEG_MARKER_SOI || cur_marker == JPEG_MARKER_EOI) { - LoggerD("offset:%d | Found: %s marker, moving to next marker at:%d", section_offset, + LoggerD("offset:%u | Found: %s marker, moving to next marker at:%u", section_offset, ((cur_marker == JPEG_MARKER_SOI) ? "SOI" : "EOI"), offset); if (cur_marker == JPEG_MARKER_EOI && m_padding_data != NULL) { @@ -306,21 +306,21 @@ common::PlatformResult JpegFile::generateListOfSections() { // size 2 bytes const long section_data_len = total_section_len - 2; - LoggerD("offset:%d tag:0x%x | Read total_section_len:%d (data len:%d)", section_offset, + LoggerD("offset:%u tag:0x%x | Read total_section_len:%ld (data len:%ld)", section_offset, cur_marker, total_section_len, section_data_len); offset += 2; // Read data size - 2 bytes if (total_section_len < 0) { return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "JPEG file is invalid", - ("offset:%d tag:0x%x | Error: total_section_len is: %d < 0", + ("offset:%u tag:0x%x | Error: total_section_len is: %ld < 0", offset, cur_marker, total_section_len)); } if (section_offset + 2 + total_section_len > m_in_data_size) { return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "JPEG file is invalid", - ("offset:%d tag:0x%x | Error: current section offset:%d" - " + 2 + total_section_len:%d = %d is greater then file size:%d", + ("offset:%u tag:0x%x | Error: current section offset:%u" + " + 2 + total_section_len:%ld = %lu is greater then file size:%u", offset, cur_marker, section_offset, total_section_len, section_offset + total_section_len, m_in_data_size)); } @@ -330,8 +330,8 @@ common::PlatformResult JpegFile::generateListOfSections() { section->exif_data = exif_data_new_from_data(section_begin, exif_data_size); LoggerD( - "offset:%d tag:0x%x | Loading exif from offset:%d" - " len:%d exif_data_new_from_data returned: %p", + "offset:%u tag:0x%x | Loading exif from offset:%u" + " len:%u exif_data_new_from_data returned: %p", offset, cur_marker, section_offset, exif_data_size, section->exif_data); if (!section->exif_data) { @@ -356,7 +356,7 @@ common::PlatformResult JpegFile::generateListOfSections() { std::size_t image_size = m_in_data_size - image_data_offset - 2; LoggerW( "offset:%d tag:0x%x" - " | Image data offset:%d Estimated image size:%d", + " | Image data offset:%u Estimated image size:%u", offset, cur_marker, image_data_offset, image_size); m_image_data = m_in_data + image_data_offset; @@ -380,7 +380,7 @@ common::PlatformResult JpegFile::generateListOfSections() { " delta:%d", image_size, eoi_tag_index, image_size - eoi_tag_index); - LoggerW("Setting image_size to EOI tag: %d", eoi_tag_index); + LoggerW("Setting image_size to EOI tag: %u", eoi_tag_index); image_size = eoi_tag_index; m_padding_data = m_image_data + image_size + 2; // (skip EOI tag) @@ -393,10 +393,10 @@ common::PlatformResult JpegFile::generateListOfSections() { m_image_size = image_size; offset = image_data_offset + image_size; - LoggerD("offset:%d tag:0x%x | SOS Offset moved to next marker", offset, cur_marker); + LoggerD("offset:%u tag:0x%x | SOS Offset moved to next marker", offset, cur_marker); } else { offset += section_data_len; - LoggerD("offset:%d tag:0x%x | Offset moved to next marker", offset, cur_marker); + LoggerD("offset:%u tag:0x%x | Offset moved to next marker", offset, cur_marker); } } } @@ -514,7 +514,7 @@ PlatformResult JpegFile::saveToFile(const std::string& out_path) { LoggerE( "Exception occured during saveToFilePriv " - "original file: [%] new: [%s]", + "original file: [%s] new: [%s]", m_source_file_path.c_str(), out_path.c_str()); if (out_path == m_source_file_path) { @@ -671,7 +671,7 @@ PlatformResult JpegFile::saveToFilePriv(const std::string& out_path) { } if (m_padding_data && m_padding_data_size > 0) { - LoggerD("Padding data exists and contains:%d bytes saving to JPEG file"); + LoggerD("Padding data exists and contains:%d bytes saving to JPEG file", m_padding_data_size); const std::size_t bytes_wrote = fwrite(m_image_data, 1, m_padding_data_size, m_out_file); if (bytes_wrote != m_padding_data_size) { @@ -712,7 +712,7 @@ JpegFileSectionPtr JpegFile::getExifSection() { } else { LoggerW( "Warning: found %d APP1/Exif sections -" - " only first is currently supported!"); + " only first is currently supported!", num_exif_sections); } } } diff --git a/src/exif/rational.cc b/src/exif/rational.cc index 2df69705..6009de54 100644 --- a/src/exif/rational.cc +++ b/src/exif/rational.cc @@ -41,7 +41,7 @@ Rational::Rational(const ExifRational& exif_rational) } Rational Rational::createFromDouble(const double value, const long precision) { - LoggerD("Entered value:%f precision:%d", value, precision); + LoggerD("Entered value:%f precision:%lu", value, precision); if (value < 0.0) { LoggerW("Trying to create negative Rational: %f!", value); return Rational(); @@ -122,7 +122,7 @@ Rational Rational::createFromDouble(const double value, const long precision) { result_denominator *= -1; } - LoggerD("Rational(%d, %d) error0 < error1m:%d", result_numerator, result_denominator, + LoggerD("Rational(%ld, %ld) error0 < error1m:%d", result_numerator, result_denominator, error0 < error1m); return Rational(numerator0, denominator0); @@ -202,7 +202,7 @@ Rational Rational::createFromExposureTimeString(const std::string& exp_time) { } nominator += denominator * integer_value; - LoggerD("%d/%d -> %f", nominator, denominator, static_cast(nominator) / denominator); + LoggerD("%ld/%ld -> %f", nominator, denominator, static_cast(nominator) / denominator); if (0 == nominator) { // Exposure time = 0 is invalid value diff --git a/src/filesystem/filesystem_file.cc b/src/filesystem/filesystem_file.cc index bc0734cd..3c75d1f2 100644 --- a/src/filesystem/filesystem_file.cc +++ b/src/filesystem/filesystem_file.cc @@ -197,7 +197,7 @@ bool FilesystemFile::Read(FilesystemBuffer* data, size_t offset, size_t length) data_p += part; data_size -= part; - LoggerD("Readed part %li bytes", readed); + LoggerD("Readed part %u bytes", readed); if (ferror(file)) { LoggerE("Error during file write!"); @@ -209,7 +209,7 @@ bool FilesystemFile::Read(FilesystemBuffer* data, size_t offset, size_t length) break; } } - LoggerD("Readed %li bytes", readed); + LoggerD("Readed %u bytes", readed); data->resize(readed); return true; } @@ -238,7 +238,7 @@ bool FilesystemFile::Write(const FilesystemBuffer& data, size_t offset, bool rew int status; status = fseek(file, offset, SEEK_SET); - LoggerD("Offset is %li, writing %i bytes", offset, data.size()); + LoggerD("Offset is %u, writing %i bytes", offset, data.size()); if (status) { LoggerE("Cannot perform seek!"); return false; @@ -271,7 +271,7 @@ bool FilesystemFile::Write(const FilesystemBuffer& data, size_t offset, bool rew LoggerE("Cannot sync file!"); return false; } - LoggerD("Written %li bytes", written); + LoggerD("Written %u bytes", written); return true; } diff --git a/src/systeminfo/systeminfo_properties_manager.cc b/src/systeminfo/systeminfo_properties_manager.cc index ec0218ab..3bb52c2d 100644 --- a/src/systeminfo/systeminfo_properties_manager.cc +++ b/src/systeminfo/systeminfo_properties_manager.cc @@ -131,7 +131,7 @@ PlatformResult SysteminfoPropertiesManager::GetPropertyValue(const std::string& return ret; } LoggerD("property name: %s", property.c_str()); - LoggerD("available property count: %d", property_count); + LoggerD("available property count: %lu", property_count); for (std::size_t i = 0; i < property_count; i++) { picojson::value result = picojson::value(picojson::object()); @@ -447,7 +447,7 @@ PlatformResult SysteminfoPropertiesManager::FetchStatus(std::string* result) { break; default: return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Received unexpected data", - ("Received unexpected data: %u", rotation)); + ("Received unexpected data: %d", rotation)); } *result = status; return PlatformResult(ErrorCode::NO_ERROR); @@ -556,7 +556,7 @@ static PlatformResult GetNetworkTypeString(NetworkType type, std::string& type_s PlatformResult SysteminfoPropertiesManager::ReportNetwork(picojson::object* out, unsigned long count) { - LoggerD("Entered with index property %d", count); + LoggerD("Entered with index property %lu", count); connection_h connection_handle = nullptr; connection_type_e connection_type = CONNECTION_TYPE_DISCONNECTED; int networkType = 0; @@ -1036,7 +1036,7 @@ static PlatformResult FetchConnection(std::string* result_status, std::string* r PlatformResult SysteminfoPropertiesManager::ReportCellularNetwork(picojson::object* out, unsigned long count) { - LoggerD("Entered with index property %d", count); + LoggerD("Entered with index property %lu", count); PlatformResult ret = SysteminfoUtils::CheckTelephonySupport(); if (ret.IsError()) { return ret; -- 2.34.1