From 721265e0fe2bd38bafd3a09a0e574e10c89bd345 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sun, 3 Apr 2011 21:37:59 -0700 Subject: Fix some more compiler warnings --- src/common/db.c | 2 +- src/common/md5calc.c | 4 ++-- src/common/md5calc.h | 2 +- src/common/mmo.h | 4 ++-- src/common/nullpo.c | 2 ++ src/common/socket.c | 22 +++++++++++----------- src/common/socket.h | 2 +- src/common/timer.c | 8 ++++---- src/common/timer.h | 5 +++-- 9 files changed, 27 insertions(+), 24 deletions(-) (limited to 'src/common') diff --git a/src/common/db.c b/src/common/db.c index cee17df..f56a511 100644 --- a/src/common/db.c +++ b/src/common/db.c @@ -229,7 +229,7 @@ static void db_rebalance_erase (struct dbn *z, struct dbn **root) z->parent->right = y; y->parent = z->parent; { - int tmp = y->color; + dbn_color tmp = y->color; y->color = z->color; z->color = tmp; } diff --git a/src/common/md5calc.c b/src/common/md5calc.c index 3f2e009..ba8f6af 100644 --- a/src/common/md5calc.c +++ b/src/common/md5calc.c @@ -165,7 +165,7 @@ void MD5_to_bin(MD5_state state, uint8_t out[0x10]) out[i] = state.val[i/4] >> 8*(i%4); } -static const char hex[0x10] = "0123456789abcdef"; +static const char hex[] = "0123456789abcdef"; void MD5_to_str(MD5_state state, char out[0x21]) { @@ -291,7 +291,7 @@ const char *MD5_saltcrypt(const char *key, const char *salt) return obuf; } -const char *make_salt() { +const char *make_salt(void) { static char salt[6]; for (int i=0; i<5; i++) salt[i] = MPRAND(48, 78); diff --git a/src/common/md5calc.h b/src/common/md5calc.h index cf1425f..b864791 100644 --- a/src/common/md5calc.h +++ b/src/common/md5calc.h @@ -53,7 +53,7 @@ const char *MD5_saltcrypt(const char *key, const char *salt); /// return some random characters (statically allocated) // Currently, returns a 5-char string -const char *make_salt(); +const char *make_salt(void); /// check plaintext password against saved saltcrypt bool pass_ok(const char *password, const char *crypted); diff --git a/src/common/mmo.h b/src/common/mmo.h index 906f5c1..2bd8705 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -101,7 +101,7 @@ struct mmo_charstatus int base_exp, job_exp, zeny; - short class; + short pc_class; short status_point, skill_point; int hp, max_hp, sp, max_sp; short option, karma, manner; @@ -176,7 +176,7 @@ struct party struct guild_member { int account_id, char_id; - short hair, hair_color, gender, class, lv; + short hair, hair_color, gender, pc_class, lv; int exp, exp_payper; short online, position; int rsv1, rsv2; diff --git a/src/common/nullpo.c b/src/common/nullpo.c index de10517..8c7c405 100644 --- a/src/common/nullpo.c +++ b/src/common/nullpo.c @@ -46,6 +46,8 @@ void nullpo_info (const char *file, int line, const char *func) } /// Actual output function +static void nullpo_info_core (const char *file, int line, const char *func, + const char *fmt, va_list ap) __attribute__((format(printf, 4, 0))); static void nullpo_info_core (const char *file, int line, const char *func, const char *fmt, va_list ap) { diff --git a/src/common/socket.c b/src/common/socket.c index 7c86b1a..67a5102 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -23,8 +23,8 @@ fd_set readfds; int fd_max; int currentuse; -const uint32_t rfifo_size = 65536; -const uint32_t wfifo_size = 65536; +const uint32_t RFIFO_SIZE = 65536; +const uint32_t WFIFO_SIZE = 65536; struct socket_data *session[FD_SETSIZE]; @@ -126,11 +126,11 @@ static void connect_client (int listen_fd) fcntl (fd, F_SETFL, O_NONBLOCK); CREATE (session[fd], struct socket_data, 1); - CREATE (session[fd]->rdata, uint8_t, rfifo_size); - CREATE (session[fd]->wdata, uint8_t, wfifo_size); + CREATE (session[fd]->rdata, uint8_t, RFIFO_SIZE); + CREATE (session[fd]->wdata, uint8_t, WFIFO_SIZE); - session[fd]->max_rdata = rfifo_size; - session[fd]->max_wdata = wfifo_size; + session[fd]->max_rdata = RFIFO_SIZE; + session[fd]->max_wdata = WFIFO_SIZE; session[fd]->func_recv = recv_to_fifo; session[fd]->func_send = send_from_fifo; session[fd]->func_parse = default_func_parse; @@ -231,11 +231,11 @@ int make_connection (uint32_t ip, uint16_t port) FD_SET (fd, &readfds); CREATE (session[fd], struct socket_data, 1); - CREATE (session[fd]->rdata, uint8_t, rfifo_size); - CREATE (session[fd]->wdata, uint8_t, wfifo_size); + CREATE (session[fd]->rdata, uint8_t, RFIFO_SIZE); + CREATE (session[fd]->wdata, uint8_t, WFIFO_SIZE); - session[fd]->max_rdata = rfifo_size; - session[fd]->max_wdata = wfifo_size; + session[fd]->max_rdata = RFIFO_SIZE; + session[fd]->max_wdata = WFIFO_SIZE; session[fd]->func_recv = recv_to_fifo; session[fd]->func_send = send_from_fifo; session[fd]->func_parse = default_func_parse; @@ -399,7 +399,7 @@ FILE *fopen_ (const char *path, const char *mode) return f; } -bool free_fds () +bool free_fds (void) { return currentuse < SOFT_LIMIT; } diff --git a/src/common/socket.h b/src/common/socket.h index 0e15f5b..b886df0 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -130,6 +130,6 @@ void set_defaultparse (void (*defaultparse) (int)); /// Wrappers to track number of free FDs void fclose_ (FILE * fp); FILE *fopen_ (const char *path, const char *mode); -bool free_fds (); +bool free_fds (void); #endif // SOCKET_H diff --git a/src/common/timer.c b/src/common/timer.c index f4be19b..6795824 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -51,7 +51,7 @@ static void push_timer_heap (timer_id index) if (timer_heap == NULL || timer_heap[0] + 1 >= timer_heap_max) { timer_heap_max += 256; - RECREATE (timer_heap, int, timer_heap_max); + RECREATE (timer_heap, timer_id, timer_heap_max); memset (timer_heap + (timer_heap_max - 256), 0, sizeof (timer_id) * 256); } // timer_heap[0] is the greatest index into the heap, which increases @@ -71,14 +71,14 @@ static void push_timer_heap (timer_id index) timer_heap[h + 1] = index; } -static timer_id top_timer_heap () +static timer_id top_timer_heap (void) { if (!timer_heap || !timer_heap[0]) return -1; return timer_heap[1]; } -static timer_id pop_timer_heap () +static timer_id pop_timer_heap (void) { if (!timer_heap || !timer_heap[0]) return -1; @@ -227,7 +227,7 @@ interval_t do_timer (tick_t tick) switch (timer_data[i].type) { case TIMER_ONCE_AUTODEL: - timer_data[i].type = 0; + timer_data[i].type = TIMER_NONE; if (free_timer_list_pos >= free_timer_list_max) { free_timer_list_max += 256; diff --git a/src/common/timer.h b/src/common/timer.h index e363a56..e6a292c 100644 --- a/src/common/timer.h +++ b/src/common/timer.h @@ -5,8 +5,9 @@ enum TIMER_TYPE { - TIMER_ONCE_AUTODEL = 1, - TIMER_INTERVAL = 2, + TIMER_NONE, + TIMER_ONCE_AUTODEL, + TIMER_INTERVAL, }; /// This is needed to produce a signed result when 2 ticks are subtracted # define DIFF_TICK(a,b) ((int32_t)((a)-(b))) -- cgit v1.2.3-60-g2f50