From aeeb3d2c2e26677758a64db496c86020f99d2f1a Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Tue, 21 Jun 2016 16:30:17 -0700 Subject: [PATCH] Fix warnings detected by -Wwrite-strings --- common/os_calls.c | 10 +++++----- common/os_calls.h | 6 +++--- common/ssl_calls.c | 4 ++-- common/ssl_calls.h | 2 +- genkeymap/genkeymap.c | 5 ++++- keygen/keygen.c | 2 +- libxrdp/libxrdp.c | 2 +- libxrdp/libxrdpinc.h | 2 +- mc/mc.c | 2 +- mc/mc.h | 4 ++-- neutrinordp/xrdp-neutrinordp.c | 2 +- neutrinordp/xrdp-neutrinordp.h | 4 ++-- rdp/rdp.c | 2 +- rdp/rdp.h | 4 ++-- sesman/chansrv/clipboard.c | 2 +- sesman/chansrv/clipboard_common.h | 3 ++- sesman/libscp/libscp_session.c | 18 +++++++++--------- sesman/libscp/libscp_session.h | 18 +++++++++--------- sesman/libscp/libscp_v1s.c | 7 ++++--- sesman/libscp/libscp_v1s.h | 7 ++++--- sesman/libscp/libscp_v1s_mng.c | 2 +- sesman/libscp/libscp_v1s_mng.h | 2 +- sesman/scp_v1.c | 4 ++-- sesman/scp_v1_mng.c | 4 ++-- vnc/vnc.c | 2 +- vnc/vnc.h | 6 +++--- xrdp/xrdp.h | 6 +++--- xrdp/xrdp_mm.c | 7 ++++--- xrdp/xrdp_painter.c | 4 ++-- xrdp/xrdp_types.h | 4 ++-- xrdp/xrdp_wm.c | 2 +- xup/xup.c | 2 +- xup/xup.h | 6 +++--- 33 files changed, 82 insertions(+), 75 deletions(-) diff --git a/common/os_calls.c b/common/os_calls.c index 9a409591..7d932a10 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -1810,7 +1810,7 @@ g_file_read(int fd, char *ptr, int len) /*****************************************************************************/ /* write to file, returns the number of bytes written or -1 on error */ int APP_CC -g_file_write(int fd, char *ptr, int len) +g_file_write(int fd, const char *ptr, int len) { #if defined(_WIN32) @@ -1947,7 +1947,7 @@ g_get_current_dir(char *dirname, int maxlen) /*****************************************************************************/ /* returns error, zero on success and -1 on failure */ int APP_CC -g_set_current_dir(char *dirname) +g_set_current_dir(const char *dirname) { #if defined(_WIN32) @@ -2116,7 +2116,7 @@ g_strlen(const char *text) /*****************************************************************************/ /* locates char in text */ -char* APP_CC +const char *APP_CC g_strchr(const char* text, int c) { if (text == NULL) @@ -2395,7 +2395,7 @@ g_htoi(char *str) int APP_CC g_pos(const char *str, const char *to_find) { - char *pp; + const char *pp; pp = strstr(str, to_find); @@ -3263,7 +3263,7 @@ g_save_to_bmp(const char* filename, char* data, int stride_bytes, data -= stride_bytes; if ((depth == 24) && (bits_per_pixel == 32)) { - line = malloc(file_stride_bytes); + line = (char *) malloc(file_stride_bytes); memset(line, 0, file_stride_bytes); for (index = 0; index < height; index++) { diff --git a/common/os_calls.h b/common/os_calls.h index 0a58d4a8..6a7cd093 100644 --- a/common/os_calls.h +++ b/common/os_calls.h @@ -104,14 +104,14 @@ int APP_CC g_file_open_ex(const char *file_name, int aread, int awrite, int acreate, int atrunc); int APP_CC g_file_close(int fd); int APP_CC g_file_read(int fd, char* ptr, int len); -int APP_CC g_file_write(int fd, char* ptr, int len); +int APP_CC g_file_write(int fd, const char *ptr, int len); int APP_CC g_file_seek(int fd, int offset); int APP_CC g_file_lock(int fd, int start, int len); int APP_CC g_chmod_hex(const char* filename, int flags); int APP_CC g_chown(const char* name, int uid, int gid); int APP_CC g_mkdir(const char* dirname); char* APP_CC g_get_current_dir(char* dirname, int maxlen); -int APP_CC g_set_current_dir(char* dirname); +int APP_CC g_set_current_dir(const char *dirname); int APP_CC g_file_exist(const char* filename); int APP_CC g_directory_exist(const char* dirname); int APP_CC g_create_dir(const char* dirname); @@ -120,7 +120,7 @@ int APP_CC g_remove_dir(const char* dirname); int APP_CC g_file_delete(const char* filename); int APP_CC g_file_get_size(const char* filename); int APP_CC g_strlen(const char* text); -char* APP_CC g_strchr(const char* text, int c); +const char *APP_CC g_strchr(const char *text, int c); char* APP_CC g_strcpy(char* dest, const char* src); char* APP_CC g_strncpy(char* dest, const char* src, int len); char* APP_CC g_strcat(char* dest, const char* src); diff --git a/common/ssl_calls.c b/common/ssl_calls.c index b7eb6131..3d9e1c2e 100644 --- a/common/ssl_calls.c +++ b/common/ssl_calls.c @@ -111,7 +111,7 @@ ssl_sha1_clear(void *sha1_info) /*****************************************************************************/ void APP_CC -ssl_sha1_transform(void *sha1_info, char *data, int len) +ssl_sha1_transform(void *sha1_info, const char *data, int len) { SHA1_Update((SHA_CTX *)sha1_info, data, len); } @@ -560,7 +560,7 @@ ssl_tls_create(struct trans *trans, const char *key, const char *cert) /*****************************************************************************/ int APP_CC -ssl_tls_print_error(char *func, SSL *connection, int value) +ssl_tls_print_error(const char *func, SSL *connection, int value) { switch (SSL_get_error(connection, value)) { diff --git a/common/ssl_calls.h b/common/ssl_calls.h index 6cfe73a3..c470e63a 100644 --- a/common/ssl_calls.h +++ b/common/ssl_calls.h @@ -41,7 +41,7 @@ ssl_sha1_info_delete(void* sha1_info); void APP_CC ssl_sha1_clear(void* sha1_info); void APP_CC -ssl_sha1_transform(void* sha1_info, char* data, int len); +ssl_sha1_transform(void* sha1_info, const char *data, int len); void APP_CC ssl_sha1_complete(void* sha1_info, char* data); void* APP_CC diff --git a/genkeymap/genkeymap.c b/genkeymap/genkeymap.c index a92d45f9..d0907f32 100644 --- a/genkeymap/genkeymap.c +++ b/genkeymap/genkeymap.c @@ -48,7 +48,10 @@ int main(int argc, char **argv) char text[256]; char *displayname = NULL; char *outfname; - char *sections[8] = {"noshift", "shift", "altgr", "shiftaltgr", "capslock", "capslockaltgr", "shiftcapslock", "shiftcapslockaltgr"}; + const char *sections[8] = { + "noshift", "shift", "altgr", "shiftaltgr", + "capslock", "capslockaltgr", "shiftcapslock", "shiftcapslockaltgr" + }; int states[8] = {0, 1, 0x80, 0x81, 2, 0x82, 3, 0x83}; int i; int idx; diff --git a/keygen/keygen.c b/keygen/keygen.c index bafcaf1c..12970100 100644 --- a/keygen/keygen.c +++ b/keygen/keygen.c @@ -282,7 +282,7 @@ sign_key(char *e_data, int e_len, char *n_data, int n_len, /*****************************************************************************/ static int APP_CC -write_out_line(int fd, char *name, char *data, int len) +write_out_line(int fd, const char *name, char *data, int len) { int max; int error; diff --git a/libxrdp/libxrdp.c b/libxrdp/libxrdp.c index daa7ca75..c3763bf5 100644 --- a/libxrdp/libxrdp.c +++ b/libxrdp/libxrdp.c @@ -1077,7 +1077,7 @@ libxrdp_query_channel(struct xrdp_session *session, int index, /* returns a zero based index of the channel, -1 if error or it doesn't exist */ int EXPORT_CC -libxrdp_get_channel_id(struct xrdp_session *session, char *name) +libxrdp_get_channel_id(struct xrdp_session *session, const char *name) { int index = 0; int count = 0; diff --git a/libxrdp/libxrdpinc.h b/libxrdp/libxrdpinc.h index b23fd340..275b674a 100644 --- a/libxrdp/libxrdpinc.h +++ b/libxrdp/libxrdpinc.h @@ -189,7 +189,7 @@ int DEFAULT_CC libxrdp_query_channel(struct xrdp_session *session, int index, char *channel_name, int *channel_flags); int DEFAULT_CC -libxrdp_get_channel_id(struct xrdp_session *session, char *name); +libxrdp_get_channel_id(struct xrdp_session *session, const char *name); int DEFAULT_CC libxrdp_send_to_channel(struct xrdp_session *session, int channel_id, char *data, int data_len, diff --git a/mc/mc.c b/mc/mc.c index c1ec958c..3bcf16f1 100644 --- a/mc/mc.c +++ b/mc/mc.c @@ -75,7 +75,7 @@ lib_mod_end(struct mod *mod) /******************************************************************************/ /* return error */ int DEFAULT_CC -lib_mod_set_param(struct mod *mod, char *name, char *value) +lib_mod_set_param(struct mod *mod, const char *name, char *value) { return 0; } diff --git a/mc/mc.h b/mc/mc.h index a28ade47..65297942 100644 --- a/mc/mc.h +++ b/mc/mc.h @@ -37,7 +37,7 @@ struct mod long param3, long param4); int (*mod_signal)(struct mod* v); int (*mod_end)(struct mod* v); - int (*mod_set_param)(struct mod* v, char* name, char* value); + int (*mod_set_param)(struct mod* v, const char *name, char* value); int (*mod_session_change)(struct mod* v, int, int); int (*mod_get_wait_objs)(struct mod* v, tbus* read_objs, int* rcount, tbus* write_objs, int* wcount, int* timeout); @@ -80,7 +80,7 @@ struct mod int (*server_query_channel)(struct mod* v, int index, char* channel_name, int* channel_flags); - int (*server_get_channel_id)(struct mod* v, char* name); + int (*server_get_channel_id)(struct mod* v, const char *name); int (*server_send_to_channel)(struct mod* v, int channel_id, char* data, int data_len, int total_data_len, int flags); diff --git a/neutrinordp/xrdp-neutrinordp.c b/neutrinordp/xrdp-neutrinordp.c index b463f8a8..8290b049 100644 --- a/neutrinordp/xrdp-neutrinordp.c +++ b/neutrinordp/xrdp-neutrinordp.c @@ -428,7 +428,7 @@ lxrdp_end(struct mod *mod) /******************************************************************************/ /* return error */ static int DEFAULT_CC -lxrdp_set_param(struct mod *mod, char *name, char *value) +lxrdp_set_param(struct mod *mod, const char *name, char *value) { rdpSettings *settings; diff --git a/neutrinordp/xrdp-neutrinordp.h b/neutrinordp/xrdp-neutrinordp.h index 4e0f5d10..79bb460d 100644 --- a/neutrinordp/xrdp-neutrinordp.h +++ b/neutrinordp/xrdp-neutrinordp.h @@ -71,7 +71,7 @@ struct mod long param3, long param4); int (*mod_signal)(struct mod *v); int (*mod_end)(struct mod *v); - int (*mod_set_param)(struct mod *v, char *name, char *value); + int (*mod_set_param)(struct mod *v, const char *name, char *value); int (*mod_session_change)(struct mod *v, int, int); int (*mod_get_wait_objs)(struct mod *v, tbus *read_objs, int *rcount, tbus *write_objs, int *wcount, int *timeout); @@ -114,7 +114,7 @@ struct mod int (*server_query_channel)(struct mod *v, int index, char *channel_name, int *channel_flags); - int (*server_get_channel_id)(struct mod *v, char *name); + int (*server_get_channel_id)(struct mod *v, const char *name); int (*server_send_to_channel)(struct mod *v, int channel_id, char *data, int data_len, int total_data_len, int flags); diff --git a/rdp/rdp.c b/rdp/rdp.c index abbbab73..ffced90b 100644 --- a/rdp/rdp.c +++ b/rdp/rdp.c @@ -242,7 +242,7 @@ lib_mod_end(struct mod *mod) /******************************************************************************/ /* return error */ int DEFAULT_CC -lib_mod_set_param(struct mod *mod, char *name, char *value) +lib_mod_set_param(struct mod *mod, const char *name, char *value) { if (g_strncasecmp(name, "ip", 255) == 0) { diff --git a/rdp/rdp.h b/rdp/rdp.h index da8c1321..ff04fafa 100644 --- a/rdp/rdp.h +++ b/rdp/rdp.h @@ -262,7 +262,7 @@ struct mod long param3, long param4); int (*mod_signal)(struct mod* v); int (*mod_end)(struct mod* v); - int (*mod_set_param)(struct mod* v, char* name, char* value); + int (*mod_set_param)(struct mod* v, const char *name, char* value); int (*mod_session_change)(struct mod* v, int, int); int (*mod_get_wait_objs)(struct mod* v, tbus* read_objs, int* rcount, tbus* write_objs, int* wcount, int* timeout); @@ -305,7 +305,7 @@ struct mod int (*server_query_channel)(struct mod* v, int index, char* channel_name, int* channel_flags); - int (*server_get_channel_id)(struct mod* v, char* name); + int (*server_get_channel_id)(struct mod* v, const char *name); int (*server_send_to_channel)(struct mod* v, int channel_id, char* data, int data_len, int total_data_len, int flags); diff --git a/sesman/chansrv/clipboard.c b/sesman/chansrv/clipboard.c index cf98b5f2..7a9795d6 100644 --- a/sesman/chansrv/clipboard.c +++ b/sesman/chansrv/clipboard.c @@ -582,7 +582,7 @@ clipboard_send_format_ack(void) /*****************************************************************************/ /* returns number of bytes written */ int APP_CC -clipboard_out_unicode(struct stream *s, char *text, int num_chars) +clipboard_out_unicode(struct stream *s, const char *text, int num_chars) { int index; int lnum_chars; diff --git a/sesman/chansrv/clipboard_common.h b/sesman/chansrv/clipboard_common.h index 5a74de66..1944b760 100644 --- a/sesman/chansrv/clipboard_common.h +++ b/sesman/chansrv/clipboard_common.h @@ -127,7 +127,8 @@ struct clip_file_desc /* CLIPRDR_FILEDESCRIPTOR */ char cFileName[256]; }; -int APP_CC clipboard_out_unicode(struct stream *s, char *text, int num_chars); +int APP_CC clipboard_out_unicode(struct stream *s, const char *text, + int num_chars); int APP_CC clipboard_in_unicode(struct stream *s, char *text, int *num_chars); #endif diff --git a/sesman/libscp/libscp_session.c b/sesman/libscp/libscp_session.c index 91f93b54..e6c77058 100644 --- a/sesman/libscp/libscp_session.c +++ b/sesman/libscp/libscp_session.c @@ -164,7 +164,7 @@ scp_session_set_rsr(struct SCP_SESSION *s, tui8 rsr) /*******************************************************************/ int -scp_session_set_locale(struct SCP_SESSION *s, char *str) +scp_session_set_locale(struct SCP_SESSION *s, const char *str) { if (0 == str) { @@ -180,7 +180,7 @@ scp_session_set_locale(struct SCP_SESSION *s, char *str) /*******************************************************************/ int -scp_session_set_username(struct SCP_SESSION *s, char *str) +scp_session_set_username(struct SCP_SESSION *s, const char *str) { if (0 == str) { @@ -206,7 +206,7 @@ scp_session_set_username(struct SCP_SESSION *s, char *str) /*******************************************************************/ int -scp_session_set_password(struct SCP_SESSION *s, char *str) +scp_session_set_password(struct SCP_SESSION *s, const char *str) { if (0 == str) { @@ -232,7 +232,7 @@ scp_session_set_password(struct SCP_SESSION *s, char *str) /*******************************************************************/ int -scp_session_set_domain(struct SCP_SESSION *s, char *str) +scp_session_set_domain(struct SCP_SESSION *s, const char *str) { if (0 == str) { @@ -258,7 +258,7 @@ scp_session_set_domain(struct SCP_SESSION *s, char *str) /*******************************************************************/ int -scp_session_set_program(struct SCP_SESSION *s, char *str) +scp_session_set_program(struct SCP_SESSION *s, const char *str) { if (0 == str) { @@ -284,7 +284,7 @@ scp_session_set_program(struct SCP_SESSION *s, char *str) /*******************************************************************/ int -scp_session_set_directory(struct SCP_SESSION *s, char *str) +scp_session_set_directory(struct SCP_SESSION *s, const char *str) { if (0 == str) { @@ -310,7 +310,7 @@ scp_session_set_directory(struct SCP_SESSION *s, char *str) /*******************************************************************/ int -scp_session_set_client_ip(struct SCP_SESSION *s, char *str) +scp_session_set_client_ip(struct SCP_SESSION *s, const char *str) { if (0 == str) { @@ -336,7 +336,7 @@ scp_session_set_client_ip(struct SCP_SESSION *s, char *str) /*******************************************************************/ int -scp_session_set_hostname(struct SCP_SESSION *s, char *str) +scp_session_set_hostname(struct SCP_SESSION *s, const char *str) { if (0 == str) { @@ -362,7 +362,7 @@ scp_session_set_hostname(struct SCP_SESSION *s, char *str) /*******************************************************************/ int -scp_session_set_errstr(struct SCP_SESSION *s, char *str) +scp_session_set_errstr(struct SCP_SESSION *s, const char *str) { if (0 == str) { diff --git a/sesman/libscp/libscp_session.h b/sesman/libscp/libscp_session.h index 4a9e9d70..51b6d03e 100644 --- a/sesman/libscp/libscp_session.h +++ b/sesman/libscp/libscp_session.h @@ -59,28 +59,28 @@ int scp_session_set_rsr(struct SCP_SESSION* s, tui8 rsr); int -scp_session_set_locale(struct SCP_SESSION* s, char* str); +scp_session_set_locale(struct SCP_SESSION* s, const char *str); int -scp_session_set_username(struct SCP_SESSION* s, char* str); +scp_session_set_username(struct SCP_SESSION* s, const char *str); int -scp_session_set_password(struct SCP_SESSION* s, char* str); +scp_session_set_password(struct SCP_SESSION* s, const char *str); int -scp_session_set_domain(struct SCP_SESSION* s, char* str); +scp_session_set_domain(struct SCP_SESSION* s, const char *str); int -scp_session_set_program(struct SCP_SESSION* s, char* str); +scp_session_set_program(struct SCP_SESSION* s, const char *str); int -scp_session_set_directory(struct SCP_SESSION* s, char* str); +scp_session_set_directory(struct SCP_SESSION* s, const char *str); int -scp_session_set_client_ip(struct SCP_SESSION* s, char* str); +scp_session_set_client_ip(struct SCP_SESSION* s, const char *str); int -scp_session_set_hostname(struct SCP_SESSION* s, char* str); +scp_session_set_hostname(struct SCP_SESSION* s, const char *str); int scp_session_set_addr(struct SCP_SESSION* s, int type, const void* addr); @@ -89,7 +89,7 @@ int scp_session_set_display(struct SCP_SESSION* s, SCP_DISPLAY display); int -scp_session_set_errstr(struct SCP_SESSION* s, char* str); +scp_session_set_errstr(struct SCP_SESSION* s, const char *str); /** * diff --git a/sesman/libscp/libscp_v1s.c b/sesman/libscp/libscp_v1s.c index 6cdf0b00..284c9b52 100644 --- a/sesman/libscp/libscp_v1s.c +++ b/sesman/libscp/libscp_v1s.c @@ -202,7 +202,7 @@ enum SCP_SERVER_STATES_E scp_v1s_accept(struct SCP_CONNECTION *c, struct SCP_SES } enum SCP_SERVER_STATES_E -scp_v1s_deny_connection(struct SCP_CONNECTION *c, char *reason) +scp_v1s_deny_connection(struct SCP_CONNECTION *c, const char *reason) { int rlen; @@ -235,7 +235,8 @@ scp_v1s_deny_connection(struct SCP_CONNECTION *c, char *reason) } enum SCP_SERVER_STATES_E -scp_v1s_request_password(struct SCP_CONNECTION *c, struct SCP_SESSION *s, char *reason) +scp_v1s_request_password(struct SCP_CONNECTION *c, struct SCP_SESSION *s, + const char *reason) { tui8 sz; tui32 version; @@ -392,7 +393,7 @@ scp_v1s_connect_new_session(struct SCP_CONNECTION *c, SCP_DISPLAY d) /* 032 */ enum SCP_SERVER_STATES_E -scp_v1s_connection_error(struct SCP_CONNECTION *c, char *error) +scp_v1s_connection_error(struct SCP_CONNECTION *c, const char *error) { tui16 len; diff --git a/sesman/libscp/libscp_v1s.h b/sesman/libscp/libscp_v1s.h index cc29d70d..69e64038 100644 --- a/sesman/libscp/libscp_v1s.h +++ b/sesman/libscp/libscp_v1s.h @@ -53,10 +53,11 @@ scp_v1s_accept(struct SCP_CONNECTION* c, struct SCP_SESSION** s, int skipVchk); */ /* 002 */ enum SCP_SERVER_STATES_E -scp_v1s_deny_connection(struct SCP_CONNECTION* c, char* reason); +scp_v1s_deny_connection(struct SCP_CONNECTION* c, const char *reason); enum SCP_SERVER_STATES_E -scp_v1s_request_password(struct SCP_CONNECTION* c, struct SCP_SESSION* s, char* reason); +scp_v1s_request_password(struct SCP_CONNECTION* c, struct SCP_SESSION* s, + const char *reason); /* 020 */ enum SCP_SERVER_STATES_E @@ -72,7 +73,7 @@ scp_v1s_connect_new_session(struct SCP_CONNECTION* c, SCP_DISPLAY d); /* 032 */ enum SCP_SERVER_STATES_E -scp_v1s_connection_error(struct SCP_CONNECTION* c, char* error); +scp_v1s_connection_error(struct SCP_CONNECTION* c, const char *error); /* 040 */ enum SCP_SERVER_STATES_E diff --git a/sesman/libscp/libscp_v1s_mng.c b/sesman/libscp/libscp_v1s_mng.c index e48fc86b..d8c5290d 100644 --- a/sesman/libscp/libscp_v1s_mng.c +++ b/sesman/libscp/libscp_v1s_mng.c @@ -138,7 +138,7 @@ scp_v1s_mng_allow_connection(struct SCP_CONNECTION *c, struct SCP_SESSION *s) /* 003 */ enum SCP_SERVER_STATES_E -scp_v1s_mng_deny_connection(struct SCP_CONNECTION *c, char *reason) +scp_v1s_mng_deny_connection(struct SCP_CONNECTION *c, const char *reason) { int rlen; diff --git a/sesman/libscp/libscp_v1s_mng.h b/sesman/libscp/libscp_v1s_mng.h index 867931a5..437a06d2 100644 --- a/sesman/libscp/libscp_v1s_mng.h +++ b/sesman/libscp/libscp_v1s_mng.h @@ -61,7 +61,7 @@ scp_v1s_mng_allow_connection(struct SCP_CONNECTION* c, struct SCP_SESSION* s); */ /* 003 */ enum SCP_SERVER_STATES_E -scp_v1s_mng_deny_connection(struct SCP_CONNECTION* c, char* reason); +scp_v1s_mng_deny_connection(struct SCP_CONNECTION* c, const char *reason); /** * diff --git a/sesman/scp_v1.c b/sesman/scp_v1.c index 92e1dad5..1501606d 100644 --- a/sesman/scp_v1.c +++ b/sesman/scp_v1.c @@ -31,7 +31,7 @@ extern struct config_sesman *g_cfg; /* in sesman.c */ -static void parseCommonStates(enum SCP_SERVER_STATES_E e, char *f); +static void parseCommonStates(enum SCP_SERVER_STATES_E e, const char *f); /******************************************************************************/ void DEFAULT_CC @@ -209,7 +209,7 @@ scp_v1_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s) g_free(slist); } -static void parseCommonStates(enum SCP_SERVER_STATES_E e, char *f) +static void parseCommonStates(enum SCP_SERVER_STATES_E e, const char *f) { switch (e) { diff --git a/sesman/scp_v1_mng.c b/sesman/scp_v1_mng.c index 2624644a..29496466 100644 --- a/sesman/scp_v1_mng.c +++ b/sesman/scp_v1_mng.c @@ -30,7 +30,7 @@ extern struct config_sesman *g_cfg; /* in sesman.c */ -static void parseCommonStates(enum SCP_SERVER_STATES_E e, char *f); +static void parseCommonStates(enum SCP_SERVER_STATES_E e, const char *f); /******************************************************************************/ void DEFAULT_CC @@ -109,7 +109,7 @@ scp_v1_mng_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s) auth_end(data); } -static void parseCommonStates(enum SCP_SERVER_STATES_E e, char *f) +static void parseCommonStates(enum SCP_SERVER_STATES_E e, const char *f) { switch (e) { diff --git a/vnc/vnc.c b/vnc/vnc.c index 604fd571..a72c8dd1 100644 --- a/vnc/vnc.c +++ b/vnc/vnc.c @@ -1396,7 +1396,7 @@ lib_mod_end(struct vnc *v) /******************************************************************************/ int DEFAULT_CC -lib_mod_set_param(struct vnc *v, char *name, char *value) +lib_mod_set_param(struct vnc *v, const char *name, char *value) { if (g_strcasecmp(name, "username") == 0) { diff --git a/vnc/vnc.h b/vnc/vnc.h index 6d1ddb8f..34f408ca 100644 --- a/vnc/vnc.h +++ b/vnc/vnc.h @@ -37,7 +37,7 @@ struct vnc long param3, long param4); int (*mod_signal)(struct vnc* v); int (*mod_end)(struct vnc* v); - int (*mod_set_param)(struct vnc* v, char* name, char* value); + int (*mod_set_param)(struct vnc* v, const char *name, char* value); int (*mod_session_change)(struct vnc* v, int, int); int (*mod_get_wait_objs)(struct vnc* v, tbus* read_objs, int* rcount, tbus* write_objs, int* wcount, int* timeout); @@ -54,7 +54,7 @@ struct vnc char* data, int width, int height, int srcx, int srcy); int (*server_set_cursor)(struct vnc* v, int x, int y, char* data, char* mask); int (*server_palette)(struct vnc* v, int* palette); - int (*server_msg)(struct vnc* v, char* msg, int code); + int (*server_msg)(struct vnc* v, const char *msg, int code); int (*server_is_term)(struct vnc* v); int (*server_set_clip)(struct vnc* v, int x, int y, int cx, int cy); int (*server_reset_clip)(struct vnc* v); @@ -80,7 +80,7 @@ struct vnc int (*server_query_channel)(struct vnc* v, int index, char* channel_name, int* channel_flags); - int (*server_get_channel_id)(struct vnc* v, char* name); + int (*server_get_channel_id)(struct vnc* v, const char *name); int (*server_send_to_channel)(struct vnc* v, int channel_id, char* data, int data_len, int total_data_len, int flags); diff --git a/xrdp/xrdp.h b/xrdp/xrdp.h index 1c7e9cad..15013942 100644 --- a/xrdp/xrdp.h +++ b/xrdp/xrdp.h @@ -266,9 +266,9 @@ xrdp_painter_draw_bitmap(struct xrdp_painter* self, struct xrdp_bitmap* to_draw, int x, int y, int cx, int cy); int APP_CC -xrdp_painter_text_width(struct xrdp_painter* self, char* text); +xrdp_painter_text_width(struct xrdp_painter* self, const char *text); int APP_CC -xrdp_painter_text_height(struct xrdp_painter* self, char* text); +xrdp_painter_text_height(struct xrdp_painter* self, const char *text); int APP_CC xrdp_painter_draw_text(struct xrdp_painter* self, struct xrdp_bitmap* bitmap, @@ -466,7 +466,7 @@ int DEFAULT_CC server_query_channel(struct xrdp_mod* mod, int index, char* channel_name, int* channel_flags); int DEFAULT_CC -server_get_channel_id(struct xrdp_mod* mod, char* name); +server_get_channel_id(struct xrdp_mod* mod, const char *name); int DEFAULT_CC server_send_to_channel(struct xrdp_mod* mod, int channel_id, char* data, int data_len, diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c index 7e6c6cd7..dfc04152 100644 --- a/xrdp/xrdp_mm.c +++ b/xrdp/xrdp_mm.c @@ -291,7 +291,8 @@ xrdp_mm_send_login(struct xrdp_mm *self) then it copies the corresponding login_values item into 'dest' 'dest' must be at least 'dest_len' + 1 bytes in size */ static int APP_CC -xrdp_mm_get_value(struct xrdp_mm *self, char *aname, char *dest, int dest_len) +xrdp_mm_get_value(struct xrdp_mm *self, const char *aname, char *dest, + int dest_len) { char *name; char *value; @@ -1111,7 +1112,7 @@ xrdp_mm_chan_send_init(struct xrdp_mm *self) /*****************************************************************************/ /* connect to chansrv */ static int APP_CC -xrdp_mm_connect_chansrv(struct xrdp_mm *self, char *ip, char *port) +xrdp_mm_connect_chansrv(struct xrdp_mm *self, const char *ip, const char *port) { int index; @@ -3145,7 +3146,7 @@ server_query_channel(struct xrdp_mod *mod, int index, char *channel_name, /*****************************************************************************/ /* returns -1 on error */ int DEFAULT_CC -server_get_channel_id(struct xrdp_mod *mod, char *name) +server_get_channel_id(struct xrdp_mod *mod, const char *name) { struct xrdp_wm *wm; diff --git a/xrdp/xrdp_painter.c b/xrdp/xrdp_painter.c index 4b36b1ea..f5605717 100644 --- a/xrdp/xrdp_painter.c +++ b/xrdp/xrdp_painter.c @@ -262,7 +262,7 @@ xrdp_painter_rop(int rop, int src, int dst) /*****************************************************************************/ int APP_CC -xrdp_painter_text_width(struct xrdp_painter *self, char *text) +xrdp_painter_text_width(struct xrdp_painter *self, const char *text) { int index; int rv; @@ -299,7 +299,7 @@ xrdp_painter_text_width(struct xrdp_painter *self, char *text) /*****************************************************************************/ int APP_CC -xrdp_painter_text_height(struct xrdp_painter *self, char *text) +xrdp_painter_text_height(struct xrdp_painter *self, const char *text) { int index; int rv; diff --git a/xrdp/xrdp_types.h b/xrdp/xrdp_types.h index d6c7ccb1..e462a881 100644 --- a/xrdp/xrdp_types.h +++ b/xrdp/xrdp_types.h @@ -42,7 +42,7 @@ struct xrdp_mod long param3, long param4); int (*mod_signal)(struct xrdp_mod* v); int (*mod_end)(struct xrdp_mod* v); - int (*mod_set_param)(struct xrdp_mod* v, char* name, char* value); + int (*mod_set_param)(struct xrdp_mod* v, const char *name, char* value); int (*mod_session_change)(struct xrdp_mod* v, int, int); int (*mod_get_wait_objs)(struct xrdp_mod* v, tbus* read_objs, int* rcount, tbus* write_objs, int* wcount, int* timeout); @@ -88,7 +88,7 @@ struct xrdp_mod int (*server_query_channel)(struct xrdp_mod* v, int index, char* channel_name, int* channel_flags); - int (*server_get_channel_id)(struct xrdp_mod* v, char* name); + int (*server_get_channel_id)(struct xrdp_mod* v, const char *name); int (*server_send_to_channel)(struct xrdp_mod* v, int channel_id, char* data, int data_len, int total_data_len, int flags); diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c index 5fec41a4..3bb326f3 100644 --- a/xrdp/xrdp_wm.c +++ b/xrdp/xrdp_wm.c @@ -548,7 +548,7 @@ xrdp_wm_init(struct xrdp_wm *self) struct list *names; struct list *values; char *q; - char *r; + const char *r; char param[256]; char section_name[256]; char cfg_file[256]; diff --git a/xup/xup.c b/xup/xup.c index b4a5df1e..ef424b40 100644 --- a/xup/xup.c +++ b/xup/xup.c @@ -1479,7 +1479,7 @@ lib_mod_end(struct mod *mod) /******************************************************************************/ /* return error */ int DEFAULT_CC -lib_mod_set_param(struct mod *mod, char *name, char *value) +lib_mod_set_param(struct mod *mod, const char *name, char *value) { if (g_strcasecmp(name, "username") == 0) { diff --git a/xup/xup.h b/xup/xup.h index 85aff9fe..8c91996d 100644 --- a/xup/xup.h +++ b/xup/xup.h @@ -39,7 +39,7 @@ struct mod tbus param3, tbus param4); int (*mod_signal)(struct mod* v); int (*mod_end)(struct mod* v); - int (*mod_set_param)(struct mod* v, char* name, char* value); + int (*mod_set_param)(struct mod* v, const char *name, char* value); int (*mod_session_change)(struct mod* v, int, int); int (*mod_get_wait_objs)(struct mod* v, tbus* read_objs, int* rcount, tbus* write_objs, int* wcount, int* timeout); @@ -58,7 +58,7 @@ struct mod int srcx, int srcy); int (*server_set_cursor)(struct mod* v, int x, int y, char* data, char* mask); int (*server_palette)(struct mod* v, int* palette); - int (*server_msg)(struct mod* v, char* msg, int code); + int (*server_msg)(struct mod* v, const char *msg, int code); int (*server_is_term)(struct mod* v); int (*server_set_clip)(struct mod* v, int x, int y, int cx, int cy); int (*server_reset_clip)(struct mod* v); @@ -84,7 +84,7 @@ struct mod int (*server_query_channel)(struct mod* v, int index, char* channel_name, int* channel_flags); - int (*server_get_channel_id)(struct mod* v, char* name); + int (*server_get_channel_id)(struct mod* v, const char *name); int (*server_send_to_channel)(struct mod* v, int channel_id, char* data, int data_len, int total_data_len, int flags);