aboutsummaryrefslogtreecommitdiffstats
path: root/widget_text.c
diff options
context:
space:
mode:
authornicowallmeier <nicowallmeier@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-02-09 19:49:38 +0000
committernicowallmeier <nicowallmeier@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-02-09 19:49:38 +0000
commitd70e873199b43dc3dc273e74d05642606d0e2463 (patch)
treef661854896a83df1c5859516a22bd1d8358e8069 /widget_text.c
parent638d38bae126f1c2a7c27b39c2903575aada19c6 (diff)
downloadlcd4linux-d70e873199b43dc3dc273e74d05642606d0e2463.tar.gz
[lcd4linux @ 2004-02-09 19:49:38 by nicowallmeier]
Minor bugfix git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@359 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'widget_text.c')
-rw-r--r--widget_text.c7
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;