lower_ext = strdup(ext);
temp = lower_ext;
if (NULL == temp) {
+ /* LCOV_EXCL_START */
ERR("strdup() Fail");
return CONTACTS_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
while (*temp) {
*temp = tolower(*temp);
ret = ctsvc_utils_copy_image(CTSVC_CONTACT_IMG_FULL_LOCATION, src_img, dest);
if (CONTACTS_ERROR_NONE != ret) {
+ /* LCOV_EXCL_START */
ERR("ctsvc_utils_copy_image() Fail(%d)", ret);
dest[0] = '\0';
return ret;
+ /* LCOV_EXCL_STOP */
}
return CONTACTS_ERROR_NONE;
ret = ctsvc_stmt_step(stmt);
if (1 /*CTS_TRUE*/ != ret) {
+ /* LCOV_EXCL_START */
ERR("DB error: ctsvc_stmt_step() Fail(%d)", ret);
ctsvc_stmt_finalize(stmt);
if (CONTACTS_ERROR_NONE == ret)
return CONTACTS_ERROR_NO_DATA;
else
return ret;
+ /* LCOV_EXCL_STOP */
}
tmp_path = ctsvc_stmt_get_text(stmt, 0);
{
int ret;
char dest[CTSVC_IMG_FULL_PATH_SIZE_MAX] = {0};
+ char *thumbnail_path = NULL;
ret = __ctsvc_contact_get_current_image_file(img_id, dest, sizeof(dest));
ret = unlink(dest);
if (ret < 0)
WARN("unlink() Fail(%d)", errno);
+
+ /* remove thumbnail */
+ thumbnail_path = ctsvc_utils_get_thumbnail_path(dest, FALSE);
+ if (thumbnail_path && 0 == access(thumbnail_path, F_OK)) {
+ ret = unlink(thumbnail_path);
+ if (ret < 0)
+ WARN("unlink() Fail(%d)", errno);
+ }
+ free(thumbnail_path);
}
if (src_img) {
if (image_path) {
char full_path[CTSVC_IMG_FULL_PATH_SIZE_MAX] = {0};
+ char *thumbnail_path = NULL;
snprintf(full_path, sizeof(full_path), "%s/%s", CTSVC_CONTACT_IMG_FULL_LOCATION, image_path);
ret = unlink(full_path);
if (ret < 0)
WARN("unlink() Fail(%d)", errno);
+
+ /* remove thumbnail */
+ thumbnail_path = ctsvc_utils_get_thumbnail_path(full_path, FALSE);
+ if (thumbnail_path && 0 == access(thumbnail_path, F_OK)) {
+ ret = unlink(thumbnail_path);
+ if (ret < 0)
+ WARN("unlink() Fail(%d)", errno);
+ }
+ free(thumbnail_path);
}
return CONTACTS_ERROR_NONE;
ret = ctsvc_query_prepare(query, &stmt);
if (NULL == stmt) {
+ /* LCOV_EXCL_START */
ERR("ctsvc_query_prepare() Fail(%d)", ret);
ctsvc_end_trans(false);
return ret;
+ /* LCOV_EXCL_STOP */
}
ret = ctsvc_stmt_step(stmt);
if (1 != ret) {
+ /* LCOV_EXCL_START */
ERR("ctsvc_stmt_step() Fail(%d)", ret);
ctsvc_stmt_finalize(stmt);
ctsvc_end_trans(false);
return CONTACTS_ERROR_NO_DATA;
else
return ret;
+ /* LCOV_EXCL_STOP */
}
addressbook_id = ctsvc_stmt_get_int(stmt, 0);
ctsvc_stmt_finalize(stmt);
stmt = NULL;
- if (false == ctsvc_have_ab_write_permission(addressbook_id)) {
- ERR("Does not have permission to delete this contact");
+ if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) {
+ /* LCOV_EXCL_START */
+ ERR("No permission in this addresbook_id(%d)", addressbook_id);
ctsvc_end_trans(false);
return CONTACTS_ERROR_PERMISSION_DENIED;
+ /* LCOV_EXCL_STOP */
}
version = ctsvc_get_next_ver();
CTS_TABLE_GROUPS, version, CTS_TABLE_GROUP_RELATIONS, contact_id);
ret = ctsvc_query_exec(query);
if (CONTACTS_ERROR_NONE != ret) {
+ /* LCOV_EXCL_START */
ERR("ctsvc_query_exec() Fail(%d)", ret);
ctsvc_end_trans(false);
return ret;
+ /* LCOV_EXCL_STOP */
}
rel_changed = ctsvc_db_change();
CTS_TABLE_CONTACTS, version, contact_id);
ret = ctsvc_query_exec(query);
if (CONTACTS_ERROR_NONE != ret) {
+ /* LCOV_EXCL_START */
ERR("ctsvc_query_exec() Fail(%d)", ret);
ctsvc_end_trans(false);
return ret;
+ /* LCOV_EXCL_STOP */
}
snprintf(query, sizeof(query), "SELECT link_count FROM "CTS_TABLE_PERSONS" WHERE person_id = %d", person_id);
#ifdef ENABLE_LOG_FEATURE
/* update phonelog */
- ctsvc_db_phone_log_update_person_id(NULL, person_id, -1, false);
+ ctsvc_db_phone_log_update_person_id(NULL, person_id, -1, false, NULL);
#endif /* ENABLE_LOG_FEATURE */
} else {
ctsvc_set_person_noti();
ret = ctsvc_end_trans(true);
if (ret < CONTACTS_ERROR_NONE) {
+ /* LCOV_EXCL_START */
ERR("ctsvc_end_trans() Fail(%d)", ret);
return ret;
+ /* LCOV_EXCL_STOP */
} else {
return CONTACTS_ERROR_NONE;
}
buf_size = SAFE_STRLEN(normalized_display_name) + strlen(contact->sort_name) + 2;
name = calloc(1, buf_size);
if (NULL == name) {
+ /* LCOV_EXCL_START */
ERR("calloc() Fail");
free(normalized_display_name);
return CONTACTS_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
snprintf(name, buf_size, "%s %s", normalized_display_name, contact->sort_name);
free(normalized_display_name);
int name_len = (CHINESE_PINYIN_SPELL_MAX_LEN*strlen(contact->display_name)+1) *sizeof(char);
char *name_nospace = calloc(1, name_len);
if (NULL == name_nospace) {
+ /* LCOV_EXCL_START */
ERR("calloc() Fail");
ctsvc_pinyin_free(pinyinname, size);
return CONTACTS_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
char *temp_name = NULL;
+ 4;
temp_name = calloc(1, buf_size);
if (NULL == temp_name) {
+ /* LCOV_EXCL_START */
ERR("calloc() Fail");
free(name_nospace);
ctsvc_pinyin_free(pinyinname, size);
free(name);
return CONTACTS_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
snprintf(temp_name, buf_size, "%s %s %s %s",
name, pinyinname[i].pinyin_name, name_nospace, pinyinname[i].pinyin_initial);
buf_size = SAFE_STRLEN(name) + SAFE_STRLEN(&contact->display_name[i]) + 2;
temp_name = calloc(1, buf_size);
if (NULL == temp_name) {
+ /* LCOV_EXCL_START */
ERR("calloc() Fail");
free(name_nospace);
ctsvc_pinyin_free(pinyinname, size);
free(name);
return CONTACTS_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
snprintf(temp_name, buf_size, "%s %s", name, &contact->display_name[i]);
buf_size = SAFE_STRLEN(normalized_display_name) + strlen(initial) + 2;
name = calloc(1, buf_size);
if (NULL == name) {
+ /* LCOV_EXCL_START */
ERR("calloc() Fail");
free(normalized_display_name);
return CONTACTS_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
snprintf(name, buf_size, "%s %s", normalized_display_name, initial);
buf_size = SAFE_STRLEN(normalized_display_name) + strlen(initial) + 2;
name = calloc(1, buf_size);
if (NULL == name) {
+ /* LCOV_EXCL_START */
ERR("calloc() Fail");
free(normalized_display_name);
return CONTACTS_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
snprintf(name, buf_size, "%s %s", normalized_display_name, initial);
int full_len, chosung_len;
char *chosung = calloc(1, strlen(contact->display_name) * 5);
if (NULL == chosung) {
+ /* LCOV_EXCL_START */
ERR("calloc() Fail");
return CONTACTS_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
int total_len = strlen(contact->display_name);
buf_size = SAFE_STRLEN(name) + SAFE_STRLEN(&contact->display_name[i]) + SAFE_STRLEN(&chosung[j]) + 3;
temp_name = calloc(1, buf_size);
if (NULL == temp_name) {
+ /* LCOV_EXCL_START */
ERR("calloc() Fail");
free(chosung);
free(name);
return CONTACTS_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
snprintf(temp_name, buf_size, "%s %s %s", name, &contact->display_name[i], &chosung[j]);
buf_size = SAFE_STRLEN(normalized_display_name) + strlen(initial) + 2;
name = calloc(1, buf_size);
if (NULL == name) {
+ /* LCOV_EXCL_START */
ERR("calloc() Fail");
free(normalized_display_name);
return CONTACTS_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
snprintf(name, buf_size, "%s %s", normalized_display_name, initial);
buf_size += 3; /* for space and null string */
phonetic = calloc(1, buf_size);
if (NULL == phonetic) {
+ /* LCOV_EXCL_START */
ERR("calloc() Fail");
free(name);
return CONTACTS_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
if (name_record->phonetic_first)
buf_size = SAFE_STRLEN(name) + SAFE_STRLEN(phonetic) + 2;
temp_name = calloc(1, buf_size);
if (NULL == temp_name) {
+ /* LCOV_EXCL_START */
ERR("calloc() Fail");
free(phonetic);
free(name);
return CONTACTS_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
snprintf(temp_name, buf_size, "%s %s", name, phonetic);
free(name);
len += 3; /* for space and null string */
*phonetic = calloc(1, len);
if (NULL == *phonetic) {
+ /* LCOV_EXCL_START */
ERR("calloc() Fail");
return CONTACTS_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
int temp_len = 0;
char *name_nospace = NULL;
name_nospace = calloc(1, name_len);
if (NULL == name_nospace) {
+ /* LCOV_EXCL_START */
ERR("calloc() Fail");
return NULL;
+ /* LCOV_EXCL_STOP */
}
int len = strlen(src);
temp_display_len += 7;
temp_display = calloc(1, temp_display_len);
if (NULL == temp_display) {
+ /* LCOV_EXCL_START */
ERR("calloc() Fail");
return;
+ /* LCOV_EXCL_STOP */
}
len = 0;
display_len = SAFE_STRLEN(name->prefix) + temp_display_len + 2;
display = calloc(1, display_len);
if (NULL == display) {
+ /* LCOV_EXCL_START */
ERR("calloc() Fail");
free(temp_display);
return;
+ /* LCOV_EXCL_STOP */
}
char *temp = __ctsvc_remove_first_space(name->prefix);
snprintf(display, display_len, "%s %s", temp, temp_display);
/* make reverse_temp_display_name */
temp_display = calloc(1, temp_display_len);
if (NULL == temp_display) {
+ /* LCOV_EXCL_START */
ERR("calloc() Fail");
return;
+ /* LCOV_EXCL_STOP */
}
len = 0;
display_len = SAFE_STRLEN(name->prefix) + temp_display_len + 2;
display = calloc(1, display_len);
if (NULL == display) {
+ /* LCOV_EXCL_START */
ERR("calloc() Fail");
free(temp_display);
return;
+ /* LCOV_EXCL_STOP */
}
snprintf(display, display_len, "%s %s", name->prefix, temp_display);
contact->display_name = display;
ret = ctsvc_db_name_insert(record, contact_id, is_my_profile, NULL);
}
if (CONTACTS_ERROR_DB == ret)
+ /* LCOV_EXCL_START */
ERR("return(%d)", ret);
+ /* LCOV_EXCL_STOP */
}
return ret;
ret = ctsvc_db_company_insert(record, contact_id, is_my_profile, NULL);
}
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("return (%d)", ret);
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(company_list));
ret = ctsvc_db_note_insert(record, contact_id, is_my_profile, NULL);
}
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("return (%d)", ret);
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(note_list));
ret = ctsvc_db_event_insert(record, contact_id, is_my_profile, NULL);
}
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("return (%d)", ret);
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(event_list));
ret = ctsvc_db_messenger_insert(record, contact_id, is_my_profile, NULL);
}
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("return (%d)", ret);
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(messenger_list));
ret = ctsvc_db_address_insert(record, contact_id, is_my_profile, NULL);
}
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("return (%d)", ret);
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(address_list));
ret = ctsvc_db_url_insert(record, contact_id, is_my_profile, NULL);
}
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("return (%d)", ret);
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(url_list));
ret = ctsvc_db_profile_insert(record, contact_id, is_my_profile, NULL);
}
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("return (%d)", ret);
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(profile_list));
ret = ctsvc_db_relationship_insert(record, contact_id, is_my_profile, NULL);
}
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("return (%d)", ret);
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(relationship_list));
}
}
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("return (%d)", ret);
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(image_list));
ret = ctsvc_db_nickname_insert(record, contact_id, is_my_profile, NULL);
}
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("return (%d)", ret);
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(nickname_list));
ret = ctsvc_db_extension_insert(record, contact_id, is_my_profile, NULL);
}
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("return (%d)", ret);
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(extension_list));
RETV_IF(NULL == sip_list, CONTACTS_ERROR_INVALID_PARAMETER);
- for (cursor = list->deleted_records;cursor;cursor=cursor->next) {
+ for (cursor = list->deleted_records; cursor; cursor = cursor->next) {
sip = (ctsvc_sip_s *)cursor->data;
ctsvc_db_sip_delete(sip->id, is_my_profile);
}
ret = ctsvc_db_sip_update(record, is_my_profile);
else
ret = ctsvc_db_sip_delete(sip->id, is_my_profile);
- }
- else
+ } else {
ret = ctsvc_db_sip_insert(record, contact_id, is_my_profile, NULL);
+ }
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("DB error : return (%d)", ret);
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(sip_list));
had = true;
}
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("return (%d)", ret);
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(number_list));
had = true;
}
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("return (%d)", ret);
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(email_list));
if (record) {
ret = ctsvc_db_name_insert(record, contact_id, is_my_profile, NULL);
if (CONTACTS_ERROR_DB == ret)
+ /* LCOV_EXCL_START */
ERR("ctsvc_db_name_insert() Fail");
+ /* LCOV_EXCL_STOP */
}
return ret;
}
contacts_list_get_current_record_p(number_list, &record);
ret = ctsvc_db_number_insert(record, contact_id, is_my_profile, NULL);
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("ctsvc_db_number_insert");
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(number_list));
contacts_list_get_current_record_p(email_list, &record);
ret = ctsvc_db_email_insert(record, contact_id, is_my_profile, NULL);
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("ctsvc_db_email_insert");
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(email_list));
contacts_list_get_current_record_p(profile_list, &record);
ret = ctsvc_db_profile_insert(record, contact_id, is_my_profile, NULL);
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("ctsvc_db_profile_insert");
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(profile_list));
contacts_list_get_current_record_p(company_list, &record);
ret = ctsvc_db_company_insert(record, contact_id, is_my_profile, NULL);
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("ctsvc_db_company_insert");
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(company_list));
if (record) {
ret = ctsvc_db_note_insert(record, contact_id, is_my_profile, NULL);
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("ctsvc_db_note_insert");
break;
+ /* LCOV_EXCL_STOP */
}
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(note_list));
contacts_list_get_current_record_p(event_list, &record);
ret = ctsvc_db_event_insert(record, contact_id, is_my_profile, NULL);
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("ctsvc_db_event_insert");
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(event_list));
contacts_list_get_current_record_p(messenger_list, &record);
ret = ctsvc_db_messenger_insert(record, contact_id, is_my_profile, NULL);
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("ctsvc_db_messenger_insert");
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(messenger_list));
contacts_list_get_current_record_p(address_list, &record);
ret = ctsvc_db_address_insert(record, contact_id, is_my_profile, NULL);
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("ctsvc_db_address_insert");
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(address_list));
contacts_list_get_current_record_p(url_list, &record);
ret = ctsvc_db_url_insert(record, contact_id, is_my_profile, NULL);
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("ctsvc_db_url_insert");
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(url_list));
contacts_list_get_current_record_p(nickname_list, &record);
ret = ctsvc_db_nickname_insert(record, contact_id, is_my_profile, NULL);
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("ctsvc_db_nickname_insert");
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(nickname_list));
contacts_list_get_current_record_p(relationship_list, &record);
ret = ctsvc_db_relationship_insert(record, contact_id, is_my_profile, NULL);
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("ctsvc_db_relationship_insert");
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(relationship_list));
contacts_list_get_current_record_p(image_list, &record);
ret = ctsvc_db_image_insert(record, contact_id, is_my_profile, NULL);
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("ctsvc_db_image_insert");
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(image_list));
contacts_list_get_current_record_p(extension_list, &record);
ret = ctsvc_db_extension_insert(record, contact_id, is_my_profile, NULL);
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("ctsvc_db_extension_insert");
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(extension_list));
contacts_list_get_current_record_p(sip_list, &record);
ret = ctsvc_db_sip_insert(record, contact_id, is_my_profile, NULL);
if (CONTACTS_ERROR_DB == ret) {
+ /* LCOV_EXCL_START */
ERR("DB error : ctsvc_db_sip_insert");
break;
+ /* LCOV_EXCL_STOP */
}
} while (CONTACTS_ERROR_NONE == contacts_list_next(sip_list));
ret = ctsvc_query_prepare(query, &stmt);
if (NULL == stmt) {
+ /* LCOV_EXCL_START */
ERR("ctsvc_query_prepare() Fail(%d)", ret);
contacts_record_destroy(record, true);
return ret;
+ /* LCOV_EXCL_STOP */
}
if (contact->display_name)