summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinje Ahn <minje.ahn@samsung.com>2017-07-31 01:55:23 (GMT)
committerMinje Ahn <minje.ahn@samsung.com>2017-07-31 01:55:23 (GMT)
commit064fbb7b479f2e92785662afdea8f66d1315bc64 (patch)
treef9384421d0d9f4ad8b1b3ea0d9a740f4230740a1
parent32da7c25c64349bbc7fc330acb8922764e16e8c9 (diff)
downloadlibmedia-thumbnail-submit/tizen/20170801.052138.zip
libmedia-thumbnail-submit/tizen/20170801.052138.tar.gz
libmedia-thumbnail-submit/tizen/20170801.052138.tar.bz2
Change-Id: I1930be6dbccc4c7957bdb5bcd6389e77acbb51e2 Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
-rwxr-xr-xinclude/media-thumbnail.h2
-rwxr-xr-xsrc/include/ipc/media-thumb-ipc.h2
-rwxr-xr-xsrc/ipc/media-thumb-ipc.c92
-rwxr-xr-xsrc/media-thumbnail.c12
-rwxr-xr-xtest/test-thumb.c10
5 files changed, 30 insertions, 88 deletions
diff --git a/include/media-thumbnail.h b/include/media-thumbnail.h
index 3285b0a..0470768 100755
--- a/include/media-thumbnail.h
+++ b/include/media-thumbnail.h
@@ -42,7 +42,7 @@ int thumbnail_request_from_db(const char *origin_path, char *thumb_path, int max
int thumbnail_request_cancel_media(unsigned int request_id, const char *origin_path);
int thumbnail_request_cancel_raw_data(int request_id);
-int thumbnail_request_cancel_all(bool is_raw_data);
+int thumbnail_request_cancel_all();
#ifdef __cplusplus
}
diff --git a/src/include/ipc/media-thumb-ipc.h b/src/include/ipc/media-thumb-ipc.h
index 651cd7c..801d1e1 100755
--- a/src/include/ipc/media-thumb-ipc.h
+++ b/src/include/ipc/media-thumb-ipc.h
@@ -53,6 +53,6 @@ int _media_thumb_request_raw_data_async(int msg_type,
thumbRawUserData *userData,
uid_t uid);
-int _media_thumb_request_cancel_all(bool isRaw);
+int _media_thumb_request_cancel_all();
#endif /*_MEDIA_THUMB_IPC_H_*/
diff --git a/src/ipc/media-thumb-ipc.c b/src/ipc/media-thumb-ipc.c
index 5faed91..63f22d4 100755
--- a/src/ipc/media-thumb-ipc.c
+++ b/src/ipc/media-thumb-ipc.c
@@ -1041,41 +1041,15 @@ int _media_thumb_request_raw_data_async(int msg_type, int request_id, const char
return err;
}
-int _media_thumb_request_cancel_all(bool isRaw)
+int _media_thumb_request_cancel_all()
{
int i;
int req_len = -1;
int len = 0;
+ thumbRawReq *tmp_raw_req = NULL;
- if (isRaw) {
- thumbRawReq *tmp_raw_req = NULL;
- if (g_manage_raw_queue == NULL) {
- thumb_err("manage_queue is NULL");
- if (g_request_raw_queue != NULL) {
- /* Check request queue */
- len = g_queue_get_length(g_request_raw_queue);
- if (len > 0) {
- tmp_raw_req = g_queue_peek_head(g_request_raw_queue);
- if (tmp_raw_req != NULL)
- tmp_raw_req->isCanceled = true;
- return MS_MEDIA_ERR_NONE;
- }
- }
- thumb_err("request_queue is NULL");
- return MS_MEDIA_ERR_INTERNAL;
- }
- req_len = g_queue_get_length(g_manage_raw_queue);
- for (i = 0; i < req_len; i++) {
- tmp_raw_req = g_queue_pop_tail(g_manage_raw_queue);
- if (tmp_raw_req) {
- SAFE_FREE(tmp_raw_req->path);
- SAFE_FREE(tmp_raw_req->userData);
- SAFE_FREE(tmp_raw_req);
- tmp_raw_req = NULL;
- }
- }
- g_queue_free(g_manage_raw_queue);
- g_manage_raw_queue = NULL;
+ if (g_manage_raw_queue == NULL) {
+ thumb_err("manage_queue is NULL");
if (g_request_raw_queue != NULL) {
/* Check request queue */
len = g_queue_get_length(g_request_raw_queue);
@@ -1083,45 +1057,31 @@ int _media_thumb_request_cancel_all(bool isRaw)
tmp_raw_req = g_queue_peek_head(g_request_raw_queue);
if (tmp_raw_req != NULL)
tmp_raw_req->isCanceled = true;
+ return MS_MEDIA_ERR_NONE;
}
}
- } else {
- thumbReq *tmp_req = NULL;
- if (g_manage_queue == NULL) {
- thumb_err("manage_queue is NULL");
- if (g_request_queue != NULL) {
- /* Check request queue */
- len = g_queue_get_length(g_request_queue);
- if (len > 0) {
- tmp_req = g_queue_peek_head(g_request_queue);
- if (tmp_req != NULL)
- tmp_req->isCanceled = true;
- return MS_MEDIA_ERR_NONE;
- }
- }
- thumb_err("request_queue is NULL");
- return MS_MEDIA_ERR_INTERNAL;
- }
- req_len = g_queue_get_length(g_manage_queue);
- for (i = 0; i < req_len; i++) {
- tmp_req = g_queue_pop_tail(g_manage_queue);
- if (tmp_req) {
- SAFE_FREE(tmp_req->path);
- SAFE_FREE(tmp_req->userData);
- SAFE_FREE(tmp_req);
- tmp_req = NULL;
- }
+ thumb_err("request_queue is NULL");
+ return MS_MEDIA_ERR_INTERNAL;
+ }
+ req_len = g_queue_get_length(g_manage_raw_queue);
+ for (i = 0; i < req_len; i++) {
+ tmp_raw_req = g_queue_pop_tail(g_manage_raw_queue);
+ if (tmp_raw_req) {
+ SAFE_FREE(tmp_raw_req->path);
+ SAFE_FREE(tmp_raw_req->userData);
+ SAFE_FREE(tmp_raw_req);
+ tmp_raw_req = NULL;
}
- g_queue_free(g_manage_queue);
- g_manage_queue = NULL;
- if (g_request_queue != NULL) {
- /* Check request queue */
- len = g_queue_get_length(g_request_queue);
- if (len > 0) {
- tmp_req = g_queue_peek_head(g_request_queue);
- if (tmp_req != NULL)
- tmp_req->isCanceled = true;
- }
+ }
+ g_queue_free(g_manage_raw_queue);
+ g_manage_raw_queue = NULL;
+ if (g_request_raw_queue != NULL) {
+ /* Check request queue */
+ len = g_queue_get_length(g_request_raw_queue);
+ if (len > 0) {
+ tmp_raw_req = g_queue_peek_head(g_request_raw_queue);
+ if (tmp_raw_req != NULL)
+ tmp_raw_req->isCanceled = true;
}
}
diff --git a/src/media-thumbnail.c b/src/media-thumbnail.c
index b7fa359..b690f4c 100755
--- a/src/media-thumbnail.c
+++ b/src/media-thumbnail.c
@@ -186,15 +186,7 @@ int thumbnail_request_cancel_raw_data(int request_id)
return MS_MEDIA_ERR_NONE;
}
-int thumbnail_request_cancel_all(bool is_raw_data)
+int thumbnail_request_cancel_all()
{
- int err = MS_MEDIA_ERR_NONE;
-
- if (is_raw_data) {
- err = _media_thumb_request_cancel_all(true);
- } else {
- err = _media_thumb_request_cancel_all(false);
- }
-
- return err;
+ return _media_thumb_request_cancel_all();
}
diff --git a/test/test-thumb.c b/test/test-thumb.c
index 4c4a3ff..7b6c845 100755
--- a/test/test-thumb.c
+++ b/test/test-thumb.c
@@ -154,16 +154,6 @@ int main(int argc, char *argv[])
} else {
printf("thumbnail_request_cancel_media success!\n");
}
- } else if (mode == 3) {
- printf("Test thumbnail_request_cancel_all\n");
-
- err = thumbnail_request_cancel_all(true);
- if (err < 0) {
- printf("thumbnail_request_cancel_all failed : %d\n", err);
- return -1;
- } else {
- printf("thumbnail_request_cancel_all success!\n");
- }
}
thumb_dbg("Test is Completed");