Fixed rails debug string warnings.
authorakallabeth <akallabeth@posteo.net>
Mon, 18 May 2020 05:54:48 +0000 (07:54 +0200)
committerakallabeth <akallabeth@posteo.net>
Mon, 18 May 2020 15:10:01 +0000 (17:10 +0200)
(cherry picked from commit e58ea30305e8754ada82018c4f2042ec1b72337c)

channels/rail/client/rail_orders.c
channels/rail/rail_common.c
channels/rail/rail_common.h
channels/rail/server/rail_main.c

index 86a3456..c394a59 100644 (file)
@@ -49,8 +49,7 @@ UINT rail_send_pdu(railPlugin* rail, wStream* s, UINT16 orderType)
        rail_write_pdu_header(s, orderType, orderLength);
        Stream_SetPosition(s, orderLength);
        WLog_Print(rail->log, WLOG_DEBUG, "Sending %s PDU, length: %" PRIu16 "",
-                  RAIL_ORDER_TYPE_STRINGS[((orderType & 0xF0) >> 3) + (orderType & 0x0F)],
-                  orderLength);
+                  rail_get_order_type_string(orderType), orderLength);
        return rail_send_channel_data(rail, s);
 }
 
@@ -926,8 +925,7 @@ UINT rail_order_recv(railPlugin* rail, wStream* s)
        }
 
        WLog_Print(rail->log, WLOG_DEBUG, "Received %s PDU, length:%" PRIu16 "",
-                  RAIL_ORDER_TYPE_STRINGS[((orderType & 0xF0) >> 3) + (orderType & 0x0F)],
-                  orderLength);
+                  rail_get_order_type_string(orderType), orderLength);
 
        switch (orderType)
        {
index 4e1a81d..902a738 100644 (file)
 
 #define TAG CHANNELS_TAG("rail.common")
 
-const char* const RAIL_ORDER_TYPE_STRINGS[] = { "",
-                                                   "Execute",
-                                                   "Activate",
-                                                   "System Parameters Update",
-                                                   "System Command",
-                                                   "Handshake",
-                                                   "Notify Event",
-                                                   "",
-                                                   "Window Move",
-                                                   "Local Move/Size",
-                                                   "Min Max Info",
-                                                   "Client Status",
-                                                   "System Menu",
-                                                   "Language Bar Info",
-                                                   "Get Application ID Request",
-                                                   "Get Application ID Response",
-                                                   "Execute Result",
-                                                   "",
-                                                   "",
-                                                   "",
-                                                   "",
-                                                   "",
-                                                   "" };
+static const char* const RAIL_ORDER_TYPE_STRINGS[] = { "",
+                                                          "Execute",
+                                                          "Activate",
+                                                          "System Parameters Update",
+                                                          "System Command",
+                                                          "Handshake",
+                                                          "Notify Event",
+                                                          "",
+                                                          "Window Move",
+                                                          "Local Move/Size",
+                                                          "Min Max Info",
+                                                          "Client Status",
+                                                          "System Menu",
+                                                          "Language Bar Info",
+                                                          "Get Application ID Request",
+                                                          "Get Application ID Response",
+                                                          "Execute Result",
+                                                          "",
+                                                          "",
+                                                          "",
+                                                          "",
+                                                          "",
+                                                          "" };
+
+const char* rail_get_order_type_string(BYTE orderType)
+{
+       return RAIL_ORDER_TYPE_STRINGS[((orderType & 0xF0) >> 3) + (orderType & 0x0F)];
+}
 
 /**
  * Function description
index aa83b8a..6d411eb 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <freerdp/rail.h>
 
-extern const char* const RAIL_ORDER_TYPE_STRINGS[];
+const char* rail_get_order_type_string(BYTE orderType);
 
 #define RAIL_PDU_HEADER_LENGTH 4
 
index 385b0dd..18a7072 100644 (file)
@@ -71,8 +71,8 @@ UINT rail_send_pdu(RailServerContext* context, wStream* s, UINT16 orderType)
        Stream_SetPosition(s, 0);
        rail_write_pdu_header(s, orderType, orderLength);
        Stream_SetPosition(s, orderLength);
-       WLog_DBG(TAG, "Sending %s PDU, length: %" PRIu16 "",
-                RAIL_ORDER_TYPE_STRINGS[((orderType & 0xF0) >> 3) + (orderType & 0x0F)], orderLength);
+       WLog_DBG(TAG, "Sending %s PDU, length: %" PRIu16 "", rail_get_order_type_string(orderType),
+                orderLength);
        return rail_send(context, s, orderLength);
 }
 
@@ -1573,8 +1573,8 @@ UINT rail_server_handle_messages(RailServerContext* context)
                return ERROR_INTERNAL_ERROR;
        }
 
-       WLog_DBG(TAG, "Received %s PDU, length:%" PRIu16 "",
-                RAIL_ORDER_TYPE_STRINGS[((orderType & 0xF0) >> 3) + (orderType & 0x0F)], orderLength);
+       WLog_DBG(TAG, "Received %s PDU, length:%" PRIu16 "", rail_get_order_type_string(orderType),
+                orderLength);
 
        switch (orderType)
        {