diff options
author | hj kim <backto.kim@samsung.com> | 2015-06-04 21:09:04 -0700 |
---|---|---|
committer | hj kim <backto.kim@samsung.com> | 2015-06-04 21:09:04 -0700 |
commit | 999b9402a56d7c9738d6d632eff2f90004bbfbaf (patch) | |
tree | 31416fd3ece796751014dab252673fc71b278240 /server | |
parent | c896230ef091a244204b17bc9ab0ffa974ce2031 (diff) | |
download | libmedia-thumbnail-999b9402a56d7c9738d6d632eff2f90004bbfbaf.tar.gz libmedia-thumbnail-999b9402a56d7c9738d6d632eff2f90004bbfbaf.tar.bz2 libmedia-thumbnail-999b9402a56d7c9738d6d632eff2f90004bbfbaf.zip |
Revert "Modify error type"submit/tizen/20150605.041217accepted/tizen/wearable/20150606.054548accepted/tizen/tv/20150606.053731accepted/tizen/mobile/20150606.053029accepted/tizen/common/20150605.124444
This reverts commit c896230ef091a244204b17bc9ab0ffa974ce2031.
Change-Id: I94ec0a56f7c3d84ad76645b91310494b96d41932
Diffstat (limited to 'server')
-rwxr-xr-x | server/thumb-server-internal.c | 28 | ||||
-rwxr-xr-x | server/thumb-server.c | 9 |
2 files changed, 20 insertions, 17 deletions
diff --git a/server/thumb-server-internal.c b/server/thumb-server-internal.c index bd08d61..1553604 100755 --- a/server/thumb-server-internal.c +++ b/server/thumb-server-internal.c @@ -151,10 +151,10 @@ void _thumb_daemon_stop_job() int _thumb_daemon_process_job(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid) { - int err = MS_MEDIA_ERR_NONE; + int err = -1; err = _media_thumb_process(req_msg, res_msg, uid); - if (err != MS_MEDIA_ERR_NONE) { + if (err < 0) { if (req_msg->msg_type == THUMB_REQUEST_SAVE_FILE) { thumb_err("_media_thumb_process is failed: %d", err); res_msg->status = THUMB_FAIL; @@ -171,7 +171,7 @@ int _thumb_daemon_process_job(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid) int _thumb_daemon_all_extract(uid_t uid) { - int err = MS_MEDIA_ERR_NONE; + int err = -1; int count = 0; char query_string[MAX_PATH_SIZE + 1] = { 0, }; char path[MAX_PATH_SIZE + 1] = { 0, }; @@ -179,15 +179,15 @@ int _thumb_daemon_all_extract(uid_t uid) sqlite3_stmt *sqlite_stmt = NULL; err = _media_thumb_db_connect(uid); - if (err != MS_MEDIA_ERR_NONE) { + if (err < 0) { thumb_err("_media_thumb_db_connect failed: %d", err); - return err; + return MEDIA_THUMB_ERROR_DB; } sqlite_db_handle = _media_thumb_db_get_handle(); if (sqlite_db_handle == NULL) { thumb_err("sqlite handle is NULL"); - return MS_MEDIA_ERR_INTERNAL; + return MEDIA_THUMB_ERROR_DB; } if (_thumb_daemon_mmc_status() == VCONFKEY_SYSMAN_MMC_MOUNTED) { @@ -195,20 +195,20 @@ int _thumb_daemon_all_extract(uid_t uid) } else { snprintf(query_string, sizeof(query_string), SELECT_PATH_FROM_UNEXTRACTED_THUMB_INTERNAL_MEDIA); } - + thumb_warn("Query: %s", query_string); err = sqlite3_prepare_v2(sqlite_db_handle, query_string, strlen(query_string), &sqlite_stmt, NULL); if (SQLITE_OK != err) { - thumb_err("prepare error [%s]", sqlite3_errmsg(sqlite_db_handle)); + thumb_err("prepare error [%s]\n", sqlite3_errmsg(sqlite_db_handle)); _media_thumb_db_disconnect(); - return MS_MEDIA_ERR_INTERNAL; + return MEDIA_THUMB_ERROR_DB; } while(1) { err = sqlite3_step(sqlite_stmt); if (err != SQLITE_ROW) { - thumb_dbg("end of row [%s]", sqlite3_errmsg(sqlite_db_handle)); + thumb_dbg("end of row [%s]\n", sqlite3_errmsg(sqlite_db_handle)); break; } @@ -232,17 +232,17 @@ int _thumb_daemon_all_extract(uid_t uid) sqlite3_finalize(sqlite_stmt); _media_thumb_db_disconnect(); - return MS_MEDIA_ERR_NONE; + return MEDIA_THUMB_ERROR_NONE; } int _thumb_daemon_process_queue_jobs(gpointer data) { - int err = MS_MEDIA_ERR_NONE; + int err = -1; char *path = NULL; uid_t uid = NULL; if (g_cur_idx < g_idx) { - thumb_warn("There are %d jobs in the queue", g_idx - g_cur_idx); + thumb_dbg("There are %d jobs in the queue", g_idx - g_cur_idx); thumb_dbg("Current idx : [%d]", g_cur_idx); uid = arr_uid[g_cur_idx]; path = arr_path[g_cur_idx++]; @@ -261,7 +261,7 @@ int _thumb_daemon_process_queue_jobs(gpointer data) if (res_msg.status == THUMB_SUCCESS) { err = _media_thumb_db_connect(uid); - if (err != MS_MEDIA_ERR_NONE) { + if (err < 0) { thumb_err("_media_thumb_mb_svc_connect failed: %d", err); return TRUE; } diff --git a/server/thumb-server.c b/server/thumb-server.c index 4248f24..ca5fd48 100755 --- a/server/thumb-server.c +++ b/server/thumb-server.c @@ -24,6 +24,7 @@ #include "media-thumb-ipc.h" #include "media-thumb-util.h" #include "thumb-server-internal.h" + #include <pthread.h> #include <heynoti.h> #include <vconf.h> @@ -91,12 +92,12 @@ int main() /* Create and bind new UDP socket */ if (!_thumb_server_prepare_socket(&sockfd)) { - thumb_err("Failed to create socket"); + thumb_err("Failed to create socket\n"); return -1; } g_thumb_server_mainloop = g_main_loop_new(context, FALSE); - + /* Create new channel to watch udp socket */ channel = g_io_channel_unix_new(sockfd); source = g_io_create_watch(channel, G_IO_IN); @@ -116,13 +117,15 @@ int main() g_source_set_callback(sig_handler_src, (GSourceFunc)_media_thumb_signal_handler, NULL, NULL); g_source_attach(sig_handler_src, context); */ + thumb_dbg("************************************"); thumb_dbg("*** Thumbnail server is running ***"); thumb_dbg("************************************"); g_main_loop_run(g_thumb_server_mainloop); - + thumb_dbg("Thumbnail server is shutting down..."); + g_io_channel_shutdown(channel, FALSE, NULL); g_io_channel_unref(channel); _thumb_daemon_finish_jobs(); |