summaryrefslogtreecommitdiff
path: root/apps/gui/statusbar.c
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2009-10-10 07:17:27 +0000
committerNils Wallménius <nils@rockbox.org>2009-10-10 07:17:27 +0000
commit901acde2d5a681ea4e2a74104e582ae37777cd31 (patch)
treedcdbf31f09c13c6b521441a056fdb9652b54aabe /apps/gui/statusbar.c
parentfaddb574824b4181aa02c0e385b177487a75e1e5 (diff)
downloadrockbox-901acde2d5a681ea4e2a74104e582ae37777cd31.tar.gz
rockbox-901acde2d5a681ea4e2a74104e582ae37777cd31.zip
Clean up a bogus array and avoid some copying of static strings
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23060 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/statusbar.c')
-rw-r--r--apps/gui/statusbar.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c
index 8edc824e2e..9be2343fef 100644
--- a/apps/gui/statusbar.c
+++ b/apps/gui/statusbar.c
@@ -610,6 +610,7 @@ static void gui_statusbar_led(struct screen * display)
610static void gui_statusbar_time(struct screen * display, struct tm *time) 610static void gui_statusbar_time(struct screen * display, struct tm *time)
611{ 611{
612 unsigned char buffer[6]; 612 unsigned char buffer[6];
613 const unsigned char *p = buffer;
613 unsigned int width, height; 614 unsigned int width, height;
614 int hour, minute; 615 int hour, minute;
615 if ( valid_time(time) ) { 616 if ( valid_time(time) ) {
@@ -624,13 +625,13 @@ static void gui_statusbar_time(struct screen * display, struct tm *time)
624 snprintf(buffer, sizeof(buffer), "%02d:%02d", hour, minute); 625 snprintf(buffer, sizeof(buffer), "%02d:%02d", hour, minute);
625 } 626 }
626 else { 627 else {
627 strlcpy(buffer, "--:--", sizeof(buffer)); 628 p = "--:--";
628 } 629 }
629 display->setfont(FONT_SYSFIXED); 630 display->setfont(FONT_SYSFIXED);
630 display->getstringsize(buffer, &width, &height); 631 display->getstringsize(p, &width, &height);
631 if (height <= STATUSBAR_HEIGHT) { 632 if (height <= STATUSBAR_HEIGHT) {
632 display->putsxy(STATUSBAR_TIME_X_END(display->getwidth()) - width, 633 display->putsxy(STATUSBAR_TIME_X_END(display->getwidth()) - width,
633 STATUSBAR_Y_POS, buffer); 634 STATUSBAR_Y_POS, p);
634 } 635 }
635 display->setfont(FONT_UI); 636 display->setfont(FONT_UI);
636} 637}
@@ -736,6 +737,7 @@ static void gui_statusbar_icon_recording_info(struct screen * display)
736{ 737{
737#if CONFIG_CODEC != SWCODEC 738#if CONFIG_CODEC != SWCODEC
738 char buffer[3]; 739 char buffer[3];
740 const char *p = buffer;
739 int width, height; 741 int width, height;
740 display->setfont(FONT_SYSFIXED); 742 display->setfont(FONT_SYSFIXED);
741#endif /* CONFIG_CODEC != SWCODEC */ 743#endif /* CONFIG_CODEC != SWCODEC */
@@ -764,21 +766,19 @@ static void gui_statusbar_icon_recording_info(struct screen * display)
764 if (global_settings.rec_source == AUDIO_SRC_SPDIF) 766 if (global_settings.rec_source == AUDIO_SRC_SPDIF)
765 { 767 {
766 /* Can't measure S/PDIF sample rate on Archos/Sim yet */ 768 /* Can't measure S/PDIF sample rate on Archos/Sim yet */
767 strlcpy(buffer, "--", sizeof(buffer)); 769 p = "--";
768 } 770 }
769 else 771 else
770#endif /* HAVE_SPDIF_IN */ 772#endif /* HAVE_SPDIF_IN */
771 { 773 {
772 static char const * const freq_strings[12] = 774 static const char *freq_strings[] = {"44", "48", "32", "22", "24", "16"};
773 { "44", "48", "32", "22", "24", "16" }; 775 p = freq_strings[global_settings.rec_frequency];
774 strlcpy(buffer, freq_strings[global_settings.rec_frequency],
775 sizeof(buffer));
776 } 776 }
777 777
778 display->getstringsize(buffer, &width, &height); 778 display->getstringsize(p, &width, &height);
779 779
780 if (height <= STATUSBAR_HEIGHT) 780 if (height <= STATUSBAR_HEIGHT)
781 display->putsxy(STATUSBAR_RECFREQ_X_POS, STATUSBAR_Y_POS, buffer); 781 display->putsxy(STATUSBAR_RECFREQ_X_POS, STATUSBAR_Y_POS, p);
782 782
783 display->setfont(FONT_UI); 783 display->setfont(FONT_UI);
784#endif /* CONFIG_CODEC == SWCODEC */ 784#endif /* CONFIG_CODEC == SWCODEC */