summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
Diffstat (limited to 'src/base')
-rw-r--r--src/base/buffer.c4
-rw-r--r--src/base/main.c2
-rw-r--r--src/base/myTimer.c20
-rw-r--r--src/base/protect.c8
-rw-r--r--src/base/space.c8
5 files changed, 21 insertions, 21 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);
}
}