From aaa89ad4e6b5484b246ec9ecb7d93248e1fa74cd Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Tue, 21 Jun 2016 16:30:17 -0700 Subject: [PATCH] Use const unsigned for hex arrays Some constants are too big for the signed type. --- rdp/rdp_rdp.c | 10 +++++----- sesman/chansrv/chansrv.c | 2 +- sesman/chansrv/rail.c | 4 ++-- xrdp/xrdp_bitmap.c | 2 +- xrdpapi/xrdpapi.c | 6 ++++-- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/rdp/rdp_rdp.c b/rdp/rdp_rdp.c index d5c8e27f..cede7b02 100644 --- a/rdp/rdp_rdp.c +++ b/rdp/rdp_rdp.c @@ -312,7 +312,7 @@ rdp_rdp_out_colcache_caps(struct rdp_rdp *self, struct stream *s) return 0; } -static char caps_0x0d[] = +static const unsigned char caps_0x0d[] = { 0x01, 0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -327,11 +327,11 @@ static char caps_0x0d[] = 0x00, 0x00, 0x00, 0x00 }; -static char caps_0x0c[] = { 0x01, 0x00, 0x00, 0x00 }; +static const unsigned char caps_0x0c[] = { 0x01, 0x00, 0x00, 0x00 }; -static char caps_0x0e[] = { 0x01, 0x00, 0x00, 0x00 }; +static const unsigned char caps_0x0e[] = { 0x01, 0x00, 0x00, 0x00 }; -static char caps_0x10[] = +static const unsigned char caps_0x10[] = { 0xFE, 0x00, 0x04, 0x00, 0xFE, 0x00, 0x04, 0x00, 0xFE, 0x00, 0x08, 0x00, 0xFE, 0x00, 0x08, 0x00, @@ -345,7 +345,7 @@ static char caps_0x10[] = /* Output unknown capability sets */ static int APP_CC rdp_rdp_out_unknown_caps(struct rdp_rdp *self, struct stream *s, int id, - int length, char *caps) + int length, const unsigned char *caps) { out_uint16_le(s, id); out_uint16_le(s, length); diff --git a/sesman/chansrv/chansrv.c b/sesman/chansrv/chansrv.c index 95224e9c..c1f41499 100644 --- a/sesman/chansrv/chansrv.c +++ b/sesman/chansrv/chansrv.c @@ -55,7 +55,7 @@ static tbus g_thread_done_event = 0; static int g_use_unix_socket = 0; -static char g_xrdpapi_magic[12] = +static const unsigned char g_xrdpapi_magic[12] = { 0x78, 0x32, 0x10, 0x67, 0x00, 0x92, 0x30, 0x56, 0xff, 0xd8, 0xa9, 0x1f }; int g_display_num = 0; diff --git a/sesman/chansrv/rail.c b/sesman/chansrv/rail.c index cad16471..8a23973a 100644 --- a/sesman/chansrv/rail.c +++ b/sesman/chansrv/rail.c @@ -1148,8 +1148,8 @@ rail_data_in(struct stream *s, int chan_id, int chan_flags, int length, return 0; } -static int g_crc_seed = 0xffffffff; -static int g_crc_table[256] = +static const unsigned int g_crc_seed = 0xffffffff; +static const unsigned int g_crc_table[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, diff --git a/xrdp/xrdp_bitmap.c b/xrdp/xrdp_bitmap.c index 6a062d51..e99e2bfe 100644 --- a/xrdp/xrdp_bitmap.c +++ b/xrdp/xrdp_bitmap.c @@ -38,7 +38,7 @@ while (0) -static const int g_crc_table[256] = +static const unsigned int g_crc_table[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, diff --git a/xrdpapi/xrdpapi.c b/xrdpapi/xrdpapi.c index baa1187a..ac303534 100644 --- a/xrdpapi/xrdpapi.c +++ b/xrdpapi/xrdpapi.c @@ -53,8 +53,10 @@ static int send_init(struct wts_obj *wts); static int can_send(int sck, int millis); static int can_recv(int sck, int millis); -static char g_xrdpapi_magic[12] = -{ 0x78, 0x32, 0x10, 0x67, 0x00, 0x92, 0x30, 0x56, 0xff, 0xd8, 0xa9, 0x1f }; +static const unsigned char g_xrdpapi_magic[12] = +{ + 0x78, 0x32, 0x10, 0x67, 0x00, 0x92, 0x30, 0x56, 0xff, 0xd8, 0xa9, 0x1f +}; /* * Opens a handle to the server end of a specified virtual channel - this