From: yoonki.park Date: Fri, 4 Mar 2016 08:41:43 +0000 (+0900) Subject: Fixed build warning "implicit declaration of function" X-Git-Tag: submit/tizen/20160304.090005^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=597a05ca47795b91fae03815e01cf8fb7467ecb9;p=sdk%2Ftarget%2Fsdbd.git Fixed build warning "implicit declaration of function" Change-Id: I15989e44823099736c39f600716e0e559bb45850 Signed-off-by: shingil.kang --- diff --git a/packaging/sdbd.spec b/packaging/sdbd.spec index dc6d083..00d6fd4 100644 --- a/packaging/sdbd.spec +++ b/packaging/sdbd.spec @@ -2,7 +2,7 @@ Name: sdbd Summary: SDB daemon -Version: 3.0.3 +Version: 3.0.4 Release: 0 License: Apache-2.0 Summary: SDB daemon diff --git a/packaging/sdbd_device.service b/packaging/sdbd_device.service index 949ca4e..e83b1f7 100644 --- a/packaging/sdbd_device.service +++ b/packaging/sdbd_device.service @@ -11,4 +11,4 @@ RemainAfterExit=yes ExecStart=/usr/sbin/sdbd [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=multi-user.target diff --git a/src/file_sync_service.c b/src/file_sync_service.c index 2efe0ea..cfe3e7f 100644 --- a/src/file_sync_service.c +++ b/src/file_sync_service.c @@ -35,6 +35,7 @@ #include "file_sync_service.h" #include "sdktools.h" #include "sdbd_plugin.h" +#include "utils.h" #define SYNC_TIMEOUT 15 @@ -65,7 +66,7 @@ void init_sdk_sync_permit_rule_regx(void) { asprintf(&sdk_sync_permit_rule[0].regx, "^((/tmp)|(%s)|(%s))/[a-zA-Z0-9]{10}/data/[a-zA-Z0-9_\\-]{1,50}\\.xml$", APP_INSTALL_PATH_PREFIX1, APP_INSTALL_PATH_PREFIX2); asprintf(&sdk_sync_permit_rule[1].regx, "^((/tmp)|(%s)|(%s))/[a-zA-Z0-9]{10}/data/+(.)*\\.gcda$", APP_INSTALL_PATH_PREFIX1, APP_INSTALL_PATH_PREFIX2); - asprintf(&sdk_sync_permit_rule[2].regx, "da", "^(/tmp/da/)*+[a-zA-Z0-9_\\-\\.]{1,50}\\.png$"); + asprintf(&sdk_sync_permit_rule[2].regx, "^(/tmp/da/)*+[a-zA-Z0-9_\\-\\.]{1,50}\\.png$"); } diff --git a/src/sdb.c b/src/sdb.c index 10198ab..52e520f 100644 --- a/src/sdb.c +++ b/src/sdb.c @@ -1262,6 +1262,24 @@ static void pwlock_cb(keynode_t *key, void* data) { send_device_status(); } +void register_pwlock_cb() { + int ret = vconf_notify_key_changed(VCONFKEY_IDLE_LOCK_STATE, pwlock_cb, NULL); + if(ret != 0) { + D("cannot register vconf callback.\n"); + return; + } + D("registered vconf callback\n"); +} + +void unregister_pwlock_cb() { + int ret = vconf_ignore_key_changed(VCONFKEY_IDLE_LOCK_STATE, pwlock_cb); + if(ret != 0) { + D("cannot unregister vconf callback.\n"); + return; + } + D("unregistered vconf callback\n"); +} + static void *pwlock_thread(void *x) { GMainLoop *loop; loop = g_main_loop_new(NULL, FALSE); @@ -1272,7 +1290,6 @@ static void *pwlock_thread(void *x) { return 0; } - void create_pwlock_thread() { sdb_thread_t t; if(sdb_thread_create( &t, pwlock_thread, NULL)) { @@ -1282,24 +1299,6 @@ void create_pwlock_thread() { D("created pwlock_thread\n"); } -void register_pwlock_cb() { - int ret = vconf_notify_key_changed(VCONFKEY_IDLE_LOCK_STATE, pwlock_cb, NULL); - if(ret != 0) { - D("cannot register vconf callback.\n"); - return; - } - D("registered vconf callback\n"); -} - -void unregister_pwlock_cb() { - int ret = vconf_ignore_key_changed(VCONFKEY_IDLE_LOCK_STATE, pwlock_cb); - if(ret != 0) { - D("cannot unregister vconf callback.\n"); - return; - } - D("unregistered vconf callback\n"); -} - #include #include #include diff --git a/src/sdb.h b/src/sdb.h index 9cef525..295aa32 100644 --- a/src/sdb.h +++ b/src/sdb.h @@ -309,6 +309,7 @@ void init_transport_registration(void); int list_transports(char *buf, size_t bufsize); void update_transports(void); void broadcast_transport(apacket *p); +int get_connected_count(transport_type type); asocket* create_device_tracker(void); diff --git a/src/services.c b/src/services.c index f5c62f3..739e36f 100644 --- a/src/services.c +++ b/src/services.c @@ -39,6 +39,7 @@ #endif #include "strutils.h" +#include "utils.h" #include #include @@ -596,7 +597,6 @@ static int create_subproc_thread(const char *name, int lines, int columns) snprintf(path, sizeof(path), "%s", trim_value); } envp[3] = path; - free(trim_value); } else { snprintf(path, sizeof(path), "%s", value); envp[3] = path; diff --git a/src/utils.c b/src/utils.c index b111a16..ae7d51d 100644 --- a/src/utils.c +++ b/src/utils.c @@ -23,6 +23,7 @@ #include #include #include +#include #define STRING_MAXLEN 1024 char* @@ -112,24 +113,42 @@ buff_add (char* buff, char* buffEnd, const char* format, ... ) return buff; } -char *str_trim(const char* string) -{ - const char* s = string; - const char* e = string + (strlen(string) - 1); - char* ret; - - while(*s == ' ' || *s == '\t') // ltrim - s++; - while(*e == ' ' || *e == '\t') // rtrim - e--; - - ret = strdup(s); - if(ret == NULL) { - return NULL; - } - ret[e - s + 1] = 0; +char *str_trim(char *str) { + size_t len = 0; + char *frontp = str; + char *endp = NULL; - return ret; + if (str == NULL) { + return NULL; + } + if (str[0] == '\0') { + return str; + } + + len = strlen(str); + endp = str + len; + + while (isspace(*frontp)) { + ++frontp; + } + if (endp != frontp) { + while (isspace(*(--endp)) && endp != frontp) { + } + } + + if (str + len - 1 != endp) + *(endp + 1) = '\0'; + else if (frontp != str && endp == frontp) + *str = '\0'; + + endp = str; + if (frontp != str) { + while (*frontp) { + *endp++ = *frontp++; + } + *endp = '\0'; + } + return str; } int spawn(char* program, char** arg_list) diff --git a/src/utils.h b/src/utils.h index 6904377..11a63c8 100644 --- a/src/utils.h +++ b/src/utils.h @@ -66,7 +66,7 @@ char* buff_add (char* buff, char* buffEnd, const char* format, ... ); #define BUFF_DECL(_buff,_cursor,_end,_size) \ char _buff[_size], *_cursor=_buff, *_end = _cursor + (_size) -char *str_trim(const char* string); +char *str_trim(char* string); /* * spawn a process and returns the process id of the new spawned process.