From 32fe300117df43130bd365049939122869933d20 Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Wed, 12 Jul 2017 11:56:56 +0900 Subject: Remove unused code Remove unused enums, values, APIs. Change-Id: I9f9e66581dc1ef19ceb10f83abe7dcb88eb563e7 Signed-off-by: Minje Ahn --- server/thumb-server-internal.c | 67 ++++++++---------------------------------- 1 file changed, 13 insertions(+), 54 deletions(-) (limited to 'server/thumb-server-internal.c') diff --git a/server/thumb-server-internal.c b/server/thumb-server-internal.c index ef2cb38..ff9e627 100755 --- a/server/thumb-server-internal.c +++ b/server/thumb-server-internal.c @@ -84,9 +84,7 @@ int _thumb_daemon_process_job(thumbMsg *req_msg, thumbMsg *res_msg) return err; } -gboolean _thumb_server_read_socket(GIOChannel *src, - GIOCondition condition, - gpointer data) +gboolean _thumb_server_read_socket(GIOChannel *src, GIOCondition condition, gpointer data) { struct sockaddr_un client_addr; unsigned int client_addr_len; @@ -262,17 +260,14 @@ gboolean _thumb_server_prepare_socket(int *sock_fd) int _thumbnail_get_data(const char *origin_path, char *thumb_path, unsigned char **data, - int *size, int *width, int *height, int *alpha, bool *is_saved) { int err = MS_MEDIA_ERR_NONE; - int thumb_width = -1; - int thumb_height = -1; - if (origin_path == NULL || size == NULL || width == NULL || height == NULL) { + if (origin_path == NULL || width == NULL || height == NULL) { thumb_err("Invalid parameter"); return MS_MEDIA_ERR_INVALID_PARAMETER; } @@ -287,49 +282,31 @@ int _thumbnail_get_data(const char *origin_path, int file_type = THUMB_NONE_TYPE; media_thumb_info thumb_info = {0,}; file_type = _media_thumb_get_file_type(origin_path); - thumb_width = *width; - thumb_height = *height; - if (thumb_width == 0 || thumb_height == 0) { - thumb_width = THUMB_DEFAULT_WIDTH; - thumb_height = THUMB_DEFAULT_HEIGHT; - } - thumb_info.is_raw = FALSE; if (file_type == THUMB_IMAGE_TYPE) { - err = _media_thumb_image(origin_path, thumb_path, thumb_width, thumb_height, &thumb_info); - if (err != MS_MEDIA_ERR_NONE) { - thumb_err("_media_thumb_image failed"); - return err; - } + err = _media_thumb_image(origin_path, thumb_path, THUMB_DEFAULT_WIDTH, THUMB_DEFAULT_HEIGHT, &thumb_info); + thumb_retvm_if(err != MS_MEDIA_ERR_NONE, err, "_media_thumb_image failed"); } else if (file_type == THUMB_VIDEO_TYPE) { - err = _media_thumb_video(origin_path, thumb_width, thumb_height, &thumb_info); - if (err != MS_MEDIA_ERR_NONE) { - thumb_err("_media_thumb_image failed"); - return err; - } + err = _media_thumb_video(origin_path, THUMB_DEFAULT_WIDTH, THUMB_DEFAULT_HEIGHT, &thumb_info); + thumb_retvm_if(err != MS_MEDIA_ERR_NONE, err, "_media_thumb_video failed"); } else { thumb_err("invalid file type"); return MS_MEDIA_ERR_THUMB_UNSUPPORTED; } - if (size) *size = thumb_info.size; if (width) *width = thumb_info.width; if (height) *height = thumb_info.height; *data = thumb_info.data; if (alpha) *alpha = thumb_info.alpha; if (is_saved) *is_saved = thumb_info.is_saved; - thumb_dbg("Thumb data is generated successfully (Size:%d, W:%d, H:%d) %p", *size, *width, *height, *data); + thumb_dbg("Thumb data is generated successfully (Size:%d, W:%d, H:%d) %p", thumb_info.size, *width, *height, *data); return MS_MEDIA_ERR_NONE; } -int _thumbnail_get_raw_data(const char *origin_path, - int *width, - int *height, - unsigned char **data, - int *size) +int _thumbnail_get_raw_data(const char *origin_path, int *width, int *height, unsigned char **data, int *size) { int err = MS_MEDIA_ERR_NONE; int thumb_width = -1; @@ -355,16 +332,10 @@ int _thumbnail_get_raw_data(const char *origin_path, if (file_type == THUMB_IMAGE_TYPE) { err = _media_thumb_image(origin_path, thumb_path, thumb_width, thumb_height, &thumb_info); - if (err != MS_MEDIA_ERR_NONE) { - thumb_err("_media_thumb_image failed"); - return err; - } + thumb_retvm_if(err != MS_MEDIA_ERR_NONE, err, "_media_thumb_image failed"); } else if (file_type == THUMB_VIDEO_TYPE) { err = _media_thumb_video(origin_path, thumb_width, thumb_height, &thumb_info); - if (err != MS_MEDIA_ERR_NONE) { - thumb_err("_media_thumb_image failed"); - return err; - } + thumb_retvm_if(err != MS_MEDIA_ERR_NONE, err, "_media_thumb_video failed"); } else { thumb_err("invalid file type"); return MS_MEDIA_ERR_THUMB_UNSUPPORTED; @@ -382,7 +353,6 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg) { int err = MS_MEDIA_ERR_NONE; unsigned char *data = NULL; - int thumb_size = 0; int thumb_w = 0; int thumb_h = 0; int max_length = 0; @@ -390,14 +360,9 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg) int alpha = 0; bool is_saved = FALSE; - if (req_msg == NULL || res_msg == NULL) { - thumb_err("Invalid msg!"); - return MS_MEDIA_ERR_INVALID_PARAMETER; - } + thumb_retvm_if(req_msg == NULL || res_msg == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid msg"); const char *origin_path = req_msg->org_path; - thumb_w = req_msg->thumb_width; - thumb_h = req_msg->thumb_height; thumb_path = res_msg->dst_path; thumb_path[0] = '\0'; max_length = sizeof(res_msg->dst_path) -1; @@ -434,7 +399,7 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg) _media_thumb_remove_file(thumb_path); } - err = _thumbnail_get_data(origin_path, thumb_path, &data, &thumb_size, &thumb_w, &thumb_h, &alpha, &is_saved); + err = _thumbnail_get_data(origin_path, thumb_path, &data, &thumb_w, &thumb_h, &alpha, &is_saved); if (err != MS_MEDIA_ERR_NONE) { thumb_err("_thumbnail_get_data failed - %d", err); SAFE_FREE(data); @@ -445,9 +410,6 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg) } res_msg->msg_type = THUMB_RESPONSE; - res_msg->thumb_size = thumb_size; - res_msg->thumb_width = thumb_w; - res_msg->thumb_height = thumb_h; /* If the image is transparent PNG format, make png file as thumbnail of this image */ if (alpha) { @@ -514,10 +476,7 @@ _media_thumb_process_raw(thumbMsg *req_msg, thumbMsg *res_msg) int thumb_w = 0; int thumb_h = 0; - if (req_msg == NULL || res_msg == NULL) { - thumb_err("Invalid msg!"); - return MS_MEDIA_ERR_INVALID_PARAMETER; - } + thumb_retvm_if(req_msg == NULL || res_msg == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid msg"); const char *origin_path = req_msg->org_path; thumb_w = req_msg->thumb_width; -- cgit v1.2.3