diff options
Diffstat (limited to 'apps/misc.c')
-rw-r--r-- | apps/misc.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/apps/misc.c b/apps/misc.c index bd7aa9485b..0bbaba965b 100644 --- a/apps/misc.c +++ b/apps/misc.c | |||
@@ -139,7 +139,7 @@ const unsigned char * const unit_strings_core[] = | |||
139 | * voiced.*/ | 139 | * voiced.*/ |
140 | char *output_dyn_value(char *buf, | 140 | char *output_dyn_value(char *buf, |
141 | int buf_size, | 141 | int buf_size, |
142 | int value, | 142 | int64_t value, |
143 | const unsigned char * const *units, | 143 | const unsigned char * const *units, |
144 | unsigned int unit_count, | 144 | unsigned int unit_count, |
145 | bool binary_scale) | 145 | bool binary_scale) |
@@ -147,8 +147,9 @@ char *output_dyn_value(char *buf, | |||
147 | unsigned int scale = binary_scale ? 1024 : 1000; | 147 | unsigned int scale = binary_scale ? 1024 : 1000; |
148 | unsigned int fraction = 0; | 148 | unsigned int fraction = 0; |
149 | unsigned int unit_no = 0; | 149 | unsigned int unit_no = 0; |
150 | unsigned int value_abs = (value < 0) ? -value : value; | 150 | uint64_t value_abs = (value < 0) ? -value : value; |
151 | char tbuf[5]; | 151 | char tbuf[5]; |
152 | int value2; | ||
152 | 153 | ||
153 | while (value_abs >= scale && unit_no < (unit_count - 1)) | 154 | while (value_abs >= scale && unit_no < (unit_count - 1)) |
154 | { | 155 | { |
@@ -157,7 +158,7 @@ char *output_dyn_value(char *buf, | |||
157 | unit_no++; | 158 | unit_no++; |
158 | } | 159 | } |
159 | 160 | ||
160 | value = (value < 0) ? -value_abs : value_abs; /* preserve sign */ | 161 | value2 = (value < 0) ? -value_abs : value_abs; /* preserve sign */ |
161 | fraction = (fraction * 1000 / scale) / 10; | 162 | fraction = (fraction * 1000 / scale) / 10; |
162 | 163 | ||
163 | if (value_abs >= 100 || fraction >= 100 || !unit_no) | 164 | if (value_abs >= 100 || fraction >= 100 || !unit_no) |
@@ -170,10 +171,10 @@ char *output_dyn_value(char *buf, | |||
170 | if (buf) | 171 | if (buf) |
171 | { | 172 | { |
172 | if (*tbuf) | 173 | if (*tbuf) |
173 | snprintf(buf, buf_size, "%d%s%s%s", value, str(LANG_POINT), | 174 | snprintf(buf, buf_size, "%d%s%s%s", value2, str(LANG_POINT), |
174 | tbuf, P2STR(units[unit_no])); | 175 | tbuf, P2STR(units[unit_no])); |
175 | else | 176 | else |
176 | snprintf(buf, buf_size, "%d%s", value, P2STR(units[unit_no])); | 177 | snprintf(buf, buf_size, "%d%s", value2, P2STR(units[unit_no])); |
177 | } | 178 | } |
178 | else | 179 | else |
179 | { | 180 | { |
@@ -1851,7 +1852,7 @@ enum current_activity get_current_activity(void) | |||
1851 | * ** Extended error info truth table ** | 1852 | * ** Extended error info truth table ** |
1852 | * [ Handle ][buf_reqd] | 1853 | * [ Handle ][buf_reqd] |
1853 | * [ > 0 ][ > 0 ] buf_reqd indicates how many bytes were used | 1854 | * [ > 0 ][ > 0 ] buf_reqd indicates how many bytes were used |
1854 | * [ALOC_ERR][ > 0 ] buf_reqd indicates how many bytes are needed | 1855 | * [ALOC_ERR][ > 0 ] buf_reqd indicates how many bytes are needed |
1855 | * [ALOC_ERR][READ_ERR] there was an error reading the file or it is empty | 1856 | * [ALOC_ERR][READ_ERR] there was an error reading the file or it is empty |
1856 | */ | 1857 | */ |
1857 | int core_load_bmp(const char * filename, struct bitmap *bm, const int bmformat, | 1858 | int core_load_bmp(const char * filename, struct bitmap *bm, const int bmformat, |