From e9e7da9b7adcf33dece522514c323d392913041b Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 20 Apr 2016 09:38:06 +0200 Subject: Do proper logging rather than fprintf(stderr, ...) --- common/rfb/Region.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'common/rfb/Region.cxx') diff --git a/common/rfb/Region.cxx b/common/rfb/Region.cxx index c17c5d48..beca482d 100644 --- a/common/rfb/Region.cxx +++ b/common/rfb/Region.cxx @@ -24,6 +24,7 @@ // #include +#include #include #include @@ -33,6 +34,8 @@ extern "C" { #include } +static rfb::LogWriter vlog("Region"); + // A _RectRegion must never be passed as a return parameter to the Xlib region // operations. This is because for efficiency its "rects" member has not been // allocated with Xmalloc. It is however safe to pass it as an input @@ -123,7 +126,7 @@ void rfb::Region::setExtentsAndOrderedRects(const ShortRect* extents, BOX* prevRects = xrgn->rects; xrgn->rects = (BOX*)Xrealloc((char*)xrgn->rects, nRects * sizeof(BOX)); if (!xrgn->rects) { - fprintf(stderr,"Xrealloc failed\n"); + vlog.error("Xrealloc failed"); Xfree(prevRects); return; } @@ -234,13 +237,13 @@ rfb::Rect rfb::Region::get_bounding_rect() const { void rfb::Region::debug_print(const char* prefix) const { - fprintf(stderr,"%s num rects %3ld extents %3d,%3d %3dx%3d\n", + vlog.debug("%s num rects %3ld extents %3d,%3d %3dx%3d", prefix, xrgn->numRects, xrgn->extents.x1, xrgn->extents.y1, xrgn->extents.x2-xrgn->extents.x1, xrgn->extents.y2-xrgn->extents.y1); for (int i = 0; i < xrgn->numRects; i++) { - fprintf(stderr," rect %3d,%3d %3dx%3d\n", + vlog.debug(" rect %3d,%3d %3dx%3d", xrgn->rects[i].x1, xrgn->rects[i].y1, xrgn->rects[i].x2-xrgn->rects[i].x1, xrgn->rects[i].y2-xrgn->rects[i].y1); -- cgit v1.2.3