Apply tizen coding rule 52/149152/1
authorHaejeong Kim <backto.kim@samsung.com>
Mon, 11 Sep 2017 23:57:00 +0000 (08:57 +0900)
committerHaejeong Kim <backto.kim@samsung.com>
Mon, 11 Sep 2017 23:57:00 +0000 (08:57 +0900)
Change-Id: I9f5fbb4546ebcd413b15a10070a98dae6334f4dc

md5/md5.c
src/common/media-svc-album.c
src/common/media-svc-db-utils.c
src/common/media-svc-util.c
src/common/media-svc.c

index 980e11c..8bac98d 100755 (executable)
--- a/md5/md5.c
+++ b/md5/md5.c
@@ -68,9 +68,8 @@ void media_svc_MD5Update(MD5_CTX *ctx, unsigned char const *buf, unsigned len)
        /* Update bitcount */
 
        t = ctx->bits[0];
-       if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t) {
+       if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t)
                ctx->bits[1]++; /* Carry from low to high */
-       }
 
        ctx->bits[1] += len >> 29;
 
index 46d3459..d7be54b 100755 (executable)
@@ -77,11 +77,10 @@ int _media_svc_get_album_art_by_album_id(sqlite3 *handle, int album_id, char **a
        }
 
        value = (char *)sqlite3_column_text(sql_stmt, 0);
-       if (STRING_VALID(value)) {
+       if (STRING_VALID(value))
                *album_art = g_strdup(value);
-       } else {
+       else
                *album_art = NULL;
-       }
 
        SQLITE3_FINALIZE(sql_stmt);
 
index 1088afa..25f6cba 100755 (executable)
@@ -303,11 +303,11 @@ int _media_svc_make_table_query(const char *table_name, media_svc_table_slist_e
                /*create trigger */
                if (col_ptr->is_trigger) {
                        if (STRING_VALID(tb->trigger_name)) {
-                               if (strncmp(table_name, MEDIA_SVC_DB_TABLE_ALBUM, strlen(MEDIA_SVC_DB_TABLE_ALBUM)) == 0) {
+                               if (strncmp(table_name, MEDIA_SVC_DB_TABLE_ALBUM, strlen(MEDIA_SVC_DB_TABLE_ALBUM)) == 0)
                                        snprintf(temp, sizeof(temp), MEDIA_SVC_DB_QUERY_TRIGGER_WITH_COUNT, tb->trigger_name, tb->event_table, tb->action_table, tb->event_table, col_ptr->name, col_ptr->name, col_ptr->name, col_ptr->name);                                  
-                               } else {
+                               else
                                        snprintf(temp, sizeof(temp), MEDIA_SVC_DB_QUERY_TRIGGER, tb->trigger_name, tb->event_table, tb->action_table, col_ptr->name, col_ptr->name);
-                               }
+
                                SAFE_STRLCAT(trigger_query, temp, sizeof(trigger_query));
                        } else {
                                media_svc_error("invalid trigger name");
index 13d249f..407dcdd 100755 (executable)
@@ -1424,25 +1424,22 @@ int _media_svc_extract_music_metadata_for_update(sqlite3 *handle, media_svc_cont
 
        if (mmf_error == FILEINFO_ERROR_NONE) {
                mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_ALBUM, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0) {
+               if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
                        content_info->media_meta.album = g_strdup(p);
-               } else {
+               else
                        SAFE_FREE(err_attr_name);
-               }
 
                mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_ARTIST, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0) {
+               if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
                        content_info->media_meta.artist = g_strdup(p);
-               } else {
+               else
                        SAFE_FREE(err_attr_name);
-               }
 
                mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_ALBUM_ARTIST, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0) {
+               if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
                        content_info->media_meta.album_artist = g_strdup(p);
-               } else {
+               else
                        SAFE_FREE(err_attr_name);
-               }
 
                mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_GENRE, &p, &size, NULL);
                if (mmf_error == FILEINFO_ERROR_NONE && size > 0) {
@@ -1480,25 +1477,22 @@ int _media_svc_extract_music_metadata_for_update(sqlite3 *handle, media_svc_cont
                }
 
                mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_DESCRIPTION, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0) {
+               if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
                        content_info->media_meta.description = g_strdup(p);
-               } else {
+               else
                        SAFE_FREE(err_attr_name);
-               }
 
                mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_AUTHOR, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0) {
+               if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
                        content_info->media_meta.composer = g_strdup(p);
-               } else {
+               else
                        SAFE_FREE(err_attr_name);
-               }
 
                mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_COPYRIGHT, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0) {
+               if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
                        content_info->media_meta.copyright = g_strdup(p);
-               } else {
+               else
                        SAFE_FREE(err_attr_name);
-               }
 
                mmf_error = mm_file_destroy_tag_attrs(tag);
                if (mmf_error != FILEINFO_ERROR_NONE)
@@ -1532,25 +1526,22 @@ int _media_svc_extract_media_metadata(sqlite3 *handle, media_svc_content_info_s
 
        if (mmf_error == FILEINFO_ERROR_NONE) {
                mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_ALBUM, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0) {
+               if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
                        content_info->media_meta.album = g_strdup(p);
-               } else {
+               else
                        SAFE_FREE(err_attr_name);
-               }
 
                mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_ARTIST, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0) {
+               if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
                        content_info->media_meta.artist = g_strdup(p);
-               } else {
+               else
                        SAFE_FREE(err_attr_name);
-               }
 
                mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_ALBUM_ARTIST, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0) {
+               if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
                        content_info->media_meta.album_artist = g_strdup(p);
-               } else {
+               else
                        SAFE_FREE(err_attr_name);
-               }
 
                mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_GENRE, &p, &size, NULL);
                if (mmf_error == FILEINFO_ERROR_NONE && size > 0) {
@@ -1588,11 +1579,10 @@ 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_DESCRIPTION, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0) {
+               if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
                        content_info->media_meta.description = g_strdup(p);
-               } else {
+               else
                        SAFE_FREE(err_attr_name);
-               }
 
                mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_SPHERICAL, &content_info->media_meta.is_360, NULL);
                if (mmf_error != FILEINFO_ERROR_NONE)
@@ -1647,27 +1637,24 @@ 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_COPYRIGHT, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0) {
+               if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
                        content_info->media_meta.copyright = g_strdup(p);
-               } else {
+               else
                        SAFE_FREE(err_attr_name);
-               }
 
                mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_TRACK_NUM, &p, &size, NULL);
-               if (mmf_error == FILEINFO_ERROR_NONE && size > 0) {
+               if (mmf_error == FILEINFO_ERROR_NONE && size > 0)
                        content_info->media_meta.track_num = g_strdup(p);
-               } else {
+               else
                        SAFE_FREE(err_attr_name);
-               }
 
                mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_DATE, &p, &size, NULL);
                if (mmf_error == FILEINFO_ERROR_NONE && size == 4) {
                        int year = 0;
-                       if ((p != NULL) && (__media_svc_safe_atoi(p, &year) == MS_MEDIA_ERR_NONE)) {
+                       if ((p != NULL) && (__media_svc_safe_atoi(p, &year) == MS_MEDIA_ERR_NONE))
                                content_info->media_meta.year = g_strdup(p);
-                       } else {
+                       else
                                media_svc_debug("Wrong Year Information [%s]", p);
-                       }
                } else {
                        SAFE_FREE(err_attr_name);
                }
@@ -1747,11 +1734,10 @@ int _media_svc_extract_media_metadata(sqlite3 *handle, media_svc_content_info_s
 
                                if (strlen(thumb_path) > 0) {
                                        ret = __media_svc_save_image(resize_image, resize_size, thumb_path, uid);
-                                       if (ret != MS_MEDIA_ERR_NONE) {
+                                       if (ret != MS_MEDIA_ERR_NONE)
                                                media_svc_error("Fail to Save Thumbnail Image");
-                                       } else {
+                                       else
                                                content_info->thumbnail_path = g_strdup(thumb_path);
-                                       }
                                }
 
                                if (size != resize_size) {
@@ -1967,9 +1953,8 @@ char *_media_svc_replace_path(char *s, const char *olds, const char *news)
        memset(result, 0x00, sizeof(result));
 
        if (STRING_VALID(s) && STRING_VALID(olds) && STRING_VALID(news)) {
-               if (strncmp(s, olds, strlen(olds)) == 0) {
+               if (strncmp(s, olds, strlen(olds)) == 0)
                        snprintf(result, sizeof(result), "%s%s", news, s + strlen(olds));
-               }
        }
 
        if (STRING_VALID(result))
@@ -2032,11 +2017,10 @@ int _media_svc_get_media_type(const char *path, int *mediatype)
        media_svc_media_type_e media_type =  MEDIA_SVC_MEDIA_TYPE_OTHER;
 
        ret = __media_svc_get_mime_type(path, mime_type);
-       if (ret == MS_MEDIA_ERR_NONE) {
+       if (ret == MS_MEDIA_ERR_NONE)
                __media_svc_get_media_type(path, mime_type, &media_type);
-       } else {
+       else
                media_svc_error("__media_svc_get_mime_type failed");
-       }
 
        *mediatype = media_type;
 
index 920f3fa..2a139e6 100755 (executable)
@@ -1011,11 +1011,10 @@ int media_svc_rename_folder(MediaSvcHandle *handle, const char *storage_id, cons
 
                char *update_item_sql = NULL;
 
-               if (no_thumb) {
+               if (no_thumb)
                        update_item_sql = sqlite3_mprintf("UPDATE '%q' SET path='%q' WHERE media_uuid='%q'", storage_id, replaced_path, media_uuid);
-               } else {
+               else
                        update_item_sql = sqlite3_mprintf("UPDATE '%q' SET path='%q', thumbnail_path='%q' WHERE media_uuid='%q'", storage_id, replaced_path, media_new_thumb_path, media_uuid);
-               }
 
                ret = media_db_request_update_db_batch(update_item_sql, uid);
                SQLITE3_SAFE_FREE(update_item_sql);