Fixed build warning "implicit declaration of function" 57/61157/2 accepted/tizen/common/20160304.195712 accepted/tizen/ivi/20160305.094413 accepted/tizen/mobile/20160305.094323 accepted/tizen/tv/20160305.094340 accepted/tizen/wearable/20160305.094352 submit/tizen/20160304.090005
authoryoonki.park <yoonki.park@samsung.com>
Fri, 4 Mar 2016 08:41:43 +0000 (17:41 +0900)
committershingil.kang <shingil.kang@samsung.com>
Fri, 4 Mar 2016 08:46:13 +0000 (17:46 +0900)
Change-Id: I15989e44823099736c39f600716e0e559bb45850
Signed-off-by: shingil.kang <shingil.kang@samsung.com>
packaging/sdbd.spec
packaging/sdbd_device.service
src/file_sync_service.c
src/sdb.c
src/sdb.h
src/services.c
src/utils.c
src/utils.h

index dc6d0833a871aef7f1b897617e0fcaa8b2dc2eb7..00d6fd48356d6635b31d58ecf4c06773a51d9504 100644 (file)
@@ -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
index 949ca4e0d597dd31b0f0b69c418643806b915765..e83b1f79148dab1e4a74b09b2f1b8b11fea15983 100644 (file)
@@ -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
index 2efe0eaaa011b1b415194f83641e5797645acb43..cfe3e7f7be6ce19022a0d4b686d147a99df76a5b 100644 (file)
@@ -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$");
 
 }
 
index 10198ab2c93d188bef762434c79fe22d9b9f2ca0..52e520fa807fa3eff4e1a6996580b3a7e8dcea8b 100644 (file)
--- 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 <dbus/dbus.h>
 #include <dbus/dbus-glib.h>
 #include <dbus/dbus-glib-lowlevel.h>
index 9cef525680ec730e12b75cec19bf76cdd2a8697e..295aa328f996480397be525bb95fe8c7edc1bef8 100644 (file)
--- 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);
 
index f5c62f3ca4b0d4480378570e650def35b643f5b3..739e36ff7c6cb8210cc42ce0e205afb40e9b8643 100644 (file)
@@ -39,6 +39,7 @@
 #endif
 
 #include "strutils.h"
+#include "utils.h"
 #include <system_info.h>
 #include <tzplatform_config.h>
 
@@ -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;
index b111a16549e8989929f65bca915ff1a41c2c9451..ae7d51d31a64a2a1b05308a53085b5d6fbb3dfda 100644 (file)
@@ -23,6 +23,7 @@
 #include <unistd.h>
 #include <sys/wait.h>
 #include <errno.h>
+#include <ctype.h>
 
 #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)
index 6904377899754bbb25e5a261dc786ea5f00dcdc1..11a63c88a8a3bb931641985bcbef0ef3c0d4b750 100644 (file)
@@ -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.