summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@fedora-arm.domain.avtechpulse.com>1999-12-31 19:27:20 -0500
committerroot <root@fedora-arm.domain.avtechpulse.com>1999-12-31 19:27:20 -0500
commitce20f1608a89a695ee5df57d42e2f0eda6979de2 (patch)
treeeb8632157c2e343d020c3d17d65691fe5e9a80d1
parent18782fcc486fe5a9d0901a73d2af3eebfca95b00 (diff)
fix encoder string/number handling
-rw-r--r--menus.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/menus.c b/menus.c
index 3179abf..8d45e33 100644
--- a/menus.c
+++ b/menus.c
@@ -2520,8 +2520,10 @@ static void Submenu_Service_Encoder(int encoder_change)
}
/* get first digit of new number */
- gchar* new_string = g_strdup_printf (" %d %s", equivalent_integer, expon);
+ gchar* int_string = g_strdup_printf ("%d", equivalent_integer);
+ gchar* new_string = g_strdup_printf (" %c.%s%s", int_string[0], int_string+1, expon);
g_free (expon);
+ g_free (int_string);
/* put in sign if required */
if (Submenu_Value<0) {
@@ -2529,10 +2531,9 @@ static void Submenu_Service_Encoder(int encoder_change)
}
// "moves" fractional digits to rear, to make room for the decimal point
- sprintf(new_string+2, "%d", equivalent_integer);
- new_string[2]='.';
new_value=atof(new_string);
+
if (equivalent_integer>9999) {
new_value*=10;
}