From 0780c0993e066d21d071ce3ac89cbb24355fc9c0 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 7 Aug 2014 22:21:07 +0200 Subject: [PATCH] Replaced fprintf(stderr with DEBUG_WARN --- client/DirectFB/dfreerdp.c | 16 +++--- client/Mac/MRDPView.m | 28 +++++----- client/Windows/wf_cliprdr.c | 10 ++-- client/Windows/wf_gdi.c | 4 +- client/Windows/wf_graphics.c | 2 +- client/Windows/wf_interface.c | 40 +++++++------- client/X11/generate_argument_docbook.c | 16 +++--- client/X11/xf_client.c | 48 ++++++++--------- client/X11/xf_cliprdr.c | 8 +-- client/X11/xf_gdi.c | 24 ++++----- client/X11/xf_graphics.c | 8 +-- client/X11/xf_input.c | 2 +- client/X11/xf_keyboard.c | 2 +- client/X11/xf_rail.c | 6 +-- client/X11/xf_tsmf.c | 6 +-- client/common/cmdline.c | 11 ++-- client/common/compatibility.c | 97 +++++++++++++++++----------------- client/common/file.c | 9 ++-- 18 files changed, 170 insertions(+), 167 deletions(-) diff --git a/client/DirectFB/dfreerdp.c b/client/DirectFB/dfreerdp.c index df68a1d..c231cd5 100644 --- a/client/DirectFB/dfreerdp.c +++ b/client/DirectFB/dfreerdp.c @@ -292,7 +292,7 @@ static void df_process_channel_event(rdpChannels* channels, freerdp* instance) break; default: - fprintf(stderr, "df_process_channel_event: unknown event type %d\n", GetMessageType(event->id)); + DEBUG_WARN( "df_process_channel_event: unknown event type %d\n", GetMessageType(event->id)); break; } @@ -339,17 +339,17 @@ int dfreerdp_run(freerdp* instance) if (freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE) { - fprintf(stderr, "Failed to get FreeRDP file descriptor\n"); + DEBUG_WARN( "Failed to get FreeRDP file descriptor\n"); break; } if (freerdp_channels_get_fds(channels, instance, rfds, &rcount, wfds, &wcount) != TRUE) { - fprintf(stderr, "Failed to get channel manager file descriptor\n"); + DEBUG_WARN( "Failed to get channel manager file descriptor\n"); break; } if (df_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE) { - fprintf(stderr, "Failed to get dfreerdp file descriptor\n"); + DEBUG_WARN( "Failed to get dfreerdp file descriptor\n"); break; } @@ -378,24 +378,24 @@ int dfreerdp_run(freerdp* instance) (errno == EINPROGRESS) || (errno == EINTR))) /* signal occurred */ { - fprintf(stderr, "dfreerdp_run: select failed\n"); + DEBUG_WARN( "dfreerdp_run: select failed\n"); break; } } if (freerdp_check_fds(instance) != TRUE) { - fprintf(stderr, "Failed to check FreeRDP file descriptor\n"); + DEBUG_WARN( "Failed to check FreeRDP file descriptor\n"); break; } if (df_check_fds(instance, &rfds_set) != TRUE) { - fprintf(stderr, "Failed to check dfreerdp file descriptor\n"); + DEBUG_WARN( "Failed to check dfreerdp file descriptor\n"); break; } if (freerdp_channels_check_fds(channels, instance) != TRUE) { - fprintf(stderr, "Failed to check channel manager file descriptor\n"); + DEBUG_WARN( "Failed to check channel manager file descriptor\n"); break; } df_process_channel_event(channels, instance); diff --git a/client/Mac/MRDPView.m b/client/Mac/MRDPView.m index 5de0da4..c298efe 100644 --- a/client/Mac/MRDPView.m +++ b/client/Mac/MRDPView.m @@ -617,7 +617,7 @@ DWORD fixKeyCode(DWORD keyCode, unichar keyChar, enum APPLE_KEYBOARD_TYPE type) vkcode &= 0xFF; #if 0 - fprintf(stderr, "keyDown: keyCode: 0x%04X scancode: 0x%04X vkcode: 0x%04X keyFlags: %d name: %s\n", + DEBUG_WARN( "keyDown: keyCode: 0x%04X scancode: 0x%04X vkcode: 0x%04X keyFlags: %d name: %s\n", keyCode, scancode, vkcode, keyFlags, GetVirtualKeyName(vkcode)); #endif @@ -654,7 +654,7 @@ DWORD fixKeyCode(DWORD keyCode, unichar keyChar, enum APPLE_KEYBOARD_TYPE type) vkcode &= 0xFF; #if 0 - fprintf(stderr, "keyUp: key: 0x%04X scancode: 0x%04X vkcode: 0x%04X keyFlags: %d name: %s\n", + DEBUG_WARN( "keyUp: key: 0x%04X scancode: 0x%04X vkcode: 0x%04X keyFlags: %d name: %s\n", keyCode, scancode, vkcode, keyFlags, GetVirtualKeyName(vkcode)); #endif @@ -683,29 +683,29 @@ DWORD fixKeyCode(DWORD keyCode, unichar keyChar, enum APPLE_KEYBOARD_TYPE type) vkcode &= 0xFF; #if 0 - fprintf(stderr, "flagsChanged: key: 0x%04X scancode: 0x%04X vkcode: 0x%04X extended: %d name: %s modFlags: 0x%04X\n", + DEBUG_WARN( "flagsChanged: key: 0x%04X scancode: 0x%04X vkcode: 0x%04X extended: %d name: %s modFlags: 0x%04X\n", key - 8, scancode, vkcode, keyFlags, GetVirtualKeyName(vkcode), modFlags); if (modFlags & NSAlphaShiftKeyMask) - fprintf(stderr, "NSAlphaShiftKeyMask\n"); + DEBUG_WARN( "NSAlphaShiftKeyMask\n"); if (modFlags & NSShiftKeyMask) - fprintf(stderr, "NSShiftKeyMask\n"); + DEBUG_WARN( "NSShiftKeyMask\n"); if (modFlags & NSControlKeyMask) - fprintf(stderr, "NSControlKeyMask\n"); + DEBUG_WARN( "NSControlKeyMask\n"); if (modFlags & NSAlternateKeyMask) - fprintf(stderr, "NSAlternateKeyMask\n"); + DEBUG_WARN( "NSAlternateKeyMask\n"); if (modFlags & NSCommandKeyMask) - fprintf(stderr, "NSCommandKeyMask\n"); + DEBUG_WARN( "NSCommandKeyMask\n"); if (modFlags & NSNumericPadKeyMask) - fprintf(stderr, "NSNumericPadKeyMask\n"); + DEBUG_WARN( "NSNumericPadKeyMask\n"); if (modFlags & NSHelpKeyMask) - fprintf(stderr, "NSHelpKeyMask\n"); + DEBUG_WARN( "NSHelpKeyMask\n"); #endif if ((modFlags & NSAlphaShiftKeyMask) && !(kbdModFlags & NSAlphaShiftKeyMask)) @@ -832,7 +832,7 @@ BOOL mac_pre_connect(freerdp* instance) if (!settings->ServerHostname) { - fprintf(stderr, "error: server hostname was not specified with /v:[:port]\n"); + DEBUG_WARN( "error: server hostname was not specified with /v:[:port]\n"); [NSApp terminate:nil]; return -1; } @@ -1200,7 +1200,7 @@ static void update_activity_cb(freerdp* instance) } else { - fprintf(stderr, "update_activity_cb: No queue!\n"); + DEBUG_WARN( "update_activity_cb: No queue!\n"); } } @@ -1225,7 +1225,7 @@ static void input_activity_cb(freerdp* instance) } else { - fprintf(stderr, "input_activity_cb: No queue!\n"); + DEBUG_WARN( "input_activity_cb: No queue!\n"); } } @@ -1238,7 +1238,7 @@ static void channel_activity_cb(freerdp* instance) if (event) { - fprintf(stderr, "channel_activity_cb: message %d\n", event->id); + DEBUG_WARN( "channel_activity_cb: message %d\n", event->id); switch (GetMessageClass(event->id)) { diff --git a/client/Windows/wf_cliprdr.c b/client/Windows/wf_cliprdr.c index d319c83..ca8c41b 100644 --- a/client/Windows/wf_cliprdr.c +++ b/client/Windows/wf_cliprdr.c @@ -568,7 +568,7 @@ void wf_cliprdr_init(wfContext* wfc, rdpChannels* channels) if (!wfc->instance->settings->RedirectClipboard) { wfc->cliprdr_context = NULL; - fprintf(stderr, "clipboard is not redirected.\n"); + DEBUG_WARN( "clipboard is not redirected.\n"); return; } @@ -658,7 +658,7 @@ static BOOL wf_cliprdr_get_file_contents(wchar_t *file_name, BYTE *buffer, int p if (file_name == NULL || buffer == NULL || puSize == NULL) { - fprintf(stderr, "get file contents Invalid Arguments.\n"); + DEBUG_WARN( "get file contents Invalid Arguments.\n"); return FALSE; } hFile = CreateFileW(file_name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, NULL); @@ -1175,7 +1175,7 @@ static void wf_cliprdr_process_cb_filecontents_request_event(wfContext *wfc, RDP hRet = OleGetClipboard(&pDataObj); if (!SUCCEEDED(hRet)) { - fprintf(stderr, "filecontents: get ole clipboard failed.\n"); + DEBUG_WARN( "filecontents: get ole clipboard failed.\n"); goto error; } @@ -1273,7 +1273,7 @@ static void wf_cliprdr_process_cb_filecontents_request_event(wfContext *wfc, RDP event->nPositionLow, event->nPositionHigh, event->cbRequested, &uSize); if (bRet == FALSE) { - fprintf(stderr, "get file contents failed.\n"); + DEBUG_WARN( "get file contents failed.\n"); uSize = 0; goto error; } @@ -1304,7 +1304,7 @@ error: IDataObject_Release(pDataObj); pDataObj = NULL; } - fprintf(stderr, "filecontents: send failed response.\n"); + DEBUG_WARN( "filecontents: send failed response.\n"); cliprdr_send_response_filecontents(cliprdr, event->streamId, 0, NULL); return; } diff --git a/client/Windows/wf_gdi.c b/client/Windows/wf_gdi.c index 1c87072..1834016 100644 --- a/client/Windows/wf_gdi.c +++ b/client/Windows/wf_gdi.c @@ -63,7 +63,7 @@ BOOL wf_set_rop2(HDC hdc, int rop2) { if ((rop2 < 0x01) || (rop2 > 0x10)) { - fprintf(stderr, "Unsupported ROP2: %d\n", rop2); + DEBUG_WARN( "Unsupported ROP2: %d\n", rop2); return FALSE; } @@ -643,7 +643,7 @@ void wf_gdi_surface_bits(wfContext* wfc, SURFACE_BITS_COMMAND* surface_bits_comm } else { - fprintf(stderr, "Unsupported codecID %d\n", surface_bits_command->codecID); + DEBUG_WARN( "Unsupported codecID %d\n", surface_bits_command->codecID); } if (tile_bitmap != NULL) diff --git a/client/Windows/wf_graphics.c b/client/Windows/wf_graphics.c index a3b40f2..c33f14a 100644 --- a/client/Windows/wf_graphics.c +++ b/client/Windows/wf_graphics.c @@ -161,7 +161,7 @@ void wf_Bitmap_Decompress(wfContext* wfc, rdpBitmap* bitmap, if (status != TRUE) { - fprintf(stderr, "Bitmap Decompression Failed\n"); + DEBUG_WARN( "Bitmap Decompression Failed\n"); } } else diff --git a/client/Windows/wf_interface.c b/client/Windows/wf_interface.c index ec7c70d..fdb7b31 100644 --- a/client/Windows/wf_interface.c +++ b/client/Windows/wf_interface.c @@ -65,7 +65,7 @@ int wf_create_console(void) freopen("CONOUT$", "w", stdout); freopen("CONOUT$", "w", stderr); - fprintf(stderr, "Debug console created.\n"); + DEBUG_WARN( "Debug console created.\n"); return 0; } @@ -202,7 +202,7 @@ BOOL wf_pre_connect(freerdp* instance) wfc->connectionRdpFile = freerdp_client_rdp_file_new(); - fprintf(stderr, "Using connection file: %s\n", settings->ConnectionFile); + DEBUG_WARN( "Using connection file: %s\n", settings->ConnectionFile); freerdp_client_parse_rdp_file(wfc->connectionRdpFile, settings->ConnectionFile); freerdp_client_populate_settings_from_rdp_file(wfc->connectionRdpFile, settings); @@ -291,7 +291,7 @@ BOOL wf_pre_connect(freerdp* instance) if ((settings->DesktopWidth < 64) || (settings->DesktopHeight < 64) || (settings->DesktopWidth > 4096) || (settings->DesktopHeight > 4096)) { - fprintf(stderr, "wf_pre_connect: invalid dimensions %d %d\n", settings->DesktopWidth, settings->DesktopHeight); + DEBUG_WARN( "wf_pre_connect: invalid dimensions %d %d\n", settings->DesktopWidth, settings->DesktopHeight); return 1; } @@ -487,7 +487,7 @@ BOOL wf_authenticate(freerdp* instance, char** username, char** password, char** if (status != NO_ERROR) { - fprintf(stderr, "CredUIPromptForCredentials unexpected status: 0x%08X\n", status); + DEBUG_WARN( "CredUIPromptForCredentials unexpected status: 0x%08X\n", status); return FALSE; } @@ -496,7 +496,7 @@ BOOL wf_authenticate(freerdp* instance, char** username, char** password, char** status = CredUIParseUserNameA(UserName, User, sizeof(User), Domain, sizeof(Domain)); - //fprintf(stderr, "User: %s Domain: %s Password: %s\n", User, Domain, Password); + //DEBUG_WARN( "User: %s Domain: %s Password: %s\n", User, Domain, Password); *username = _strdup(User); @@ -590,7 +590,7 @@ static BOOL wf_auto_reconnect(freerdp* instance) return FALSE; /* A network disconnect was detected */ - fprintf(stderr, "Network disconnect!\n"); + DEBUG_WARN( "Network disconnect!\n"); if (!instance->settings->AutoReconnectionEnabled) { /* No auto-reconnect - just quit */ @@ -605,7 +605,7 @@ static BOOL wf_auto_reconnect(freerdp* instance) return FALSE; /* Attempt the next reconnect */ - fprintf(stderr, "Attempting reconnect (%u of %u)\n", num_retries, max_retries); + DEBUG_WARN( "Attempting reconnect (%u of %u)\n", num_retries, max_retries); if (freerdp_reconnect(instance)) { return TRUE; @@ -614,7 +614,7 @@ static BOOL wf_auto_reconnect(freerdp* instance) Sleep(5000); } - fprintf(stderr, "Maximum reconnect retries exceeded\n"); + DEBUG_WARN( "Maximum reconnect retries exceeded\n"); return FALSE; } @@ -784,13 +784,13 @@ DWORD WINAPI wf_client_thread(LPVOID lpParam) { if (freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE) { - fprintf(stderr, "Failed to get FreeRDP file descriptor\n"); + DEBUG_WARN( "Failed to get FreeRDP file descriptor\n"); break; } } if (wf_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE) { - fprintf(stderr, "Failed to get wfreerdp file descriptor\n"); + DEBUG_WARN( "Failed to get wfreerdp file descriptor\n"); break; } @@ -798,7 +798,7 @@ DWORD WINAPI wf_client_thread(LPVOID lpParam) { if (freerdp_channels_get_fds(channels, instance, rfds, &rcount, wfds, &wcount) != TRUE) { - fprintf(stderr, "Failed to get channel manager file descriptor\n"); + DEBUG_WARN( "Failed to get channel manager file descriptor\n"); break; } } @@ -816,14 +816,14 @@ DWORD WINAPI wf_client_thread(LPVOID lpParam) /* exit if nothing to do */ if (fds_count == 0) { - fprintf(stderr, "wfreerdp_run: fds_count is zero\n"); + DEBUG_WARN( "wfreerdp_run: fds_count is zero\n"); //break; } /* do the wait */ if (MsgWaitForMultipleObjects(fds_count, fds, FALSE, 1000, QS_ALLINPUT) == WAIT_FAILED) { - fprintf(stderr, "wfreerdp_run: WaitForMultipleObjects failed: 0x%04X\n", GetLastError()); + DEBUG_WARN( "wfreerdp_run: WaitForMultipleObjects failed: 0x%04X\n", GetLastError()); break; } @@ -834,7 +834,7 @@ DWORD WINAPI wf_client_thread(LPVOID lpParam) if (wf_auto_reconnect(instance)) continue; - fprintf(stderr, "Failed to check FreeRDP file descriptor\n"); + DEBUG_WARN( "Failed to check FreeRDP file descriptor\n"); break; } } @@ -844,7 +844,7 @@ DWORD WINAPI wf_client_thread(LPVOID lpParam) } if (wf_check_fds(instance) != TRUE) { - fprintf(stderr, "Failed to check wfreerdp file descriptor\n"); + DEBUG_WARN( "Failed to check wfreerdp file descriptor\n"); break; } @@ -852,7 +852,7 @@ DWORD WINAPI wf_client_thread(LPVOID lpParam) { if (freerdp_channels_check_fds(channels, instance) != TRUE) { - fprintf(stderr, "Failed to check channel manager file descriptor\n"); + DEBUG_WARN( "Failed to check channel manager file descriptor\n"); break; } @@ -960,7 +960,7 @@ DWORD WINAPI wf_keyboard_thread(LPVOID lpParam) { if (status == -1) { - fprintf(stderr, "keyboard thread error getting message\n"); + DEBUG_WARN( "keyboard thread error getting message\n"); break; } else @@ -974,7 +974,7 @@ DWORD WINAPI wf_keyboard_thread(LPVOID lpParam) } else { - fprintf(stderr, "failed to install keyboard hook\n"); + DEBUG_WARN( "failed to install keyboard hook\n"); } printf("Keyboard thread exited.\n"); @@ -1002,7 +1002,7 @@ int freerdp_client_focus_out(wfContext* wfc) int freerdp_client_set_window_size(wfContext* wfc, int width, int height) { - fprintf(stderr, "freerdp_client_set_window_size %d, %d", width, height); + DEBUG_WARN( "freerdp_client_set_window_size %d, %d", width, height); if ((width != wfc->client_width) || (height != wfc->client_height)) { @@ -1027,7 +1027,7 @@ int freerdp_client_load_settings_from_rdp_file(wfContext* wfc, char* filename) freerdp_client_rdp_file_free(wfc->connectionRdpFile); wfc->connectionRdpFile = freerdp_client_rdp_file_new(); - fprintf(stderr, "Using connection file: %s\n", settings->ConnectionFile); + DEBUG_WARN( "Using connection file: %s\n", settings->ConnectionFile); if (!freerdp_client_parse_rdp_file(wfc->connectionRdpFile, settings->ConnectionFile)) { diff --git a/client/X11/generate_argument_docbook.c b/client/X11/generate_argument_docbook.c index 4b49f34..c1a3035 100644 --- a/client/X11/generate_argument_docbook.c +++ b/client/X11/generate_argument_docbook.c @@ -26,7 +26,7 @@ LPSTR tr_esc_str(LPCSTR arg) tmp = (LPSTR)realloc(tmp, ds * sizeof(CHAR)); if(NULL == tmp) { - fprintf(stderr, "Could not allocate string buffer."); + DEBUG_WARN( "Could not allocate string buffer."); exit(-2); } /* Copy character for character and check, if it is necessary to escape. */ @@ -40,7 +40,7 @@ LPSTR tr_esc_str(LPCSTR arg) tmp = (LPSTR)realloc(tmp, ds * sizeof(CHAR)); if(NULL == tmp) { - fprintf(stderr, "Could not reallocate string buffer."); + DEBUG_WARN( "Could not reallocate string buffer."); exit(-3); } tmp[cs++] = '&'; @@ -53,7 +53,7 @@ LPSTR tr_esc_str(LPCSTR arg) tmp = (LPSTR)realloc(tmp, ds * sizeof(CHAR)); if(NULL == tmp) { - fprintf(stderr, "Could not reallocate string buffer."); + DEBUG_WARN( "Could not reallocate string buffer."); exit(-4); } tmp[cs++] = '&'; @@ -66,7 +66,7 @@ LPSTR tr_esc_str(LPCSTR arg) tmp = (LPSTR)realloc(tmp, ds * sizeof(CHAR)); if(NULL == tmp) { - fprintf(stderr, "Could not reallocate string buffer."); + DEBUG_WARN( "Could not reallocate string buffer."); exit(-5); } tmp[cs++] = '&'; @@ -81,7 +81,7 @@ LPSTR tr_esc_str(LPCSTR arg) tmp = (LPSTR)realloc(tmp, ds * sizeof(CHAR)); if(NULL == tmp) { - fprintf(stderr, "Could not reallocate string buffer."); + DEBUG_WARN( "Could not reallocate string buffer."); exit(-6); } tmp[cs++] = '&'; @@ -96,7 +96,7 @@ LPSTR tr_esc_str(LPCSTR arg) tmp = (LPSTR)realloc(tmp, ds * sizeof(CHAR)); if(NULL == tmp) { - fprintf(stderr, "Could not reallocate string buffer."); + DEBUG_WARN( "Could not reallocate string buffer."); exit(-7); } tmp[cs++] = '&'; @@ -125,7 +125,7 @@ int main(int argc, char *argv[]) fp = fopen(fname, "w"); if(NULL == fp) { - fprintf(stderr, "Could not open '%s' for writing.", fname); + DEBUG_WARN( "Could not open '%s' for writing.", fname); return -1; } /* The tag used as header in the manpage */ @@ -136,7 +136,7 @@ int main(int argc, char *argv[]) * compatible XML */ if(elements < 2) { - fprintf(stderr, "The argument array 'args' is empty, writing an empty file."); + DEBUG_WARN( "The argument array 'args' is empty, writing an empty file."); elements = 1; } for(x=0; xdisplay, &pf_count); if(pfs == NULL) { - fprintf(stderr, "xf_get_pixmap_info: XListPixmapFormats failed\n"); + DEBUG_WARN( "xf_get_pixmap_info: XListPixmapFormats failed\n"); return 1; } for(i = 0; i < pf_count; i++) @@ -592,13 +592,13 @@ BOOL xf_get_pixmap_info(xfContext *xfc) template.screen = xfc->screen_number; if(XGetWindowAttributes(xfc->display, RootWindowOfScreen(xfc->screen), &window_attributes) == 0) { - fprintf(stderr, "xf_get_pixmap_info: XGetWindowAttributes failed\n"); + DEBUG_WARN( "xf_get_pixmap_info: XGetWindowAttributes failed\n"); return FALSE; } vis = XGetVisualInfo(xfc->display, VisualClassMask | VisualScreenMask, &template, &vi_count); if(vis == NULL) { - fprintf(stderr, "xf_get_pixmap_info: XGetVisualInfo failed\n"); + DEBUG_WARN( "xf_get_pixmap_info: XGetVisualInfo failed\n"); return FALSE; } vi = NULL; @@ -637,7 +637,7 @@ int xf_error_handler(Display *d, XErrorEvent *ev) char buf[256]; int do_abort = TRUE; XGetErrorText(d, ev->error_code, buf, sizeof(buf)); - fprintf(stderr, "%s", buf); + DEBUG_WARN( "%s", buf); if(do_abort) abort(); _def_error_handler(d, ev); @@ -721,20 +721,20 @@ BOOL xf_pre_connect(freerdp *instance) { if(!XInitThreads()) { - fprintf(stderr, "warning: XInitThreads() failure\n"); + DEBUG_WARN( "warning: XInitThreads() failure\n"); xfc->UseXThreads = FALSE; } } xfc->display = XOpenDisplay(NULL); if(!xfc->display) { - fprintf(stderr, "xf_pre_connect: failed to open display: %s\n", XDisplayName(NULL)); - fprintf(stderr, "Please check that the $DISPLAY environment variable is properly set.\n"); + DEBUG_WARN( "xf_pre_connect: failed to open display: %s\n", XDisplayName(NULL)); + DEBUG_WARN( "Please check that the $DISPLAY environment variable is properly set.\n"); return FALSE; } if(xfc->debug) { - fprintf(stderr, "Enabling X11 debug mode.\n"); + DEBUG_WARN( "Enabling X11 debug mode.\n"); XSynchronize(xfc->display, TRUE); _def_error_handler = XSetErrorHandler(_xf_error_handler); } @@ -750,15 +750,15 @@ BOOL xf_pre_connect(freerdp *instance) /* Check --authonly has a username and password. */ if(settings->Username == NULL) { - fprintf(stderr, "--authonly, but no -u username. Please provide one.\n"); + DEBUG_WARN( "--authonly, but no -u username. Please provide one.\n"); return FALSE; } if(settings->Password == NULL) { - fprintf(stderr, "--authonly, but no -p password. Please provide one.\n"); + DEBUG_WARN( "--authonly, but no -p password. Please provide one.\n"); return FALSE; } - fprintf(stderr, "Authentication only. Don't connect to X.\n"); + DEBUG_WARN( "Authentication only. Don't connect to X.\n"); /* Avoid XWindows initialization and configuration below. */ return TRUE; } @@ -1225,7 +1225,7 @@ BOOL xf_auto_reconnect(freerdp *instance) if(freerdp_error_info(instance) != 0) return FALSE; /* A network disconnect was detected */ - fprintf(stderr, "Network disconnect!\n"); + DEBUG_WARN( "Network disconnect!\n"); if(!instance->settings->AutoReconnectionEnabled) { /* No auto-reconnect - just quit */ @@ -1240,7 +1240,7 @@ BOOL xf_auto_reconnect(freerdp *instance) return FALSE; } /* Attempt the next reconnect */ - fprintf(stderr, "Attempting reconnect (%u of %u)\n", num_retries, max_retries); + DEBUG_WARN( "Attempting reconnect (%u of %u)\n", num_retries, max_retries); if(freerdp_reconnect(instance)) { xfc->disconnect = FALSE; @@ -1248,7 +1248,7 @@ BOOL xf_auto_reconnect(freerdp *instance) } sleep(5); } - fprintf(stderr, "Maximum reconnect retries exceeded\n"); + DEBUG_WARN( "Maximum reconnect retries exceeded\n"); return FALSE; } @@ -1301,7 +1301,7 @@ void *xf_thread(void *param) if(instance->settings->AuthenticationOnly) { freerdp_disconnect(instance); - fprintf(stderr, "Authentication only, exit status %d\n", !status); + DEBUG_WARN( "Authentication only, exit status %d\n", !status); ExitThread(exit_code); } if(!status) @@ -1352,7 +1352,7 @@ void *xf_thread(void *param) { if(freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE) { - fprintf(stderr, "Failed to get FreeRDP file descriptor\n"); + DEBUG_WARN( "Failed to get FreeRDP file descriptor\n"); exit_code = XF_EXIT_CONN_FAILED; break; } @@ -1361,7 +1361,7 @@ void *xf_thread(void *param) { if(freerdp_channels_get_fds(channels, instance, rfds, &rcount, wfds, &wcount) != TRUE) { - fprintf(stderr, "Failed to get channel manager file descriptor\n"); + DEBUG_WARN( "Failed to get channel manager file descriptor\n"); exit_code = XF_EXIT_CONN_FAILED; break; } @@ -1370,7 +1370,7 @@ void *xf_thread(void *param) { if(xf_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE) { - fprintf(stderr, "Failed to get xfreerdp file descriptor\n"); + DEBUG_WARN( "Failed to get xfreerdp file descriptor\n"); exit_code = XF_EXIT_CONN_FAILED; break; } @@ -1407,7 +1407,7 @@ void *xf_thread(void *param) if(!((errno == EAGAIN) || (errno == EWOULDBLOCK) || (errno == EINPROGRESS) || (errno == EINTR))) /* signal occurred */ { - fprintf(stderr, "xfreerdp_run: select failed\n"); + DEBUG_WARN( "xfreerdp_run: select failed\n"); break; } } @@ -1417,7 +1417,7 @@ void *xf_thread(void *param) { if(xf_auto_reconnect(instance)) continue; - fprintf(stderr, "Failed to check FreeRDP file descriptor\n"); + DEBUG_WARN( "Failed to check FreeRDP file descriptor\n"); break; } } @@ -1425,7 +1425,7 @@ void *xf_thread(void *param) { if(freerdp_channels_check_fds(channels, instance) != TRUE) { - fprintf(stderr, "Failed to check channel manager file descriptor\n"); + DEBUG_WARN( "Failed to check channel manager file descriptor\n"); break; } xf_process_channel_event(channels, instance); @@ -1434,7 +1434,7 @@ void *xf_thread(void *param) { if(xf_process_x_events(instance) != TRUE) { - fprintf(stderr, "Closed from X11\n"); + DEBUG_WARN( "Closed from X11\n"); break; } } @@ -1444,7 +1444,7 @@ void *xf_thread(void *param) { if(!freerdp_message_queue_process_pending_messages(instance, FREERDP_INPUT_MESSAGE_QUEUE)) { - fprintf(stderr, "User Disconnect\n"); + DEBUG_WARN( "User Disconnect\n"); xfc->disconnect = TRUE; break; } @@ -1559,7 +1559,7 @@ static int xfreerdp_client_start(rdpContext *context) rdpSettings *settings = context->settings; if(!settings->ServerHostname) { - fprintf(stderr, "error: server hostname was not specified with /v:[:port]\n"); + DEBUG_WARN( "error: server hostname was not specified with /v:[:port]\n"); return -1; } xfc->thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) xf_thread, diff --git a/client/X11/xf_cliprdr.c b/client/X11/xf_cliprdr.c index eabdac1..b37fa6f 100644 --- a/client/X11/xf_cliprdr.c +++ b/client/X11/xf_cliprdr.c @@ -143,15 +143,15 @@ void xf_cliprdr_init(xfContext* xfc, rdpChannels* channels) } else { - fprintf(stderr, "%s: Error querying X Fixes extension version\n", __FUNCTION__); + DEBUG_WARN( "%s: Error querying X Fixes extension version\n", __FUNCTION__); } } else { - fprintf(stderr, "%s: Error loading X Fixes extension\n", __FUNCTION__); + DEBUG_WARN( "%s: Error loading X Fixes extension\n", __FUNCTION__); } #else - fprintf(stderr, "Warning: Using clipboard redirection without XFIXES extension is strongly discouraged!\n"); + DEBUG_WARN( "Warning: Using clipboard redirection without XFIXES extension is strongly discouraged!\n"); #endif n = 0; @@ -970,7 +970,7 @@ static BOOL xf_cliprdr_process_dib(clipboardContext* cb, BYTE* data, int size) Stream_Read_UINT16(s, bpp); if ((bpp < 1) || (bpp > 32)) { - fprintf(stderr, "%s: invalid bpp value %d", __FUNCTION__, bpp); + DEBUG_WARN( "%s: invalid bpp value %d", __FUNCTION__, bpp); return FALSE; } diff --git a/client/X11/xf_gdi.c b/client/X11/xf_gdi.c index 1ab20af..2b6bce3 100644 --- a/client/X11/xf_gdi.c +++ b/client/X11/xf_gdi.c @@ -68,7 +68,7 @@ BOOL xf_set_rop2(xfContext* xfc, int rop2) { if ((rop2 < 0x01) || (rop2 > 0x10)) { - fprintf(stderr, "Unsupported ROP2: %d\n", rop2); + DEBUG_WARN( "Unsupported ROP2: %d\n", rop2); return FALSE; } @@ -204,7 +204,7 @@ BOOL xf_set_rop3(xfContext* xfc, int rop3) if (function < 0) { - fprintf(stderr, "Unsupported ROP3: 0x%08X\n", rop3); + DEBUG_WARN( "Unsupported ROP3: 0x%08X\n", rop3); XSetFunction(xfc->display, xfc->gc, GXclear); return FALSE; } @@ -398,7 +398,7 @@ void xf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt) } else { - fprintf(stderr, "unimplemented brush style:%d\n", brush->style); + DEBUG_WARN( "unimplemented brush style:%d\n", brush->style); } if (xfc->drawing == xfc->primary) @@ -522,7 +522,7 @@ void xf_gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* mult void xf_gdi_draw_nine_grid(rdpContext* context, DRAW_NINE_GRID_ORDER* draw_nine_grid) { - fprintf(stderr, "DrawNineGrid\n"); + DEBUG_WARN( "DrawNineGrid\n"); } void xf_gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to) @@ -713,7 +713,7 @@ void xf_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt) } else { - fprintf(stderr, "Mem3Blt unimplemented brush style:%d\n", brush->style); + DEBUG_WARN( "Mem3Blt unimplemented brush style:%d\n", brush->style); } XCopyArea(xfc->display, bitmap->pixmap, xfc->drawing, xfc->gc, @@ -777,7 +777,7 @@ void xf_gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc) break; default: - fprintf(stderr, "PolygonSC unknown fillMode: %d\n", polygon_sc->fillMode); + DEBUG_WARN( "PolygonSC unknown fillMode: %d\n", polygon_sc->fillMode); break; } @@ -839,7 +839,7 @@ void xf_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb) break; default: - fprintf(stderr, "PolygonCB unknown fillMode: %d\n", polygon_cb->fillMode); + DEBUG_WARN( "PolygonCB unknown fillMode: %d\n", polygon_cb->fillMode); break; } @@ -897,7 +897,7 @@ void xf_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb) } else { - fprintf(stderr, "PolygonCB unimplemented brush style:%d\n", brush->style); + DEBUG_WARN( "PolygonCB unimplemented brush style:%d\n", brush->style); } XSetFunction(xfc->display, xfc->gc, GXcopy); @@ -908,12 +908,12 @@ void xf_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb) void xf_gdi_ellipse_sc(rdpContext* context, ELLIPSE_SC_ORDER* ellipse_sc) { - fprintf(stderr, "EllipseSC\n"); + DEBUG_WARN( "EllipseSC\n"); } void xf_gdi_ellipse_cb(rdpContext* context, ELLIPSE_CB_ORDER* ellipse_cb) { - fprintf(stderr, "EllipseCB\n"); + DEBUG_WARN( "EllipseCB\n"); } void xf_gdi_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surface_frame_marker) @@ -1111,12 +1111,12 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits } else { - fprintf(stderr, "Invalid bitmap size - data is %d bytes for %dx%d\n update", surface_bits_command->bitmapDataLength, surface_bits_command->width, surface_bits_command->height); + DEBUG_WARN( "Invalid bitmap size - data is %d bytes for %dx%d\n update", surface_bits_command->bitmapDataLength, surface_bits_command->width, surface_bits_command->height); } } else { - fprintf(stderr, "Unsupported codecID %d\n", surface_bits_command->codecID); + DEBUG_WARN( "Unsupported codecID %d\n", surface_bits_command->codecID); } xf_unlock_x11(xfc, FALSE); diff --git a/client/X11/xf_graphics.c b/client/X11/xf_graphics.c index 83e815c..7bb8c05 100644 --- a/client/X11/xf_graphics.c +++ b/client/X11/xf_graphics.c @@ -141,7 +141,7 @@ void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, switch (codec_id) { case RDP_CODEC_ID_NSCODEC: - fprintf(stderr, "xf_Bitmap_Decompress: nsc not done\n"); + DEBUG_WARN( "xf_Bitmap_Decompress: nsc not done\n"); break; case RDP_CODEC_ID_REMOTEFX: @@ -150,7 +150,7 @@ void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, if (!msg) { - fprintf(stderr, "xf_Bitmap_Decompress: rfx Decompression Failed\n"); + DEBUG_WARN( "xf_Bitmap_Decompress: rfx Decompression Failed\n"); } else { @@ -173,7 +173,7 @@ void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, case RDP_CODEC_ID_JPEG: if (!jpeg_decompress(data, bitmap->data, width, height, length, bpp)) { - fprintf(stderr, "xf_Bitmap_Decompress: jpeg Decompression Failed\n"); + DEBUG_WARN( "xf_Bitmap_Decompress: jpeg Decompression Failed\n"); } break; @@ -184,7 +184,7 @@ void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, if (!status) { - fprintf(stderr, "xf_Bitmap_Decompress: Bitmap Decompression Failed\n"); + DEBUG_WARN( "xf_Bitmap_Decompress: Bitmap Decompression Failed\n"); } } else diff --git a/client/X11/xf_input.c b/client/X11/xf_input.c index 9549bdb..067c0e7 100644 --- a/client/X11/xf_input.c +++ b/client/X11/xf_input.c @@ -624,7 +624,7 @@ int xf_input_touch_remote(xfContext* xfc, XIDeviceEvent* event, int evtype) } else if (evtype == XI_TouchUpdate) { - printf("TouchUpdate: %d\n", touchId); + DEBUG_MSG("TouchUpdate: %d\n", touchId); contactId = rdpei->TouchUpdate(rdpei, touchId, x, y); } else if (evtype == XI_TouchEnd) diff --git a/client/X11/xf_keyboard.c b/client/X11/xf_keyboard.c index 175e836..284059d 100644 --- a/client/X11/xf_keyboard.c +++ b/client/X11/xf_keyboard.c @@ -191,7 +191,7 @@ void xf_keyboard_send_key(xfContext* xfc, BOOL down, BYTE keycode) if (rdp_scancode == RDP_SCANCODE_UNKNOWN) { - fprintf(stderr, "Unknown key with X keycode 0x%02x\n", keycode); + DEBUG_WARN( "Unknown key with X keycode 0x%02x\n", keycode); } else if (rdp_scancode == RDP_SCANCODE_PAUSE && !xf_keyboard_key_pressed(xfc, XK_Control_L) && !xf_keyboard_key_pressed(xfc, XK_Control_R)) diff --git a/client/X11/xf_rail.c b/client/X11/xf_rail.c index 8b93187..039f74e 100644 --- a/client/X11/xf_rail.c +++ b/client/X11/xf_rail.c @@ -497,7 +497,7 @@ void xf_process_rail_exec_result_event(xfContext* xfc, rdpChannels* channels, wM if (exec_result->execResult != RAIL_EXEC_S_OK) { - fprintf(stderr, "RAIL exec error: execResult=%s NtError=0x%X\n", + DEBUG_WARN( "RAIL exec error: execResult=%s NtError=0x%X\n", error_code_names[exec_result->execResult], exec_result->rawResult); xfc->disconnect = True; } @@ -660,7 +660,7 @@ void xf_process_rail_appid_resp_event(xfContext* xfc, rdpChannels* channels, wMe RAIL_GET_APPID_RESP_ORDER* appid_resp = (RAIL_GET_APPID_RESP_ORDER*) event->wParam; - fprintf(stderr, "Server Application ID Response PDU: windowId=0x%X " + DEBUG_WARN( "Server Application ID Response PDU: windowId=0x%X " "applicationId=(length=%d dump)\n", appid_resp->windowId, 512); @@ -672,7 +672,7 @@ void xf_process_rail_langbarinfo_event(xfContext* xfc, rdpChannels* channels, wM RAIL_LANGBAR_INFO_ORDER* langbar = (RAIL_LANGBAR_INFO_ORDER*) event->wParam; - fprintf(stderr, "Language Bar Information PDU: languageBarStatus=0x%X\n", + DEBUG_WARN( "Language Bar Information PDU: languageBarStatus=0x%X\n", langbar->languageBarStatus); } diff --git a/client/X11/xf_tsmf.c b/client/X11/xf_tsmf.c index 131d2ea..72acb48 100644 --- a/client/X11/xf_tsmf.c +++ b/client/X11/xf_tsmf.c @@ -140,7 +140,7 @@ void xf_tsmf_init(xfContext* xfc, long xv_port) XFree(attr); #ifdef WITH_DEBUG_XV - fprintf(stderr, "xf_tsmf_init: pixel format "); + DEBUG_WARN( "xf_tsmf_init: pixel format "); #endif fo = XvListImageFormats(xfc->display, xv->xv_port, &ret); if (ret > 0) @@ -152,7 +152,7 @@ void xf_tsmf_init(xfContext* xfc, long xv_port) { xv->xv_pixfmts[i] = fo[i].id; #ifdef WITH_DEBUG_XV - fprintf(stderr, "%c%c%c%c ", ((char*)(xv->xv_pixfmts + i))[0], ((char*)(xv->xv_pixfmts + i))[1], + DEBUG_WARN( "%c%c%c%c ", ((char*)(xv->xv_pixfmts + i))[0], ((char*)(xv->xv_pixfmts + i))[1], ((char*)(xv->xv_pixfmts + i))[2], ((char*)(xv->xv_pixfmts + i))[3]); #endif } @@ -160,7 +160,7 @@ void xf_tsmf_init(xfContext* xfc, long xv_port) } XFree(fo); #ifdef WITH_DEBUG_XV - fprintf(stderr, "\n"); + DEBUG_WARN( "\n"); #endif } diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 480f9f2..a1e8b0f 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -1190,7 +1191,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings, if (compatibility) { - fprintf(stderr, "WARNING: Using deprecated command-line interface!\n"); + DEBUG_WARN( "WARNING: Using deprecated command-line interface!\n"); return freerdp_client_parse_old_command_line_arguments(argc, argv, settings); } else @@ -1374,7 +1375,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings, if (!id) { - fprintf(stderr, "Could not identify keyboard layout: %s\n", arg->Value); + DEBUG_WARN( "Could not identify keyboard layout: %s\n", arg->Value); } } @@ -1732,7 +1733,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings, } else { - fprintf(stderr, "unknown protocol security: %s\n", arg->Value); + DEBUG_WARN( "unknown protocol security: %s\n", arg->Value); } } CommandLineSwitchCase(arg, "sec-rdp") @@ -1878,7 +1879,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings, } else { - fprintf(stderr, "reconnect-cookie: invalid base64 '%s'\n", + DEBUG_WARN( "reconnect-cookie: invalid base64 '%s'\n", arg->Value); } } @@ -1943,7 +1944,7 @@ int freerdp_client_load_static_channel_addin(rdpChannels* channels, rdpSettings* { if (freerdp_channels_client_load(channels, settings, entry, data) == 0) { - fprintf(stderr, "loading channel %s\n", name); + DEBUG_WARN( "loading channel %s\n", name); return 0; } } diff --git a/client/common/compatibility.c b/client/common/compatibility.c index aeda88a..1c68c3d 100644 --- a/client/common/compatibility.c +++ b/client/common/compatibility.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -121,7 +122,7 @@ int freerdp_client_old_process_plugin(rdpSettings* settings, ADDIN_ARGV* args) if (strcmp(args->argv[0], "cliprdr") == 0) { settings->RedirectClipboard = TRUE; - fprintf(stderr, "--plugin cliprdr -> +clipboard\n"); + DEBUG_WARN( "--plugin cliprdr -> +clipboard\n"); } else if (strcmp(args->argv[0], "rdpdr") == 0) { @@ -437,37 +438,37 @@ int freerdp_client_parse_old_command_line_arguments(int argc, char** argv, rdpSe CommandLineSwitchCase(arg, "0") { settings->ConsoleSession = TRUE; - fprintf(stderr, "-0 -> /admin\n"); + DEBUG_WARN( "-0 -> /admin\n"); } CommandLineSwitchCase(arg, "a") { settings->ColorDepth = atoi(arg->Value); - fprintf(stderr, "-a %s -> /bpp:%s\n", arg->Value, arg->Value); + DEBUG_WARN( "-a %s -> /bpp:%s\n", arg->Value, arg->Value); } CommandLineSwitchCase(arg, "c") { settings->ShellWorkingDirectory = _strdup(arg->Value); - fprintf(stderr, "-c %s -> /shell-dir:%s\n", arg->Value, arg->Value); + DEBUG_WARN( "-c %s -> /shell-dir:%s\n", arg->Value, arg->Value); } CommandLineSwitchCase(arg, "D") { settings->Decorations = FALSE; - fprintf(stderr, "-D -> -decorations\n"); + DEBUG_WARN( "-D -> -decorations\n"); } CommandLineSwitchCase(arg, "T") { settings->WindowTitle = _strdup(arg->Value); - fprintf(stderr, "-T %s -> /title:%s\n", arg->Value, arg->Value); + DEBUG_WARN( "-T %s -> /title:%s\n", arg->Value, arg->Value); } CommandLineSwitchCase(arg, "d") { settings->Domain = _strdup(arg->Value); - fprintf(stderr, "-d %s -> /d:%s\n", arg->Value, arg->Value); + DEBUG_WARN( "-d %s -> /d:%s\n", arg->Value, arg->Value); } CommandLineSwitchCase(arg, "f") { settings->Fullscreen = TRUE; - fprintf(stderr, "-f -> /f\n"); + DEBUG_WARN( "-f -> /f\n"); } CommandLineSwitchCase(arg, "g") { @@ -484,50 +485,50 @@ int freerdp_client_parse_old_command_line_arguments(int argc, char** argv, rdpSe free(str); - fprintf(stderr, "-g %s -> /size:%s or /w:%d /h:%d\n", arg->Value, arg->Value, + DEBUG_WARN( "-g %s -> /size:%s or /w:%d /h:%d\n", arg->Value, arg->Value, settings->DesktopWidth, settings->DesktopHeight); } CommandLineSwitchCase(arg, "k") { sscanf(arg->Value, "%X", &(settings->KeyboardLayout)); - fprintf(stderr, "-k %s -> /kbd:%s\n", arg->Value, arg->Value); + DEBUG_WARN( "-k %s -> /kbd:%s\n", arg->Value, arg->Value); } CommandLineSwitchCase(arg, "K") { settings->GrabKeyboard = FALSE; - fprintf(stderr, "-K -> -grab-keyboard\n"); + DEBUG_WARN( "-K -> -grab-keyboard\n"); } CommandLineSwitchCase(arg, "n") { settings->ClientHostname = _strdup(arg->Value); - fprintf(stderr, "-n -> /client-hostname:%s\n", arg->Value); + DEBUG_WARN( "-n -> /client-hostname:%s\n", arg->Value); } CommandLineSwitchCase(arg, "o") { settings->RemoteConsoleAudio = TRUE; - fprintf(stderr, "-o -> /audio-mode:1\n"); + DEBUG_WARN( "-o -> /audio-mode:1\n"); } CommandLineSwitchCase(arg, "p") { settings->Password = _strdup(arg->Value); - fprintf(stderr, "-p ****** -> /p:******\n"); + DEBUG_WARN( "-p ****** -> /p:******\n"); /* Hide the value from 'ps'. */ FillMemory(arg->Value, strlen(arg->Value), '*'); } CommandLineSwitchCase(arg, "s") { settings->AlternateShell = _strdup(arg->Value); - fprintf(stderr, "-s %s -> /shell:%s\n", arg->Value, arg->Value); + DEBUG_WARN( "-s %s -> /shell:%s\n", arg->Value, arg->Value); } CommandLineSwitchCase(arg, "t") { settings->ServerPort = atoi(arg->Value); - fprintf(stderr, "-t %s -> /port:%s\n", arg->Value, arg->Value); + DEBUG_WARN( "-t %s -> /port:%s\n", arg->Value, arg->Value); } CommandLineSwitchCase(arg, "u") { settings->Username = _strdup(arg->Value); - fprintf(stderr, "-u %s -> /u:%s\n", arg->Value, arg->Value); + DEBUG_WARN( "-u %s -> /u:%s\n", arg->Value, arg->Value); } CommandLineSwitchCase(arg, "x") { @@ -555,31 +556,31 @@ int freerdp_client_parse_old_command_line_arguments(int argc, char** argv, rdpSe freerdp_performance_flags_split(settings); } - fprintf(stderr, "-x %s -> /network:", arg->Value); + DEBUG_WARN( "-x %s -> /network:", arg->Value); if (type == CONNECTION_TYPE_MODEM) - fprintf(stderr, "modem"); + DEBUG_WARN( "modem"); else if (CONNECTION_TYPE_BROADBAND_HIGH) - fprintf(stderr, "broadband"); + DEBUG_WARN( "broadband"); else if (CONNECTION_TYPE_LAN) - fprintf(stderr, "lan"); + DEBUG_WARN( "lan"); - fprintf(stderr, "\n"); + DEBUG_WARN( "\n"); } CommandLineSwitchCase(arg, "X") { settings->ParentWindowId = strtol(arg->Value, NULL, 0); - fprintf(stderr, "-X %s -> /parent-window:%s\n", arg->Value, arg->Value); + DEBUG_WARN( "-X %s -> /parent-window:%s\n", arg->Value, arg->Value); } CommandLineSwitchCase(arg, "z") { settings->CompressionEnabled = TRUE; - fprintf(stderr, "-z -> /compression\n"); + DEBUG_WARN( "-z -> /compression\n"); } CommandLineSwitchCase(arg, "app") { settings->RemoteApplicationMode = TRUE; - fprintf(stderr, "--app -> /app: + program name or alias\n"); + DEBUG_WARN( "--app -> /app: + program name or alias\n"); } CommandLineSwitchCase(arg, "ext") { @@ -588,7 +589,7 @@ int freerdp_client_parse_old_command_line_arguments(int argc, char** argv, rdpSe CommandLineSwitchCase(arg, "no-auth") { settings->Authentication = FALSE; - fprintf(stderr, "--no-auth -> -authentication\n"); + DEBUG_WARN( "--no-auth -> -authentication\n"); } CommandLineSwitchCase(arg, "authonly") { @@ -602,12 +603,12 @@ int freerdp_client_parse_old_command_line_arguments(int argc, char** argv, rdpSe { settings->FastPathInput = FALSE; settings->FastPathOutput = FALSE; - fprintf(stderr, "--no-fastpath -> -fast-path\n"); + DEBUG_WARN( "--no-fastpath -> -fast-path\n"); } CommandLineSwitchCase(arg, "no-motion") { settings->MouseMotion = FALSE; - fprintf(stderr, "--no-motion -> -mouse-motion\n"); + DEBUG_WARN( "--no-motion -> -mouse-motion\n"); } CommandLineSwitchCase(arg, "gdi") { @@ -616,26 +617,26 @@ int freerdp_client_parse_old_command_line_arguments(int argc, char** argv, rdpSe else if (strcmp(arg->Value, "hw") == 0) settings->SoftwareGdi = FALSE; - fprintf(stderr, "--gdi %s -> /gdi:%s\n", arg->Value, arg->Value); + DEBUG_WARN( "--gdi %s -> /gdi:%s\n", arg->Value, arg->Value); } CommandLineSwitchCase(arg, "no-osb") { settings->OffscreenSupportLevel = FALSE; - fprintf(stderr, "--no-osb -> -offscreen-cache\n"); + DEBUG_WARN( "--no-osb -> -offscreen-cache\n"); } CommandLineSwitchCase(arg, "no-bmp-cache") { settings->BitmapCacheEnabled = FALSE; - fprintf(stderr, "--no-bmp-cache -> -bitmap-cache\n"); + DEBUG_WARN( "--no-bmp-cache -> -bitmap-cache\n"); } CommandLineSwitchCase(arg, "plugin") { - fprintf(stderr, "--plugin -> /a, /vc, /dvc and channel-specific options\n"); + DEBUG_WARN( "--plugin -> /a, /vc, /dvc and channel-specific options\n"); } CommandLineSwitchCase(arg, "rfx") { settings->RemoteFxCodec = TRUE; - fprintf(stderr, "--rfx -> /rfx\n"); + DEBUG_WARN( "--rfx -> /rfx\n"); } CommandLineSwitchCase(arg, "rfx-mode") { @@ -644,37 +645,37 @@ int freerdp_client_parse_old_command_line_arguments(int argc, char** argv, rdpSe else if (arg->Value[0] == 'i') settings->RemoteFxCodecMode = 0x02; - fprintf(stderr, "--rfx-mode -> /rfx-mode:%s\n", settings->RemoteFxCodecMode ? "image" : "video"); + DEBUG_WARN( "--rfx-mode -> /rfx-mode:%s\n", settings->RemoteFxCodecMode ? "image" : "video"); } CommandLineSwitchCase(arg, "nsc") { settings->NSCodec = TRUE; - fprintf(stderr, "--nsc -> /nsc\n"); + DEBUG_WARN( "--nsc -> /nsc\n"); } CommandLineSwitchCase(arg, "disable-wallpaper") { settings->DisableWallpaper = TRUE; - fprintf(stderr, "--disable-wallpaper -> -wallpaper\n"); + DEBUG_WARN( "--disable-wallpaper -> -wallpaper\n"); } CommandLineSwitchCase(arg, "composition") { settings->AllowDesktopComposition = TRUE; - fprintf(stderr, "--composition -> +composition\n"); + DEBUG_WARN( "--composition -> +composition\n"); } CommandLineSwitchCase(arg, "disable-full-window-drag") { settings->DisableFullWindowDrag = TRUE; - fprintf(stderr, "--disable-full-window-drag -> -window-drag\n"); + DEBUG_WARN( "--disable-full-window-drag -> -window-drag\n"); } CommandLineSwitchCase(arg, "disable-menu-animations") { settings->DisableMenuAnims = TRUE; - fprintf(stderr, "--disable-menu-animations -> -menu-anims\n"); + DEBUG_WARN( "--disable-menu-animations -> -menu-anims\n"); } CommandLineSwitchCase(arg, "disable-theming") { settings->DisableThemes = TRUE; - fprintf(stderr, "--disable-theming -> -themes\n"); + DEBUG_WARN( "--disable-theming -> -themes\n"); } CommandLineSwitchCase(arg, "ntlm") { @@ -683,7 +684,7 @@ int freerdp_client_parse_old_command_line_arguments(int argc, char** argv, rdpSe CommandLineSwitchCase(arg, "ignore-certificate") { settings->IgnoreCertificate = TRUE; - fprintf(stderr, "--ignore-certificate -> /cert-ignore\n"); + DEBUG_WARN( "--ignore-certificate -> /cert-ignore\n"); } CommandLineSwitchCase(arg, "sec") { @@ -709,22 +710,22 @@ int freerdp_client_parse_old_command_line_arguments(int argc, char** argv, rdpSe settings->NlaSecurity = TRUE; } - fprintf(stderr, "--sec %s -> /sec:%s\n", arg->Value, arg->Value); + DEBUG_WARN( "--sec %s -> /sec:%s\n", arg->Value, arg->Value); } CommandLineSwitchCase(arg, "no-rdp") { settings->RdpSecurity = FALSE; - fprintf(stderr, "--no-rdp -> -sec-rdp\n"); + DEBUG_WARN( "--no-rdp -> -sec-rdp\n"); } CommandLineSwitchCase(arg, "no-tls") { settings->TlsSecurity = FALSE; - fprintf(stderr, "--no-tls -> -sec-tls\n"); + DEBUG_WARN( "--no-tls -> -sec-tls\n"); } CommandLineSwitchCase(arg, "no-nla") { settings->NlaSecurity = FALSE; - fprintf(stderr, "--no-nla -> -sec-nla\n"); + DEBUG_WARN( "--no-nla -> -sec-nla\n"); } CommandLineSwitchCase(arg, "secure-checksum") { @@ -739,12 +740,12 @@ int freerdp_client_parse_old_command_line_arguments(int argc, char** argv, rdpSe } while ((arg = CommandLineFindNextArgumentA(arg)) != NULL); - fprintf(stderr, "%s -> /v:%s", settings->ServerHostname, settings->ServerHostname); + DEBUG_WARN( "%s -> /v:%s", settings->ServerHostname, settings->ServerHostname); if (settings->ServerPort != 3389) - fprintf(stderr, " /port:%d", settings->ServerPort); + DEBUG_WARN( " /port:%d", settings->ServerPort); - fprintf(stderr, "\n"); + DEBUG_WARN( "\n"); return 1; } diff --git a/client/common/file.c b/client/common/file.c index c493734..fb95996 100644 --- a/client/common/file.c +++ b/client/common/file.c @@ -21,6 +21,7 @@ #include "config.h" #endif +#include #include #include @@ -54,7 +55,7 @@ BOOL freerdp_client_rdp_file_set_integer(rdpFile* file, const char* name, int va BOOL bStandard = TRUE; #ifdef DEBUG_CLIENT_FILE - fprintf(stderr, "%s:i:%d\n", name, value); + DEBUG_WARN( "%s:i:%d\n", name, value); #endif if (_stricmp(name, "use multimon") == 0) @@ -240,7 +241,7 @@ BOOL freerdp_client_rdp_file_set_string(rdpFile* file, const char* name, const c BOOL bStandard = TRUE; #ifdef DEBUG_CLIENT_FILE - fprintf(stderr, "%s:s:%s\n", name, value); + DEBUG_WARN( "%s:s:%s\n", name, value); #endif if (_stricmp(name, "username") == 0) @@ -665,7 +666,7 @@ BOOL freerdp_client_write_rdp_file(const rdpFile* file, const char* name, BOOL u if (length < 0) { - fprintf(stderr, "freerdp_client_write_rdp_file: error determining buffer size.\n"); + DEBUG_WARN( "freerdp_client_write_rdp_file: error determining buffer size.\n"); return FALSE; } @@ -673,7 +674,7 @@ BOOL freerdp_client_write_rdp_file(const rdpFile* file, const char* name, BOOL u if (freerdp_client_write_rdp_file_buffer(file, buffer, length + 1) != length) { - fprintf(stderr, "freerdp_client_write_rdp_file: error writing to output buffer\n"); + DEBUG_WARN( "freerdp_client_write_rdp_file: error writing to output buffer\n"); free(buffer); return FALSE; } -- 2.7.4