From a5556469effb0b230743c4f113233dee11df90ce Mon Sep 17 00:00:00 2001 From: ehouse Date: Sun, 20 Sep 2009 05:00:23 +0000 Subject: [PATCH] fix timer formatting --- xwords4/linux/gtkdraw.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xwords4/linux/gtkdraw.c b/xwords4/linux/gtkdraw.c index c5094d746..308ece5fc 100644 --- a/xwords4/linux/gtkdraw.c +++ b/xwords4/linux/gtkdraw.c @@ -908,18 +908,19 @@ gtk_draw_score_pendingScore( DrawCtx* p_dctx, const XP_Rect* rect, } /* gtk_draw_score_pendingScore */ static void -gtkFormatTimerText( XP_UCHAR* buf, XP_S16 secondsLeft ) +gtkFormatTimerText( XP_UCHAR* buf, XP_U16 bufLen, XP_S16 secondsLeft ) { XP_U16 minutes, seconds; if ( secondsLeft < 0 ) { *buf++ = '-'; + --bufLen; secondsLeft *= -1; } minutes = secondsLeft / 60; seconds = secondsLeft % 60; - XP_SNPRINTF( buf, VSIZE(buf), "% 1d:%02d", minutes, seconds ); + XP_SNPRINTF( buf, bufLen, "% 1d:%02d", minutes, seconds ); } /* gtkFormatTimerText */ static void @@ -930,7 +931,7 @@ gtk_draw_drawTimer( DrawCtx* p_dctx, const XP_Rect* rInner, GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; XP_UCHAR buf[10]; - gtkFormatTimerText( buf, secondsLeft ); + gtkFormatTimerText( buf, VSIZE(buf), secondsLeft ); /* gdk_gc_set_clip_rectangle( dctx->drawGC, (GdkRectangle*)rInner ); */ gtkEraseRect( dctx, rInner );