From: Anna Niznik Date: Tue, 21 Jul 2015 11:56:38 +0000 (+0200) Subject: Removing warnings from modules: badge, bluetooth, calendar. X-Git-Tag: submit/tizen/20151026.073646^2^2~224 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd7f44c1eae196f5d19a9beb837f06bc6bed3705;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git Removing warnings from modules: badge, bluetooth, calendar. Using cppcheck (with --enable=all flag). [calendar] Also used gcc. [Verification] TCT result: Before: [badge] 100.00% [bluetooth] 76.78% [calendar] 100.00% After: [badge] 100.00% [bluetooth] 76.78% [calendar] 100.00% Change-Id: I114b76348b70462d8f386d6f0bce5369b1b3318f Signed-off-by: Anna Niznik --- diff --git a/src/bluetooth/bluetooth_adapter.cc b/src/bluetooth/bluetooth_adapter.cc index 0151b84b..c61648b4 100755 --- a/src/bluetooth/bluetooth_adapter.cc +++ b/src/bluetooth/bluetooth_adapter.cc @@ -347,6 +347,8 @@ BluetoothAdapter::BluetoothAdapter(BluetoothInstance& instance) : is_powered_(false), is_initialized_(false), user_request_list_(), + user_request_callback_(), + requested_powered_(), instance_(instance) { LoggerD("Entered"); @@ -1280,9 +1282,9 @@ void BluetoothAdapter::UnregisterUUID(const std::string& uuid, int callback_hand } } - if (registered_uuids_.size() == 0 && - connection_requests_.size() == 0 && - connected_sockets_.size() == 0) { + if (registered_uuids_.empty() && + connection_requests_.empty() && + connected_sockets_.empty()) { bt_socket_unset_connection_state_changed_cb(); } } else if (result.IsSuccess()){ @@ -1466,13 +1468,13 @@ void BluetoothAdapter::OnSocketConnected( return; } - if (object->connected_sockets_.size() == 0) { + if (object->connected_sockets_.empty()) { bt_socket_unset_data_received_cb(); } - if (object->registered_uuids_.size() == 0 && - object->connection_requests_.size() == 0 && - object->connected_sockets_.size() == 0) { + if (object->registered_uuids_.empty() && + object->connection_requests_.empty() && + object->connected_sockets_.empty()) { bt_socket_unset_connection_state_changed_cb(); } } diff --git a/src/bluetooth/bluetooth_gatt_service.cc b/src/bluetooth/bluetooth_gatt_service.cc index d4c29e55..738a87c6 100755 --- a/src/bluetooth/bluetooth_gatt_service.cc +++ b/src/bluetooth/bluetooth_gatt_service.cc @@ -322,7 +322,7 @@ void BluetoothGATTService::ReadValue(const picojson::value& args, bt_gatt_h handle = (bt_gatt_h) static_cast(args.get("handle").get()); auto read_value = [](int result, bt_gatt_h handle, void *user_data) -> void { - Data* data = (Data*) user_data; + Data* data = static_cast(user_data); double callback_handle = data->callback_handle; BluetoothGATTService* service = data->service; delete data; diff --git a/src/calendar/calendar.cc b/src/calendar/calendar.cc index 5998e55d..c28a8fe2 100755 --- a/src/calendar/calendar.cc +++ b/src/calendar/calendar.cc @@ -342,7 +342,7 @@ PlatformResult Calendar::UpdateBatch(const picojson::object& args, } CalendarListPtr list_ptr = CalendarListPtr(list, CalendarRecord::ListDeleter); - int ret, id; + int id; calendar_record_h record; for (auto& item : items) { @@ -353,7 +353,7 @@ PlatformResult Calendar::UpdateBatch(const picojson::object& args, id = common::stol(FromJson(item_obj, "id")); } - ret = calendar_db_get_record(view_uri.c_str(), id, &record); + int ret = calendar_db_get_record(view_uri.c_str(), id, &record); if (CALENDAR_ERROR_NONE != ret) { LoggerW("Can't get platform record %d", ret); return PlatformResult(ErrorCode::UNKNOWN_ERR, @@ -669,13 +669,16 @@ PlatformResult Calendar::Find(const picojson::object& args, picojson::array& arr error_code = calendar_filter_add_int( sub_filter, propertyId, CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, initial_value_date); + if ((status = ErrorChecker(error_code)).IsError()) return status; error_code = calendar_filter_add_operator( sub_filter, CALENDAR_FILTER_OPERATOR_AND); + if ((status = ErrorChecker(error_code)).IsError()) return status; error_code = calendar_filter_add_int( sub_filter, propertyId, CALENDAR_MATCH_LESS_THAN_OR_EQUAL, end_value_date); + if ((status = ErrorChecker(error_code)).IsError()) return status; error_code = calendar_filter_add_filter(calendar_filter, sub_filter); if ((status = ErrorChecker(error_code)).IsError()) return status; @@ -939,9 +942,8 @@ PlatformResult Calendar::RemoveBatch(const picojson::object& args, } } - int ret; if (ids_to_remove.size() > 0) { - ret = calendar_db_delete_records(view_uri.c_str(), &ids_to_remove[0], + int ret = calendar_db_delete_records(view_uri.c_str(), &ids_to_remove[0], ids_to_remove.size()); if (CALENDAR_ERROR_NONE != ret) { @@ -969,13 +971,12 @@ PlatformResult Calendar::AddChangeListener(const picojson::object& args, const std::string& type = FromJson(args, "type"); const std::string& listener_id = FromJson(args, "listenerId"); - int ret; if (listeners_registered_.find(type) == listeners_registered_.end()) { std::string view_uri; PlatformResult status = CalendarRecord::TypeToUri(type, &view_uri); if (status.IsError()) return status; - ret = calendar_db_add_changed_cb(view_uri.c_str(), ChangeCallback, this); + int ret = calendar_db_add_changed_cb(view_uri.c_str(), ChangeCallback, this); if (CALENDAR_ERROR_NONE != ret) { LoggerE("Add calendar change callback error for type %s", type.c_str()); return PlatformResult(ErrorCode::UNKNOWN_ERR, @@ -1004,13 +1005,12 @@ PlatformResult Calendar::RemoveChangeListener(const picojson::object& args, const std::string& type = FromJson(args, "type"); - int ret; if (listeners_registered_.find(type) != listeners_registered_.end()) { std::string view_uri; PlatformResult status = CalendarRecord::TypeToUri(type, &view_uri); if (status.IsError()) return status; - ret = calendar_db_remove_changed_cb(view_uri.c_str(), ChangeCallback, this); + int ret = calendar_db_remove_changed_cb(view_uri.c_str(), ChangeCallback, this); if (CALENDAR_ERROR_NONE != ret) { LoggerE("Remove calendar change callback error for type %s", type.c_str()); diff --git a/src/calendar/calendar_record.cc b/src/calendar/calendar_record.cc index 49830997..81c17953 100755 --- a/src/calendar/calendar_record.cc +++ b/src/calendar/calendar_record.cc @@ -355,9 +355,8 @@ PlatformResult CalendarRecord::CalendarToJson(calendar_record_h rec, return PlatformResult(ErrorCode::UNKNOWN_ERR, "Calendar record is null"); } - int id; + int id = 0; PlatformResult status = GetInt(rec, _calendar_book.id, &id); - int account_id; GetInt(rec, _calendar_book.account_id, &account_id);