summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhj kim <backto.kim@samsung.com>2019-09-16 07:41:13 +0000
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>2019-09-16 07:41:13 +0000
commitde8af4666db2e9703f2a4bf1d7dba4754837ede9 (patch)
tree82fa894420b6062a10c9b2e7f284ba35afb5a00a
parentae9e34e2114f65b9f2cf5af8b9297d5c45ff0673 (diff)
parent3451eeb8f10aadb6aec2fa6981f7a9f2e1fd9e81 (diff)
downloadlibmedia-thumbnail-de8af4666db2e9703f2a4bf1d7dba4754837ede9.tar.gz
libmedia-thumbnail-de8af4666db2e9703f2a4bf1d7dba4754837ede9.tar.bz2
libmedia-thumbnail-de8af4666db2e9703f2a4bf1d7dba4754837ede9.zip
-rwxr-xr-xsrc/include/media-thumb-internal.h2
-rwxr-xr-xsrc/media-thumb-internal.c13
2 files changed, 10 insertions, 5 deletions
diff --git a/src/include/media-thumb-internal.h b/src/include/media-thumb-internal.h
index b0f84fe..2b9b271 100755
--- a/src/include/media-thumb-internal.h
+++ b/src/include/media-thumb-internal.h
@@ -47,7 +47,7 @@ typedef struct {
void *user_data;
} thumbRawUserData;
-int _media_thumb_image(const char *origin_path, char *thumb_path, int thumb_width, int thumb_height, media_thumb_info *thumb_info);
+int _media_thumb_image(const char *origin_path, char *thumb_path, unsigned int thumb_width, unsigned int thumb_height, media_thumb_info *thumb_info);
int _media_thumb_video(const char *origin_path, const char *thumb_path, int thumb_width, int thumb_height, media_thumb_info *thumb_info);
int _media_thumb_get_hash_name(const char *file_full_path, char *thumb_hash_path, size_t max_thumb_path, uid_t uid);
diff --git a/src/media-thumb-internal.c b/src/media-thumb-internal.c
index 0514c6c..f7225a3 100755
--- a/src/media-thumb-internal.c
+++ b/src/media-thumb-internal.c
@@ -32,10 +32,15 @@
#include <mm_file.h>
#include <mm_util_magick.h>
-static void __media_thumb_get_proper_thumb_size(int origin_width, int origin_height, int *thumb_width, int *thumb_height)
+static void __media_thumb_get_proper_thumb_size(unsigned int origin_width, unsigned int origin_height, unsigned int *thumb_width, unsigned int *thumb_height)
{
bool portrait = false;
- double ratio;
+ double ratio = 0.0;
+
+ thumb_retm_if(origin_width == 0, "Invalid origin_width");
+ thumb_retm_if(origin_height == 0, "Invalid origin_height");
+ thumb_retm_if(!thumb_width, "Invalid thumb_width");
+ thumb_retm_if(!thumb_height, "Invalid thumb_height");
if (origin_width < origin_height)
portrait = true;
@@ -88,7 +93,7 @@ int _media_thumb_general(const char *origin_path, const char *thumb_path, int th
return err;
}
-int _media_thumb_image(const char *origin_path, char *thumb_path, int thumb_width, int thumb_height, media_thumb_info *thumb_info)
+int _media_thumb_image(const char *origin_path, char *thumb_path, unsigned int thumb_width, unsigned int thumb_height, media_thumb_info *thumb_info)
{
int err = MS_MEDIA_ERR_NONE;
mm_util_img_codec_type image_type = 0;
@@ -257,7 +262,7 @@ static int __get_video_info(int cdis_value, const char *origin_path, int *video_
return MS_MEDIA_ERR_NONE;
}
-static int __get_video_thumb(int width, int height, void *frame, size_t size, mm_util_magick_rotate_type rot_type, const char *thumb_path, int thumb_width, int thumb_height, mm_util_image_h *dst_img)
+static int __get_video_thumb(int width, int height, void *frame, size_t size, mm_util_magick_rotate_type rot_type, const char *thumb_path, unsigned int thumb_width, unsigned int thumb_height, mm_util_image_h *dst_img)
{
int err = MS_MEDIA_ERR_NONE;
mm_util_image_h img = NULL;