From: Minje Ahn Date: Wed, 17 Aug 2016 04:23:12 +0000 (+0900) Subject: Apply tizen coding rule X-Git-Tag: accepted/tizen/common/20160818.144406~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a2039232d3e5c5992428544cf9f7b96e23297459;p=platform%2Fcore%2Fmultimedia%2Flibmedia-service.git Apply tizen coding rule Change-Id: I3cc2b998939467353c981a406b904338b412a0be Signed-off-by: Minje Ahn --- diff --git a/include/media-svc-types.h b/include/media-svc-types.h index 32548da..42df946 100755 --- a/include/media-svc-types.h +++ b/include/media-svc-types.h @@ -77,10 +77,10 @@ typedef struct { float altitude; /**< altitude*/ char *exposure_time; /**< exposure_time*/ float fnumber; /**< fnumber*/ - int iso; /**< iso*/ + int iso; /**< iso*/ char *model; /**< model*/ - int width; /**< width*/ - int height; /**< height*/ + int width; /**< width*/ + int height; /**< height*/ char *datetaken; /**< datetaken*/ int orientation; /**< orientation*/ int rating; /**< user defined rating */ @@ -137,13 +137,13 @@ typedef struct { /** * Type definition for scanning status */ -typedef enum{ +typedef enum { MEDIA_SVC_SCAN_PREPARE = 0, /**< Prepare scanning*/ MEDIA_SVC_SCAN_PROCESSING = 1, /**< Process scanning*/ MEDIA_SVC_SCAN_STOP = 2, /**< Stop scanning*/ MEDIA_SVC_SCAN_COMPLETE = 3, /**< Complete scanning*/ MEDIA_SVC_SCAN_MAX = 4, /**< Invalid status*/ -}media_svc_scan_status_type_e; +} media_svc_scan_status_type_e; #define MEDIA_SVC_DEFAULT_GPS_VALUE -200 /**< Default GPS Value*/ diff --git a/md5/media-svc-hash.c b/md5/media-svc-hash.c index 9987f50..77df888 100755 --- a/md5/media-svc-hash.c +++ b/md5/media-svc-hash.c @@ -60,9 +60,8 @@ char *_mb_svc_generate_hash_name(const char *file) const unsigned char *c; int length; - if (!file) { + if (!file) return NULL; - } length = 3 * strlen(file) + 9; @@ -72,9 +71,8 @@ char *_mb_svc_generate_hash_name(const char *file) ((c) >= 32 && (c) < 128 && (ACCEPTABLE_URI_CHARS[(c) - 32] & 0x08)) uri = alloca(length); - if (uri == NULL) { + if (uri == NULL) return NULL; - } strncpy(uri, "file://", length); uri[length - 1] = '\0'; @@ -109,15 +107,13 @@ int mb_svc_generate_hash_code(const char *origin_path, char *hash_code, int max_ { char *hash = NULL; - if (max_length < ((2 * MD5_HASHBYTES) + 1)) { + if (max_length < ((2 * MD5_HASHBYTES) + 1)) return MS_MEDIA_ERR_INVALID_PARAMETER; - } hash = _mb_svc_generate_hash_name(origin_path); - if (hash == NULL) { + if (hash == NULL) return MS_MEDIA_ERR_INTERNAL; - } strncpy(hash_code, hash, max_length); hash_code[strlen(hash_code)] = '\0'; diff --git a/plugin/media-content-plugin.c b/plugin/media-content-plugin.c index 992ab37..8116c6b 100755 --- a/plugin/media-content-plugin.c +++ b/plugin/media-content-plugin.c @@ -458,14 +458,12 @@ int update_end(uid_t uid) int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; ret = thumbnail_request_extract_all_thumbs(uid); - if (ret < 0) { + if (ret < 0) return MEDIA_SVC_PLUGIN_ERROR; - } ret = dcm_svc_request_extract_all(uid); - if (ret < 0) { + if (ret < 0) return MEDIA_SVC_PLUGIN_ERROR; - } #endif return MEDIA_SVC_PLUGIN_ERROR_NONE; } @@ -931,18 +929,18 @@ int get_extract_list(void* handle, const char* storage_id, int storage_type, int #if 0 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - if(handle == NULL) { + if (handle == NULL) { __set_error_message(ERR_HANDLE, err_msg); return MEDIA_SVC_PLUGIN_ERROR; } - if(!STORAGE_VALID(storage_type)) { + if (!STORAGE_VALID(storage_type)) { __set_error_message(ERR_STORAGE_TYPE, err_msg); return MEDIA_SVC_PLUGIN_ERROR; } ret = media_svc_pass2_get_extract_list(handle, storage_id, storage_type, scan_type, path, burst, uid, array); - if(ret < 0) { + if (ret < 0) { __set_error_message(ret, err_msg); return MEDIA_SVC_PLUGIN_ERROR; } @@ -955,18 +953,18 @@ int update_one_extract_item(void* handle, const char* storage_id, int storage_ty #if 0 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - if(handle == NULL) { + if (handle == NULL) { __set_error_message(ERR_HANDLE, err_msg); return MEDIA_SVC_PLUGIN_ERROR; } - if(!STORAGE_VALID(storage_type)) { + if (!STORAGE_VALID(storage_type)) { __set_error_message(ERR_STORAGE_TYPE, err_msg); return MEDIA_SVC_PLUGIN_ERROR; } ret = media_svc_insert_one_item_pass2(handle, storage_id, storage_type, data, burst); - if(ret < 0) { + if (ret < 0) { __set_error_message(ret, err_msg); return MEDIA_SVC_PLUGIN_ERROR; } @@ -979,13 +977,13 @@ int query_do_update_list(void* handle, char** err_msg) #if 0 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - if(handle == NULL) { + if (handle == NULL) { __set_error_message(ERR_HANDLE, err_msg); return MEDIA_SVC_PLUGIN_ERROR; } ret = media_svc_query_do_update_list(handle); - if(ret < 0) { + if (ret < 0) { __set_error_message(ret, err_msg); return MEDIA_SVC_PLUGIN_ERROR; } diff --git a/src/common/media-svc-album.c b/src/common/media-svc-album.c index 65a8c35..7dbf8dc 100755 --- a/src/common/media-svc-album.c +++ b/src/common/media-svc-album.c @@ -34,20 +34,19 @@ int _media_svc_get_album_id(sqlite3 *handle, const char *album, const char *arti media_svc_retvm_if(album == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "album is NULL"); - if (artist != NULL) { + if (artist != NULL) sql = sqlite3_mprintf("SELECT album_id FROM %s WHERE name = '%q' AND artist = '%q';", MEDIA_SVC_DB_TABLE_ALBUM, album, artist); - } else { + else sql = sqlite3_mprintf("SELECT album_id FROM %s WHERE name = '%q' AND artist IS NULL;", MEDIA_SVC_DB_TABLE_ALBUM, album, artist); - } ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt); if (ret != MS_MEDIA_ERR_NONE) { - if (ret == MS_MEDIA_ERR_DB_NO_RECORD) { + if (ret == MS_MEDIA_ERR_DB_NO_RECORD) media_svc_debug("there is no album."); - } else { + else media_svc_error("error when _media_svc_get_album_id. err = [%d]", ret); - } + return ret; } @@ -69,11 +68,11 @@ int _media_svc_get_album_art_by_album_id(sqlite3 *handle, int album_id, char **a ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt); if (ret != MS_MEDIA_ERR_NONE) { - if (ret == MS_MEDIA_ERR_DB_NO_RECORD) { + if (ret == MS_MEDIA_ERR_DB_NO_RECORD) media_svc_debug("there is no album_id."); - } else { + else media_svc_error("error when get album_art. err = [%d]", ret); - } + return ret; } @@ -126,11 +125,11 @@ int _media_svc_get_media_count_with_album_id_by_path(sqlite3 *handle, const char ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt); if (ret != MS_MEDIA_ERR_NONE) { - if (ret == MS_MEDIA_ERR_DB_NO_RECORD) { + if (ret == MS_MEDIA_ERR_DB_NO_RECORD) media_svc_debug("there is no media in relted to this media's album."); - } else { + else media_svc_error("error when _media_svc_get_media_count_with_album_id_by_path. err = [%d]", ret); - } + return ret; } diff --git a/src/common/media-svc-db-utils.c b/src/common/media-svc-db-utils.c index ae745da..0e885f9 100755 --- a/src/common/media-svc-db-utils.c +++ b/src/common/media-svc-db-utils.c @@ -1068,11 +1068,11 @@ void _media_svc_destroy_table_query() tb = g_hash_table_lookup(table, MEDIA_SVC_DB_TABLE_UHD); __media_svc_table_free(tb); - g_hash_table_remove (table, MEDIA_SVC_DB_TABLE_UHD); + g_hash_table_remove(table, MEDIA_SVC_DB_TABLE_UHD); tb = g_hash_table_lookup(table, MEDIA_SVC_DB_TABLE_PVR); __media_svc_table_free(tb); - g_hash_table_remove (table, MEDIA_SVC_DB_TABLE_PVR); + g_hash_table_remove(table, MEDIA_SVC_DB_TABLE_PVR); g_hash_table_destroy(table); diff --git a/src/common/media-svc-debug.c b/src/common/media-svc-debug.c index 21e482f..e23d06b 100755 --- a/src/common/media-svc-debug.c +++ b/src/common/media-svc-debug.c @@ -42,9 +42,8 @@ void mediainfo_init_file_debug() { if (g_log_fp == NULL) { snprintf(_g_file_path, sizeof(_g_file_path), "/tmp/%s", "media-info"); - if (access(_g_file_path, R_OK == 0)) { + if (access(_g_file_path, R_OK == 0)) remove(_g_file_path); - } g_log_fp = fopen(_g_file_path, "a"); } diff --git a/src/common/media-svc-localize_ch.c b/src/common/media-svc-localize_ch.c index 540a369..cef7744 100755 --- a/src/common/media-svc-localize_ch.c +++ b/src/common/media-svc-localize_ch.c @@ -2285,20 +2285,17 @@ int _media_svc_convert_chinese_to_pinyin(const char *src, pinyin_name_s **name, /*if(temp_name[j].pinyin_name[0]) */ /* name_len[j] += snprintf(temp_name[j].pinyin_name + name_len[j], pinyin_name_len - name_len[j], " "); */ - name_len[j] += snprintf(temp_name[j].pinyin_name + name_len[j], pinyin_name_len - name_len[j], - "%s", spell[i][index]); + name_len[j] += snprintf(temp_name[j].pinyin_name + name_len[j], pinyin_name_len - name_len[j], "%s", spell[i][index]); int char_len = _media_svc_check_utf8(spell[i][index][0]); if (char_len > 0) { if (char_len == 1) - initial_len[j] += snprintf(temp_name[j].pinyin_initial + initial_len[j], pinyin_initial_len - initial_len[j], - "%c", spell[i][index][0]); + initial_len[j] += snprintf(temp_name[j].pinyin_initial + initial_len[j], pinyin_initial_len - initial_len[j], "%c", spell[i][index][0]); else { char temp[10]; snprintf(temp, sizeof(temp), "%s", spell[i][index]); temp[char_len] = '\0'; - initial_len[j] += snprintf(temp_name[j].pinyin_initial + initial_len[j], pinyin_initial_len - initial_len[j], - "%s", temp); + initial_len[j] += snprintf(temp_name[j].pinyin_initial + initial_len[j], pinyin_initial_len - initial_len[j], "%s", temp); } } else { media_svc_error("_media_svc_check_utf8 failed"); diff --git a/src/common/media-svc-localize_tw.c b/src/common/media-svc-localize_tw.c index a932062..6c867ab 100755 --- a/src/common/media-svc-localize_tw.c +++ b/src/common/media-svc-localize_tw.c @@ -436,21 +436,21 @@ static bopomofo_map UNICODES[] = { { 0xA184, { 0x3127, 0x3122, 0x0, 0x0} }, /* I_AN */ { 0xA185, { 0x3127, 0x3123, 0x0, 0x0} }, /* I_EN */ { 0xA186, { 0x3127, 0x3124, 0x0, 0x0} }, /* I_ANG */ - { 0xA187, { 0x3127, 0x3125, 0x0, 0x0} }, /* I_ENG */ + { 0xA187, { 0x3127, 0x3125, 0x0, 0x0} }, /* I_ENG */ { 0xA188, { 0x3128, 0x0, 0x0, 0x0} }, /* U */ - { 0xA189, { 0x3128, 0x311A, 0x0, 0x0} }, /* U_A */ - { 0xA18A, { 0x3128, 0x311B, 0x0, 0x0} }, /* U_O */ - { 0xA18B, { 0x3128, 0x311E, 0x0, 0x0} }, /* U_AI */ - { 0xA18C, { 0x3128, 0x311F, 0x0, 0x0} }, /* U_EI */ - { 0xA18D, { 0x3128, 0x3122, 0x0, 0x0} }, /* U_AN */ - { 0xA18E, { 0x3128, 0x3123, 0x0, 0x0} }, /* U_EN */ - { 0xA18F, { 0x3128, 0x3124, 0x0, 0x0} }, /* U_ANG */ - { 0xA190, { 0x3128, 0x3125, 0x0, 0x0} }, /* U_ENG */ - { 0xA191, { 0x3129, 0x0, 0x0 } }, /* IU */ - { 0xA192, { 0x3129, 0x311D, 0x0, 0x0} }, /* IU_EH */ - { 0xA193, { 0x3129, 0x3122, 0x0, 0x0} }, /* IU_AN */ - { 0xA194, { 0x3129, 0x3123, 0x0, 0x0} }, /* IU_EN */ - { 0xA195, { 0x3129, 0x3125, 0x0, 0x0} }, /* IU_ENG */ + { 0xA189, { 0x3128, 0x311A, 0x0, 0x0} }, /* U_A */ + { 0xA18A, { 0x3128, 0x311B, 0x0, 0x0} }, /* U_O */ + { 0xA18B, { 0x3128, 0x311E, 0x0, 0x0} }, /* U_AI */ + { 0xA18C, { 0x3128, 0x311F, 0x0, 0x0} }, /* U_EI */ + { 0xA18D, { 0x3128, 0x3122, 0x0, 0x0} }, /* U_AN */ + { 0xA18E, { 0x3128, 0x3123, 0x0, 0x0} }, /* U_EN */ + { 0xA18F, { 0x3128, 0x3124, 0x0, 0x0} }, /* U_ANG */ + { 0xA190, { 0x3128, 0x3125, 0x0, 0x0} }, /* U_ENG */ + { 0xA191, { 0x3129, 0x0, 0x0 } }, /* IU */ + { 0xA192, { 0x3129, 0x311D, 0x0, 0x0} }, /* IU_EH */ + { 0xA193, { 0x3129, 0x3122, 0x0, 0x0} }, /* IU_AN */ + { 0xA194, { 0x3129, 0x3123, 0x0, 0x0} }, /* IU_EN */ + { 0xA195, { 0x3129, 0x3125, 0x0, 0x0} }, /* IU_ENG */ { 0xA196, { 0x311A, 0x0, 0x0, 0x0} }, /* A */ { 0xA197, { 0x311B, 0x0, 0x0, 0x0} }, /* O */ { 0xA198, { 0x311C, 0x0, 0x0, 0x0} }, /* E */ @@ -14053,11 +14053,10 @@ static UChar *__media_svc_bopomofo_find(bopomofo_map *table, int size, UChar src } else if (lowerBound > upperBound) { return NULL; } else { - if (table[curIn].yi_syllable < src) { + if (table[curIn].yi_syllable < src) lowerBound = curIn + 1; - } else { + else upperBound = curIn - 1; - } } } return NULL; @@ -14160,9 +14159,8 @@ static const UChar *__media_svc_get_bpmf(const UChar src) code = __media_svc_yi_syllable_find(HANZI_TO_BPMF_MAP_9, array_sizeof(HANZI_TO_BPMF_MAP_9), src); else if (MAP_10_BEGIN <= src && src < MAP_END) code = __media_svc_yi_syllable_find(HANZI_TO_BPMF_MAP_10, array_sizeof(HANZI_TO_BPMF_MAP_10), src); - else { + else return NULL; - } } else if (src >= 0x3105 && src <= 0x3129) { code = __media_svc_yi_syllable_find(BPMF_TO_BPMF_MAP, array_sizeof(BPMF_TO_BPMF_MAP), src); } else @@ -14351,66 +14349,66 @@ char _media_svc_bpmf_get_fuzzy_number(const char *src) { char fuzzy_number = '*'; switch (src[2]) { - case 0x85: /* \u3105 : u3105, e3 84 85 - 1 */ - case 0x86: /* \u3106 : u3106, e3 84 86 - 1 */ - case 0x87: /* \u3107 : u3107, e3 84 87 - 1 */ - case 0x88: /* \u3108 : u3108, e3 84 88 - 1 */ - fuzzy_number = '1'; - break; - case 0x89: /* \u3109: u3109, e3 84 89 - 2 */ - case 0x8a: /* \u310a: u310a, e3 84 8a - 2 */ - case 0x8b: /* \u310b: u310b, e3 84 8b - 2 */ - case 0x8c: /* \u310c: u310c, e3 84 8c - 2 */ - fuzzy_number = '2'; - break; - case 0x8d: /* \u310d: u310d, e3 84 8d - 3 */ - case 0x8e: /* \u310e: u310e, e3 84 8e - 3 */ - case 0x8f: /* \u310f: u310f, e3 84 8f - 3 */ - fuzzy_number = '3'; - break; - case 0x90: /* \u3110: u3110, e3 84 90 - 4 */ - case 0x91: /* \u3111: u3111, e3 84 91 - 4 */ - case 0x92: /* \u3112: u3112, e3 84 92 - 4 */ - fuzzy_number = '4'; - break; - case 0x93: /* \u3113: u3113, e3 84 93 - 5 */ - case 0x94: /* \u3114: u3114, e3 84 94 - 5 */ - case 0x95: /* \u3115: u3115, e3 84 95 - 5 */ - case 0x96: /* \u3116: u3116, e3 84 96 - 5 */ - fuzzy_number = '5'; - break; - case 0x97: /* \u3117: u3117, e3 84 97 - 6 */ - case 0x98: /* \u3118: u3118, e3 84 98 - 6 */ - case 0x99: /* \u3119: u3119, e3 84 99 - 6 */ - fuzzy_number = '6'; - break; - case 0x9a: /* \u311a: u311a, e3 84 9a - 7 */ - case 0x9b: /* \u311b: u311b, e3 84 9b - 7 */ - case 0x9c: /* \u311c: u311c, e3 84 9c - 7 */ - case 0x9d: /* \u311d: u311d, e3 84 9d - 7 */ - fuzzy_number = '7'; - break; - case 0x9e: /* \u311e: u311e, e3 84 9e - 8 */ - case 0x9f: /* \u311f: u311f, e3 84 9f - 8 */ - case 0xa0: /* \u3120: u3120, e3 84 a0 - 8 */ - case 0xa1: /* \u3121: u3121, e3 84 a1 - 8 */ - fuzzy_number = '8'; - break; - case 0xa2: /* \u3122: u3122, e3 84 a2 - 9 */ - case 0xa3: /* \u3123: u3123, e3 84 a3 - 9 */ - case 0xa4: /* \u3124: u3124, e3 84 a4 - 9 */ - case 0xa5: /* \u3125: u3125, e3 84 a5 - 9 */ - case 0xa6: /* \u3126: u3126, e3 84 a6 - 9 */ - fuzzy_number = '9'; - break; - case 0xa7: /* \u3127: u3127, e3 84 a7 - 0 */ - case 0xa8: /* \u3128: u3128, e3 84 a8 - 0 */ - case 0xa9: /* \u3129: u3129, e3 84 a9 - 0 */ - fuzzy_number = '0'; - break; - default: - fuzzy_number = '*'; - break; + case 0x85: /* \u3105 : u3105, e3 84 85 - 1 */ + case 0x86: /* \u3106 : u3106, e3 84 86 - 1 */ + case 0x87: /* \u3107 : u3107, e3 84 87 - 1 */ + case 0x88: /* \u3108 : u3108, e3 84 88 - 1 */ + fuzzy_number = '1'; + break; + case 0x89: /* \u3109: u3109, e3 84 89 - 2 */ + case 0x8a: /* \u310a: u310a, e3 84 8a - 2 */ + case 0x8b: /* \u310b: u310b, e3 84 8b - 2 */ + case 0x8c: /* \u310c: u310c, e3 84 8c - 2 */ + fuzzy_number = '2'; + break; + case 0x8d: /* \u310d: u310d, e3 84 8d - 3 */ + case 0x8e: /* \u310e: u310e, e3 84 8e - 3 */ + case 0x8f: /* \u310f: u310f, e3 84 8f - 3 */ + fuzzy_number = '3'; + break; + case 0x90: /* \u3110: u3110, e3 84 90 - 4 */ + case 0x91: /* \u3111: u3111, e3 84 91 - 4 */ + case 0x92: /* \u3112: u3112, e3 84 92 - 4 */ + fuzzy_number = '4'; + break; + case 0x93: /* \u3113: u3113, e3 84 93 - 5 */ + case 0x94: /* \u3114: u3114, e3 84 94 - 5 */ + case 0x95: /* \u3115: u3115, e3 84 95 - 5 */ + case 0x96: /* \u3116: u3116, e3 84 96 - 5 */ + fuzzy_number = '5'; + break; + case 0x97: /* \u3117: u3117, e3 84 97 - 6 */ + case 0x98: /* \u3118: u3118, e3 84 98 - 6 */ + case 0x99: /* \u3119: u3119, e3 84 99 - 6 */ + fuzzy_number = '6'; + break; + case 0x9a: /* \u311a: u311a, e3 84 9a - 7 */ + case 0x9b: /* \u311b: u311b, e3 84 9b - 7 */ + case 0x9c: /* \u311c: u311c, e3 84 9c - 7 */ + case 0x9d: /* \u311d: u311d, e3 84 9d - 7 */ + fuzzy_number = '7'; + break; + case 0x9e: /* \u311e: u311e, e3 84 9e - 8 */ + case 0x9f: /* \u311f: u311f, e3 84 9f - 8 */ + case 0xa0: /* \u3120: u3120, e3 84 a0 - 8 */ + case 0xa1: /* \u3121: u3121, e3 84 a1 - 8 */ + fuzzy_number = '8'; + break; + case 0xa2: /* \u3122: u3122, e3 84 a2 - 9 */ + case 0xa3: /* \u3123: u3123, e3 84 a3 - 9 */ + case 0xa4: /* \u3124: u3124, e3 84 a4 - 9 */ + case 0xa5: /* \u3125: u3125, e3 84 a5 - 9 */ + case 0xa6: /* \u3126: u3126, e3 84 a6 - 9 */ + fuzzy_number = '9'; + break; + case 0xa7: /* \u3127: u3127, e3 84 a7 - 0 */ + case 0xa8: /* \u3128: u3128, e3 84 a8 - 0 */ + case 0xa9: /* \u3129: u3129, e3 84 a9 - 0 */ + fuzzy_number = '0'; + break; + default: + fuzzy_number = '*'; + break; } return fuzzy_number; @@ -14420,9 +14418,8 @@ char _media_svc_bpmf_get_fuzzy_number(const char *src) bool _media_svc_bpmf_is_bpmf(const char *src) { if (src[0] == 0xe3 && src[1] == 0x84) { - if (src[2] >= 0x85 && src[2] <= 0xa9) { + if (src[2] >= 0x85 && src[2] <= 0xa9) return true; - } } return false; diff --git a/src/common/media-svc-media-folder.c b/src/common/media-svc-media-folder.c index 19ecd58..1599d90 100755 --- a/src/common/media-svc-media-folder.c +++ b/src/common/media-svc-media-folder.c @@ -110,11 +110,11 @@ int _media_svc_get_folder_id_by_foldername(sqlite3 *handle, const char *storage_ ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt); if (ret != MS_MEDIA_ERR_NONE) { - if (ret == MS_MEDIA_ERR_DB_NO_RECORD) { + if (ret == MS_MEDIA_ERR_DB_NO_RECORD) media_svc_debug("there is no folder."); - } else { + else media_svc_error("error when _media_svc_get_folder_id_by_foldername. err = [%d]", ret); - } + return ret; } @@ -161,9 +161,8 @@ int _media_svc_get_folder_id_by_foldername(sqlite3 *handle, const char *storage_ ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt); if (ret == MS_MEDIA_ERR_NONE) { temp_parent_uuid = (char *)sqlite3_column_text(sql_stmt, 0); - if (temp_parent_uuid != NULL) { + if (temp_parent_uuid != NULL) _strncpy_safe(parent_folder_uuid, temp_parent_uuid, MEDIA_SVC_UUID_SIZE+1); - } SQLITE3_FINALIZE(sql_stmt); } @@ -292,9 +291,8 @@ static int __media_svc_get_and_append_parent_folder(sqlite3 *handle, const char } ret = __media_svc_append_folder(storage_id, storage_type, folder_uuid, dir_path, parent_folder_uuid, FALSE, uid); - if (ret != MS_MEDIA_ERR_NONE) { + if (ret != MS_MEDIA_ERR_NONE) media_svc_error("__media_svc_append_folder is failed"); - } media_svc_error("[No-Error] New Appended folder path [%s], folder_uuid [%s], parent_folder_uuid [%s]", dir_path, folder_uuid, parent_folder_uuid); _strncpy_safe(parent_folder_uuid, folder_uuid, MEDIA_SVC_UUID_SIZE + 1); @@ -321,9 +319,8 @@ int _media_svc_get_and_append_folder(sqlite3 *handle, const char *storage_id, co ret = _media_svc_get_folder_id_by_foldername(handle, storage_id, path, folder_id, uid); - if (ret == MS_MEDIA_ERR_DB_NO_RECORD) { + if (ret == MS_MEDIA_ERR_DB_NO_RECORD) ret = __media_svc_get_and_append_parent_folder(handle, storage_id, path, storage_type, folder_id, uid); - } return ret; } @@ -462,9 +459,9 @@ int _media_svc_get_all_folders(sqlite3 *handle, char *start_path, char ***folder } /* free all data */ - for (i = 0; i < idx; i++) { + for (i = 0; i < idx; i++) SAFE_FREE(folder_uuid[i]); - } + SAFE_FREE(folder_uuid); return ret; @@ -496,11 +493,11 @@ int _media_svc_get_folder_info_by_foldername(sqlite3 *handle, const char *storag ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt); if (ret != MS_MEDIA_ERR_NONE) { - if (ret == MS_MEDIA_ERR_DB_NO_RECORD) { + if (ret == MS_MEDIA_ERR_DB_NO_RECORD) media_svc_debug("there is no folder."); - } else { + else media_svc_error("error when _media_svc_get_folder_id_by_foldername. err = [%d]", ret); - } + return ret; } @@ -658,9 +655,8 @@ int _media_svc_get_folder_scan_status(sqlite3 *handle, const char *storage_id, c media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); - while (sqlite3_step(sql_stmt) == SQLITE_ROW) { + while (sqlite3_step(sql_stmt) == SQLITE_ROW) *scan_status = sqlite3_column_int(sql_stmt, 0); - } SQLITE3_FINALIZE(sql_stmt); @@ -672,11 +668,10 @@ int _media_svc_set_folder_scan_status(const char *storage_id, const char *path, int ret = MS_MEDIA_ERR_NONE; char *sql = NULL; - if (path) { + if (path) sql = sqlite3_mprintf("UPDATE '%s' SET scan_status=%d WHERE path = '%q' AND storage_uuid = '%q'", MEDIA_SVC_DB_TABLE_FOLDER, scan_status, path, storage_id); - } else { + else sql = sqlite3_mprintf("UPDATE '%s' SET scan_status=%d WHERE storage_uuid = '%q'", MEDIA_SVC_DB_TABLE_FOLDER, scan_status, storage_id); - } ret = _media_svc_sql_query(sql, uid); sqlite3_free(sql); @@ -694,11 +689,11 @@ int _media_svc_get_folder_modified_time_by_path(sqlite3 *handle, const char *pat ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt); if (ret != MS_MEDIA_ERR_NONE) { - if (ret == MS_MEDIA_ERR_DB_NO_RECORD) { + if (ret == MS_MEDIA_ERR_DB_NO_RECORD) media_svc_debug("there is no folder."); - } else { + else media_svc_error("error when _media_svc_get_folder_modified_time_by_path. err = [%d]", ret); - } + return ret; } @@ -723,11 +718,10 @@ int _media_svc_get_null_scan_folder_list(sqlite3 *handle, const char *storage_id ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt); if (ret != MS_MEDIA_ERR_NONE) { - if (ret == MS_MEDIA_ERR_DB_NO_RECORD) { + if (ret == MS_MEDIA_ERR_DB_NO_RECORD) media_svc_debug("there is no folder."); - } else { + else media_svc_error("error when get folder_id by path. err = [%d]", ret); - } *folder_list = NULL; *count = 0; @@ -761,11 +755,11 @@ int _media_svc_get_null_scan_folder_list(sqlite3 *handle, const char *storage_id ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt); if (ret != MS_MEDIA_ERR_NONE) { - if (ret == MS_MEDIA_ERR_DB_NO_RECORD) { + if (ret == MS_MEDIA_ERR_DB_NO_RECORD) media_svc_debug("there is no folder."); - } else { + else media_svc_error("error when get folder_id by path [%s]. err = [%d]", path, ret); - } + return ret; } @@ -821,9 +815,9 @@ int _media_svc_get_null_scan_folder_list(sqlite3 *handle, const char *storage_id } else { /* free all data */ int i = 0; - for (i = 0; i < idx; i++) { + for (i = 0; i < idx; i++) SAFE_FREE((*folder_list)[i]); - } + SAFE_FREE(*folder_list); *count = 0; ret = MS_MEDIA_ERR_INTERNAL; diff --git a/src/common/media-svc-media.c b/src/common/media-svc-media.c index 513eebc..834beaa 100755 --- a/src/common/media-svc-media.c +++ b/src/common/media-svc-media.c @@ -1129,7 +1129,7 @@ int _media_svc_insert_item_pass2(const char *storage_id, media_svc_content_info_ fnumber=%.6f, iso=%d, model=%Q, rating=%d, weather=%Q, file_name_pinyin=%Q, title_pinyin=%Q, album_pinyin=%Q, \ artist_pinyin=%Q, album_artist_pinyin=%Q, genre_pinyin=%Q, composer_pinyin=%Q, copyright_pinyin=%Q, description_pinyin=%Q, is_360=%d WHERE path=%Q;", storage_id, - //content_info->folder_uuid, + /* content_info->folder_uuid, */ content_info->thumbnail_path, content_info->media_meta.title, content_info->album_id, diff --git a/src/common/media-svc-noti.c b/src/common/media-svc-noti.c index 1dbb6c2..319d110 100755 --- a/src/common/media-svc-noti.c +++ b/src/common/media-svc-noti.c @@ -209,9 +209,8 @@ int _media_svc_publish_noti_list(int all_cnt) media_svc_noti_item *noti_list = g_inserted_noti_list; if (noti_list) { - for (idx = 0; idx < all_cnt; idx++) { + for (idx = 0; idx < all_cnt; idx++) ret = __media_svc_publish_noti_by_item(&(noti_list[idx])); - } } return ret; diff --git a/src/common/media-svc-storage.c b/src/common/media-svc-storage.c index 1610cba..4af6f91 100755 --- a/src/common/media-svc-storage.c +++ b/src/common/media-svc-storage.c @@ -221,9 +221,8 @@ int _media_svc_get_storage_uuid(sqlite3 *handle, const char *path, char *storage ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt); media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); - if (STRING_VALID((const char *)sqlite3_column_text(sql_stmt, 0))) { + if (STRING_VALID((const char *)sqlite3_column_text(sql_stmt, 0))) _strncpy_safe(storage_id, (const char *)sqlite3_column_text(sql_stmt, 0), MEDIA_SVC_UUID_SIZE+1); - } SQLITE3_FINALIZE(sql_stmt); SAFE_FREE(storage_path); diff --git a/src/common/media-svc-util.c b/src/common/media-svc-util.c index d0c3421..88b59cc 100755 --- a/src/common/media-svc-util.c +++ b/src/common/media-svc-util.c @@ -281,9 +281,8 @@ static int __media_svc_get_exif_info(ExifData *ed, char *buf, int *i_value, doub ExifEntry *entry; ExifTag tag; - if (ed == NULL) { + if (ed == NULL) return MS_MEDIA_ERR_INVALID_PARAMETER; - } tag = tagtype; @@ -387,16 +386,14 @@ time_t __media_svc_get_timeline_from_str(const char *timstr) if (strptime(timstr, "%Y:%m:%d %H:%M:%S", &t) || strptime(timstr, "%Y-%m-%d %H:%M:%S", &t)) { t.tm_isdst = timeinfo.tm_isdst; - if (t.tm_isdst != 0) { + if (t.tm_isdst != 0) media_svc_error("DST %d", t.tm_isdst); - } modified_t = mktime(&t); - if (modified_t > 0) { + if (modified_t > 0) return modified_t; - } else { + else media_svc_error("Failed to get timeline : [%s] [%d:%d:%d: %d:%d:%d]", timstr, t.tm_year, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec); - } } else { media_svc_error("Failed to get timeline : [%s]", timstr); } @@ -509,9 +506,8 @@ static int __media_svc_get_media_type(const char *path, const char *mime_type, m media_svc_media_type_e type; ret = __media_svc_get_content_type_from_mime(path, mime_type, &category); - if (ret != MS_MEDIA_ERR_NONE) { + if (ret != MS_MEDIA_ERR_NONE) media_svc_error("__media_svc_get_content_type_from_mime failed : %d", ret); - } if (category & MEDIA_SVC_CATEGORY_SOUND) type = MEDIA_SVC_MEDIA_TYPE_SOUND; else if (category & MEDIA_SVC_CATEGORY_MUSIC) type = MEDIA_SVC_MEDIA_TYPE_MUSIC; @@ -552,9 +548,8 @@ static bool __media_svc_get_file_ext(const char *file_path, char *file_ext) return true; } - if (file_path[i] == '/') { + if (file_path[i] == '/') return false; - } } return false; } @@ -567,27 +562,24 @@ static int __media_svc_get_location_value(MMHandleType tag, double *longitude, d mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_LONGITUDE, &gps_value, NULL); if (mmf_error == FILEINFO_ERROR_NONE) { - if (longitude != NULL) { + if (longitude != NULL) *longitude = (gps_value == 0.0) ? MEDIA_SVC_DEFAULT_GPS_VALUE : gps_value; - } } else { SAFE_FREE(err_attr_name); } mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_LATIDUE, &gps_value, NULL); if (mmf_error == FILEINFO_ERROR_NONE) { - if (latitude != NULL) { + if (latitude != NULL) *latitude = (gps_value == 0.0) ? MEDIA_SVC_DEFAULT_GPS_VALUE : gps_value; - } } else { SAFE_FREE(err_attr_name); } mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_ALTIDUE, &gps_value, NULL); if (mmf_error == FILEINFO_ERROR_NONE) { - if (altitude != NULL) { + if (altitude != NULL) *altitude = (gps_value == 0.0) ? MEDIA_SVC_DEFAULT_GPS_VALUE : gps_value; - } } else { SAFE_FREE(err_attr_name); } @@ -867,17 +859,17 @@ int _media_svc_remove_all_files_in_dir(const char *dir_path) if (result == NULL) break; - if (strcmp(entry.d_name, ".") == 0 || strcmp(entry.d_name, "..") == 0) { + if (strcmp(entry.d_name, ".") == 0 || strcmp(entry.d_name, "..") == 0) continue; - } + snprintf(filename, sizeof(filename), "%s/%s", dir_path, entry.d_name); - if (stat(filename, &st) != 0) { + if (stat(filename, &st) != 0) continue; - } - if (S_ISDIR(st.st_mode)) { + + if (S_ISDIR(st.st_mode)) continue; - } + if (unlink(filename) != 0) { media_svc_stderror("failed to remove"); closedir(dir); @@ -989,13 +981,12 @@ static int __media_svc_check_thumb_dir(const char *thumb_dir) } ret = chmod(thumb_dir, 0777); - if (ret != 0) { + if (ret != 0) media_svc_stderror("chmod failed"); - } + ret = chown(thumb_dir, 5000, 5000); - if (ret != 0) { + if (ret != 0) media_svc_stderror("chown failed"); - } } return MS_MEDIA_ERR_NONE; @@ -1033,9 +1024,8 @@ int _media_svc_get_thumbnail_path(media_svc_storage_type_e storage_type, char *t } memset(file_ext, 0, sizeof(file_ext)); - if (!__media_svc_get_file_ext(pathname, file_ext)) { + if (!__media_svc_get_file_ext(pathname, file_ext)) media_svc_error("get file ext fail"); - } ret = mb_svc_generate_hash_code(pathname, hash, sizeof(hash)); if (ret != MS_MEDIA_ERR_NONE) { @@ -1171,7 +1161,7 @@ int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char content_info->modified_time = st.st_mtime; content_info->timeline = content_info->modified_time; content_info->size = st.st_size; - //media_svc_debug("Modified time : [%d] Size : [%lld]", content_info->modified_time, content_info->size); + /* media_svc_debug("Modified time : [%d] Size : [%lld]", content_info->modified_time, content_info->size); */ } else { media_svc_stderror("stat failed"); } @@ -1253,12 +1243,12 @@ int image_360_check(char *path) if (fp == NULL) goto ERROR; - size = fread(exif_header, 1, sizeof (exif_header), fp); + size = fread(exif_header, 1, sizeof(exif_header), fp); if (size <= 0) goto ERROR; if ((exif_header[0] == 0xff) && (exif_header[1] == 0xd8) && (exif_header[2] == 0xff) && (exif_header[3] == 0xe1)) { - size = fread(exif_app1, 1, sizeof (exif_app1), fp); + size = fread(exif_app1, 1, sizeof(exif_app1), fp); if (size <= 0) goto ERROR; @@ -1270,14 +1260,14 @@ int image_360_check(char *path) if (fseek(fp, app1_size, SEEK_CUR) != 0) goto ERROR; - size = fread(exif_app1_xmp, 1, sizeof (exif_app1_xmp), fp); + size = fread(exif_app1_xmp, 1, sizeof(exif_app1_xmp), fp); if (size <= 0) goto ERROR; if ((exif_app1_xmp[0] == 0xff) && (exif_app1_xmp[1] == 0xe1)) { int result = 0; char *ptr = NULL; - size = fread(exif_app1_xmp_t, 1, sizeof (exif_app1_xmp_t), fp); + size = fread(exif_app1_xmp_t, 1, sizeof(exif_app1_xmp_t), fp); if (size <= 0) goto ERROR; @@ -1300,7 +1290,7 @@ int image_360_check(char *path) } ptr = ptr - temp; - if(strstr(ptr, "UsePanoramaViewer") + if (strstr(ptr, "UsePanoramaViewer") && strstr(ptr, "True") && strstr(ptr, "ProjectionType") && strstr(ptr, "equirectangular")) @@ -1374,9 +1364,8 @@ int _media_svc_extract_image_metadata(sqlite3 *handle, media_svc_content_info_s if (__media_svc_get_exif_info(ed, NULL, NULL, &value, EXIF_TAG_GPS_LATITUDE) == MS_MEDIA_ERR_NONE) { if (__media_svc_get_exif_info(ed, buf, NULL, NULL, EXIF_TAG_GPS_LATITUDE_REF) == MS_MEDIA_ERR_NONE) { if (strlen(buf) > 0) { - if (strcmp(buf, "S") == 0) { + if (strcmp(buf, "S") == 0) value = -1 * value; - } } content_info->media_meta.latitude = value; } else { @@ -1391,9 +1380,8 @@ int _media_svc_extract_image_metadata(sqlite3 *handle, media_svc_content_info_s if (__media_svc_get_exif_info(ed, NULL, NULL, &value, EXIF_TAG_GPS_LONGITUDE) == MS_MEDIA_ERR_NONE) { if (__media_svc_get_exif_info(ed, buf, NULL, NULL, EXIF_TAG_GPS_LONGITUDE_REF) == MS_MEDIA_ERR_NONE) { if (strlen(buf) > 0) { - if (strcmp(buf, "W") == 0) { + if (strcmp(buf, "W") == 0) value = -1 * value; - } } content_info->media_meta.longitude = value; } else { @@ -1462,17 +1450,16 @@ int _media_svc_extract_image_metadata(sqlite3 *handle, media_svc_content_info_s if (has_datetaken) { content_info->timeline = __media_svc_get_timeline_from_str(content_info->media_meta.datetaken); - if (content_info->timeline == 0) { + if (content_info->timeline == 0) content_info->timeline = content_info->modified_time; - } else { + else media_svc_debug("Timeline : %ld", content_info->timeline); - } } /* Get exposure_time value from exif. */ if (__media_svc_get_exif_info(ed, exposure_time_buf, NULL, NULL, EXIF_TAG_EXPOSURE_TIME) == MS_MEDIA_ERR_NONE) { if (strlen(exposure_time_buf) == 0) { - //media_svc_debug("exposure_time_buf is NULL"); + /* media_svc_debug("exposure_time_buf is NULL"); */ } else { ret = __media_svc_malloc_and_strncpy(&content_info->media_meta.exposure_time, exposure_time_buf); if (ret != MS_MEDIA_ERR_NONE) @@ -1482,22 +1469,20 @@ int _media_svc_extract_image_metadata(sqlite3 *handle, media_svc_content_info_s /* Get fnumber value from exif. */ if (__media_svc_get_exif_info(ed, NULL, NULL, &fnumber, EXIF_TAG_FNUMBER) == MS_MEDIA_ERR_NONE) { - if (fnumber > 0.0) { + if (fnumber > 0.0) content_info->media_meta.fnumber = fnumber; - } else { + else content_info->media_meta.fnumber = 0.0; - } } else { content_info->media_meta.fnumber = 0.0; } /* Get iso value from exif. */ if (__media_svc_get_exif_info(ed, NULL, &iso, NULL, EXIF_TAG_ISO_SPEED_RATINGS) == MS_MEDIA_ERR_NONE) { - if (iso > 0) { + if (iso > 0) content_info->media_meta.iso = iso; - } else { + else content_info->media_meta.iso = 0; - } } else { content_info->media_meta.iso = 0; } @@ -1505,7 +1490,7 @@ int _media_svc_extract_image_metadata(sqlite3 *handle, media_svc_content_info_s /* Get model value from exif. */ if (__media_svc_get_exif_info(ed, model_buf, NULL, NULL, EXIF_TAG_MODEL) == MS_MEDIA_ERR_NONE) { if (strlen(model_buf) == 0) { - //media_svc_debug("model_buf is NULL"); + /* media_svc_debug("model_buf is NULL"); */ } else { ret = __media_svc_malloc_and_strncpy(&content_info->media_meta.model, model_buf); if (ret != MS_MEDIA_ERR_NONE) @@ -1515,33 +1500,30 @@ int _media_svc_extract_image_metadata(sqlite3 *handle, media_svc_content_info_s /* Get orientation value from exif. */ if (__media_svc_get_exif_info(ed, NULL, &orient_value, NULL, EXIF_TAG_ORIENTATION) == MS_MEDIA_ERR_NONE) { - if (orient_value >= NOT_AVAILABLE && orient_value <= ROT_270) { + if (orient_value >= NOT_AVAILABLE && orient_value <= ROT_270) content_info->media_meta.orientation = orient_value; - } else { + else content_info->media_meta.orientation = 0; - } } else { content_info->media_meta.orientation = 0; } /* Get width value from exif. */ if (__media_svc_get_exif_info(ed, NULL, &exif_width, NULL, EXIF_TAG_PIXEL_X_DIMENSION) == MS_MEDIA_ERR_NONE) { - if (exif_width > 0) { + if (exif_width > 0) content_info->media_meta.width = exif_width; - } else { + else content_info->media_meta.width = 0; - } } else { content_info->media_meta.width = 0; } /* Get height value from exif. */ if (__media_svc_get_exif_info(ed, NULL, &exif_height, NULL, EXIF_TAG_PIXEL_Y_DIMENSION) == MS_MEDIA_ERR_NONE) { - if (exif_height > 0) { + if (exif_height > 0) content_info->media_meta.height = exif_height; - } else { + else content_info->media_meta.height = 0; - } } else { content_info->media_meta.height = 0; } @@ -1723,9 +1705,8 @@ int _media_svc_extract_music_metadata_for_update(sqlite3 *handle, media_svc_cont } mmf_error = mm_file_destroy_tag_attrs(tag); - if (mmf_error != FILEINFO_ERROR_NONE) { + if (mmf_error != FILEINFO_ERROR_NONE) media_svc_error("fail to free tag attr - err(%x)", mmf_error); - } } else { /* in case of file size 0, MMFW Can't parsting tag info but add it to Music DB. */ char *no_tag_title = NULL; @@ -1885,9 +1866,8 @@ int _media_svc_extract_media_metadata(sqlite3 *handle, media_svc_content_info_s mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_360, &content_info->media_meta.is_360, NULL); - if (mmf_error != FILEINFO_ERROR_NONE) { + if (mmf_error != FILEINFO_ERROR_NONE) SAFE_FREE(err_attr_name); - } mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_RECDATE, &p, &size, NULL); if ((mmf_error == FILEINFO_ERROR_NONE) && (size > 0)) { @@ -1928,11 +1908,10 @@ int _media_svc_extract_media_metadata(sqlite3 *handle, media_svc_content_info_s media_svc_error("strcpy error"); content_info->timeline = __media_svc_get_timeline_from_str(content_info->media_meta.recorded_date); - if (content_info->timeline == 0) { + if (content_info->timeline == 0) content_info->timeline = content_info->modified_time; - } else { + else media_svc_debug("Timeline : %ld", content_info->timeline); - } } /*media_svc_debug("Recorded date : %s", content_info->media_meta.recorded_date); */ } else { @@ -2050,9 +2029,8 @@ int _media_svc_extract_media_metadata(sqlite3 *handle, media_svc_content_info_s mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_ARTWORK_MIME, &p, &artwork_mime_size, NULL); if ((mmf_error == FILEINFO_ERROR_NONE) && (artwork_mime_size > 0)) { ret = _media_svc_get_thumbnail_path(content_info->storage_type, thumb_path, content_info->path, p, uid); - if (ret != MS_MEDIA_ERR_NONE) { + if (ret != MS_MEDIA_ERR_NONE) media_svc_error("Fail to Get Thumbnail Path"); - } /* albumart resizing */ __media_svc_resize_artwork(image, size, p, &resize_image, &resize_size); } else { @@ -2102,9 +2080,8 @@ int _media_svc_extract_media_metadata(sqlite3 *handle, media_svc_content_info_s } mmf_error = mm_file_destroy_tag_attrs(tag); - if (mmf_error != FILEINFO_ERROR_NONE) { + if (mmf_error != FILEINFO_ERROR_NONE) media_svc_error("fail to free tag attr - err(%x)", mmf_error); - } } else { /* in case of file size 0, MMFW Can't parsting tag info but add it to Music DB. */ char *no_tag_title = NULL; @@ -2124,11 +2101,10 @@ int _media_svc_extract_media_metadata(sqlite3 *handle, media_svc_content_info_s } /*Get Content attribute ===========*/ - if (cdis_value == 1) { + if (cdis_value == 1) mmf_error = mm_file_create_content_attrs_safe(&content, content_info->path); - } else { + else mmf_error = mm_file_create_content_attrs_simple(&content, content_info->path); - } if (mmf_error == FILEINFO_ERROR_NONE) { /*Common attribute*/ @@ -2215,16 +2191,15 @@ int _media_svc_extract_media_metadata(sqlite3 *handle, media_svc_content_info_s } else { media_svc_error("Not support type"); mmf_error = mm_file_destroy_content_attrs(content); - if (mmf_error != FILEINFO_ERROR_NONE) { + if (mmf_error != FILEINFO_ERROR_NONE) media_svc_error("fail to free content attr - err(%x)", mmf_error); - } + return MS_MEDIA_ERR_INVALID_PARAMETER; } mmf_error = mm_file_destroy_content_attrs(content); - if (mmf_error != FILEINFO_ERROR_NONE) { + if (mmf_error != FILEINFO_ERROR_NONE) media_svc_error("fail to free content attr - err(%x)", mmf_error); - } } else { media_svc_error("error in mm_file_create_content_attrs [%d]", mmf_error); } @@ -2377,7 +2352,7 @@ int _media_svc_get_pinyin_str(const char *src_str, char **pinyin_str) if (size > 0 && STRING_VALID(pinyinname[0].pinyin_name)) *pinyin_str = strdup(pinyinname[0].pinyin_name); else - *pinyin_str = strdup(src_str); //Return Original Non China Character + *pinyin_str = strdup(src_str); /* Return Original Non China Character */ } _media_svc_pinyin_free(pinyinname, size); diff --git a/src/common/media-svc.c b/src/common/media-svc.c index 1dd8cc0..d59ed51 100755 --- a/src/common/media-svc.c +++ b/src/common/media-svc.c @@ -365,15 +365,14 @@ int media_svc_insert_item_bulk(MediaSvcHandle *handle, const char *storage_id, m return ret; if (media_type == MEDIA_SVC_MEDIA_TYPE_OTHER - ||(media_type == MEDIA_SVC_MEDIA_TYPE_PVR) - ||(media_type == MEDIA_SVC_MEDIA_TYPE_UHD) - ||(media_type == MEDIA_SVC_MEDIA_TYPE_SCSA)) { - /*Do nothing.*/ - } else if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) { + || (media_type == MEDIA_SVC_MEDIA_TYPE_PVR) + || (media_type == MEDIA_SVC_MEDIA_TYPE_UHD) + || (media_type == MEDIA_SVC_MEDIA_TYPE_SCSA)) + media_svc_debug("Do nothing[%d]", media_type); + else if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) ret = _media_svc_extract_image_metadata(db_handle, &content_info); - } else { + else ret = _media_svc_extract_media_metadata(db_handle, &content_info, uid); - } media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info); /*Set or Get folder id*/ @@ -452,14 +451,13 @@ int media_svc_insert_item_immediately(MediaSvcHandle *handle, const char *storag /*Set media info*/ ret = _media_svc_set_media_info(&content_info, storage_id, storage_type, path, &media_type, FALSE); - if (ret != MS_MEDIA_ERR_NONE) { + if (ret != MS_MEDIA_ERR_NONE) return ret; - } if (media_type == MEDIA_SVC_MEDIA_TYPE_OTHER - ||(media_type == MEDIA_SVC_MEDIA_TYPE_PVR) - ||(media_type == MEDIA_SVC_MEDIA_TYPE_UHD) - ||(media_type == MEDIA_SVC_MEDIA_TYPE_SCSA)) { + || (media_type == MEDIA_SVC_MEDIA_TYPE_PVR) + || (media_type == MEDIA_SVC_MEDIA_TYPE_UHD) + || (media_type == MEDIA_SVC_MEDIA_TYPE_SCSA)) { /*Do nothing.*/ } else if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) { ret = _media_svc_extract_image_metadata(db_handle, &content_info); @@ -572,11 +570,11 @@ int media_svc_move_item(MediaSvcHandle *handle, const char *storage_id, media_sv if (g_media_svc_move_item_data_cnt == 1) { /*update item*/ - if ((media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) || (media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO)) { + if ((media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) || (media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO)) ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, new_thumb_path, FALSE, uid); - } else { + else ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, NULL, FALSE, uid); - } + SAFE_FREE(file_name); media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); @@ -603,11 +601,11 @@ int media_svc_move_item(MediaSvcHandle *handle, const char *storage_id, media_sv } else if (g_media_svc_move_item_cur_data_cnt < (g_media_svc_move_item_data_cnt - 1)) { /*update item*/ - if ((media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) || (media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO)) { + if ((media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) || (media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO)) ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, new_thumb_path, TRUE, uid); - } else { + else ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, NULL, TRUE, uid); - } + SAFE_FREE(file_name); media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); @@ -620,13 +618,12 @@ int media_svc_move_item(MediaSvcHandle *handle, const char *storage_id, media_sv g_media_svc_move_item_cur_data_cnt++; } else if (g_media_svc_move_item_cur_data_cnt == (g_media_svc_move_item_data_cnt - 1)) { - /*update item*/ - if ((media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) || (media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO)) { + if ((media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) || (media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO)) ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, new_thumb_path, TRUE, uid); - } else { + else ret = _media_svc_update_item_by_path(storage_id, src_path, dest_storage, dest_path, file_name, modified_time, folder_uuid, NULL, TRUE, uid); - } + SAFE_FREE(file_name); media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); @@ -677,10 +674,8 @@ int media_svc_set_item_validity_end(uid_t uid) media_svc_debug_fenter(); - if (g_media_svc_item_validity_cur_data_cnt > 0) { - + if (g_media_svc_item_validity_cur_data_cnt > 0) ret = _media_svc_list_query_do(MEDIA_SVC_QUERY_SET_ITEM_VALIDITY, uid); - } g_media_svc_item_validity_data_cnt = 1; g_media_svc_item_validity_cur_data_cnt = 0; @@ -809,10 +804,9 @@ int media_svc_delete_item_by_path(MediaSvcHandle *handle, const char *storage_id if (thumb_count == 1) { */ ret = _media_svc_remove_file(thumb_path); - if (ret != MS_MEDIA_ERR_NONE) { + if (ret != MS_MEDIA_ERR_NONE) media_svc_error("fail to remove thumbnail file."); - } -// } +/* } */ } SAFE_FREE(default_thumbnail_path); @@ -915,9 +909,8 @@ int media_svc_refresh_item(MediaSvcHandle *handle, const char *storage_id, media /*Set media info*/ ret = _media_svc_set_media_info(&content_info, storage_id, storage_type, path, &media_type, TRUE); - if (ret != MS_MEDIA_ERR_NONE) { + if (ret != MS_MEDIA_ERR_NONE) return ret; - } /* Initialize thumbnail information to remake thumbnail. */ if (ini_val == 1) { @@ -930,9 +923,8 @@ int media_svc_refresh_item(MediaSvcHandle *handle, const char *storage_id, media if (g_file_test(thumb_path, G_FILE_TEST_EXISTS) && (STRING_VALID(MEDIA_SVC_THUMB_DEFAULT_PATH)) && (strncmp(thumb_path, MEDIA_SVC_THUMB_DEFAULT_PATH, strlen(MEDIA_SVC_THUMB_DEFAULT_PATH)) != 0)) { ret = _media_svc_remove_file(thumb_path); - if (ret != MS_MEDIA_ERR_NONE) { + if (ret != MS_MEDIA_ERR_NONE) media_svc_error("_media_svc_remove_file failed : %s", thumb_path); - } } ret = _media_svc_update_thumbnail_path(storage_id, path, NULL, uid); @@ -954,15 +946,14 @@ int media_svc_refresh_item(MediaSvcHandle *handle, const char *storage_id, media content_info.media_type = media_type; if (media_type == MEDIA_SVC_MEDIA_TYPE_OTHER - ||(media_type == MEDIA_SVC_MEDIA_TYPE_PVR) - ||(media_type == MEDIA_SVC_MEDIA_TYPE_UHD) - ||(media_type == MEDIA_SVC_MEDIA_TYPE_SCSA)) { - /*Do nothing.*/ - } else if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) { + || (media_type == MEDIA_SVC_MEDIA_TYPE_PVR) + || (media_type == MEDIA_SVC_MEDIA_TYPE_UHD) + || (media_type == MEDIA_SVC_MEDIA_TYPE_SCSA)) + media_svc_debug("Do nothing [%d]", media_type); + else if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) ret = _media_svc_extract_image_metadata(db_handle, &content_info); - } else { + else ret = _media_svc_extract_media_metadata(db_handle, &content_info, uid); - } if (ret != MS_MEDIA_ERR_NONE) { _media_svc_destroy_noti_item(noti_item); @@ -979,9 +970,8 @@ int media_svc_refresh_item(MediaSvcHandle *handle, const char *storage_id, media int height = 0; ret = _media_svc_request_thumbnail_with_origin_size(content_info.path, thumb_path, sizeof(thumb_path), &width, &height, uid); - if (ret == MS_MEDIA_ERR_NONE) { + if (ret == MS_MEDIA_ERR_NONE) ret = __media_svc_malloc_and_strncpy(&(content_info.thumbnail_path), thumb_path); - } if (content_info.media_meta.width <= 0) content_info.media_meta.width = width; @@ -1142,11 +1132,10 @@ int media_svc_rename_folder(MediaSvcHandle *handle, const char *storage_id, cons update_item_sql = sqlite3_mprintf("UPDATE media SET path='%q' WHERE media_uuid='%q'", replaced_path, media_uuid); } else { #if 0 - if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE || media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO) { + if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE || media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO) update_item_sql = sqlite3_mprintf("UPDATE media SET path='%q', thumbnail_path='%q' WHERE media_uuid='%q'", replaced_path, media_new_thumb_path, media_uuid); - } else { + else update_item_sql = sqlite3_mprintf("UPDATE media SET path='%q', thumbnail_path='%q' WHERE media_uuid='%q'", replaced_path, media_thumb_path, media_uuid); - } #else update_item_sql = sqlite3_mprintf("UPDATE media SET path='%q', thumbnail_path='%q' WHERE media_uuid='%q'", replaced_path, media_new_thumb_path, media_uuid); #endif @@ -1168,9 +1157,8 @@ int media_svc_rename_folder(MediaSvcHandle *handle, const char *storage_id, cons char *default_thumbnail_path = _media_svc_get_thumb_default_path(uid); if ((!no_thumb) && (default_thumbnail_path != NULL) && (strncmp(media_thumb_path, default_thumbnail_path, strlen(default_thumbnail_path)) != 0)) { ret = _media_svc_rename_file(media_thumb_path, media_new_thumb_path); - if (ret != MS_MEDIA_ERR_NONE) { + if (ret != MS_MEDIA_ERR_NONE) media_svc_error("_media_svc_rename_file failed : %d", ret); - } } SAFE_FREE(default_thumbnail_path); @@ -1298,9 +1286,8 @@ int media_svc_update_folder_time(MediaSvcHandle *handle, const char *storage_id, ret = _media_svc_get_folder_info_by_foldername(db_handle, storage_id, folder_path, folder_uuid, &sto_time); if (ret == MS_MEDIA_ERR_NONE) { - if (sto_time != cur_time) { + if (sto_time != cur_time) ret = _media_svc_update_folder_modified_time_by_folder_uuid(folder_uuid, folder_path, FALSE, uid); - } } return ret; @@ -1324,10 +1311,8 @@ int media_svc_update_item_end(uid_t uid) media_svc_debug_fenter(); - if (g_media_svc_update_item_cur_data_cnt > 0) { - + if (g_media_svc_update_item_cur_data_cnt > 0) ret = _media_svc_list_query_do(MEDIA_SVC_QUERY_UPDATE_ITEM, uid); - } g_media_svc_update_item_data_cnt = 1; g_media_svc_update_item_cur_data_cnt = 0; @@ -1351,15 +1336,13 @@ int media_svc_update_item_meta(MediaSvcHandle *handle, const char *file_path, co /*Set media info*/ ret = _media_svc_set_media_info(&content_info, storage_id, storage_type, file_path, &media_type, FALSE); - if (ret != MS_MEDIA_ERR_NONE) { + if (ret != MS_MEDIA_ERR_NONE) return ret; - } - if (media_type == MEDIA_SVC_MEDIA_TYPE_MUSIC) { + if (media_type == MEDIA_SVC_MEDIA_TYPE_MUSIC) ret = _media_svc_extract_music_metadata_for_update(db_handle, &content_info, media_type); - } else { + else return MS_MEDIA_ERR_NONE; - } if (ret != MS_MEDIA_ERR_NONE) { _media_svc_destroy_content_info(&content_info); @@ -1658,11 +1641,11 @@ static int __media_svc_copy_para_to_content(media_svc_content_info_s *content_in } } - new_content_info->media_meta.is_360= content_info->media_meta.is_360; - //new_content_info->media_meta.bitrate = content_info->media_meta.bitrate; - //new_content_info->media_meta.samplerate = content_info->media_meta.samplerate; - //new_content_info->media_meta.channel = content_info->media_meta.channel; - //new_content_info->media_meta.orientation = content_info->media_meta.orientation; + new_content_info->media_meta.is_360 = content_info->media_meta.is_360; + /* new_content_info->media_meta.bitrate = content_info->media_meta.bitrate; */ + /* new_content_info->media_meta.samplerate = content_info->media_meta.samplerate; */ + /* new_content_info->media_meta.channel = content_info->media_meta.channel; */ + /* new_content_info->media_meta.orientation = content_info->media_meta.orientation; */ if (content_info->media_meta.longitude != MEDIA_SVC_DEFAULT_GPS_VALUE) new_content_info->media_meta.longitude = content_info->media_meta.longitude; @@ -1718,13 +1701,12 @@ int media_svc_insert_item_immediately_with_data(MediaSvcHandle *handle, media_sv media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "fail _media_svc_set_media_info"); if (content_info->storage_type != MEDIA_SVC_STORAGE_CLOUD) { - if (media_type == MEDIA_SVC_MEDIA_TYPE_OTHER) { - /*Do nothing.*/ - } else if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) { + if (media_type == MEDIA_SVC_MEDIA_TYPE_OTHER) + media_svc_debug("Do nothing[%d]", media_type); + else if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) ret = _media_svc_extract_image_metadata(db_handle, &_new_content_info); - } else { + else ret = _media_svc_extract_media_metadata(db_handle, &_new_content_info, uid); - } media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, content_info); @@ -1738,9 +1720,8 @@ int media_svc_insert_item_immediately_with_data(MediaSvcHandle *handle, media_sv int height = 0; ret = _media_svc_request_thumbnail_with_origin_size(_new_content_info.path, thumb_path, sizeof(thumb_path), &width, &height, uid); - if (ret == MS_MEDIA_ERR_NONE) { + if (ret == MS_MEDIA_ERR_NONE) ret = __media_svc_malloc_and_strncpy(&(_new_content_info.thumbnail_path), thumb_path); - } if (_new_content_info.media_meta.width <= 0) _new_content_info.media_meta.width = width; @@ -1807,13 +1788,11 @@ int media_svc_insert_item_immediately_with_data(MediaSvcHandle *handle, media_sv /* Insert to db - calling _media_svc_insert_item_with_data */ ret = _media_svc_insert_item_with_data(db_handle, _new_content_info.storage_uuid, &_new_content_info, FALSE, FALSE, uid); - if (ret == MS_MEDIA_ERR_NONE) { + if (ret == MS_MEDIA_ERR_NONE) media_svc_debug("Insertion is successful."); - } - if (ret == MS_MEDIA_ERR_DB_CONSTRAINT_FAIL) { + if (ret == MS_MEDIA_ERR_DB_CONSTRAINT_FAIL) media_svc_error("This item is already inserted. This may be normal operation because other process already did this"); - } _media_svc_destroy_content_info(&_new_content_info); @@ -1909,9 +1888,8 @@ int media_svc_delete_storage(MediaSvcHandle *handle, const char *storage_id, con media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "remove storage failed : %d", ret); ret = _media_svc_delete_folder_by_storage_id(storage_id, storage_type, uid); - if (ret != MS_MEDIA_ERR_NONE) { + if (ret != MS_MEDIA_ERR_NONE) media_svc_error("fail to _media_svc_delete_folder_by_storage_id. error : [%d]", ret); - } if ((storage_type == MEDIA_SVC_STORAGE_EXTERNAL_USB) || (storage_type == MEDIA_SVC_STORAGE_CLOUD)) { ret = _media_svc_drop_media_table(storage_id, uid); @@ -1942,10 +1920,8 @@ int media_svc_insert_folder_end(uid_t uid) media_svc_debug_fenter(); - if (g_media_svc_insert_folder_cur_data_cnt > 0) { - + if (g_media_svc_insert_folder_cur_data_cnt > 0) ret = _media_svc_list_query_do(MEDIA_SVC_QUERY_INSERT_FOLDER, uid); - } g_media_svc_insert_folder_data_cnt = 1; g_media_svc_insert_folder_cur_data_cnt = 0; @@ -2036,8 +2012,6 @@ int media_svc_insert_item_pass1(MediaSvcHandle *handle, const char *storage_id, return ret; } - //media_svc_debug("total %d, cur %d insert flag %d", g_media_svc_insert_item_data_cnt, g_media_svc_insert_item_cur_data_cnt, g_insert_with_noti); - /*Set or Get folder id*/ ret = _media_svc_get_and_append_folder_id_by_path(db_handle, storage_id, path, storage_type, folder_uuid, uid); media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info); @@ -2128,30 +2102,26 @@ int media_svc_insert_item_pass2(MediaSvcHandle *handle, const char *storage_id, char *sql; char folder_uuid[MEDIA_SVC_UUID_SIZE+1] = {0,}; - if (scan_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) { + if (scan_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) ret = _media_svc_get_folder_id_by_foldername(handle, storage_id, extract_path, folder_uuid, uid); - } if (scan_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE && ret == MS_MEDIA_ERR_NONE) { media_svc_error("folder no recursive extract"); - if (is_burst == 1) { + if (is_burst == 1) sql = sqlite3_mprintf("SELECT path, media_type FROM '%s' WHERE validity = 1 AND title IS NULL and folder_uuid = '%q' ", storage_id, folder_uuid); - } else { + else sql = sqlite3_mprintf("SELECT path, media_type FROM '%s' WHERE validity = 1 AND title IS NULL and folder_uuid = '%q' LIMIT %d", storage_id, folder_uuid, BATCH_REQUEST_MAX); - } } else if (scan_type == MS_MSG_DIRECTORY_SCANNING) { media_svc_error("folder recursive extract"); - if (is_burst == 1) { + if (is_burst == 1) sql = sqlite3_mprintf("SELECT path, media_type FROM '%s' WHERE validity = 1 and title IS NULL and path LIKE '%q%%' ", storage_id, extract_path); - } else { + else sql = sqlite3_mprintf("SELECT path, media_type FROM '%s' WHERE validity = 1 and title IS NULL and path LIKE '%q%%' LIMIT %d", storage_id, extract_path, BATCH_REQUEST_MAX); - } } else { - if (is_burst == 1) { + if (is_burst == 1) sql = sqlite3_mprintf("SELECT path, media_type FROM '%s' WHERE validity = 1 and title IS NULL", storage_id); - } else { + else sql = sqlite3_mprintf("SELECT path, media_type FROM '%s' WHERE validity = 1 and title IS NULL LIMIT %d", storage_id, BATCH_REQUEST_MAX); - } } ret = _media_svc_sql_prepare_to_step_simple(handle, sql, &sql_stmt); @@ -2189,7 +2159,7 @@ int media_svc_insert_item_pass2(MediaSvcHandle *handle, const char *storage_id, } media_type = db_data->media_type; - //media_svc_debug("path is %s, media type %d", db_data->path, media_type); + /* media_svc_debug("path is %s, media type %d", db_data->path, media_type); */ memset(&content_info, 0, sizeof(media_svc_content_info_s)); __media_svc_malloc_and_strncpy(&content_info.path, db_data->path); @@ -2199,15 +2169,14 @@ int media_svc_insert_item_pass2(MediaSvcHandle *handle, const char *storage_id, _media_svc_set_default_value(&content_info, FALSE); if (media_type == MEDIA_SVC_MEDIA_TYPE_OTHER - ||(media_type == MEDIA_SVC_MEDIA_TYPE_PVR) - ||(media_type == MEDIA_SVC_MEDIA_TYPE_UHD) - ||(media_type == MEDIA_SVC_MEDIA_TYPE_SCSA)) { - /*Do nothing.*/ - } else if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) { + || (media_type == MEDIA_SVC_MEDIA_TYPE_PVR) + || (media_type == MEDIA_SVC_MEDIA_TYPE_UHD) + || (media_type == MEDIA_SVC_MEDIA_TYPE_SCSA)) + media_svc_debug("Do nothing[%d]", media_type); + else if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE) ret = _media_svc_extract_image_metadata(db_handle, &content_info); - } else { + else ret = _media_svc_extract_media_metadata(db_handle, &content_info, uid); - } ret = _media_svc_insert_item_pass2(storage_id, &content_info, is_burst, TRUE, uid); @@ -2231,9 +2200,9 @@ int media_svc_insert_item_pass2(MediaSvcHandle *handle, const char *storage_id, while (db_data_array->len != 0) { db_data = NULL; db_data = g_array_index(db_data_array, media_svc_item_info_s*, 0); - g_array_remove_index (db_data_array, 0); + g_array_remove_index(db_data_array, 0); - if(db_data) { + if (db_data) { SAFE_FREE(db_data->path); free(db_data); db_data = NULL; @@ -2284,11 +2253,10 @@ int media_svc_get_folder_modified_time(MediaSvcHandle *handle, const char *path, system_time = _media_svc_get_file_time(path); media_svc_error("modified_time = [%d], system_time = [%d], path = [%s]", modified_time, system_time, path); - if (system_time != modified_time && system_time != 0) { + if (system_time != modified_time && system_time != 0) *modified = TRUE; - } else { + else *modified = FALSE; - } return ret; } diff --git a/src/include/common/media-svc-db-utils.h b/src/include/common/media-svc-db-utils.h index cf9ffc5..44af1dc 100755 --- a/src/include/common/media-svc-db-utils.h +++ b/src/include/common/media-svc-db-utils.h @@ -26,8 +26,8 @@ #include #include -#define SQLITE3_FINALIZE(x) if (x != NULL) {sqlite3_finalize(x);} -#define SQLITE3_SAFE_FREE(x) {if(x != NULL) {sqlite3_free(x);x = NULL;}} +#define SQLITE3_FINALIZE(x) if (x != NULL) sqlite3_finalize(x); +#define SQLITE3_SAFE_FREE(x) {if (x != NULL) {sqlite3_free(x); x = NULL; } } int _media_svc_make_table_query(const char *table_name, media_svc_table_slist_e list, uid_t uid); int _media_svc_upgrade_table_query(sqlite3 *db_handle, const char *table_name, media_svc_table_slist_e list, uid_t uid); diff --git a/src/include/common/media-svc-debug.h b/src/include/common/media-svc-debug.h index e4cc9f2..de2663c 100755 --- a/src/include/common/media-svc-debug.h +++ b/src/include/common/media-svc-debug.h @@ -74,7 +74,7 @@ } while (0) #define media_svc_retvm_if(expr, val, fmt, arg...) do { \ if (expr) { \ - LOGE(FONT_COLOR_RED" "fmt"", ##arg); \ + LOGE(FONT_COLOR_RED" "fmt"", ##arg); \ return (val); \ } \ } while (0) @@ -92,7 +92,7 @@ } while (0) #define media_svc_sec_warn(fmt, arg...) do { \ - SECURE_LOGW(FONT_COLOR_GREEN" "fmt"", ##arg); \ + SECURE_LOGW(FONT_COLOR_GREEN" "fmt"", ##arg); \ } while (0) #define media_svct_sec_error(fmt, arg...) do { \ @@ -110,7 +110,7 @@ void mediainfo_init_file_debug(); void mediainfo_close_file_debug(); FILE* get_fp(); -#define mediainfo_file_dbg(fmt,arg...) fprintf( get_fp(), "[%s: %d] [%s]" fmt "\n", __FILE__, __LINE__, __FUNCTION__, ##arg) +#define mediainfo_file_dbg(fmt, arg...) fprintf(get_fp(), "[%s: %d] [%s]" fmt "\n", __FILE__, __LINE__, __FUNCTION__, ##arg) #endif diff --git a/src/include/common/media-svc-env.h b/src/include/common/media-svc-env.h index e640107..d72a1de 100755 --- a/src/include/common/media-svc-env.h +++ b/src/include/common/media-svc-env.h @@ -137,11 +137,11 @@ extern "C" { #define MEDIA_SVC_TAG_UNKNOWN "Unknown" #define MEDIA_SVC_MEDIA_PATH tzplatform_mkpath(TZ_USER_SHARE, "media") /**< Media path*/ #define MEDIA_SVC_THUMB_PATH_PREFIX tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb") /**< Thumbnail path prefix*/ -#define MEDIA_SVC_THUMB_INTERNAL_PATH tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/phone") /**< Phone thumbnail path*/ -#define MEDIA_SVC_THUMB_EXTERNAL_PATH tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/mmc") /**< MMC thumbnail path*/ +#define MEDIA_SVC_THUMB_INTERNAL_PATH tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/phone") /**< Phone thumbnail path*/ +#define MEDIA_SVC_THUMB_EXTERNAL_PATH tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/mmc") /**< MMC thumbnail path*/ #define MEDIA_SVC_THUMB_DEFAULT_PATH tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/thumb_default.png") /**< default thumbnail */ -#define THUMB_EXT "jpg" +#define THUMB_EXT "jpg" enum Exif_Orientation { NOT_AVAILABLE = 0, @@ -165,7 +165,7 @@ typedef enum { } media_svc_query_type_e; typedef enum { - MEDIA_SVC_DB_LIST_MEDIA = 0, + MEDIA_SVC_DB_LIST_MEDIA = 0, MEDIA_SVC_DB_LIST_FOLDER, MEDIA_SVC_DB_LIST_PLAYLIST_MAP, MEDIA_SVC_DB_LIST_PLAYLIST, diff --git a/src/include/common/media-svc-localize-utils.h b/src/include/common/media-svc-localize-utils.h index 2a9c124..463af1c 100755 --- a/src/include/common/media-svc-localize-utils.h +++ b/src/include/common/media-svc-localize-utils.h @@ -29,4 +29,4 @@ int SAFE_SNPRINTF(char **buf, int *buf_size, int len, const char *src); int _media_svc_collation_str(const char *src, char **dest); -#endif /* __MEDIA_SVC_LOCALIZE_UTILS_H__ */ \ No newline at end of file +#endif /* __MEDIA_SVC_LOCALIZE_UTILS_H__ */ diff --git a/src/include/common/media-svc-localize_ch.h b/src/include/common/media-svc-localize_ch.h index 5d0e132..867802c 100755 --- a/src/include/common/media-svc-localize_ch.h +++ b/src/include/common/media-svc-localize_ch.h @@ -31,4 +31,4 @@ void _media_svc_pinyin_free(pinyin_name_s *pinyinname, int size); bool _media_svc_has_chinese(const char *src); -#endif /* __MEDIA_SERVICE_LOCALIZE_CH_H__ */ \ No newline at end of file +#endif /* __MEDIA_SERVICE_LOCALIZE_CH_H__ */ diff --git a/src/include/common/media-svc-localize_tw.h b/src/include/common/media-svc-localize_tw.h index fb6de6d..80b92ca 100755 --- a/src/include/common/media-svc-localize_tw.h +++ b/src/include/common/media-svc-localize_tw.h @@ -32,4 +32,4 @@ void _media_svc_bpmf_name_destroy(media_svc_bpmf_name_s *bpmf); bool _media_svc_bpmf_is_bpmf(const char *src); char _media_svc_bpmf_get_fuzzy_number(const char *src); -#endif /*__MEDIA_SERVICE_LOCALIZE_TW_H__ */ \ No newline at end of file +#endif /*__MEDIA_SERVICE_LOCALIZE_TW_H__ */ diff --git a/src/include/common/media-svc-util.h b/src/include/common/media-svc-util.h index 1ffc7b5..37b28bb 100755 --- a/src/include/common/media-svc-util.h +++ b/src/include/common/media-svc-util.h @@ -42,8 +42,8 @@ extern "C" { #define TRUE 1 #endif -#define SAFE_FREE(src) { if (src) {free(src); src = NULL;}} -#define G_SAFE_FREE(src) { if (src) {g_free(src); src = NULL;}} +#define SAFE_FREE(src) { if (src) {free(src); src = NULL; } } +#define G_SAFE_FREE(src) { if (src) {g_free(src); src = NULL; } } #define STRING_VALID(str) \ ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)