summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorhj kim <backto.kim@samsung.com>2015-06-05 05:58:36 (GMT)
committerhj kim <backto.kim@samsung.com>2015-06-05 05:58:36 (GMT)
commit147bd126e27935c2f61283e0b9b247b713744127 (patch)
tree97e54161e040dbc59c0945184ed3a0abc1f3cc02 /server
parent999b9402a56d7c9738d6d632eff2f90004bbfbaf (diff)
downloadlibmedia-thumbnail-147bd126e27935c2f61283e0b9b247b713744127.zip
libmedia-thumbnail-147bd126e27935c2f61283e0b9b247b713744127.tar.gz
libmedia-thumbnail-147bd126e27935c2f61283e0b9b247b713744127.tar.bz2
This reverts commit 999b9402a56d7c9738d6d632eff2f90004bbfbaf. Change-Id: Ieadecdcb087ad27b7c60a1ed448db329df2b38c1
Diffstat (limited to 'server')
-rwxr-xr-xserver/thumb-server-internal.c28
-rwxr-xr-xserver/thumb-server.c9
2 files changed, 17 insertions, 20 deletions
diff --git a/server/thumb-server-internal.c b/server/thumb-server-internal.c
index 1553604..bd08d61 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 = -1;
+ int err = MS_MEDIA_ERR_NONE;
err = _media_thumb_process(req_msg, res_msg, uid);
- if (err < 0) {
+ if (err != MS_MEDIA_ERR_NONE) {
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 = -1;
+ int err = MS_MEDIA_ERR_NONE;
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 < 0) {
+ if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_db_connect failed: %d", err);
- return MEDIA_THUMB_ERROR_DB;
+ return err;
}
sqlite_db_handle = _media_thumb_db_get_handle();
if (sqlite_db_handle == NULL) {
thumb_err("sqlite handle is NULL");
- return MEDIA_THUMB_ERROR_DB;
+ return MS_MEDIA_ERR_INTERNAL;
}
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]\n", sqlite3_errmsg(sqlite_db_handle));
+ thumb_err("prepare error [%s]", sqlite3_errmsg(sqlite_db_handle));
_media_thumb_db_disconnect();
- return MEDIA_THUMB_ERROR_DB;
+ return MS_MEDIA_ERR_INTERNAL;
}
while(1) {
err = sqlite3_step(sqlite_stmt);
if (err != SQLITE_ROW) {
- thumb_dbg("end of row [%s]\n", sqlite3_errmsg(sqlite_db_handle));
+ thumb_dbg("end of row [%s]", 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 MEDIA_THUMB_ERROR_NONE;
+ return MS_MEDIA_ERR_NONE;
}
int _thumb_daemon_process_queue_jobs(gpointer data)
{
- int err = -1;
+ int err = MS_MEDIA_ERR_NONE;
char *path = NULL;
uid_t uid = NULL;
if (g_cur_idx < g_idx) {
- thumb_dbg("There are %d jobs in the queue", g_idx - g_cur_idx);
+ thumb_warn("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 < 0) {
+ if (err != MS_MEDIA_ERR_NONE) {
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 ca5fd48..4248f24 100755
--- a/server/thumb-server.c
+++ b/server/thumb-server.c
@@ -24,7 +24,6 @@
#include "media-thumb-ipc.h"
#include "media-thumb-util.h"
#include "thumb-server-internal.h"
-
#include <pthread.h>
#include <heynoti.h>
#include <vconf.h>
@@ -92,12 +91,12 @@ int main()
/* Create and bind new UDP socket */
if (!_thumb_server_prepare_socket(&sockfd)) {
- thumb_err("Failed to create socket\n");
+ thumb_err("Failed to create socket");
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);
@@ -117,15 +116,13 @@ 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...");
+ thumb_dbg("Thumbnail server is shutting down...");
g_io_channel_shutdown(channel, FALSE, NULL);
g_io_channel_unref(channel);
_thumb_daemon_finish_jobs();