Merge "Remove default systemd configuration" into tizen
authorJihoon Jung <jh8801.jung@samsung.com>
Thu, 5 Mar 2020 05:39:46 +0000 (05:39 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Thu, 5 Mar 2020 05:39:46 +0000 (05:39 +0000)
CMakeLists.txt
include/entity/mtp_store.h
include/transport/mtp_descs_strings.h
src/entity/mtp_property.c
src/entity/mtp_store.c
src/transport/mtp_usb_driver_slp.c
src/util/mtp_support.c
src/util/mtp_util.c

index f256ee6..3c916cf 100644 (file)
@@ -23,7 +23,7 @@ FOREACH(flag ${pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall -Werror-implicit-function-declaration")
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall -Werror")
 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fexceptions -fvisibility=hidden -fprofile-arcs -ftest-coverage")
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE")
index 569fc54..7d298c2 100644 (file)
@@ -96,7 +96,7 @@ mtp_obj_t *_entity_get_object_from_store(mtp_store_t *store, mtp_uint32 handle);
 mtp_obj_t *_entity_get_last_object_from_store(mtp_store_t *store,
                mtp_uint32 handle);
 mtp_obj_t *_entity_get_object_from_store_by_path(mtp_store_t *store,
-               mtp_char *file_path);
+               const mtp_char *file_path);
 mtp_uint32 _entity_get_objects_from_store(mtp_store_t *store,
                mtp_uint32 obj_handle, mtp_uint32 fmt, ptp_array_t *obj_arr);
 mtp_uint32 _entity_get_objects_from_store_till_depth(mtp_store_t *store,
index 37747ba..9e340f5 100644 (file)
@@ -28,8 +28,15 @@ enum functionfs_flags {
 };
 #endif
 
-#define cpu_to_le16(x)  htole16(x)
-#define cpu_to_le32(x)  htole32(x)
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+#define cpu_to_le16(x)  (x)
+#define cpu_to_le32(x)  (x)
+#else
+#define cpu_to_le16(x)  ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8))
+#define cpu_to_le32(x)  \
+       ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >>  8) | \
+       (((x) & 0x0000ff00u) <<  8) | (((x) & 0x000000ffu) << 24))
+#endif
 #define le32_to_cpu(x)  le32toh(x)
 #define le16_to_cpu(x)  le16toh(x)
 
index 3ab46d5..c14f61d 100644 (file)
@@ -1452,7 +1452,7 @@ mtp_bool _prop_is_valid_integer(prop_info_t *prop_info, mtp_uint64 value)
                mtp_uint32 ii;
                for (ii = 0; ii < prop_info->supp_value_list.nnodes;
                                ii++, node = node->link) {
-                       if (value == (mtp_uint32) node->value)
+                       if (value == GPOINTER_TO_UINT(node->value))
                                return TRUE;
                /* LCOV_EXCL_STOP */
                }
@@ -2421,7 +2421,7 @@ mtp_uint32 _prop_pack_device_prop_desc(device_prop_desc_t *prop,
                                        ii < prop->propinfo.supp_value_list.nnodes;
                                        ii++, node = node->link) {
 
-                               value = (mtp_uint32)node->value;
+                               value = GPOINTER_TO_UINT(node->value);
                                memcpy(temp, &value, prop->propinfo.dts_size);
 #ifdef __BIG_ENDIAN__
                                _util_conv_byte_order(temp, prop->propinfo.dts_size);
@@ -3044,7 +3044,7 @@ mtp_uint32 _prop_pack_obj_prop_desc(obj_prop_desc_t *prop, mtp_uchar *buf,
                                        ii < prop->propinfo.supp_value_list.nnodes;
                                        ii++, node = node->link) {
 
-                               value = (mtp_uint32)node->value;
+                               value = GPOINTER_TO_UINT(node->value);
                                memcpy(temp, &value, prop->propinfo.dts_size);
 #ifdef __BIG_ENDIAN__
                                _util_conv_byte_order(temp, prop->propinfo.dts_size);
@@ -3637,7 +3637,7 @@ mtp_bool _prop_add_supp_integer_val(prop_info_t *prop_info, mtp_uint32 value)
        }
 
        /* Create the node and append it. */
-       _util_add_node(&(prop_info->supp_value_list), (void *)value);
+       _util_add_node(&(prop_info->supp_value_list), GUINT_TO_POINTER(value));
 
        return TRUE;
 }
index d8fc4a8..b778cc7 100644 (file)
@@ -408,7 +408,7 @@ mtp_obj_t *_entity_get_last_object_from_store(mtp_store_t *store,
 }
 
 mtp_obj_t *_entity_get_object_from_store_by_path(mtp_store_t *store,
-               mtp_char *file_path)
+               const mtp_char *file_path)
 {
        mtp_obj_t *obj = NULL;
        slist_iterator *iter = NULL;
index 7ae85e3..a19de3d 100644 (file)
@@ -328,8 +328,8 @@ static void __handle_control_request(mtp_int32 request)
                        return;
                }
 
-               memcpy(&(cancelreq_data.io_code), buffer, sizeof(mtp_word));
-               memcpy(&(cancelreq_data.tid), &buffer[2], sizeof(mtp_dword));
+               memcpy(&(cancelreq_data.io_code), buffer, sizeof(mtp_uint16));
+               memcpy(&(cancelreq_data.tid), &buffer[2], sizeof(mtp_uint32));
                DBG("cancel io code [%d], transaction id [%du]\n",
                    cancelreq_data.io_code, cancelreq_data.tid);
                break;
index f9221c2..fb2b44b 100644 (file)
@@ -18,6 +18,7 @@
 #include <glib/gprintf.h>
 #include <unistd.h>
 #include <sys/wait.h>
+#include <stdint.h>
 #include "mtp_support.h"
 #include "ptp_datacodes.h"
 #include "mtp_util.h"
@@ -152,7 +153,7 @@ void _util_wchar_cpy(mtp_wchar *dest, const mtp_wchar *src)
        ret_if(src == NULL);
        ret_if(dest == NULL);
 
-       if (!((int)dest & 0x1) && !((int)src & 0x1)) {
+       if (!((uintptr_t)dest & 0x1) && !((uintptr_t)src & 0x1)) {
                /* 2-byte aligned */
                mtp_wchar *temp = dest;
 
@@ -191,7 +192,7 @@ void _util_wchar_ncpy(mtp_wchar *dest, const mtp_wchar *src, unsigned long n)
        ret_if(src == NULL);
        ret_if(dest == NULL);
 
-       if (!((int)dest & 0x1) && !((int)src & 0x1)) {  /* 2-byte aligned */
+       if (!((uintptr_t)dest & 0x1) && !((uintptr_t)src & 0x1)) {      /* 2-byte aligned */
                temp = dest;
 
                while (n && (*temp++ = *src++))
@@ -231,7 +232,7 @@ void _util_wchar_ncpy(mtp_wchar *dest, const mtp_wchar *src, unsigned long n)
  */
 size_t _util_wchar_len(const mtp_wchar *s)
 {
-       if (!((int)s & 0x1)) {  /* 2-byte aligned */
+       if (!((uintptr_t)s & 0x1)) {    /* 2-byte aligned */
                mtp_wchar *temp = (mtp_wchar *)s;
 
                while (*temp++)
index c16783a..21f077d 100644 (file)
@@ -348,8 +348,8 @@ static bool _util_device_external_supported_cb(int storage_id, storage_type_e ty
        //DBG("storage id: %d, path: %s", storage_id, path);
 
        if (type == STORAGE_TYPE_EXTERNAL && path != NULL) {
-               strncpy(storage_path, path, strlen(path)+1);
-               storage_path[strlen(path)] = 0;
+               strncpy(storage_path, path, MTP_MAX_PATHNAME_SIZE);
+               storage_path[MTP_MAX_PATHNAME_SIZE] = 0;
                //DBG("external storage path : %s", storage_path);
        }
 
@@ -367,7 +367,7 @@ void _util_get_external_path(char *external_path)
 /* LCOV_EXCL_START */
                ERR("get external storage path Fail");
                if (external_path != NULL) {
-                       strncpy(external_path, MTP_EXTERNAL_PATH_CHAR, sizeof(MTP_EXTERNAL_PATH_CHAR));
+                       strncpy(external_path, MTP_EXTERNAL_PATH_CHAR, MTP_MAX_PATHNAME_SIZE);
                        external_path[sizeof(MTP_EXTERNAL_PATH_CHAR) - 1] = 0;
                }
        }
@@ -461,15 +461,15 @@ void _util_get_internal_path(char *internal_path)
        if (active_name == NULL) {
                /* LCOV_EXCL_START */
                ERR("active_name is NULL");
-               strncpy(internal_path, MTP_USER_DIRECTORY, sizeof(MTP_USER_DIRECTORY));
+               strncpy(internal_path, MTP_USER_DIRECTORY, MTP_MAX_PATHNAME_SIZE);
                internal_path[sizeof(MTP_USER_DIRECTORY) - 1] = 0;
                return;
                /* LCOV_EXCL_STOP */
        }
 
        if (internal_path != NULL) {
-               strncpy(internal_path, MTP_INTERNAL_PATH_CHAR, sizeof(MTP_INTERNAL_PATH_CHAR));
-               strncat(internal_path, active_name, strlen(active_name) + 1);
+               strncpy(internal_path, MTP_INTERNAL_PATH_CHAR, MTP_MAX_PATHNAME_SIZE);
+               strncat(internal_path, active_name, MTP_MAX_PATHNAME_SIZE - sizeof(MTP_INTERNAL_PATH_CHAR));
                strncat(internal_path, "/media", 7);
                internal_path[strlen(internal_path)] = 0;
        }