summaryrefslogtreecommitdiffstats
path: root/apps/plugins
diff options
context:
space:
mode:
authorSteve Bavin <pondlife@pondlife.me>2008-05-13 09:57:56 +0000
committerSteve Bavin <pondlife@pondlife.me>2008-05-13 09:57:56 +0000
commit652657781805d9cc10d744a49fb23eb17019fbbf (patch)
tree2d1a6ae597a17531f726b57fd9f8cbaa2a46a07f /apps/plugins
parenta94e40d5153ab698fa8a1b6b57d91fcb6acc905e (diff)
downloadrockbox-652657781805d9cc10d744a49fb23eb17019fbbf.tar.gz
rockbox-652657781805d9cc10d744a49fb23eb17019fbbf.tar.bz2
rockbox-652657781805d9cc10d744a49fb23eb17019fbbf.zip
Plugin parameters should be const.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17492 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/alpine_cdc.c10
-rw-r--r--apps/plugins/battery_bench.c4
-rw-r--r--apps/plugins/beatbox/beatbox.c4
-rw-r--r--apps/plugins/blackjack.c5
-rw-r--r--apps/plugins/bounce.c4
-rw-r--r--apps/plugins/brickmania.c4
-rw-r--r--apps/plugins/bubbles.c4
-rw-r--r--apps/plugins/calculator.c4
-rw-r--r--apps/plugins/calendar.c4
-rw-r--r--apps/plugins/chessbox.c2
-rw-r--r--apps/plugins/chessbox/chessbox.c2
-rw-r--r--apps/plugins/chessbox/chessbox_pgn.c16
-rw-r--r--apps/plugins/chessbox/chessbox_pgn.h14
-rw-r--r--apps/plugins/chessbox/gnuchess.c2
-rw-r--r--apps/plugins/chessbox/gnuchess.h2
-rw-r--r--apps/plugins/chessclock.c4
-rw-r--r--apps/plugins/chip8.c20
-rw-r--r--apps/plugins/chopper.c4
-rw-r--r--apps/plugins/clock/clock.c4
-rw-r--r--apps/plugins/clock/clock.h2
-rw-r--r--apps/plugins/credits.c4
-rw-r--r--apps/plugins/cube.c4
-rw-r--r--apps/plugins/demystify.c4
-rw-r--r--apps/plugins/dice.c4
-rw-r--r--apps/plugins/dict.c4
-rw-r--r--apps/plugins/disktidy.c4
-rw-r--r--apps/plugins/doom/rockdoom.c4
-rw-r--r--apps/plugins/doom/rockmacros.h2
-rw-r--r--apps/plugins/euroconverter.c4
-rw-r--r--apps/plugins/fire.c4
-rw-r--r--apps/plugins/fireworks.c4
-rw-r--r--apps/plugins/firmware_flash.c4
-rw-r--r--apps/plugins/flipit.c4
-rw-r--r--apps/plugins/greyscale.c4
-rw-r--r--apps/plugins/helloworld.c4
-rw-r--r--apps/plugins/invadrox.c4
-rw-r--r--apps/plugins/iriver_flash.c4
-rw-r--r--apps/plugins/iriverify.c4
-rw-r--r--apps/plugins/jackpot.c4
-rw-r--r--apps/plugins/jewels.c4
-rw-r--r--apps/plugins/jpeg.c4
-rw-r--r--apps/plugins/lamp.c4
-rw-r--r--apps/plugins/lib/bmp.c2
-rw-r--r--apps/plugins/lib/bmp.h2
-rw-r--r--apps/plugins/lib/checkbox.c2
-rw-r--r--apps/plugins/lib/checkbox.h2
-rw-r--r--apps/plugins/lib/configfile.c4
-rw-r--r--apps/plugins/lib/configfile.h2
-rw-r--r--apps/plugins/lib/grey.h22
-rw-r--r--apps/plugins/lib/grey_core.c2
-rw-r--r--apps/plugins/lib/helper.c12
-rw-r--r--apps/plugins/lib/helper.h12
-rw-r--r--apps/plugins/lib/highscore.c4
-rw-r--r--apps/plugins/lib/highscore.h2
-rw-r--r--apps/plugins/lib/oldmenuapi.c4
-rw-r--r--apps/plugins/lib/oldmenuapi.h2
-rw-r--r--apps/plugins/lib/overlay.c2
-rw-r--r--apps/plugins/lib/overlay.h2
-rw-r--r--apps/plugins/lib/playback_control.c6
-rw-r--r--apps/plugins/lib/playback_control.h4
-rw-r--r--apps/plugins/lib/playergfx.c4
-rw-r--r--apps/plugins/lib/playergfx.h2
-rw-r--r--apps/plugins/lib/pluginlib_actions.c2
-rw-r--r--apps/plugins/lib/pluginlib_actions.h2
-rw-r--r--apps/plugins/lib/profile_plugin.c4
-rw-r--r--apps/plugins/lib/profile_plugin.h2
-rw-r--r--apps/plugins/lib/xlcd.h4
-rw-r--r--apps/plugins/lib/xlcd_core.c4
-rw-r--r--apps/plugins/logo.c4
-rw-r--r--apps/plugins/mandelbrot.c4
-rw-r--r--apps/plugins/matrix.c4
-rw-r--r--apps/plugins/maze.c4
-rw-r--r--apps/plugins/mazezam.c4
-rw-r--r--apps/plugins/metronome.c4
-rw-r--r--apps/plugins/midi/midifile.c2
-rw-r--r--apps/plugins/midi/midifile.h2
-rw-r--r--apps/plugins/midi/midiplay.c8
-rw-r--r--apps/plugins/midi2wav.c10
-rw-r--r--apps/plugins/minesweeper.c4
-rw-r--r--apps/plugins/mosaique.c4
-rw-r--r--apps/plugins/mp3_encoder.c8
-rw-r--r--apps/plugins/mpegplayer/decode.c2
-rw-r--r--apps/plugins/mpegplayer/header.c2
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c4
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.h2
-rw-r--r--apps/plugins/nim.c4
-rw-r--r--apps/plugins/oscilloscope.c4
-rw-r--r--apps/plugins/pacbox/arcade.c2
-rw-r--r--apps/plugins/pacbox/hardware.c2
-rw-r--r--apps/plugins/pacbox/pacbox.c4
-rw-r--r--apps/plugins/pegbox.c4
-rw-r--r--apps/plugins/pictureflow.c4
-rw-r--r--apps/plugins/plasma.c4
-rw-r--r--apps/plugins/pong.c4
-rw-r--r--apps/plugins/properties.c16
-rw-r--r--apps/plugins/random_folder_advance_config.c4
-rw-r--r--apps/plugins/reversi/reversi-game.h2
-rw-r--r--apps/plugins/reversi/reversi-gui.c4
-rw-r--r--apps/plugins/robotfindskitten.c4
-rw-r--r--apps/plugins/rockblox.c4
-rw-r--r--apps/plugins/rockbox_flash.c4
-rw-r--r--apps/plugins/rockboy.c2
-rw-r--r--apps/plugins/rockboy/loader.c4
-rw-r--r--apps/plugins/rockboy/loader.h2
-rw-r--r--apps/plugins/rockboy/rockboy.c6
-rw-r--r--apps/plugins/rockboy/rockmacros.h2
-rw-r--r--apps/plugins/rocklife.c4
-rw-r--r--apps/plugins/rockpaint.c8
-rw-r--r--apps/plugins/search.c8
-rw-r--r--apps/plugins/searchengine/searchengine.c4
-rw-r--r--apps/plugins/searchengine/searchengine.h2
-rw-r--r--apps/plugins/shortcuts/shortcuts.h2
-rw-r--r--apps/plugins/shortcuts/shortcuts_append.c2
-rw-r--r--apps/plugins/shortcuts/shortcuts_view.c2
-rw-r--r--apps/plugins/sliding_puzzle.c4
-rw-r--r--apps/plugins/snake.c4
-rw-r--r--apps/plugins/snake2.c4
-rw-r--r--apps/plugins/snow.c4
-rw-r--r--apps/plugins/sokoban.c4
-rw-r--r--apps/plugins/solitaire.c4
-rw-r--r--apps/plugins/sort.c4
-rw-r--r--apps/plugins/spacerocks.c4
-rw-r--r--apps/plugins/splitedit.c4
-rw-r--r--apps/plugins/star.c4
-rw-r--r--apps/plugins/starfield.c6
-rw-r--r--apps/plugins/stats.c4
-rw-r--r--apps/plugins/stopwatch.c4
-rw-r--r--apps/plugins/sudoku/generator.c2
-rw-r--r--apps/plugins/sudoku/sudoku.c4
-rw-r--r--apps/plugins/superdom.c6
-rw-r--r--apps/plugins/test_codec.c4
-rw-r--r--apps/plugins/test_disk.c4
-rw-r--r--apps/plugins/test_fps.c4
-rw-r--r--apps/plugins/test_grey.c4
-rw-r--r--apps/plugins/test_resize.c4
-rw-r--r--apps/plugins/test_sampr.c4
-rw-r--r--apps/plugins/test_scanrate.c4
-rw-r--r--apps/plugins/test_touchpad.c4
-rw-r--r--apps/plugins/test_viewports.c6
-rw-r--r--apps/plugins/text_editor.c6
-rw-r--r--apps/plugins/vbrfix.c8
-rw-r--r--apps/plugins/video.c4
-rw-r--r--apps/plugins/viewer.c6
-rw-r--r--apps/plugins/vu_meter.c2
-rw-r--r--apps/plugins/wav2wv.c38
-rw-r--r--apps/plugins/wavplay.c4
-rw-r--r--apps/plugins/wavrecord.c4
-rw-r--r--apps/plugins/wavview.c6
-rw-r--r--apps/plugins/wormlet.c4
-rw-r--r--apps/plugins/xobox.c4
-rw-r--r--apps/plugins/zxbox.c2
-rw-r--r--apps/plugins/zxbox/spconf.c2
-rw-r--r--apps/plugins/zxbox/spconf.h2
-rw-r--r--apps/plugins/zxbox/spmain.c8
-rw-r--r--apps/plugins/zxbox/spmain.h4
-rw-r--r--apps/plugins/zxbox/zxbox.c4
-rw-r--r--apps/plugins/zxbox/zxconfig.h2
157 files changed, 355 insertions, 362 deletions
diff --git a/apps/plugins/alpine_cdc.c b/apps/plugins/alpine_cdc.c
index 89fc8401ac..6f921e3af8 100644
--- a/apps/plugins/alpine_cdc.c
+++ b/apps/plugins/alpine_cdc.c
@@ -133,8 +133,8 @@ void sound_neutral(void); /* set to everything flat and 0 dB volume */
void sound_normal(void); /* return to user settings */
void thread(void); /* the thread running it all */
-int main(void* parameter); /* main loop */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter); /* entry */
+int main(const void* parameter); /* main loop */
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter); /* entry */
/****************** data types ******************/
@@ -207,7 +207,7 @@ struct
struct thread_entry *thread; /* worker thread id */
} gTread;
-static struct plugin_api* rb; /* here is the global API struct pointer */
+static const struct plugin_api* rb; /* here is the global API struct pointer */
/****************** implementation ******************/
@@ -1133,7 +1133,7 @@ bool exit_tsr(bool reenter)
/****************** main ******************/
-int main(void* parameter)
+int main(const void* parameter)
{
(void)parameter;
#ifdef DEBUG
@@ -1189,7 +1189,7 @@ int main(void* parameter)
/***************** Plugin Entry Point *****************/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
rb = api; /* copy to global api pointer */
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c
index e2f76062c6..de92c91fa3 100644
--- a/apps/plugins/battery_bench.c
+++ b/apps/plugins/battery_bench.c
@@ -169,14 +169,14 @@ PLUGIN_HEADER
#endif
/****************************** Plugin Entry Point ****************************/
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
MEM_FUNCTION_WRAPPERS(rb);
int main(void);
bool exit_tsr(bool);
void thread(void);
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
(void)parameter;
rb = api;
diff --git a/apps/plugins/beatbox/beatbox.c b/apps/plugins/beatbox/beatbox.c
index e24c8e7d0c..7cc7c167f9 100644
--- a/apps/plugins/beatbox/beatbox.c
+++ b/apps/plugins/beatbox/beatbox.c
@@ -178,7 +178,7 @@ const unsigned char * drumNames[]={
long gmbuf[BUF_SIZE*NBUF];
int quit=0;
-struct plugin_api * rb;
+const struct plugin_api * rb;
#define STATE_STOPPED 0
@@ -232,7 +232,7 @@ int editState=EDITSTATE_PATTERN;
int playState=STATE_STOPPED, stepFlag=0;
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int retval = 0;
diff --git a/apps/plugins/blackjack.c b/apps/plugins/blackjack.c
index c3d4926683..a23a833128 100644
--- a/apps/plugins/blackjack.c
+++ b/apps/plugins/blackjack.c
@@ -313,7 +313,7 @@ extern const fb_data card_back[];
#define NEXT_CARD bj->player_cards[done][bj->num_player_cards[done]]
/* global rockbox api */
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
MEM_FUNCTION_WRAPPERS(rb);
@@ -1529,7 +1529,8 @@ static int blackjack(struct game_context* bj) {
/*****************************************************************************
* plugin entry point.
******************************************************************************/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
+{
struct game_context bj;
bool exit = false;
unsigned int position;
diff --git a/apps/plugins/bounce.c b/apps/plugins/bounce.c
index c8a40dec4a..7ad73f6aa4 100644
--- a/apps/plugins/bounce.c
+++ b/apps/plugins/bounce.c
@@ -167,7 +167,7 @@ PLUGIN_HEADER
#endif
#endif
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
#define LETTER_WIDTH 11
#define LETTER_HEIGHT 16
@@ -573,7 +573,7 @@ static int loopit(void)
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int w, h;
char *off = "[Off] to stop";
diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c
index f0059ba633..756b4de0ec 100644
--- a/apps/plugins/brickmania.c
+++ b/apps/plugins/brickmania.c
@@ -195,7 +195,7 @@ PLUGIN_HEADER
#endif
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
enum menu_items {
BM_START,
@@ -2015,7 +2015,7 @@ int game_loop(void)
}
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
(void)parameter;
rb = api;
diff --git a/apps/plugins/bubbles.c b/apps/plugins/bubbles.c
index bc76c15962..32e921338f 100644
--- a/apps/plugins/bubbles.c
+++ b/apps/plugins/bubbles.c
@@ -192,7 +192,7 @@ PLUGIN_HEADER
#define MIN_DISTANCE ((BUBBLE_WIDTH*8)/10)*((BUBBLE_HEIGHT*8)/10)
/* global rockbox api */
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
/* levels */
char level[NUM_LEVELS][BB_LEVEL_HEIGHT][BB_WIDTH] = {
@@ -2585,7 +2585,7 @@ static int bubbles(struct game_context* bb) {
/*****************************************************************************
* plugin entry point.
******************************************************************************/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
struct game_context bb;
bool exit = false;
int position;
diff --git a/apps/plugins/calculator.c b/apps/plugins/calculator.c
index 89bec041c9..47facaadf4 100644
--- a/apps/plugins/calculator.c
+++ b/apps/plugins/calculator.c
@@ -290,7 +290,7 @@ PLUGIN_HEADER
#endif
#endif
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
MEM_FUNCTION_WRAPPERS(rb);
enum {
@@ -1536,7 +1536,7 @@ void sciButtonsProcess(void){
/* -----------------------------------------------------------------------
Main();
----------------------------------------------------------------------- */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
(void)parameter;
rb = api;
diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c
index 8798406b2e..70ca2b4b17 100644
--- a/apps/plugins/calendar.c
+++ b/apps/plugins/calendar.c
@@ -25,7 +25,7 @@
PLUGIN_HEADER
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
static bool leap_year;
static int days_in_month[2][13] = {
@@ -659,7 +659,7 @@ static void prev_day(struct shown *shown, int step)
draw_calendar(shown);
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
struct today today;
struct shown shown;
diff --git a/apps/plugins/chessbox.c b/apps/plugins/chessbox.c
index fc3b703b2c..e6fca80a70 100644
--- a/apps/plugins/chessbox.c
+++ b/apps/plugins/chessbox.c
@@ -27,7 +27,7 @@
PLUGIN_HEADER
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
return run_overlay(api, parameter, PLUGIN_GAMES_DIR "/chessbox.ovl", "ChessBox");
}
diff --git a/apps/plugins/chessbox/chessbox.c b/apps/plugins/chessbox/chessbox.c
index f9e1020461..a90ddd68cb 100644
--- a/apps/plugins/chessbox/chessbox.c
+++ b/apps/plugins/chessbox/chessbox.c
@@ -902,7 +902,7 @@ void cb_play_game(void) {
/*****************************************************************************
* plugin entry point.
******************************************************************************/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
/* plugin init */
diff --git a/apps/plugins/chessbox/chessbox_pgn.c b/apps/plugins/chessbox/chessbox_pgn.c
index 94bda2eaaa..a2b05af255 100644
--- a/apps/plugins/chessbox/chessbox_pgn.c
+++ b/apps/plugins/chessbox/chessbox_pgn.c
@@ -24,7 +24,7 @@
#define LOG_FILE PLUGIN_GAMES_DIR "/chessbox.log"
int loghandler;
-struct plugin_api* rb;
+const struct plugin_api* rb;
short kn_offs[8][2] = {{2,1},{2,-1},{-2,1},{-2,-1},{1,2},{1,-2},{-1,2},{-1,-2}};
short rk_offs[4][2] = {{1,0},{-1,0},{0,1},{0,-1}};
@@ -556,7 +556,7 @@ void write_pgn_token(int fhandler, char *buffer, size_t *line_length){
}
/* ---- api functions ---- */
-struct pgn_game_node* pgn_list_games(struct plugin_api* api,const char* filename){
+struct pgn_game_node* pgn_list_games(const struct plugin_api* api,const char* filename){
int fhandler;
char line_buffer[128];
struct pgn_game_node size_node, *first_game = NULL;
@@ -614,7 +614,7 @@ struct pgn_game_node* pgn_list_games(struct plugin_api* api,const char* filename
return first_game;
}
-struct pgn_game_node* pgn_show_game_list(struct plugin_api* api,
+struct pgn_game_node* pgn_show_game_list(const struct plugin_api* api,
struct pgn_game_node* first_game){
int curr_selection = 0;
int button;
@@ -659,7 +659,7 @@ struct pgn_game_node* pgn_show_game_list(struct plugin_api* api,
}
}
-void pgn_parse_game(struct plugin_api* api, const char* filename,
+void pgn_parse_game(const struct plugin_api* api, const char* filename,
struct pgn_game_node* selected_game){
struct pgn_ply_node size_ply, *first_ply = NULL;
struct pgn_ply_node *temp_ply = NULL, *curr_node = NULL;
@@ -729,7 +729,7 @@ void pgn_parse_game(struct plugin_api* api, const char* filename,
rb->close(fhandler);
}
-struct pgn_game_node* pgn_init_game(struct plugin_api* api){
+struct pgn_game_node* pgn_init_game(const struct plugin_api* api){
struct pgn_game_node game_size, *game;
struct pgn_ply_node ply_size, *ply;
struct tm *current_time;
@@ -767,7 +767,7 @@ struct pgn_game_node* pgn_init_game(struct plugin_api* api){
return game;
}
-void pgn_append_ply(struct plugin_api* api, struct pgn_game_node* game,
+void pgn_append_ply(const struct plugin_api* api, struct pgn_game_node* game,
unsigned short ply_player, char *move_buffer, bool is_mate){
struct pgn_ply_node ply_size, *ply, *temp;
@@ -801,7 +801,7 @@ void pgn_append_ply(struct plugin_api* api, struct pgn_game_node* game,
temp->prev_node = ply;
}
-void pgn_set_result(struct plugin_api* api, struct pgn_game_node* game,
+void pgn_set_result(const struct plugin_api* api, struct pgn_game_node* game,
bool is_mate){
rb = api;
@@ -815,7 +815,7 @@ void pgn_set_result(struct plugin_api* api, struct pgn_game_node* game,
}
}
-void pgn_store_game(struct plugin_api* api, struct pgn_game_node* game){
+void pgn_store_game(const struct plugin_api* api, struct pgn_game_node* game){
int fhandler;
struct pgn_ply_node *ply;
unsigned ply_count;
diff --git a/apps/plugins/chessbox/chessbox_pgn.h b/apps/plugins/chessbox/chessbox_pgn.h
index 672bacaf6e..a457619887 100644
--- a/apps/plugins/chessbox/chessbox_pgn.h
+++ b/apps/plugins/chessbox/chessbox_pgn.h
@@ -350,35 +350,35 @@ struct pgn_game_node {
* the user selects a game, that obviously saves processing
* and speeds up response when the user selects the file
*/
-struct pgn_game_node* pgn_list_games(struct plugin_api* api,
+struct pgn_game_node* pgn_list_games(const struct plugin_api* api,
const char* filename);
/* Show the list of games found in a file and allow the user
* to select a game to be parsed and showed
*/
-struct pgn_game_node* pgn_show_game_list(struct plugin_api* api,
+struct pgn_game_node* pgn_show_game_list(const struct plugin_api* api,
struct pgn_game_node* first_game);
/* Parse the pgn string of a game and assign it to the move
* list in the structure
*/
-void pgn_parse_game(struct plugin_api* api, const char* filename,
+void pgn_parse_game(const struct plugin_api* api, const char* filename,
struct pgn_game_node* selected_game);
/* Initialize a new game structure with default values and make
* it ready to store the history of a newly played match
*/
-struct pgn_game_node* pgn_init_game(struct plugin_api* api);
+struct pgn_game_node* pgn_init_game(const struct plugin_api* api);
/* Add a new ply to the game structure based on the positions */
-void pgn_append_ply(struct plugin_api* api, struct pgn_game_node* game,
+void pgn_append_ply(const struct plugin_api* api, struct pgn_game_node* game,
unsigned short ply_player, char *move_buffer, bool is_mate);
/* Set the result of the game if it was reached during the opponent's ply
*/
-void pgn_set_result(struct plugin_api* api, struct pgn_game_node* game,
+void pgn_set_result(const struct plugin_api* api, struct pgn_game_node* game,
bool is_mate);
/* Store a complete game in the PGN history file
*/
-void pgn_store_game(struct plugin_api* api, struct pgn_game_node* game);
+void pgn_store_game(const struct plugin_api* api, struct pgn_game_node* game);
diff --git a/apps/plugins/chessbox/gnuchess.c b/apps/plugins/chessbox/gnuchess.c
index 3574dd6fbe..51e200d0f2 100644
--- a/apps/plugins/chessbox/gnuchess.c
+++ b/apps/plugins/chessbox/gnuchess.c
@@ -64,7 +64,7 @@
#define taxicab(a,b) (abs(column[a]-column[b]) + abs(row[a]-row[b]))
/* ---- RockBox datatypes and variables */
-struct plugin_api* rb;
+const struct plugin_api* rb;
/* ---- Chess datatypes and variables ---- */
struct leaf
diff --git a/apps/plugins/chessbox/gnuchess.h b/apps/plugins/chessbox/gnuchess.h
index 6a4a6bdd4e..b80647a287 100644
--- a/apps/plugins/chessbox/gnuchess.h
+++ b/apps/plugins/chessbox/gnuchess.h
@@ -44,7 +44,7 @@ extern struct TimeControlRec TimeControl;
extern struct GameRec GameList[240];
/* ---- RockBox integration ---- */
-extern struct plugin_api* rb;
+extern const struct plugin_api* rb;
/* ---- The beginning of a GNUChess v2 APIfication ---- */
void SetTimeControl(void);
diff --git a/apps/plugins/chessclock.c b/apps/plugins/chessclock.c
index d3e39e04ad..0235473438 100644
--- a/apps/plugins/chessclock.c
+++ b/apps/plugins/chessclock.c
@@ -224,7 +224,7 @@ PLUGIN_HEADER
/* here is a global api struct pointer. while not strictly necessary,
it's nice not to have to pass the api pointer in all function calls
in the plugin */
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
MEM_FUNCTION_WRAPPERS(rb);
#define MAX_PLAYERS 10
@@ -257,7 +257,7 @@ static bool pause;
#define MAX_TIME 7200
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int i;
bool done;
diff --git a/apps/plugins/chip8.c b/apps/plugins/chip8.c
index e00e4213e8..d62ff5a7bf 100644
--- a/apps/plugins/chip8.c
+++ b/apps/plugins/chip8.c
@@ -24,7 +24,7 @@
PLUGIN_HEADER
-static struct plugin_api* rb; /* here is a global api struct pointer */
+static const struct plugin_api* rb; /* here is a global api struct pointer */
#define EXTERN static
#define STATIC static
@@ -1287,7 +1287,7 @@ static void chip8_interrupt (void)
starttimer = newtimer - runtime;
}
-static bool chip8_init(char* file)
+static bool chip8_init(const char* file)
{
int numread;
int fd;
@@ -1307,14 +1307,16 @@ static bool chip8_init(char* file)
rb->close(fd);
/* is there a c8k file (chip8 keys) ? */
+ char c8kname[MAX_PATH];
+ rb->strcpy(c8kname, file);
for(i=0; i<16; i++) {
chip8_virtual_keys[i] = 0;
chip8_keymap[i] = i;
}
- len = rb->strlen(file);
- file[len-2] = '8';
- file[len-1] = 'k';
- fd = rb->open(file, O_RDONLY);
+ len = rb->strlen(c8kname);
+ c8kname[len-2] = '8';
+ c8kname[len-1] = 'k';
+ fd = rb->open(c8kname, O_RDONLY);
if (fd!=-1) {
rb->lcd_puts(0, 6, "File&Keymap OK.");
numread = rb->read(fd, chip8_keymap, 16);
@@ -1340,7 +1342,7 @@ static bool chip8_init(char* file)
return true;
}
-bool chip8_run(char* file)
+bool chip8_run(const char* file)
{
int ok;
@@ -1406,9 +1408,9 @@ bool chip8_run(char* file)
/***************** Plugin Entry Point *****************/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
- char* filename;
+ const char* filename;
rb = api; /* copy to global api pointer */
diff --git a/apps/plugins/chopper.c b/apps/plugins/chopper.c
index 2ab7c09d1c..09d281ea81 100644
--- a/apps/plugins/chopper.c
+++ b/apps/plugins/chopper.c
@@ -125,7 +125,7 @@ Still To do:
#endif
#endif
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
#define NUMBER_OF_BLOCKS 8
#define NUMBER_OF_PARTICLES 3
@@ -979,7 +979,7 @@ void chopper_load(bool newgame)
}
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
(void)parameter;
rb = api;
diff --git a/apps/plugins/clock/clock.c b/apps/plugins/clock/clock.c
index 07057d21b2..588112cf63 100644
--- a/apps/plugins/clock/clock.c
+++ b/apps/plugins/clock/clock.c
@@ -54,7 +54,7 @@ const struct button_mapping* plugin_contexts[]={
#define ACTION_SKIN_PREV PLA_DEC
#define ACTION_SKIN_PREV_REPEAT PLA_DEC_REPEAT
-extern struct plugin_api* rb;
+extern const struct plugin_api* rb;
/**************************
* Cleanup on plugin return
@@ -109,7 +109,7 @@ void format_date(char* buffer, struct time* time, enum date_format format){
/**********************************************************************
* Plugin starts here
**********************************************************************/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter){
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter){
int button;
int last_second = -1;
bool redraw=true;
diff --git a/apps/plugins/clock/clock.h b/apps/plugins/clock/clock.h
index eeb04380a2..76822ec162 100644
--- a/apps/plugins/clock/clock.h
+++ b/apps/plugins/clock/clock.h
@@ -20,7 +20,7 @@
#ifndef _CLOCK_
#define _CLOCK_
#include "clock_settings.h"
-extern struct plugin_api* rb;
+extern const struct plugin_api* rb;
struct time{
int year, day, month;
diff --git a/apps/plugins/credits.c b/apps/plugins/credits.c
index c0967c6235..dc19e0ebff 100644
--- a/apps/plugins/credits.c
+++ b/apps/plugins/credits.c
@@ -21,7 +21,7 @@
PLUGIN_HEADER
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
const char* const credits[] = {
#include "credits.raw" /* generated list of names from docs/CREDITS */
@@ -367,7 +367,7 @@ void roll_credits(void)
#endif
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
(void)parameter;
rb = api;
diff --git a/apps/plugins/cube.c b/apps/plugins/cube.c
index aed27329ec..bc5564b473 100644
--- a/apps/plugins/cube.c
+++ b/apps/plugins/cube.c
@@ -425,7 +425,7 @@ static long matrice[3][3];
static const int nb_points = 8;
static long z_off = 600;
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
static void cube_rotate(int xa, int ya, int za)
{
@@ -580,7 +580,7 @@ void cleanup(void *parameter)
#endif
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
char buffer[30];
int t_disp = 0;
diff --git a/apps/plugins/demystify.c b/apps/plugins/demystify.c
index 580783f18d..df92184b08 100644
--- a/apps/plugins/demystify.c
+++ b/apps/plugins/demystify.c
@@ -65,7 +65,7 @@ struct line_color
/******************************* Globals ***********************************/
-static struct plugin_api* rb; /* global api struct pointer */
+static const struct plugin_api* rb; /* global api struct pointer */
/*
* Compute a new random step to make the point bounce the borders of the screen
@@ -424,7 +424,7 @@ int plugin_main(void)
/*************************** Plugin entry point ****************************/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int ret;
diff --git a/apps/plugins/dice.c b/apps/plugins/dice.c
index 7688d91a07..cde89e1144 100644
--- a/apps/plugins/dice.c
+++ b/apps/plugins/dice.c
@@ -44,7 +44,7 @@ struct dices
#define PRINT_BUFFER_LENGTH MAX_DICES*4
PLUGIN_HEADER
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
static struct dices dice;
static int sides_index;
@@ -72,7 +72,7 @@ void dice_print(struct dices* dice, struct screen* display);
bool dice_menu(struct dices* dice);
/* plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
(void)parameter;
rb = api;
int i, action;
diff --git a/apps/plugins/dict.c b/apps/plugins/dict.c
index a149f0089a..26670f7aa4 100644
--- a/apps/plugins/dict.c
+++ b/apps/plugins/dict.c
@@ -22,7 +22,7 @@
PLUGIN_HEADER
/* save the plugin api pointer. */
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
/* screen info */
static int display_columns, display_lines;
@@ -138,7 +138,7 @@ long reverse (long N) {
#define DICT_DESC ROCKBOX_DIR "/rocks/apps/dict.desc"
/* the main plugin function */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
char searchword[WORDLEN]; /* word to search for */
char *description; /* pointer to description buffer */
diff --git a/apps/plugins/disktidy.c b/apps/plugins/disktidy.c
index dd75408d48..ed29206d6b 100644
--- a/apps/plugins/disktidy.c
+++ b/apps/plugins/disktidy.c
@@ -19,7 +19,7 @@
#include "plugin.h"
PLUGIN_HEADER
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
/* function return values */
enum tidy_return
@@ -412,7 +412,7 @@ int tidy_lcd_menu(void)
}
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
enum tidy_system system = TIDY_ALL;
enum tidy_return status;
diff --git a/apps/plugins/doom/rockdoom.c b/apps/plugins/doom/rockdoom.c
index f23e856fdc..b36e677c49 100644
--- a/apps/plugins/doom/rockdoom.c
+++ b/apps/plugins/doom/rockdoom.c
@@ -99,7 +99,7 @@ int my_close(int id)
return 0;
}
#endif
-struct plugin_api* rb;
+const struct plugin_api* rb;
#define MAXARGVS 100
bool noprintf=0; // Variable disables printf lcd updates to protect grayscale lib/direct lcd updates
@@ -675,7 +675,7 @@ int doom_menu()
extern int systemvol;
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
PLUGIN_IRAM_INIT(api)
diff --git a/apps/plugins/doom/rockmacros.h b/apps/plugins/doom/rockmacros.h
index 2ddbb94fcf..1611807b40 100644
--- a/apps/plugins/doom/rockmacros.h
+++ b/apps/plugins/doom/rockmacros.h
@@ -24,7 +24,7 @@
#include "autoconf.h"
#include "z_zone.h"
-extern struct plugin_api* rb;
+extern const struct plugin_api* rb;
extern bool noprintf;
extern bool doomexit;
diff --git a/apps/plugins/euroconverter.c b/apps/plugins/euroconverter.c
index 224fb85703..fe45bef6c3 100644
--- a/apps/plugins/euroconverter.c
+++ b/apps/plugins/euroconverter.c
@@ -140,7 +140,7 @@ static unsigned char *abbrev_str[12] = {
static unsigned long heuro,hhome; /*Handles for the new patterns*/
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
static char *currency_str[12] = {
"France",
@@ -402,7 +402,7 @@ static void euro_exit(void *parameter)
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
bool end, pos;
longlong_t e,h,old_e,old_h;
diff --git a/apps/plugins/fire.c b/apps/plugins/fire.c
index c26822c8dc..2755436c7c 100644
--- a/apps/plugins/fire.c
+++ b/apps/plugins/fire.c
@@ -41,7 +41,7 @@
PLUGIN_HEADER
-static struct plugin_api* rb; /* global api struct pointer */
+static const struct plugin_api* rb; /* global api struct pointer */
#ifndef HAVE_LCD_COLOR
GREY_INFO_STRUCT
@@ -344,7 +344,7 @@ int main(void)
/*************************** Plugin entry point ****************************/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int ret;
diff --git a/apps/plugins/fireworks.c b/apps/plugins/fireworks.c
index 361930f1c8..d06cbdf912 100644
--- a/apps/plugins/fireworks.c
+++ b/apps/plugins/fireworks.c
@@ -22,7 +22,7 @@
PLUGIN_HEADER
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
/***
* FIREWORKS.C by ZAKK ROBERTS
@@ -385,7 +385,7 @@ void fireworks_menu(void)
}
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
(void)parameter;
diff --git a/apps/plugins/firmware_flash.c b/apps/plugins/firmware_flash.c
index f4daab2fcd..6cbb252cd1 100644
--- a/apps/plugins/firmware_flash.c
+++ b/apps/plugins/firmware_flash.c
@@ -126,7 +126,7 @@ typedef struct
char name[32];
} tFlashInfo;
-static struct plugin_api* rb; /* here is a global api struct pointer */
+static const struct plugin_api* rb; /* here is a global api struct pointer */
#define MASK_ADR 0xFC /* position of hardware mask value in Flash */
#define VERSION_ADR 0xFE /* position of firmware version value in Flash */
@@ -1072,7 +1072,7 @@ void DoUserDialog(char* filename)
/***************** Plugin Entry Point *****************/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int oldmode;
diff --git a/apps/plugins/flipit.c b/apps/plugins/flipit.c
index 874ddf41f7..7e865b0ea8 100644
--- a/apps/plugins/flipit.c
+++ b/apps/plugins/flipit.c
@@ -244,7 +244,7 @@ PLUGIN_HEADER
#endif
#endif
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
static int spots[20];
static int toggle[20];
static int cursor_pos, moves;
@@ -591,7 +591,7 @@ static bool flipit_loop(void)
}
/* called function from outside */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int i, rc;
diff --git a/apps/plugins/greyscale.c b/apps/plugins/greyscale.c
index 17449b9f62..cffa8f1940 100644
--- a/apps/plugins/greyscale.c
+++ b/apps/plugins/greyscale.c
@@ -102,7 +102,7 @@ PLUGIN_HEADER
/******************************* Globals ***********************************/
GREY_INFO_STRUCT
-static struct plugin_api* rb; /* global api struct pointer */
+static const struct plugin_api* rb; /* global api struct pointer */
static char pbuf[32]; /* global printf buffer */
static unsigned char *gbuf;
static size_t gbuf_size = 0;
@@ -361,7 +361,7 @@ int main(void)
/*************************** Plugin entry point ****************************/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
rb = api; /* copy to global api pointer */
(void)parameter;
diff --git a/apps/plugins/helloworld.c b/apps/plugins/helloworld.c
index eca9d2e85a..ebad484d9c 100644
--- a/apps/plugins/helloworld.c
+++ b/apps/plugins/helloworld.c
@@ -27,10 +27,10 @@ PLUGIN_HEADER
/* here is a global api struct pointer. while not strictly necessary,
it's nice not to have to pass the api pointer in all function calls
in the plugin */
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
/* if you don't use the parameter, you can do like
this to avoid the compiler warning about it */
diff --git a/apps/plugins/invadrox.c b/apps/plugins/invadrox.c
index 946e36d05a..1294ed35c3 100644
--- a/apps/plugins/invadrox.c
+++ b/apps/plugins/invadrox.c
@@ -595,7 +595,7 @@ unsigned char fire_sprite[FIRE_HEIGHT] = {
#define CYCLETIME 40
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
/* Physical x is at PLAYFIELD_X + LIVES_X + x * ALIEN_SPEED
* Physical y is at y * ALIEN_HEIGHT
@@ -1785,7 +1785,7 @@ void game_loop(void)
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, UNUSED void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, UNUSED const void* parameter)
{
rb = api;
diff --git a/apps/plugins/iriver_flash.c b/apps/plugins/iriver_flash.c
index d9ea73b622..af002acb2f 100644
--- a/apps/plugins/iriver_flash.c
+++ b/apps/plugins/iriver_flash.c
@@ -54,7 +54,7 @@ struct flash_info
char name[32];
};
-static struct plugin_api* rb; /* here is a global api struct pointer */
+static const struct plugin_api* rb; /* here is a global api struct pointer */
#ifdef IRIVER_H100_SERIES
#define SEC_SIZE 4096
@@ -802,7 +802,7 @@ void DoUserDialog(char* filename)
/***************** Plugin Entry Point *****************/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int oldmode;
diff --git a/apps/plugins/iriverify.c b/apps/plugins/iriverify.c
index b578cf7e0c..abff78266d 100644
--- a/apps/plugins/iriverify.c
+++ b/apps/plugins/iriverify.c
@@ -25,7 +25,7 @@
PLUGIN_HEADER
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
ssize_t buf_size;
static char *filename;
@@ -130,7 +130,7 @@ static int write_file(void)
return 0;
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
char *buf;
int rc;
diff --git a/apps/plugins/jackpot.c b/apps/plugins/jackpot.c
index de99eae2a9..5950551b44 100644
--- a/apps/plugins/jackpot.c
+++ b/apps/plugins/jackpot.c
@@ -69,7 +69,7 @@ const struct picture jackpot_pictures[]={
#define SLEEP_TIME (HZ/200)
#endif /* HAVE_LCD_CHARCELLS */
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
struct jackpot
{
@@ -290,7 +290,7 @@ void jackpot_play_turn(struct jackpot* game)
jackpot_print_turn_result(game, gain, rb->screens[d]);
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
rb = api;
int action, i;
diff --git a/apps/plugins/jewels.c b/apps/plugins/jewels.c
index ddd659d2a1..7eec89eaa3 100644
--- a/apps/plugins/jewels.c
+++ b/apps/plugins/jewels.c
@@ -339,7 +339,7 @@ struct jewels_menu {
};
/* global rockbox api */
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
/* external bitmaps */
extern const fb_data jewels[];
@@ -1898,7 +1898,7 @@ static int jewels_main(struct game_context* bj) {
/*****************************************************************************
* plugin entry point.
******************************************************************************/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
struct game_context bj;
bool exit = false;
int position;
diff --git a/apps/plugins/jpeg.c b/apps/plugins/jpeg.c
index e95c10bbfa..a05eaa72dc 100644
--- a/apps/plugins/jpeg.c
+++ b/apps/plugins/jpeg.c
@@ -279,7 +279,7 @@ GREY_INFO_STRUCT
/******************************* Globals ***********************************/
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
MEM_FUNCTION_WRAPPERS(rb);
/* for portability of below JPEG code */
@@ -3318,7 +3318,7 @@ int load_and_show(char* filename)
/******************** Plugin entry point *********************/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
rb = api;
diff --git a/apps/plugins/lamp.c b/apps/plugins/lamp.c
index 943cc97fce..2f91545edc 100644
--- a/apps/plugins/lamp.c
+++ b/apps/plugins/lamp.c
@@ -92,7 +92,7 @@ PLUGIN_HEADER
# endif
#endif
-static struct plugin_api* rb; /* global api struct pointer */
+static const struct plugin_api* rb; /* global api struct pointer */
#ifdef HAVE_LCD_COLOR
/* RGB color sets */
@@ -102,7 +102,7 @@ static int colorset[NUM_COLORSETS][3] = { { 255, 255, 255 } , /* white */
#endif /* HAVE_LCD_COLOR */
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
(void)parameter;
rb = api;
diff --git a/apps/plugins/lib/bmp.c b/apps/plugins/lib/bmp.c
index 20adc6de86..c46093a8d9 100644
--- a/apps/plugins/lib/bmp.c
+++ b/apps/plugins/lib/bmp.c
@@ -30,7 +30,7 @@
/**
* Save to 24 bit bitmap.
*/
-int save_bmp_file( char* filename, struct bitmap *bm, struct plugin_api* rb )
+int save_bmp_file( char* filename, struct bitmap *bm, const struct plugin_api* rb )
{
/* I'm not really sure about this one :) */
int line_width = bm->width*3+((bm->width*3)%4?4-((bm->width*3)%4):0);
diff --git a/apps/plugins/lib/bmp.h b/apps/plugins/lib/bmp.h
index 10f71865f7..9114df1ee5 100644
--- a/apps/plugins/lib/bmp.h
+++ b/apps/plugins/lib/bmp.h
@@ -26,7 +26,7 @@
/**
* Save bitmap to file
*/
-int save_bmp_file( char* filename, struct bitmap *bm, struct plugin_api* rb );
+int save_bmp_file( char* filename, struct bitmap *bm, const struct plugin_api* rb );
#endif
/**
diff --git a/apps/plugins/lib/checkbox.c b/apps/plugins/lib/checkbox.c
index 5acc52a728..039d5f9cbf 100644
--- a/apps/plugins/lib/checkbox.c
+++ b/apps/plugins/lib/checkbox.c
@@ -25,7 +25,7 @@
/*
* Print a checkbox
*/
-void checkbox(struct plugin_api *api, int x, int y, int width, int height, bool checked)
+void checkbox(const struct plugin_api *api, int x, int y, int width, int height, bool checked)
{
/* draw box */
api->lcd_drawrect(x, y, width, height);
diff --git a/apps/plugins/lib/checkbox.h b/apps/plugins/lib/checkbox.h
index 2a5ffea0aa..72de4952ca 100644
--- a/apps/plugins/lib/checkbox.h
+++ b/apps/plugins/lib/checkbox.h
@@ -24,6 +24,6 @@
/*
* Print a checkbox
*/
-void checkbox(struct plugin_api *api, int x, int y, int width, int height, bool checked);
+void checkbox(const struct plugin_api *api, int x, int y, int width, int height, bool checked);
#endif
diff --git a/apps/plugins/lib/configfile.c b/apps/plugins/lib/configfile.c
index b0d134fae9..516bf616cb 100644
--- a/apps/plugins/lib/configfile.c
+++ b/apps/plugins/lib/configfile.c
@@ -19,9 +19,9 @@
#include "plugin.h"
#include "configfile.h"
-static struct plugin_api *cfg_rb;
+static const struct plugin_api *cfg_rb;
-void configfile_init(struct plugin_api* newrb)
+void configfile_init(const struct plugin_api* newrb)
{
cfg_rb = newrb;
}
diff --git a/apps/plugins/lib/configfile.h b/apps/plugins/lib/configfile.h
index 7aa69f3ecf..fe4b43c485 100644
--- a/apps/plugins/lib/configfile.h
+++ b/apps/plugins/lib/configfile.h
@@ -37,7 +37,7 @@ struct configdata
NULL otherwise */
};
-void configfile_init(struct plugin_api* newrb);
+void configfile_init(const struct plugin_api* newrb);
/* configfile_save - Given configdata entries this function will
create a config file with these entries, destroying any
diff --git a/apps/plugins/lib/grey.h b/apps/plugins/lib/grey.h
index 81912b1995..4a15bd38ea 100644
--- a/apps/plugins/lib/grey.h
+++ b/apps/plugins/lib/grey.h
@@ -50,7 +50,7 @@
#define GREY_ON_COP 0x0004 /* Run ISR on COP (PP targets) */
/* Library initialisation and release */
-bool grey_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
+bool grey_init(const struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
unsigned features, int width, int height, long *buf_taken);
void grey_release(void);
@@ -168,16 +168,16 @@ struct _grey_info
int by; /* 4-pixel or 8-pixel units */
int bheight; /* 4-pixel or 8-pixel units */
#endif
- unsigned long flags; /* various flags, see #defines */
- struct plugin_api *rb; /* plugin API pointer */
- unsigned char *values; /* start of greyscale pixel values */
- unsigned char *phases; /* start of greyscale pixel phases */
- unsigned char *buffer; /* start of chunky pixel buffer (for buffered mode) */
- unsigned char gvalue[256]; /* calculated brightness -> greyvalue table */
- int fg_brightness; /* current foreground brightness */
- int bg_brightness; /* current background brightness */
- int drawmode; /* current draw mode */
- int curfont; /* current selected font */
+ unsigned long flags; /* various flags, see #defines */
+ const struct plugin_api *rb; /* plugin API pointer */
+ unsigned char *values; /* start of greyscale pixel values */
+ unsigned char *phases; /* start of greyscale pixel phases */
+ unsigned char *buffer; /* start of chunky pixel buffer (for buffered mode) */
+ unsigned char gvalue[256]; /* calculated brightness -> greyvalue table */
+ int fg_brightness; /* current foreground brightness */
+ int bg_brightness; /* current background brightness */
+ int drawmode; /* current draw mode */
+ int curfont; /* current selected font */
};
/* Global variable, defined in the plugin */
diff --git a/apps/plugins/lib/grey_core.c b/apps/plugins/lib/grey_core.c
index e2260cdf11..e7f02dd6cb 100644
--- a/apps/plugins/lib/grey_core.c
+++ b/apps/plugins/lib/grey_core.c
@@ -478,7 +478,7 @@ static void fill_gvalues(void)
The function is authentic regarding memory usage on the simulator, even
if it doesn't use all of the allocated memory. */
-bool grey_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
+bool grey_init(const struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
unsigned features, int width, int height, long *buf_taken)
{
int bdim, i;
diff --git a/apps/plugins/lib/helper.c b/apps/plugins/lib/helper.c
index 8ac822b407..691a17f15c 100644
--- a/apps/plugins/lib/helper.c
+++ b/apps/plugins/lib/helper.c
@@ -21,7 +21,7 @@
#include "helper.h"
/* Force the backlight on */
-void backlight_force_on(struct plugin_api* rb)
+void backlight_force_on(const struct plugin_api* rb)
{
if(!rb)
return;
@@ -34,7 +34,7 @@ void backlight_force_on(struct plugin_api* rb)
}
/* Reset backlight operation to its settings */
-void backlight_use_settings(struct plugin_api* rb)
+void backlight_use_settings(const struct plugin_api* rb)
{
if (!rb)
return;
@@ -47,7 +47,7 @@ void backlight_use_settings(struct plugin_api* rb)
#ifdef HAVE_REMOTE_LCD
/* Force the backlight on */
-void remote_backlight_force_on(struct plugin_api* rb)
+void remote_backlight_force_on(const struct plugin_api* rb)
{
if (!rb)
return;
@@ -60,7 +60,7 @@ void remote_backlight_force_on(struct plugin_api* rb)
}
/* Reset backlight operation to its settings */
-void remote_backlight_use_settings(struct plugin_api* rb)
+void remote_backlight_use_settings(const struct plugin_api* rb)
{
if (!rb)
return;
@@ -75,7 +75,7 @@ void remote_backlight_use_settings(struct plugin_api* rb)
#ifdef HAVE_BUTTON_LIGHT
/* Force the buttonlight on */
-void buttonlight_force_on(struct plugin_api* rb)
+void buttonlight_force_on(const struct plugin_api* rb)
{
if (!rb)
return;
@@ -84,7 +84,7 @@ void buttonlight_force_on(struct plugin_api* rb)
}
/* Reset buttonlight operation to its settings */
-void buttonlight_use_settings(struct plugin_api* rb)
+void buttonlight_use_settings(const struct plugin_api* rb)
{
if (!rb)
return;
diff --git a/apps/plugins/lib/helper.h b/apps/plugins/lib/helper.h
index 4d1328bd0c..d34e6334f0 100644
--- a/apps/plugins/lib/helper.h
+++ b/apps/plugins/lib/helper.h
@@ -24,14 +24,14 @@
/**
* Backlight on/off operations
*/
-void backlight_force_on(struct plugin_api* rb);
-void backlight_use_settings(struct plugin_api* rb);
+void backlight_force_on(const struct plugin_api* rb);
+void backlight_use_settings(const struct plugin_api* rb);
#ifdef HAVE_REMOTE_LCD
-void remote_backlight_force_on(struct plugin_api* rb);
-void remote_backlight_use_settings(struct plugin_api* rb);
+void remote_backlight_force_on(const struct plugin_api* rb);
+void remote_backlight_use_settings(const struct plugin_api* rb);
#endif
#ifdef HAVE_BUTTON_LIGHT
-void buttonlight_force_on(struct plugin_api* rb);
-void buttonlight_use_settings(struct plugin_api* rb);
+void buttonlight_force_on(const struct plugin_api* rb);
+void buttonlight_use_settings(const struct plugin_api* rb);
#endif
#endif
diff --git a/apps/plugins/lib/highscore.c b/apps/plugins/lib/highscore.c
index df7a71bcdf..94b6a7b947 100644
--- a/apps/plugins/lib/highscore.c
+++ b/apps/plugins/lib/highscore.c
@@ -19,9 +19,9 @@
#include "plugin.h"
#include "highscore.h"
-static struct plugin_api *rb;
+static const struct plugin_api *rb;
-void highscore_init(struct plugin_api* newrb)
+void highscore_init(const struct plugin_api* newrb)
{
rb = newrb;
}
diff --git a/apps/plugins/lib/highscore.h b/apps/plugins/lib/highscore.h
index ba7da241f1..b6501cf568 100644
--- a/apps/plugins/lib/highscore.h
+++ b/apps/plugins/lib/highscore.h
@@ -26,7 +26,7 @@ struct highscore
int level;
};
-void highscore_init(struct plugin_api* newrb);
+void highscore_init(const struct plugin_api* newrb);
int highscore_save(char *filename, struct highscore *scores, int num_scores);
int highscore_load(char *filename, struct highscore *scores, int num_scores);
int highscore_update(int score, int level, struct highscore *scores, int num_scores);
diff --git a/apps/plugins/lib/oldmenuapi.c b/apps/plugins/lib/oldmenuapi.c
index 27e4fdd49e..51fb4f3eb2 100644
--- a/apps/plugins/lib/oldmenuapi.c
+++ b/apps/plugins/lib/oldmenuapi.c
@@ -27,7 +27,7 @@
#include "plugin.h"
#include "oldmenuapi.h"
-struct plugin_api *rb = NULL;
+const struct plugin_api *rb = NULL;
struct menu {
struct menu_item* items;
@@ -65,7 +65,7 @@ static int menu_find_free(void)
return(i);
}
-int menu_init(struct plugin_api *api, const struct menu_item* mitems,
+int menu_init(const struct plugin_api *api, const struct menu_item* mitems,
int count, int (*callback)(int, int),
const char *button1, const char *button2, const char *button3)
{
diff --git a/apps/plugins/lib/oldmenuapi.h b/apps/plugins/lib/oldmenuapi.h
index 34f6226d59..ccfd1400dd 100644
--- a/apps/plugins/lib/oldmenuapi.h
+++ b/apps/plugins/lib/oldmenuapi.h
@@ -31,7 +31,7 @@ struct menu_item {
bool (*function) (void); /* return true if USB was connected */
};
-int menu_init(struct plugin_api *api, const struct menu_item* mitems,
+int menu_init(const struct plugin_api *api, const struct menu_item* mitems,
int count, int (*callback)(int, int),
const char *button1, const char *button2, const char *button3);
void menu_exit(int menu);
diff --git a/apps/plugins/lib/overlay.c b/apps/plugins/lib/overlay.c
index 53cc4a84f0..63fb776f02 100644
--- a/apps/plugins/lib/overlay.c
+++ b/apps/plugins/lib/overlay.c
@@ -44,7 +44,7 @@
The linker script for the overlay should use a base address towards the
end of the audiobuffer, just low enough to make the overlay fit. */
-enum plugin_status run_overlay(struct plugin_api* rb, void* parameter,
+enum plugin_status run_overlay(const struct plugin_api* rb, const void* parameter,
unsigned char *filename, unsigned char *name)
{
int fd, readsize;
diff --git a/apps/plugins/lib/overlay.h b/apps/plugins/lib/overlay.h
index bbf7549274..ba9b1fa308 100644
--- a/apps/plugins/lib/overlay.h
+++ b/apps/plugins/lib/overlay.h
@@ -26,7 +26,7 @@
#include "plugin.h"
/* load and run a plugin linked as an overlay. */
-enum plugin_status run_overlay(struct plugin_api* api, void* parameter,
+enum plugin_status run_overlay(const struct plugin_api* api, const void* parameter,
unsigned char *filename, unsigned char *name);
#endif /* !SIMULATOR */
diff --git a/apps/plugins/lib/playback_control.c b/apps/plugins/lib/playback_control.c
index 7e74728ab4..b0456248a8 100644
--- a/apps/plugins/lib/playback_control.c
+++ b/apps/plugins/lib/playback_control.c
@@ -20,7 +20,7 @@
#include "plugin.h"
#include "playback_control.h"
-struct plugin_api* api = 0;
+const struct plugin_api* api = 0;
struct viewport *parentvp = NULL;
static bool prevtrack(void)
@@ -105,14 +105,14 @@ MAKE_MENU(playback_control_menu, "Playback Control", NULL, Icon_NOICON,
&prevtrack_item, &playpause_item, &stop_item, &nexttrack_item,
&volume_item, &shuffle_item, &repeat_mode_item);
-void playback_control_init(struct plugin_api* newapi,
+void playback_control_init(const struct plugin_api* newapi,
struct viewport parent[NB_SCREENS])
{
api = newapi;
parentvp = parent;
}
-bool playback_control(struct plugin_api* newapi,
+bool playback_control(const struct plugin_api* newapi,
struct viewport parent[NB_SCREENS])
{
api = newapi;
diff --git a/apps/plugins/lib/playback_control.h b/apps/plugins/lib/playback_control.h
index a3a0d7afbc..23b586095e 100644
--- a/apps/plugins/lib/playback_control.h
+++ b/apps/plugins/lib/playback_control.h
@@ -25,11 +25,11 @@
So, make sure you use the same viewport for the rb->do_menu() call
that you use in the playback_control_init() call
*/
-void playback_control_init(struct plugin_api* newapi,
+void playback_control_init(const struct plugin_api* newapi,
struct viewport parent[NB_SCREENS]);
/* Use this if your menu still uses the old menu api */
-bool playback_control(struct plugin_api* api,
+bool playback_control(const struct plugin_api* api,
struct viewport parent[NB_SCREENS]);
#endif /* __PLAYBACK_CONTROL_H__ */
diff --git a/apps/plugins/lib/playergfx.c b/apps/plugins/lib/playergfx.c
index 8853078fa1..4139a6c605 100644
--- a/apps/plugins/lib/playergfx.c
+++ b/apps/plugins/lib/playergfx.c
@@ -26,7 +26,7 @@
/*** globals ***/
-static struct plugin_api *pgfx_rb = NULL; /* global api struct pointer */
+static const struct plugin_api *pgfx_rb = NULL; /* global api struct pointer */
static int char_width;
static int char_height;
static int pixel_height;
@@ -38,7 +38,7 @@ static int drawmode = DRMODE_SOLID;
/*** Special functions ***/
/* library init */
-bool pgfx_init(struct plugin_api* newrb, int cwidth, int cheight)
+bool pgfx_init(const struct plugin_api* newrb, int cwidth, int cheight)
{
int i;
diff --git a/apps/plugins/lib/playergfx.h b/apps/plugins/lib/playergfx.h
index 5f49831609..504599ae39 100644
--- a/apps/plugins/lib/playergfx.h
+++ b/apps/plugins/lib/playergfx.h
@@ -26,7 +26,7 @@
#ifdef HAVE_LCD_CHARCELLS /* Player only :) */
-bool pgfx_init(struct plugin_api* newrb, int cwidth, int cheight);
+bool pgfx_init(const struct plugin_api* newrb, int cwidth, int cheight);
void pgfx_release(void);
void pgfx_display(int cx, int cy);
void pgfx_display_block(int cx, int cy, int x, int y);
diff --git a/apps/plugins/lib/pluginlib_actions.c b/apps/plugins/lib/pluginlib_actions.c
index be78bf1408..a63ffb352a 100644
--- a/apps/plugins/lib/pluginlib_actions.c
+++ b/apps/plugins/lib/pluginlib_actions.c
@@ -464,7 +464,7 @@ static const struct button_mapping* get_context_map(int context)
else return NULL;
}
-int pluginlib_getaction(struct plugin_api *api,int timeout,
+int pluginlib_getaction(const struct plugin_api *api,int timeout,
const struct button_mapping *plugin_contexts[],
int count)
{
diff --git a/apps/plugins/lib/pluginlib_actions.h b/apps/plugins/lib/pluginlib_actions.h
index c11a087904..601cd73a8c 100644
--- a/apps/plugins/lib/pluginlib_actions.h
+++ b/apps/plugins/lib/pluginlib_actions.h
@@ -58,7 +58,7 @@ extern const struct button_mapping generic_left_right_fire[];
extern const struct button_mapping generic_actions[];
extern const struct button_mapping generic_increase_decrease[];
-int pluginlib_getaction(struct plugin_api *api,int timeout,
+int pluginlib_getaction(const struct plugin_api *api,int timeout,
const struct button_mapping *plugin_contexts[],
int count);
diff --git a/apps/plugins/lib/profile_plugin.c b/apps/plugins/lib/profile_plugin.c
index 38c6d81598..6f31288c8f 100644
--- a/apps/plugins/lib/profile_plugin.c
+++ b/apps/plugins/lib/profile_plugin.c
@@ -21,9 +21,9 @@
#include "plugin.h"
-static struct plugin_api *local_rb = NULL; /* global api struct pointer */
+static const struct plugin_api *local_rb = NULL; /* global api struct pointer */
-void profile_init(struct plugin_api* pa)
+void profile_init(const struct plugin_api* pa)
{
local_rb = pa;
}
diff --git a/apps/plugins/lib/profile_plugin.h b/apps/plugins/lib/profile_plugin.h
index 71cff37033..6bc19734d8 100644
--- a/apps/plugins/lib/profile_plugin.h
+++ b/apps/plugins/lib/profile_plugin.h
@@ -24,7 +24,7 @@
#include "plugin.h"
-void profile_init(struct plugin_api* pa);
+void profile_init(const struct plugin_api* pa);
void __cyg_profile_func_enter(void *this_fn, void *call_site)
NO_PROF_ATTR ICODE_ATTR;
diff --git a/apps/plugins/lib/xlcd.h b/apps/plugins/lib/xlcd.h
index 59a048228b..a1e2389f39 100644
--- a/apps/plugins/lib/xlcd.h
+++ b/apps/plugins/lib/xlcd.h
@@ -26,7 +26,7 @@
#ifdef HAVE_LCD_BITMAP
-void xlcd_init(struct plugin_api* newrb);
+void xlcd_init(const struct plugin_api* newrb);
void xlcd_filltriangle(int x1, int y1, int x2, int y2, int x3, int y3);
void xlcd_filltriangle_screen(struct screen* display,
int x1, int y1, int x2, int y2, int x3, int y3);
@@ -49,7 +49,7 @@ void xlcd_scroll_up(int count);
void xlcd_scroll_down(int count);
/* internal stuff */
-extern struct plugin_api *_xlcd_rb; /* global api struct pointer */
+extern const struct plugin_api *_xlcd_rb; /* global api struct pointer */
#endif /* HAVE_LCD_BITMAP */
#endif /* __XLCD_H__ */
diff --git a/apps/plugins/lib/xlcd_core.c b/apps/plugins/lib/xlcd_core.c
index e8cc688591..7f8e566865 100644
--- a/apps/plugins/lib/xlcd_core.c
+++ b/apps/plugins/lib/xlcd_core.c
@@ -27,12 +27,12 @@
/*** globals ***/
-struct plugin_api *_xlcd_rb = NULL; /* global api struct pointer */
+const struct plugin_api *_xlcd_rb = NULL; /* global api struct pointer */
/*** functions ***/
/* library init */
-void xlcd_init(struct plugin_api* newrb)
+void xlcd_init(const struct plugin_api* newrb)
{
_xlcd_rb = newrb;
}
diff --git a/apps/plugins/logo.c b/apps/plugins/logo.c
index f08ca3a62a..79ff6acb62 100644
--- a/apps/plugins/logo.c
+++ b/apps/plugins/logo.c
@@ -176,12 +176,12 @@ const unsigned char rockbox16x7[] = {
#endif
#endif
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
int button;
int timer = 10;
int x = (DISPLAY_WIDTH / 2) - (LOGO_WIDTH / 2);
int y = (DISPLAY_HEIGHT / 2) - (LOGO_HEIGHT / 2);
- struct plugin_api* rb = api;
+ const struct plugin_api* rb = api;
int dx;
int dy;
#ifdef HAVE_LCD_CHARCELLS
diff --git a/apps/plugins/mandelbrot.c b/apps/plugins/mandelbrot.c
index 1576b875dd..8b045e74de 100644
--- a/apps/plugins/mandelbrot.c
+++ b/apps/plugins/mandelbrot.c
@@ -273,7 +273,7 @@ PLUGIN_HEADER
#define MYXLCD(fn) xlcd_ ## fn
#endif
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
/* Fixed point format s5.26: sign, 5 bits integer part, 26 bits fractional part */
static long x_min;
@@ -661,7 +661,7 @@ void cleanup(void *parameter)
#define REDRAW_PARTIAL 1
#define REDRAW_FULL 2
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int button;
int lastbutton = BUTTON_NONE;
diff --git a/apps/plugins/matrix.c b/apps/plugins/matrix.c
index 33509dc69a..65a4a6b785 100644
--- a/apps/plugins/matrix.c
+++ b/apps/plugins/matrix.c
@@ -119,7 +119,7 @@ extern const fb_data matrix_normal[];
#define SLEEP HZ/50
/* Codec api pointer */
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
/* Each position is of this type */
typedef struct cmatrix {
@@ -284,7 +284,7 @@ static void matrix_loop(void)
}
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
int button;
int sleep = SLEEP;
bool frozen = false;
diff --git a/apps/plugins/maze.c b/apps/plugins/maze.c
index cebdc46cff..f18dd68eb6 100644
--- a/apps/plugins/maze.c
+++ b/apps/plugins/maze.c
@@ -79,7 +79,7 @@ PLUGIN_HEADER
#define BORDER_W 0x00000080
#define PATH 0x00000100
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
#ifdef __PLUGINLIB_ACTIONS_H__
const struct button_mapping *plugin_contexts[]
@@ -470,7 +470,7 @@ void maze_move_player_right(struct maze* maze)
/**********************************/
/* this is the plugin entry point */
/**********************************/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int button, lastbutton = BUTTON_NONE;
int quit = 0;
diff --git a/apps/plugins/mazezam.c b/apps/plugins/mazezam.c
index 2ee6e20059..93d9ec4c9a 100644
--- a/apps/plugins/mazezam.c
+++ b/apps/plugins/mazezam.c
@@ -26,7 +26,7 @@
/* Include standard plugin macro */
PLUGIN_HEADER
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
/* The plugin actions of interest. */
const struct button_mapping *plugin_contexts[]
@@ -916,7 +916,7 @@ static void main_menu(void)
/*****************************************************************************
* Plugin entry point
******************************************************************************/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
enum plugin_status plugin_state;
diff --git a/apps/plugins/metronome.c b/apps/plugins/metronome.c
index a778429195..85b1260a86 100644
--- a/apps/plugins/metronome.c
+++ b/apps/plugins/metronome.c
@@ -78,7 +78,7 @@ const struct button_mapping *plugin_contexts[]={
};
#define PLA_ARRAY_COUNT sizeof(plugin_contexts)/sizeof(plugin_contexts[0])
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
MEM_FUNCTION_WRAPPERS(rb);
@@ -299,7 +299,7 @@ void tap(void)
reset_tap = false;
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter){
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter){
int button;
enum plugin_status status;
diff --git a/apps/plugins/midi/midifile.c b/apps/plugins/midi/midifile.c
index 5f98e895a2..6411b8e658 100644
--- a/apps/plugins/midi/midifile.c
+++ b/apps/plugins/midi/midifile.c
@@ -26,7 +26,7 @@ int readID(int file);
struct MIDIfile midi_file IBSS_ATTR;
-struct MIDIfile * loadFile(char * filename)
+struct MIDIfile * loadFile(const char * filename)
{
struct MIDIfile * mfload;
int file = rb->open (filename, O_RDONLY);
diff --git a/apps/plugins/midi/midifile.h b/apps/plugins/midi/midifile.h
index a1024d500b..25ab2f5b19 100644
--- a/apps/plugins/midi/midifile.h
+++ b/apps/plugins/midi/midifile.h
@@ -17,5 +17,5 @@
*
****************************************************************************/
-struct MIDIfile * loadFile(char * filename);
+struct MIDIfile * loadFile(const char * filename);
diff --git a/apps/plugins/midi/midiplay.c b/apps/plugins/midi/midiplay.c
index e97d7acf1c..69be53e75d 100644
--- a/apps/plugins/midi/midiplay.c
+++ b/apps/plugins/midi/midiplay.c
@@ -191,11 +191,11 @@ int32_t gmbuf[BUF_SIZE*NBUF];
static unsigned int samples_in_buf;
int quit=0;
-struct plugin_api * rb;
+const struct plugin_api * rb;
-static int midimain(void * filename);
+static int midimain(const void * filename);
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int retval = 0;
@@ -292,7 +292,7 @@ void get_more(unsigned char** start, size_t* size)
#endif
}
-static int midimain(void * filename)
+static int midimain(const void * filename)
{
int notesUsed = 0;
int a=0;
diff --git a/apps/plugins/midi2wav.c b/apps/plugins/midi2wav.c
index ad41451d88..6e4e7d1bc1 100644
--- a/apps/plugins/midi2wav.c
+++ b/apps/plugins/midi2wav.c
@@ -54,20 +54,14 @@ long bpm;
#include "midi/synth.c"
-
-
int fd=-1; /* File descriptor where the output is written */
extern long tempo; /* The sequencer keeps track of this */
-
-struct plugin_api * rb;
-
-
-
+const struct plugin_api * rb;
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
(void)parameter;
rb = api;
diff --git a/apps/plugins/minesweeper.c b/apps/plugins/minesweeper.c
index e4b8c939b4..7b1587ce6f 100644
--- a/apps/plugins/minesweeper.c
+++ b/apps/plugins/minesweeper.c
@@ -221,7 +221,7 @@ enum minesweeper_status {
* it's nice not to have to pass the api pointer in all function calls
* in the plugin
*/
-static struct plugin_api *rb;
+static const struct plugin_api *rb;
extern const fb_data minesweeper_tiles[];
@@ -731,7 +731,7 @@ enum minesweeper_status minesweeper( void )
}
/* plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
bool exit = false;
diff --git a/apps/plugins/mosaique.c b/apps/plugins/mosaique.c
index 9545f89f59..4d7b0af795 100644
--- a/apps/plugins/mosaique.c
+++ b/apps/plugins/mosaique.c
@@ -141,7 +141,7 @@ PLUGIN_HEADER
#endif
#endif
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int button;
int timer = 10;
@@ -149,7 +149,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
int y=0;
int sx = 3;
int sy = 3;
- struct plugin_api* rb = api;
+ const struct plugin_api* rb = api;
(void)parameter;
#ifdef HAVE_LCD_CHARCELLS
diff --git a/apps/plugins/mp3_encoder.c b/apps/plugins/mp3_encoder.c
index a344bdc7dc..db9c9d4e67 100644
--- a/apps/plugins/mp3_encoder.c
+++ b/apps/plugins/mp3_encoder.c
@@ -16,7 +16,7 @@
PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
MEM_FUNCTION_WRAPPERS(rb);
@@ -806,7 +806,7 @@ static const int win_const[18][4] = {
{ 134, -146,-3352,-3072 } };
-static char* wav_filename;
+static const char* wav_filename;
static int mp3file, wavfile, wav_size, frames;
static uint32 enc_buffer[16384]; /* storage for 65536 Bytes */
static int enc_chunk = 0; /* encode chunk counter */
@@ -2278,7 +2278,7 @@ void compress(void)
int num_file;
char mp3_name[80];
-void get_mp3_filename(char *wav_name)
+void get_mp3_filename(const char *wav_name)
{
int slen = rb->strlen(wav_name);
rb->strncpy(mp3_name, wav_name, 79);
@@ -2353,7 +2353,7 @@ void get_mp3_filename(char *wav_name)
#endif
#endif
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int rat, srat, nrat; /* for rate selection */
int cont = 1, butt;
diff --git a/apps/plugins/mpegplayer/decode.c b/apps/plugins/mpegplayer/decode.c
index ab3a800d9b..1c85fa7a92 100644
--- a/apps/plugins/mpegplayer/decode.c
+++ b/apps/plugins/mpegplayer/decode.c
@@ -25,7 +25,7 @@
#include "mpeg2dec_config.h"
-extern struct plugin_api* rb;
+extern const struct plugin_api* rb;
#include "mpeg2.h"
#include "attributes.h"
diff --git a/apps/plugins/mpegplayer/header.c b/apps/plugins/mpegplayer/header.c
index 3dd3d280dd..d8d005b692 100644
--- a/apps/plugins/mpegplayer/header.c
+++ b/apps/plugins/mpegplayer/header.c
@@ -26,7 +26,7 @@
#include "mpeg2dec_config.h"
-extern struct plugin_api* rb;
+extern const struct plugin_api* rb;
#include "mpeg2.h"
#include "attributes.h"
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 8e46b24eee..82703ca840 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -257,7 +257,7 @@ PLUGIN_IRAM_DECLARE
#endif
#endif
-struct plugin_api* rb;
+const struct plugin_api* rb;
CACHE_FUNCTION_WRAPPERS(rb);
ALIGN_BUFFER_WRAPPER(rb);
@@ -1544,7 +1544,7 @@ static void button_loop(void)
backlight_use_settings(rb);
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int status = PLUGIN_ERROR; /* assume failure */
int result;
diff --git a/apps/plugins/mpegplayer/mpegplayer.h b/apps/plugins/mpegplayer/mpegplayer.h
index b92af38e6c..fa13a1e378 100644
--- a/apps/plugins/mpegplayer/mpegplayer.h
+++ b/apps/plugins/mpegplayer/mpegplayer.h
@@ -22,7 +22,7 @@
#define MPEGPLAYER_H
/* Global API pointer */
-extern struct plugin_api* rb;
+extern const struct plugin_api* rb;
#ifdef HAVE_SCHEDULER_BOOSTCTRL
#define trigger_cpu_boost rb->trigger_cpu_boost
diff --git a/apps/plugins/nim.c b/apps/plugins/nim.c
index b13cfe415b..ae3297d458 100644
--- a/apps/plugins/nim.c
+++ b/apps/plugins/nim.c
@@ -59,7 +59,7 @@ static unsigned char str[12]; /*String use to display the first line*/
static unsigned long hsmile,hcry,h1,h2; /*Handle for the new pattern*/
static bool end; /*If true game is finished*/
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
/*Display that the action it's impossible*/
@@ -138,7 +138,7 @@ static void nim_exit(void *parameter)
}
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int y,z,button;
int x,v,min;
diff --git a/apps/plugins/oscilloscope.c b/apps/plugins/oscilloscope.c
index eae1a7bc4c..e126ff57d0 100644
--- a/apps/plugins/oscilloscope.c
+++ b/apps/plugins/oscilloscope.c
@@ -249,7 +249,7 @@ enum { OSC_HORIZ, OSC_VERT, MAX_OSC };
/* global variables */
-struct plugin_api* rb; /* global api struct pointer */
+const struct plugin_api* rb; /* global api struct pointer */
/* settings */
struct osc_config {
@@ -650,7 +650,7 @@ void cleanup(void *parameter)
backlight_use_settings(rb); /* backlight control in lib/helper.c */
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int button, vol;
int lastbutton = BUTTON_NONE;
diff --git a/apps/plugins/pacbox/arcade.c b/apps/plugins/pacbox/arcade.c
index db7bf0bb89..5244ed8d8c 100644
--- a/apps/plugins/pacbox/arcade.c
+++ b/apps/plugins/pacbox/arcade.c
@@ -27,7 +27,7 @@
#include <string.h>
#include "plugin.h"
-extern struct plugin_api* rb;
+extern const struct plugin_api* rb;
#ifndef HAVE_LCD_COLOR
/* Convert RGB888 to 2-bit greyscale - logic taken from bmp2rb.c */
diff --git a/apps/plugins/pacbox/hardware.c b/apps/plugins/pacbox/hardware.c
index 23658cf61e..376fe3273f 100644
--- a/apps/plugins/pacbox/hardware.c
+++ b/apps/plugins/pacbox/hardware.c
@@ -25,7 +25,7 @@
#include "plugin.h"
#include "hardware.h"
-extern struct plugin_api* rb;
+extern const struct plugin_api* rb;
/* The main data for Pacman */
diff --git a/apps/plugins/pacbox/pacbox.c b/apps/plugins/pacbox/pacbox.c
index fad27358d2..1eb040e24d 100644
--- a/apps/plugins/pacbox/pacbox.c
+++ b/apps/plugins/pacbox/pacbox.c
@@ -32,7 +32,7 @@
PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
-struct plugin_api* rb;
+const struct plugin_api* rb;
struct pacman_settings {
int difficulty;
@@ -361,7 +361,7 @@ static int gameProc( void )
return 0;
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
(void)parameter;
diff --git a/apps/plugins/pegbox.c b/apps/plugins/pegbox.c
index e41c724da6..ed58ac605d 100644
--- a/apps/plugins/pegbox.c
+++ b/apps/plugins/pegbox.c
@@ -25,7 +25,7 @@
#endif
#include "pegbox_pieces.h"
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
PLUGIN_HEADER
@@ -1256,7 +1256,7 @@ static int pegbox(struct game_context* pb) {
/*****************************************************************************
* plugin entry point.
******************************************************************************/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
bool exit = false;
struct game_context pb;
diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c
index e5494d661a..bea028eadc 100644
--- a/apps/plugins/pictureflow.c
+++ b/apps/plugins/pictureflow.c
@@ -34,7 +34,7 @@ PLUGIN_HEADER
/******************************* Globals ***********************************/
-static struct plugin_api *rb; /* global api struct pointer */
+static const struct plugin_api *rb; /* global api struct pointer */
const struct button_mapping *plugin_contexts[]
= {generic_actions, generic_directions};
@@ -2080,7 +2080,7 @@ int main(void)
/*************************** Plugin entry point ****************************/
-enum plugin_status plugin_start(struct plugin_api *api, void *parameter)
+enum plugin_status plugin_start(const struct plugin_api *api, const void *parameter)
{
int ret;
diff --git a/apps/plugins/plasma.c b/apps/plugins/plasma.c
index e8ae7645b4..027a8355da 100644
--- a/apps/plugins/plasma.c
+++ b/apps/plugins/plasma.c
@@ -36,7 +36,7 @@ PLUGIN_HEADER
/******************************* Globals ***********************************/
-static struct plugin_api* rb; /* global api struct pointer */
+static const struct plugin_api* rb; /* global api struct pointer */
static unsigned char wave_array[256]; /* Pre calculated wave array */
#ifdef HAVE_LCD_COLOR
static fb_data colours[256]; /* Smooth transition of shades */
@@ -343,7 +343,7 @@ int main(void)
/*************************** Plugin entry point ****************************/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int ret;
diff --git a/apps/plugins/pong.c b/apps/plugins/pong.c
index 8163915fb6..c7382a58b2 100644
--- a/apps/plugins/pong.c
+++ b/apps/plugins/pong.c
@@ -174,7 +174,7 @@ PLUGIN_HEADER
#endif
#endif
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
struct pong {
int ballx; /* current X*RES position of the ball */
@@ -453,7 +453,7 @@ void showscore(struct pong *p)
}
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
struct pong pong;
int game = 1;
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c
index 27805154b3..05d05a746b 100644
--- a/apps/plugins/properties.c
+++ b/apps/plugins/properties.c
@@ -20,7 +20,7 @@
PLUGIN_HEADER
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
MEM_FUNCTION_WRAPPERS(rb);
@@ -252,21 +252,23 @@ char * get_props(int selected_item, void* data, char *buffer, size_t buffer_len)
return buffer;
}
-enum plugin_status plugin_start(struct plugin_api* api, void* file)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
rb = api;
struct gui_synclist properties_lists;
int button;
bool prev_show_statusbar;
bool quit = false;
+ char file[MAX_PATH];
+ rb->strcpy(file, (const char *) parameter);
/* determine if it's a file or a directory */
bool found = false;
DIR* dir;
struct dirent* entry;
- char* ptr = rb->strrchr((char*)file, '/') + 1;
- int dirlen = (ptr - (char*)file);
- rb->strncpy(str_dirname, (char*)file, dirlen);
+ char* ptr = rb->strrchr(file, '/') + 1;
+ int dirlen = (ptr - file);
+ rb->strncpy(str_dirname, file, dirlen);
str_dirname[dirlen] = 0;
dir = rb->opendir(str_dirname);
@@ -288,13 +290,13 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file)
if(!found)
{
/* weird: we couldn't find the entry. This Should Never Happen (TM) */
- rb->splash(0, "File/Dir not found: %s", (char*)file);
+ rb->splash(0, "File/Dir not found: %s", file);
rb->action_userabort(TIMEOUT_BLOCK);
return PLUGIN_OK;
}
/* get the info depending on its_a_dir */
- if(!(its_a_dir ? dir_properties((char*)file):file_properties((char*)file)))
+ if(!(its_a_dir ? dir_properties(file) : file_properties(file)))
{
/* something went wrong (to do: tell user what it was (nesting,...) */
rb->splash(0, "Failed to gather information");
diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c
index 413dc029b4..4df764285f 100644
--- a/apps/plugins/random_folder_advance_config.c
+++ b/apps/plugins/random_folder_advance_config.c
@@ -21,7 +21,7 @@
PLUGIN_HEADER
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
static bool abort;
static int fd;
static int dirs_count;
@@ -544,7 +544,7 @@ int main_menu(void)
return 0;
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
(void)parameter;
diff --git a/apps/plugins/reversi/reversi-game.h b/apps/plugins/reversi/reversi-game.h
index de05df78f9..9558f000bf 100644
--- a/apps/plugins/reversi/reversi-game.h
+++ b/apps/plugins/reversi/reversi-game.h
@@ -58,7 +58,7 @@ typedef struct _reversi_board_t {
*/
move_t history[BOARD_SIZE*BOARD_SIZE - INIT_STONES];
- struct plugin_api *rb;
+ const struct plugin_api *rb;
} reversi_board_t;
diff --git a/apps/plugins/reversi/reversi-gui.c b/apps/plugins/reversi/reversi-gui.c
index 1995923f4f..a7e695529b 100644
--- a/apps/plugins/reversi/reversi-gui.c
+++ b/apps/plugins/reversi/reversi-gui.c
@@ -52,7 +52,7 @@ PLUGIN_HEADER
/* The global api struct pointer. While not strictly necessary,
it's nice not to have to pass the api pointer in all function
calls in the plugin */
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
/* Thickness of the grid lines */
#define LINE_THCK 1
@@ -543,7 +543,7 @@ static void reversi_gui_move_cursor(int new_row, int new_col) {
/* plugin entry point */
-enum plugin_status plugin_start(struct plugin_api *api, void *parameter) {
+enum plugin_status plugin_start(const struct plugin_api *api, const void *parameter) {
bool exit, draw_screen;
int button;
int lastbutton = BUTTON_NONE;
diff --git a/apps/plugins/robotfindskitten.c b/apps/plugins/robotfindskitten.c
index a2786b7e2d..a2208a30d5 100644
--- a/apps/plugins/robotfindskitten.c
+++ b/apps/plugins/robotfindskitten.c
@@ -180,7 +180,7 @@ int screen[X_MAX + 1][Y_MAX + 1];
/* here is a global api struct pointer. while not strictly necessary,
it's nice not to have to pass the api pointer in all function calls
in the plugin */
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
/******************************************************************************
*
@@ -593,7 +593,7 @@ static void initialize_screen()
}
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
(void)parameter;
rb = api;
diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c
index 62e7c747e1..3df427da48 100644
--- a/apps/plugins/rockblox.c
+++ b/apps/plugins/rockblox.c
@@ -507,7 +507,7 @@ extern const fb_data rockblox_background[];
/* must have variable */
-static struct plugin_api *rb;
+static const struct plugin_api *rb;
static bool gameover = false;
/* c=current f=figure o=orientation n=next */
@@ -1159,7 +1159,7 @@ static int rockblox_loop (void)
return PLUGIN_OK;
}
-enum plugin_status plugin_start (struct plugin_api *api, void *parameter)
+enum plugin_status plugin_start (const struct plugin_api *api, const void *parameter)
{
int ret;
diff --git a/apps/plugins/rockbox_flash.c b/apps/plugins/rockbox_flash.c
index ed0fd17f53..fd855ff520 100644
--- a/apps/plugins/rockbox_flash.c
+++ b/apps/plugins/rockbox_flash.c
@@ -95,7 +95,7 @@ typedef struct
char name[32];
} tFlashInfo;
-static struct plugin_api* rb; /* here is a global api struct pointer */
+static const struct plugin_api* rb; /* here is a global api struct pointer */
static UINT8* sector; /* better not place this on the stack... */
@@ -1017,7 +1017,7 @@ void DoUserDialog(char* filename)
/***************** Plugin Entry Point *****************/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int oldmode;
diff --git a/apps/plugins/rockboy.c b/apps/plugins/rockboy.c
index 67f10043ba..c4b1ff0425 100644
--- a/apps/plugins/rockboy.c
+++ b/apps/plugins/rockboy.c
@@ -27,7 +27,7 @@
PLUGIN_HEADER
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
return run_overlay(api, parameter, PLUGIN_GAMES_DIR "/rockboy.ovl", "RockBoy");
}
diff --git a/apps/plugins/rockboy/loader.c b/apps/plugins/rockboy/loader.c
index d48a06957e..71ab4e78d7 100644
--- a/apps/plugins/rockboy/loader.c
+++ b/apps/plugins/rockboy/loader.c
@@ -99,7 +99,7 @@ static const unsigned char ramsize_table[5] =
0, 1, 1, 4, 16
};
-static char *romfile;
+static const char *romfile;
static char sramfile[500];
static char rtcfile[500];
static char saveprefix[500];
@@ -284,7 +284,7 @@ void cleanup(void)
/* IDEA - if error, write emergency savestate..? */
}
-void loader_init(char *s)
+void loader_init(const char *s)
{
romfile = s;
if(rom_load())
diff --git a/apps/plugins/rockboy/loader.h b/apps/plugins/rockboy/loader.h
index 33217d55f3..5ade6e7d8a 100644
--- a/apps/plugins/rockboy/loader.h
+++ b/apps/plugins/rockboy/loader.h
@@ -3,7 +3,7 @@
#ifndef __LOADER_H__
#define __LOADER_H__
-void loader_init(char *s);
+void loader_init(const char *s);
void cleanup(void);
#endif
diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c
index 58696a1f61..a0e87d041d 100644
--- a/apps/plugins/rockboy/rockboy.c
+++ b/apps/plugins/rockboy/rockboy.c
@@ -30,7 +30,7 @@ PLUGIN_IRAM_DECLARE
/* here is a global api struct pointer. while not strictly necessary,
it's nice not to have to pass the api pointer in all function calls
in the plugin */
-struct plugin_api* rb;
+const struct plugin_api* rb;
int shut,cleanshut;
char *errormsg;
@@ -275,7 +275,7 @@ void doevents(void)
}
}
-static int gnuboy_main(char *rom)
+static int gnuboy_main(const char *rom)
{
rb->lcd_puts(0,0,"Init video");
vid_init();
@@ -297,7 +297,7 @@ static int gnuboy_main(char *rom)
}
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
PLUGIN_IRAM_INIT(api)
diff --git a/apps/plugins/rockboy/rockmacros.h b/apps/plugins/rockboy/rockmacros.h
index 89cb845ec2..18e4d5c255 100644
--- a/apps/plugins/rockboy/rockmacros.h
+++ b/apps/plugins/rockboy/rockmacros.h
@@ -26,7 +26,7 @@
#define malloc(a) my_malloc(a)
void *my_malloc(size_t size);
-extern struct plugin_api* rb;
+extern const struct plugin_api* rb;
extern int shut,cleanshut;
void vid_init(void);
inline void vid_begin(void);
diff --git a/apps/plugins/rocklife.c b/apps/plugins/rocklife.c
index 49e1e8fc33..507f131322 100644
--- a/apps/plugins/rocklife.c
+++ b/apps/plugins/rocklife.c
@@ -77,7 +77,7 @@ PLUGIN_HEADER
#define PATTERN_ACORN 3
#define PATTERN_GLIDER_GUN 4 /* not yet implemented */
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
const struct button_mapping *plugin_contexts[]
= {generic_directions, generic_actions};
@@ -393,7 +393,7 @@ static void next_generation(char *pgrid, char *pnext_grid){
/**********************************/
/* this is the plugin entry point */
/**********************************/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int button = 0;
int quit = 0;
diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c
index 997cbef0f3..e612d458bb 100644
--- a/apps/plugins/rockpaint.c
+++ b/apps/plugins/rockpaint.c
@@ -256,7 +256,7 @@ static void inv_cursor(bool update);
static void restore_screen(void);
static void clear_drawing(void);
static void goto_menu(void);
-static int load_bitmap( char *filename );
+static int load_bitmap( const char *filename );
static int save_bitmap( char *filename );
static void draw_rect_full( int x1, int y1, int x2, int y2 );
extern int errno;
@@ -269,7 +269,7 @@ extern int errno;
int errno;
#endif
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
MEM_FUNCTION_WRAPPERS(rb);
@@ -2953,7 +2953,7 @@ static bool rockpaint_loop( void )
return PLUGIN_OK;
}
-static int load_bitmap( char *file )
+static int load_bitmap( const char *file )
{
struct bitmap bm;
bool ret;
@@ -2992,7 +2992,7 @@ static int save_bitmap( char *file )
return save_bmp_file( file, &bm, rb );
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
/** must have stuff **/
rb = api;
diff --git a/apps/plugins/search.c b/apps/plugins/search.c
index 097f4ac7d5..5f034ef8ae 100644
--- a/apps/plugins/search.c
+++ b/apps/plugins/search.c
@@ -22,7 +22,7 @@
PLUGIN_HEADER
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
#define BUFFER_SIZE 16384
@@ -114,7 +114,7 @@ static void clear_display(void){
}
}
-static bool search_init(char* file){
+static bool search_init(const char* file){
rb->memset(search_string, 0, sizeof(search_string));
if (!rb->kbd_input(search_string,sizeof search_string)){
@@ -144,10 +144,10 @@ static bool search_init(char* file){
}
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int ok;
- char *filename = parameter;
+ const char *filename = parameter;
char *p;
rb = api;
diff --git a/apps/plugins/searchengine/searchengine.c b/apps/plugins/searchengine/searchengine.c
index 62d3a91fa7..944714eb2f 100644
--- a/apps/plugins/searchengine/searchengine.c
+++ b/apps/plugins/searchengine/searchengine.c
@@ -26,7 +26,7 @@ PLUGIN_HEADER
void *audio_bufferbase;
void *audio_bufferpointer;
size_t audio_buffer_free;
-struct plugin_api* rb;
+const struct plugin_api* rb;
int w, h, y;
void *my_malloc(size_t size)
@@ -56,7 +56,7 @@ void setmallocpos(void *pointer)
}
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
unsigned char *result,buf[500];
int parsefd,hits;
diff --git a/apps/plugins/searchengine/searchengine.h b/apps/plugins/searchengine/searchengine.h
index 07248ef37e..b0f6597971 100644
--- a/apps/plugins/searchengine/searchengine.h
+++ b/apps/plugins/searchengine/searchengine.h
@@ -38,7 +38,7 @@ rb->lcd_update()
rb->lcd_update()
#endif
-extern struct plugin_api* rb;
+extern const struct plugin_api* rb;
void *my_malloc(size_t size);
void setmallocpos(void *pointer);
diff --git a/apps/plugins/shortcuts/shortcuts.h b/apps/plugins/shortcuts/shortcuts.h
index 34f200d193..2d2c705a66 100644
--- a/apps/plugins/shortcuts/shortcuts.h
+++ b/apps/plugins/shortcuts/shortcuts.h
@@ -32,7 +32,7 @@
#define SHORTCUTS_FILENAME "/shortcuts.link"
-extern struct plugin_api* rb;
+extern const struct plugin_api* rb;
typedef struct sc_entry_s
{
diff --git a/apps/plugins/shortcuts/shortcuts_append.c b/apps/plugins/shortcuts/shortcuts_append.c
index afd03929ae..4174bdd2d8 100644
--- a/apps/plugins/shortcuts/shortcuts_append.c
+++ b/apps/plugins/shortcuts/shortcuts_append.c
@@ -49,7 +49,7 @@ bool append_entry_to_file(sc_file_t *file, char *path, bool is_dir)
}
-enum plugin_status plugin_start(struct plugin_api* api, void* void_parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* void_parameter)
{
rb = api;
bool found;
diff --git a/apps/plugins/shortcuts/shortcuts_view.c b/apps/plugins/shortcuts/shortcuts_view.c
index 5e7d9c2b00..47f0203b87 100644
--- a/apps/plugins/shortcuts/shortcuts_view.c
+++ b/apps/plugins/shortcuts/shortcuts_view.c
@@ -198,7 +198,7 @@ bool ends_with(char *string, char *suffix)
}
-enum plugin_status plugin_start(struct plugin_api* api, void* void_parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* void_parameter)
{
rb = api;
bool leave_loop;
diff --git a/apps/plugins/sliding_puzzle.c b/apps/plugins/sliding_puzzle.c
index 1e99a7adaf..36c95b9dda 100644
--- a/apps/plugins/sliding_puzzle.c
+++ b/apps/plugins/sliding_puzzle.c
@@ -184,7 +184,7 @@ PLUGIN_HEADER
#define IMAGE_HEIGHT BMPHEIGHT_sliding_puzzle
#define IMAGE_SIZE IMAGE_WIDTH
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
/* use a square image, (the default Archos bitmap looks square on its display)
Puzzle image dimension is min(lcd_height,lcd_width)
@@ -603,7 +603,7 @@ static int puzzle_loop(void)
}
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int i, w, h;
diff --git a/apps/plugins/snake.c b/apps/plugins/snake.c
index 6203a07a23..471b72f6b1 100644
--- a/apps/plugins/snake.c
+++ b/apps/plugins/snake.c
@@ -174,7 +174,7 @@ PLUGIN_HEADER
static int board[BOARD_WIDTH][BOARD_HEIGHT],snakelength;
static unsigned int score,hiscore=0,level=1;
static short dir,frames,apple,dead=0;
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
void die (void)
{
@@ -432,7 +432,7 @@ void game_init(void) {
}
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
(void)(parameter);
rb = api;
diff --git a/apps/plugins/snake2.c b/apps/plugins/snake2.c
index 0452294195..625e5c5a6a 100644
--- a/apps/plugins/snake2.c
+++ b/apps/plugins/snake2.c
@@ -354,7 +354,7 @@ static int apple;
static int level = 4, speed = 5,dead = 0, quit = 0;
static int sillydir = 0, num_levels = 0;
static int level_from_file = 0;
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
static int headx, heady, tailx, taily, applecountdown = 5;
static int game_type = 0;
static int num_apples_to_get=1;
@@ -1398,7 +1398,7 @@ void game_init(void)
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
(void)(parameter);
rb = api;
diff --git a/apps/plugins/snow.c b/apps/plugins/snow.c
index 6550050646..becc7d871a 100644
--- a/apps/plugins/snow.c
+++ b/apps/plugins/snow.c
@@ -70,7 +70,7 @@ PLUGIN_HEADER
#endif
static short particles[NUM_PARTICLES][2];
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
#ifdef HAVE_LCD_BITMAP
#if LCD_WIDTH >= 160
@@ -185,7 +185,7 @@ static void snow_init(void)
#endif
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int button;
(void)(parameter);
diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c
index 2b12a3da58..bc5bf42e8d 100644
--- a/apps/plugins/sokoban.c
+++ b/apps/plugins/sokoban.c
@@ -372,7 +372,7 @@ static struct BufferedBoards {
} buffered_boards;
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
MEM_FUNCTION_WRAPPERS(rb);
static char buf[ROWS*(COLS + 1)]; /* Enough for a whole board or a filename */
@@ -1576,7 +1576,7 @@ static bool sokoban_loop(void)
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int w, h;
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c
index 0907054a1c..d16b65c549 100644
--- a/apps/plugins/solitaire.c
+++ b/apps/plugins/solitaire.c
@@ -28,7 +28,7 @@
PLUGIN_HEADER
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
#define min(a,b) (a<b?a:b)
/**
@@ -1843,7 +1843,7 @@ int solitaire( int skipmenu )
* Plugin entry point
*/
-enum plugin_status plugin_start( struct plugin_api* api, void* parameter )
+enum plugin_status plugin_start( const struct plugin_api* api, const void* parameter )
{
int result;
diff --git a/apps/plugins/sort.c b/apps/plugins/sort.c
index f99549ebd7..571978cf1c 100644
--- a/apps/plugins/sort.c
+++ b/apps/plugins/sort.c
@@ -57,7 +57,7 @@
PLUGIN_HEADER
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
ssize_t buf_size;
static char *filename;
@@ -176,7 +176,7 @@ static int write_file(void)
return 0;
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
char *buf;
int rc;
diff --git a/apps/plugins/spacerocks.c b/apps/plugins/spacerocks.c
index bfddb453dc..8db5ff92cf 100644
--- a/apps/plugins/spacerocks.c
+++ b/apps/plugins/spacerocks.c
@@ -25,7 +25,7 @@
PLUGIN_HEADER
/******************************* Globals ***********************************/
-static struct plugin_api* rb; /* global api struct pointer */
+static const struct plugin_api* rb; /* global api struct pointer */
/* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD
#define AST_PAUSE BUTTON_ON
@@ -2022,7 +2022,7 @@ enum plugin_status start_game(void)
}
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
enum plugin_status retval;
(void)(parameter);
diff --git a/apps/plugins/splitedit.c b/apps/plugins/splitedit.c
index ab4ce415b7..419ce7a676 100644
--- a/apps/plugins/splitedit.c
+++ b/apps/plugins/splitedit.c
@@ -97,7 +97,7 @@ unsigned char SCALE_BMP[][13] =
#define SE_COUNT 5
/* the global api pointer */
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
/* contains the file name of the song that is to be split */
static char path_mp3[MAX_PATH];
@@ -1248,7 +1248,7 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
return retval;
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
struct mp3entry* mp3;
diff --git a/apps/plugins/star.c b/apps/plugins/star.c
index 46780f9ea7..1b7c4d01b5 100644
--- a/apps/plugins/star.c
+++ b/apps/plugins/star.c
@@ -310,7 +310,7 @@ static char board[STAR_HEIGHT][STAR_WIDTH];
static int char_width = -1;
static int char_height = -1;
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
/* this arrays contains a group of levels loaded into memory */
static unsigned char* levels =
@@ -1101,7 +1101,7 @@ static int star_menu(void)
/**
* Main entry point
*/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
(void)parameter;
rb = api;
diff --git a/apps/plugins/starfield.c b/apps/plugins/starfield.c
index 754af24f8c..130e077cc7 100644
--- a/apps/plugins/starfield.c
+++ b/apps/plugins/starfield.c
@@ -24,7 +24,7 @@ PLUGIN_HEADER
/******************************* Globals ***********************************/
-static struct plugin_api* rb; /* global api struct pointer */
+static const struct plugin_api* rb; /* global api struct pointer */
/* Key assignement */
#if (CONFIG_KEYPAD == IPOD_4G_PAD) || \
@@ -169,7 +169,7 @@ static struct plugin_api* rb; /* global api struct pointer */
#define MSG_DISP_TIME 30
-static struct plugin_api* rb; /* global api struct pointer */
+static const struct plugin_api* rb; /* global api struct pointer */
/*
* Each star's stuffs
@@ -432,7 +432,7 @@ int plugin_main(void)
/*************************** Plugin entry point ****************************/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int ret;
diff --git a/apps/plugins/stats.c b/apps/plugins/stats.c
index a65fde4704..be73e23406 100644
--- a/apps/plugins/stats.c
+++ b/apps/plugins/stats.c
@@ -20,7 +20,7 @@
PLUGIN_HEADER
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
static int files, dirs, musicfiles, largestdir;
static int lasttick;
static bool abort;
@@ -183,7 +183,7 @@ void traversedir(char* location, char* name)
largestdir = files_in_dir;
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int button;
diff --git a/apps/plugins/stopwatch.c b/apps/plugins/stopwatch.c
index 18ad1c48cb..ece19b1e82 100644
--- a/apps/plugins/stopwatch.c
+++ b/apps/plugins/stopwatch.c
@@ -171,7 +171,7 @@ PLUGIN_HEADER
#endif
#endif
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
static int stopwatch = 0;
static long start_at = 0;
@@ -228,7 +228,7 @@ static void ticks_to_string(int ticks,int lap,int buflen, char * buf)
}
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
char buf[32];
int button;
diff --git a/apps/plugins/sudoku/generator.c b/apps/plugins/sudoku/generator.c
index eaef8c0f17..56dce48cc2 100644
--- a/apps/plugins/sudoku/generator.c
+++ b/apps/plugins/sudoku/generator.c
@@ -35,7 +35,7 @@
#include "sudoku.h"
#include "templates.h"
-extern struct plugin_api* rb;
+extern const struct plugin_api* rb;
#define assert(x)
diff --git a/apps/plugins/sudoku/sudoku.c b/apps/plugins/sudoku/sudoku.c
index d76b68ef27..64a6c8d7c9 100644
--- a/apps/plugins/sudoku/sudoku.c
+++ b/apps/plugins/sudoku/sudoku.c
@@ -80,7 +80,7 @@ PLUGIN_HEADER
it's nice not to have to pass the api pointer in all function calls
in the plugin */
-struct plugin_api* rb;
+const struct plugin_api* rb;
/* Default game - used to initialise sudoku.ss if it doesn't exist. */
static const char default_game[9][9] =
@@ -1188,7 +1188,7 @@ void move_cursor(struct sudoku_state_t* state, int newx, int newy)
}
/* plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
bool exit;
int button;
diff --git a/apps/plugins/superdom.c b/apps/plugins/superdom.c
index e99d456454..4f5cc53086 100644
--- a/apps/plugins/superdom.c
+++ b/apps/plugins/superdom.c
@@ -18,7 +18,7 @@
****************************************************************************/
#include "plugin.h"
PLUGIN_HEADER
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
extern const fb_data superdom_boarditems[];
char buf[255];
@@ -2153,7 +2153,7 @@ void computer_war(void) {
}
}
-int load_game(char* file) {
+static int load_game(const char* file) {
int fd;
fd = rb->open(file, O_RDONLY);
@@ -2222,7 +2222,7 @@ int average_strength(bool colour) {
return totalpower/100;
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int tempmenu;
bool statusbar_setting;
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c
index 69d905a37e..40b1bfdd32 100644
--- a/apps/plugins/test_codec.c
+++ b/apps/plugins/test_codec.c
@@ -30,7 +30,7 @@ PLUGIN_HEADER
#define TESTCODEC_EXITBUTTON BUTTON_SELECT
#endif
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
CACHE_FUNCTION_WRAPPERS(rb)
@@ -629,7 +629,7 @@ exit:
}
/* plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
uintptr_t* codec_stack_copy;
int result, selection = 0;
diff --git a/apps/plugins/test_disk.c b/apps/plugins/test_disk.c
index 27dbdb3334..93464807c3 100644
--- a/apps/plugins/test_disk.c
+++ b/apps/plugins/test_disk.c
@@ -34,7 +34,7 @@ PLUGIN_HEADER
#endif
#define TEST_TIME 10 /* in seconds */
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
static unsigned char* audiobuf;
static ssize_t audiobuflen;
@@ -404,7 +404,7 @@ static bool test_speed(void)
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
static const struct menu_item items[] = {
{ "Disk speed", test_speed },
diff --git a/apps/plugins/test_fps.c b/apps/plugins/test_fps.c
index 46a94a91ec..0852e0a9fb 100644
--- a/apps/plugins/test_fps.c
+++ b/apps/plugins/test_fps.c
@@ -39,7 +39,7 @@ PLUGIN_IRAM_DECLARE
PLUGIN_HEADER
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
/* Screen logging */
static int line;
@@ -334,7 +334,7 @@ static void time_greyscale(void)
#endif
/* plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
#ifndef SIMULATOR
char str[32];
diff --git a/apps/plugins/test_grey.c b/apps/plugins/test_grey.c
index a413854332..5d836633de 100644
--- a/apps/plugins/test_grey.c
+++ b/apps/plugins/test_grey.c
@@ -105,7 +105,7 @@ static const unsigned char dither_matrix[16][16] = {
static unsigned char input_levels[STEPS+1];
static unsigned char lcd_levels[STEPS+1];
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
static unsigned char *gbuf;
static size_t gbuf_size = 0;
@@ -136,7 +136,7 @@ static void fill_rastered(int bx, int by, int bw, int bh, int step)
}
/* plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
bool done = false;
int cur_step = 1;
diff --git a/apps/plugins/test_resize.c b/apps/plugins/test_resize.c
index c50bc5f91c..218da2a625 100644
--- a/apps/plugins/test_resize.c
+++ b/apps/plugins/test_resize.c
@@ -28,7 +28,7 @@
PLUGIN_HEADER
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
const struct button_mapping *plugin_contexts[]
= {generic_actions, generic_directions};
@@ -62,7 +62,7 @@ static fb_data output_bmp_data[MAX_OUTPUT_WIDTH*MAX_OUTPUT_HEIGHT];
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
(void)parameter;
diff --git a/apps/plugins/test_sampr.c b/apps/plugins/test_sampr.c
index 2cd95d7983..a036844880 100644
--- a/apps/plugins/test_sampr.c
+++ b/apps/plugins/test_sampr.c
@@ -21,7 +21,7 @@
PLUGIN_HEADER
-struct plugin_api *rb;
+const struct plugin_api *rb;
enum
{
@@ -253,7 +253,7 @@ void set_waveform(void)
/* Tests hardware sample rate switching */
/* TODO: needs a volume control */
-enum plugin_status plugin_start(struct plugin_api *api, void *parameter)
+enum plugin_status plugin_start(const struct plugin_api *api, const void *parameter)
{
static const struct menu_item items[] =
{
diff --git a/apps/plugins/test_scanrate.c b/apps/plugins/test_scanrate.c
index bd189bc85e..995e64a257 100644
--- a/apps/plugins/test_scanrate.c
+++ b/apps/plugins/test_scanrate.c
@@ -107,7 +107,7 @@ PLUGIN_HEADER
#define NEED_BOOST
#endif
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
static unsigned char bitbuffer[2][BUF_HEIGHT][BUF_WIDTH];
static int curbuf = 0;
static int scan_rate = DEFAULT_SCAN_RATE;
@@ -210,7 +210,7 @@ int plugin_main(void)
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
(void)parameter;
rb = api;
diff --git a/apps/plugins/test_touchpad.c b/apps/plugins/test_touchpad.c
index 2970f6fbf4..a9ad96eb32 100644
--- a/apps/plugins/test_touchpad.c
+++ b/apps/plugins/test_touchpad.c
@@ -28,10 +28,10 @@ PLUGIN_HEADER
#define TOUCHPAD_TOGGLE BUTTON_RC_MODE
#endif
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
/* plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int button = 0;
enum touchpad_mode mode = TOUCHPAD_BUTTON;
diff --git a/apps/plugins/test_viewports.c b/apps/plugins/test_viewports.c
index 1f1e99a0ff..bb1b4b9af9 100644
--- a/apps/plugins/test_viewports.c
+++ b/apps/plugins/test_viewports.c
@@ -21,7 +21,7 @@
PLUGIN_HEADER
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
#ifdef HAVE_LCD_BITMAP
@@ -157,7 +157,7 @@ static struct viewport rvp1 =
#endif
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
(void)parameter;
char buf[80];
@@ -278,7 +278,7 @@ static struct viewport vp2 =
};
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
(void)parameter;
diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c
index 617155fb2b..0edde54e75 100644
--- a/apps/plugins/text_editor.c
+++ b/apps/plugins/text_editor.c
@@ -26,7 +26,7 @@
#endif
#define MAX_LINE_LEN 2048
PLUGIN_HEADER
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
static char buffer[MAX_CHARS];
static char eol[3];
@@ -118,8 +118,8 @@ int _do_action(int action, char* str, int line)
char *list_get_name_cb(int selected_item, void* data,
char* buf, size_t buf_len)
{
- char *b = &buffer[do_action(ACTION_GET,0,selected_item)];
(void)data;
+ char *b = &buffer[do_action(ACTION_GET,0,selected_item)];
if (rb->strlen(b) >= buf_len)
{
char t = b[buf_len-10];
@@ -306,7 +306,7 @@ int hex_to_rgb(const char* hex, int* color)
#endif /* HAVE_LCD_COLOR */
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int fd;
static char temp_line[MAX_LINE_LEN];
diff --git a/apps/plugins/vbrfix.c b/apps/plugins/vbrfix.c
index 665a2aae5e..85a61cbfc3 100644
--- a/apps/plugins/vbrfix.c
+++ b/apps/plugins/vbrfix.c
@@ -20,7 +20,7 @@
PLUGIN_HEADER
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
static char *audiobuf;
static ssize_t audiobuflen;
@@ -36,7 +36,7 @@ static void xingupdate(int percent)
rb->lcd_update();
}
-static int insert_data_in_file(char *fname, int fpos, char *buf, int num_bytes)
+static int insert_data_in_file(const char *fname, int fpos, char *buf, int num_bytes)
{
int readlen;
int rc;
@@ -126,7 +126,7 @@ static const unsigned char empty_id3_header[] =
0x00, 0x00, 0x1f, 0x76 /* Size is 4096 minus 10 bytes for the header */
};
-static bool vbr_fix(char *selected_file)
+static bool vbr_fix(const char *selected_file)
{
struct mp3entry entry;
int fd;
@@ -261,7 +261,7 @@ static bool vbr_fix(char *selected_file)
return false;
}
-enum plugin_status plugin_start(struct plugin_api* api, void *parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void *parameter)
{
rb = api;
diff --git a/apps/plugins/video.c b/apps/plugins/video.c
index 3e7e53aec8..f1f6533f4f 100644
--- a/apps/plugins/video.c
+++ b/apps/plugins/video.c
@@ -141,7 +141,7 @@ typedef struct /* the little header for all audio blocks */
/****************** globals ******************/
-static struct plugin_api* rb; /* here is a global api struct pointer */
+static const struct plugin_api* rb; /* here is a global api struct pointer */
static char gPrint[32]; /* a global printf buffer, saves stack */
@@ -986,7 +986,7 @@ int main(char* filename)
/***************** Plugin Entry Point *****************/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
rb = api; /* copy to global api pointer */
diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c
index 885ac70bea..cd0d3694ba 100644
--- a/apps/plugins/viewer.c
+++ b/apps/plugins/viewer.c
@@ -357,7 +357,7 @@ static int display_lines; /* number of lines on the display */
static int draw_columns; /* number of (pixel) columns available for text */
static int par_indent_spaces; /* number of spaces to indent first paragraph */
static int fd;
-static char *file_name;
+static const char *file_name;
static long file_size;
static long start_position; /* position in the file after the viewer is started */
static bool mac_text;
@@ -368,7 +368,7 @@ static unsigned char *screen_top_ptr;
static unsigned char *next_screen_ptr;
static unsigned char *next_screen_to_draw_ptr;
static unsigned char *next_line_ptr;
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
#ifdef HAVE_LCD_BITMAP
static struct font *pf;
#endif
@@ -1457,7 +1457,7 @@ static void viewer_menu(void)
viewer_draw(col);
}
-enum plugin_status plugin_start(struct plugin_api* api, void* file)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* file)
{
int button, i, ok;
int lastbutton = BUTTON_NONE;
diff --git a/apps/plugins/vu_meter.c b/apps/plugins/vu_meter.c
index bdbab8ccf5..861adcc64c 100644
--- a/apps/plugins/vu_meter.c
+++ b/apps/plugins/vu_meter.c
@@ -648,7 +648,7 @@ void digital_meter(void) {
rb->lcd_hline(0,LCD_WIDTH-1,half_height+3);
}
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
int button;
int lastbutton = BUTTON_NONE;
diff --git a/apps/plugins/wav2wv.c b/apps/plugins/wav2wv.c
index f3e191d30d..45f99f7071 100644
--- a/apps/plugins/wav2wv.c
+++ b/apps/plugins/wav2wv.c
@@ -27,7 +27,7 @@ PLUGIN_HEADER
#define SAMPLES_PER_BLOCK 22050
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
void *memset(void *s, int c, size_t n) {
return(rb->memset(s,c,n));
@@ -102,34 +102,35 @@ static void wvupdate (int32_t start_tick,
static int32_t temp_buffer [TEMP_SAMPLES] IDATA_ATTR;
-static int wav2wv (char *filename)
+static int wav2wv(const char *infile)
{
int in_fd, out_fd, num_chans, error = false, last_buttons;
unsigned int32_t total_bytes_read = 0, total_bytes_written = 0;
unsigned int32_t total_samples, samples_remaining;
int32_t *input_buffer = (int32_t *) audiobuf;
unsigned char *output_buffer = (unsigned char *)(audiobuf + 0x100000);
- char *extension, save_a;
+ char outfile[MAX_PATH];
+ const char *inextension;
+ char *outextension;
WavpackConfig config;
WavpackContext *wpc;
int32_t start_tick;
rb->lcd_clear_display();
- rb->lcd_puts_scroll(0, 0, (unsigned char *)filename);
+ rb->lcd_puts_scroll(0, 0, (unsigned char *)infile);
#ifdef HAVE_LCD_BITMAP
rb->lcd_update();
#endif
last_buttons = rb->button_status ();
start_tick = *rb->current_tick;
- extension = filename + rb->strlen (filename) - 3;
-
- if (rb->strcasecmp (extension, "wav")) {
+ inextension = infile + rb->strlen(infile) - 3;
+ if (rb->strcasecmp (inextension, "wav")) {
rb->splash(HZ*2, "only for wav files!");
return 1;
}
- in_fd = rb->open(filename, O_RDONLY);
+ in_fd = rb->open(infile, O_RDONLY);
if (in_fd < 0) {
rb->splash(HZ*2, "could not open file!");
@@ -171,14 +172,12 @@ static int wav2wv (char *filename)
}
WavpackAddWrapper (wpc, &raw_header, sizeof (raw_header));
- save_a = extension [1];
- extension [1] = extension [2];
- extension [2] = 0;
-
- out_fd = rb->creat (filename);
- extension [2] = extension [1];
- extension [1] = save_a;
+ rb->strcpy(outfile, infile);
+ outextension = outfile + rb->strlen(outfile) - 3;
+ outextension[1] = outextension[2];
+ outextension[2] = 0;
+ out_fd = rb->creat(outfile);
if (out_fd < 0) {
rb->splash(HZ*2, "could not create file!");
@@ -278,12 +277,7 @@ static int wav2wv (char *filename)
rb->close (in_fd);
if (error) {
- save_a = extension [1];
- extension [1] = extension [2];
- extension [2] = 0;
- rb->remove (filename);
- extension [2] = extension [1];
- extension [1] = save_a;
+ rb->remove (outfile);
}
else
rb->splash(HZ*3, "operation successful");
@@ -291,7 +285,7 @@ static int wav2wv (char *filename)
return error;
}
-enum plugin_status plugin_start(struct plugin_api* api, void *parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void *parameter)
{
#ifdef RB_PROFILE
/* This doesn't start profiling or anything, it just gives the
diff --git a/apps/plugins/wavplay.c b/apps/plugins/wavplay.c
index e20fa55d84..0ef7ef3584 100644
--- a/apps/plugins/wavplay.c
+++ b/apps/plugins/wavplay.c
@@ -3135,7 +3135,7 @@ void dma_end_isr(void) __attribute__((interrupt_handler));
/* variables */
-static struct plugin_api *rb;
+static const struct plugin_api *rb;
static unsigned char *aud_buf;
static ssize_t aud_size;
@@ -3647,7 +3647,7 @@ int play_file(char* filename)
}
/* plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
ssize_t buf_size;
diff --git a/apps/plugins/wavrecord.c b/apps/plugins/wavrecord.c
index f6969ff7b5..77e71b8b25 100644
--- a/apps/plugins/wavrecord.c
+++ b/apps/plugins/wavrecord.c
@@ -3178,7 +3178,7 @@ void rec_tick(void) __attribute__((interrupt_handler));
/* variables */
-static struct plugin_api *rb;
+static const struct plugin_api *rb;
/* settings */
struct rec_config {
@@ -3752,7 +3752,7 @@ static int recording_menu(void)
}
/* plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
ssize_t buf_size;
int align;
diff --git a/apps/plugins/wavview.c b/apps/plugins/wavview.c
index 9ce873476f..40031ac7f6 100644
--- a/apps/plugins/wavview.c
+++ b/apps/plugins/wavview.c
@@ -20,7 +20,7 @@
PLUGIN_HEADER
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
/* temp byte buffer */
uint8_t samples[10 * 1024]; /* read 10KB at the time */
@@ -100,7 +100,7 @@ void little_endian_to_native (void *data, char *format)
/* read WAV file
display some info about it
store peak info in aufiobuf for display routine */
-static int readwavpeaks(char *filename)
+static int readwavpeaks(const char *filename)
{
register uint32_t bytes_read;
register uint32_t fppmp_count;
@@ -352,7 +352,7 @@ void show_help(void)
rb->lcd_update();
}
-enum plugin_status plugin_start(struct plugin_api* api, void *parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void *parameter)
{
unsigned int quit = 0;
unsigned int action = 0;
diff --git a/apps/plugins/wormlet.c b/apps/plugins/wormlet.c
index f84fad9e4b..f862c1b345 100644
--- a/apps/plugins/wormlet.c
+++ b/apps/plugins/wormlet.c
@@ -417,7 +417,7 @@ static int player3_dir = EAST;
static int players = 1;
/* the rockbox plugin api */
-static struct plugin_api* rb;
+static const struct plugin_api* rb;
#define SETTINGS_VERSION 1
#define SETTINGS_MIN_VERSION 1
@@ -2444,7 +2444,7 @@ bool launch_wormlet(void)
/**
* Main entry point
*/
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
int result;
int menu_quit = 0;
diff --git a/apps/plugins/xobox.c b/apps/plugins/xobox.c
index 331650eddc..5054fd21b1 100644
--- a/apps/plugins/xobox.c
+++ b/apps/plugins/xobox.c
@@ -258,7 +258,7 @@ static int speed = 6; /* CYCLETIME = (11-speed)*10 ms */
static int difficulty = 75; /* Percentage of screen that needs to be filled
* in order to win the game */
-static struct plugin_api *rb;
+static const struct plugin_api *rb;
MEM_FUNCTION_WRAPPERS(rb);
@@ -974,7 +974,7 @@ static int xobox_loop (void)
}
/* plugin main procedure */
-enum plugin_status plugin_start (struct plugin_api *api, void *parameter)
+enum plugin_status plugin_start (const struct plugin_api *api, const void *parameter)
{
int ret = PLUGIN_OK;
diff --git a/apps/plugins/zxbox.c b/apps/plugins/zxbox.c
index 61d9eea4ac..14f8b0911b 100644
--- a/apps/plugins/zxbox.c
+++ b/apps/plugins/zxbox.c
@@ -24,7 +24,7 @@
PLUGIN_HEADER
/* this is the plugin entry point */
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
return run_overlay(api, parameter, PLUGIN_APPS_DIR "/zxbox.ovl", "ZXBox");
}
diff --git a/apps/plugins/zxbox/spconf.c b/apps/plugins/zxbox/spconf.c
index d316ad0fbf..5a14959adc 100644
--- a/apps/plugins/zxbox/spconf.c
+++ b/apps/plugins/zxbox/spconf.c
@@ -103,7 +103,7 @@ static int find_extension(const char *ext)
/* now actually a snapshot/tape loader*/
-void spcf_read_command_line(void* parameter)
+void spcf_read_command_line(const void* parameter)
{
int ix;
diff --git a/apps/plugins/zxbox/spconf.h b/apps/plugins/zxbox/spconf.h
index b7b89a22f7..7de5d2e857 100644
--- a/apps/plugins/zxbox/spconf.h
+++ b/apps/plugins/zxbox/spconf.h
@@ -31,7 +31,7 @@ extern int spcf_init_tapefile_type;
/*extern int spcf_read_conf_file(const char *filename);*/
-extern void spcf_read_command_line(void* parameter);
+extern void spcf_read_command_line(const void* parameter);
extern void spcf_read_xresources(void);
extern int spcf_find_file_type(char *filename, int *ftp, int *ftsubp);
diff --git a/apps/plugins/zxbox/spmain.c b/apps/plugins/zxbox/spmain.c
index 51344763f9..136dcf0f24 100644
--- a/apps/plugins/zxbox/spmain.c
+++ b/apps/plugins/zxbox/spmain.c
@@ -519,17 +519,17 @@ static void run_singlemode(void)
}
-void check_params(void* parameter)
+void check_params(const void* parameter)
{
spcf_read_conf_file(GLOBALCFG);
spcf_read_command_line(parameter);
}
-static void init_load(void *parameter)
+static void init_load(const void *parameter)
{
if(load_immed) snsh_z80_load_intern(loadim, loadim_size);
- check_params (parameter);
+ check_params(parameter);
if(spcf_init_snapshot != NULL) {
#ifndef USE_GREY
rb->splash(HZ, "Loading snapshot '%s'", spcf_init_snapshot);
@@ -548,7 +548,7 @@ static void init_load(void *parameter)
}
}
-void start_spectemu(void *parameter)
+void start_spectemu(const void *parameter)
{
spti_init();
init_load(parameter);
diff --git a/apps/plugins/zxbox/spmain.h b/apps/plugins/zxbox/spmain.h
index 8168b261f6..5fb926ece9 100644
--- a/apps/plugins/zxbox/spmain.h
+++ b/apps/plugins/zxbox/spmain.h
@@ -21,8 +21,8 @@
#ifndef SPMAIN_H
#define SPMAIN_H
-extern void check_params(void* parameter);
-extern void start_spectemu(void* parameter);
+extern void check_params(const void* parameter);
+extern void start_spectemu(const void* parameter);
extern struct zxbox_settings settings;
struct zxbox_settings {
int invert_colors;
diff --git a/apps/plugins/zxbox/zxbox.c b/apps/plugins/zxbox/zxbox.c
index 3d94981ce5..873ecdf6c3 100644
--- a/apps/plugins/zxbox/zxbox.c
+++ b/apps/plugins/zxbox/zxbox.c
@@ -22,7 +22,7 @@
PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
-struct plugin_api* rb;
+const struct plugin_api* rb;
#include "spkey_p.h"
@@ -59,7 +59,7 @@ static size_t gbuf_size = 0;
long video_frames IBSS_ATTR = 0 ;
long start_time IBSS_ATTR = 0;
-enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
PLUGIN_IRAM_INIT(api)
diff --git a/apps/plugins/zxbox/zxconfig.h b/apps/plugins/zxbox/zxconfig.h
index f83c091ab9..d0a6c5a7ea 100644
--- a/apps/plugins/zxbox/zxconfig.h
+++ b/apps/plugins/zxbox/zxconfig.h
@@ -5,7 +5,7 @@
extern int load_tap;
extern bool clear_kbd;
extern bool exit_requested;
-extern struct plugin_api* rb;
+extern const struct plugin_api* rb;
extern void press_key(int c);
extern long video_frames;
extern long start_time;