summaryrefslogtreecommitdiff
path: root/apps/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/misc.c')
-rw-r--r--apps/misc.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/apps/misc.c b/apps/misc.c
index d8caabd397..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.*/
140char *output_dyn_value(char *buf, 140char *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 {
@@ -200,7 +201,7 @@ bool warn_on_pl_erase(void)
200 return true; 201 return true;
201} 202}
202 203
203bool show_search_progress(bool init, int count) 204bool show_search_progress(bool init, int display_count, int current, int total)
204{ 205{
205 static int last_tick = 0; 206 static int last_tick = 0;
206 207
@@ -214,7 +215,15 @@ bool show_search_progress(bool init, int count)
214 /* Update progress every 1/10 of a second */ 215 /* Update progress every 1/10 of a second */
215 if (TIME_AFTER(current_tick, last_tick + HZ/10)) 216 if (TIME_AFTER(current_tick, last_tick + HZ/10))
216 { 217 {
217 splashf(0, str(LANG_PLAYLIST_SEARCH_MSG), count, str(LANG_OFF_ABORT)); 218 if (total != current)
219 {
220 splash_progress(current, total, str(LANG_PLAYLIST_SEARCH_MSG),
221 display_count, str(LANG_OFF_ABORT));
222 }
223 else
224 splashf(0, str(LANG_PLAYLIST_SEARCH_MSG),
225 display_count, str(LANG_OFF_ABORT));
226
218 if (action_userabort(TIMEOUT_NOBLOCK)) 227 if (action_userabort(TIMEOUT_NOBLOCK))
219 return false; 228 return false;
220 last_tick = current_tick; 229 last_tick = current_tick;
@@ -1843,7 +1852,7 @@ enum current_activity get_current_activity(void)
1843* ** Extended error info truth table ** 1852* ** Extended error info truth table **
1844* [ Handle ][buf_reqd] 1853* [ Handle ][buf_reqd]
1845* [ > 0 ][ > 0 ] buf_reqd indicates how many bytes were used 1854* [ > 0 ][ > 0 ] buf_reqd indicates how many bytes were used
1846* [ALOC_ERR][ > 0 ] buf_reqd indicates how many bytes are needed 1855* [ALOC_ERR][ > 0 ] buf_reqd indicates how many bytes are needed
1847* [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
1848*/ 1857*/
1849int core_load_bmp(const char * filename, struct bitmap *bm, const int bmformat, 1858int core_load_bmp(const char * filename, struct bitmap *bm, const int bmformat,