diff options
author | nicowallmeier <> | 2004-02-09 19:49:38 +0000 |
---|---|---|
committer | nicowallmeier <> | 2004-02-09 19:49:38 +0000 |
commit | 2c96fb8c98d4e0c1cb0b9df61f726ad154cfc8fb (patch) | |
tree | f661854896a83df1c5859516a22bd1d8358e8069 | |
parent | 1b5dfda14a8e3a7e132ce3a9b24e5b2cea248c39 (diff) | |
download | lcd4linux-2c96fb8c98d4e0c1cb0b9df61f726ad154cfc8fb.tar.gz |
[lcd4linux @ 2004-02-09 19:49:38 by nicowallmeier]
Minor bugfix
-rw-r--r-- | widget_text.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/widget_text.c b/widget_text.c index 15e866c..c2112e8 100644 --- a/widget_text.c +++ b/widget_text.c @@ -1,4 +1,4 @@ -/* $Id: widget_text.c,v 1.11 2004/01/30 20:57:56 reinelt Exp $ +/* $Id: widget_text.c,v 1.12 2004/02/09 19:49:38 nicowallmeier Exp $ * * simple text widget handling * @@ -21,6 +21,9 @@ * * * $Log: widget_text.c,v $ + * Revision 1.12 2004/02/09 19:49:38 nicowallmeier + * Minor bugfix + * * Revision 1.11 2004/01/30 20:57:56 reinelt * HD44780 patch from Martin Hejl * dmalloc integrated @@ -224,12 +227,12 @@ void widget_text_update (void *Self) } else { double number=R2N(&result); int width=T->width-strlen(preval)-strlen(postval); - if (width<0) width=0; int precision=T->precision; // print zero bytes so we can specify NULL as target // and get the length of the resulting string int size=snprintf (NULL, 0, "%.*f", precision, number); // number does not fit into field width: try to reduce precision + if (width<0) width=0; if (size>width && precision>0) { int delta=size-width; if (delta>precision) delta=precision; |