summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorMinje Ahn <minje.ahn@samsung.com>2015-08-07 00:40:46 (GMT)
committerMinje Ahn <minje.ahn@samsung.com>2015-08-07 01:10:15 (GMT)
commit7adbb6954d7f05fd02b9cded3741ce6ed2c9226b (patch)
tree5315a9e75f2283f559b18a8375f093b6eca10a3e /src/util
parent41f405edc8f31d877615c580ed6eb308d7eaebec (diff)
downloadlibmedia-thumbnail-7adbb6954d7f05fd02b9cded3741ce6ed2c9226b.zip
libmedia-thumbnail-7adbb6954d7f05fd02b9cded3741ce6ed2c9226b.tar.gz
libmedia-thumbnail-7adbb6954d7f05fd02b9cded3741ce6ed2c9226b.tar.bz2
Separate CMakeFiles for apply fPIE option Remove unused code Remove thumb_type Modify jpeg thumbnail creation logic when exif thumbnail is smaller than request thumbnail size Add scale down logic when request huge size image Fix bugs, memory leaks Remove unused parameters in function Change thumb path creation API position Remove thumbnail folder creation API Rename some functions Change-Id: I0e13d393dd524b61bcf44722c33b6f270649b732 Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
Diffstat (limited to 'src/util')
-rwxr-xr-xsrc/util/media-thumb-db.c10
-rwxr-xr-xsrc/util/media-thumb-debug.c3
-rwxr-xr-xsrc/util/media-thumb-util.c65
3 files changed, 36 insertions, 42 deletions
diff --git a/src/util/media-thumb-db.c b/src/util/media-thumb-db.c
index 76c737e..0dceec7 100755
--- a/src/util/media-thumb-db.c
+++ b/src/util/media-thumb-db.c
@@ -257,6 +257,10 @@ int _media_thumb_update_thumb_path_to_db(sqlite3 *handle,
thumb_dbg("Query success");
}
+ sqlite3_free(path_string);
+ sqlite3_free(thumbpath_string);
+ sqlite3_free(query_string);
+
return err;
}
@@ -285,6 +289,9 @@ int _media_thumb_update_wh_to_db(sqlite3 *handle,
thumb_dbg("Query success");
}
+ sqlite3_free(path_string);
+ sqlite3_free(query_string);
+
return err;
}
@@ -314,6 +321,9 @@ int _media_thumb_update_thumb_path_wh_to_db(sqlite3 *handle,
thumb_dbg("Query success");
}
+ sqlite3_free(path_string);
+ sqlite3_free(query_string);
+
return err;
}
diff --git a/src/util/media-thumb-debug.c b/src/util/media-thumb-debug.c
index a9ce049..9515505 100755
--- a/src/util/media-thumb-debug.c
+++ b/src/util/media-thumb-debug.c
@@ -27,7 +27,7 @@
#ifdef _PERFORMANCE_CHECK_
static long g_time_usec = 0L;
-#endif
+
#ifdef _USE_LOG_FILE_
static FILE *g_log_fp = NULL;
@@ -109,3 +109,4 @@ thumb_print_debug_time_ex(long start, long end, const char *func_name,
totaltime);
#endif
}
+#endif \ No newline at end of file
diff --git a/src/util/media-thumb-util.c b/src/util/media-thumb-util.c
index 3ba1c06..c487b6e 100755
--- a/src/util/media-thumb-util.c
+++ b/src/util/media-thumb-util.c
@@ -27,52 +27,12 @@
#include <aul.h>
#include <string.h>
-int _media_thumb_get_width(media_thumb_type thumb_type)
-{
- if (thumb_type == MEDIA_THUMB_LARGE) {
- return THUMB_LARGE_WIDTH;
- } else if (thumb_type == MEDIA_THUMB_SMALL) {
- return THUMB_SMALL_WIDTH;
- } else {
- return -1;
- }
-}
-
-int _media_thumb_get_height(media_thumb_type thumb_type)
-{
- if (thumb_type == MEDIA_THUMB_LARGE) {
- return THUMB_LARGE_HEIGHT;
- } else if (thumb_type == MEDIA_THUMB_SMALL) {
- return THUMB_SMALL_HEIGHT;
- } else {
- return -1;
- }
-}
-
-int _media_thumb_get_file_ext(const char *file_path, char *file_ext, int max_len)
-{
- int i = 0;
-
- for (i = strlen(file_path); i >= 0; i--) {
- if ((file_path[i] == '.') && (i < strlen(file_path))) {
- strncpy(file_ext, &file_path[i + 1], max_len);
- return 0;
- }
-
- /* meet the dir. no ext */
- if (file_path[i] == '/') {
- return -1;
- }
- }
-
- return -1;
-}
-
int
_media_thumb_get_file_type(const char *file_full_path)
{
int ret = 0;
char mimetype[255] = {0,};
+ const char *unsupported_type = "image/tiff";
if (file_full_path == NULL)
return MS_MEDIA_ERR_INVALID_PARAMETER;
@@ -116,6 +76,10 @@ _media_thumb_get_file_type(const char *file_full_path)
/* categorize from mimetype */
if (strstr(mimetype, "image") != NULL) {
+ if (!strcmp(mimetype, unsupported_type)) {
+ thumb_warn("This is unsupport file type");
+ return THUMB_NONE_TYPE;
+ }
return THUMB_IMAGE_TYPE;
} else if (strstr(mimetype, "video") != NULL) {
return THUMB_VIDEO_TYPE;
@@ -149,4 +113,23 @@ int _media_thumb_remove_file(const char *path)
thumb_stderror("fail to remove file[%s] result");
return FALSE;
}
+}
+
+int _media_thumb_get_file_ext(const char *file_path, char *file_ext, int max_len)
+{
+ int i = 0;
+
+ for (i = (int)strlen(file_path); i >= 0; i--) {
+ if ((file_path[i] == '.') && (i < (int)strlen(file_path))) {
+ strncpy(file_ext, &file_path[i + 1], max_len);
+ return 0;
+ }
+
+ /* meet the dir. no ext */
+ if (file_path[i] == '/') {
+ return -1;
+ }
+ }
+
+ return -1;
} \ No newline at end of file