From ba03cb4aea212553f47a9da672fdd897e9f2e620 Mon Sep 17 00:00:00 2001 From: Bertrik Sikken Date: Sat, 31 Dec 2011 20:29:08 +0000 Subject: Make local functions static in clock and chessbox plugin git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31505 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/chessbox/chessbox.c | 24 ++++++++++++------------ apps/plugins/chessbox/chessbox_pgn.c | 18 +++++++++--------- apps/plugins/clock/clock.c | 4 ++-- apps/plugins/clock/clock_counter.c | 2 +- apps/plugins/clock/clock_draw.c | 10 +++++----- apps/plugins/clock/clock_draw_analog.c | 22 +++++++++++----------- apps/plugins/clock/clock_draw_binary.c | 2 +- apps/plugins/clock/clock_menu.c | 11 ++++++----- apps/plugins/clock/clock_settings.c | 14 +++++++------- 9 files changed, 54 insertions(+), 53 deletions(-) (limited to 'apps/plugins') diff --git a/apps/plugins/chessbox/chessbox.c b/apps/plugins/chessbox/chessbox.c index 6437c8d4fd..3bd9593e3a 100644 --- a/apps/plugins/chessbox/chessbox.c +++ b/apps/plugins/chessbox/chessbox.c @@ -94,7 +94,7 @@ const char *level_string[] = { "Level 1: 60 moves / 5 min" , int wt_command = COMMAND_NOP; /* ---- Get the board column and row (e2 f.e.) for a physical x y ---- */ -void xy2cr ( short x, short y, short *c, short *r ) { +static void xy2cr ( short x, short y, short *c, short *r ) { if (computer == black ) { *c = x ; *r = y ; @@ -105,7 +105,7 @@ void xy2cr ( short x, short y, short *c, short *r ) { } /* ---- get physical x y for a board column and row (e2 f.e.) ---- */ -void cr2xy ( short c, short r, short *x, short *y ) { +static void cr2xy ( short c, short r, short *x, short *y ) { if ( computer == black ) { *x = c ; *y = r ; @@ -174,7 +174,7 @@ static void cb_drawboard (void) { } /* ---- Switch mark on board ---- */ -void cb_switch ( short x , short y ) { +static void cb_switch ( short x , short y ) { rb->lcd_set_drawmode ( DRMODE_COMPLEMENT ); rb->lcd_drawrect ( XOFS + x*TILE_WIDTH + 1 , YOFS + ( 7 - y )*TILE_HEIGHT +1 , @@ -184,7 +184,7 @@ void cb_switch ( short x , short y ) { } /* ---- callback for capturing interaction while thinking ---- */ -void cb_wt_callback ( void ) { +static void cb_wt_callback ( void ) { int button = BUTTON_NONE; wt_command = COMMAND_NOP; @@ -208,7 +208,7 @@ void cb_wt_callback ( void ) { } /* ---- set playing parameters depending on level ---- */ -void cb_setlevel ( int lev ) { +static void cb_setlevel ( int lev ) { Level = (lev > 7) ? 7 : ( (lev < 1) ? 1 : lev ) ; switch (Level) { case 1 : @@ -257,7 +257,7 @@ void cb_setlevel ( int lev ) { } /* ---- increase playing level ---- */ -void cb_levelup ( void ) { +static void cb_levelup ( void ) { if ( Level == 7 ) cb_setlevel ( 1 ); else @@ -266,7 +266,7 @@ void cb_levelup ( void ) { }; /* ---- Save current position ---- */ -void cb_saveposition ( void ) { +static void cb_saveposition ( void ) { int fd; short sq,i,c; unsigned short temp; @@ -319,7 +319,7 @@ void cb_saveposition ( void ) { } /* ---- Restore saved position ---- */ -void cb_restoreposition ( void ) { +static void cb_restoreposition ( void ) { int fd; short sq; unsigned short m; @@ -419,7 +419,7 @@ static int cb_menu_viewer(void) } /* ---- get a command in game mode ---- */ -struct cb_command cb_get_viewer_command (void) { +static struct cb_command cb_get_viewer_command (void) { int button; struct cb_command result = { 0, {0,0,0,0,0}, 0 }; @@ -447,7 +447,7 @@ struct cb_command cb_get_viewer_command (void) { } /* ---- viewer main loop ---- */ -void cb_start_viewer(char* filename){ +static void cb_start_viewer(char* filename){ struct pgn_game_node *first_game, *selected_game; struct pgn_ply_node *curr_ply; bool exit_game = false; @@ -638,7 +638,7 @@ static int cb_menu(void) } /* ---- get a command in game mode ---- */ -struct cb_command cb_getcommand (void) { +static struct cb_command cb_getcommand (void) { static short x = 4 , y = 3 ; short c , r , l; int button; @@ -773,7 +773,7 @@ struct cb_command cb_getcommand (void) { } /* ---- game main loop ---- */ -void cb_play_game(void) { +static void cb_play_game(void) { struct cb_command command; struct pgn_game_node *game; char move_buffer[20]; diff --git a/apps/plugins/chessbox/chessbox_pgn.c b/apps/plugins/chessbox/chessbox_pgn.c index 846ea41847..8b2cb1b2f2 100644 --- a/apps/plugins/chessbox/chessbox_pgn.c +++ b/apps/plugins/chessbox/chessbox_pgn.c @@ -37,7 +37,7 @@ size_t bufleft; /* simple function to "allocate" memory in pluginbuffer. * (borrowed from dict.c) */ -void *pl_malloc(size_t size) +static void *pl_malloc(size_t size) { void *ptr; ptr = bufptr; @@ -55,12 +55,12 @@ void *pl_malloc(size_t size) } /* init function for pl_malloc() */ -void pl_malloc_init(void) +static void pl_malloc_init(void) { bufptr = rb->plugin_get_buffer(&bufleft); } -void process_tag(struct pgn_game_node* game, char* buffer){ +static void process_tag(struct pgn_game_node* game, char* buffer){ char tag_type[20]; char tag_value[255]; short pos=0, pos2=0; @@ -95,7 +95,7 @@ void process_tag(struct pgn_game_node* game, char* buffer){ } } -unsigned short get_next_token(const char* line_buffer, unsigned short initial_pos, +static unsigned short get_next_token(const char* line_buffer, unsigned short initial_pos, char* token_buffer){ unsigned short pos, token_pos=0; for (pos = initial_pos;line_buffer[pos] == ' ' || line_buffer[pos] == '.';pos++); @@ -112,7 +112,7 @@ unsigned short get_next_token(const char* line_buffer, unsigned short initial_po return pos; } -unsigned short piece_from_pgn(char pgn_piece){ +static unsigned short piece_from_pgn(char pgn_piece){ switch (pgn_piece){ case 'R': return rook; @@ -128,7 +128,7 @@ unsigned short piece_from_pgn(char pgn_piece){ return no_piece; } -char pgn_from_piece(unsigned short piece, unsigned short color){ +static char pgn_from_piece(unsigned short piece, unsigned short color){ char pgn_piece = ' '; switch (piece){ case pawn: @@ -159,7 +159,7 @@ char pgn_from_piece(unsigned short piece, unsigned short color){ return pgn_piece; } -void pgn_to_coords(struct pgn_ply_node* ply){ +static void pgn_to_coords(struct pgn_ply_node* ply){ unsigned short str_length = rb->strlen(ply->pgn_text); char str[10]; rb->strcpy(str,ply->pgn_text); @@ -354,7 +354,7 @@ void pgn_to_coords(struct pgn_ply_node* ply){ color[locn[ply->row_from][ply->column_from]] = neutral; } -void coords_to_pgn(struct pgn_ply_node* ply){ +static void coords_to_pgn(struct pgn_ply_node* ply){ int pos = 0,i,j; unsigned short moving_piece = board[locn[ply->row_from][ply->column_from]]; char unambiguous_position; @@ -545,7 +545,7 @@ static const char* get_game_text(int selected_item, void *data, return buffer; } -void write_pgn_token(int fhandler, char *buffer, size_t *line_length){ +static void write_pgn_token(int fhandler, char *buffer, size_t *line_length){ if (*line_length + rb->strlen(buffer) + 1 > 80){ rb->fdprintf(fhandler,"\n"); *line_length = 0; diff --git a/apps/plugins/clock/clock.c b/apps/plugins/clock/clock.c index 641a1e7ad3..d287c75598 100644 --- a/apps/plugins/clock/clock.c +++ b/apps/plugins/clock/clock.c @@ -57,7 +57,7 @@ const struct button_mapping* plugin_contexts[]={ /************************** * Cleanup on plugin return *************************/ -void cleanup(void) +static void cleanup(void) { clock_draw_restore_colors(); if(clock_settings.general.save_settings == 1) @@ -68,7 +68,7 @@ void cleanup(void) } /* puts the current time into the time struct */ -void clock_update_time( struct time* time){ +static void clock_update_time( struct time* time){ struct tm* current_time = rb->get_time(); time->hour = current_time->tm_hour; time->minute = current_time->tm_min; diff --git a/apps/plugins/clock/clock_counter.c b/apps/plugins/clock/clock_counter.c index 7137eeaf38..ce29e4ce91 100644 --- a/apps/plugins/clock/clock_counter.c +++ b/apps/plugins/clock/clock_counter.c @@ -7,7 +7,7 @@ void counter_init(struct counter* counter){ counter->paused=true; } -int counter_get_ticks_since_last_pause(struct counter* counter){ +static int counter_get_ticks_since_last_pause(struct counter* counter){ if(!counter->paused) return(*rb->current_tick - counter->ticks_at_last_unpause); return(0); diff --git a/apps/plugins/clock/clock_draw.c b/apps/plugins/clock/clock_draw.c index 411a7f1545..ce5006d46d 100644 --- a/apps/plugins/clock/clock_draw.c +++ b/apps/plugins/clock/clock_draw.c @@ -26,7 +26,7 @@ #include "clock_draw_binary.h" #include "clock_settings.h" -void black_background(struct screen* display){ +static void black_background(struct screen* display){ #if (LCD_DEPTH > 1) || (defined(LCD_REMOTE_DEPTH) && (LCD_REMOTE_DEPTH > 1)) if(display->depth>1){ display->set_background(LCD_BLACK); @@ -39,7 +39,7 @@ void black_background(struct screen* display){ } } -void white_background(struct screen* display){ +static void white_background(struct screen* display){ #if (LCD_DEPTH > 1) || (defined(LCD_REMOTE_DEPTH) && (LCD_REMOTE_DEPTH > 1)) if(display->depth>1){ #if defined(HAVE_LCD_COLOR) @@ -53,18 +53,18 @@ void white_background(struct screen* display){ display->clear_display(); } -bool skin_require_black_background(int mode, int skin){ +static bool skin_require_black_background(int mode, int skin){ return((mode==BINARY && skin==2) || (mode==DIGITAL && skin==1 )); } -void skin_set_background(struct screen* display, int mode, int skin){ +static void skin_set_background(struct screen* display, int mode, int skin){ if(skin_require_black_background(mode, skin) ) black_background(display); else white_background(display); } -void skin_restore_background(struct screen* display, int mode, int skin){ +static void skin_restore_background(struct screen* display, int mode, int skin){ if(skin_require_black_background(mode, skin) ) white_background(display); } diff --git a/apps/plugins/clock/clock_draw_analog.c b/apps/plugins/clock/clock_draw_analog.c index b8ec308eed..bda7241d33 100644 --- a/apps/plugins/clock/clock_draw_analog.c +++ b/apps/plugins/clock/clock_draw_analog.c @@ -37,7 +37,7 @@ #define SECOND_ANGLE(second) (6 * (second)) /* Note that the given angle's origin is midday and not 3 o'clock */ -void polar_to_cartesian(int a, int r, int* x, int* y) +static void polar_to_cartesian(int a, int r, int* x, int* y) { #if CONFIG_LCD == LCD_SSD1815 /* Correct non-square pixel aspect of archos recorder LCD */ @@ -48,7 +48,7 @@ void polar_to_cartesian(int a, int r, int* x, int* y) *y = (fp14_sin(a-90) * r) >> 14; } -void polar_to_cartesian_screen_centered(struct screen * display, +static void polar_to_cartesian_screen_centered(struct screen * display, int a, int r, int* x, int* y) { polar_to_cartesian(a, r, x, y); @@ -56,7 +56,7 @@ void polar_to_cartesian_screen_centered(struct screen * display, *y+=display->getheight()/2; } -void angle_to_square(int square_width, int square_height, +static void angle_to_square(int square_width, int square_height, int a, int* x, int* y) { a = (a+360-90)%360; @@ -82,7 +82,7 @@ void angle_to_square(int square_width, int square_height, } } -void angle_to_square_screen_centered(struct screen * display, +static void angle_to_square_screen_centered(struct screen * display, int square_width, int square_height, int a, int* x, int* y) { @@ -91,7 +91,7 @@ void angle_to_square_screen_centered(struct screen * display, *y+=display->getheight()/2; } -void draw_hand(struct screen* display, int angle, +static void draw_hand(struct screen* display, int angle, int radius, int thickness, bool round) { int x1, y1; /* the longest */ @@ -115,7 +115,7 @@ void draw_hand(struct screen* display, int angle, rb->lcd_drawline(x1, y1, x3, y3); } -void draw_hands(struct screen* display, int hour, int minute, int second, +static void draw_hands(struct screen* display, int hour, int minute, int second, int thickness, bool round, bool draw_seconds) { if(draw_seconds){ @@ -128,7 +128,7 @@ void draw_hands(struct screen* display, int hour, int minute, int second, ANALOG_HOUR_RADIUS(display, round), thickness+2, round); } -void draw_counter(struct screen* display, struct counter* counter) +static void draw_counter(struct screen* display, struct counter* counter) { char buffer[10]; int second_str_w, hour_str_w, str_h; @@ -150,7 +150,7 @@ void draw_counter(struct screen* display, struct counter* counter) display->getheight()-str_h); } -void draw_date(struct screen* display, struct time* time, int date_format) +static void draw_date(struct screen* display, struct time* time, int date_format) { char buffer[10]; int year_str_w, monthday_str_w, str_h; @@ -176,7 +176,7 @@ void draw_date(struct screen* display, struct time* time, int date_format) display->getheight()-monthday_line*str_h); } -void draw_border(struct screen* display, int skin) +static void draw_border(struct screen* display, int skin) { /* Draws square dots every 5 minutes */ int i; @@ -197,7 +197,7 @@ void draw_border(struct screen* display, int skin) } } -void draw_hour(struct screen* display, struct time* time, +static void draw_hour(struct screen* display, struct time* time, bool show_seconds, int skin) { int hour=time->hour; @@ -220,7 +220,7 @@ void draw_hour(struct screen* display, struct time* time, 0, skin, show_seconds); } -void draw_center_cover(struct screen* display) +static void draw_center_cover(struct screen* display) { display->hline((display->getwidth()/2)-1, (display->getwidth()/2)+1, (display->getheight()/2)+3); diff --git a/apps/plugins/clock/clock_draw_binary.c b/apps/plugins/clock/clock_draw_binary.c index 620788dc5e..611ab1b371 100644 --- a/apps/plugins/clock/clock_draw_binary.c +++ b/apps/plugins/clock/clock_draw_binary.c @@ -25,7 +25,7 @@ const struct picture* binary_skin[]={binary,digits,segments}; -void print_binary(char* buffer, int number, int nb_bits){ +static void print_binary(char* buffer, int number, int nb_bits){ int i; int mask=1; buffer[nb_bits]='\0'; diff --git a/apps/plugins/clock/clock_menu.c b/apps/plugins/clock/clock_menu.c index ed0027305b..a597664f49 100644 --- a/apps/plugins/clock/clock_menu.c +++ b/apps/plugins/clock/clock_menu.c @@ -22,6 +22,7 @@ #include "clock.h" #include "clock_bitmaps.h" #include "clock_settings.h" +#include "clock_menu.h" #include "lib/playback_control.h" /* Option structs (possible selections per each option) */ @@ -57,7 +58,7 @@ static const struct opt_items hour_format_text[] = { * Select a mode, returs true when the mode has been selected * (we go back to clock display then) **************/ -bool menu_mode_selector(void){ +static bool menu_mode_selector(void){ MENUITEM_STRINGLIST(menu,"Mode Selector",NULL, "Analog", "Digital", "Binary"); if(rb->do_menu(&menu, &clock_settings.mode, NULL, false) >=0) @@ -68,7 +69,7 @@ bool menu_mode_selector(void){ /********************** * Analog settings menu *********************/ -void menu_analog_settings(void) +static void menu_analog_settings(void) { int selection=0, result=0; @@ -99,7 +100,7 @@ void menu_analog_settings(void) /*********************** * Digital settings menu **********************/ -void menu_digital_settings(void){ +static void menu_digital_settings(void){ int selection=0, result=0; MENUITEM_STRINGLIST(menu,"Digital Mode Settings",NULL,"Show Seconds", @@ -125,7 +126,7 @@ void menu_digital_settings(void){ /*********************************************************** * Confirm resetting of settings, used in general_settings() **********************************************************/ -void confirm_reset(void){ +static void confirm_reset(void){ int result=0; rb->set_option("Reset all settings?", &result, INT, noyes_text, 2, NULL); @@ -141,7 +142,7 @@ void confirm_reset(void){ /************************************ * General settings. Reset, save, etc ***********************************/ -void menu_general_settings(void){ +static void menu_general_settings(void){ int selection=0, result=0; MENUITEM_STRINGLIST(menu,"General Settings",NULL, diff --git a/apps/plugins/clock/clock_settings.c b/apps/plugins/clock/clock_settings.c index 6dd1b5ee65..e559e1fe1b 100644 --- a/apps/plugins/clock/clock_settings.c +++ b/apps/plugins/clock/clock_settings.c @@ -51,7 +51,7 @@ struct clock_settings clock_settings; * we can know at saving time if changes have been made */ struct clock_settings hdd_clock_settings; -bool settings_needs_saving(struct clock_settings* settings){ +static bool settings_needs_saving(struct clock_settings* settings){ return(rb->memcmp(settings, &hdd_clock_settings, sizeof(*settings))); } @@ -99,8 +99,8 @@ void clock_settings_skin_previous(struct clock_settings* settings){ settings->skin[settings->mode]=max_skin[settings->mode]-1; } -enum settings_file_status clock_settings_load(struct clock_settings* settings, - char* filename){ +static enum settings_file_status clock_settings_load( + struct clock_settings* settings,char* filename){ int fd = rb->open(filename, O_RDONLY); if(fd >= 0){ /* does file exist? */ /* basic consistency check */ @@ -117,8 +117,8 @@ enum settings_file_status clock_settings_load(struct clock_settings* settings, return(ERRLOAD); } -enum settings_file_status clock_settings_save(struct clock_settings* settings, - char* filename){ +static enum settings_file_status clock_settings_save( + struct clock_settings* settings, char* filename){ int fd = rb->creat(filename, 0666); if(fd >= 0){ /* does file exist? */ rb->write (fd, settings, sizeof(*settings)); @@ -128,7 +128,7 @@ enum settings_file_status clock_settings_save(struct clock_settings* settings, return(ERRSAVE); } -void draw_logo(struct screen* display){ +static void draw_logo(struct screen* display){ #ifdef HAVE_LCD_COLOR if(display->is_color){ display->set_foreground(LCD_BLACK); @@ -141,7 +141,7 @@ void draw_logo(struct screen* display){ picture_draw(display, logo, 0, 0); } -void draw_message(struct screen* display, int msg, int y){ +static void draw_message(struct screen* display, int msg, int y){ const struct picture* message = &(messages[display->screen_type]); display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); display->fillrect(0, display->getheight()-message->slide_height, -- cgit v1.2.3