From: Anna Niznik Date: Tue, 21 Jul 2015 12:13:29 +0000 (+0200) Subject: Removing warnings from module: contact. X-Git-Tag: submit/tizen/20151026.073646^2^2~221 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e7f4eea04db527bd3248176b351eee9da093c9ba;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git Removing warnings from module: contact. Using cppcheck (with --enable=all flag). [Verification] TCT result: Before: 100.00% After: 100.00% Change-Id: I4e94e1931b40d4e521897c30ed2ae7afc539cb0a Signed-off-by: Anna Niznik --- diff --git a/src/contact/addressbook.cc b/src/contact/addressbook.cc index d2535a41..6bb6bd4d 100755 --- a/src/contact/addressbook.cc +++ b/src/contact/addressbook.cc @@ -56,10 +56,9 @@ PlatformResult AddressBookGet(const JsonObject& args, JsonObject& out) { int contact_id = common::stol(FromJson(args, "id")); - int err = CONTACTS_ERROR_NONE; contacts_record_h contacts_record = nullptr; - err = contacts_db_get_record(_contacts_contact._uri, contact_id, - &contacts_record); + int err = contacts_db_get_record(_contacts_contact._uri, contact_id, + &contacts_record); if (CONTACTS_ERROR_NONE != err) { LoggerW("Contacts record get error, error code: %d", err); return PlatformResult(ErrorCode::NOT_FOUND_ERR, @@ -153,9 +152,8 @@ PlatformResult AddressBookUpdate(const JsonObject& args, JsonObject& out) { "Contact is not saved in database"); } - int err = CONTACTS_ERROR_NONE; contacts_record_h to_update = nullptr; - err = contacts_db_get_record(_contacts_contact._uri, contactId, &to_update); + int err = contacts_db_get_record(_contacts_contact._uri, contactId, &to_update); if (CONTACTS_ERROR_NONE != err) { LoggerW("Problem with getting contact. Error: %d", err); return PlatformResult(ErrorCode::NOT_FOUND_ERR, @@ -423,9 +421,8 @@ PlatformResult AddressBookAddGroup(const JsonObject& args, JsonObject& out) { "Group object is previously added"); } - int err = CONTACTS_ERROR_NONE; contacts_record_h contacts_record = nullptr; - err = contacts_record_create(_contacts_group._uri, &contacts_record); + int err = contacts_record_create(_contacts_group._uri, &contacts_record); status = ContactUtil::ErrorChecker( err, "Error during executing contacts_record_create()"); if (status.IsError()) return status; @@ -466,9 +463,8 @@ PlatformResult AddressBookGetGroup(const JsonObject& args, JsonObject& out) { return PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Incorrect group id"); } - int err = CONTACTS_ERROR_NONE; contacts_record_h contacts_record = nullptr; - err = contacts_db_get_record(_contacts_group._uri, id, &contacts_record); + int err = contacts_db_get_record(_contacts_group._uri, id, &contacts_record); if (CONTACTS_ERROR_NONE != err || nullptr == contacts_record) { LoggerE("Group not exist"); return PlatformResult(ErrorCode::NOT_FOUND_ERR, "Group not exist"); diff --git a/src/contact/contact_manager.cc b/src/contact/contact_manager.cc index 9cefd2c0..01238609 100755 --- a/src/contact/contact_manager.cc +++ b/src/contact/contact_manager.cc @@ -776,8 +776,7 @@ PlatformResult ContactManagerImportFromVCard(const JsonObject& args, contacts_list_h contacts_list = nullptr; - int err = CONTACTS_ERROR_NONE; - err = contacts_vcard_parse_to_contacts(vcard_char_ptr, &contacts_list); + int err = contacts_vcard_parse_to_contacts(vcard_char_ptr, &contacts_list); if (CONTACTS_ERROR_INVALID_PARAMETER == err) { LoggerE("Invalid vCard string"); return PlatformResult(ErrorCode::UNKNOWN_ERR, "Invalid vCard string"); diff --git a/src/contact/contact_util.cc b/src/contact/contact_util.cc index 17c13cf4..3a01e4f9 100755 --- a/src/contact/contact_util.cc +++ b/src/contact/contact_util.cc @@ -289,9 +289,8 @@ PlatformResult GetNumberOfChildRecord(contacts_record_h contacts_record, LoggerD("Enter"); Assert(child_count); - int err = CONTACTS_ERROR_NONE; - err = contacts_record_get_child_record_count(contacts_record, property_id, - child_count); + int err = contacts_record_get_child_record_count(contacts_record, property_id, + child_count); if (CONTACTS_ERROR_NONE != err && CONTACTS_ERROR_NO_DATA != err) { return PlatformResult(ErrorCode::UNKNOWN_ERR, "Problem during getting child count"); @@ -310,9 +309,8 @@ PlatformResult ImportContactNameFromContactsRecord( return PlatformResult(ErrorCode::UNKNOWN_ERR, "Contacts record is null"); } int count = 0; - int err = CONTACTS_ERROR_NONE; - err = contacts_record_get_child_record_count(contacts_record, - _contacts_contact.name, &count); + int err = contacts_record_get_child_record_count(contacts_record, + _contacts_contact.name, &count); PlatformResult status = ContactUtil::ErrorChecker(err, "Contacts child record get count error"); if (status.IsError()) { @@ -477,9 +475,8 @@ PlatformResult ExportContactNameToContactsRecord( return PlatformResult(ErrorCode::UNKNOWN_ERR, "Contacts record is null"); } - int err = CONTACTS_ERROR_NONE; contacts_record_h contact_name = nullptr; - err = contacts_record_get_child_record_at_p( + int err = contacts_record_get_child_record_at_p( contacts_record, _contacts_contact.name, 0, &contact_name); bool update = true; if (CONTACTS_ERROR_NONE != err && nullptr == contact_name) { @@ -644,9 +641,8 @@ PlatformResult ImportContactEmailAddressFromContactsRecord( return PlatformResult(ErrorCode::UNKNOWN_ERR, "Contacts record is null"); } - int err = CONTACTS_ERROR_NONE; contacts_record_h child_record = nullptr; - err = contacts_record_get_child_record_at_p( + int err = contacts_record_get_child_record_at_p( contacts_record, _contacts_contact.email, index, &child_record); if (CONTACTS_ERROR_NONE != err && CONTACTS_ERROR_NO_DATA != err) { return PlatformResult(ErrorCode::NO_ERROR); @@ -728,8 +724,7 @@ PlatformResult ExportContactEmailAddressToContactsRecord( return PlatformResult(ErrorCode::UNKNOWN_ERR, "Contacts record is null"); } - int err = CONTACTS_ERROR_NONE; - err = contacts_record_create(_contacts_email._uri, &c_email_record_h); + int err = contacts_record_create(_contacts_email._uri, &c_email_record_h); PlatformResult status = ContactUtil::ErrorChecker( err, "Failed to create email record in database"); if (status.IsError()) { @@ -1040,9 +1035,8 @@ PlatformResult ImportContactOrganizationFromContactsRecord( return PlatformResult(ErrorCode::UNKNOWN_ERR, "Contacts record is null"); } - int err = CONTACTS_ERROR_NONE; contacts_record_h child_record = nullptr; - err = contacts_record_get_child_record_at_p( + int err = contacts_record_get_child_record_at_p( contacts_record, _contacts_contact.company, index, &child_record); if (CONTACTS_ERROR_NONE != err && CONTACTS_ERROR_NO_DATA != err) { return PlatformResult(ErrorCode::NO_ERROR); @@ -1114,8 +1108,7 @@ PlatformResult ExportContactOrganizationToContactsRecord( } contacts_record_h organization_record = nullptr; - int err = CONTACTS_ERROR_NONE; - err = contacts_record_create(_contacts_company._uri, &organization_record); + int err = contacts_record_create(_contacts_company._uri, &organization_record); PlatformResult status = ContactUtil::ErrorChecker( err, "Failed to create organization record in database"); if (status.IsError()) { @@ -1200,9 +1193,8 @@ PlatformResult ImportContactWebSiteFromContactsRecord( return PlatformResult(ErrorCode::UNKNOWN_ERR, "Contacts record is null"); } - int err = CONTACTS_ERROR_NONE; contacts_record_h child_record = nullptr; - err = contacts_record_get_child_record_at_p( + int err = contacts_record_get_child_record_at_p( contacts_record, _contacts_contact.url, index, &child_record); if (CONTACTS_ERROR_NONE != err && CONTACTS_ERROR_NO_DATA != err) { return PlatformResult(ErrorCode::NO_ERROR); @@ -1257,9 +1249,8 @@ PlatformResult ExportContactWebSiteToContactsRecord( return PlatformResult(ErrorCode::NO_ERROR); } - int err = CONTACTS_ERROR_NONE; contacts_record_h website_record_h = nullptr; - err = contacts_record_create(_contacts_url._uri, &website_record_h); + int err = contacts_record_create(_contacts_url._uri, &website_record_h); PlatformResult status = ContactUtil::ErrorChecker( err, "Fail to create website record in database."); if (status.IsError()) { @@ -1316,9 +1307,8 @@ PlatformResult ImportContactAnniversariesFromContactsRecord( return PlatformResult(ErrorCode::UNKNOWN_ERR, "Contacts record is null"); } - int err = CONTACTS_ERROR_NONE; contacts_record_h child_record = nullptr; - err = contacts_record_get_child_record_at_p( + int err = contacts_record_get_child_record_at_p( contacts_record, _contacts_contact.event, index, &child_record); if (CONTACTS_ERROR_NONE != err && CONTACTS_ERROR_NO_DATA != err) { *ret = false; @@ -1379,9 +1369,8 @@ PlatformResult ExportContactAnniversariesToContactsRecord( return PlatformResult(ErrorCode::NO_ERROR); } - int err = CONTACTS_ERROR_NONE; contacts_record_h anniversary_record = nullptr; - err = contacts_record_create(_contacts_event._uri, &anniversary_record); + int err = contacts_record_create(_contacts_event._uri, &anniversary_record); PlatformResult status = ContactUtil::ErrorChecker( err, "Failed to create anniversary record in database"); if (status.IsError()) { @@ -1443,9 +1432,8 @@ PlatformResult ImportContactRelationshipFromContactsRecord( return PlatformResult(ErrorCode::UNKNOWN_ERR, "Contacts record is null"); } - int err = CONTACTS_ERROR_NONE; contacts_record_h child_record = nullptr; - err = contacts_record_get_child_record_at_p( + int err = contacts_record_get_child_record_at_p( contacts_record, _contacts_contact.relationship, index, &child_record); if (CONTACTS_ERROR_NONE != err && CONTACTS_ERROR_NO_DATA != err) { return PlatformResult(ErrorCode::NO_ERROR); @@ -1585,9 +1573,8 @@ PlatformResult ExportContactRelationshipToContactsRecord( return PlatformResult(ErrorCode::UNKNOWN_ERR, "Contacts record is null"); } - int err = CONTACTS_ERROR_NONE; contacts_record_h child_record = nullptr; - err = contacts_record_create(_contacts_relationship._uri, &child_record); + int err = contacts_record_create(_contacts_relationship._uri, &child_record); PlatformResult status = ContactUtil::ErrorChecker(err, "Fail to create child_record in database"); if (status.IsError()) { @@ -1685,9 +1672,8 @@ PlatformResult ImportContactInstantMessengerFromContactsRecord( return PlatformResult(ErrorCode::UNKNOWN_ERR, "Contacts record is null"); } - int err = CONTACTS_ERROR_NONE; contacts_record_h child_record = nullptr; - err = contacts_record_get_child_record_at_p( + 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); @@ -1794,9 +1780,8 @@ PlatformResult ExportContactInstantMessengerToContactsRecord( return PlatformResult(ErrorCode::UNKNOWN_ERR, "Contacts record is null"); } - int err = CONTACTS_ERROR_NONE; contacts_record_h child_record = nullptr; - err = contacts_record_create(_contacts_messenger._uri, &child_record); + int err = contacts_record_create(_contacts_messenger._uri, &child_record); PlatformResult status = ContactUtil::ErrorChecker(err, "Fail to create child_record in database"); if (status.IsError()) { @@ -1886,9 +1871,8 @@ PlatformResult ImportContactAddressFromContactsRecord( return PlatformResult(ErrorCode::UNKNOWN_ERR, "Contacts record is null"); } - int err = CONTACTS_ERROR_NONE; contacts_record_h child_record = nullptr; - err = contacts_record_get_child_record_at_p( + int err = contacts_record_get_child_record_at_p( contacts_record, _contacts_contact.address, index, &child_record); if (CONTACTS_ERROR_NONE != err && CONTACTS_ERROR_NO_DATA != err) { return PlatformResult(ErrorCode::NO_ERROR); @@ -2006,9 +1990,8 @@ PlatformResult ExportContactAddressToContactsRecord( return PlatformResult(ErrorCode::UNKNOWN_ERR, "Contacts record is null"); } - int err = CONTACTS_ERROR_NONE; contacts_record_h address_record = nullptr; - err = contacts_record_create(_contacts_address._uri, &address_record); + int err = contacts_record_create(_contacts_address._uri, &address_record); PlatformResult status = ContactUtil::ErrorChecker( err, "Failed to create address record in database"); if (status.IsError()) { @@ -2138,9 +2121,8 @@ PlatformResult ImportContactNotesFromContactsRecord( return PlatformResult(ErrorCode::UNKNOWN_ERR, "Contacts record is null"); } - int err = CONTACTS_ERROR_NONE; contacts_record_h notes_record = nullptr; - err = contacts_record_get_child_record_at_p( + int err = contacts_record_get_child_record_at_p( contacts_record, _contacts_contact.note, index, ¬es_record); if (CONTACTS_ERROR_NONE != err && CONTACTS_ERROR_NO_DATA != err) { return PlatformResult(ErrorCode::NO_ERROR); @@ -2173,8 +2155,7 @@ PlatformResult ExportNotesToContactsRecord(contacts_record_h contacts_record, return PlatformResult(ErrorCode::UNKNOWN_ERR, "Contacts record is null"); } - int err = CONTACTS_ERROR_NONE; - err = contacts_record_create(_contacts_note._uri, ¬es_record); + int err = contacts_record_create(_contacts_note._uri, ¬es_record); PlatformResult status = ContactUtil::ErrorChecker(err, "Fail to create note record in database"); if (status.IsError()) {