From abe77a1a2a1db4e6b9bcd4a8d14dc7abef0b2104 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Sun, 1 Aug 2004 21:50:57 +0000 Subject: More const policeing step 1 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4978 a1c6a512-1295-4272-9138-f99709370657 --- apps/main.c | 2 +- apps/misc.c | 4 ++-- apps/plugin.h | 6 +++--- apps/settings.c | 4 ++-- apps/settings.h | 6 +++--- apps/version.h | 2 +- firmware/drivers/lcd-recorder.c | 6 +++--- firmware/export/lcd.h | 7 +++---- 8 files changed, 18 insertions(+), 19 deletions(-) diff --git a/apps/main.c b/apps/main.c index 346c9bcddc..270f3d6dc3 100644 --- a/apps/main.c +++ b/apps/main.c @@ -59,7 +59,7 @@ /*#define AUTOROCK*/ /* define this to check for "autostart.rock" on boot */ -char appsversion[]=APPSVERSION; +const char appsversion[]=APPSVERSION; void init(void); diff --git a/apps/misc.c b/apps/misc.c index 2ee6627f03..582901f2ef 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -114,7 +114,7 @@ int main(int argc, char **argv) #ifdef HAVE_LCD_BITMAP extern unsigned char lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH]; -static unsigned char bmpheader[] = +static const unsigned char bmpheader[] = { 0x42, 0x4d, 0x3e, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x40, 0x00, @@ -126,7 +126,7 @@ static unsigned char bmpheader[] = static unsigned char buf[112*8]; static unsigned char buf2[112*8]; -static char dummy[2] = {0, 0}; +static const char dummy[2] = {0, 0}; void screen_dump(void) { diff --git a/apps/plugin.h b/apps/plugin.h index 3d5f9a5504..4656b05be5 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -111,7 +111,7 @@ struct plugin_api { /* lcd */ void (*lcd_clear_display)(void); - void (*lcd_puts)(int x, int y, unsigned char *string); + void (*lcd_puts)(int x, int y, const unsigned char *string); void (*lcd_puts_scroll)(int x, int y, unsigned char* string); void (*lcd_stop_scroll)(void); void (*lcd_set_contrast)(int x); @@ -125,7 +125,7 @@ struct plugin_api { void (*lcd_icon)(int icon, bool enable); #else void (*lcd_putsxy)(int x, int y, const unsigned char *string); - void (*lcd_puts_style)(int x, int y, unsigned char *str, int style); + void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style); void (*lcd_bitmap)(const unsigned char *src, int x, int y, int nx, int ny, bool clear); void (*lcd_drawline)(int x1, int y1, int x2, int y2); @@ -138,7 +138,7 @@ struct plugin_api { void (*lcd_fillrect)(int x, int y, int nx, int ny); void (*lcd_drawrect)(int x, int y, int nx, int ny); void (*lcd_invertrect)(int x, int y, int nx, int ny); - int (*lcd_getstringsize)(unsigned char *str, int *w, int *h); + int (*lcd_getstringsize)(const unsigned char *str, int *w, int *h); void (*lcd_update)(void); void (*lcd_update_rect)(int x, int y, int width, int height); void (*scrollbar)(int x, int y, int width, int height, int items, diff --git a/apps/settings.c b/apps/settings.c index 0487f250b3..47969d1abe 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -67,7 +67,7 @@ void dac_line_in(bool enable); #endif struct user_settings global_settings; -char rec_base_directory[] = REC_BASE_DIR; +const char rec_base_directory[] = REC_BASE_DIR; #define CONFIG_BLOCK_VERSION 16 @@ -1513,7 +1513,7 @@ bool set_option(char* string, void* variable, enum optiontype type, #ifdef HAVE_MAS3587F /* This array holds the record timer interval lengths, in seconds */ -static unsigned long rec_timer_seconds[] = +static const unsigned long rec_timer_seconds[] = { 24*60*60, /* OFF really means 24 hours, to avoid >2Gbyte files */ 5*60, /* 00:05 */ diff --git a/apps/settings.h b/apps/settings.h index 36b4a839a4..78f46eaa4f 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -69,7 +69,7 @@ #define VIRT_SIZE 0xFFFF /* more than enough for our string ID range */ #ifdef SIMULATOR /* a space which is defined in stubs.c */ -extern unsigned char vp_dummy[VIRT_SIZE]; +extern unsigned char vp_dummy[VIRT_SIZE]; #define VIRT_PTR vp_dummy #else /* a location where we won't store strings, 0 is the fastest */ @@ -250,7 +250,7 @@ struct user_settings enum optiontype { INT, BOOL }; struct opt_items { - unsigned char* string; + unsigned const char* string; int voice_id; }; @@ -291,7 +291,7 @@ extern struct user_settings global_settings; extern long lasttime; /* Recording base directory */ -extern char rec_base_directory[]; +extern const char rec_base_directory[]; /* system defines */ diff --git a/apps/version.h b/apps/version.h index 0090bce571..2eb9c26857 100644 --- a/apps/version.h +++ b/apps/version.h @@ -19,6 +19,6 @@ #ifndef _VERSION_H_ #define _VERSION_H_ -extern char appsversion[]; +extern const char appsversion[]; #endif diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c index 3d3763ca50..d2949c8758 100644 --- a/firmware/drivers/lcd-recorder.c +++ b/firmware/drivers/lcd-recorder.c @@ -305,7 +305,7 @@ void lcd_setfont(int newfont) curfont = newfont; } -int lcd_getstringsize(unsigned char *str, int *w, int *h) +int lcd_getstringsize(const unsigned char *str, int *w, int *h) { struct font* pf = font_get(curfont); int ch; @@ -328,12 +328,12 @@ int lcd_getstringsize(unsigned char *str, int *w, int *h) } /* put a string at a given char position */ -void lcd_puts(int x, int y, unsigned char *str) +void lcd_puts(int x, int y, const unsigned char *str) { lcd_puts_style(x, y, str, STYLE_DEFAULT); } -void lcd_puts_style(int x, int y, unsigned char *str, int style) +void lcd_puts_style(int x, int y, const unsigned char *str, int style) { int xpos,ypos,w,h; diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 1a408d448c..6a7f8cf155 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h @@ -31,8 +31,8 @@ extern void lcd_init(void); extern void lcd_clear_display(void); extern void lcd_backlight(bool on); -extern void lcd_puts(int x, int y, unsigned char *string); -extern void lcd_puts_style(int x, int y, unsigned char *string, int style); +extern void lcd_puts(int x, int y, const unsigned char *string); +extern void lcd_puts_style(int x, int y, const unsigned char *string, int style); extern void lcd_putc(int x, int y, unsigned short ch); extern void lcd_puts_scroll(int x, int y, unsigned char* string ); @@ -142,8 +142,7 @@ extern void lcd_bidir_scroll(int threshold); extern void lcd_scroll_step(int pixels); extern void lcd_setfont(int font); extern void lcd_putsxy(int x, int y, const unsigned char *string); -extern int lcd_getstringsize(unsigned char *str, int *w, int *h); -extern int lcd_getstringsize(unsigned char *str, int *w, int *h); +extern int lcd_getstringsize(const unsigned char *str, int *w, int *h); #endif /* CHARCELLS / BITMAP */ -- cgit v1.2.3