Replaced fprintf error messages with WLog.

This commit is contained in:
Armin Novak 2014-11-16 12:21:38 +01:00
parent 6de22298d0
commit 8d4589b1e1
9 changed files with 85 additions and 70 deletions

View File

@ -23,6 +23,7 @@
#include <unistd.h> #include <unistd.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <freerdp/log.h>
#include <freerdp/freerdp.h> #include <freerdp/freerdp.h>
#include <freerdp/client/cmdline.h> #include <freerdp/client/cmdline.h>
#include <freerdp/channels/channels.h> #include <freerdp/channels/channels.h>
@ -30,6 +31,8 @@
#include <wayland-client.h> #include <wayland-client.h>
#define TAG CLIENT_TAG("wayland")
struct display struct display
{ {
struct wl_display* display; struct wl_display* display;
@ -101,7 +104,7 @@ static void window_redraw(void* data, struct wl_callback* callback, uint32_t tim
fdt = ftruncate(fd, window->width * window->height * 4); fdt = ftruncate(fd, window->width * window->height * 4);
if (fdt != 0) if (fdt != 0)
{ {
fprintf(stderr, "window_redraw: could not allocate memory\n"); WLog_ERR(TAG, "window_redraw: could not allocate memory");
close(fd); close(fd);
return; return;
} }
@ -109,7 +112,7 @@ static void window_redraw(void* data, struct wl_callback* callback, uint32_t tim
buffer->shm_data = mmap(0, window->width * window->height * 4, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); buffer->shm_data = mmap(0, window->width * window->height * 4, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (buffer->shm_data == MAP_FAILED) if (buffer->shm_data == MAP_FAILED)
{ {
fprintf(stderr, "window_redraw: failed to memory map buffer\n"); WLog_ERR(TAG, "window_redraw: failed to memory map buffer");
close(fd); close(fd);
return; return;
} }
@ -220,8 +223,8 @@ BOOL wl_pre_connect(freerdp* instance)
if (!display->display) if (!display->display)
{ {
fprintf(stderr, "wl_pre_connect: failed to connect to Wayland compositor\n"); WLog_ERR(TAG, "wl_pre_connect: failed to connect to Wayland compositor");
fprintf(stderr, "Please check that the XDG_RUNTIME_DIR environment variable is properly set.\n"); WLog_ERR(TAG, "Please check that the XDG_RUNTIME_DIR environment variable is properly set.");
free(display); free(display);
return FALSE; return FALSE;
} }
@ -232,7 +235,7 @@ BOOL wl_pre_connect(freerdp* instance)
if (!display->compositor || !display->shell || !display->shm) if (!display->compositor || !display->shell || !display->shm)
{ {
fprintf(stderr, "wl_pre_connect: failed to find needed compositor interfaces\n"); WLog_ERR(TAG, "wl_pre_connect: failed to find needed compositor interfaces");
free(display); free(display);
return FALSE; return FALSE;
} }

View File

@ -20,11 +20,14 @@
#include "config.h" #include "config.h"
#endif #endif
#include <freerdp/log.h>
#include <winpr/tchar.h> #include <winpr/tchar.h>
#include <winpr/print.h> #include <winpr/print.h>
#include "wf_rail.h" #include "wf_rail.h"
#define TAG CLIENT_TAG("windows")
#define GET_X_LPARAM(lParam) ((UINT16) (lParam & 0xFFFF)) #define GET_X_LPARAM(lParam) ((UINT16) (lParam & 0xFFFF))
#define GET_Y_LPARAM(lParam) ((UINT16) ((lParam >> 16) & 0xFFFF)) #define GET_Y_LPARAM(lParam) ((UINT16) ((lParam >> 16) & 0xFFFF))
@ -99,7 +102,7 @@ void PrintWindowStyles(UINT32 style)
{ {
int i; int i;
fprintf(stderr, "\tWindow Styles:\n\t{\n"); WLog_INFO(TAG, "\tWindow Styles:\t{");
for (i = 0; i < ARRAYSIZE(WINDOW_STYLES); i++) for (i = 0; i < ARRAYSIZE(WINDOW_STYLES); i++)
{ {
if (style & WINDOW_STYLES[i].style) if (style & WINDOW_STYLES[i].style)
@ -110,17 +113,16 @@ void PrintWindowStyles(UINT32 style)
continue; continue;
} }
fprintf(stderr, "\t\t%s\n", WINDOW_STYLES[i].name); WLog_INFO(TAG, "\t\t%s", WINDOW_STYLES[i].name);
} }
} }
fprintf(stderr, "\t}\n");
} }
void PrintExtendedWindowStyles(UINT32 style) void PrintExtendedWindowStyles(UINT32 style)
{ {
int i; int i;
fprintf(stderr, "\tExtended Window Styles:\n\t{\n"); WLog_INFO(TAG, "\tExtended Window Styles:\t{");
for (i = 0; i < ARRAYSIZE(EXTENDED_WINDOW_STYLES); i++) for (i = 0; i < ARRAYSIZE(EXTENDED_WINDOW_STYLES); i++)
{ {
if (style & EXTENDED_WINDOW_STYLES[i].style) if (style & EXTENDED_WINDOW_STYLES[i].style)
@ -131,29 +133,28 @@ void PrintExtendedWindowStyles(UINT32 style)
continue; continue;
} }
fprintf(stderr, "\t\t%s\n", EXTENDED_WINDOW_STYLES[i].name); WLog_INFO(TAG, "\t\t%s", EXTENDED_WINDOW_STYLES[i].name);
} }
} }
fprintf(stderr, "\t}\n");
} }
void PrintRailWindowState(WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* windowState) void PrintRailWindowState(WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* windowState)
{ {
if (orderInfo->fieldFlags & WINDOW_ORDER_STATE_NEW) if (orderInfo->fieldFlags & WINDOW_ORDER_STATE_NEW)
fprintf(stderr, "WindowCreate: WindowId: 0x%04X\n", orderInfo->windowId); WLog_INFO(TAG, "WindowCreate: WindowId: 0x%04X", orderInfo->windowId);
else else
fprintf(stderr, "WindowUpdate: WindowId: 0x%04X\n", orderInfo->windowId); WLog_INFO(TAG, "WindowUpdate: WindowId: 0x%04X", orderInfo->windowId);
fprintf(stderr, "{\n"); WLog_INFO(TAG, "{");
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_OWNER) if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_OWNER)
{ {
fprintf(stderr, "\tOwnerWindowId: 0x%04X\n", windowState->ownerWindowId); WLog_INFO(TAG, "\tOwnerWindowId: 0x%04X", windowState->ownerWindowId);
} }
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_STYLE) if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_STYLE)
{ {
fprintf(stderr, "\tStyle: 0x%04X ExtendedStyle: 0x%04X\n", WLog_INFO(TAG, "\tStyle: 0x%04X ExtendedStyle: 0x%04X",
windowState->style, windowState->extendedStyle); windowState->style, windowState->extendedStyle);
PrintWindowStyles(windowState->style); PrintWindowStyles(windowState->style);
@ -162,7 +163,7 @@ void PrintRailWindowState(WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* wind
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_SHOW) if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_SHOW)
{ {
fprintf(stderr, "\tShowState: %d\n", windowState->showState); WLog_INFO(TAG, "\tShowState: %d", windowState->showState);
} }
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_TITLE) if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_TITLE)
@ -172,7 +173,7 @@ void PrintRailWindowState(WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* wind
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) windowState->titleInfo.string, ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) windowState->titleInfo.string,
windowState->titleInfo.length / 2, &title, 0, NULL, NULL); windowState->titleInfo.length / 2, &title, 0, NULL, NULL);
fprintf(stderr, "\tTitleInfo: %s (length = %d)\n", title, WLog_INFO(TAG, "\tTitleInfo: %s (length = %d)", title,
windowState->titleInfo.length); windowState->titleInfo.length);
free(title); free(title);
@ -180,41 +181,41 @@ void PrintRailWindowState(WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* wind
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET) if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET)
{ {
fprintf(stderr, "\tClientOffsetX: %d ClientOffsetY: %d\n", WLog_INFO(TAG, "\tClientOffsetX: %d ClientOffsetY: %d",
windowState->clientOffsetX, windowState->clientOffsetY); windowState->clientOffsetX, windowState->clientOffsetY);
} }
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE) if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE)
{ {
fprintf(stderr, "\tClientAreaWidth: %d ClientAreaHeight: %d\n", WLog_INFO(TAG, "\tClientAreaWidth: %d ClientAreaHeight: %d",
windowState->clientAreaWidth, windowState->clientAreaHeight); windowState->clientAreaWidth, windowState->clientAreaHeight);
} }
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_RP_CONTENT) if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_RP_CONTENT)
{ {
fprintf(stderr, "\tRPContent: %d\n", windowState->RPContent); WLog_INFO(TAG, "\tRPContent: %d", windowState->RPContent);
} }
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ROOT_PARENT) if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ROOT_PARENT)
{ {
fprintf(stderr, "\tRootParentHandle: 0x%04X\n", windowState->rootParentHandle); WLog_INFO(TAG, "\tRootParentHandle: 0x%04X", windowState->rootParentHandle);
} }
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET) if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET)
{ {
fprintf(stderr, "\tWindowOffsetX: %d WindowOffsetY: %d\n", WLog_INFO(TAG, "\tWindowOffsetX: %d WindowOffsetY: %d",
windowState->windowOffsetX, windowState->windowOffsetY); windowState->windowOffsetX, windowState->windowOffsetY);
} }
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_CLIENT_DELTA) if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_CLIENT_DELTA)
{ {
fprintf(stderr, "\tWindowClientDeltaX: %d WindowClientDeltaY: %d\n", WLog_INFO(TAG, "\tWindowClientDeltaX: %d WindowClientDeltaY: %d",
windowState->windowClientDeltaX, windowState->windowClientDeltaY); windowState->windowClientDeltaX, windowState->windowClientDeltaY);
} }
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE) if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE)
{ {
fprintf(stderr, "\tWindowWidth: %d WindowHeight: %d\n", WLog_INFO(TAG, "\tWindowWidth: %d WindowHeight: %d",
windowState->windowWidth, windowState->windowHeight); windowState->windowWidth, windowState->windowHeight);
} }
@ -223,20 +224,20 @@ void PrintRailWindowState(WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* wind
UINT32 index; UINT32 index;
RECTANGLE_16* rect; RECTANGLE_16* rect;
fprintf(stderr, "\tnumWindowRects: %d\n", windowState->numWindowRects); WLog_INFO(TAG, "\tnumWindowRects: %d", windowState->numWindowRects);
for (index = 0; index < windowState->numWindowRects; index++) for (index = 0; index < windowState->numWindowRects; index++)
{ {
rect = &windowState->windowRects[index]; rect = &windowState->windowRects[index];
fprintf(stderr, "\twindowRect[%d]: left: %d top: %d right: %d bottom: %d\n", WLog_INFO(TAG, "\twindowRect[%d]: left: %d top: %d right: %d bottom: %d",
index, rect->left, rect->top, rect->right, rect->bottom); index, rect->left, rect->top, rect->right, rect->bottom);
} }
} }
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_VIS_OFFSET) if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_VIS_OFFSET)
{ {
fprintf(stderr, "\tvisibileOffsetX: %d visibleOffsetY: %d\n", WLog_INFO(TAG, "\tvisibileOffsetX: %d visibleOffsetY: %d",
windowState->visibleOffsetX, windowState->visibleOffsetY); windowState->visibleOffsetX, windowState->visibleOffsetY);
} }
@ -245,39 +246,39 @@ void PrintRailWindowState(WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* wind
UINT32 index; UINT32 index;
RECTANGLE_16* rect; RECTANGLE_16* rect;
fprintf(stderr, "\tnumVisibilityRects: %d\n", windowState->numVisibilityRects); WLog_INFO(TAG, "\tnumVisibilityRects: %d", windowState->numVisibilityRects);
for (index = 0; index < windowState->numVisibilityRects; index++) for (index = 0; index < windowState->numVisibilityRects; index++)
{ {
rect = &windowState->visibilityRects[index]; rect = &windowState->visibilityRects[index];
fprintf(stderr, "\tvisibilityRect[%d]: left: %d top: %d right: %d bottom: %d\n", WLog_INFO(TAG, "\tvisibilityRect[%d]: left: %d top: %d right: %d bottom: %d",
index, rect->left, rect->top, rect->right, rect->bottom); index, rect->left, rect->top, rect->right, rect->bottom);
} }
} }
fprintf(stderr, "}\n"); WLog_INFO(TAG, "}");
} }
static void PrintRailIconInfo(WINDOW_ORDER_INFO* orderInfo, ICON_INFO* iconInfo) static void PrintRailIconInfo(WINDOW_ORDER_INFO* orderInfo, ICON_INFO* iconInfo)
{ {
fprintf(stderr, "ICON_INFO\n"); WLog_INFO(TAG, "ICON_INFO");
fprintf(stderr, "{\n"); WLog_INFO(TAG, "{");
fprintf(stderr, "\tbigIcon: %s\n", (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ICON_BIG) ? "true" : "false"); WLog_INFO(TAG, "\tbigIcon: %s", (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ICON_BIG) ? "true" : "false");
fprintf(stderr, "\tcacheEntry; 0x%04X\n", iconInfo->cacheEntry); WLog_INFO(TAG, "\tcacheEntry; 0x%04X", iconInfo->cacheEntry);
fprintf(stderr, "\tcacheId: 0x%04X\n", iconInfo->cacheId); WLog_INFO(TAG, "\tcacheId: 0x%04X", iconInfo->cacheId);
fprintf(stderr, "\tbpp: %d\n", iconInfo->bpp); WLog_INFO(TAG, "\tbpp: %d", iconInfo->bpp);
fprintf(stderr, "\twidth: %d\n", iconInfo->width); WLog_INFO(TAG, "\twidth: %d", iconInfo->width);
fprintf(stderr, "\theight: %d\n", iconInfo->height); WLog_INFO(TAG, "\theight: %d", iconInfo->height);
fprintf(stderr, "\tcbColorTable: %d\n", iconInfo->cbColorTable); WLog_INFO(TAG, "\tcbColorTable: %d", iconInfo->cbColorTable);
fprintf(stderr, "\tcbBitsMask: %d\n", iconInfo->cbBitsMask); WLog_INFO(TAG, "\tcbBitsMask: %d", iconInfo->cbBitsMask);
fprintf(stderr, "\tcbBitsColor: %d\n", iconInfo->cbBitsColor); WLog_INFO(TAG, "\tcbBitsColor: %d", iconInfo->cbBitsColor);
fprintf(stderr, "\tcolorTable: %p\n", iconInfo->colorTable); WLog_INFO(TAG, "\tcolorTable: %p", iconInfo->colorTable);
fprintf(stderr, "\tbitsMask: %p\n", iconInfo->bitsMask); WLog_INFO(TAG, "\tbitsMask: %p", iconInfo->bitsMask);
fprintf(stderr, "\tbitsColor: %p\n", iconInfo->bitsColor); WLog_INFO(TAG, "\tbitsColor: %p", iconInfo->bitsColor);
fprintf(stderr, "}\n"); WLog_INFO(TAG, "}");
} }
LRESULT CALLBACK wf_RailWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK wf_RailWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
@ -650,7 +651,7 @@ static void wf_rail_window_delete(rdpContext* context, WINDOW_ORDER_INFO* orderI
wfContext* wfc = (wfContext*) context; wfContext* wfc = (wfContext*) context;
RailClientContext* rail = wfc->rail; RailClientContext* rail = wfc->rail;
fprintf(stderr, "RailWindowDelete\n"); WLog_DBG(TAG, "RailWindowDelete");
railWindow = (wfRailWindow*) HashTable_GetItemValue(wfc->railWindows, railWindow = (wfRailWindow*) HashTable_GetItemValue(wfc->railWindows,
(void*) (UINT_PTR) orderInfo->windowId); (void*) (UINT_PTR) orderInfo->windowId);
@ -680,7 +681,7 @@ static void wf_rail_window_icon(rdpContext* context, WINDOW_ORDER_INFO* orderInf
wfContext* wfc = (wfContext*) context; wfContext* wfc = (wfContext*) context;
RailClientContext* rail = wfc->rail; RailClientContext* rail = wfc->rail;
fprintf(stderr, "RailWindowIcon\n"); WLog_DBG(TAG, "RailWindowIcon");
PrintRailIconInfo(orderInfo, windowIcon->iconInfo); PrintRailIconInfo(orderInfo, windowIcon->iconInfo);
@ -750,7 +751,7 @@ static void wf_rail_window_icon(rdpContext* context, WINDOW_ORDER_INFO* orderInf
static void wf_rail_window_cached_icon(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_CACHED_ICON_ORDER* windowCachedIcon) static void wf_rail_window_cached_icon(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_CACHED_ICON_ORDER* windowCachedIcon)
{ {
fprintf(stderr, "RailWindowCachedIcon\n"); WLog_DBG(TAG, "RailWindowCachedIcon");
} }
static void wf_rail_notify_icon_common(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notifyIconState) static void wf_rail_notify_icon_common(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notifyIconState)
@ -793,7 +794,7 @@ static void wf_rail_notify_icon_create(rdpContext* context, WINDOW_ORDER_INFO* o
wfContext* wfc = (wfContext*) context; wfContext* wfc = (wfContext*) context;
RailClientContext* rail = wfc->rail; RailClientContext* rail = wfc->rail;
fprintf(stderr, "RailNotifyIconCreate\n"); WLog_DBG(TAG, "RailNotifyIconCreate");
wf_rail_notify_icon_common(context, orderInfo, notifyIconState); wf_rail_notify_icon_common(context, orderInfo, notifyIconState);
} }
@ -803,7 +804,7 @@ static void wf_rail_notify_icon_update(rdpContext* context, WINDOW_ORDER_INFO* o
wfContext* wfc = (wfContext*) context; wfContext* wfc = (wfContext*) context;
RailClientContext* rail = wfc->rail; RailClientContext* rail = wfc->rail;
fprintf(stderr, "RailNotifyIconUpdate\n"); WLog_DBG(TAG, "RailNotifyIconUpdate");
wf_rail_notify_icon_common(context, orderInfo, notifyIconState); wf_rail_notify_icon_common(context, orderInfo, notifyIconState);
} }
@ -813,7 +814,7 @@ static void wf_rail_notify_icon_delete(rdpContext* context, WINDOW_ORDER_INFO* o
wfContext* wfc = (wfContext*) context; wfContext* wfc = (wfContext*) context;
RailClientContext* rail = wfc->rail; RailClientContext* rail = wfc->rail;
fprintf(stderr, "RailNotifyIconDelete\n"); WLog_DBG(TAG, "RailNotifyIconDelete");
} }
static void wf_rail_monitored_desktop(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, MONITORED_DESKTOP_ORDER* monitoredDesktop) static void wf_rail_monitored_desktop(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, MONITORED_DESKTOP_ORDER* monitoredDesktop)
@ -821,7 +822,7 @@ static void wf_rail_monitored_desktop(rdpContext* context, WINDOW_ORDER_INFO* or
wfContext* wfc = (wfContext*) context; wfContext* wfc = (wfContext*) context;
RailClientContext* rail = wfc->rail; RailClientContext* rail = wfc->rail;
fprintf(stderr, "RailMonitorDesktop\n"); WLog_DBG(TAG, "RailMonitorDesktop");
} }
static void wf_rail_non_monitored_desktop(rdpContext* context, WINDOW_ORDER_INFO* orderInfo) static void wf_rail_non_monitored_desktop(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
@ -829,7 +830,7 @@ static void wf_rail_non_monitored_desktop(rdpContext* context, WINDOW_ORDER_INFO
wfContext* wfc = (wfContext*) context; wfContext* wfc = (wfContext*) context;
RailClientContext* rail = wfc->rail; RailClientContext* rail = wfc->rail;
fprintf(stderr, "RailNonMonitorDesktop\n"); WLog_DBG(TAG, "RailNonMonitorDesktop");
} }
void wf_rail_register_update_callbacks(rdpUpdate* update) void wf_rail_register_update_callbacks(rdpUpdate* update)
@ -852,7 +853,7 @@ void wf_rail_register_update_callbacks(rdpUpdate* update)
static int wf_rail_server_execute_result(RailClientContext* context, RAIL_EXEC_RESULT_ORDER* execResult) static int wf_rail_server_execute_result(RailClientContext* context, RAIL_EXEC_RESULT_ORDER* execResult)
{ {
fprintf(stderr, "RailServerExecuteResult: 0x%04X\n", execResult->rawResult); WLog_DBG(TAG, "RailServerExecuteResult: 0x%04X", execResult->rawResult);
return 1; return 1;
} }

View File

@ -28,10 +28,13 @@
#include <winpr/crt.h> #include <winpr/crt.h>
#include <freerdp/api.h> #include <freerdp/api.h>
#include <freerdp/log.h>
#include <freerdp/freerdp.h> #include <freerdp/freerdp.h>
#include <freerdp/primitives.h> #include <freerdp/primitives.h>
#include <freerdp/codec/color.h> #include <freerdp/codec/color.h>
#define TAG FREERDP_TAG("color")
int freerdp_get_pixel(BYTE* data, int x, int y, int width, int height, int bpp) int freerdp_get_pixel(BYTE* data, int x, int y, int width, int height, int bpp)
{ {
int start; int start;
@ -1372,7 +1375,7 @@ int freerdp_image_copy_from_monochrome(BYTE* pDstData, UINT32 DstFormat, int nDs
return 1; return 1;
} }
fprintf(stderr, "freerdp_image_copy_from_monochrome failure: dstBytesPerPixel: %d dstBitsPerPixel: %d\n", WLog_ERR(TAG, "failure: dstBytesPerPixel: %d dstBitsPerPixel: %d",
dstBytesPerPixel, dstBitsPerPixel); dstBytesPerPixel, dstBitsPerPixel);
return -1; return -1;
@ -1563,7 +1566,7 @@ int freerdp_image_copy_from_pointer_data(BYTE* pDstData, UINT32 DstFormat, int n
} }
} }
fprintf(stderr, "freerdp_image_copy_from_pointer_data: failed to convert from %d bpp to %d bpp\n", WLog_ERR(TAG, "failed to convert from %d bpp to %d bpp",
xorBpp, dstBitsPerPixel); xorBpp, dstBitsPerPixel);
return -1; return -1;
@ -3312,7 +3315,7 @@ int freerdp_image_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst,
dstBitsPerPixel = FREERDP_PIXEL_FORMAT_DEPTH(DstFormat); dstBitsPerPixel = FREERDP_PIXEL_FORMAT_DEPTH(DstFormat);
dstBytesPerPixel = (FREERDP_PIXEL_FORMAT_BPP(DstFormat) / 8); dstBytesPerPixel = (FREERDP_PIXEL_FORMAT_BPP(DstFormat) / 8);
fprintf(stderr, "freerdp_image_copy failure: src: %d/%d dst: %d/%d\n", WLog_ERR(TAG, "failure: src: %d/%d dst: %d/%d",
srcBitsPerPixel, srcBytesPerPixel, dstBitsPerPixel, dstBytesPerPixel); srcBitsPerPixel, srcBytesPerPixel, dstBitsPerPixel, dstBytesPerPixel);
} }

View File

@ -22,6 +22,9 @@
#endif #endif
#include <freerdp/codec/interleaved.h> #include <freerdp/codec/interleaved.h>
#include <freerdp/log.h>
#define TAG FREERDP_TAG("codec")
/* /*
RLE Compressed Bitmap Stream (RLE_BITMAP_STREAM) RLE Compressed Bitmap Stream (RLE_BITMAP_STREAM)
@ -363,13 +366,13 @@ int interleaved_compress(BITMAP_INTERLEAVED_CONTEXT* interleaved, BYTE* pDstData
if (nWidth % 4) if (nWidth % 4)
{ {
fprintf(stderr, "interleaved_compress: width is not a multiple of 4\n"); WLog_ERR(TAG, "interleaved_compress: width is not a multiple of 4");
return -1; return -1;
} }
if ((nWidth > 64) || (nHeight > 64)) if ((nWidth > 64) || (nHeight > 64))
{ {
fprintf(stderr, "interleaved_compress: width (%d) or height (%d) is greater than 64\n", nWidth, nHeight); WLog_ERR(TAG, "interleaved_compress: width (%d) or height (%d) is greater than 64", nWidth, nHeight);
return -1; return -1;
} }

View File

@ -2731,7 +2731,7 @@ BOOL rdp_read_bitmap_codecs_capability_set(wStream* s, UINT16 length, rdpSetting
if (Stream_GetPosition(s) != end) if (Stream_GetPosition(s) != end)
{ {
fprintf(stderr, "error while reading codec properties: actual offset: %d expected offset: %d\n", WLog_ERR(TAG, "error while reading codec properties: actual offset: %d expected offset: %d",
(int) Stream_GetPosition(s), end); (int) Stream_GetPosition(s), end);
Stream_SetPosition(s, end); Stream_SetPosition(s, end);
} }

View File

@ -603,7 +603,7 @@ BOOL tcp_connect(rdpTcp* tcp, const char* hostname, int port, int timeout)
status = getaddrinfo(hostname, port_str, &hints, &result); status = getaddrinfo(hostname, port_str, &hints, &result);
if (status) { if (status) {
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(status)); WLog_ERR(TAG, "getaddrinfo: %s", gai_strerror(status));
return FALSE; return FALSE;
} }
@ -627,7 +627,7 @@ BOOL tcp_connect(rdpTcp* tcp, const char* hostname, int port, int timeout)
} }
if (connect(tcp->sockfd, tmp->ai_addr, tmp->ai_addrlen) < 0) { if (connect(tcp->sockfd, tmp->ai_addr, tmp->ai_addrlen) < 0) {
fprintf(stderr, "connect: %s\n", strerror(errno)); WLog_ERR(TAG, "connect: %s", strerror(errno));
freeaddrinfo(result); freeaddrinfo(result);
return FALSE; return FALSE;
} }

View File

@ -20,10 +20,13 @@
#include "config.h" #include "config.h"
#endif #endif
#include <freerdp/log.h>
#include <rdtk/rdtk.h> #include <rdtk/rdtk.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#define TAG "rdtk.sample"
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
GC gc; GC gc;
@ -56,7 +59,7 @@ int main(int argc, char** argv)
if (!display) if (!display)
{ {
fprintf(stderr, "Cannot open display\n"); WLog_ERR(TAG, "Cannot open display");
exit(1); exit(1);
} }

View File

@ -171,7 +171,7 @@ int x11_shadow_pam_authenticate(x11ShadowSubsystem* subsystem, const char* user,
if (pam_status != PAM_SUCCESS) if (pam_status != PAM_SUCCESS)
{ {
fprintf(stderr, "pam_start failure: %s\n", pam_strerror(info->handle, pam_status)); WLog_ERR(TAG, "pam_start failure: %s", pam_strerror(info->handle, pam_status));
free(info); free(info);
return -1; return -1;
} }
@ -180,7 +180,7 @@ int x11_shadow_pam_authenticate(x11ShadowSubsystem* subsystem, const char* user,
if (pam_status != PAM_SUCCESS) if (pam_status != PAM_SUCCESS)
{ {
fprintf(stderr, "pam_authenticate failure: %s\n", pam_strerror(info->handle, pam_status)); WLog_ERR(TAG, "pam_authenticate failure: %s", pam_strerror(info->handle, pam_status));
free(info); free(info);
return -1; return -1;
} }
@ -189,7 +189,7 @@ int x11_shadow_pam_authenticate(x11ShadowSubsystem* subsystem, const char* user,
if (pam_status != PAM_SUCCESS) if (pam_status != PAM_SUCCESS)
{ {
fprintf(stderr, "pam_acct_mgmt failure: %s\n", pam_strerror(info->handle, pam_status)); WLog_ERR(TAG, "pam_acct_mgmt failure: %s", pam_strerror(info->handle, pam_status));
free(info); free(info);
return -1; return -1;
} }
@ -1133,7 +1133,7 @@ int x11_shadow_subsystem_init(x11ShadowSubsystem* subsystem)
if ((subsystem->depth != 24) && (subsystem->depth != 32)) if ((subsystem->depth != 24) && (subsystem->depth != 32))
{ {
fprintf(stderr, "x11_shadow_subsystem_init: unsupported X11 server color depth: %d\n", subsystem->depth); WLog_ERR(TAG, "unsupported X11 server color depth: %d", subsystem->depth);
return -1; return -1;
} }

View File

@ -22,6 +22,7 @@
#endif #endif
#include <winpr/crt.h> #include <winpr/crt.h>
#include <winpr/log.h>
#include <winpr/io.h> #include <winpr/io.h>
#include <winpr/nt.h> #include <winpr/nt.h>
#include <winpr/library.h> #include <winpr/library.h>
@ -33,6 +34,7 @@
#include "wtsapi.h" #include "wtsapi.h"
#define WTSAPI_CHANNEL_MAGIC 0x44484356 #define WTSAPI_CHANNEL_MAGIC 0x44484356
#define TAG WINPR_TAG("wtsapi")
struct _WTSAPI_CHANNEL struct _WTSAPI_CHANNEL
{ {
@ -108,13 +110,13 @@ BOOL Win32_WTSVirtualChannelReadAsync(WTSAPI_CHANNEL* pChannel)
if (status) if (status)
{ {
fprintf(stderr, "Unexpected ReadFile status: %d numBytes: %d\n", status, numBytes); WLog_ERR(TAG, "Unexpected ReadFile status: %d numBytes: %d", status, numBytes);
return FALSE; /* ReadFile should return FALSE and set ERROR_IO_PENDING */ return FALSE; /* ReadFile should return FALSE and set ERROR_IO_PENDING */
} }
if (GetLastError() != ERROR_IO_PENDING) if (GetLastError() != ERROR_IO_PENDING)
{ {
fprintf(stderr, "ReadFile: GetLastError() = %d\n", GetLastError()); WLog_ERR(TAG, "ReadFile: GetLastError() = %d", GetLastError());
return FALSE; return FALSE;
} }