gcc9 build fix 14/221114/1 accepted/tizen/unified/20191230.120904 submit/tizen/20191230.070409
authormanish.r <manish.r@samsung.com>
Fri, 27 Dec 2019 06:55:44 +0000 (12:25 +0530)
committermanish.r <manish.r@samsung.com>
Fri, 27 Dec 2019 06:55:44 +0000 (12:25 +0530)
Change-Id: I720c6984327f1a38a102973487a7d746ff56b333
Signed-off-by: manish.r <manish.r@samsung.com>
src/descs_strings.h
src/sdb.c
src/transport_local.c

index d36b33aeb5eddbf23fb8b184ce4ab9ff0b69cee7..033293b1c8ff42595caa8cdbb8d8f33f88eb03d3 100644 (file)
@@ -7,8 +7,21 @@
 #define MAX_PACKET_SIZE_FS     64
 #define MAX_PACKET_SIZE_HS     512
 
-#define cpu_to_le16(x)  htole16(x)
-#define cpu_to_le32(x)  htole32(x)
+/*
+ * cpu_to_le16/32 are used when initializing structures, a context where a
+ * function call is not allowed. To solve this, we code cpu_to_le16/32 in a way
+ * that allows them to be used when initializing structures.
+ */
+
+#if __BYTE_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
 
 extern struct sdb_usb_descs {
     struct usb_functionfs_descs_head header;
index b35ebae16fb86fb7210ed676cbd14af5c1311508..d16a43765e2dafc23f3743b96eb25f46a359036c 100644 (file)
--- a/src/sdb.c
+++ b/src/sdb.c
@@ -1208,7 +1208,7 @@ static void sdb_cleanup(void)
 void start_device_log(void)
 {
     int fd;
-    char    path[PATH_MAX] = {0, };
+    char    path[2*PATH_MAX] = {0, };
     char    path_folder[PATH_MAX] = {0, };
     char    path_file[PATH_MAX] = {0, };
     struct tm now;
index eab7712a4b9747bec68844f9bd15b0d05d7595f3..7601969b8ee1b6738280354a96ecb16934075f56 100644 (file)
@@ -442,7 +442,7 @@ static int send_msg_to_localhost_from_guest(const char *host_ip, int local_port,
 // send the "emulator" request to sdbserver
 static void* notify_sdbd_startup_thread(void* ptr) {
     char                 buffer[512];
-    char                 request[512];
+    char                 request[500];
 
     SdbdCommandlineArgs *sdbd_args = &sdbd_commandline_args; // alias