From: Szymon Jastrzebski Date: Mon, 20 Aug 2018 09:29:33 +0000 (+0200) Subject: [Common] Fixing printf format modifiers X-Git-Tag: submit/tizen/20180907.104919~5^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be0339e6522c2bbf276f81e2ee7d183081058a58;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Common] Fixing printf format modifiers + The following commit fixes error build for aarch. + C++ source code was formatted in whole project. + Added -Wformat-signedness flag to check the signedness of arguments passed to the logging macros. [Verification] Code compiles for 32&64 bit archs Change-Id: I106afb31132babb50c3a4b64dd510d627c5c10fe Signed-off-by: Szymon Jastrzebski --- diff --git a/src/alarm/alarm_manager.cc b/src/alarm/alarm_manager.cc index 7a27dfcc..bcc74e04 100644 --- a/src/alarm/alarm_manager.cc +++ b/src/alarm/alarm_manager.cc @@ -143,7 +143,8 @@ void AlarmManager::Add(const picojson::value& args, picojson::object& out) { } std::string delay_str = std::to_string(delay); - int ret_app = app_control_add_extra_data(app_control, kAlarmRelativeDelayKey, delay_str.c_str()); + int ret_app = + app_control_add_extra_data(app_control, kAlarmRelativeDelayKey, delay_str.c_str()); if (APP_CONTROL_ERROR_NONE != ret_app) { LogAndReportError( PlatformResult(ErrorCode::UNKNOWN_ERR, "Fail to add data from app_control."), &out, @@ -631,8 +632,9 @@ PlatformResult AlarmManager::GetAlarm(int id, picojson::object& obj) { int ret_app = app_control_get_extra_data(app_control, kAlarmRelativeDelayKey, &delay_string); if (APP_CONTROL_ERROR_NONE != ret_app) { - return LogAndCreateResult(ErrorCode::NOT_FOUND_ERR, "Failed to get data.", - ("Failed to get data: %d (%s)", ret_app, get_error_message(ret_app))); + return LogAndCreateResult( + ErrorCode::NOT_FOUND_ERR, "Failed to get data.", + ("Failed to get data: %d (%s)", ret_app, get_error_message(ret_app))); } obj.insert(std::make_pair("type", picojson::value(kAlarmRelative))); diff --git a/src/archive/archive_file.cc b/src/archive/archive_file.cc index 0f911990..94ec9dbf 100644 --- a/src/archive/archive_file.cc +++ b/src/archive/archive_file.cc @@ -76,7 +76,7 @@ ArchiveFile::~ArchiveFile() { ScopeLogger(); if (m_entry_map) { - LoggerD("Unlinking old m_entry_map: %d ArchiveFileEntries", m_entry_map->size()); + LoggerD("Unlinking old m_entry_map: %zu ArchiveFileEntries", m_entry_map->size()); for (auto it = m_entry_map->begin(); it != m_entry_map->end(); ++it) { if (it->second) { it->second->setArchiveFileNonProtectPtr(NULL); @@ -537,7 +537,7 @@ void ArchiveFile::setEntryMap(ArchiveFileEntryPtrMapPtr entries) { ScopeLogger(); if (m_entry_map) { - LoggerD("Unlinking old m_entry_map: %d ArchiveFileEntries", m_entry_map->size()); + LoggerD("Unlinking old m_entry_map: %zu ArchiveFileEntries", m_entry_map->size()); for (auto it = m_entry_map->begin(); it != m_entry_map->end(); ++it) { if (it->second) { it->second->setArchiveFileNonProtectPtr(NULL); @@ -547,7 +547,7 @@ void ArchiveFile::setEntryMap(ArchiveFileEntryPtrMapPtr entries) { m_entry_map = entries; - LoggerD("Linking new m_entry_map ArchiveFileEntries (%d) with ArchiveFile object", + LoggerD("Linking new m_entry_map ArchiveFileEntries (%zu) with ArchiveFile object", m_entry_map->size()); for (auto it = m_entry_map->begin(); it != m_entry_map->end(); ++it) { if (it->second) { diff --git a/src/archive/archive_instance.cc b/src/archive/archive_instance.cc index cb28a2b3..cf7f9c8c 100644 --- a/src/archive/archive_instance.cc +++ b/src/archive/archive_instance.cc @@ -147,7 +147,7 @@ void ArchiveInstance::Open(const picojson::value& args, picojson::object& out) { } file_ptr = FilePtr(new File(node, File::PermissionList())); - LoggerD("open: %s mode: 0x%x overwrite: %d", location_full_path.c_str(), fm, overwrite); + LoggerD("open: %s mode: 0x%d overwrite: %d", location_full_path.c_str(), fm, overwrite); if (FileMode::WRITE == fm || FileMode::READ_WRITE == fm) { if (overwrite) { LoggerD("Deleting existing file: %s", location_full_path.c_str()); diff --git a/src/archive/filesystem_node.cc b/src/archive/filesystem_node.cc index 13d23f7e..9ba9400c 100644 --- a/src/archive/filesystem_node.cc +++ b/src/archive/filesystem_node.cc @@ -147,7 +147,7 @@ PlatformResult Node::resolve(const PathPtr& path, NodePtr* node) { } type = S_ISDIR(syminfo.st_mode) ? NT_DIRECTORY : NT_FILE; - LoggerD("%x", type); + LoggerD("%d", type); } *node = std::shared_ptr(new Node(path, type)); diff --git a/src/archive/un_zip.cc b/src/archive/un_zip.cc index 9689622f..b381bdd4 100644 --- a/src/archive/un_zip.cc +++ b/src/archive/un_zip.cc @@ -51,7 +51,7 @@ UnZip::UnZip(const std::string& filename) UnZip::~UnZip() { ScopeLogger(); for (auto& x : path_access_map) { - LoggerD("Setting permission for path: %s [%d] ", x.first.c_str(), x.second); + LoggerD("Setting permission for path: %s [%u] ", x.first.c_str(), x.second); if (chmod(x.first.c_str(), x.second) == -1) { LoggerE("Couldn't set permissions for: [%s] errno: %s", x.first.c_str(), GetErrorString(errno).c_str()); diff --git a/src/archive/un_zip_extract_request.cc b/src/archive/un_zip_extract_request.cc index 3cb09566..1fdd4907 100644 --- a/src/archive/un_zip_extract_request.cc +++ b/src/archive/un_zip_extract_request.cc @@ -297,7 +297,7 @@ PlatformResult UnZipExtractRequest::handleDirectoryEntry() { } } - LoggerD("Set dir: [%s] access and modify to: %4d-%2d-%2d %2d:%2d:%2d", m_new_dir_path.c_str(), + LoggerD("Set dir: [%s] access and modify to: %4u-%2u-%2u %2u:%2u:%2u", m_new_dir_path.c_str(), m_file_info.tmu_date.tm_year, m_file_info.tmu_date.tm_mon, m_file_info.tmu_date.tm_mday, m_file_info.tmu_date.tm_hour, m_file_info.tmu_date.tm_min, m_file_info.tmu_date.tm_sec); diff --git a/src/archive/zip_add_request.cc b/src/archive/zip_add_request.cc index 526867fd..46cd84db 100644 --- a/src/archive/zip_add_request.cc +++ b/src/archive/zip_add_request.cc @@ -361,7 +361,7 @@ PlatformResult ZipAddRequest::addToZipArchive(filesystem::NodePtr src_file_node) fseek(m_input_file, 0, SEEK_END); const size_t in_file_size = ftell(m_input_file); fseek(m_input_file, 0, SEEK_SET); - LoggerD("Source file: [%s] size: %d - %s", src_file_path.c_str(), in_file_size, + LoggerD("Source file: [%s] size: %zu - %s", src_file_path.c_str(), in_file_size, bytesToReadableString(in_file_size).c_str()); cur_afentry->setSize(in_file_size); @@ -383,7 +383,7 @@ PlatformResult ZipAddRequest::addToZipArchive(filesystem::NodePtr src_file_node) return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "New file addition failed"); } - LoggerD("Read: %d bytes from input file:[%s]", size_read, src_file_path.c_str()); + LoggerD("Read: %zu bytes from input file:[%s]", size_read, src_file_path.c_str()); total_bytes_read += size_read; m_bytes_compressed += size_read; @@ -402,7 +402,7 @@ PlatformResult ZipAddRequest::addToZipArchive(filesystem::NodePtr src_file_node) LoggerD( "Callculatting overall progress: %llu/%llu bytes; " - "%lu/%lu files; current file: [%s] progress: %d/%d bytes; ", + "%lu/%lu files; current file: [%s] progress: %zu/%zu 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); @@ -423,7 +423,7 @@ PlatformResult ZipAddRequest::addToZipArchive(filesystem::NodePtr src_file_node) if (in_file_size != total_bytes_read) { return LogAndCreateResult( ErrorCode::UNKNOWN_ERR, "Could not add file to archive", - ("in_file_size(%d) != total_bytes_read(%d)", in_file_size, total_bytes_read)); + ("in_file_size(%zu) != total_bytes_read(%zu)", in_file_size, total_bytes_read)); } fclose(m_input_file); diff --git a/src/badge/badge_manager.cc b/src/badge/badge_manager.cc index fab178e6..b41f9cc2 100644 --- a/src/badge/badge_manager.cc +++ b/src/badge/badge_manager.cc @@ -88,7 +88,7 @@ PlatformResult BadgeManager::SetBadgeCount(const std::string &app_id, unsigned i } ret = badge_set_count(app_id_str, count); - LoggerD("badge_set_count() ret : %d, %s, count : %d ", ret, get_error_message(ret), count); + LoggerD("badge_set_count() ret : %d, %s, count : %u ", ret, get_error_message(ret), count); if (ret == BADGE_ERROR_PERMISSION_DENIED) { return LogAndCreateResult(ErrorCode::SECURITY_ERR, "Security error"); @@ -136,7 +136,7 @@ PlatformResult BadgeManager::GetBadgeCount(const std::string &app_id, unsigned i ret = badge_get_count(app_id.c_str(), count); - LoggerD("badge_get_count() ret : %d count : %d", ret, *count); + LoggerD("badge_get_count() ret : %d count : %u", ret, *count); switch (ret) { case BADGE_ERROR_NONE: diff --git a/src/calendar/calendar_item.cc b/src/calendar/calendar_item.cc index fe6e59b8..b3bc59d5 100644 --- a/src/calendar/calendar_item.cc +++ b/src/calendar/calendar_item.cc @@ -829,7 +829,7 @@ PlatformResult CalendarItem::AttendeesToJson(int type, calendar_record_h rec, calendar_record_h attendee; for (unsigned int i = 0; i < count; ++i) { - LoggerD("Processing the attendee %d", i); + LoggerD("Processing the attendee %u", i); if (GetChildRecordAt(rec, property, &attendee, i).IsError()) { LoggerW("Can't get attendee record"); @@ -1049,7 +1049,7 @@ PlatformResult CalendarItem::AlarmsToJson(int type, calendar_record_h rec, picoj int tick, tick_unit; calendar_record_h alarm; for (unsigned int i = 0; i < count; ++i) { - LoggerD("Processing the alarm %d", i); + LoggerD("Processing the alarm %u", i); if (GetChildRecordAt(rec, property, &alarm, i).IsError()) { LoggerW("Can't get alarm record"); diff --git a/src/callhistory/callhistory.cc b/src/callhistory/callhistory.cc index 1108c80d..2f972a70 100644 --- a/src/callhistory/callhistory.cc +++ b/src/callhistory/callhistory.cc @@ -291,7 +291,7 @@ void CallHistory::LoadPhoneNumbers(const picojson::object& args, CallHistory* ca LoggerD("wait..."); fut.wait(); n = fut.get(); - LoggerD("Phone number [%d] : %s", modem_num, n.c_str()); + LoggerD("Phone number [%u] : %s", modem_num, n.c_str()); } while (false); phone_numbers.push_back(n); diff --git a/src/common/common.gypi b/src/common/common.gypi index cf4fed83..4609a66f 100644 --- a/src/common/common.gypi +++ b/src/common/common.gypi @@ -82,6 +82,7 @@ '-fvisibility=hidden', '-Wall', '-Werror', + '-Wformat-signedness', ], 'cflags_c': [ '-std=c11', diff --git a/src/contact/contact_util.cc b/src/contact/contact_util.cc index fb32edef..f1078433 100644 --- a/src/contact/contact_util.cc +++ b/src/contact/contact_util.cc @@ -1731,7 +1731,7 @@ PlatformResult ImportContactInstantMessengerFromContactsRecord(contacts_record_h int err = contacts_record_get_child_record_at_p(contacts_record, _contacts_contact.messenger, index, &child_record); if (CONTACTS_ERROR_NONE != err && CONTACTS_ERROR_NO_DATA != err) { - LoggerW("Skipping message with index %i. error code: %i", index, err); + LoggerW("Skipping message with index %u. error code: %i", index, err); return PlatformResult(ErrorCode::NO_ERROR); } @@ -1744,7 +1744,7 @@ PlatformResult ImportContactInstantMessengerFromContactsRecord(contacts_record_h } if (!im_address) { - LoggerW("Skipping message with index %i. missing im address", index); + LoggerW("Skipping message with index %u. missing im address", index); return PlatformResult(ErrorCode::NO_ERROR); } @@ -2201,7 +2201,7 @@ PlatformResult ImportGroupIdsFromContactsRecord(contacts_record_h contacts_recor index, &record); if (CONTACTS_ERROR_NONE != err && CONTACTS_ERROR_NO_DATA != err) { // ignoring this record - LoggerW("Skipping record with index %i. error code: %i", index, err); + LoggerW("Skipping record with index %u. error code: %i", index, err); return PlatformResult(ErrorCode::NO_ERROR); } diff --git a/src/exif/exif_information.cc b/src/exif/exif_information.cc index 9a07286b..6ed1bcc5 100644 --- a/src/exif/exif_information.cc +++ b/src/exif/exif_information.cc @@ -333,7 +333,7 @@ void ExifInformation::setGpsProcessingMethod(const std::string& type, const std::string& processing_method) { if (type != EXIF_UNDEFINED_TYPE_ASCII && type != EXIF_UNDEFINED_TYPE_JIS && type != EXIF_UNDEFINED_TYPE_UNICODE && type != EXIF_UNDEFINED_TYPE_UNDEFINED) { - LoggerW("Trying to set invalid GPSProcessingMethod type: [%s] len:%d", type.c_str(), + LoggerW("Trying to set invalid GPSProcessingMethod type: [%s] len: %zu", type.c_str(), type.length()); return; } @@ -368,7 +368,7 @@ const std::string& ExifInformation::getUserCommentType() { void ExifInformation::setUserComment(const std::string& type, const std::string& user_comment) { if (type != EXIF_UNDEFINED_TYPE_ASCII && type != EXIF_UNDEFINED_TYPE_JIS && type != EXIF_UNDEFINED_TYPE_UNICODE && type != EXIF_UNDEFINED_TYPE_UNDEFINED) { - LoggerW("Trying to set invalid user comment type: [%s] len:%d", type.c_str(), type.length()); + LoggerW("Trying to set invalid user comment type: [%s] len: %zu", type.c_str(), type.length()); return; } @@ -689,7 +689,7 @@ PlatformResult ExifInformation::updateAttributesInExifData(ExifData* exif_data) } if (isSet(EXIF_INFORMATION_ATTRIBUTE_ISO_SPEED_RATINGS)) { std::vector iso_ratings = getIsoSpeedRatings(); - LoggerD("Saving iso speed ratings count:%d", iso_ratings.size()); + LoggerD("Saving iso speed ratings count: %zu", iso_ratings.size()); ret = ExifTagSaver::saveToExif(iso_ratings, EXIF_FORMAT_SHORT, EXIF_TAG_ISO_SPEED_RATINGS, exif_data); if (!ret) { diff --git a/src/exif/exif_instance.cc b/src/exif/exif_instance.cc index 0129d7c1..c632916c 100644 --- a/src/exif/exif_instance.cc +++ b/src/exif/exif_instance.cc @@ -23,11 +23,11 @@ #include #include +#include "common/filesystem/filesystem_provider.h" #include "common/logger.h" #include "common/platform_result.h" #include "common/task-queue.h" #include "common/tools.h" -#include "common/filesystem/filesystem_provider.h" #include "exif/exif_information.h" #include "exif/exif_util.h" diff --git a/src/exif/exif_tag_saver.cc b/src/exif/exif_tag_saver.cc index 0d917669..74b8092f 100644 --- a/src/exif/exif_tag_saver.cc +++ b/src/exif/exif_tag_saver.cc @@ -31,7 +31,7 @@ void ExifTagSaver::removeExifEntryWithTag(const ExifTag tag, ExifData* exif_data ScopeLogger("tag: %d (%p)", tag, exif_data); ExifEntry* exif_entry = exif_data_get_entry(exif_data, tag); if (!exif_entry) { - LoggerE("Exif entry with tag: %d (0x%x) is not present", tag, tag); + LoggerE("Exif entry with tag: %d (0x%x) is not present", tag, (unsigned)tag); return; } diff --git a/src/exif/get_exif_info.cc b/src/exif/get_exif_info.cc index a5e4e81c..4cd21c48 100644 --- a/src/exif/get_exif_info.cc +++ b/src/exif/get_exif_info.cc @@ -85,7 +85,7 @@ bool DecomposeExifUndefined(ExifEntry* entry, std::string& type, std::string& va } if (entry->size < EXIF_UNDEFINED_TYPE_LENGTH) { - LoggerW("entry size is invalid %d < EXIF_UNDEFINED_TYPE_LENGTH", entry->size); + LoggerW("entry size is invalid %u < EXIF_UNDEFINED_TYPE_LENGTH", entry->size); return false; } @@ -313,7 +313,7 @@ PlatformResult GetExifInfo::ProcessEntry(ExifEntry* entry, ExifData* exif_data, result_obj->insert(pair); LoggerD("Setting ExifInformation gps longitude REF to: WEST"); } else { - LoggerW("Unknown longitude ref: %c (0x%x)", ref, static_cast(ref)); + LoggerW("Unknown longitude ref: %c (0x%x)", ref, static_cast(ref)); } break; } @@ -357,7 +357,7 @@ PlatformResult GetExifInfo::ProcessEntry(ExifEntry* entry, ExifData* exif_data, result_obj->insert(pair); LoggerD("Setting ExifInformation gps latitude REF to: SOUTH"); } else { - LoggerW("Unknown latitude ref: %c (0x%x)", ref, static_cast(ref)); + LoggerW("Unknown latitude ref: %c (0x%x)", ref, static_cast(ref)); } break; } @@ -390,7 +390,7 @@ PlatformResult GetExifInfo::ProcessEntry(ExifEntry* entry, ExifData* exif_data, // UNDEFINED - Any std::string type, value; if (DecomposeExifUndefined(entry, type, value)) { - LoggerD("Extracted GPSProcessingMethod: [%s], len:%d, type:%s", value.c_str(), + LoggerD("Extracted GPSProcessingMethod: [%s], len: %zu, type: %s", value.c_str(), value.length(), type.c_str()); pair = std::make_pair("gpsProcessingMethod", JsonValue(value)); result_obj->insert(pair); @@ -425,7 +425,7 @@ PlatformResult GetExifInfo::ProcessEntry(ExifEntry* entry, ExifData* exif_data, // UNDEFINED - Any std::string type, value; if (DecomposeExifUndefined(entry, type, value)) { - LoggerD("Extracted UserComment: [%s], len:%d, type:%s", value.c_str(), value.length(), + LoggerD("Extracted UserComment: [%s], len: %zu, type: %s", value.c_str(), value.length(), type.c_str()); pair = std::make_pair("userComment", JsonValue(value)); diff --git a/src/exif/jpeg_file.cc b/src/exif/jpeg_file.cc index 6388e78b..a5dced5b 100644 --- a/src/exif/jpeg_file.cc +++ b/src/exif/jpeg_file.cc @@ -158,7 +158,7 @@ PlatformResult JpegFile::load(const std::string& path) { const std::size_t in_file_size = static_cast(ftell_val); fseek(m_in_file, 0, SEEK_SET); - LoggerD("JPEG file: [%s] size:%d", path.c_str(), in_file_size); + LoggerD("JPEG file: [%s] size: %zu", path.c_str(), in_file_size); if (0 == in_file_size) { return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "JPEG file is invalid", ("Input file [%s] is empty!", path.c_str())); @@ -167,7 +167,7 @@ PlatformResult JpegFile::load(const std::string& path) { m_in_data = new (std::nothrow) unsigned char[in_file_size]; if (!m_in_data) { return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Memory allocation failed", - ("Couldn't allocate buffer with size: %d", in_file_size)); + ("Couldn't allocate buffer with size: %zu", in_file_size)); } m_in_data_size = in_file_size; @@ -176,7 +176,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: %u bytes!", m_in_data_size, read_bytes)); + ("Couldn't read all: %zu bytes. Read only: %zu bytes!", m_in_data_size, read_bytes)); } if (fclose(m_in_file) == EOF) { @@ -232,7 +232,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:%u | Starting iteration: %u", offset, iterration); + LoggerD("offset: %zu | Starting iteration: %zu", 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) { @@ -245,7 +245,7 @@ common::PlatformResult JpegFile::generateListOfSections() { if (search_len == search_offset) { return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "JPEG file is invalid", - ("offset:%u | Couldn't find marker! RAW DATA:{%s}", offset, + ("offset: %zu | Couldn't find marker! RAW DATA:{%s}", offset, getPartOfFile(offset, 0, 10).c_str())); } @@ -253,16 +253,16 @@ common::PlatformResult JpegFile::generateListOfSections() { unsigned char* section_begin = m_in_data + section_offset; offset = section_offset; // Move to section begin - LoggerD("offset:%u | Moved to section begin", offset); + LoggerD("offset: %zu | Moved to section begin", offset); if (!isJpegMarker(section_begin[1])) { return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "JPEG file is invalid", - ("offset:%u | Is not valid marker: 0x%x RAW DATA:{%s}", offset, + ("offset: %zu | 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:%u | Found valid marker: 0x%x RAW DATA:{%s}", offset, cur_marker, + LoggerD("offset: %zu | Found valid marker: 0x%x RAW DATA:{%s}", offset, (unsigned)cur_marker, getPartOfFile(section_offset, 0, 4).c_str()); offset += 2; // Read 0xffxx marker tag - 2 bytes @@ -281,7 +281,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:%u | Found: %s marker, moving to next marker at:%u", section_offset, + LoggerD("offset: %zu | Found: %s marker, moving to next marker at: %zu", section_offset, ((cur_marker == JPEG_MARKER_SOI) ? "SOI" : "EOI"), offset); if (cur_marker == JPEG_MARKER_EOI && m_padding_data != NULL) { @@ -308,23 +308,23 @@ common::PlatformResult JpegFile::generateListOfSections() { // size 2 bytes const long section_data_len = total_section_len - 2; - LoggerD("offset:%u tag:0x%x | Read total_section_len:%ld (data len:%ld)", section_offset, - cur_marker, total_section_len, section_data_len); + LoggerD("offset: %zu tag:0x%x | Read total_section_len: %ld (data len: %ld)", section_offset, + (unsigned)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:%u tag:0x%x | Error: total_section_len is: %ld < 0", - offset, cur_marker, total_section_len)); + ("offset: %zu tag:0x%x | Error: total_section_len is: %ld < 0", + offset, (unsigned)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:%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, + ("offset: %zu tag:0x%x | Error: current section offset: %zu" + " + 2 + total_section_len: %ld = %lu is greater then file size: %zu", + offset, (unsigned)cur_marker, section_offset, total_section_len, section_offset + total_section_len, m_in_data_size)); } @@ -333,12 +333,12 @@ common::PlatformResult JpegFile::generateListOfSections() { section->exif_data = exif_data_new_from_data(section_begin, exif_data_size); LoggerD( - "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); + "offset: %zu tag:0x%x | Loading exif from offset: %zu" + " len: %u exif_data_new_from_data returned: %p", + offset, (unsigned)cur_marker, section_offset, exif_data_size, section->exif_data); if (!section->exif_data) { - LoggerW("offset:%d tag:0x%x | Couldn't load Exif!", offset, cur_marker); + LoggerW("offset: %zu tag:0x%x | Couldn't load Exif!", offset, (unsigned)cur_marker); } } @@ -358,9 +358,9 @@ common::PlatformResult JpegFile::generateListOfSections() { // -2 (exclude ending EOI marker (2 bytes) std::size_t image_size = m_in_data_size - image_data_offset - 2; LoggerW( - "offset:%d tag:0x%x" - " | Image data offset:%u Estimated image size:%u", - offset, cur_marker, image_data_offset, image_size); + "offset: %zu tag:0x%x" + " | Image data offset: %zu Estimated image size: %zu", + offset, (unsigned)cur_marker, image_data_offset, image_size); m_image_data = m_in_data + image_data_offset; @@ -375,31 +375,32 @@ common::PlatformResult JpegFile::generateListOfSections() { "JPEG file contains image data stream: image_size+= 2"); image_size += 2; // Skip expected EOI tag which is not present } else { - LoggerD("EOI tag found at offset: %d from SOS data", eoi_tag_index); + LoggerD("EOI tag found at offset: %zu from SOS data", eoi_tag_index); if (eoi_tag_index != image_size) { LoggerW( - "Estimated image size:%d doesn't match EOI tag index:%d" - " delta:%d", + "Estimated image size: %zu doesn't match EOI tag index: %zu" + " delta: %zu", image_size, eoi_tag_index, image_size - eoi_tag_index); - LoggerW("Setting image_size to EOI tag: %u", eoi_tag_index); + LoggerW("Setting image_size to EOI tag: %zu", eoi_tag_index); image_size = eoi_tag_index; m_padding_data = m_image_data + image_size + 2; // (skip EOI tag) m_padding_data_size = (m_in_data + m_in_data_size) - m_padding_data; - LoggerW("Saving padding data from offset:%d with size:%d", m_padding_data - m_in_data, - m_padding_data_size); + LoggerW("Saving padding data from offset: %td with size: %zu", + m_padding_data - m_in_data, m_padding_data_size); } } m_image_size = image_size; offset = image_data_offset + image_size; - LoggerD("offset:%u tag:0x%x | SOS Offset moved to next marker", offset, cur_marker); + LoggerD("offset: %zu tag:0x%x | SOS Offset moved to next marker", offset, + (unsigned)cur_marker); } else { offset += section_data_len; - LoggerD("offset:%u tag:0x%x | Offset moved to next marker", offset, cur_marker); + LoggerD("offset: %zu tag:0x%x | Offset moved to next marker", offset, (unsigned)cur_marker); } } } @@ -410,7 +411,7 @@ common::PlatformResult JpegFile::generateListOfSections() { bool JpegFile::searchForTagInBuffer(const unsigned char* buffer_start, const unsigned char* buffer_end, const JpegMarker marker, std::size_t& out_index) { - ScopeLogger("start:%p end:%p marker:0x%x", buffer_start, buffer_end, marker); + ScopeLogger("start: %p end: %p marker:0x%x", buffer_start, buffer_end, (unsigned)marker); if (!buffer_start) { LoggerE("buffer_start is NULL"); @@ -427,7 +428,7 @@ bool JpegFile::searchForTagInBuffer(const unsigned char* buffer_start, return false; } - LoggerD("Bytes to scan: %d", static_cast(buffer_end - buffer_start)); + LoggerD("Bytes to scan: %zu", static_cast(buffer_end - buffer_start)); const unsigned char marker_uchar = static_cast(marker); for (const unsigned char* ptr = buffer_start; ptr < buffer_end; ++ptr) { @@ -511,7 +512,7 @@ ExifData* JpegFile::getExifData() { } PlatformResult JpegFile::saveToFile(const std::string& out_path) { - ScopeLogger("out_path:%s", out_path.c_str()); + ScopeLogger("out_path: %s", out_path.c_str()); PlatformResult status = saveToFilePriv(out_path); if (status) return status; @@ -540,7 +541,7 @@ PlatformResult JpegFile::saveToFile(const std::string& out_path) { return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Couldn't restore whole file", ("Couldn't restore whole JPEG! " - "Only %d of %d bytes have been wrote!", + "Only %zu of %zu bytes have been wrote!", bytes_wrote, m_in_data_size)); } if (EOF == fclose(outf)) { @@ -554,7 +555,7 @@ PlatformResult JpegFile::saveToFile(const std::string& out_path) { } PlatformResult JpegFile::saveToFilePriv(const std::string& out_path) { - ScopeLogger("out_path:%s", out_path.c_str()); + ScopeLogger("out_path: %s", out_path.c_str()); m_out_file = fopen(out_path.c_str(), "wb"); if (!m_out_file) { @@ -571,7 +572,7 @@ PlatformResult JpegFile::saveToFilePriv(const std::string& out_path) { JpegFileSectionPtr cur = *it; const JpegMarker cur_marker = cur->type; - LoggerD("offset:%d | Section: %d marker 0x%x", offset, section_index, cur_marker); + LoggerD("offset: %zu | Section: %d marker 0x%x", offset, section_index, (unsigned)cur_marker); std::size_t bytes_to_write = 0; std::size_t bytes_wrote = 0; @@ -595,15 +596,15 @@ PlatformResult JpegFile::saveToFilePriv(const std::string& out_path) { return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Could not save Exif in JPEG file"); } - LoggerD("offset:%d | Generated Exif RAW Data length:%d", offset, exif_output_size); + LoggerD("offset: %zu | Generated Exif RAW Data length: %u", offset, exif_output_size); exif_output_data.reset(tmp); if (exif_output_size > MAX_AVAILABLE_JPEG_SECTION_DATA_SIZE) { return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Exif data is to big to be saved in JPEG file", - ("exif_output_size:%d is greater then maximum JPEG section" - "data block size: %d", + ("exif_output_size: %u is greater then maximum JPEG section" + "data block size: %u", exif_output_size, MAX_AVAILABLE_JPEG_SECTION_DATA_SIZE)); } section_size += exif_output_size; @@ -618,9 +619,9 @@ PlatformResult JpegFile::saveToFilePriv(const std::string& out_path) { } LoggerD( - "offset:%d | Writing section:" - " marker:0x%x size:%d", - offset, cur_marker, cur->size); + "offset: %zu | Writing section:" + " marker:0x%x size: %d", + offset, (unsigned)cur_marker, cur->size); bytes_wrote = fwrite(tmp_buf, 1, bytes_to_write, m_out_file); offset += bytes_wrote; @@ -628,11 +629,11 @@ PlatformResult JpegFile::saveToFilePriv(const std::string& out_path) { if (bytes_wrote != bytes_to_write) { return LogAndCreateResult( ErrorCode::UNKNOWN_ERR, "Could not write JPEG file", - ("Couldn't wrote %d bytes! Only %d bytes wrote", bytes_to_write, bytes_wrote)); + ("Couldn't wrote %zu bytes! Only %zu bytes wrote", bytes_to_write, bytes_wrote)); } if (write_section_data && cur->size > 0) { - LoggerD("offset:%d | Writing data with length:%d", offset, cur->size); + LoggerD("offset: %zu | Writing data with length: %d", offset, cur->size); bytes_to_write = cur->size; bytes_wrote = fwrite(cur->data_ptr, 1, bytes_to_write, m_out_file); @@ -641,12 +642,12 @@ PlatformResult JpegFile::saveToFilePriv(const std::string& out_path) { if (bytes_wrote != bytes_to_write) { return LogAndCreateResult( ErrorCode::UNKNOWN_ERR, "Could not write JPEG file", - ("Couldn't wrote %d bytes! Only %d bytes wrote", bytes_to_write, bytes_wrote)); + ("Couldn't wrote %zu bytes! Only %zu bytes wrote", bytes_to_write, bytes_wrote)); } } if (write_exif_data && exif_output_data && exif_output_size > 0) { - LoggerD("offset:%d | Writing new exif data with length:%d", offset, exif_output_size); + LoggerD("offset: %zu | Writing new exif data with length: %u", offset, exif_output_size); bytes_to_write = exif_output_size; bytes_wrote = fwrite(exif_output_data.get(), 1, bytes_to_write, m_out_file); @@ -655,12 +656,12 @@ PlatformResult JpegFile::saveToFilePriv(const std::string& out_path) { if (bytes_wrote != bytes_to_write) { return LogAndCreateResult( ErrorCode::UNKNOWN_ERR, "Could not write JPEG file", - ("Couldn't wrote %d bytes! Only %d bytes wrote", bytes_to_write, bytes_wrote)); + ("Couldn't wrote %zu bytes! Only %zu bytes wrote", bytes_to_write, bytes_wrote)); } } if (JPEG_MARKER_SOS == cur_marker) { - LoggerD("offset:%d | Writing image data stream with lenght:%d", offset, m_image_size); + LoggerD("offset: %zu | Writing image data stream with lenght: %zu", offset, m_image_size); bytes_to_write = m_image_size; bytes_wrote = fwrite(m_image_data, 1, bytes_to_write, m_out_file); @@ -669,19 +670,19 @@ PlatformResult JpegFile::saveToFilePriv(const std::string& out_path) { if (bytes_wrote != bytes_to_write) { return LogAndCreateResult( ErrorCode::UNKNOWN_ERR, "Could not write JPEG file", - ("Couldn't wrote %d bytes! Only %d bytes wrote", bytes_to_write, bytes_wrote)); + ("Couldn't wrote %zu bytes! Only %zu bytes wrote", bytes_to_write, bytes_wrote)); } } } if (m_padding_data && m_padding_data_size > 0) { - LoggerD("Padding data exists and contains:%d bytes saving to JPEG file", m_padding_data_size); + LoggerD("Padding data exists and contains: %zu 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) { return LogAndCreateResult( ErrorCode::UNKNOWN_ERR, "Could not write JPEG file", - ("Couldn't wrote %d bytes! Only %d bytes wrote", m_padding_data_size, bytes_wrote)); + ("Couldn't wrote %zu bytes! Only %zu bytes wrote", m_padding_data_size, bytes_wrote)); } } @@ -715,7 +716,7 @@ JpegFileSectionPtr JpegFile::getExifSection() { first_exif_section = cur; } else { LoggerW( - "Warning: found %d APP1/Exif sections -" + "Warning: found %zu APP1/Exif sections -" " only first is currently supported!", num_exif_sections); } diff --git a/src/filesystem/filesystem_instance.cc b/src/filesystem/filesystem_instance.cc index 0837d5e9..8fef9feb 100644 --- a/src/filesystem/filesystem_instance.cc +++ b/src/filesystem/filesystem_instance.cc @@ -148,7 +148,7 @@ FilesystemInstance::Worker::Worker() } FilesystemInstance::Worker::~Worker() { - if(!exit && thread.joinable()) { + if (!exit && thread.joinable()) { stop(); } } @@ -2006,7 +2006,7 @@ void FilesystemInstance::FileHandleReadString(const picojson::value& args, picoj IOException("File doesn't contain UTF-8 encoded string with given length"), out); return; } - LoggerD("char_count: %ld", char_count); + LoggerD("char_count: %lu", char_count); LoggerD("ftell: %ld", ftell(handle->file_handle)); if (!(std::feof( handle->file_handle))) { // read number of characters if not whole file read diff --git a/src/humanactivitymonitor/humanactivitymonitor_manager.cc b/src/humanactivitymonitor/humanactivitymonitor_manager.cc index 676d6cbc..0762f54c 100644 --- a/src/humanactivitymonitor/humanactivitymonitor_manager.cc +++ b/src/humanactivitymonitor/humanactivitymonitor_manager.cc @@ -1573,8 +1573,8 @@ HumanActivityMonitorManager::HumanActivityMonitorManager() return ConvertRecordedTime(data, obj); }; - monitors_.insert(std::make_pair(kActivityTypePedometer, - std::make_shared())); + monitors_.insert( + std::make_pair(kActivityTypePedometer, std::make_shared())); monitors_.insert(std::make_pair(kActivityTypeWristUp, std::make_shared(kActivityTypeWristUp))); monitors_.insert(std::make_pair(kActivityTypeSleepDetector, diff --git a/src/messaging/MsgCommon/AttributeRangeFilter.h b/src/messaging/MsgCommon/AttributeRangeFilter.h index 6d93cbfe..267faa2a 100644 --- a/src/messaging/MsgCommon/AttributeRangeFilter.h +++ b/src/messaging/MsgCommon/AttributeRangeFilter.h @@ -54,7 +54,6 @@ class AttributeRangeFilter : public AbstractFilter { */ AttributeRangeFilterPtr castToAttributeRangeFilter(AbstractFilterPtr from); - } // Tizen } // DeviceAPI diff --git a/src/messaging/conversations_change_callback.cc b/src/messaging/conversations_change_callback.cc index fe5f7e0f..a53c8d3f 100644 --- a/src/messaging/conversations_change_callback.cc +++ b/src/messaging/conversations_change_callback.cc @@ -74,7 +74,7 @@ ConversationPtrVector ConversationsChangeCallback::filterConversations( LoggerD("[%d] matched filter: %s", i, matched ? "YES" : "NO"); } - LoggerD("returning matching %d of %d conversations", filtered_conversations.size(), + LoggerD("returning matching %zu of %zu conversations", filtered_conversations.size(), source_conversations.size()); return filtered_conversations; @@ -85,7 +85,7 @@ ConversationPtrVector ConversationsChangeCallback::filterConversations( } void ConversationsChangeCallback::added(const ConversationPtrVector& conversations) { - ScopeLogger("conversations.size() = %d", conversations.size()); + ScopeLogger("conversations.size() = %zu", conversations.size()); if (!m_is_act) { return; } @@ -104,14 +104,14 @@ void ConversationsChangeCallback::added(const ConversationPtrVector& conversatio }; for_each(filtered.begin(), filtered.end(), each); - LoggerD("Calling:%s with:%d added conversations", CONVERSATIONSADDED, filtered.size()); + LoggerD("Calling:%s with:%zu added conversations", CONVERSATIONSADDED, filtered.size()); m_callback_data.SetAction(CONVERSATIONSADDED, picojson::value(array)); m_callback_data.AddAndPost(PostPriority::MEDIUM); } void ConversationsChangeCallback::updated(const ConversationPtrVector& conversations) { - ScopeLogger("conversations.size() = %d", conversations.size()); + ScopeLogger("conversations.size() = %zu", conversations.size()); if (!m_is_act) { return; } @@ -130,14 +130,14 @@ void ConversationsChangeCallback::updated(const ConversationPtrVector& conversat }; for_each(filtered.begin(), filtered.end(), each); - LoggerD("Calling:%s with:%d added conversations", CONVERSATIONSUPDATED, filtered.size()); + LoggerD("Calling:%s with:%zu added conversations", CONVERSATIONSUPDATED, filtered.size()); m_callback_data.SetAction(CONVERSATIONSUPDATED, picojson::value(array)); m_callback_data.AddAndPost(PostPriority::LOW); } void ConversationsChangeCallback::removed(const ConversationPtrVector& conversations) { - ScopeLogger("conversations.size() = %d", conversations.size()); + ScopeLogger("conversations.size() = %zu", conversations.size()); if (!m_is_act) { return; } @@ -156,7 +156,7 @@ void ConversationsChangeCallback::removed(const ConversationPtrVector& conversat }; for_each(filtered.begin(), filtered.end(), each); - LoggerD("Calling:%s with:%d added conversations", CONVERSATIONSREMOVED, filtered.size()); + LoggerD("Calling:%s with:%zu added conversations", CONVERSATIONSREMOVED, filtered.size()); m_callback_data.SetAction(CONVERSATIONSREMOVED, picojson::value(array)); m_callback_data.AddAndPost(PostPriority::LAST); diff --git a/src/messaging/email_manager.cc b/src/messaging/email_manager.cc index 65b117cf..db1327c0 100644 --- a/src/messaging/email_manager.cc +++ b/src/messaging/email_manager.cc @@ -575,7 +575,7 @@ PlatformResult EmailManager::loadMessageAttachment(MessageAttachmentCallbackData return platform_result; } - LoggerD("Mail: [%d] contains: [%d] attachments", msgAttachment->getMessageId(), + LoggerD("Mail: [%d] contains: [%zu] attachments", msgAttachment->getMessageId(), attachments.size()); auto it = attachments.begin(); @@ -821,7 +821,7 @@ void EmailManager::removeStatusCallback(const std::vector& ids, if (it != m_deleteRequests.end()) { LoggerD("Found request"); if (NOTI_MAIL_DELETE_FINISH == status) { - LoggerD("Successfully removed %d mails", ids.size()); + LoggerD("Successfully removed %zu mails", ids.size()); it->messagesDeleted += ids.size(); } MessagesCallbackUserData* callback = it->callback; @@ -1047,7 +1047,7 @@ void EmailManager::findMessages(FindMsgCallbackUserData* callback) { } // Complete task - LoggerD("callback: %p error: %d messages.size() = %d", callback, callback->IsError(), + LoggerD("callback: %p error: %d messages.size() = %zu", callback, callback->IsError(), callback->getMessages().size()); if (callback->IsError()) { @@ -1113,7 +1113,7 @@ void EmailManager::findConversations(ConversationCallbackData* callback) { } // Complete task - LoggerD("callback: %p error:%d conversations.size()=%d", callback, callback->IsError(), + LoggerD("callback: %p error:%d conversations.size()=%zu", callback, callback->IsError(), callback->getConversations().size()); if (callback->IsError()) { @@ -1232,7 +1232,7 @@ void EmailManager::findFolders(FoldersCallbackData* callback) { } // Complete task - LoggerD("callback: %p error:%d folders.size()=%d", callback, callback->IsError(), + LoggerD("callback: %p error:%d folders.size()=%zu", callback, callback->IsError(), callback->getFolders().size()); if (callback->IsError()) { diff --git a/src/messaging/folders_change_callback.cc b/src/messaging/folders_change_callback.cc index 6ceda0b2..8bb67f25 100644 --- a/src/messaging/folders_change_callback.cc +++ b/src/messaging/folders_change_callback.cc @@ -69,7 +69,7 @@ FolderPtrVector FoldersChangeCallback::filterFolders(tizen::AbstractFilterPtr fi } void FoldersChangeCallback::added(const FolderPtrVector& folders) { - ScopeLogger("folders.size() = %d", folders.size()); + ScopeLogger("folders.size() = %zu", folders.size()); if (!m_is_act) { return; } @@ -88,14 +88,14 @@ void FoldersChangeCallback::added(const FolderPtrVector& folders) { }; for_each(filtered.begin(), filtered.end(), each); - LoggerD("Calling:%s with:%d added folders", FOLDERSADDED, filtered.size()); + LoggerD("Calling:%s with:%zu added folders", FOLDERSADDED, filtered.size()); m_callback_data.SetAction(FOLDERSADDED, picojson::value(array)); m_callback_data.AddAndPost(PostPriority::MEDIUM); } void FoldersChangeCallback::updated(const FolderPtrVector& folders) { - ScopeLogger("folders.size() = %d", folders.size()); + ScopeLogger("folders.size() = %zu", folders.size()); if (!m_is_act) { return; } @@ -114,14 +114,14 @@ void FoldersChangeCallback::updated(const FolderPtrVector& folders) { }; for_each(filtered.begin(), filtered.end(), each); - LoggerD("Calling:%s with:%d updated folders", FOLDERSUPDATED, filtered.size()); + LoggerD("Calling:%s with:%zu updated folders", FOLDERSUPDATED, filtered.size()); m_callback_data.SetAction(FOLDERSUPDATED, picojson::value(array)); m_callback_data.AddAndPost(PostPriority::LOW); } void FoldersChangeCallback::removed(const FolderPtrVector& folders) { - ScopeLogger("folders.size() = %d", folders.size()); + ScopeLogger("folders.size() = %zu", folders.size()); if (!m_is_act) { return; } @@ -140,7 +140,7 @@ void FoldersChangeCallback::removed(const FolderPtrVector& folders) { }; for_each(filtered.begin(), filtered.end(), each); - LoggerD("Calling:%s with:%d removed folders", FOLDERSREMOVED, filtered.size()); + LoggerD("Calling:%s with:%zu removed folders", FOLDERSREMOVED, filtered.size()); m_callback_data.SetAction(FOLDERSREMOVED, picojson::value(array)); m_callback_data.AddAndPost(PostPriority::LAST); diff --git a/src/messaging/message.cc b/src/messaging/message.cc index 231e0957..21681995 100644 --- a/src/messaging/message.cc +++ b/src/messaging/message.cc @@ -591,8 +591,8 @@ PlatformResult Message::addEmailAttachments(std::shared_ptr message) { AttachmentPtrVector attachments = message->getMessageAttachments(); AttachmentPtrVector inlineAttachments = message->getBody()->getInlineAttachments(); - LoggerD("Attachments size: %d", attachments.size()); - LoggerD("Inline attachments size: %d", inlineAttachments.size()); + LoggerD("Attachments size: %zu", attachments.size()); + LoggerD("Inline attachments size: %zu", inlineAttachments.size()); LoggerD("Adding attachments for mail id = [%d]\n", message->getId()); for (auto it = attachments.begin(); it != attachments.end(); ++it) { PlatformResult ret = addSingleEmailAttachment(message, *it, AttachmentType::EXTERNAL); @@ -669,7 +669,7 @@ PlatformResult Message::addSMSRecipientsToStruct(const std::vector& for (unsigned int i = 0; i < size; ++i) { char* address = const_cast(recipients.at(i).c_str()); - LoggerD("[%d] address:[%s]", i, address); + LoggerD("[%u] address:[%s]", i, address); msg_struct_t tmpAddr = NULL; if (MSG_SUCCESS == msg_list_add_item(msg, MSG_MESSAGE_ADDR_LIST_HND, &tmpAddr)) { msg_set_int_value(tmpAddr, MSG_ADDRESS_INFO_ADDRESS_TYPE_INT, MSG_ADDRESS_TYPE_PLMN); @@ -677,7 +677,7 @@ PlatformResult Message::addSMSRecipientsToStruct(const std::vector& msg_set_str_value(tmpAddr, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, address, strlen(address)); } else { return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "failed to add address", - ("failed to add address[%d] %s", i, address)); + ("failed to add address[%u] %s", i, address)); } } return PlatformResult(ErrorCode::NO_ERROR); @@ -696,7 +696,7 @@ PlatformResult Message::addMMSRecipientsToStruct(const std::vector& } char* address = const_cast(recipients.at(i).c_str()); - LoggerD("[%d] address:[%s] address_type:%d type:%d", i, address, address_type, type); + LoggerD("[%u] address:[%s] address_type:%d type:%d", i, address, address_type, type); int error = msg_list_add_item(msg, MSG_MESSAGE_ADDR_LIST_HND, &tmpAddr); if (MSG_SUCCESS == error) { @@ -705,7 +705,7 @@ PlatformResult Message::addMMSRecipientsToStruct(const std::vector& msg_set_str_value(tmpAddr, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, address, strlen(address)); } else { return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "failed to add address", - ("[%d] failed to add address: [%s], error: %d", i, address, error)); + ("[%u] failed to add address: [%s], error: %d", i, address, error)); } } return PlatformResult(ErrorCode::NO_ERROR); @@ -714,7 +714,7 @@ PlatformResult Message::addMMSRecipientsToStruct(const std::vector& PlatformResult Message::addMMSBodyAndAttachmentsToStruct(const AttachmentPtrVector& attach, msg_struct_t& mms_struct, Message* message) { - ScopeLogger("attachments.size() = %zd", attach.size()); + ScopeLogger("attachments.size() = %zu", attach.size()); int size = attach.size(); for (int i = 0; i < size; i++) { @@ -805,7 +805,7 @@ PlatformResult Message::convertPlatformShortMessageToStruct(Message* message, ms return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "msg_get_message() Fail", ("msg_get_message() Fail [%d] (%s)", err, get_error_message(err))); } - LoggerD("Using existing msg for id: %d", id); + LoggerD("Using existing msg for id: %u", id); } else { // id is not set - the message does not exist in database MessageType msgType = message->getType(); if (msgType == MessageType::SMS) { @@ -950,7 +950,7 @@ PlatformResult Message::convertPlatformShortMessageToStruct(Message* message, ms } // Set MMS attachments AttachmentPtrVector attach_list = message->getMessageAttachments(); - LoggerD("Message(%p): id:%d subject:[%s] plainBody:[%s] contains %d attachments", message, + LoggerD("Message(%p): id:%d subject:[%s] plainBody:[%s] contains %zu attachments", message, message->getId(), message->getSubject().c_str(), message->getBody()->getPlainBody().c_str(), attach_list.size()); @@ -1209,7 +1209,8 @@ PlatformResult Message::setMMSBodyAndAttachmentsFromStruct(Message* message, msg LoggerD( "[p:%d, m:%d] added attachment: %p " "(mime:0x%x mime:%s messageId:%d)", - p, m, att, msg_media_type, msg_media_type_str.c_str(), ma->getMessageId()); + p, m, att, (unsigned)msg_media_type, msg_media_type_str.c_str(), + ma->getMessageId()); } msg_release_struct(&media); @@ -1233,7 +1234,7 @@ PlatformResult Message::setMMSBodyAndAttachmentsFromStruct(Message* message, msg LoggerW("Warning: body has not been set!"); } - LoggerD("after MSG_MMS_PAGE_LIST attachments count is:%d", message->m_attachments.size()); + LoggerD("after MSG_MMS_PAGE_LIST attachments count is:%zu", message->m_attachments.size()); // if there are some other attachments add it to attachments vector msg_list_handle_t attach_list = NULL; @@ -1269,8 +1270,8 @@ PlatformResult Message::setMMSBodyAndAttachmentsFromStruct(Message* message, msg ma->setMimeType(type); MessageAttachment* att = ma.get(); - LoggerD("[att:%d] added attachement: %p (mime:0x%x mime:%s path:%s id:%d)", i, att, tempInt, - type.c_str(), infoStr, ma->getId()); + LoggerD("[att:%d] added attachement: %p (mime:0x%x mime:%s path:%s id:%d)", i, att, + (unsigned)tempInt, type.c_str(), infoStr, ma->getId()); message->m_attachments.push_back(ma); message->m_has_attachment = true; @@ -1284,7 +1285,7 @@ PlatformResult Message::setMMSBodyAndAttachmentsFromStruct(Message* message, msg ("msg_get_list_handle error: %d (%s)", error, get_error_message(error))); } - LoggerD("after MSG_MMS_ATTACH_LIST attachments count is:%d", message->m_attachments.size()); + LoggerD("after MSG_MMS_ATTACH_LIST attachments count is:%zu", message->m_attachments.size()); msg_release_struct(&mms_struct); return PlatformResult(ErrorCode::NO_ERROR); } diff --git a/src/messaging/messages_change_callback.cc b/src/messaging/messages_change_callback.cc index e0567dcd..e0a48bec 100644 --- a/src/messaging/messages_change_callback.cc +++ b/src/messaging/messages_change_callback.cc @@ -63,7 +63,7 @@ MessagesChangeCallback::~MessagesChangeCallback() { MessagePtrVector MessagesChangeCallback::filterMessages(tizen::AbstractFilterPtr filter, const MessagePtrVector& source_messages, const int service_id) { - ScopeLogger("sourceMessages.size() = %d filter %s", source_messages.size(), + ScopeLogger("sourceMessages.size() = %zu filter %s", source_messages.size(), (filter ? "PRESENT" : "NULL")); if (filter) { @@ -94,7 +94,7 @@ MessagePtrVector MessagesChangeCallback::filterMessages(tizen::AbstractFilterPtr LoggerD("}"); } - LoggerD("returning matching %d of %d messages", filtered_messages.size(), + LoggerD("returning matching %zu of %zu messages", filtered_messages.size(), source_messages.size()); return filtered_messages; } else { @@ -104,7 +104,7 @@ MessagePtrVector MessagesChangeCallback::filterMessages(tizen::AbstractFilterPtr } void MessagesChangeCallback::added(const MessagePtrVector& msgs) { - ScopeLogger("event: msgs.size() = %d", msgs.size()); + ScopeLogger("event: msgs.size() = %zu", msgs.size()); if (!m_is_act) { return; } @@ -123,14 +123,14 @@ void MessagesChangeCallback::added(const MessagePtrVector& msgs) { for_each(filtered_msgs.begin(), filtered_msgs.end(), each); - LoggerD("Calling:%s with:%d added messages", MESSAGESADDED, filtered_msgs.size()); + LoggerD("Calling:%s with:%zu added messages", MESSAGESADDED, filtered_msgs.size()); m_callback_data.SetAction(MESSAGESADDED, picojson::value(array)); m_callback_data.AddAndPost(PostPriority::MEDIUM); } void MessagesChangeCallback::updated(const MessagePtrVector& msgs) { - ScopeLogger("event: msgs.size() = %d", msgs.size()); + ScopeLogger("event: msgs.size() = %zu", msgs.size()); if (!m_is_act) { return; } @@ -149,14 +149,14 @@ void MessagesChangeCallback::updated(const MessagePtrVector& msgs) { for_each(filtered_msgs.begin(), filtered_msgs.end(), each); - LoggerD("Calling:%s with:%d updated messages", MESSAGESUPDATED, filtered_msgs.size()); + LoggerD("Calling:%s with:%zu updated messages", MESSAGESUPDATED, filtered_msgs.size()); m_callback_data.SetAction(MESSAGESUPDATED, picojson::value(array)); m_callback_data.AddAndPost(PostPriority::LOW); } void MessagesChangeCallback::removed(const MessagePtrVector& msgs) { - ScopeLogger("event: msgs.size() = %d", msgs.size()); + ScopeLogger("event: msgs.size() = %zu", msgs.size()); if (!m_is_act) { return; } @@ -176,7 +176,7 @@ void MessagesChangeCallback::removed(const MessagePtrVector& msgs) { for_each(filtered_msgs.begin(), filtered_msgs.end(), each); - LoggerD("Calling:%s with:%d removed messages", MESSAGESREMOVED, filtered_msgs.size()); + LoggerD("Calling:%s with:%zu removed messages", MESSAGESREMOVED, filtered_msgs.size()); m_callback_data.SetAction(MESSAGESREMOVED, picojson::value(array)); m_callback_data.AddAndPost(PostPriority::LAST); diff --git a/src/messaging/short_message_manager.cc b/src/messaging/short_message_manager.cc index d1fc95ce..069a6863 100644 --- a/src/messaging/short_message_manager.cc +++ b/src/messaging/short_message_manager.cc @@ -53,7 +53,7 @@ static gboolean sendMessageCompleteCB(void* user_data) { } else { std::shared_ptr message = callback->getMessage(); - LoggerD("Calling success callback with: %d recipients", message->getTO().size()); + LoggerD("Calling success callback with: %zu recipients", message->getTO().size()); std::vector recipients; auto addToRecipients = [&recipients](std::string& e) -> void { @@ -393,7 +393,7 @@ PlatformResult ShortMsgManager::callProperEventMessages(EventMessages* event, msg_storage_change_type_t storageChangeType, ShortMsgManager* shortMsgManager) { ScopeLogger( - "event.items.size()=%d event.removed_conversations.size()=%d" + "event.items.size()=%zu event.removed_conversations.size()=%zu" " sChangeType:%d", event->items.size(), event->removed_conversations.size(), storageChangeType); @@ -435,17 +435,17 @@ PlatformResult ShortMsgManager::callProperEventMessages(EventMessages* event, cur_conv->getConversationId(), cur_conv->getLastMessageId()); } - LoggerD("num conversations:all=%d added=%d update=%d", eventConv->items.size(), + LoggerD("num conversations:all=%zu added=%zu update=%zu", eventConv->items.size(), added_conv.size(), updated_conv.size()); if (false == added_conv.empty()) { - LoggerD("%d new conversations, calling onConversationAdded", added_conv.size()); + LoggerD("%zu new conversations, calling onConversationAdded", added_conv.size()); eventConv->items = added_conv; ChangeListenerContainer::getInstance().callConversationAdded(eventConv); } if (false == updated_conv.empty()) { - LoggerD("%d updated conversation, calling onConversationUpdated", updated_conv.size()); + LoggerD("%zu updated conversation, calling onConversationUpdated", updated_conv.size()); eventConv->items = updated_conv; ChangeListenerContainer::getInstance().callConversationUpdated(eventConv); } @@ -535,7 +535,7 @@ void ShortMsgManager::storage_change_cb(msg_handle_t handle, for (int i = 0; i < pMsgIdList->nCount; ++i) { const msg_message_id_t& msg_id = pMsgIdList->msgIdList[i]; - LoggerD("pMsgIdList[%d] = %d", i, msg_id); + LoggerD("pMsgIdList[%d] = %u", i, msg_id); std::map::iterator it = cur_rem_msgs.find(msg_id); if (it != cur_rem_msgs.end()) { @@ -761,7 +761,7 @@ void ShortMsgManager::updateMessages(MessagesCallbackUserData* callback) { return; } - LoggerD("messages to update: %d", callback->getMessages().size()); + LoggerD("messages to update: %zu", callback->getMessages().size()); { std::lock_guard lock(m_mutex); @@ -849,7 +849,7 @@ PlatformResult ShortMsgManager::getMessage(int msg_id, msg_struct_t* out_msg) { PlatformResult ShortMsgManager::getConversationsForMessages( MessagePtrVector messages, msg_storage_change_type_t storageChangeType, ConversationPtrVector* result, ShortMsgManager* shortMsgManager) { - ScopeLogger("messages.size()=%d storageChangeType=%d", messages.size(), storageChangeType); + ScopeLogger("messages.size()=%zu storageChangeType=%d", messages.size(), storageChangeType); std::unordered_set unique_conv_ids; ConversationPtrVector convs; @@ -942,7 +942,7 @@ void ShortMsgManager::findMessages(FindMsgCallbackUserData* callback) { if (callback->IsError()) { LoggerD("Calling error callback"); } else { - LoggerD("Calling success callback with %d messages:", callback->getMessages().size()); + LoggerD("Calling success callback with %zu messages:", callback->getMessages().size()); std::vector response; auto messages = callback->getMessages(); @@ -1072,7 +1072,7 @@ void ShortMsgManager::removeConversations(ConversationCallbackData* callback) { ConversationPtr conv = (*it); msg_thread_id_t conv_id = conv->getConversationId(); - LoggerD("[%d] MessageConversation(%p) conv_id:%d", conv_index, conv.get(), conv_id); + LoggerD("[%d] MessageConversation(%p) conv_id:%u", conv_index, conv.get(), conv_id); msg_struct_list_s conv_view_list; error = msg_get_conversation_view_list(handle, (msg_thread_id_t)conv_id, &conv_view_list); @@ -1088,14 +1088,14 @@ void ShortMsgManager::removeConversations(ConversationCallbackData* callback) { LoggerD( "[%d] message[%d] msg_id:%d," - "saved MessageConversation(%p) with conv_id:%d", + "saved MessageConversation(%p) with conv_id:%u", conv_index, msg_index, cur_msg_id, conv.get(), conv_id); } else { LoggerE("[%d] Couldn't get msg_id, error: %s!", error, get_error_message(error)); } } } else { - LoggerE("[%d] Couldn' get conversation view list for conv_id:%d error: %d", conv_index, + LoggerE("[%d] Couldn' get conversation view list for conv_id:%u error: %d", conv_index, conv_id, error); } @@ -1139,12 +1139,12 @@ ShortMsgManager::ShortMsgManager() : m_msg_handle(NULL) { ShortMsgManager::~ShortMsgManager() { ScopeLogger(); - LoggerD("m_sms_removed_messages.size() = %d", m_sms_removed_messages.size()); - LoggerD("m_mms_removed_messages.size() = %d", m_mms_removed_messages.size()); - LoggerD("m_sms_removed_msg_id_conv_id_map.size() = %d", m_sms_removed_msg_id_conv_id_map.size()); - LoggerD("m_sms_removed_conv_id_object_map.size() = %d", m_sms_removed_conv_id_object_map.size()); - LoggerD("m_mms_removed_msg_id_conv_id_map.size() = %d", m_mms_removed_msg_id_conv_id_map.size()); - LoggerD("m_mms_removed_conv_id_object_map.size() = %d", m_mms_removed_conv_id_object_map.size()); + LoggerD("m_sms_removed_messages.size() = %zu", m_sms_removed_messages.size()); + LoggerD("m_mms_removed_messages.size() = %zu", m_mms_removed_messages.size()); + LoggerD("m_sms_removed_msg_id_conv_id_map.size() = %zu", m_sms_removed_msg_id_conv_id_map.size()); + LoggerD("m_sms_removed_conv_id_object_map.size() = %zu", m_sms_removed_conv_id_object_map.size()); + LoggerD("m_mms_removed_msg_id_conv_id_map.size() = %zu", m_mms_removed_msg_id_conv_id_map.size()); + LoggerD("m_mms_removed_conv_id_object_map.size() = %zu", m_mms_removed_conv_id_object_map.size()); } std::string ShortMsgManager::getMessageStatus(int id) { ScopeLogger(); diff --git a/src/nfc/nfc_adapter.cc b/src/nfc/nfc_adapter.cc index f1725f3a..65c87c41 100644 --- a/src/nfc/nfc_adapter.cc +++ b/src/nfc/nfc_adapter.cc @@ -436,7 +436,7 @@ PlatformResult NFCAdapter::SetCardEmulationMode(const std::string& mode) { if (result.IsError()) { return result; } - LoggerD("Card emulation mode value: %x", (int)new_mode); + LoggerD("Card emulation mode value: %x", (unsigned)new_mode); std::string current_mode = ""; result = GetCardEmulationMode(¤t_mode); @@ -498,7 +498,7 @@ PlatformResult NFCAdapter::SetActiveSecureElement(std::string element) { LoggerD("Error: %s", result.message().c_str()); return result; } - LoggerD("Secure element type value: %x", (int)new_type); + LoggerD("Secure element type value: %x", (unsigned)new_type); std::string current_type = ""; result = GetActiveSecureElement(¤t_type); @@ -947,7 +947,7 @@ static void tagEventCallback(nfc_discovered_type_e type, nfc_tag_h tag, void* /* obj.insert(make_pair("action", picojson::value("ondetach"))); NFCAdapter::GetInstance()->RespondAsync(event.serialize().c_str()); } else { // ERROR - should never happen - LoggerE("Invalid NFC discovered type: %d (%x)", type, type); + LoggerE("Invalid NFC discovered type: %d (%x)", type, (unsigned)type); } } @@ -1554,7 +1554,7 @@ PlatformResult NFCAdapter::SetPreferredApp() { if (aids.empty()) { return LogAndCreateResult(ErrorCode::ABORT_ERR, "No AID registered"); } - LoggerD("Found %d AIDs", aids.size()); + LoggerD("Found %zu AIDs", aids.size()); int ret = nfc_se_set_preferred_handler(); if (ret != NFC_ERROR_NONE) { diff --git a/src/nfc/nfc_util.cc b/src/nfc/nfc_util.cc index de51aaac..e91e1a1f 100644 --- a/src/nfc/nfc_util.cc +++ b/src/nfc/nfc_util.cc @@ -221,7 +221,7 @@ PlatformResult NFCUtil::ToStringCardEmulationMode(const nfc_se_card_emulation_mo break; default: return LogAndCreateResult(ErrorCode::TYPE_MISMATCH_ERR, "No Match Card Emulation mode", - ("No Match Card Emulation mode: %x", card_mode)); + ("No Match Card Emulation mode: %x", (unsigned)card_mode)); } return PlatformResult(ErrorCode::NO_ERROR); } @@ -254,7 +254,7 @@ PlatformResult NFCUtil::ToStringSecureElementType(const nfc_se_type_e se_type, s break; default: return LogAndCreateResult(ErrorCode::TYPE_MISMATCH_ERR, "No Match Secure Element Type", - ("No Match Secure Element Type: %x", se_type)); + ("No Match Secure Element Type: %x", (unsigned)se_type)); } return PlatformResult(ErrorCode::NO_ERROR); } diff --git a/src/package/package_instance.cc b/src/package/package_instance.cc index 6af3a746..b944775f 100644 --- a/src/package/package_instance.cc +++ b/src/package/package_instance.cc @@ -19,12 +19,12 @@ #include #include +#include "common/filesystem/filesystem_provider.h" #include "common/logger.h" #include "common/picojson.h" #include "common/task-queue.h" #include "common/tools.h" #include "package/package_info_provider.h" -#include "common/filesystem/filesystem_provider.h" namespace extension { namespace package { diff --git a/src/sound/sound_manager.cc b/src/sound/sound_manager.cc index fa23c617..c902d9a4 100644 --- a/src/sound/sound_manager.cc +++ b/src/sound/sound_manager.cc @@ -197,7 +197,7 @@ double SoundManager::ConvertToSystemVolume(int max_volume, int volume) { } void SoundManager::VolumeChangeCallback(sound_type_e type, unsigned int value) { - ScopeLogger("VolumeChangeCallback: type: %d, value: %d", type, value); + ScopeLogger("VolumeChangeCallback: type: %d, value: %u", type, value); // Prepare response picojson::value response = picojson::value(picojson::object()); diff --git a/src/systeminfo/systeminfo_properties_manager.cc b/src/systeminfo/systeminfo_properties_manager.cc index da705ebd..4b46b1b6 100644 --- a/src/systeminfo/systeminfo_properties_manager.cc +++ b/src/systeminfo/systeminfo_properties_manager.cc @@ -1208,7 +1208,7 @@ PlatformResult SysteminfoPropertiesManager::ReportStorage(picojson::object* out) // handling storages from provider common::FilesystemProvider& provider(common::FilesystemProvider::Create()); auto storages = provider.GetStorages(); - LoggerD("Storages found %d", storages.size()); + LoggerD("Storages found %zu", storages.size()); for (auto storage : storages) { if (storage->state() == common::StorageState::kMounted) { unsigned long long available; diff --git a/src/widgetservice/widgetservice_instance.cc b/src/widgetservice/widgetservice_instance.cc index fd8f0baa..bbd61c01 100644 --- a/src/widgetservice/widgetservice_instance.cc +++ b/src/widgetservice/widgetservice_instance.cc @@ -586,7 +586,8 @@ TizenResult WidgetServiceInstance::SendContent(picojson::object const& args) { LogAndReturnTizenError(common::AbortError(ret), ("bundle_add() failed")); } - int ret_widget = widget_service_trigger_update(widget_id.c_str(), instance_id.c_str(), data, force); + int ret_widget = + widget_service_trigger_update(widget_id.c_str(), instance_id.c_str(), data, force); if (WIDGET_ERROR_NONE != ret_widget) { LogAndReturnTizenError(WidgetServiceUtils::ConvertErrorCode(ret_widget), ("widget_service_trigger_update() failed")); @@ -620,8 +621,8 @@ TizenResult WidgetServiceInstance::GetContent(picojson::object const& args, bundle_free(bundle_data); }; - int ret_widget = widget_service_get_content_of_widget_instance(widget_id.c_str(), instance_id.c_str(), - &bundle_data); + int ret_widget = widget_service_get_content_of_widget_instance( + widget_id.c_str(), instance_id.c_str(), &bundle_data); if (WIDGET_ERROR_NONE != ret_widget) { LoggerE("widget_service_get_content_of_widget_instance() failed"); this->Post(token, WidgetServiceUtils::ConvertErrorCode(ret_widget));