ERR("Not able to retrieve store");
return MTP_ERROR_GENERAL;
}
+ /* LCOV_EXCL_START */
_entity_update_store_info_run_time(&(store->store_info),
store->root_path);
info->store_type = store->store_info.store_type;
info->free_space_in_objs = store->store_info.free_space_in_objs;
return MTP_ERROR_NONE;
+ /* LCOV_EXCL_STOP */
}
mtp_err_t _hutil_get_storage_ids(ptp_array_t *store_ids)
prop = _device_get_device_property(prop_id);
if (prop == NULL)
return MTP_ERROR_GENERAL;
-
+/* LCOV_EXCL_START */
if (prop->propinfo.get_set == PTP_PROPGETSET_GETONLY)
return MTP_ERROR_ACCESS_DENIED;
return MTP_ERROR_INVALID_OBJ_PROP_VALUE;
return MTP_ERROR_NONE;
+/* LCOV_EXCL_STOP */
}
/*
mtp_uint16 ii = 0;
if (prop_id == 0xFFFFFFFF) {
-
+ /* LCOV_EXCL_START */
prop = _device_get_ref_prop_list();
if (prop == NULL) {
ERR("property reference is NULL");
}
for (ii = 0; ii < NUM_DEVICE_PROPERTIES; ii++)
_prop_reset_device_prop_desc(&prop[ii]);
+ /* LCOV_EXCL_STOP */
} else {
prop = _device_get_device_property(prop_id);
if (prop == NULL)
mtp_bool is_made_by_mtp = FALSE;
mtp_wchar w_file_name[MTP_MAX_FILENAME_SIZE + 1] = { 0 };
+ if (obj_info == NULL)
+ return MTP_ERROR_INVALID_PARAM;
+
if (obj_info->h_parent != PTP_OBJECTHANDLE_ROOT) {
+ /* LCOV_EXCL_START */
par_obj = _device_get_object_with_handle(obj_info->h_parent);
if (par_obj == NULL) {
ERR("parent is not existed.");
_entity_dealloc_obj_info(obj_info);
return MTP_ERROR_INVALID_PARENT;
}
+ /* LCOV_EXCL_STOP */
}
store = _device_get_store(obj_info->store_id);
}
if (store->store_info.free_space < obj_info->file_size) {
- ERR("free space is not enough [%ld] bytes, object size[%ld]\n",
+ ERR("free space is not enough [%llu] bytes, object size[%llu]\n",
store->store_info.free_space, obj_info->file_size);
_entity_dealloc_obj_info(obj_info);
return MTP_ERROR_STORE_FULL;
obj_info->protcn_status = PTP_PROTECTIONSTATUS_NOPROTECTION;
}
+ if (file_name == NULL) {
+ _entity_dealloc_obj_info(obj_info);
+ _entity_dealloc_mtp_obj(obj);
+ return MTP_ERROR_INVALID_PARAM;
+ }
if (strlen(file_name) == 0) {
/* Generate a filename in 8.3 format for this object */
g_snprintf(utf8_temp, MTP_MAX_PATHNAME_SIZE + 1,
if (_util_create_path(new_f_path, sizeof(new_f_path),
store->root_path, utf8_temp) == FALSE) {
+ /* LCOV_EXCL_START */
_entity_dealloc_mtp_obj(obj);
return MTP_ERROR_GENERAL;
}
return MTP_ERROR_GENERAL;
}
}
-
+ /* LCOV_EXCL_STOP */
/*
* g_mgr->ftemp_st.filepath was allocated g_strdup("/tmp/.mtptemp.tmp");
* So if we need to change the path we need to allocate sufficient memory
*/
path_len = strlen(store->root_path) + strlen(MTP_TEMP_FILE) + 2;
- g_mgr->ftemp_st.filepath = g_realloc(g_mgr->ftemp_st.filepath, path_len);
+ g_mgr->ftemp_st.filepath = (mtp_char*)g_malloc0(path_len);
if (g_mgr->ftemp_st.filepath == NULL) {
ERR("g_realloc Fail");
_entity_dealloc_mtp_obj(obj);
#ifdef MTP_SUPPORT_ALBUM_ART
if (access(new_f_path, F_OK) == 0) {
+ /* LCOV_EXCL_START */
file_exist = TRUE;
/* if file is album, overwrite it. */
mtp_char alb_buf[MTP_MAX_PATHNAME_SIZE + 1] = { 0 };
alb_ext);
}
}
+ /* LCOV_EXCL_STOP */
}
#endif /*MTP_SUPPORT_ALBUM_ART*/
if (file_exist == FALSE) {
DBG_SECURE("Found a unique file name for the incoming object\
- [%s]\n", temp_wfname);
+ [0x%p]\n", temp_wfname);
break;
}
obj_info->obj_fmt > MTP_FMT_UNDEFINED_COLLECTION &&
obj_info->obj_fmt < MTP_FMT_UNDEFINED_DOC;
#endif /*MTP_USE_SELFMAKE_ABSTRACTION*/
+ /* LCOV_EXCL_START */
+ if (new_obj == NULL) {
+ _entity_dealloc_obj_info(obj_info);
+ _entity_dealloc_mtp_obj(obj);
+ return MTP_ERROR_INVALID_PARAM;
+ }
if (obj_info->obj_fmt == PTP_FMT_ASSOCIATION ||
is_made_by_mtp) {
*new_obj = _device_get_object_with_path(new_f_path);
_util_wchar_swprintf(temp_wfname,
MTP_MAX_PATHNAME_SIZE + 1, "COPY%d_%s", i, w_file_name);
}
-
+ /* LCOV_EXCL_STOP */
/* Save the full path to this object */
_entity_set_object_file_path(obj, new_f_path, CHAR_TYPE);
if (obj_info->obj_fmt == PTP_FMT_ASSOCIATION || is_made_by_mtp) {
/* Create the new object */
+ /* LCOV_EXCL_START */
DBG("[normal] create association file/folder[%s][0x%x]\n",
new_f_path, obj_info->association_type);
_entity_dealloc_mtp_obj(obj);
return MTP_ERROR_STORE_FULL;
}
+ /* LCOV_EXCL_STOP */
} else {
/* Reserve space for the object: Object itself, and probably
* some Filesystem-specific overhead
if (NULL == obj || NULL == obj->obj_info)
return MTP_ERROR_GENERAL;
+ if (obj_ptr == NULL)
+ return MTP_ERROR_INVALID_PARAM;
+
*obj_ptr = obj;
return MTP_ERROR_NONE;
}
return MTP_ERROR_GENERAL;
}
+ /* LCOV_EXCL_START */
if (h_parent > 0) {
if (keep_handle) {
/* two sam handle can occurs in folder copy case
return MTP_ERROR_NONE;
}
+/* LCOV_EXCL_STOP */
mtp_err_t _hutil_move_object_entry(mtp_uint32 dst_store_id, mtp_uint32 h_parent,
mtp_uint32 obj_handle)
ERR("object is [%p]\n", obj);
return MTP_ERROR_INVALID_OBJECTHANDLE;
}
+ /* LCOV_EXCL_START */
if (NULL == obj->obj_info) {
ERR("obj_info is [%p]\n", obj->obj_info);
return MTP_ERROR_GENERAL;
_util_add_file_to_db(new_obj->file_path);
return MTP_ERROR_NONE;
+ /* LCOV_EXCL_STOP */
}
return MTP_ERROR_GENERAL;
}
return MTP_ERROR_INVALID_OBJECTHANDLE;
}
+ /* LCOV_EXCL_START */
src = _device_get_store_containing_obj(obj_handle);
if (NULL == src) {
ERR("Source store not found");
return MTP_ERROR_NONE;
}
+/* LCOV_EXCL_STOP */
mtp_err_t _hutil_read_file_data_from_offset(mtp_uint32 obj_handle, off_t offset,
void *data, mtp_uint32 *data_sz)
return MTP_ERROR_INVALID_OBJECTHANDLE;
}
+ /* LCOV_EXCL_START */
if (obj->obj_info->protcn_status ==
MTP_PROTECTIONSTATUS_NONTRANSFERABLE_DATA) {
}
_util_file_close(h_file);
+ /* LCOV_EXCL_STOP */
return MTP_ERROR_NONE;
}
retv_if(obj == NULL, MTP_ERROR_INVALID_PARAM);
retv_if(obj->obj_info == NULL, MTP_ERROR_INVALID_PARAM);
-
+ /* LCOV_EXCL_START */
store = _device_get_store(store_id);
if (store == NULL) {
ERR("destination store is not valid");
#endif /*MTP_USE_RUNTIME_GETOBJECTPROPVALUE*/
_entity_add_object_to_store(store, obj);
-
+ /* LCOV_EXCL_STOP */
return MTP_ERROR_NONE;
}
}
}
+ /* LCOV_EXCL_START */
if (!h_parent) {
if (!format) {
*num_obj = _device_get_num_objects(store_id);
*num_obj = _entity_get_num_children(store, h_parent, format);
return MTP_ERROR_NONE;
}
+/* LCOV_EXCL_STOP */
mtp_err_t _hutil_get_object_handles(mtp_uint32 store_id, mtp_uint32 format,
mtp_uint32 h_parent, ptp_array_t *handle_arr)
}
if (store_id == PTP_STORAGEID_ALL && h_parent == PTP_OBJECTHANDLE_ROOT) {
- for (i = 0; i < _device_get_num_stores(); i++) {
- store = _device_get_store_at_index(i);
- _entity_get_objects_from_store_by_format(store, format, handle_arr);
+ for (i = 0; i < _device_get_num_stores(); i++) { // LCOV_EXCL_LINE
+ store = _device_get_store_at_index(i); // LCOV_EXCL_LINE
+ _entity_get_objects_from_store_by_format(store, format, handle_arr); // LCOV_EXCL_LINE
}
return MTP_ERROR_NONE;
} else if (store_id == PTP_STORAGEID_ALL && h_parent == PTP_OBJECTHANDLE_ALL) {
h_parent = PTP_OBJECTHANDLE_ROOT;
- for (i = 0; i < _device_get_num_stores(); i++) {
- store = _device_get_store_at_index(i);
- _entity_get_child_handles_with_same_format(store, h_parent, format, handle_arr);
+ for (i = 0; i < _device_get_num_stores(); i++) { // LCOV_EXCL_LINE
+ store = _device_get_store_at_index(i); // LCOV_EXCL_LINE
+ _entity_get_child_handles_with_same_format(store, h_parent, format, handle_arr); // LCOV_EXCL_LINE
}
return MTP_ERROR_NONE;
return MTP_ERROR_INVALID_STORE;
}
+ /* LCOV_EXCL_START */
_entity_get_objects_from_store_by_format(store, format, handle_arr);
return MTP_ERROR_NONE;
_entity_get_child_handles_with_same_format(store, h_parent, format, handle_arr);
return MTP_ERROR_NONE;
+ /* LCOV_EXCL_STOP */
}
mtp_err_t _hutil_construct_object_entry(mtp_uint32 store_id,
if ((store->store_info.free_space) == 0 ||
(store->store_info.free_space >
store->store_info.capacity)) {
- ERR("free space is not enough [%ld:%ld]\n",
+ ERR("free space is not enough [%llu:%llu]\n",
store->store_info.free_space,
store->store_info.capacity);
return MTP_ERROR_STORE_FULL;
mtp_char file_name[MTP_MAX_FILENAME_SIZE + 1] = { 0 };
if (obj_data != NULL && obj_data->obj != NULL) {
+ /* LCOV_EXCL_START */
store = _device_get_store(obj_data->store_id);
if (store != NULL) {
DBG("check free size instead of re-calculation");
(store->root_path));
}
_entity_dealloc_mtp_obj(obj_data->obj);
+ /* LCOV_EXCL_STOP */
}
store = _device_get_store(store_id);
return MTP_ERROR_INVALID_STORE;
}
+ /* LCOV_EXCL_START */
if (store->store_info.access == PTP_STORAGEACCESS_R) {
ERR("Only read access allowed on store");
return MTP_ERROR_STORE_READ_ONLY;
if ((store->store_info.free_space) == 0 ||
(store->store_info.free_space > store->store_info.capacity)) {
- ERR("free space is not enough [%ld bytes]\n",
+ ERR("free space is not enough [%llu bytes]\n",
+ store->store_info.free_space);
+ return MTP_ERROR_STORE_FULL;
+ }
+
+ if (store->store_info.free_space <= obj_sz) {
+ ERR("free space is not enough [%llu bytes]\n",
store->store_info.free_space);
return MTP_ERROR_STORE_FULL;
}
g_free(alb_buf);
#endif /* MTP_SUPPORT_ALBUM_ART */
*obj_ptr = obj;
- if (obj_info != NULL)
- _entity_dealloc_obj_info(obj_info);
return MTP_ERROR_NONE;
#endif /* MTP_SUPPORT_ALBUM_ART */
if (obj_info != NULL)
_entity_dealloc_obj_info(obj_info);
-
+ /* LCOV_EXCL_STOP */
return resp;
}
return MTP_ERROR_INVALID_OBJECTHANDLE;
}
+ /* LCOV_EXCL_START */
tprop = _prop_get_prop_val(tobj, prop_code);
if (tprop != NULL) {
memcpy(prop_val, tprop, sizeof(obj_prop_val_t));
ERR("can not get the prop value for propcode [0x%x]\n", prop_code);
return MTP_ERROR_GENERAL;
+ /* LCOV_EXCL_STOP */
}
mtp_err_t _hutil_update_object_property(mtp_uint32 obj_handle,
return MTP_ERROR_INVALID_OBJECTHANDLE;
}
+ /* LCOV_EXCL_START */
obj_info = obj->obj_info;
/* Avoid to rename file/folder during file operating by phone side. */
if (_util_is_file_opened(obj->file_path) == TRUE) {
if (prop_sz != NULL)
*prop_sz = p_size;
-
+ /* LCOV_EXCL_STOP */
return MTP_ERROR_NONE;
}
if ((obj_handle != PTP_OBJECTHANDLE_UNDEFINED) &&
(obj_handle != PTP_OBJECTHANDLE_ALL)) {
/* Is this object handle valid? */
+ /* LCOV_EXCL_START */
store = _device_get_store_containing_obj(obj_handle);
if (store == NULL) {
ERR("invalid object handle");
return MTP_ERROR_INVALID_OBJECTHANDLE;
}
+ /* LCOV_EXCL_STOP */
}
if (prop_code == PTP_PROPERTY_UNDEFINED) {
}
}
+ /* LCOV_EXCL_START */
if (!(obj_handle == PTP_OBJECTHANDLE_ALL ||
obj_handle == PTP_OBJECTHANDLE_UNDEFINED) &&
!(format == PTP_FORMATCODE_NOTUSED ||
return MTP_ERROR_NO_SPEC_BY_FORMAT;
}
+ if (prop_list == NULL)
+ return MTP_ERROR_INVALID_PARAM;
+
_util_init_list(&(prop_list->prop_quad_list));
_prop_init_ptparray(obj_arr, UINT32_TYPE);
return MTP_ERROR_GENERAL;
}
}
+ /* LCOV_EXCL_STOP */
}
#ifndef MTP_USE_RUNTIME_GETOBJECTPROPVALUE
return MTP_ERROR_INVALID_OBJECTHANDLE;
}
+ /* LCOV_EXCL_START */
if (parray == NULL) {
*num_ele = 0;
return MTP_ERROR_GENERAL;
}
_prop_deinit_ptparray(&ref_arr);
+ /* LCOV_EXCL_STOP */
return MTP_ERROR_NONE;
}
retv_if(skip_param == 0, MTP_ERROR_INVALID_PARAM);
+/* LCOV_EXCL_START */
if (_device_get_playback_obj(&obj_handle) == FALSE) {
ERR("_device_get_playback_obj Fail");
return MTP_ERROR_GENERAL;
return MTP_ERROR_GENERAL;
}
+/* LCOV_EXCL_STOP */
mtp_err_t _hutil_format_storage(mtp_uint32 store_id, mtp_uint32 fs_format)
{