#define MEDIA_CONTENT_EMPTY_STRING ""
#define MAX_QUERY_SIZE 4096
+#define MAX_PATH_LEN 4096
#define DEFAULT_QUERY_SIZE 1024
#define COLLATE_STR_SIZE 32
#define MEDIA_CONTENT_UUID_SIZE 36
Name: capi-content-media-content
Summary: A Media content library in Tizen Native API
-Version: 0.3.4
+Version: 0.3.5
Release: 0
Group: Multimedia/API
License: Apache-2.0
/*query = sqlite3_mprintf("%s %s %s", select_query, condition_query, option_query);*/
len = snprintf(query, sizeof(query), "%s %s %s", select_query, condition_query, option_query);
- if (len > 0 && len < MAX_QUERY_SIZE)
+ if (len > 0 && len < sizeof(query))
query[len] = '\0';
- else if (len >= MAX_QUERY_SIZE)
+ else if (len >= sizeof(query))
query[MAX_QUERY_SIZE -1] = '\0';
else {
media_content_error("snprintf failed");
len = snprintf(query, sizeof(query), "SELECT * FROM (%s %s %s) as table1 UNION ALL SELECT * FROM (%s %s %s) as table2",
select_query1, condition_query1, option_query1, select_query2, condition_query2, option_query2);
- if (len > 0 && len < MAX_QUERY_SIZE) {
+ if (len > 0 && len < sizeof(query)) {
query[len] = '\0';
- } else if (len >= MAX_QUERY_SIZE) {
+ } else if (len >= sizeof(query)) {
query[MAX_QUERY_SIZE -1] = '\0';
} else {
media_content_error("snprintf failed");
char *folder_path = NULL;
int check_file = MEDIA_CONTENT_ERROR_NONE;
char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0,};
- char repl_path[MAX_QUERY_SIZE] = {0,};
+ char repl_path[MAX_PATH_LEN] = {0,};
media_content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid path");
int ret = MEDIA_CONTENT_ERROR_NONE;
bool ignore_dir = FALSE;
char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
- char repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
media_content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path");
memset(repl_path, 0, sizeof(repl_path));
int media_content_cancel_scan_folder(const char *path)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
- char repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
media_content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path");
char bracket_added_condition[MAX_QUERY_SIZE] = {0, };
memset(bracket_added_condition, 0x00, sizeof(bracket_added_condition));
- SAFE_STRLCAT(bracket_added_condition, QUERY_KEYWORD_OPEN_BRACKET, MAX_QUERY_SIZE);
- SAFE_STRLCAT(bracket_added_condition, _filter->condition, MAX_QUERY_SIZE);
- SAFE_STRLCAT(bracket_added_condition, QUERY_KEYWORD_BRACKET, MAX_QUERY_SIZE);
+ SAFE_STRLCAT(bracket_added_condition, QUERY_KEYWORD_OPEN_BRACKET, sizeof(bracket_added_condition));
+ SAFE_STRLCAT(bracket_added_condition, _filter->condition, sizeof(bracket_added_condition));
+ SAFE_STRLCAT(bracket_added_condition, QUERY_KEYWORD_BRACKET, sizeof(bracket_added_condition));
ret = _media_filter_attribute_generate(attr, bracket_added_condition, _filter->condition_collate_type, condition_query);
media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
attribute_h attr = NULL;
filter_s *_filter = (filter_s*)filter;
char *tmp_path = NULL;
- char repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
attr = _content_get_alias_attirbute_handle();
memset(select_query, 0x00, sizeof(select_query));
sqlite3_stmt *stmt = NULL;
attribute_h attr = NULL;
char *tmp_path = NULL;
- char repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
attr = _content_get_attirbute_handle();
memset(select_query, 0x00, sizeof(select_query));
SAFE_FREE(_filter->condition);
char new_condition[MAX_QUERY_SIZE] = {0, };
- memset(new_condition, 0, MAX_QUERY_SIZE);
+ memset(new_condition, 0, sizeof(new_condition));
ret = _media_content_replace_path_in_condition(condition, new_condition);
media_content_retvm_if(!STRING_VALID(new_condition), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
if (_filter) {
if (STRING_VALID(_filter->condition)) {
char new_condition[MAX_QUERY_SIZE] = {0, };
- memset(new_condition, 0, MAX_QUERY_SIZE);
+ memset(new_condition, 0, sizeof(new_condition));
ret = _media_content_rollback_path_in_condition(_filter->condition, new_condition);
media_content_retvm_if(!STRING_VALID(new_condition), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
sqlite3_stmt *stmt = NULL;
char select_query[DEFAULT_QUERY_SIZE];
char *tmp_path = NULL;
- char repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
if (!STRING_VALID(folder_id)) {
media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
int ret = MEDIA_CONTENT_ERROR_NONE;
media_folder_s *_folder = (media_folder_s*)folder;
char *sql = NULL;
- char repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
if ((_folder == NULL) || (_folder->folder_id == NULL)) {
media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
/* Update all folder record's path, which are matched by old parent path */
char *update_folder_path_sql = NULL;
- char src_path_slash[MAX_QUERY_SIZE + 1] = {0, };
- char dst_path_slash[MAX_QUERY_SIZE + 1] = {0, };
+ char src_path_slash[MAX_PATH_LEN + 1] = {0, };
+ char dst_path_slash[MAX_PATH_LEN + 1] = {0, };
snprintf(src_path_slash, sizeof(src_path_slash), "%s/", g_src_path);
snprintf(dst_path_slash, sizeof(dst_path_slash), "%s/", repl_path);
if (_folder != NULL && STRING_VALID(name)) {
if (STRING_VALID(_folder->path) && STRING_VALID(_folder->name)) {
char *folder_path = NULL;
- char new_folder_path[MAX_QUERY_SIZE] = {0,};
+ char new_folder_path[MAX_PATH_LEN] = {0,};
bool ignore_dir = FALSE;
- char repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
memset(repl_path, 0, sizeof(repl_path));
ret = _media_content_replace_path(_folder->path, repl_path);
media_info_s *_media = (media_info_s*)media;
char *tmp_path = NULL;
- char repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
_media->media_id = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_UUID));
bool ignore_dir = FALSE;
char *folder_path = NULL;
char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
- char repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
int ret = MEDIA_CONTENT_ERROR_NONE;
media_content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid path");
char **repl_path_array = NULL;
int idx = 0;
int ret = MS_MEDIA_ERR_NONE;
- char repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
media_content_retvm_if(path_array == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path_array");
media_content_retvm_if(array_length <= 0, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid array_length");
char **repl_path_array = NULL;
int idx = 0;
int ret = MS_MEDIA_ERR_NONE;
- char repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
media_content_retvm_if(path_array == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path_array");
media_content_retvm_if(array_length <= 0, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid array_length");
char *file_path = NULL;
media_content_storage_e storage_type = 0;
char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
- char repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
if (!STRING_VALID(media_id)) {
media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
media_svc_storage_type_e src_storage_type = 0;
media_svc_storage_type_e dst_storage_type = 0;
char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
- char repl_path[MAX_QUERY_SIZE] = {0, };
- char org_repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
+ char org_repl_path[MAX_PATH_LEN] = {0, };
media_content_retvm_if(media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid media");
media_content_retvm_if(!STRING_VALID(dst_path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid dst_path");
{
int ret = MEDIA_CONTENT_ERROR_NONE;
static unsigned int req_id = 0;
- char repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
media_info_s *_media = (media_info_s*)media;
if (_media != NULL && STRING_VALID(_media->media_id) && STRING_VALID(_media->file_path)) {
{
int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- char repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
if (_media != NULL && STRING_VALID(_media->media_id) && STRING_VALID(_media->file_path) && _media->request_id > 0) {
memset(repl_path, 0, sizeof(repl_path));
int ret = MEDIA_CONTENT_ERROR_NONE;
static unsigned int req_id = 0;
media_info_s *_media = (media_info_s*)media;
- char repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
if (!__media_info_isFaceRecognition_feature_supported()) {
media_content_error("NOT_SUPPORTED(0x%08x)", MEDIA_CONTENT_ERROR_NOT_SUPPORTED);
{
int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
- char repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
if (!__media_info_isFaceRecognition_feature_supported()) {
media_content_error("NOT_SUPPORTED(0x%08x)", MEDIA_CONTENT_ERROR_NOT_SUPPORTED);
static int __media_info_map_data_usr_to_svc(media_info_s *media, media_svc_content_info_s **service_content, media_content_storage_e storage_type)
{
media_content_retvm_if(media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid handle");
- char repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
char *tmp_path = NULL;
media_svc_content_info_s *svc_content_info = calloc(1, sizeof(media_svc_content_info_s));
{
int ret = MEDIA_CONTENT_ERROR_NONE;
int ret_cnt = 0;
- char repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
media_info_s *_media = (media_info_s*)media;
char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
media_svc_storage_type_e storage_type = 0;
bool ignore_file = FALSE;
- char repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
media_content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path");
media_content_retvm_if(media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid media");
media_content_error("Out of Memory");
return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
}
- memset(tmp_str, 0, sizeof(MAX_QUERY_SIZE));
+ memset(tmp_str, 0, sizeof(tmp_str));
while (fgets(tmp_str, MAX_QUERY_SIZE, fp) != NULL) {
memset(repl_item, 0, sizeof(repl_item));
char** import_item_list = NULL;
int import_item_count = 0;
int idx;
- char repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
media_content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path");
media_content_retvm_if(!STRING_VALID(playlist_name), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid playlist_name");
media_playlist_s *_playlist = (media_playlist_s*)playlist;
GList *item_list = NULL;
unsigned int idx = 0;
- char repl_path[MAX_QUERY_SIZE] = {0, };
+ char repl_path[MAX_PATH_LEN] = {0, };
char repl_item[MAX_QUERY_SIZE] = {0, };
media_content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path");
struct dirent *result = NULL;
char *leaf_path = NULL;
- char search_path[4096] = {0, };
+ char search_path[MAX_PATH_LEN] = {0, };
- strncpy(search_path, dir_path, strlen(dir_path));
+ strncpy(search_path, dir_path, sizeof(search_path));
while (STRING_VALID(search_path)) {
dp = opendir(search_path);
if (dp == NULL) {
int ret = MEDIA_CONTENT_ERROR_NONE;
#ifdef _USE_TV_PROFILE
- snprintf(replace_path, MAX_QUERY_SIZE, "%s", path);
+ snprintf(replace_path, MAX_PATH_LEN, "%s", path);
#else
if (!STRING_VALID(g_old_path)) {
ret = storage_get_root_directory(STORAGE_TYPE_INTERNAL, &g_old_path);
if (strncmp(path, g_old_path, strlen(g_old_path)) == 0) {
media_content_sec_debug("Old path[%s]", path);
- snprintf(replace_path, MAX_QUERY_SIZE, "%s%s", tzplatform_getenv(TZ_USER_CONTENT), path + strlen(g_old_path));
+ snprintf(replace_path, MAX_PATH_LEN, "%s%s", tzplatform_getenv(TZ_USER_CONTENT), path + strlen(g_old_path));
} else {
- snprintf(replace_path, MAX_QUERY_SIZE, "%s", path);
+ snprintf(replace_path, MAX_PATH_LEN, "%s", path);
}
#endif
int ret = MEDIA_CONTENT_ERROR_NONE;
#ifdef _USE_TV_PROFILE
- snprintf(replace_path, MAX_QUERY_SIZE, "%s", path);
+ snprintf(replace_path, MAX_PATH_LEN, "%s", path);
#else
if (!STRING_VALID(g_old_path)) {
if (strncmp(path, tzplatform_getenv(TZ_USER_CONTENT), strlen(tzplatform_getenv(TZ_USER_CONTENT))) == 0) {
media_content_sec_debug("new path[%s]", path);
- snprintf(replace_path, MAX_QUERY_SIZE, "%s%s", g_old_path, path + strlen(tzplatform_getenv(TZ_USER_CONTENT)));
+ snprintf(replace_path, MAX_PATH_LEN, "%s%s", g_old_path, path + strlen(tzplatform_getenv(TZ_USER_CONTENT)));
} else {
- snprintf(replace_path, MAX_QUERY_SIZE, "%s", path);
+ snprintf(replace_path, MAX_PATH_LEN, "%s", path);
}
#endif