if ((cancel_scan_item != NULL) && (cancel_scan_item->path != NULL)) {
MS_DBG_WARN("check blocked storage [%s][%s]", cancel_scan_item->path, start_path);
if ((strncmp(cancel_scan_item->path, start_path, strlen(cancel_scan_item->path)) == 0)
- && (cancel_scan_item->pid == -1 || cancel_scan_item->pid == pid)){
+ && (cancel_scan_item->pid == -1 || cancel_scan_item->pid == pid)) {
MS_DBG_ERR("Receive cancel request [%s][%s]. STOP scan!!", cancel_scan_item->path, start_path);
unsigned int path_len = strlen(cancel_scan_item->path);
ms_bacth_commit_enable(handle, TRUE, TRUE, MS_NOTI_SWITCH_OFF, pid);
/* get the current path from directory array */
current_path = g_array_index(dir_array , char*, 0);
- g_array_remove_index (dir_array, 0);
+ g_array_remove_index(dir_array, 0);
__msc_set_dir_scan_cur_path(current_path);
}
if (ms_strappend(path, sizeof(path), "%s/%s", current_path, d->d_name) != MS_MEDIA_ERR_NONE) {
- MS_DBG_ERR("ms_strappend failed");
+ MS_DBG_ERR("ms_strappend failed");
bpos += d->d_reclen;
continue;
}
}
/* insert into media DB */
- ret = ms_scan_validate_item(handle,storage_id, path, uid);
+ ret = ms_scan_validate_item(handle, storage_id, path, uid);
if (ret != MS_MEDIA_ERR_NONE) {
MS_DBG_ERR("failed to update db : %d\n", scan_type);
if (ret == MS_MEDIA_ERR_FILE_IO) {
ms_set_folder_scan_status(handle, storage_id, current_path, MS_DIR_SCAN_STOP, uid);
END_SCAN:
- if(fd != -1) {
+ if (fd != -1) {
close(fd);
fd = -1;
}
continue;
}
/* insert into media DB */
- ret = scan_function(handle,storage_id, path, uid);
+ ret = scan_function(handle, storage_id, path, uid);
if (ret != MS_MEDIA_ERR_NONE) {
MS_DBG_ERR("failed to update db : %d\n", scan_type);
if (ret == MS_MEDIA_ERR_FILE_IO) {
MS_DBG_ERR("I/O ERROR COUNT[%d]", io_err_storage++);
- }
+ }
bpos += d->d_reclen;
continue;
} else {
}
ms_get_folder_scan_status(handle, storage_id, scan_data->msg, (int*)&scan_status);
- if ((scan_status == MS_DIR_SCAN_DONE ) || (scan_status == MS_DIR_SCAN_STOP)) {
+ if ((scan_status == MS_DIR_SCAN_DONE) || (scan_status == MS_DIR_SCAN_STOP)) {
MS_DBG_WARN("[%s] scan status [%d]!!!", scan_data->msg, scan_status);
break;
}
/*remove invalid folder in folder table.*/
if (is_recursive == true) {
- if(ms_delete_invalid_folder_by_path(handle, storage_id, scan_data->msg, uid, &delete_folder_count) != MS_MEDIA_ERR_NONE) {
+ if (ms_delete_invalid_folder_by_path(handle, storage_id, scan_data->msg, uid, &delete_folder_count) != MS_MEDIA_ERR_NONE) {
MS_DBG_ERR("deleting invalid folder failed");
}
}
ms_dir_info_s *data = NULL;
data = g_array_index(dir_array , ms_dir_info_s*, 0);
g_array_remove_index(dir_array, 0);
- MS_SAFE_FREE(data->dir_path);
- MS_SAFE_FREE(data);
+ if (data != NULL) {
+ MS_SAFE_FREE(data->dir_path);
+ MS_SAFE_FREE(data);
+ }
}
g_array_free(dir_array, FALSE);
dir_array = NULL;
#ifdef _USE_RECORDED_CONTENT
if (ms_is_support_pvr()) {
while (1) {
- FILE* file = fopen( "/run/pvr_ready", "rb" );
+ FILE* file = fopen("/run/pvr_ready", "rb");
if (file != NULL) {
- fclose( file );
+ fclose(file);
MS_DBG_WARN("PVR service is ready");
break;
} else {
if (!ms_delete_invalid_items(handle, scan_data->storage_id, storage_type, uid)) {
MS_DBG_ERR("ms_delete_invalid_items fails");
}
- }/* else if (scan_type == MS_MSG_STORAGE_PARTIAL) {
+ } /* else if (scan_type == MS_MSG_STORAGE_PARTIAL) {
ms_validaty_change_all_items(handle, scan_data->storage_id, storage_type, false, uid);
}*/
scan_item->pid = -1;
} else {
scan_item = (s_scan_item*)malloc(sizeof(s_scan_item));
- if(scan_item == NULL) {
+ if (scan_item == NULL) {
MS_DBG_ERR("malloc item failed...");
return MS_MEDIA_ERR_INTERNAL;
}
int ret = -1;
MS_DBG_WARN("msc_set_cancel_scan_item begin");
g_mutex_lock(&scan_item_mutex);
- if(cancel_path == NULL) {
+ if (cancel_path == NULL) {
MS_DBG_ERR("cancel_path invalid...");
return ret;
}
- if(cur_scan_item != NULL && cur_scan_item->path != NULL) {
+ if (cur_scan_item != NULL && cur_scan_item->path != NULL) {
MS_DBG_WARN("cur_scan_item->path[%s], cur_scan_item->pid[%d]", cur_scan_item->path, cur_scan_item->pid);
MS_DBG_WARN("cancel_path[%s], pid[%d]", cancel_path, pid);
if ((strcmp(cur_scan_item->path, cancel_path) == 0) && (pid == cur_scan_item->pid)) {
int ret = MS_MEDIA_ERR_NONE;
switch (scan_type) {
- case MS_SCAN_STORAGE:
- g_async_queue_push(storage_queue2, GINT_TO_POINTER(recv_msg));
- break;
- case MS_SCAN_DIRECTORY:
- g_async_queue_push(scan_queue2, GINT_TO_POINTER(recv_msg));
- break;
- case MS_SCAN_REGISTER:
- g_async_queue_push(reg_queue2, GINT_TO_POINTER(recv_msg));
- break;
- default:
- MS_DBG_ERR("invalid parameter");
- ret = MS_MEDIA_ERR_INVALID_PARAMETER;
- break;
+ case MS_SCAN_STORAGE:
+ g_async_queue_push(storage_queue2, GINT_TO_POINTER(recv_msg));
+ break;
+ case MS_SCAN_DIRECTORY:
+ g_async_queue_push(scan_queue2, GINT_TO_POINTER(recv_msg));
+ break;
+ case MS_SCAN_REGISTER:
+ g_async_queue_push(reg_queue2, GINT_TO_POINTER(recv_msg));
+ break;
+ default:
+ MS_DBG_ERR("invalid parameter");
+ ret = MS_MEDIA_ERR_INVALID_PARAMETER;
+ break;
}
return ret;
int ret = MS_MEDIA_ERR_NONE;
switch (scan_type) {
- case MS_SCAN_STORAGE:
- *remain_request = g_async_queue_length(storage_queue2);
- break;
- case MS_SCAN_DIRECTORY:
- *remain_request = g_async_queue_length(scan_queue2);
- break;
- case MS_SCAN_REGISTER:
- *remain_request = g_async_queue_length(reg_queue2);
- break;
- default:
- MS_DBG_ERR("invalid parameter");
- ret = MS_MEDIA_ERR_INVALID_PARAMETER;
- break;
+ case MS_SCAN_STORAGE:
+ *remain_request = g_async_queue_length(storage_queue2);
+ break;
+ case MS_SCAN_DIRECTORY:
+ *remain_request = g_async_queue_length(scan_queue2);
+ break;
+ case MS_SCAN_REGISTER:
+ *remain_request = g_async_queue_length(reg_queue2);
+ break;
+ default:
+ MS_DBG_ERR("invalid parameter");
+ ret = MS_MEDIA_ERR_INVALID_PARAMETER;
+ break;
}
return ret;