Const policed pointer arguments to functions, part 3

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4999 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2004-08-18 01:09:31 +00:00
parent 6d0da414bf
commit 8fb336148f
27 changed files with 170 additions and 158 deletions

View file

@ -51,19 +51,19 @@
#define MAX_BOOKMARK_SIZE 350
#define RECENT_BOOKMARK_FILE ROCKBOX_DIR "/most-recent.bmark"
static bool add_bookmark(char* bookmark_file_name, char* bookmark);
static bool add_bookmark(const char* bookmark_file_name, const char* bookmark);
static bool bookmark_load_menu(void);
static bool check_bookmark(char* bookmark);
static bool check_bookmark(const char* bookmark);
static char* create_bookmark(void);
static bool delete_bookmark(char* bookmark_file_name, int bookmark_id);
static void display_bookmark(char* bookmark,
static bool delete_bookmark(const char* bookmark_file_name, int bookmark_id);
static void display_bookmark(const char* bookmark,
int bookmark_id,
int bookmark_count);
static void say_bookmark(char* bookmark,
static void say_bookmark(const char* bookmark,
int bookmark_id);
static bool generate_bookmark_file_name(char *in);
static char* get_bookmark(char* bookmark_file, int bookmark_count);
static bool parse_bookmark(char *bookmark,
static bool generate_bookmark_file_name(const char *in);
static char* get_bookmark(const char* bookmark_file, int bookmark_count);
static bool parse_bookmark(const char *bookmark,
int *resume_index,
int *resume_offset,
int *resume_seed,
@ -75,10 +75,10 @@ static bool parse_bookmark(char *bookmark,
bool *shuffle,
char* file_name,
unsigned int max_file_name_size);
static char* select_bookmark(char* bookmark_file_name);
static char* select_bookmark(const char* bookmark_file_name);
static bool system_check(void);
static bool write_bookmark(bool create_bookmark_file);
static int get_bookmark_count(char* bookmark_file_name);
static int get_bookmark_count(const char* bookmark_file_name);
static char global_temp_buffer[MAX_PATH+1];
static char global_bookmark_file_name[MAX_PATH];
@ -332,7 +332,7 @@ static bool write_bookmark(bool create_bookmark_file)
/* ----------------------------------------------------------------------- */
/* This function adds a bookmark to a file. */
/* ------------------------------------------------------------------------*/
static bool add_bookmark(char* bookmark_file_name, char* bookmark)
static bool add_bookmark(const char* bookmark_file_name, const char* bookmark)
{
int temp_bookmark_file = 0;
int bookmark_file = 0;
@ -447,7 +447,7 @@ static char* create_bookmark()
return NULL;
}
static bool check_bookmark(char* bookmark)
static bool check_bookmark(const char* bookmark)
{
return parse_bookmark(bookmark,
NULL,NULL,NULL, NULL,
@ -459,7 +459,7 @@ static bool check_bookmark(char* bookmark)
/* This function will determine if an autoload is necessary. This is an */
/* interface function. */
/* ------------------------------------------------------------------------*/
bool bookmark_autoload(char* file)
bool bookmark_autoload(const char* file)
{
int key;
int fd;
@ -537,7 +537,7 @@ bool bookmark_autoload(char* file)
/* This function loads the bookmark information into the resume memory. */
/* This is an interface function. */
/* ------------------------------------------------------------------------*/
bool bookmark_load(char* file, bool autoload)
bool bookmark_load(const char* file, bool autoload)
{
int fd;
bool success = true;
@ -587,7 +587,7 @@ bool bookmark_load(char* file, bool autoload)
}
static int get_bookmark_count(char* bookmark_file_name)
static int get_bookmark_count(const char* bookmark_file_name)
{
int read_count = 0;
int file = open(bookmark_file_name, O_RDONLY);
@ -613,7 +613,7 @@ static int get_bookmark_count(char* bookmark_file_name)
/* This displays a the bookmarks in a file and allows the user to */
/* select one to play. */
/* ------------------------------------------------------------------------*/
static char* select_bookmark(char* bookmark_file_name)
static char* select_bookmark(const char* bookmark_file_name)
{
int bookmark_id = 0;
int bookmark_id_prev = -1;
@ -732,7 +732,7 @@ static char* select_bookmark(char* bookmark_file_name)
/* This function takes a location in a bookmark file and deletes that */
/* bookmark. */
/* ------------------------------------------------------------------------*/
static bool delete_bookmark(char* bookmark_file_name, int bookmark_id)
static bool delete_bookmark(const char* bookmark_file_name, int bookmark_id)
{
int temp_bookmark_file = 0;
int bookmark_file = 0;
@ -784,7 +784,7 @@ static bool delete_bookmark(char* bookmark_file_name, int bookmark_id)
/* ----------------------------------------------------------------------- */
/* This function parses a bookmark and displays it for the user. */
/* ------------------------------------------------------------------------*/
static void display_bookmark(char* bookmark,
static void display_bookmark(const char* bookmark,
int bookmark_id,
int bookmark_count)
{
@ -908,7 +908,7 @@ static void display_bookmark(char* bookmark,
/* ----------------------------------------------------------------------- */
/* This function parses a bookmark, says the voice UI part of it. */
/* ------------------------------------------------------------------------*/
static void say_bookmark(char* bookmark,
static void say_bookmark(const char* bookmark,
int bookmark_id)
{
int resume_index;
@ -952,7 +952,7 @@ static void say_bookmark(char* bookmark,
/* in the file, it will return the last one. */
/* It also returns the index number of the bookmark in the file */
/* ------------------------------------------------------------------------*/
static char* get_bookmark(char* bookmark_file, int bookmark_count)
static char* get_bookmark(const char* bookmark_file, int bookmark_count)
{
int read_count = -1;
int result = 0;
@ -989,7 +989,7 @@ static char* get_bookmark(char* bookmark_file, int bookmark_count)
/* validates the bookmark. Passing in NULL for an output variable */
/* indicates that value is not requested. */
/* ----------------------------------------------------------------------- */
static bool parse_bookmark(char *bookmark,
static bool parse_bookmark(const char *bookmark,
int *resume_index,
int *resume_offset,
int *resume_seed,
@ -1123,7 +1123,7 @@ static bool parse_bookmark(char *bookmark,
/* it would be here that the centralized/decentralized bookmark code */
/* could be placed. */
/* ----------------------------------------------------------------------- */
static bool generate_bookmark_file_name(char *in)
static bool generate_bookmark_file_name(const char *in)
{
int len = strlen(in);

View file

@ -25,8 +25,8 @@ bool bookmark_menu(void);
bool bookmark_autobookmark(void);
bool bookmark_create_menu(void);
bool bookmark_mrb_load(void);
bool bookmark_autoload(char* file);
bool bookmark_load(char* file, bool autoload);
bool bookmark_autoload(const char* file);
bool bookmark_load(const char* file, bool autoload);
void bookmark_play(char* resume_file, int index, int offset, int seed);
#endif /* __BOOKMARK_H__ */

View file

@ -202,7 +202,7 @@ bool dbg_mpeg_thread(void)
/* Tool function to calculate a CRC16 across some buffer */
unsigned short crc_16(unsigned char* buf, unsigned len)
unsigned short crc_16(const unsigned char* buf, unsigned len)
{
/* CCITT standard polynomial 0x1021 */
static const unsigned short crc16_lookup[16] =

View file

@ -72,11 +72,11 @@ static char string_buffer[STRING_BUFFER_SIZE];
/* prototypes */
#ifdef HAVE_LCD_BITMAP
static char* string2icon(char*);
static char* string2icon(const char*);
#endif
static char* get_string(char*);
static char* get_string(const char*);
static int find_attr_index(int);
static bool read_config(char*);
static bool read_config(const char*);
static void rm_whitespaces(char*);
static void scan_plugins(void);
@ -160,7 +160,7 @@ int filetype_get_icon(int attr)
}
/* get plugin */
char* filetype_get_plugin(struct entry* file)
char* filetype_get_plugin(const struct entry* file)
{
int ix;
@ -197,7 +197,7 @@ bool filetype_supported(int attr)
}
/* get the "dynamic" attribute for an extension */
int filetype_get_attr(char* name)
int filetype_get_attr(const char* name)
{
int i;
@ -239,7 +239,7 @@ int filetype_load_menu(struct menu_item* menu,int max_items)
}
/* start a plugin with an argument (called from onplay.c) */
int filetype_load_plugin(char* plugin, char* file)
int filetype_load_plugin(const char* plugin, char* file)
{
snprintf(plugin_name,sizeof(plugin_name),"%s/%s.rock",
VIEWERS_DIR,plugin);
@ -427,7 +427,7 @@ static void scan_plugins(void)
}
/* read config file (or cahe file) */
bool read_config(char* file)
bool read_config(const char* file)
{
enum {extension,
plugin,
@ -584,7 +584,7 @@ bool read_config(char* file)
#ifdef HAVE_LCD_BITMAP
/* convert an ascii hexadecimal icon to a binary icon */
static char* string2icon(char* str)
static char* string2icon(const char* str)
{
char tmp[ICON_LENGTH*2];
char *cp;
@ -634,7 +634,7 @@ static char* string2icon(char* str)
#endif
/* get string from buffer */
static char* get_string(char* str)
static char* get_string(const char* str)
{
unsigned int l=strlen(str)+1;
char* cp;

View file

@ -23,17 +23,17 @@
#include <tree.h>
#include <menu.h>
int filetype_get_attr(char*);
int filetype_get_attr(const char*);
#ifdef HAVE_LCD_BITMAP
const char* filetype_get_icon(int);
#else
int filetype_get_icon(int);
#endif
char* filetype_get_plugin(struct entry*);
char* filetype_get_plugin(const struct entry*);
void filetype_init(void);
bool filetype_supported(int);
int filetype_load_menu(struct menu_item*, int);
int filetype_load_plugin(char*,char*);
int filetype_load_plugin(const char*, char*);
struct file_type {
#ifdef HAVE_LCD_BITMAP

View file

@ -28,7 +28,7 @@ extern int printf(const char *format, ...);
static unsigned char language_buffer[MAX_LANGUAGE_SIZE];
int lang_load(char *filename)
int lang_load(const char *filename)
{
int filesize;
int fd = open(filename, O_RDONLY);

View file

@ -25,4 +25,4 @@
#define LANGUAGE_VERSION 0x02
/* load a given language file */
int lang_load(char *filename);
int lang_load(const char *filename);

View file

@ -49,7 +49,7 @@ struct menu {
int (*callback)(int, int);
#ifdef HAVE_LCD_BITMAP
bool use_buttonbar; /* true if a buttonbar is defined */
char *buttonbar[3];
const char *buttonbar[3];
#endif
};
@ -225,7 +225,7 @@ static void put_cursor(int m, int target)
}
int menu_init(const struct menu_item* mitems, int count, int (*callback)(int, int),
char *button1, char *button2, char *button3)
const char *button1, const char *button2, const char *button3)
{
int i;

View file

@ -28,7 +28,7 @@ struct menu_item {
};
int menu_init(const struct menu_item* mitems, int count, int (*callback)(int, int),
char *button1, char *button2, char *button3);
const char *button1, const char *button2, const char *button3);
void menu_exit(int menu);
void put_cursorxy(int x, int y, bool on);

View file

@ -128,19 +128,19 @@ static struct playlist_info current_playlist;
static char now_playing[MAX_PATH+1];
static void empty_playlist(struct playlist_info* playlist, bool resume);
static void new_playlist(struct playlist_info* playlist, char *dir,
char *file);
static void new_playlist(struct playlist_info* playlist, const char *dir,
const char *file);
static void create_control(struct playlist_info* playlist);
static int check_control(struct playlist_info* playlist);
static void update_playlist_filename(struct playlist_info* playlist,
char *dir, char *file);
const char *dir, const char *file);
static int add_indices_to_playlist(struct playlist_info* playlist,
char* buffer, int buflen);
static int add_track_to_playlist(struct playlist_info* playlist,
char *filename, int position, bool queue,
int seek_pos);
const char *filename, int position,
bool queue, int seek_pos);
static int add_directory_to_playlist(struct playlist_info* playlist,
char *dirname, int *position, bool queue,
const char *dirname, int *position, bool queue,
int *count, bool recurse);
static int remove_track_from_playlist(struct playlist_info* playlist,
int position, bool write);
@ -149,18 +149,18 @@ static int randomise_playlist(struct playlist_info* playlist,
bool write);
static int sort_playlist(struct playlist_info* playlist, bool start_current,
bool write);
static int get_next_index(struct playlist_info* playlist, int steps);
static int get_next_index(const struct playlist_info* playlist, int steps);
static void find_and_set_playlist_index(struct playlist_info* playlist,
unsigned int seek);
static int compare(const void* p1, const void* p2);
static int get_filename(struct playlist_info* playlist, int seek,
bool control_file, char *buf, int buf_length);
static int format_track_path(char *dest, char *src, int buf_length, int max,
char *dir);
static void display_playlist_count(int count, char *fmt);
const char *dir);
static void display_playlist_count(int count, const char *fmt);
static void display_buffer_full(void);
static int flush_pending_control(struct playlist_info* playlist);
static int rotate_index(struct playlist_info* playlist, int index);
static int rotate_index(const struct playlist_info* playlist, int index);
/*
* remove any files and indices associated with the playlist
@ -212,8 +212,8 @@ static void empty_playlist(struct playlist_info* playlist, bool resume)
* Initialize a new playlist for viewing/editing/playing. dir is the
* directory where the playlist is located and file is the filename.
*/
static void new_playlist(struct playlist_info* playlist, char *dir,
char *file)
static void new_playlist(struct playlist_info* playlist, const char *dir,
const char *file)
{
empty_playlist(playlist, false);
@ -291,7 +291,7 @@ static int check_control(struct playlist_info* playlist)
* store directory and name of playlist file
*/
static void update_playlist_filename(struct playlist_info* playlist,
char *dir, char *file)
const char *dir, const char *file)
{
char *sep="";
int dirlen = strlen(dir);
@ -400,8 +400,8 @@ static int add_indices_to_playlist(struct playlist_info* playlist,
* PLAYLIST_INSERT_LAST - Add track to end of playlist
*/
static int add_track_to_playlist(struct playlist_info* playlist,
char *filename, int position, bool queue,
int seek_pos)
const char *filename, int position,
bool queue, int seek_pos)
{
int insert_position = position;
unsigned int flags = PLAYLIST_INSERT_TYPE_INSERT;
@ -523,7 +523,7 @@ static int add_track_to_playlist(struct playlist_info* playlist,
* Insert directory into playlist. May be called recursively.
*/
static int add_directory_to_playlist(struct playlist_info* playlist,
char *dirname, int *position, bool queue,
const char *dirname, int *position, bool queue,
int *count, bool recurse)
{
char buf[MAX_PATH+1];
@ -791,7 +791,7 @@ static int sort_playlist(struct playlist_info* playlist, bool start_current,
* returns the index of the track that is "steps" away from current playing
* track.
*/
static int get_next_index(struct playlist_info* playlist, int steps)
static int get_next_index(const struct playlist_info* playlist, int steps)
{
int current_index = playlist->index;
int next_index = -1;
@ -972,7 +972,7 @@ static int get_filename(struct playlist_info* playlist, int seek,
* Returns absolute path of track
*/
static int format_track_path(char *dest, char *src, int buf_length, int max,
char *dir)
const char *dir)
{
int i = 0;
int j;
@ -1037,7 +1037,7 @@ static int format_track_path(char *dest, char *src, int buf_length, int max,
* Display splash message showing progress of playlist/directory insertion or
* save.
*/
static void display_playlist_count(int count, char *fmt)
static void display_playlist_count(int count, const char *fmt)
{
lcd_clear_display();
@ -1120,7 +1120,7 @@ static int flush_pending_control(struct playlist_info* playlist)
/*
* Rotate indices such that first_index is index 0
*/
static int rotate_index(struct playlist_info* playlist, int index)
static int rotate_index(const struct playlist_info* playlist, int index)
{
index -= playlist->first_index;
if (index < 0)
@ -1153,7 +1153,7 @@ void playlist_init(void)
/*
* Create new playlist
*/
int playlist_create(char *dir, char *file)
int playlist_create(const char *dir, const char *file)
{
struct playlist_info* playlist = &current_playlist;
@ -1555,7 +1555,7 @@ int playlist_resume(void)
/*
* Add track to in_ram playlist. Used when playing directories.
*/
int playlist_add(char *filename)
int playlist_add(const char *filename)
{
struct playlist_info* playlist = &current_playlist;
int len = strlen(filename);
@ -1780,7 +1780,8 @@ int playlist_amount(void)
* playlist indices (required for and only used if !current playlist). The
* temp_buffer (if not NULL) is used as a scratchpad when loading indices.
*/
int playlist_create_ex(struct playlist_info* playlist, char* dir, char* file,
int playlist_create_ex(struct playlist_info* playlist,
const char* dir, const char* file,
void* index_buffer, int index_buffer_size,
void* temp_buffer, int temp_buffer_size)
{
@ -1897,7 +1898,7 @@ void playlist_close(struct playlist_info* playlist)
* Insert track into playlist at specified position (or one of the special
* positions). Returns position where track was inserted or -1 if error.
*/
int playlist_insert_track(struct playlist_info* playlist, char *filename,
int playlist_insert_track(struct playlist_info* playlist, const char *filename,
int position, bool queue)
{
int result;
@ -1925,8 +1926,9 @@ int playlist_insert_track(struct playlist_info* playlist, char *filename,
/*
* Insert all tracks from specified directory into playlist.
*/
int playlist_insert_directory(struct playlist_info* playlist, char *dirname,
int position, bool queue, bool recurse)
int playlist_insert_directory(struct playlist_info* playlist,
const char *dirname, int position, bool queue,
bool recurse)
{
int count = 0;
int result;
@ -2226,7 +2228,7 @@ int playlist_sort(struct playlist_info* playlist, bool start_current)
}
/* returns true if playlist has been modified */
bool playlist_modified(struct playlist_info* playlist)
bool playlist_modified(const struct playlist_info* playlist)
{
if (!playlist)
playlist = &current_playlist;
@ -2240,7 +2242,7 @@ bool playlist_modified(struct playlist_info* playlist)
}
/* returns index of first track in playlist */
int playlist_get_first_index(struct playlist_info* playlist)
int playlist_get_first_index(const struct playlist_info* playlist)
{
if (!playlist)
playlist = &current_playlist;
@ -2249,7 +2251,7 @@ int playlist_get_first_index(struct playlist_info* playlist)
}
/* returns shuffle seed of playlist */
int playlist_get_seed(struct playlist_info* playlist)
int playlist_get_seed(const struct playlist_info* playlist)
{
if (!playlist)
playlist = &current_playlist;
@ -2258,7 +2260,7 @@ int playlist_get_seed(struct playlist_info* playlist)
}
/* returns number of tracks in playlist (includes queued/inserted tracks) */
int playlist_amount_ex(struct playlist_info* playlist)
int playlist_amount_ex(const struct playlist_info* playlist)
{
if (!playlist)
playlist = &current_playlist;
@ -2267,7 +2269,8 @@ int playlist_amount_ex(struct playlist_info* playlist)
}
/* returns full path of playlist (minus extension) */
char *playlist_name(struct playlist_info* playlist, char *buf, int buf_size)
char *playlist_name(const struct playlist_info* playlist, char *buf,
int buf_size)
{
char *sep;
@ -2288,7 +2291,7 @@ char *playlist_name(struct playlist_info* playlist, char *buf, int buf_size)
}
/* returns the playlist filename */
char *playlist_get_name(struct playlist_info* playlist, char *buf,
char *playlist_get_name(const struct playlist_info* playlist, char *buf,
int buf_size)
{
if (!playlist)

View file

@ -68,9 +68,9 @@ struct playlist_track_info
/* Exported functions only for current playlist. */
void playlist_init(void);
int playlist_create(char *dir, char *file);
int playlist_create(const char *dir, const char *file);
int playlist_resume(void);
int playlist_add(char *filename);
int playlist_add(const char *filename);
int playlist_shuffle(int random_seed, int start_index);
int playlist_start(int start_index, int offset);
bool playlist_check(int steps);
@ -82,15 +82,17 @@ int playlist_amount(void);
/* Exported functions for all playlists. Pass NULL for playlist_info
structure to work with current playlist. */
int playlist_create_ex(struct playlist_info* playlist, char* dir, char* file,
int playlist_create_ex(struct playlist_info* playlist,
const char* dir, const char* file,
void* index_buffer, int index_buffer_size,
void* temp_buffer, int temp_buffer_size);
int playlist_set_current(struct playlist_info* playlist);
void playlist_close(struct playlist_info* playlist);
int playlist_insert_track(struct playlist_info* playlist, char *filename,
int playlist_insert_track(struct playlist_info* playlist, const char *filename,
int position, bool queue);
int playlist_insert_directory(struct playlist_info* playlist, char *dirname,
int position, bool queue, bool recurse);
int playlist_insert_directory(struct playlist_info* playlist,
const char *dirname, int position, bool queue,
bool recurse);
int playlist_insert_playlist(struct playlist_info* playlist, char *filename,
int position, bool queue);
int playlist_delete(struct playlist_info* playlist, int index);
@ -98,12 +100,13 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index);
int playlist_randomise(struct playlist_info* playlist, unsigned int seed,
bool start_current);
int playlist_sort(struct playlist_info* playlist, bool start_current);
bool playlist_modified(struct playlist_info* playlist);
int playlist_get_first_index(struct playlist_info* playlist);
int playlist_get_seed(struct playlist_info* playlist);
int playlist_amount_ex(struct playlist_info* playlist);
char *playlist_name(struct playlist_info* playlist, char *buf, int buf_size);
char *playlist_get_name(struct playlist_info* playlist, char *buf,
bool playlist_modified(const struct playlist_info* playlist);
int playlist_get_first_index(const struct playlist_info* playlist);
int playlist_get_seed(const struct playlist_info* playlist);
int playlist_amount_ex(const struct playlist_info* playlist);
char *playlist_name(const struct playlist_info* playlist, char *buf,
int buf_size);
char *playlist_get_name(const struct playlist_info* playlist, char *buf,
int buf_size);
int playlist_get_track_info(struct playlist_info* playlist, int index,
struct playlist_track_info* info);

View file

@ -123,8 +123,8 @@ static bool initialize(char* filename, bool reload);
static void load_playlist_entries(int start_index);
static void load_playlist_entries_r(int end_index);
static int load_entry(int index, int pos, char* p, int size);
static void format_name(char* dest, char* src);
static void format_line(struct playlist_entry* track, char* str, int len);
static void format_name(char* dest, const char* src);
static void format_line(const struct playlist_entry* track, char* str, int len);
static void display_playlist(void);
static void update_display_line(int line, bool scroll);
static void scroll_display(int lines);
@ -392,7 +392,7 @@ static int load_entry(int index, int pos, char* p, int size)
}
/* Format trackname for display purposes */
static void format_name(char* dest, char* src)
static void format_name(char* dest, const char* src)
{
switch (global_settings.playlist_viewer_track_display)
{
@ -422,7 +422,7 @@ static void format_name(char* dest, char* src)
}
/* Format display line */
static void format_line(struct playlist_entry* track, char* str, int len)
static void format_line(const struct playlist_entry* track, char* str, int len)
{
char name[MAX_PATH];

View file

@ -261,7 +261,7 @@ static const struct plugin_api rockbox_api = {
mpeg_get_last_header,
};
int plugin_load(char* plugin, void* parameter)
int plugin_load(const char* plugin, void* parameter)
{
enum plugin_status (*plugin_start)(struct plugin_api* api, void* param);
int rc;

View file

@ -153,7 +153,7 @@ struct plugin_api {
#endif
void (*backlight_on)(void);
void (*backlight_off)(void);
void (*splash)(int ticks, bool center, char *fmt, ...);
void (*splash)(int ticks, bool center, const char *fmt, ...);
/* button */
int (*button_get)(bool block);
@ -298,7 +298,7 @@ struct plugin_api {
};
/* defined by the plugin loader (plugin.c) */
int plugin_load(char* plugin, void* parameter);
int plugin_load(const char* plugin, void* parameter);
void* plugin_get_buffer(int *buffer_size);
void* plugin_get_mp3_buffer(int *buffer_size);
int plugin_register_timer(int cycles, int prio, void (*timer_callback)(void));

View file

@ -659,7 +659,7 @@ bool quick_screen(int context, int button)
void splash(int ticks, /* how long the splash is displayed */
bool center, /* FALSE means left-justified, TRUE means
horizontal and vertical center */
char *fmt, /* what to say *printf style */
const char *fmt, /* what to say *printf style */
...)
{
char *next;
@ -813,7 +813,7 @@ void charging_splash(void)
#ifdef HAVE_LCD_BITMAP
/* little helper function for voice output */
static void say_time(int cursorpos, struct tm *tm)
static void say_time(int cursorpos, const struct tm *tm)
{
const int unit[] = { UNIT_HOUR, UNIT_MIN, UNIT_SEC, 0, 0, 0 };
int value = 0;
@ -850,7 +850,7 @@ static void say_time(int cursorpos, struct tm *tm)
#define INDEX_X 0
#define INDEX_Y 1
#define INDEX_WIDTH 2
bool set_time_screen(char* string, struct tm *tm)
bool set_time_screen(const char* string, struct tm *tm)
{
bool done = false;
int button;

View file

@ -34,11 +34,11 @@ bool quick_screen(const int, const int);
void splash(int ticks, /* how long */
bool center, /* FALSE means left-justified, TRUE means
horizontal and vertical center */
char *fmt, /* what to say *printf style */
const char *fmt, /* what to say *printf style */
...);
#ifdef HAVE_RTC
bool set_time_screen(char* string, struct tm *tm);
bool set_time_screen(const char* string, struct tm *tm);
#endif
bool shutdown_screen(void);

View file

@ -339,7 +339,7 @@ static const struct bit_entry hd_bits[] =
/* helper function to extract n (<=32) bits from an arbitrary position */
static unsigned long get_bits(
unsigned long* p, /* the start of the bitfield array */
const unsigned long* p, /* the start of the bitfield array */
unsigned int from, /* bit no. to start reading from */
unsigned int size) /* how many bits to read */
{
@ -418,7 +418,7 @@ static void set_bits(
* Calculates the checksum for the config block and returns it
*/
static unsigned short calculate_config_checksum(unsigned char* buf)
static unsigned short calculate_config_checksum(const unsigned char* buf)
{
unsigned int i;
unsigned char cksum[2];
@ -890,8 +890,8 @@ void set_file(char* filename, char* setting, int maxlen)
static int load_cfg_table(
const struct bit_entry* p_table, /* the table which describes the entries */
int count, /* number of entries in the table, including the first */
char* name, /* the item to be searched */
char* value, /* the value which got loaded for that item */
const char* name, /* the item to be searched */
const char* value, /* the value which got loaded for that item */
int hint) /* position to start looking */
{
int i = hint;
@ -963,7 +963,7 @@ static int load_cfg_table(
}
bool settings_load_config(char* file)
bool settings_load_config(const char* file)
{
int fd;
char line[128];
@ -1238,7 +1238,7 @@ void settings_reset(void) {
}
bool set_bool(char* string, bool* variable )
bool set_bool(const char* string, bool* variable )
{
return set_bool_options(string, variable,
STR(LANG_SET_BOOL_YES),
@ -1256,9 +1256,9 @@ void bool_funcwrapper(int value)
boolfunction(false);
}
bool set_bool_options(char* string, bool* variable,
char* yes_str, int yes_voice,
char* no_str, int no_voice,
bool set_bool_options(const char* string, bool* variable,
const char* yes_str, int yes_voice,
const char* no_str, int no_voice,
void (*function)(bool))
{
struct opt_items names[] = { {no_str, no_voice}, {yes_str, yes_voice} };
@ -1270,8 +1270,8 @@ bool set_bool_options(char* string, bool* variable,
return result;
}
bool set_int(char* string,
char* unit,
bool set_int(const char* string,
const char* unit,
int voice_unit,
int* variable,
void (*function)(int),
@ -1391,7 +1391,7 @@ bool set_int(char* string,
different and bit-incompatible types and can not share the same access
code. */
bool set_option(char* string, void* variable, enum optiontype type,
bool set_option(const char* string, void* variable, enum optiontype type,
const struct opt_items* options, int numoptions, void (*function)(int))
{
bool done = false;

View file

@ -264,19 +264,19 @@ void settings_apply(void);
void settings_apply_pm_range(void);
void settings_display(void);
bool settings_load_config(char* file);
bool settings_load_config(const char* file);
bool settings_save_config(void);
bool set_bool_options(char* string, bool* variable,
char* yes_str, int yes_voice,
char* no_str, int no_voice,
bool set_bool_options(const char* string, bool* variable,
const char* yes_str, int yes_voice,
const char* no_str, int no_voice,
void (*function)(bool));
bool set_bool(char* string, bool* variable );
bool set_option(char* string, void* variable, enum optiontype type,
bool set_bool(const char* string, bool* variable );
bool set_option(const char* string, void* variable, enum optiontype type,
const struct opt_items* options, int numoptions, void (*function)(int));
bool set_int(char* string, char* unit, int voice_unit, int* variable,
bool set_int(const char* string, const char* unit, int voice_unit, int* variable,
void (*function)(int), int step, int min, int max );
bool set_time_screen(char* string, struct tm *tm);
bool set_time_screen(const char* string, struct tm *tm);
int read_line(int fd, char* buffer, int buffer_size);
void set_file(char* filename, char* setting, int maxlen);

View file

@ -42,7 +42,7 @@ static const char* const fmt[] =
"%d.%02d %s " /* 2 decimals */
};
bool set_sound(char* string,
bool set_sound(const char* string,
int* variable,
int setting)
{

View file

@ -268,7 +268,7 @@ void status_draw(bool force_redraw)
}
#ifdef HAVE_LCD_BITMAP
static void draw_buttonbar_btn(int num, char* caption)
static void draw_buttonbar_btn(int num, const char* caption)
{
int xpos, ypos, button_width, text_width;
int fw, fh;
@ -294,7 +294,8 @@ static char stored_caption1[8];
static char stored_caption2[8];
static char stored_caption3[8];
void buttonbar_set(char* caption1, char *caption2, char *caption3)
void buttonbar_set(const char* caption1, const char *caption2,
const char *caption3)
{
buttonbar_unset();
if(caption1)

View file

@ -34,7 +34,8 @@ void status_init(void);
void status_set_ffmode(enum playmode mode);
#ifdef HAVE_LCD_BITMAP
bool statusbar(bool state);
void buttonbar_set(char* caption1, char* caption2, char* caption3);
void buttonbar_set(const char* caption1, const char* caption2,
const char* caption3);
void buttonbar_unset(void);
bool buttonbar_isset(void);
void buttonbar_draw(void);

View file

@ -378,7 +378,7 @@ int talk_id(int id, bool enqueue)
/* play a thumbnail from file */
int talk_file(char* filename, bool enqueue)
int talk_file(const char* filename, bool enqueue)
{
int fd;
int size;
@ -532,7 +532,7 @@ int talk_value(int n, int unit, bool enqueue)
}
/* spell a string */
int talk_spell(char* spell, bool enqueue)
int talk_spell(const char* spell, bool enqueue)
{
char c; /* currently processed char */

View file

@ -61,9 +61,9 @@ extern const char* const dir_thumbnail_name;
void talk_init(void);
int talk_buffer_steal(void); /* claim the mp3 buffer e.g. for play/record */
int talk_id(int id, bool enqueue); /* play a voice ID from voicefont */
int talk_file(char* filename, bool enqueue); /* play a thumbnail from file */
int talk_file(const char* filename, bool enqueue); /* play a thumbnail from file */
int talk_number(int n, bool enqueue); /* say a number */
int talk_value(int n, int unit, bool enqueue); /* say a numeric value */
int talk_spell(char* spell, bool enqueue); /* spell a string */
int talk_spell(const char* spell, bool enqueue); /* spell a string */
#endif /* __TALK_H__ */

View file

@ -118,7 +118,7 @@ static int boot_cluster;
static bool boot_changed = false;
static bool start_wps = false;
static bool dirbrowse(char *root, int *dirfilter);
static bool dirbrowse(const char *root, const int *dirfilter);
void browse_root(void)
{
@ -293,7 +293,7 @@ static int compare(const void* p1, const void* p2)
return 0; /* never reached */
}
static void showfileline(int line, int direntry, bool scroll, int *dirfilter)
static void showfileline(int line, int direntry, bool scroll, const int *dirfilter)
{
char* name = dircache[direntry].name;
int xpos = LINE_X;
@ -331,7 +331,7 @@ static void showfileline(int line, int direntry, bool scroll, int *dirfilter)
}
/* load sorted directory into dircache. returns NULL on failure. */
struct entry* load_and_sort_directory(char *dirname, int *dirfilter,
struct entry* load_and_sort_directory(const char *dirname, const int *dirfilter,
int *num_files, bool *buffer_full)
{
int i;
@ -453,7 +453,7 @@ static int recalc_screen_height(void)
}
#endif
static int showdir(char *path, int start, int *dirfilter)
static int showdir(const char *path, int start, const int *dirfilter)
{
int i;
int tree_max_on_screen;
@ -652,7 +652,7 @@ static bool ask_resume(bool ask_once)
}
/* load tracks from specified directory to resume play */
void resume_directory(char *dir)
void resume_directory(const char *dir)
{
bool buffer_full;
@ -753,7 +753,8 @@ void set_current_file(char *path)
}
#ifdef BUTTON_ON
static bool handle_on(int *ds, int *dc, int numentries, int tree_max_on_screen, int *dirfilter)
static bool handle_on(int *ds, int *dc, int numentries, int tree_max_on_screen,
const int *dirfilter)
{
bool exit = false;
bool used = false;
@ -878,7 +879,7 @@ static bool handle_on(int *ds, int *dc, int numentries, int tree_max_on_screen,
}
#endif
static bool dirbrowse(char *root, int *dirfilter)
static bool dirbrowse(const char *root, const int *dirfilter)
{
int numentries=0;
char buf[MAX_PATH];
@ -1643,7 +1644,7 @@ bool create_playlist(void)
return true;
}
bool rockbox_browse(char *root, int dirfilter)
bool rockbox_browse(const char *root, int dirfilter)
{
bool rc;
int dircursor_save = dircursor;

View file

@ -52,12 +52,12 @@ void tree_get_filetypes(const struct filetype**, int*);
void tree_init(void);
void browse_root(void);
void set_current_file(char *path);
bool rockbox_browse(char *root, int dirfilter);
bool rockbox_browse(const char *root, int dirfilter);
bool create_playlist(void);
void resume_directory(char *dir);
void resume_directory(const char *dir);
char *getcwd(char *buf, int size);
void reload_directory(void);
struct entry* load_and_sort_directory(char *dirname, int *dirfilter,
struct entry* load_and_sort_directory(const char *dirname, const int *dirfilter,
int *num_files, bool *buffer_full);
#endif

View file

@ -68,9 +68,11 @@
#ifdef HAVE_LCD_CHARCELLS
static unsigned char wps_progress_pat[8]={0,0,0,0,0,0,0,0};
static bool full_line_progressbar=0;
static bool draw_player_progress(struct mp3entry* id3, int ff_rewwind_count);
static bool draw_player_progress(const struct mp3entry* id3,
int ff_rewwind_count);
static void draw_player_fullbar(char* buf, int buf_size,
struct mp3entry* id3, int ff_rewwind_count);
const struct mp3entry* id3,
int ff_rewwind_count);
static char map_fullbar_char(char ascii_val);
#endif
@ -86,7 +88,7 @@ bool wps_time_countup = true;
static bool wps_loaded = false;
/* Set format string to use for WPS, splitting it into lines */
static void wps_format(char* fmt)
static void wps_format(const char* fmt)
{
char* buf = format_buffer;
char* start_of_line = format_buffer;
@ -170,7 +172,7 @@ void wps_reset(void)
memset(&format_buffer, 0, sizeof format_buffer);
}
bool wps_load(char* file, bool display)
bool wps_load(const char* file, bool display)
{
int i, s;
char buffer[FORMAT_BUFFER_SIZE];
@ -256,10 +258,10 @@ static void format_time(char* buf, int buf_size, int time)
*
* Returns buf if the desired level was found, NULL otherwise.
*/
static char* get_dir(char* buf, int buf_size, char* path, int level)
static char* get_dir(char* buf, int buf_size, const char* path, int level)
{
char* sep;
char* last_sep;
const char* sep;
const char* last_sep;
int len;
sep = path + strlen(path);
@ -304,7 +306,7 @@ static char* get_dir(char* buf, int buf_size, char* path, int level)
*/
static char* get_tag(struct mp3entry* cid3,
struct mp3entry* nid3,
char* tag,
const char* tag,
char* buf,
int buf_size,
unsigned char* tag_len,
@ -622,7 +624,7 @@ static char* get_tag(struct mp3entry* cid3,
*
* Returns the new position in fmt.
*/
static char* skip_conditional(char* fmt, bool to_else)
static const char* skip_conditional(const char* fmt, bool to_else)
{
int level = 1;
@ -693,7 +695,7 @@ static void format_display(char* buf,
int buf_size,
struct mp3entry* id3,
struct mp3entry* nid3, /* next song's id3 */
char* fmt,
const char* fmt,
unsigned char* subline_time_mult,
unsigned char* flags)
{
@ -1051,7 +1053,8 @@ bool wps_display(struct mp3entry* id3,
}
#ifdef HAVE_LCD_CHARCELLS
static bool draw_player_progress(struct mp3entry* id3, int ff_rewwind_count)
static bool draw_player_progress(const struct mp3entry* id3,
int ff_rewwind_count)
{
char player_progressbar[7];
char binline[36];
@ -1087,7 +1090,8 @@ static bool draw_player_progress(struct mp3entry* id3, int ff_rewwind_count)
}
static void draw_player_fullbar(char* buf, int buf_size,
struct mp3entry* id3, int ff_rewwind_count)
const struct mp3entry* id3,
int ff_rewwind_count)
{
int i,j,lcd_char_pos;

View file

@ -36,8 +36,7 @@
bool wps_refresh(struct mp3entry* id3, struct mp3entry* nid3,
int ffwd_offset, unsigned char refresh_mode);
bool wps_display(struct mp3entry* id3, struct mp3entry* nid3);
bool wps_load(char* file, bool display);
bool wps_load(const char* file, bool display);
void wps_reset(void);
char* wps_get_genre(struct mp3entry* id3);
#endif