From 8606ae9a83a7f7904b1b2c918d41718d50d8f029 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Fri, 22 Feb 2019 15:48:17 +0100 Subject: [PATCH] WINGs: simplify code It looks like the original code was expecting the side effect of specifying a length in the %d to smartly truncate the number, which it does not. The new code has the same behaviour without extra complexity. Signed-off-by: Christophe CURIS --- WINGs/wruler.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/WINGs/wruler.c b/WINGs/wruler.c index 18f9cb77..f1ff8626 100644 --- a/WINGs/wruler.c +++ b/WINGs/wruler.c @@ -181,10 +181,7 @@ static void drawRulerOnPixmap(Ruler * rPtr) XDrawLine(rPtr->view->screen->display, rPtr->drawBuffer, rPtr->fgGC, rPtr->margins.left + m, 23, rPtr->margins.left + m, marks[i % 8] + 23); if (i != 0 && i % 8 == 0) { - if (j < 10) - snprintf(c, 3, "%d", ++j); - else - snprintf(c, 3, "%2d", ++j); + snprintf(c, sizeof(c), "%d", ++j); WMDrawString(rPtr->view->screen, rPtr->drawBuffer, rPtr->fg, rPtr->font, rPtr->margins.left + 2 + m, 26, c, 2); }