diff options
| author | Dusan Durech <dusan@debian.debian> | 2009-03-26 15:04:00 +0100 |
|---|---|---|
| committer | Dusan Durech <dusan@debian.debian> | 2009-03-26 15:04:00 +0100 |
| commit | e5e0724740215565404dba837f8c3072f9fe7413 (patch) | |
| tree | 39d80e50e12a9fffe47834cd375212017b22025b | |
| parent | df1f2b7cccb241db5500453aa65d11896f54ce6d (diff) | |
fix warnings...
| -rw-r--r-- | src/base/buffer.c | 4 | ||||
| -rw-r--r-- | src/base/main.c | 2 | ||||
| -rw-r--r-- | src/base/myTimer.c | 20 | ||||
| -rw-r--r-- | src/base/protect.c | 8 | ||||
| -rw-r--r-- | src/base/space.c | 8 | ||||
| -rw-r--r-- | src/client/hotKey.c | 8 | ||||
| -rw-r--r-- | src/client/interface.c | 3 | ||||
| -rw-r--r-- | src/modules/modAI.c | 20 | ||||
| -rw-r--r-- | src/modules/modPipe.c | 4 | ||||
| -rw-r--r-- | src/modules/modTeleport.c | 16 | ||||
| -rw-r--r-- | src/modules/modWall.c | 4 | ||||
| -rw-r--r-- | src/screen/browser.c | 10 | ||||
| -rw-r--r-- | src/screen/setting.c | 16 | ||||
| -rw-r--r-- | src/widget/widget_button.c | 8 | ||||
| -rw-r--r-- | src/widget/widget_buttonimage.c | 8 | ||||
| -rw-r--r-- | src/widget/widget_choicegroup.c | 8 | ||||
| -rw-r--r-- | src/widget/widget_textfield.c | 8 |
17 files changed, 78 insertions, 77 deletions
diff --git a/src/base/buffer.c b/src/base/buffer.c index dff0f05..6e771db 100644 --- a/src/base/buffer.c +++ b/src/base/buffer.c @@ -49,7 +49,7 @@ int cutBuffer(buffer_t * p, int len) assert(p != NULL); assert(len >= 0); - if (p->size - len >= 0) { + if (p->size - len > 0) { memmove(p->data, p->data + len, p->size - len); p->size -= len; return 0; @@ -116,7 +116,7 @@ int getBufferDataLen(buffer_t * p, char *line, int len) assert(line != NULL); assert(len >= 0); - if (p->size < len) { + if ((unsigned)p->size < (unsigned)len) { len = p->size; } diff --git a/src/base/main.c b/src/base/main.c index fce5a9f..f28f23f 100644 --- a/src/base/main.c +++ b/src/base/main.c @@ -29,8 +29,8 @@ static char **my_argv; char *getParam(char *s) { + unsigned int len; int i; - int len; len = strlen(s); diff --git a/src/base/myTimer.c b/src/base/myTimer.c index 90d5731..6e4a54f 100644 --- a/src/base/myTimer.c +++ b/src/base/myTimer.c @@ -16,7 +16,7 @@ # include "interface.h" #endif -static struct timeval start = {.tv_sec = 0,.tv_usec = 0 }; +static struct timeval my_start = {.tv_sec = 0,.tv_usec = 0 }; list_t *newTimer() { @@ -25,7 +25,7 @@ list_t *newTimer() void restartTimer() { - gettimeofday(&start, NULL); + gettimeofday(&my_start, NULL); } @@ -34,11 +34,11 @@ my_time_t getMyTime() struct timeval now; my_time_t ticks; - if (start.tv_sec == 0 && start.tv_usec == 0) + if (my_start.tv_sec == 0 && my_start.tv_usec == 0) restartTimer(); gettimeofday(&now, NULL); - ticks = (now.tv_sec - start.tv_sec) * 1000 + (now.tv_usec - start.tv_usec) / 1000; + ticks = (now.tv_sec - my_start.tv_sec) * 1000 + (now.tv_usec - my_start.tv_usec) / 1000; //printf("-> %d\n", ticks); return ticks; @@ -46,15 +46,15 @@ my_time_t getMyTime() my_time_t getMyTimeMicro() { - static struct timeval start = {.tv_sec = 0,.tv_usec = 0 }; + static struct timeval my_micro_start = {.tv_sec = 0,.tv_usec = 0 }; struct timeval now; my_time_t ticks; - if (start.tv_sec == 0 && start.tv_usec == 0) - gettimeofday(&start, NULL); + if (my_micro_start.tv_sec == 0 && my_micro_start.tv_usec == 0) + gettimeofday(&my_micro_start, NULL); gettimeofday(&now, NULL); - ticks = (now.tv_sec - start.tv_sec) * 1000 * 1000 + (now.tv_usec - start.tv_usec); + ticks = (now.tv_sec - my_micro_start.tv_sec) * 1000 * 1000 + (now.tv_usec - my_micro_start.tv_usec); //printf("-> %d\n", ticks); return ticks; @@ -131,15 +131,15 @@ void eventTimer(list_t * listTimer) void delTimer(list_t * listTimer, int id) { - int i; my_timer_t *thisTimer; + int i; for (i = 0; i < listTimer->count; i++) { thisTimer = (my_timer_t *) listTimer->list[i]; assert(thisTimer != NULL); - if (thisTimer->id == id) { + if (thisTimer->id == (unsigned)id) { delListItem(listTimer, i, free); return; } diff --git a/src/base/protect.c b/src/base/protect.c index 9661e32..d73b7dc 100644 --- a/src/base/protect.c +++ b/src/base/protect.c @@ -35,17 +35,17 @@ void refreshLastMove(protect_t * p) p->count++; if (p->count == PROTECT_SPEED_AVARAGE) { - int index; + int my_index; - index = p->avarage / PROTECT_SPEED_AVARAGE; + my_index = p->avarage / PROTECT_SPEED_AVARAGE; p->avarage = 0; p->count = 0; #if 0 - if (index < PROTECT_SPEED_INTERVAL_TIMEOUT) { + if (my_index < PROTECT_SPEED_INTERVAL_TIMEOUT) { p->isDown = TRUE; } #endif - //printf("speed index = %d\n", index); + //printf("speed index = %d\n", my_index); } } diff --git a/src/base/space.c b/src/base/space.c index 2250e37..2458bba 100644 --- a/src/base/space.c +++ b/src/base/space.c @@ -213,7 +213,7 @@ void delObjectFromSpace(space_t * p, void *item) { int segX, segY, segW, segH; int id, x, y, w, h; - int index; + int myIndex; int i, j; p->getStatus(item, &id, &x, &y, &w, &h); @@ -225,9 +225,9 @@ void delObjectFromSpace(space_t * p, void *item) continue; } - index = searchListItem(p->zone[j][i]->list, item); - assert(index != -1); - delList(p->zone[j][i]->list, index); + myIndex = searchListItem(p->zone[j][i]->list, item); + assert(myIndex != -1); + delList(p->zone[j][i]->list, myIndex); } } diff --git a/src/client/hotKey.c b/src/client/hotKey.c index 30287ee..228e50d 100644 --- a/src/client/hotKey.c +++ b/src/client/hotKey.c @@ -74,7 +74,7 @@ void registerHotKey(SDLKey key, void (*handler) ()) void unregisterHotKey(SDLKey key) { hotKey_t *hotkey; - int index; + int my_index; hotkey = findHotkey(key); @@ -82,9 +82,9 @@ void unregisterHotKey(SDLKey key) assert(!"This hotkey not register"); } - index = searchListItem(listHotKey, hotkey); - assert(index != -1); - delListItem(listHotKey, index, destroyHotKey); + my_index = searchListItem(listHotKey, hotkey); + assert(my_index != -1); + delListItem(listHotKey, my_index, destroyHotKey); } void enableHotKey(SDLKey key) diff --git a/src/client/interface.c b/src/client/interface.c index 57a9bee..fba9521 100644 --- a/src/client/interface.c +++ b/src/client/interface.c @@ -28,8 +28,7 @@ static Uint32 g_win_flags = SDL_OPENGL; static bool_t isInterfaceInit = FALSE; // flag, kterym se ridi zarazovani klaves do bufferu -bool_t keyboardBufferEnabled = FALSE; -bool_t isSlowHack; +static bool_t keyboardBufferEnabled = FALSE; bool_t isInterfaceInicialized() { diff --git a/src/modules/modAI.c b/src/modules/modAI.c index 003c65e..67ee594 100644 --- a/src/modules/modAI.c +++ b/src/modules/modAI.c @@ -193,7 +193,7 @@ static void eventTuxAI(tux_t * tux) int x, y, w, h; int rival_x, rival_y; - int i, index; + int i, my_index; int countFork = 0; int countDel = 0; @@ -225,12 +225,12 @@ static void eventTuxAI(tux_t * tux) addList(listAlternative, newAlternative(TUX_LEFT, x - (w + 10), y)); addList(listAlternative, newAlternative(TUX_DOWN, x, y + (h + 10))); - index = -1; + my_index = -1; while (1) { alternative_t *this; - index++; - if (index < 0 || index >= listAlternative->count) { + my_index++; + if (my_index < 0 || my_index >= listAlternative->count) { int j; @@ -242,22 +242,22 @@ static void eventTuxAI(tux_t * tux) listDoEmpty(listFork); - index = 0; + my_index = 0; } if (listAlternative->count == 0) { break; } - this = (alternative_t *) listAlternative->list[index]; + this = (alternative_t *) listAlternative->list[my_index]; if (++countDo == 100) break; if (this->step > 100) { - delListItem(listAlternative, index, destroyAlternative); + delListItem(listAlternative, my_index, destroyAlternative); countLimit++; - index--; + my_index--; continue; } @@ -276,7 +276,7 @@ static void eventTuxAI(tux_t * tux) delList(listAlternative, index); addList(listDst, this); - index--; + my_index--; //continue; break; } @@ -284,7 +284,7 @@ static void eventTuxAI(tux_t * tux) if (export_fce->fce_isFreeSpace(arena, this->x, this->y, w, h) == 0) { //forkAlternative(listFork, this, w*2, h*2); delListItem(listAlternative, index, destroyAlternative); - index--; + my_index--; countDel++; continue; diff --git a/src/modules/modPipe.c b/src/modules/modPipe.c index 76554b2..5d1728f 100644 --- a/src/modules/modPipe.c +++ b/src/modules/modPipe.c @@ -317,9 +317,9 @@ static void action_eventpipe(space_t * space, pipe_t * pipe, shot_t * shot) } static void -action_eventshot(space_t * space, shot_t * shot, space_t * spacePipe) +action_eventshot(space_t * space, shot_t * shot, space_t * p_spacePipe) { - actionSpaceFromLocation(spacePipe, action_eventpipe, shot, shot->x, + actionSpaceFromLocation(p_spacePipe, action_eventpipe, shot, shot->x, shot->y, shot->w, shot->h); if (shot->del == TRUE) { diff --git a/src/modules/modTeleport.c b/src/modules/modTeleport.c index 492de5b..8f74eca 100644 --- a/src/modules/modTeleport.c +++ b/src/modules/modTeleport.c @@ -168,13 +168,13 @@ static void cmd_teleport(char *line) static teleport_t *getRandomTeleportBut(space_t * space, teleport_t * teleport) { - int index; + int my_index; do { - index = random() % getSpaceCount(space); - } while (getItemFromSpace(space, index) == teleport); + my_index = random() % getSpaceCount(space); + } while (getItemFromSpace(space, my_index) == teleport); - return (teleport_t *) getItemFromSpace(space, index); + return (teleport_t *) getItemFromSpace(space, my_index); } static int getRandomPosition() @@ -287,9 +287,9 @@ action_eventteleportshot(space_t * space, teleport_t * teleport, shot_t * shot) } static void -action_eventshot(space_t * space, shot_t * shot, space_t * spaceTeleport) +action_eventshot(space_t * space, shot_t * shot, space_t * p_spaceTeleport) { - actionSpaceFromLocation(spaceTeleport, action_eventteleportshot, shot, + actionSpaceFromLocation(p_spaceTeleport, action_eventteleportshot, shot, shot->x, shot->y, shot->w, shot->h); } @@ -300,13 +300,13 @@ action_eventteleporttux(space_t * space, teleport_t * teleport, tux_t * tux) } static void -action_eventtux(space_t * space, tux_t * tux, space_t * spaceTeleport) +action_eventtux(space_t * space, tux_t * tux, space_t * p_spaceTeleport) { int x, y, w, h; export_fce->fce_getTuxProportion(tux, &x, &y, &w, &h); - actionSpaceFromLocation(spaceTeleport, action_eventteleporttux, tux, x, y, + actionSpaceFromLocation(p_spaceTeleport, action_eventteleporttux, tux, x, y, w, h); } diff --git a/src/modules/modWall.c b/src/modules/modWall.c index 41b7e04..d3734d5 100644 --- a/src/modules/modWall.c +++ b/src/modules/modWall.c @@ -296,9 +296,9 @@ static void action_eventwall(space_t * space, wall_t * wall, shot_t * shot) } static void -action_eventshot(space_t * space, shot_t * shot, space_t * spaceWall) +action_eventshot(space_t * space, shot_t * shot, space_t * p_spaceWall) { - actionSpaceFromLocation(spaceWall, action_eventwall, shot, shot->x, + actionSpaceFromLocation(p_spaceWall, action_eventwall, shot, shot->x, shot->y, shot->w, shot->h); if (shot->del == TRUE) { diff --git a/src/screen/browser.c b/src/screen/browser.c index 91b3350..d9bf61e 100644 --- a/src/screen/browser.c +++ b/src/screen/browser.c @@ -192,7 +192,7 @@ static void eventWidget(void *p) server_t *server_getcurr() { - unsigned i = 0; + int i = 0; server_t *server; for (server = server_list.next; server != &server_list; @@ -336,7 +336,8 @@ int server_getinfo(server_t * server) "uptime: D\n" */ - unsigned i = 0; + //unsigned i = 0; + int i = 0; while (i < ret) { if (str[i] == '\n') @@ -525,7 +526,7 @@ static int LoadServers() if (len <= 0) return 0; - unsigned i = 0; + int i = 0; char list[256]; struct in_addr srv; @@ -549,7 +550,8 @@ static int LoadServers() ctx->version = 0; ctx->arena = 0; - int ret = server_getinfo(ctx); + //int ret = server_getinfo(ctx); + ret = server_getinfo(ctx); srv.s_addr = ctx->ip; diff --git a/src/screen/setting.c b/src/screen/setting.c index 9fab21f..1895ec2 100644 --- a/src/screen/setting.c +++ b/src/screen/setting.c @@ -186,26 +186,26 @@ void stopScreenSetting() static void eventWidget(void *p) { - widget_t *button; - widget_t *check; + widget_t *my_button; + widget_t *my_check; - button = (widget_t *) (p); - check = (widget_t *) (p); + my_button = (widget_t *) (p); + my_check = (widget_t *) (p); - if (button == button_back) { + if (my_button == button_back) { setScreen("mainMenu"); } - if (button == button_keys) { + if (my_button == button_keys) { setScreen("settingKeys"); } #ifndef NO_SOUND - if (check == check_music) { + if (my_check == check_music) { setMusicActive(getWidgetCheckStatus(check_music)); } - if (check == check_sound) { + if (my_check == check_sound) { setSoundActive(getWidgetCheckStatus(check_sound)); } #endif diff --git a/src/widget/widget_button.c b/src/widget/widget_button.c index c2afcad..ca1573a 100644 --- a/src/widget/widget_button.c +++ b/src/widget/widget_button.c @@ -61,7 +61,7 @@ void drawWidgetButton(widget_t * widget) void eventWidgetButton(widget_t * widget) { widget_button_t *p; - static int time = 0; + static int my_time = 0; int x, y; assert(widget != NULL); @@ -69,8 +69,8 @@ void eventWidgetButton(widget_t * widget) p = (widget_button_t *) widget->private_data; - if (time > 0) { - time--; + if (my_time > 0) { + my_time--; return; } @@ -79,7 +79,7 @@ void eventWidgetButton(widget_t * widget) if (x >= widget->x && x <= widget->x + WIDGET_BUTTON_WIDTH && y >= widget->y && y <= widget->y + WIDGET_BUTTON_HEIGHT && isMouseClicked()) { - time = WIDGET_BUTTON_TIME; + my_time = WIDGET_BUTTON_TIME; DEBUG_MSG(_("Event caught\n")); diff --git a/src/widget/widget_buttonimage.c b/src/widget/widget_buttonimage.c index dd20e62..a896142 100644 --- a/src/widget/widget_buttonimage.c +++ b/src/widget/widget_buttonimage.c @@ -49,7 +49,7 @@ void drawWidgetButtonimage(widget_t * widget) void eventWidgetButtonimage(widget_t * widget) { widget_buttonimage_t *p; - static int time = 0; + static int my_time = 0; int x, y; assert(widget != NULL); @@ -57,8 +57,8 @@ void eventWidgetButtonimage(widget_t * widget) p = (widget_buttonimage_t *) widget->private_data; - if (time > 0) { - time--; + if (my_time > 0) { + my_time--; return; } @@ -66,7 +66,7 @@ void eventWidgetButtonimage(widget_t * widget) if (x >= widget->x && x <= widget->x + p->w && y >= widget->y && y <= widget->y + p->h && isMouseClicked()) { - time = WIDGET_BUTTONIMAGE_TIME; + my_time = WIDGET_BUTTONIMAGE_TIME; p->active = 1; p->fce_event(widget); } diff --git a/src/widget/widget_choicegroup.c b/src/widget/widget_choicegroup.c index 1045f81..5173164 100644 --- a/src/widget/widget_choicegroup.c +++ b/src/widget/widget_choicegroup.c @@ -132,15 +132,15 @@ void eventWidgetChoicegroup(widget_t * widget) void destroyWidgetChoicegroup(widget_t * widget) { widget_choicegroup_t *p; - int index; + int my_index; assert(widget != NULL); assert(widget->type == WIDGET_TYPE_CHOICE); p = (widget_choicegroup_t *) widget->private_data; - index = searchListItem(p->list, widget); - assert(index != -1); - delList(p->list, index); + my_index = searchListItem(p->list, widget); + assert(my_index != -1); + delList(p->list, my_index); free(p); destroyWidget(widget); diff --git a/src/widget/widget_textfield.c b/src/widget/widget_textfield.c index 6a8824a..94fef18 100644 --- a/src/widget/widget_textfield.c +++ b/src/widget/widget_textfield.c @@ -383,11 +383,11 @@ static void readKey(widget_textfield_t * p) p->text[len] = c; if (mapa[SDLK_LSHIFT] == SDL_PRESSED || mapa[SDLK_RSHIFT] == SDL_PRESSED) { - int i; + int j; - for (i = 0; i < len_shift_map; i += 2) { - if (c == shift_map[i]) { - p->text[len] = shift_map[i + 1]; + for (j = 0; j < len_shift_map; j += 2) { + if (c == shift_map[j]) { + p->text[len] = shift_map[j + 1]; } } |