summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinje Ahn <minje.ahn@samsung.com>2017-07-07 04:14:02 (GMT)
committerMinje Ahn <minje.ahn@samsung.com>2017-07-07 04:14:02 (GMT)
commit5b465316dc7b468f0e1edcfc845ece329f2d59d6 (patch)
tree1e8505e3eb58e7515e8fc64fbe19cfe4cff459e5
parent17668dc96167be8ebcd817aeb00dc13449470ac0 (diff)
downloadlibmedia-thumbnail-5b465316dc7b468f0e1edcfc845ece329f2d59d6.zip
libmedia-thumbnail-5b465316dc7b468f0e1edcfc845ece329f2d59d6.tar.gz
libmedia-thumbnail-5b465316dc7b468f0e1edcfc845ece329f2d59d6.tar.bz2
Remove checker for DB updaterefs/changes/64/137664/1
No more need this parameter Change-Id: I365aa9a6c6b63e51d5ea64bcb3fac4ea36ab625d Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
-rwxr-xr-xserver/thumb-server-internal.c56
-rwxr-xr-xsrc/include/util/media-thumb-db.h1
-rwxr-xr-xsrc/util/media-thumb-db.c3
3 files changed, 23 insertions, 37 deletions
diff --git a/server/thumb-server-internal.c b/server/thumb-server-internal.c
index 10b7162..14b3cbf 100755
--- a/server/thumb-server-internal.c
+++ b/server/thumb-server-internal.c
@@ -82,7 +82,7 @@ int _thumb_daemon_process_job(thumbMsg *req_msg, thumbMsg *res_msg)
err = _media_thumb_process_raw(req_msg, res_msg);
if (err != MS_MEDIA_ERR_NONE)
thumb_warn("_media_thumb_process_raw is failed: %d", err);
- } else {
+ } else if (req_msg->msg_type == THUMB_REQUEST_DB_INSERT) {
err = _media_thumb_process(req_msg, res_msg);
if (err != MS_MEDIA_ERR_NONE)
thumb_warn("_media_thumb_process is failed: %d", err);
@@ -400,7 +400,6 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg)
int origin_h = 0;
int max_length = 0;
char *thumb_path = NULL;
- int need_update_db = 0;
int alpha = 0;
bool is_saved = FALSE;
@@ -409,7 +408,6 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg)
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
- int msg_type = req_msg->msg_type;
const char *origin_path = req_msg->org_path;
thumb_w = req_msg->thumb_width;
thumb_h = req_msg->thumb_height;
@@ -431,28 +429,25 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg)
return err;
}
- if (msg_type == THUMB_REQUEST_DB_INSERT) {
- err = _media_thumb_get_thumb_from_db_with_size(origin_path, thumb_path, max_length, &need_update_db, &origin_w, &origin_h);
- if (err == MS_MEDIA_ERR_NONE) {
- res_msg->origin_width = origin_w;
- res_msg->origin_height = origin_h;
- _media_thumb_db_disconnect();
- return MS_MEDIA_ERR_NONE;
- } else {
- if (strlen(thumb_path) == 0) {
- err = _media_thumb_get_hash_name(origin_path, thumb_path, max_length, req_msg->uid);
- if (err != MS_MEDIA_ERR_NONE) {
- thumb_err("_media_thumb_get_hash_name failed - %d", err);
- strncpy(thumb_path, THUMB_EMPTY_STR, max_length);
- _media_thumb_db_disconnect();
- res_msg->status = err;
- return err;
- }
-
- thumb_path[strlen(thumb_path)] = '\0';
+ err = _media_thumb_get_thumb_from_db_with_size(origin_path, thumb_path, max_length, &origin_w, &origin_h);
+ if (err == MS_MEDIA_ERR_NONE) {
+ res_msg->origin_width = origin_w;
+ res_msg->origin_height = origin_h;
+ _media_thumb_db_disconnect();
+ return MS_MEDIA_ERR_NONE;
+ } else {
+ if (strlen(thumb_path) == 0) {
+ err = _media_thumb_get_hash_name(origin_path, thumb_path, max_length, req_msg->uid);
+ if (err != MS_MEDIA_ERR_NONE) {
+ thumb_err("_media_thumb_get_hash_name failed - %d", err);
+ strncpy(thumb_path, THUMB_EMPTY_STR, max_length);
+ _media_thumb_db_disconnect();
+ res_msg->status = err;
+ return err;
}
- }
+ thumb_path[strlen(thumb_path)] = '\0';
+ }
}
thumb_dbg_slog("Thumb path : %s", thumb_path);
@@ -498,9 +493,7 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg)
thumb_err("save_to_file_with_evas failed - %d", err);
SAFE_FREE(data);
- if (msg_type == THUMB_REQUEST_DB_INSERT) {
- strncpy(thumb_path, THUMB_EMPTY_STR, max_length);
- }
+ strncpy(thumb_path, THUMB_EMPTY_STR, max_length);
_media_thumb_db_disconnect();
res_msg->status = err;
return err;
@@ -529,13 +522,10 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg)
SAFE_FREE(data);
DB_UPDATE:
- /* DB update if needed */
- if (need_update_db == 1) {
- err = _media_thumb_update_db(origin_path, thumb_path, res_msg->origin_width, res_msg->origin_height, req_msg->uid);
- if (err != MS_MEDIA_ERR_NONE) {
- thumb_err("_media_thumb_update_db failed : %d", err);
- res_msg->status = err;
- }
+ err = _media_thumb_update_db(origin_path, thumb_path, res_msg->origin_width, res_msg->origin_height, req_msg->uid);
+ if (err != MS_MEDIA_ERR_NONE) {
+ thumb_err("_media_thumb_update_db failed : %d", err);
+ res_msg->status = err;
}
_media_thumb_db_disconnect();
diff --git a/src/include/util/media-thumb-db.h b/src/include/util/media-thumb-db.h
index 6a5b64c..b3e3666 100755
--- a/src/include/util/media-thumb-db.h
+++ b/src/include/util/media-thumb-db.h
@@ -37,7 +37,6 @@ int _media_thumb_db_disconnect();
int _media_thumb_get_thumb_from_db_with_size(const char *origin_path,
char *thumb_path,
int max_length,
- int *need_update_db,
int *width,
int *height);
int _media_thumb_update_db(const char *origin_path, char *thumb_path, int width, int height, uid_t uid);
diff --git a/src/util/media-thumb-db.c b/src/util/media-thumb-db.c
index 33d00ca..3332a18 100755
--- a/src/util/media-thumb-db.c
+++ b/src/util/media-thumb-db.c
@@ -163,7 +163,6 @@ int _media_thumb_db_disconnect()
int _media_thumb_get_thumb_from_db_with_size(const char *origin_path,
char *thumb_path,
int max_length,
- int *need_update_db,
int *width,
int *height)
{
@@ -179,7 +178,6 @@ int _media_thumb_get_thumb_from_db_with_size(const char *origin_path,
if (strlen(thumb_path) == 0) {
thumb_warn("thumb path doesn't exist in DB");
- *need_update_db = 1;
return MS_MEDIA_ERR_INTERNAL;
}
@@ -187,7 +185,6 @@ int _media_thumb_get_thumb_from_db_with_size(const char *origin_path,
if (!g_file_test(thumb_path, G_FILE_TEST_EXISTS)) {
thumb_warn("thumb path doesn't exist in file system");
- *need_update_db = 1;
return MS_MEDIA_ERR_INTERNAL;
} else {
thumb_dbg("This thumb path already exist");