From 9a26e44e68ce3121e5eee8bf68c9733e3d67327c Mon Sep 17 00:00:00 2001 From: Christian Kroll Date: Thu, 22 Apr 2010 21:49:26 +0000 Subject: [PATCH] fixed a bunch of compiler warnings --- animations/stonefly.c | 2 +- display_loop.c | 2 +- games/tetris/highscore.c | 2 +- games/tetris/variant_bastet.c | 2 +- menu/menu.c | 5 ++--- scrolltext/scrolltext3.c | 4 +++- simulator/eeprom.c | 4 ++-- simulator/main.c | 36 +++++++++++++++++------------------ simulator/util.c | 10 ++++++---- 9 files changed, 35 insertions(+), 32 deletions(-) diff --git a/animations/stonefly.c b/animations/stonefly.c index 722c5da..2983747 100644 --- a/animations/stonefly.c +++ b/animations/stonefly.c @@ -127,7 +127,7 @@ void stonefly(void) stone_t stones[MAX_STONES]; uint8_t stoneCount = 0; uint16_t counter = 622; /* run 622 cycles */ - uint8_t invax, invay, invasion = 0; + uint8_t invax = 0, invay = 0, invasion = 0; uint8_t draw; //init all stones to zero diff --git a/display_loop.c b/display_loop.c index 30fae72..0ccff3a 100644 --- a/display_loop.c +++ b/display_loop.c @@ -53,7 +53,7 @@ void display_loop(){ #ifdef RANDOM_SUPPORT { char a[28]; - sprintf(a,"nPieceScores[6].shape, TETRIS_PC_ANGLE_0); - tetris_piece_t *pPiece; + tetris_piece_t *pPiece = NULL; const uint8_t nPercent[4] = {75, 92, 98, 100}; uint8_t nRnd = rand() % 100; for (uint8_t i = 0; i < 4; ++i) diff --git a/menu/menu.c b/menu/menu.c index 4ee3611..ac9eb2d 100644 --- a/menu/menu.c +++ b/menu/menu.c @@ -21,7 +21,7 @@ extern game_descriptor_t _game_descriptors_start__[]; extern game_descriptor_t _game_descriptors_end__[]; // defines -#define MENU_ITEM_MAX (((unsigned int)_game_descriptors_end__ - (unsigned int)_game_descriptors_start__)/sizeof(game_descriptor_t)) +#define MENU_ITEM_MAX ((uint8_t)(((size_t)_game_descriptors_end__ - (size_t)_game_descriptors_start__) / sizeof(game_descriptor_t))) #define MENU_WIDTH_ICON 8 #define MENU_HEIGHT_ICON 8 @@ -71,7 +71,6 @@ void menu() wait(MENU_WAIT_CHATTER); // call corresponding function - _game_descriptors_start__[miSelection].run(); break; @@ -214,7 +213,7 @@ void menu_animate(uint8_t miInitial, menu_direction_t direction) // wait between the frames so that the animation can be seen wait(nWait); - // animation speed can be throtteled + // animation speed can be throttled nWait += MENU_WAIT_INCREMENT; } } diff --git a/scrolltext/scrolltext3.c b/scrolltext/scrolltext3.c index 35a3608..9d3f0a2 100644 --- a/scrolltext/scrolltext3.c +++ b/scrolltext/scrolltext3.c @@ -1,5 +1,7 @@ #define SCROLLTEXT_C +#define _XOPEN_SOURCE 600 + #include #include #include @@ -316,7 +318,7 @@ blob_t * setupBlob(char * str){ blob->commands = lastcommands; } - blob->str = strtok_r (0, delim, &last); + blob->str = strtok_r (NULL, delim, &last); if ( blob->str == 0) goto fail; diff --git a/simulator/eeprom.c b/simulator/eeprom.c index 30b0650..736d0ec 100644 --- a/simulator/eeprom.c +++ b/simulator/eeprom.c @@ -35,9 +35,9 @@ static void init(){ extern uint8_t _eeprom_start__[]; -uint16_t conv_addr(uint8_t * p){ +uint16_t conv_addr(void * p){ uint16_t addr; - addr = (unsigned int)p - (unsigned int)_eeprom_start__; + addr = (unsigned long)p - (unsigned long)_eeprom_start__; if(addr >= EEPROM_SIZE){ printf ("warning: eeprom write to %X\n",addr); } diff --git a/simulator/main.c b/simulator/main.c index c634133..5e543af 100644 --- a/simulator/main.c +++ b/simulator/main.c @@ -1,25 +1,25 @@ +#ifdef _WIN32 + #include + #include + #include +#define pthread_t int +#else + #define _XOPEN_SOURCE 500 + #ifdef OSX_ + #include + #else + #include + #endif + #include // for threads in linux + #include + #include + #include + #include +#endif #include #include -#ifdef _WIN32 -# include -# include -# include -# define pthread_t int -#else -# ifdef OSX_ -# include -# else -# include -# endif -# include // for threads in linux -# include -# include -# include -# include -#endif - #include "../config.h" #include "../display_loop.h" #include "../pixel.h" diff --git a/simulator/util.c b/simulator/util.c index 97d59cf..57c49cb 100644 --- a/simulator/util.c +++ b/simulator/util.c @@ -1,3 +1,9 @@ +#ifdef _WIN32 + #include +#else + #define _XOPEN_SOURCE 500 +#endif + #include #include #include @@ -5,10 +11,6 @@ #include #include "joystick.h" -#ifdef _WIN32 -# include -#endif - extern jmp_buf newmode_jmpbuf; void wait(unsigned int ms) {