diff options
Diffstat (limited to 'apps/misc.c')
-rw-r--r-- | apps/misc.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/apps/misc.c b/apps/misc.c index 939de440b6..8f6da8b5e5 100644 --- a/apps/misc.c +++ b/apps/misc.c | |||
@@ -124,7 +124,7 @@ char *output_dyn_value(char *buf, int buf_size, int value, | |||
124 | snprintf(tbuf, sizeof(tbuf), "%01d", fraction / 100); | 124 | snprintf(tbuf, sizeof(tbuf), "%01d", fraction / 100); |
125 | else | 125 | else |
126 | snprintf(tbuf, sizeof(tbuf), "%02d", fraction / 10); | 126 | snprintf(tbuf, sizeof(tbuf), "%02d", fraction / 10); |
127 | 127 | ||
128 | if (buf) | 128 | if (buf) |
129 | { | 129 | { |
130 | if (strlen(tbuf)) | 130 | if (strlen(tbuf)) |
@@ -168,7 +168,7 @@ int read_line(int fd, char* buffer, int buffer_size) | |||
168 | { | 168 | { |
169 | int count = 0; | 169 | int count = 0; |
170 | int num_read = 0; | 170 | int num_read = 0; |
171 | 171 | ||
172 | errno = 0; | 172 | errno = 0; |
173 | 173 | ||
174 | while (count < buffer_size) | 174 | while (count < buffer_size) |
@@ -177,9 +177,9 @@ int read_line(int fd, char* buffer, int buffer_size) | |||
177 | 177 | ||
178 | if (1 != read(fd, &c, 1)) | 178 | if (1 != read(fd, &c, 1)) |
179 | break; | 179 | break; |
180 | 180 | ||
181 | num_read++; | 181 | num_read++; |
182 | 182 | ||
183 | if ( c == '\n' ) | 183 | if ( c == '\n' ) |
184 | break; | 184 | break; |
185 | 185 | ||
@@ -201,15 +201,15 @@ int fast_readline(int fd, char *buf, int buf_size, void *parameters, | |||
201 | char *p, *next; | 201 | char *p, *next; |
202 | int rc, pos = 0; | 202 | int rc, pos = 0; |
203 | int count = 0; | 203 | int count = 0; |
204 | 204 | ||
205 | while ( 1 ) | 205 | while ( 1 ) |
206 | { | 206 | { |
207 | next = NULL; | 207 | next = NULL; |
208 | 208 | ||
209 | rc = read(fd, &buf[pos], buf_size - pos - 1); | 209 | rc = read(fd, &buf[pos], buf_size - pos - 1); |
210 | if (rc >= 0) | 210 | if (rc >= 0) |
211 | buf[pos+rc] = '\0'; | 211 | buf[pos+rc] = '\0'; |
212 | 212 | ||
213 | if ( (p = strchr(buf, '\r')) != NULL) | 213 | if ( (p = strchr(buf, '\r')) != NULL) |
214 | { | 214 | { |
215 | *p = '\0'; | 215 | *p = '\0'; |
@@ -217,17 +217,17 @@ int fast_readline(int fd, char *buf, int buf_size, void *parameters, | |||
217 | } | 217 | } |
218 | else | 218 | else |
219 | p = buf; | 219 | p = buf; |
220 | 220 | ||
221 | if ( (p = strchr(p, '\n')) != NULL) | 221 | if ( (p = strchr(p, '\n')) != NULL) |
222 | { | 222 | { |
223 | *p = '\0'; | 223 | *p = '\0'; |
224 | next = ++p; | 224 | next = ++p; |
225 | } | 225 | } |
226 | 226 | ||
227 | rc = callback(count, buf, parameters); | 227 | rc = callback(count, buf, parameters); |
228 | if (rc < 0) | 228 | if (rc < 0) |
229 | return rc; | 229 | return rc; |
230 | 230 | ||
231 | count++; | 231 | count++; |
232 | if (next) | 232 | if (next) |
233 | { | 233 | { |
@@ -237,7 +237,7 @@ int fast_readline(int fd, char *buf, int buf_size, void *parameters, | |||
237 | else | 237 | else |
238 | break ; | 238 | break ; |
239 | } | 239 | } |
240 | 240 | ||
241 | return 0; | 241 | return 0; |
242 | } | 242 | } |
243 | 243 | ||
@@ -338,7 +338,7 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter) | |||
338 | splashf(0, "%s %s", str(LANG_WARNING_BATTERY_EMPTY), | 338 | splashf(0, "%s %s", str(LANG_WARNING_BATTERY_EMPTY), |
339 | str(LANG_SHUTTINGDOWN)); | 339 | str(LANG_SHUTTINGDOWN)); |
340 | } | 340 | } |
341 | 341 | ||
342 | if (global_settings.fade_on_stop | 342 | if (global_settings.fade_on_stop |
343 | && (audio_stat & AUDIO_STATUS_PLAY)) | 343 | && (audio_stat & AUDIO_STATUS_PLAY)) |
344 | { | 344 | { |
@@ -371,7 +371,7 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter) | |||
371 | #endif | 371 | #endif |
372 | 372 | ||
373 | #if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC | 373 | #if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC |
374 | audio_close_recording(); | 374 | audio_close_recording(); |
375 | #endif | 375 | #endif |
376 | 376 | ||
377 | if(global_settings.talk_menu) | 377 | if(global_settings.talk_menu) |
@@ -461,11 +461,11 @@ static bool waiting_to_resume_play = false; | |||
461 | static long play_resume_tick; | 461 | static long play_resume_tick; |
462 | 462 | ||
463 | static void car_adapter_mode_processing(bool inserted) | 463 | static void car_adapter_mode_processing(bool inserted) |
464 | { | 464 | { |
465 | if (global_settings.car_adapter_mode) | 465 | if (global_settings.car_adapter_mode) |
466 | { | 466 | { |
467 | if(inserted) | 467 | if(inserted) |
468 | { | 468 | { |
469 | /* | 469 | /* |
470 | * Just got plugged in, delay & resume if we were playing | 470 | * Just got plugged in, delay & resume if we were playing |
471 | */ | 471 | */ |
@@ -598,7 +598,7 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame | |||
598 | case SYS_CHARGER_CONNECTED: | 598 | case SYS_CHARGER_CONNECTED: |
599 | car_adapter_mode_processing(true); | 599 | car_adapter_mode_processing(true); |
600 | return SYS_CHARGER_CONNECTED; | 600 | return SYS_CHARGER_CONNECTED; |
601 | 601 | ||
602 | case SYS_CHARGER_DISCONNECTED: | 602 | case SYS_CHARGER_DISCONNECTED: |
603 | car_adapter_mode_processing(false); | 603 | car_adapter_mode_processing(false); |
604 | return SYS_CHARGER_DISCONNECTED; | 604 | return SYS_CHARGER_DISCONNECTED; |
@@ -634,12 +634,12 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame | |||
634 | return SYS_PHONE_UNPLUGGED; | 634 | return SYS_PHONE_UNPLUGGED; |
635 | #endif | 635 | #endif |
636 | #ifdef IPOD_ACCESSORY_PROTOCOL | 636 | #ifdef IPOD_ACCESSORY_PROTOCOL |
637 | case SYS_IAP_PERIODIC: | 637 | case SYS_IAP_PERIODIC: |
638 | iap_periodic(); | 638 | iap_periodic(); |
639 | return SYS_IAP_PERIODIC; | 639 | return SYS_IAP_PERIODIC; |
640 | case SYS_IAP_HANDLEPKT: | 640 | case SYS_IAP_HANDLEPKT: |
641 | iap_handlepkt(); | 641 | iap_handlepkt(); |
642 | return SYS_IAP_HANDLEPKT; | 642 | return SYS_IAP_HANDLEPKT; |
643 | #endif | 643 | #endif |
644 | } | 644 | } |
645 | return 0; | 645 | return 0; |
@@ -772,7 +772,7 @@ char* strrsplt(char* str, int c) | |||
772 | { | 772 | { |
773 | s = str; | 773 | s = str; |
774 | } | 774 | } |
775 | 775 | ||
776 | return s; | 776 | return s; |
777 | } | 777 | } |
778 | 778 | ||
@@ -857,14 +857,14 @@ void format_time(char* buf, int buf_size, long t) | |||
857 | { | 857 | { |
858 | if ( t < 3600000 ) | 858 | if ( t < 3600000 ) |
859 | { | 859 | { |
860 | snprintf(buf, buf_size, "%d:%02d", | 860 | snprintf(buf, buf_size, "%d:%02d", |
861 | (int) (t / 60000), (int) (t % 60000 / 1000)); | 861 | (int) (t / 60000), (int) (t % 60000 / 1000)); |
862 | } | 862 | } |
863 | else | 863 | else |
864 | { | 864 | { |
865 | snprintf(buf, buf_size, "%d:%02d:%02d", | 865 | snprintf(buf, buf_size, "%d:%02d:%02d", |
866 | (int) (t / 3600000), (int) (t % 3600000 / 60000), | 866 | (int) (t / 3600000), (int) (t % 3600000 / 60000), |
867 | (int) (t % 60000 / 1000)); | 867 | (int) (t % 60000 / 1000)); |
868 | } | 868 | } |
869 | } | 869 | } |
870 | 870 | ||
@@ -895,7 +895,7 @@ int open_utf8(const char* pathname, int flags) | |||
895 | read(fd, bom, BOM_SIZE); | 895 | read(fd, bom, BOM_SIZE); |
896 | /* check for BOM */ | 896 | /* check for BOM */ |
897 | if(memcmp(bom, BOM, BOM_SIZE)) | 897 | if(memcmp(bom, BOM, BOM_SIZE)) |
898 | lseek(fd, 0, SEEK_SET); | 898 | lseek(fd, 0, SEEK_SET); |
899 | } | 899 | } |
900 | return fd; | 900 | return fd; |
901 | } | 901 | } |
@@ -908,8 +908,8 @@ int open_utf8(const char* pathname, int flags) | |||
908 | 908 | ||
909 | static int hex2dec(int c) | 909 | static int hex2dec(int c) |
910 | { | 910 | { |
911 | return (((c) >= '0' && ((c) <= '9')) ? (c) - '0' : | 911 | return (((c) >= '0' && ((c) <= '9')) ? (c) - '0' : |
912 | (toupper(c)) - 'A' + 10); | 912 | (toupper(c)) - 'A' + 10); |
913 | } | 913 | } |
914 | 914 | ||
915 | int hex_to_rgb(const char* hex, int* color) | 915 | int hex_to_rgb(const char* hex, int* color) |
@@ -986,7 +986,7 @@ const char* parse_list(const char *fmt, uint32_t *set_vals, | |||
986 | 986 | ||
987 | *s = p; | 987 | *s = p; |
988 | while (*p && *p != sep) | 988 | while (*p && *p != sep) |
989 | p++; | 989 | p++; |
990 | set = (s[0][0]!='-') && (s[0][1]!=sep) ; | 990 | set = (s[0][0]!='-') && (s[0][1]!=sep) ; |
991 | break; | 991 | break; |
992 | 992 | ||
@@ -1007,9 +1007,9 @@ const char* parse_list(const char *fmt, uint32_t *set_vals, | |||
1007 | } | 1007 | } |
1008 | else | 1008 | else |
1009 | { | 1009 | { |
1010 | *d = *p++ - '0'; | 1010 | *d = *p++ - '0'; |
1011 | while (isdigit(*p)) | 1011 | while (isdigit(*p)) |
1012 | *d = (*d * 10) + (*p++ - '0'); | 1012 | *d = (*d * 10) + (*p++ - '0'); |
1013 | set = true; | 1013 | set = true; |
1014 | if (is_negative) | 1014 | if (is_negative) |
1015 | *d *= -1; | 1015 | *d *= -1; |