libdeviced: fix warnings occurred during compiling 19/55619/4
authorTaeyoung Kim <ty317.kim@samsung.com>
Mon, 28 Dec 2015 08:01:15 +0000 (17:01 +0900)
committerTaeyoung Kim <ty317.kim@samsung.com>
Mon, 28 Dec 2015 09:56:33 +0000 (18:56 +0900)
- type mismatches are fixed
- unused functions and variables are removed
- missed header files are added

Change-Id: I6f91fc82e047e9dd9e19ad5ab4216f61b88bc705
Signed-off-by: Taeyoung Kim <ty317.kim@samsung.com>
src/deviced/dd-storage.h
src/libdeviced/control.c
src/libdeviced/dbus.c
src/libdeviced/deviced-conf.c
src/libdeviced/deviced-noti.c
src/libdeviced/haptic.c
src/libdeviced/storage.c
src/shared/dbus.h

index deb3cd8..9181e91 100644 (file)
@@ -65,7 +65,7 @@ enum storage_path_type {
  *  ...
  * @endcode
  */
-int storage_get_path(int type, unsigned char *path, int size);
+int storage_get_path(int type, char *path, int size);
 
 /**
  * @} // end of CAPI_SYSTEM_DEVICED_STORAGE_MODULE
index 3f53530..cc94947 100644 (file)
@@ -20,6 +20,7 @@
 #include <stdio.h>
 #include <vconf.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include "log.h"
 #include "dbus.h"
index d62e8fc..7b6a6e7 100644 (file)
@@ -23,6 +23,7 @@
 #include <stdint.h>
 #include <errno.h>
 #include <dbus/dbus.h>
+#include <dbus/dbus-glib-lowlevel.h>
 
 #include "common.h"
 #include "log.h"
index 0d3cb1c..f6e442f 100644 (file)
@@ -18,6 +18,7 @@
 
 
 #include <stdio.h>
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <dlfcn.h>
@@ -267,7 +268,6 @@ API int deviced_conf_is_vip(int pid)
 
 API int deviced_conf_set_permanent_bypid(int pid)
 {
-       int fd;
        if (already_permanent(pid))
                goto MEMPOL_SET;
 
index 0277f36..812f63c 100644 (file)
@@ -78,8 +78,12 @@ static inline int send_str(int fd, char *str)
                len = strlen(str);
                if (len > SYSTEM_NOTI_MAXSTR)
                        len = SYSTEM_NOTI_MAXSTR;
-               write(fd, &len, sizeof(int));
+               ret = write(fd, &len, sizeof(int));
+               if (ret < 0)
+                       _E("Failed to write (%d)", errno);
                ret = write(fd, str, len);
+               if (ret < 0)
+                       _E("Failed to write (%d)", errno);
        }
        return ret;
 }
@@ -142,38 +146,6 @@ static int noti_send(struct sysnoti *msg)
        return result;
 }
 
-static int dbus_flightmode_handler(char* type, char *buf)
-{
-       DBusError err;
-       DBusMessage *msg;
-       char *pa[3];
-       int ret, val;
-
-       pa[0] = type;
-       pa[1] = "1";
-       pa[2] = buf;
-
-       msg = dbus_method_sync_with_reply(DEVICED_BUS_NAME,
-                       DEVICED_PATH_POWER, DEVICED_INTERFACE_POWER,
-                       pa[0], "sis", pa);
-       if (!msg)
-               return -EBADMSG;
-
-       dbus_error_init(&err);
-
-       ret = dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &val, DBUS_TYPE_INVALID);
-       if (!ret) {
-               _E("no message : [%s:%s]", err.name, err.message);
-               val = -EBADMSG;
-       }
-
-       dbus_message_unref(msg);
-       dbus_error_free(&err);
-
-       _D("%s-%s : %d", DEVICED_INTERFACE_POWER, pa[0], val);
-       return val;
-}
-
 API int deviced_call_predef_action(const char *type, int num, ...)
 {
        struct sysnoti *msg;
@@ -371,7 +343,6 @@ static DBusMessage *alarm_set_time_sync_with_reply(time_t timet)
        DBusMessageIter iter;
        DBusMessage *reply;
        DBusError err;
-       int r;
 
        conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
        if (!conn) {
index 255ae9d..40f090b 100644 (file)
@@ -220,7 +220,7 @@ API int haptic_close(haptic_device_h device_handle)
        int ret;
 
        /* check if handle is valid */
-       if (device_handle == NULL) {
+       if (!device_handle) {
                _E("Invalid parameter : device_handle");
                return HAPTIC_ERROR_INVALID_PARAMETER;
        }
@@ -261,7 +261,7 @@ API int haptic_vibrate_monotone_with_detail(haptic_device_h device_handle,
        int ret;
 
        /* check if handle is valid */
-       if (device_handle == NULL) {
+       if (!device_handle) {
                _E("Invalid parameter : device_handle");
                return HAPTIC_ERROR_INVALID_PARAMETER;
        }
@@ -310,7 +310,7 @@ API int haptic_vibrate_monotone_with_detail(haptic_device_h device_handle,
 
 API int haptic_vibrate_file(haptic_device_h device_handle, const char *file_path, haptic_effect_h *effect_handle)
 {
-       char *vibe_buffer;
+       unsigned char *vibe_buffer;
        int size, ret;
 
        vibe_buffer = convert_file_to_buffer(file_path, &size);
@@ -320,7 +320,7 @@ API int haptic_vibrate_file(haptic_device_h device_handle, const char *file_path
        }
 
        ret = haptic_vibrate_buffers_with_detail(device_handle,
-                                                                                       vibe_buffer,
+                                                                                       (const unsigned char *)vibe_buffer,
                                                                                        size,
                                                                                        HAPTIC_ITERATION_ONCE,
                                                                                        HAPTIC_FEEDBACK_AUTO,
@@ -337,7 +337,7 @@ API int haptic_vibrate_file_with_detail(haptic_device_h device_handle,
                                        haptic_priority_e priority,
                                        haptic_effect_h *effect_handle)
 {
-       char *vibe_buffer;
+       unsigned char *vibe_buffer;
        int size, ret;
 
        vibe_buffer = convert_file_to_buffer(file_path, &size);
@@ -347,7 +347,7 @@ API int haptic_vibrate_file_with_detail(haptic_device_h device_handle,
        }
 
        ret = haptic_vibrate_buffers_with_detail(device_handle,
-                                                                                       vibe_buffer,
+                                                                                       (const unsigned char *)vibe_buffer,
                                                                                        size,
                                                                                        iteration,
                                                                                        feedback,
@@ -415,7 +415,7 @@ API int haptic_vibrate_buffers_with_detail(haptic_device_h device_handle,
        int ret;
 
        /* check if handle is valid */
-       if (device_handle == NULL) {
+       if (!device_handle) {
                _E("Invalid parameter : device_handle");
                return HAPTIC_ERROR_INVALID_PARAMETER;
        }
@@ -482,7 +482,7 @@ API int haptic_stop_all_effects(haptic_device_h device_handle)
        int ret;
 
        /* check if handle is valid */
-       if (device_handle == NULL) {
+       if (!device_handle) {
                _E("Invalid parameter : device_handle");
                return HAPTIC_ERROR_INVALID_PARAMETER;
        }
@@ -507,7 +507,7 @@ API int haptic_get_effect_state(haptic_device_h device_handle, haptic_effect_h e
        int ret;
 
        /* check if handle is valid */
-       if (device_handle == NULL) {
+       if (!device_handle) {
                _E("Invalid parameter : device_handle");
                return HAPTIC_ERROR_INVALID_PARAMETER;
        }
@@ -624,7 +624,7 @@ API int haptic_save_effect(const unsigned char *vibe_buffer,
                        const char *file_path)
 {
        struct stat buf;
-       int size, ret;
+       int ret;
 
        /* check if passed arguments are valid */
        if (vibe_buffer == NULL) {
@@ -660,7 +660,7 @@ API int haptic_save_effect(const unsigned char *vibe_buffer,
 
 API int haptic_get_file_duration(haptic_device_h device_handle, const char *file_path, int *file_duration)
 {
-       char *vibe_buffer;
+       unsigned char *vibe_buffer;
        int size, ret;
 
        vibe_buffer = convert_file_to_buffer(file_path, &size);
@@ -670,7 +670,7 @@ API int haptic_get_file_duration(haptic_device_h device_handle, const char *file
        }
 
        ret = haptic_get_buffers_duration(device_handle,
-                                                                        vibe_buffer,
+                                                                        (const unsigned char *)vibe_buffer,
                                                                         size,
                                                                         file_duration);
        free(vibe_buffer);
@@ -693,7 +693,7 @@ API int haptic_get_buffers_duration(haptic_device_h device_handle, const unsigne
        int ret;
 
        /* check if handle is valid */
-       if (device_handle == NULL) {
+       if (!device_handle) {
                _E("Invalid parameter : device_handle");
                return HAPTIC_ERROR_INVALID_PARAMETER;
        }
@@ -729,7 +729,6 @@ API int haptic_get_buffers_duration(haptic_device_h device_handle, const unsigne
 API int haptic_save_led(const unsigned char *vibe_buffer, int max_bufsize, const char *file_path)
 {
        struct stat buf;
-       char str_bufsize[32];
        char *arr[3];
        struct dbus_byte bytes;
        int ret;
index aaf5eb0..3f0151b 100644 (file)
 #define EXT_PARENT_PATH                        "/opt/storage"
 #define EXT_OPTION1_PATH               "/mnt/mmc"
 
-static bool check_ext_mount(void)
-{
-       struct stat parent, ext;
-
-       if (stat(EXT_PATH, &ext) != 0 || stat(EXT_PARENT_PATH, &parent) != 0)
-               return false;
-
-       if (ext.st_dev == parent.st_dev)
-               return false;
-
-       return true;
-}
-
-API int storage_get_path(int type, unsigned char *path, int size)
+API int storage_get_path(int type, char *path, int size)
 {
        char *ext_path = EXT_PATH;
-       int option;
 
        if (type < 0 || type > STORAGE_MAX || !path)
                return -EINVAL;
index f79315c..4762b23 100644 (file)
 #define CRASHD_INTERFACE_CRASH              CRASHD_INTERFACE_NAME".Crash"
 
 struct dbus_byte {
-       const char *data;
+       const unsigned char *data;
        int size;
 };