From 55e12a09d8297c62302a9a93414444f00dc8ec1c Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Thu, 21 Apr 2016 21:20:12 -0700 Subject: [PATCH 1/6] Include config_ac.h from common/os_calls.h to enable all format warnings --- common/os_calls.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/os_calls.h b/common/os_calls.h index 5f107f47..2ed2cb81 100644 --- a/common/os_calls.h +++ b/common/os_calls.h @@ -21,6 +21,10 @@ #if !defined(OS_CALLS_H) #define OS_CALLS_H +#if defined(HAVE_CONFIG_H) +#include "config_ac.h" +#endif + #ifndef NULL #define NULL 0 #endif From bd0b1acf794b2552b13bd4185c8eef91b2d9784c Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Sun, 10 Apr 2016 13:49:00 -0700 Subject: [PATCH 2/6] Fix format warnings caused by g_writeln("") --- keygen/keygen.c | 16 ++++++++-------- tests/tcp_proxy/main.c | 2 +- xrdp/xrdpwin.c | 24 ++++++++++++------------ 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/keygen/keygen.c b/keygen/keygen.c index 1e2dd25d..bafcaf1c 100644 --- a/keygen/keygen.c +++ b/keygen/keygen.c @@ -195,11 +195,11 @@ static tui8 g_testkey2048[376] = /* 2048 bit test key */ static int APP_CC out_params(void) { - g_writeln(""); + g_writeln("%s", ""); g_writeln("xrdp rsa key gen utility examples"); g_writeln(" xrdp-keygen xrdp ['path and file name' | auto] [512 or 2048]"); g_writeln(" xrdp-keygen test"); - g_writeln(""); + g_writeln("%s", ""); return 0; } @@ -351,7 +351,7 @@ save_all(char *e_data, int e_len, char *n_data, int n_len, } g_writeln("saving to %s", filename); - g_writeln(""); + g_writeln("%s", ""); if (g_file_exist(filename)) { @@ -411,9 +411,9 @@ key_gen(const char *path_and_file_name) d_len = n_len; sign_len = 64; error = 0; - g_writeln(""); + g_writeln("%s", ""); g_writeln("Generating %d bit rsa key...", g_key_size_bits); - g_writeln(""); + g_writeln("%s", ""); if (error == 0) { @@ -428,7 +428,7 @@ key_gen(const char *path_and_file_name) if (error == 0) { g_writeln("ssl_gen_key_xrdp1 ok"); - g_writeln(""); + g_writeln("%s", ""); error = sign_key(e_data, e_len, n_data, n_len, sign_data, sign_len); if (error != 0) @@ -588,10 +588,10 @@ main(int argc, char **argv) } else if (g_strcasecmp(argv[1], "test") == 0) { - g_writeln(""); + g_writeln("%s", ""); g_writeln("testing 512 bit key"); key_test512(); - g_writeln(""); + g_writeln("%s", ""); g_writeln("testing 2048 bit key"); key_test2048(); return 0; diff --git a/tests/tcp_proxy/main.c b/tests/tcp_proxy/main.c index 26c974cd..3a62c98c 100644 --- a/tests/tcp_proxy/main.c +++ b/tests/tcp_proxy/main.c @@ -109,7 +109,7 @@ g_hexdump(char *p, int len) g_printf("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.'); } - g_writeln(""); + g_writeln("%s", ""); offset += thisline; line += thisline; } diff --git a/xrdp/xrdpwin.c b/xrdp/xrdpwin.c index 95669fa6..224efc0c 100644 --- a/xrdp/xrdpwin.c +++ b/xrdp/xrdpwin.c @@ -344,16 +344,16 @@ main(int argc, char **argv) g_strncasecmp(argv[1], "--help", 255) == 0 || g_strncasecmp(argv[1], "-h", 255) == 0) { - g_writeln(""); + g_writeln("%s", ""); g_writeln("xrdp: A Remote Desktop Protocol server."); g_writeln("Copyright (C) Jay Sorg 2004-2011"); g_writeln("See http://xrdp.sourceforge.net for more information."); - g_writeln(""); + g_writeln("%s", ""); g_writeln("Usage: xrdp [options]"); g_writeln(" -h: show help"); g_writeln(" -install: install service"); g_writeln(" -remove: remove service"); - g_writeln(""); + g_writeln("%s", ""); g_exit(0); } else if (g_strncasecmp(argv[1], "-install", 255) == 0 || @@ -423,7 +423,7 @@ main(int argc, char **argv) { g_writeln("Unknown Parameter"); g_writeln("xrdp -h for help"); - g_writeln(""); + g_writeln("%s", ""); g_exit(0); } } @@ -431,7 +431,7 @@ main(int argc, char **argv) { g_writeln("Unknown Parameter"); g_writeln("xrdp -h for help"); - g_writeln(""); + g_writeln("%s", ""); g_exit(0); } @@ -499,34 +499,34 @@ main(int argc, char **argv) g_strncasecmp(argv[1], "--help", 255) == 0 || g_strncasecmp(argv[1], "-h", 255) == 0) { - g_writeln(""); + g_writeln("%s", ""); g_writeln("xrdp: A Remote Desktop Protocol server."); g_writeln("Copyright (C) Jay Sorg 2004-2011"); g_writeln("See http://xrdp.sourceforge.net for more information."); - g_writeln(""); + g_writeln("%s", ""); g_writeln("Usage: xrdp [options]"); g_writeln(" -h: show help"); g_writeln(" -nodaemon: don't fork into background"); g_writeln(" -kill: shut down xrdp"); - g_writeln(""); + g_writeln("%s", ""); g_exit(0); } else if ((g_strncasecmp(argv[1], "-v", 255) == 0) || (g_strncasecmp(argv[1], "--version", 255) == 0)) { - g_writeln(""); + g_writeln("%s", ""); g_writeln("xrdp: A Remote Desktop Protocol server."); g_writeln("Copyright (C) Jay Sorg 2004-2011"); g_writeln("See http://xrdp.sourceforge.net for more information."); g_writeln("Version %s", PACKAGE_VERSION); - g_writeln(""); + g_writeln("%s", ""); g_exit(0); } else { g_writeln("Unknown Parameter"); g_writeln("xrdp -h for help"); - g_writeln(""); + g_writeln("%s", ""); g_exit(0); } } @@ -534,7 +534,7 @@ main(int argc, char **argv) { g_writeln("Unknown Parameter"); g_writeln("xrdp -h for help"); - g_writeln(""); + g_writeln("%s", ""); g_exit(0); } From e65bd6b7d7c8177def8fa7c23875b1f0ff13d7ce Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Sun, 10 Apr 2016 13:59:27 -0700 Subject: [PATCH 3/6] Fix more format warnings --- common/list.c | 2 +- sesman/chansrv/clipboard.c | 28 ++++++++++++------------- sesman/chansrv/rail.c | 36 ++++++++++++++++----------------- sesman/chansrv/smartcard.c | 4 ++-- sesman/chansrv/smartcard_pcsc.c | 2 +- xup/xup.c | 2 +- 6 files changed, 37 insertions(+), 37 deletions(-) diff --git a/common/list.c b/common/list.c index abab2fab..5873d41d 100644 --- a/common/list.c +++ b/common/list.c @@ -221,6 +221,6 @@ list_dump_items(struct list *self) for (index = 0; index < self->count; index++) { - g_writeln("%d: %s", index, list_get_item(self, index)); + g_writeln("%d: 0x%lx", index, list_get_item(self, index)); } } diff --git a/sesman/chansrv/clipboard.c b/sesman/chansrv/clipboard.c index 929805f9..a170dd23 100644 --- a/sesman/chansrv/clipboard.c +++ b/sesman/chansrv/clipboard.c @@ -1697,9 +1697,9 @@ clipboard_event_selection_owner_notify(XEvent *xevent) XFixesSelectionNotifyEvent *lxevent; lxevent = (XFixesSelectionNotifyEvent *)xevent; - log_debug("clipboard_event_selection_owner_notify: %p", lxevent->owner); + log_debug("clipboard_event_selection_owner_notify: 0x%lx", lxevent->owner); log_debug("clipboard_event_selection_owner_notify: " - "window %d subtype %d owner %d g_wnd %d", + "window %ld subtype %d owner %ld g_wnd %ld", lxevent->window, lxevent->subtype, lxevent->owner, g_wnd); if (lxevent->owner == g_wnd) @@ -1735,7 +1735,7 @@ clipboard_get_window_property(Window wnd, Atom prop, Atom *type, int *fmt, Atom ltype; log_debug("clipboard_get_window_property:"); - log_debug(" prop %d name %s", prop, get_atom_text(prop)); + log_debug(" prop %ld name %s", prop, get_atom_text(prop)); lxdata = 0; ltype = 0; XGetWindowProperty(g_display, wnd, prop, 0, 0, 0, @@ -1873,7 +1873,7 @@ clipboard_event_selection_notify(XEvent *xevent) if (rv == 0) { - log_debug("clipboard_event_selection_notify: wnd %p prop %s", + log_debug("clipboard_event_selection_notify: wnd 0x%lx prop %s", lxevent->requestor, get_atom_text(lxevent->property)); rv = clipboard_get_window_property(lxevent->requestor, lxevent->property, @@ -1922,7 +1922,7 @@ clipboard_event_selection_notify(XEvent *xevent) atom = atoms[index]; LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_notify: %d %s %d", atom, get_atom_text(atom), XA_STRING)); - log_debug("clipboard_event_selection_notify: 0x%x %s", + log_debug("clipboard_event_selection_notify: 0x%lx %s", atom, get_atom_text(atom)); if (atom == g_utf8_atom) { @@ -1943,15 +1943,15 @@ clipboard_event_selection_notify(XEvent *xevent) } else { - log_error("clipboard_event_selection_notify: unknown atom 0x%x", atom); + log_error("clipboard_event_selection_notify: unknown atom 0x%lx", atom); } } } else { log_error("clipboard_event_selection_notify: error, " - "target is 'TARGETS' and type[%d] or fmt[%d] not right, " - "should be type[%d], fmt[%d]", type, fmt, XA_ATOM, 32); + "target is 'TARGETS' and type[%ld] or fmt[%d] not right, " + "should be type[%ld], fmt[%d]", type, fmt, XA_ATOM, 32); } } else if (lxevent->target == g_utf8_atom) @@ -2138,9 +2138,9 @@ clipboard_event_selection_request(XEvent *xevent) char *xdata; lxev = (XSelectionRequestEvent *)xevent; - log_debug("clipboard_event_selection_request: %p", lxev->property); - log_debug("clipboard_event_selection_request: g_wnd %d, " - ".requestor %d .owner %d .selection %d '%s' .target %d .property %d", + log_debug("clipboard_event_selection_request: 0x%lx", lxev->property); + log_debug("clipboard_event_selection_request: g_wnd %ld, " + ".requestor %ld .owner %ld .selection %ld '%s' .target %ld .property %ld", g_wnd, lxev->requestor, lxev->owner, lxev->selection, get_atom_text(lxev->selection), lxev->target, lxev->property); @@ -2326,8 +2326,8 @@ clipboard_event_property_notify(XEvent *xevent) char *cptr; log_debug("clipboard_event_property_notify:"); - log_debug("clipboard_event_property_notify: PropertyNotify .window %d " - ".state %d .atom %d %s", xevent->xproperty.window, + log_debug("clipboard_event_property_notify: PropertyNotify .window %ld " + ".state %d .atom %ld %s", xevent->xproperty.window, xevent->xproperty.state, xevent->xproperty.atom, get_atom_text(xevent->xproperty.atom)); @@ -2412,7 +2412,7 @@ clipboard_event_property_notify(XEvent *xevent) } else { - log_error("clipboard_event_property_notify: error unknown type %d", + log_error("clipboard_event_property_notify: error unknown type %ld", g_clip_s2c.type); clipboard_send_data_response_failed(); } diff --git a/sesman/chansrv/rail.c b/sesman/chansrv/rail.c index 09f40eba..cad16471 100644 --- a/sesman/chansrv/rail.c +++ b/sesman/chansrv/rail.c @@ -508,7 +508,7 @@ rail_win_popdown(void) window_attributes.map_state == IsViewable && list_index_of(g_window_list, children[i]) >= 0) { - LOG(10, (" dismiss pop up 0x%8.8x", children[i])); + LOG(10, (" dismiss pop up 0x%8.8lx", children[i])); rail_send_key_esc(children[i]); rv = 1; } @@ -756,7 +756,7 @@ rail_win_set_state(Window win, unsigned long state) int old_state; unsigned long data[2] = { state, None }; - LOG(10, (" rail_win_set_state: %d", state)); + LOG(10, (" rail_win_set_state: %ld", state)); /* check whether WM_STATE exists */ old_state = rail_win_get_state(win); if (old_state == -1) @@ -1259,7 +1259,7 @@ rail_win_send_text(Window win) } if (data && len > 0) { - LOG(10, ("chansrv::rail_win_send_text: 0x%8.8x text %s length %d", + LOG(10, ("chansrv::rail_win_send_text: 0x%8.8lx text %s length %d", win, data, len)); make_stream(s); init_stream(s, len + 1024); @@ -1289,7 +1289,7 @@ rail_destroy_window(Window window_id) { struct stream *s; - LOG(10, ("chansrv::rail_destroy_window 0x%8.8x", window_id)); + LOG(10, ("chansrv::rail_destroy_window 0x%8.8lx", window_id)); make_stream(s); init_stream(s, 1024); @@ -1309,7 +1309,7 @@ rail_show_window(Window window_id, int show_state) int flags; struct stream* s; - LOG(10, ("chansrv::rail_show_window 0x%8.8x 0x%x", window_id, show_state)); + LOG(10, ("chansrv::rail_show_window 0x%8.8lx 0x%x", window_id, show_state)); make_stream(s); init_stream(s, 1024); @@ -1351,7 +1351,7 @@ rail_create_window(Window window_id, Window owner_id) struct rail_window_data* rwd; struct stream* s; - LOG(10, ("chansrv::rail_create_window 0x%8.8x", window_id)); + LOG(10, ("chansrv::rail_create_window 0x%8.8lx", window_id)); rwd = rail_get_window_data_safe(window_id); if (rwd == 0) @@ -1507,7 +1507,7 @@ rail_configure_request_window(XConfigureRequestEvent* config) if (mask & CWStackMode) { LOG(10, ("chansrv::rail_configure_request_window: CWStackMode " - "detail 0x%8.8x above 0x%8.8x", config->detail, config->above)); + "detail 0x%8.8x above 0x%8.8lx", config->detail, config->above)); if (config->detail == Above) { LOG(10, ("chansrv::rail_configure_request_window: bring to front " @@ -1808,7 +1808,7 @@ rail_xevent(void *xevent) { case PropertyNotify: prop_name = XGetAtomName(g_display, lxevent->xproperty.atom); - LOG(10, (" got PropertyNotify window_id 0x%8.8x %s state new %d", + LOG(10, (" got PropertyNotify window_id 0x%8.8lx %s state new %d", lxevent->xproperty.window, prop_name, lxevent->xproperty.state == PropertyNewValue)); @@ -1831,7 +1831,7 @@ rail_xevent(void *xevent) break; case ConfigureRequest: - LOG(10, (" got ConfigureRequest window_id 0x%8.8x", lxevent->xconfigurerequest.window)); + LOG(10, (" got ConfigureRequest window_id 0x%8.8lx", lxevent->xconfigurerequest.window)); g_memset(&xwc, 0, sizeof(xwc)); xwc.x = lxevent->xconfigurerequest.x; xwc.y = lxevent->xconfigurerequest.y; @@ -1849,13 +1849,13 @@ rail_xevent(void *xevent) break; case CreateNotify: - LOG(10, (" got CreateNotify window 0x%8.8x parent 0x%8.8x", + LOG(10, (" got CreateNotify window 0x%8.8lx parent 0x%8.8lx", lxevent->xcreatewindow.window, lxevent->xcreatewindow.parent)); rail_select_input(lxevent->xcreatewindow.window); break; case DestroyNotify: - LOG(10, (" got DestroyNotify window 0x%8.8x event 0x%8.8x", + LOG(10, (" got DestroyNotify window 0x%8.8lx event 0x%8.8lx", lxevent->xdestroywindow.window, lxevent->xdestroywindow.event)); if (lxevent->xdestroywindow.window != lxevent->xdestroywindow.event) { @@ -1871,12 +1871,12 @@ rail_xevent(void *xevent) break; case MapRequest: - LOG(10, (" got MapRequest window 0x%8.8x", lxevent->xmaprequest.window)); + LOG(10, (" got MapRequest window 0x%8.8lx", lxevent->xmaprequest.window)); XMapWindow(g_display, lxevent->xmaprequest.window); break; case MapNotify: - LOG(10, (" got MapNotify window 0x%8.8x event 0x%8.8x", + LOG(10, (" got MapNotify window 0x%8.8lx event 0x%8.8lx", lxevent->xmap.window, lxevent->xmap.event)); if (lxevent->xmap.window != lxevent->xmap.event) { @@ -1902,7 +1902,7 @@ rail_xevent(void *xevent) break; case UnmapNotify: - LOG(10, (" got UnmapNotify 0x%8.8x", lxevent->xunmap.event)); + LOG(10, (" got UnmapNotify 0x%8.8lx", lxevent->xunmap.event)); if (lxevent->xunmap.window != lxevent->xunmap.event) { break; @@ -1910,7 +1910,7 @@ rail_xevent(void *xevent) if (is_window_valid_child_of_root(lxevent->xunmap.window)) { index = list_index_of(g_window_list, lxevent->xunmap.window); - LOG(10, (" window 0x%8.8x is unmapped", lxevent->xunmap.window)); + LOG(10, (" window 0x%8.8lx is unmapped", lxevent->xunmap.window)); if (index >= 0) { XGetWindowAttributes(g_display, lxevent->xunmap.window, &wnd_attributes); @@ -1929,7 +1929,7 @@ rail_xevent(void *xevent) break; case ConfigureNotify: - LOG(10, (" got ConfigureNotify 0x%8.8x event 0x%8.8x", lxevent->xconfigure.window, + LOG(10, (" got ConfigureNotify 0x%8.8lx event 0x%8.8lx", lxevent->xconfigure.window, lxevent->xconfigure.event)); rv = 0; if (lxevent->xconfigure.event != lxevent->xconfigure.window || @@ -1975,8 +1975,8 @@ rail_xevent(void *xevent) break; case ReparentNotify: - LOG(10, (" got ReparentNotify window 0x%8.8x parent 0x%8.8x " - "event 0x%8.8x x %d y %d override redirect %d", + LOG(10, (" got ReparentNotify window 0x%8.8lx parent 0x%8.8lx " + "event 0x%8.8lx x %d y %d override redirect %d", lxevent->xreparent.window, lxevent->xreparent.parent, lxevent->xreparent.event, lxevent->xreparent.x, lxevent->xreparent.y, lxevent->xreparent.override_redirect)); diff --git a/sesman/chansrv/smartcard.c b/sesman/chansrv/smartcard.c index a07e36eb..02a30d1a 100644 --- a/sesman/chansrv/smartcard.c +++ b/sesman/chansrv/smartcard.c @@ -1854,8 +1854,8 @@ scard_send_Transmit(IRP *irp, char *context, int context_bytes, } log_debug("send_bytes %d recv_bytes %d send dwProtocol %d cbPciLength %d " - "extra_bytes %d recv dwProtocol %d cbPciLength %d", send_bytes, - recv_bytes, send_ior->dwProtocol, send_ior->cbPciLength, + "extra_bytes %d recv dwProtocol %d cbPciLength %d extra_bytes %d", + send_bytes, recv_bytes, send_ior->dwProtocol, send_ior->cbPciLength, send_ior->extra_bytes, recv_ior->dwProtocol, recv_ior->cbPciLength, recv_ior->extra_bytes); diff --git a/sesman/chansrv/smartcard_pcsc.c b/sesman/chansrv/smartcard_pcsc.c index 9824432e..bf3d11bb 100644 --- a/sesman/chansrv/smartcard_pcsc.c +++ b/sesman/chansrv/smartcard_pcsc.c @@ -259,7 +259,7 @@ free_uds_client(struct pcsc_uds_client *uds_client) } list_delete(context->cards); } - LLOGLN(10, (" left over context 0x%8.8x", context->context)); + LLOGLN(10, (" left over context %p", context->context)); scard_send_cancel(0, context->context, context->context_bytes); scard_send_release_context(0, context->context, context->context_bytes); diff --git a/xup/xup.c b/xup/xup.c index 8e904d52..1bc976ea 100644 --- a/xup/xup.c +++ b/xup/xup.c @@ -212,7 +212,7 @@ lib_mod_connect(struct mod *mod) if (trans_connect(mod->trans, mod->ip, con_port, 3000) == 0) { LLOGLN(0, ("lib_mod_connect: connected to Xserver " - "(Xorg or X11rdp) sck %d", mod->trans->sck)); + "(Xorg or X11rdp) sck %ld", mod->trans->sck)); error = 0; } From 0629b25d5f406bad82f5bd0fa4894ae9667dc48e Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Thu, 21 Apr 2016 22:27:27 -0700 Subject: [PATCH 4/6] Fix warnings about unused variables and functions --- libxrdp/xrdp_sec.c | 1 - sesman/chansrv/chansrv_fuse.c | 4 ++-- sesman/chansrv/clipboard_file.c | 2 ++ sesman/chansrv/sound.c | 2 ++ sesman/chansrv/xcommon.c | 2 ++ xup/xup.c | 4 ---- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libxrdp/xrdp_sec.c b/libxrdp/xrdp_sec.c index 4076699e..aae1ac87 100644 --- a/libxrdp/xrdp_sec.c +++ b/libxrdp/xrdp_sec.c @@ -1814,7 +1814,6 @@ xrdp_sec_process_mcs_data_channels(struct xrdp_sec *self, struct stream *s) { int num_channels; int index; - struct mcs_channel_item *channel_item; struct xrdp_client_info *client_info = (struct xrdp_client_info *)NULL; client_info = &(self->rdp_layer->client_info); diff --git a/sesman/chansrv/chansrv_fuse.c b/sesman/chansrv/chansrv_fuse.c index 7997dfb9..0bb9ceff 100644 --- a/sesman/chansrv/chansrv_fuse.c +++ b/sesman/chansrv/chansrv_fuse.c @@ -39,8 +39,6 @@ //#define USE_SYNC_FLAG -static char g_fuse_mount_name[256] = "xrdp_client"; - /* FUSE mount point */ char g_fuse_root_path[256] = ""; char g_fuse_clipboard_path[256] = ""; /* for clipboard use */ @@ -239,6 +237,8 @@ struct opendir_req struct fuse_file_info *fi; }; +static char g_fuse_mount_name[256] = "xrdp_client"; + FIFO g_fifo_opendir; static struct list *g_req_list = 0; diff --git a/sesman/chansrv/clipboard_file.c b/sesman/chansrv/clipboard_file.c index 4f3f1ade..52079c6c 100644 --- a/sesman/chansrv/clipboard_file.c +++ b/sesman/chansrv/clipboard_file.c @@ -102,6 +102,7 @@ static int g_file_request_sent_type = 0; #define CB_EPOCH_DIFF 11644473600LL /*****************************************************************************/ +#if 0 static tui64 APP_CC timeval2wintime(struct timeval *tv) { @@ -113,6 +114,7 @@ timeval2wintime(struct timeval *tv) result += tv->tv_usec * 10; return result; } +#endif /*****************************************************************************/ /* this will replace %20 or any hex with the space or correct char diff --git a/sesman/chansrv/sound.c b/sesman/chansrv/sound.c index a0899f67..66108651 100644 --- a/sesman/chansrv/sound.c +++ b/sesman/chansrv/sound.c @@ -103,6 +103,7 @@ static struct xr_wave_format_ex g_pcm_44100 = g_pcm_44100_data /* data */ }; +#if defined(XRDP_OPUS) static char g_opus_44100_data[] = { 0 }; static struct xr_wave_format_ex g_opus_44100 = { @@ -115,6 +116,7 @@ static struct xr_wave_format_ex g_opus_44100 = 0, /* data size */ g_opus_44100_data /* data */ }; +#endif #if defined(XRDP_OPUS) diff --git a/sesman/chansrv/xcommon.c b/sesman/chansrv/xcommon.c index d6d2d4b4..9aae4a06 100644 --- a/sesman/chansrv/xcommon.c +++ b/sesman/chansrv/xcommon.c @@ -63,11 +63,13 @@ xcommon_error_handler(Display *dis, XErrorEvent *xer) /* The X server had an internal error. This is the last function called. Do any cleanup that needs to be done on exit, like removing temporary files. Don't worry about memory leaks */ +#if 0 static int DEFAULT_CC xcommon_fatal_handler(Display *dis) { return 0; } +#endif /*****************************************************************************/ /* returns time in milliseconds diff --git a/xup/xup.c b/xup/xup.c index 1bc976ea..c93fa799 100644 --- a/xup/xup.c +++ b/xup/xup.c @@ -1151,10 +1151,6 @@ process_server_paint_rect_shmem_ex(struct mod *amod, struct stream *s) int shmem_offset; int width; int height; - int x; - int y; - int cx; - int cy; int index; int rv; tsi16 *ldrects; From 95e1603f9dda52a7846ad454082712ce9a7aa75e Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Thu, 21 Apr 2016 23:03:40 -0700 Subject: [PATCH 5/6] Fix recently introduced warnings in session.c Use of tabs is fixed as well. --- sesman/session.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sesman/session.c b/sesman/session.c index 76eb264a..02bb6fa7 100644 --- a/sesman/session.c +++ b/sesman/session.c @@ -412,7 +412,7 @@ session_start_fork(int width, int height, int bpp, char *username, int pampid = 0; int xpid = 0; int i = 0; - char **xserver; /* absolute/relative path to Xorg/X11rdp/Xvnc */ + char *xserver; /* absolute/relative path to Xorg/X11rdp/Xvnc */ char geometry[32]; char depth[32]; char screen[32]; /* display number */ @@ -653,9 +653,9 @@ session_start_fork(int width, int height, int bpp, char *username, xserver_params = list_create(); xserver_params->auto_free = 1; - /* get path of Xorg from config */ - xserver = g_strdup(list_get_item(g_cfg->xorg_params, 0)); - list_remove_item(g_cfg->xorg_params, 0); + /* get path of Xorg from config */ + xserver = g_strdup((const char *)list_get_item(g_cfg->xorg_params, 0)); + list_remove_item(g_cfg->xorg_params, 0); /* these are the must have parameters */ list_add_item(xserver_params, (tintptr) g_strdup(xserver)); @@ -687,9 +687,9 @@ session_start_fork(int width, int height, int bpp, char *username, xserver_params = list_create(); xserver_params->auto_free = 1; - /* get path of Xvnc from config */ - xserver = g_strdup(list_get_item(g_cfg->vnc_params, 0)); - list_remove_item(g_cfg->vnc_params, 0); + /* get path of Xvnc from config */ + xserver = g_strdup((const char *)list_get_item(g_cfg->vnc_params, 0)); + list_remove_item(g_cfg->vnc_params, 0); /* these are the must have parameters */ list_add_item(xserver_params, (tintptr)g_strdup(xserver)); @@ -717,9 +717,9 @@ session_start_fork(int width, int height, int bpp, char *username, xserver_params = list_create(); xserver_params->auto_free = 1; - /* get path of X11rdp from config */ - xserver = g_strdup(list_get_item(g_cfg->rdp_params, 0)); - list_remove_item(g_cfg->rdp_params, 0); + /* get path of X11rdp from config */ + xserver = g_strdup((const char *)list_get_item(g_cfg->rdp_params, 0)); + list_remove_item(g_cfg->rdp_params, 0); /* these are the must have parameters */ list_add_item(xserver_params, (tintptr)g_strdup(xserver)); From 70f3d4c5e23ab53bf82bc5e2029001896bf3823e Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Fri, 22 Apr 2016 23:40:48 -0700 Subject: [PATCH 6/6] Fix warnings for unused variables read from byte streams --- libxrdp/xrdp_rdp.c | 12 ++++-------- libxrdp/xrdp_sec.c | 3 +-- rdp/rdp_orders.c | 9 +++------ rdp/rdp_rdp.c | 18 ++++++------------ sesman/chansrv/chansrv.c | 3 +-- sesman/chansrv/clipboard_file.c | 3 +-- sesman/chansrv/drdynvc.c | 8 ++++---- 7 files changed, 20 insertions(+), 36 deletions(-) diff --git a/libxrdp/xrdp_rdp.c b/libxrdp/xrdp_rdp.c index 1e58a1f4..00bda631 100644 --- a/libxrdp/xrdp_rdp.c +++ b/libxrdp/xrdp_rdp.c @@ -962,7 +962,6 @@ xrdp_rdp_process_data_sync(struct xrdp_rdp *self) static int APP_CC xrdp_rdp_process_screen_update(struct xrdp_rdp *self, struct stream *s) { - int op; int left; int top; int right; @@ -970,7 +969,7 @@ xrdp_rdp_process_screen_update(struct xrdp_rdp *self, struct stream *s) int cx; int cy; - in_uint32_le(s, op); + in_uint8s(s, 4); /* op */ in_uint16_le(s, left); in_uint16_le(s, top); in_uint16_le(s, right); @@ -1129,16 +1128,13 @@ xrdp_rdp_process_frame_ack(struct xrdp_rdp *self, struct stream *s) int APP_CC xrdp_rdp_process_data(struct xrdp_rdp *self, struct stream *s) { - int len; int data_type; - int ctype; - int clen; in_uint8s(s, 6); - in_uint16_le(s, len); + in_uint8s(s, 2); /* len */ in_uint8(s, data_type); - in_uint8(s, ctype); - in_uint16_le(s, clen); + in_uint8s(s, 1); /* ctype */ + in_uint8s(s, 2); /* clen */ DEBUG(("xrdp_rdp_process_data code %d", data_type)); switch (data_type) diff --git a/libxrdp/xrdp_sec.c b/libxrdp/xrdp_sec.c index aae1ac87..3857e2d1 100644 --- a/libxrdp/xrdp_sec.c +++ b/libxrdp/xrdp_sec.c @@ -648,7 +648,6 @@ xrdp_sec_process_logon_info(struct xrdp_sec *self, struct stream *s) int len_directory = 0; int len_ip = 0; int len_dll = 0; - int tzone = 0; char tmpdata[256]; /* initialize (zero out) local variables */ @@ -837,7 +836,7 @@ xrdp_sec_process_logon_info(struct xrdp_sec *self, struct stream *s) { return 1; } - in_uint32_le(s, tzone); /* len of timezone */ + in_uint8s(s, 4); /* len of timezone */ in_uint8s(s, 62); /* skip */ in_uint8s(s, 22); /* skip misc. */ in_uint8s(s, 62); /* skip */ diff --git a/rdp/rdp_orders.c b/rdp/rdp_orders.c index 518a42ee..1cad819d 100644 --- a/rdp/rdp_orders.c +++ b/rdp/rdp_orders.c @@ -225,7 +225,6 @@ rdp_orders_process_raw_bmpcache(struct rdp_orders *self, struct stream *s, int flags) { int cache_idx = 0; - int bufsize = 0; int cache_id = 0; int width = 0; int height = 0; @@ -244,7 +243,7 @@ rdp_orders_process_raw_bmpcache(struct rdp_orders *self, struct stream *s, in_uint8(s, height); in_uint8(s, bpp); Bpp = (bpp + 7) / 8; - in_uint16_le(s, bufsize); + in_uint8s(s, 2); /* bufsize */ in_uint16_le(s, cache_idx); inverted = (char *)g_malloc(width * height * Bpp, 0); @@ -326,8 +325,6 @@ rdp_orders_process_bmpcache(struct rdp_orders *self, struct stream *s, int bpp = 0; int Bpp = 0; int bufsize = 0; - int row_size = 0; - int final_size = 0; struct rdp_bitmap *bitmap = (struct rdp_bitmap *)NULL; struct stream *rec_s = (struct stream *)NULL; @@ -348,8 +345,8 @@ rdp_orders_process_bmpcache(struct rdp_orders *self, struct stream *s, { in_uint8s(s, 2); /* pad */ in_uint16_le(s, size); - in_uint16_le(s, row_size); - in_uint16_le(s, final_size); + in_uint8s(s, 2); /* row_size */ + in_uint8s(s, 2); /* final_size */ } in_uint8p(s, data, size); diff --git a/rdp/rdp_rdp.c b/rdp/rdp_rdp.c index 9ce63664..d5c8e27f 100644 --- a/rdp/rdp_rdp.c +++ b/rdp/rdp_rdp.c @@ -506,8 +506,6 @@ static int APP_CC rdp_rdp_process_pointer_pdu(struct rdp_rdp *self, struct stream *s) { int message_type; - int x; - int y; int rv; rv = 0; @@ -517,8 +515,8 @@ rdp_rdp_process_pointer_pdu(struct rdp_rdp *self, struct stream *s) switch (message_type) { case RDP_POINTER_MOVE: - in_uint16_le(s, x); - in_uint16_le(s, y); + in_uint8s(s, 2); /* x */ + in_uint8s(s, 2); /* y */ break; case RDP_POINTER_COLOR: rv = rdp_rdp_process_color_pointer_pdu(self, s); @@ -934,15 +932,13 @@ int APP_CC rdp_rdp_process_data_pdu(struct rdp_rdp *self, struct stream *s) { int data_pdu_type; - int ctype; - int len; int rv; rv = 0; in_uint8s(s, 6); /* shareid, pad, streamid */ - in_uint16_le(s, len); + in_uint8s(s, 2); /* len */ in_uint8(s, data_pdu_type); - in_uint8(s, ctype); + in_uint8s(s, 1); /* ctype */ in_uint8s(s, 2); /* clen */ switch (data_pdu_type) @@ -983,14 +979,12 @@ rdp_rdp_process_general_caps(struct rdp_rdp *self, struct stream *s) static void APP_CC rdp_rdp_process_bitmap_caps(struct rdp_rdp *self, struct stream *s) { - int width = 0; - int height = 0; int bpp = 0; in_uint16_le(s, bpp); in_uint8s(s, 6); - in_uint16_le(s, width); - in_uint16_le(s, height); + in_uint8s(s, 2); /* width */ + in_uint8s(s, 2); /* height */ self->mod->rdp_bpp = bpp; /* todo, call reset if needed and use width and height */ } diff --git a/sesman/chansrv/chansrv.c b/sesman/chansrv/chansrv.c index fad2841d..e3d2f5d2 100644 --- a/sesman/chansrv/chansrv.c +++ b/sesman/chansrv/chansrv.c @@ -756,7 +756,6 @@ int DEFAULT_CC my_trans_data_in(struct trans *trans) { struct stream *s = (struct stream *)NULL; - int id = 0; int size = 0; int error = 0; @@ -772,7 +771,7 @@ my_trans_data_in(struct trans *trans) LOGM((LOG_LEVEL_DEBUG, "my_trans_data_in:")); s = trans_get_in_s(trans); - in_uint32_le(s, id); + in_uint8s(s, 4); /* id */ in_uint32_le(s, size); error = trans_force_read(trans, size - 8); diff --git a/sesman/chansrv/clipboard_file.c b/sesman/chansrv/clipboard_file.c index 52079c6c..562ee82d 100644 --- a/sesman/chansrv/clipboard_file.c +++ b/sesman/chansrv/clipboard_file.c @@ -531,7 +531,6 @@ clipboard_process_file_request(struct stream *s, int clip_msg_status, int lindex; int dwFlags; int nPositionLow; - int nPositionHigh; int cbRequested; //int clipDataId; @@ -541,7 +540,7 @@ clipboard_process_file_request(struct stream *s, int clip_msg_status, in_uint32_le(s, lindex); in_uint32_le(s, dwFlags); in_uint32_le(s, nPositionLow); - in_uint32_le(s, nPositionHigh); + in_uint8s(s, 4); /* nPositionHigh */ in_uint32_le(s, cbRequested); //in_uint32_le(s, clipDataId); /* options, used when locking */ if (dwFlags & CB_FILECONTENTS_SIZE) diff --git a/sesman/chansrv/drdynvc.c b/sesman/chansrv/drdynvc.c index 5c20661e..5b9224ca 100644 --- a/sesman/chansrv/drdynvc.c +++ b/sesman/chansrv/drdynvc.c @@ -342,24 +342,24 @@ drdynvc_process_data_first(struct stream *s, unsigned char cmd) uint32_t chan_id; int bytes_in_stream; - int data_len; int Len; drdynvc_get_chan_id(s, cmd, &chan_id); Len = (cmd >> 2) & 0x03; + /* skip data_len */ if (Len == 0) { - in_uint8(s, data_len); + in_uint8s(s, 1); } else if (Len == 1) { - in_uint16_le(s, data_len); + in_uint8s(s, 2); } else { - in_uint32_le(s, data_len); + in_uint8s(s, 4); } bytes_in_stream = stream_length_after_p(s);