diff options
-rw-r--r-- | src/echar/char.c | 6 | ||||
-rw-r--r-- | src/ecommon/utils/strutil.c | 2 | ||||
-rw-r--r-- | src/elogin/md5calc.c | 2 | ||||
-rw-r--r-- | src/elogin/mt_rand.c | 2 | ||||
-rw-r--r-- | src/elogin/parse.c | 4 | ||||
-rw-r--r-- | src/elogin/send.c | 2 | ||||
-rw-r--r-- | src/emap/clif.c | 6 | ||||
-rw-r--r-- | src/emap/craft.c | 4 | ||||
-rw-r--r-- | src/emap/craftconf.c | 6 | ||||
-rw-r--r-- | src/emap/itemdb.c | 3 | ||||
-rw-r--r-- | src/emap/lang.c | 4 | ||||
-rw-r--r-- | src/emap/map.c | 12 | ||||
-rw-r--r-- | src/emap/mob.c | 6 | ||||
-rw-r--r-- | src/emap/pc.c | 16 | ||||
-rw-r--r-- | src/emap/script.c | 20 | ||||
-rw-r--r-- | src/emap/script_buildins.c | 10 | ||||
-rw-r--r-- | src/emap/send.c | 10 | ||||
-rw-r--r-- | src/emap/status.c | 6 | ||||
-rw-r--r-- | src/emap/utils/formatutils.c | 4 |
19 files changed, 76 insertions, 49 deletions
diff --git a/src/echar/char.c b/src/echar/char.c index 205f703..6f2c92f 100644 --- a/src/echar/char.c +++ b/src/echar/char.c @@ -103,12 +103,14 @@ void echar_parse_char_create_new_char(int *fdPtr, struct char_session_data* sd) static int tmpVersion = 0; -void echar_parse_char_connect_pre(int *fdPtr, struct char_session_data *sd, uint32 *ipl) +void echar_parse_char_connect_pre(int *fdPtr, + struct char_session_data *sd __attribute__ ((unused)), + uint32 *ipl __attribute__ ((unused))) { tmpVersion = RFIFOW(*fdPtr, 14); } -void echar_parse_char_connect_post(int *fdPtr, struct char_session_data *sd, uint32 *ipl) +void echar_parse_char_connect_post(int *fdPtr, struct char_session_data *sd, uint32 *ipl __attribute__ ((unused))) { sd = (struct char_session_data*)sockt->session[*fdPtr]->session_data; if (sd) diff --git a/src/ecommon/utils/strutil.c b/src/ecommon/utils/strutil.c index 7862777..544bbaf 100644 --- a/src/ecommon/utils/strutil.c +++ b/src/ecommon/utils/strutil.c @@ -28,7 +28,7 @@ struct strutil_data *strutil_split(const char *str, VECTOR_ENSURE(data->parts, len + 1, 1); data->len = sv->split(data->str, - strlen(data->str), + (int)strlen(data->str), 0, separator, VECTOR_DATA(data->parts), diff --git a/src/elogin/md5calc.c b/src/elogin/md5calc.c index 87c4a52..9bb9460 100644 --- a/src/elogin/md5calc.c +++ b/src/elogin/md5calc.c @@ -238,7 +238,7 @@ void MD5_String2binary (const char *string, char *output) //Step 1.Append Padding Bits (extension of a mark bit) //1-1 - string_byte_len = strlen (string); //The byte chief of a character sequence is acquired. + string_byte_len = (unsigned int)strlen(string); //The byte chief of a character sequence is acquired. pstring = (unsigned char *) string; //The position of the present character sequence is set. //1-2 Repeat calculation until length becomes less than 64 bytes. diff --git a/src/elogin/mt_rand.c b/src/elogin/mt_rand.c index 627d9dd..8f1bc36 100644 --- a/src/elogin/mt_rand.c +++ b/src/elogin/mt_rand.c @@ -114,5 +114,5 @@ int mt_rand (void) while (r >> 16) r = (r & 0xFFFF) + (r >> 16); - return (r); + return (int)(r); } diff --git a/src/elogin/parse.c b/src/elogin/parse.c index 3140615..3e0155a 100644 --- a/src/elogin/parse.c +++ b/src/elogin/parse.c @@ -55,7 +55,7 @@ int elogin_client_login_pre(int *fdPtr, } char username[NAME_LENGTH]; safestrncpy(username, RFIFOP(fd, 6), NAME_LENGTH); - int len = safestrnlen(username, NAME_LENGTH); + int len = (int)safestrnlen(username, NAME_LENGTH); if (clientVersion < 2) { lclif->login_error(fd, 5); @@ -94,7 +94,7 @@ void elogin_parse_client_login2(int fd) safestrncpy(username, RFIFOP(fd, 2), NAME_LENGTH); - int len = safestrnlen(username, NAME_LENGTH); + int len = (int)safestrnlen(username, NAME_LENGTH); if (len < 2 || !(username[len - 2] == '_') || !memchr("FfMm", username[len - 1], 4)) { lclif->login_error(fd, 3); diff --git a/src/elogin/send.c b/src/elogin/send.c index a8bc99b..01c2906 100644 --- a/src/elogin/send.c +++ b/src/elogin/send.c @@ -34,7 +34,7 @@ void send_update_host(int fd) { if (!update_server) return; - const int sz = strlen(update_server); + const int sz = (int)strlen(update_server); WFIFOHEAD(fd, sz + 4); WFIFOW(fd, 0) = 0x63; WFIFOW(fd, 2) = sz + 4; diff --git a/src/emap/clif.c b/src/emap/clif.c index e2a0337..87092c1 100644 --- a/src/emap/clif.c +++ b/src/emap/clif.c @@ -114,7 +114,7 @@ void eclif_charnameack(int *fdPtr, struct block_list *bl) return; } const char *tr = lang_pctrans(((TBL_NPC*)bl)->name, sd); - const int trLen = strlen(tr); + const int trLen = (int)strlen(tr); const int len = 8 + trLen; // if no recipient specified just update nearby clients if (fd == 0) @@ -177,7 +177,7 @@ void eclif_charnameack(int *fdPtr, struct block_list *bl) break; } const char *tr = lang_pctrans(ptr, sd); - const int trLen = strlen(tr); + const int trLen = (int)strlen(tr); const int len = 8 + trLen; // if no recipient specified just update nearby clients @@ -1314,7 +1314,7 @@ void eclif_disp_message(struct block_list* src, nullpo_retv(mes); - int len = strlen(mes); + int len = (int)strlen(mes); if (len == 0 || !isInit) return; diff --git a/src/emap/craft.c b/src/emap/craft.c index 0e2001f..c33ec64 100644 --- a/src/emap/craft.c +++ b/src/emap/craft.c @@ -522,7 +522,7 @@ static bool check_quests(TBL_PC *sd, return true; } -static bool check_inventories(TBL_PC *sd, +static bool check_inventories(TBL_PC *sd __attribute__ ((unused)), struct craft_db_entry *entry, struct item_pair *craft_inventory) { @@ -871,7 +871,7 @@ bool craft_use(TBL_PC *sd, return true; } -int craft_get_entry_code(TBL_PC *sd, +int craft_get_entry_code(TBL_PC *sd __attribute__ ((unused)), const int id) { struct craft_db_entry *entry = idb_get(craftconf_db, id); diff --git a/src/emap/craftconf.c b/src/emap/craftconf.c index 89b31ea..0c9d329 100644 --- a/src/emap/craftconf.c +++ b/src/emap/craftconf.c @@ -27,7 +27,7 @@ struct DBMap *craftconf_db = NULL; -struct craft_db_entry *craft_create_db_entry(const int id) +struct craft_db_entry *craft_create_db_entry(const int id __attribute__ ((unused))) { struct craft_db_entry *entry = aCalloc(sizeof(struct craft_db_entry), 1); if (!entry) @@ -304,7 +304,9 @@ static void craft_read_items_collection(struct craft_db_entry *entry, entry->var = def; \ } -static bool craft_read_db_sub(struct config_setting_t *craftt, int id, const char *source) +static bool craft_read_db_sub(struct config_setting_t *craftt, + int id __attribute__ ((unused)), + const char *source) { int class_; int i32; diff --git a/src/emap/itemdb.c b/src/emap/itemdb.c index 9f3de0a..2550aa6 100644 --- a/src/emap/itemdb.c +++ b/src/emap/itemdb.c @@ -159,7 +159,8 @@ void eitemdb_readdb_additional_fields(int *itemid, hookStop(); } -void edestroy_item_data(struct item_data* self, int *free_selfPtr) +void edestroy_item_data(struct item_data* self, + int *free_selfPtr __attribute__ ((unused))) { struct ItemdExt *data = itemd_get(self); if (!data) diff --git a/src/emap/lang.c b/src/emap/lang.c index 9952c3a..fcef241 100644 --- a/src/emap/lang.c +++ b/src/emap/lang.c @@ -138,14 +138,14 @@ static int langsdb_readdb (void) if (!strings) { strings = aCalloc (lang_num, sizeof(int*)); - sz = strlen(line1) + 1; + sz = (int)strlen(line1) + 1; strings[0] = aCalloc (sz < 24 ? 24 : sz, sizeof(char)); strcpy (strings[0], line2); strdb_put(translate_db, aStrdup (line1), strings); } else { - sz = strlen(line2) + 1; + sz = (int)strlen(line2) + 1; strings[i] = aCalloc (sz < 24 ? 24 : sz, sizeof(char)); strcpy (strings[i], line2); } diff --git a/src/emap/map.c b/src/emap/map.c index 428853d..c85a831 100644 --- a/src/emap/map.c +++ b/src/emap/map.c @@ -62,7 +62,7 @@ struct mapcell2 }; int emap_addflooritem_post(int retVal, - const struct block_list *bl, + const struct block_list *bl __attribute__ ((unused)), struct item *item, int *amount __attribute__ ((unused)), int16 *m __attribute__ ((unused)), @@ -169,7 +169,7 @@ void emap_online_list(int fd) } dbi_destroy(iter); - send_online_list(fd, buf, ptr - buf); + send_online_list(fd, buf, (unsigned int)(ptr - buf)); aFree(buf); } @@ -397,7 +397,13 @@ void emap_setgatcell(int16 *mPtr, int16 *xPtr, int16 *yPtr, int *gatPtr) hookStop(); } -bool emap_iwall_set(int16 *m, int16 *x, int16 *y, int *size, int8 *dir, bool *shootable, const char* wall_name) +bool emap_iwall_set(int16 *m __attribute__ ((unused)), + int16 *x __attribute__ ((unused)), + int16 *y __attribute__ ((unused)), + int *size __attribute__ ((unused)), + int8 *dir __attribute__ ((unused)), + bool *shootable __attribute__ ((unused)), + const char* wall_name __attribute__ ((unused))) { ShowError("Unsupported set wall function\n"); hookStop(); diff --git a/src/emap/mob.c b/src/emap/mob.c index f64c789..a5700cc 100644 --- a/src/emap/mob.c +++ b/src/emap/mob.c @@ -57,8 +57,8 @@ int emob_deleteslave_sub(struct block_list *bl, va_list ap) void emob_read_db_additional_fields(struct mob_db *entry, struct config_setting_t *it, - int *nPtr, - const char *source) + int *nPtr __attribute__ ((unused)), + const char *source __attribute__ ((unused))) { int i32 = 0; @@ -74,7 +74,7 @@ void emob_read_db_additional_fields(struct mob_db *entry, } int emob_read_db_mode_sub_post(int retVal, - struct mob_db *entry, + struct mob_db *entry __attribute__ ((unused)), struct config_setting_t *t) { struct config_setting_t *t2; diff --git a/src/emap/pc.c b/src/emap/pc.c index 3ad18e8..1ba06c7 100644 --- a/src/emap/pc.c +++ b/src/emap/pc.c @@ -483,7 +483,9 @@ static int tempN = 0; static int tempId = 0; static int tempAmount = 0; -int epc_dropitem_pre(struct map_session_data *sd, int *nPtr, int *amountPtr) +int epc_dropitem_pre(struct map_session_data *sd, + int *nPtr, + int *amountPtr __attribute__ ((unused))) { const int n = *nPtr; if (!sd || n < 0 || n >= MAX_INVENTORY) @@ -513,7 +515,8 @@ int epc_dropitem_post(int retVal, struct map_session_data *sd, int *nPtr, int *a return retVal; } -int epc_takeitem_pre(struct map_session_data *sd, struct flooritem_data *fitem) +int epc_takeitem_pre(struct map_session_data *sd __attribute__ ((unused)), + struct flooritem_data *fitem) { if (!fitem) { @@ -527,7 +530,9 @@ int epc_takeitem_pre(struct map_session_data *sd, struct flooritem_data *fitem) return 1; } -int epc_takeitem_post(int retVal, struct map_session_data *sd, struct flooritem_data *fitem) +int epc_takeitem_post(int retVal, + struct map_session_data *sd, + struct flooritem_data *fitem __attribute__ ((unused))) { if (retVal && tempN == -1 && tempId) { @@ -561,7 +566,10 @@ int epc_insert_card_pre(struct map_session_data* sd, int *idx_card, int *idx_equ return 1; } -int epc_insert_card_post(int retVal, struct map_session_data* sd, int *idx_card, int *idx_equip) +int epc_insert_card_post(int retVal, + struct map_session_data* sd, + int *idx_card __attribute__ ((unused)), + int *idx_equip) { if (retVal && *idx_equip == tempN && tempId) { diff --git a/src/emap/script.c b/src/emap/script.c index 178b99a..5c635b0 100644 --- a/src/emap/script.c +++ b/src/emap/script.c @@ -20,7 +20,7 @@ #define getExt2() \ TBL_NPC *nd = NULL; \ - int num = reference_uid(script->add_str(".id"), 0); \ + int num = (int)reference_uid(script->add_str(".id"), 0); \ int id = (int)i64db_iget(n->vars, num); \ if (!id) \ id = st->oid; \ @@ -33,7 +33,7 @@ #define getExt2Ret(r) \ TBL_NPC *nd = NULL; \ - int num = reference_uid(script->add_str(".id"), 0); \ + int num = (int)reference_uid(script->add_str(".id"), 0); \ int id = (int)i64db_iget(n->vars, num); \ if (!id) \ id = st->oid; \ @@ -46,7 +46,7 @@ #define getExt1() \ TBL_NPC *nd = NULL; \ - int num = reference_uid(script->add_str(".id"), 0); \ + int num = (int)reference_uid(script->add_str(".id"), 0); \ int id = (int)i64db_iget(n->vars, num); \ if (!id) \ id = st->oid; \ @@ -56,7 +56,7 @@ #define getExt1Return(r) \ TBL_NPC *nd = NULL; \ - int num = reference_uid(script->add_str(".id"), 0); \ + int num = (int)reference_uid(script->add_str(".id"), 0); \ int id = (int)i64db_iget(n->vars, num); \ if (!id) \ id = st->oid; \ @@ -111,7 +111,11 @@ void escript_load_translations(void) hookStop(); } -void eset_reg_npcscope_num(struct script_state* st, struct reg_db *n, int64 *num, const char* name, int *val) +void eset_reg_npcscope_num(struct script_state* st, + struct reg_db *n, + int64 *num __attribute__ ((unused)), + const char* name, + int *val) { if (!strcmp(name, ".lang")) { @@ -297,7 +301,11 @@ int eget_val_npcscope_num(struct script_state* st, struct reg_db *n, struct scri return 0; } -void eset_reg_npcscope_str(struct script_state* st, struct reg_db *n, int64 *num, const char* name, const char *str) +void eset_reg_npcscope_str(struct script_state* st, + struct reg_db *n, + int64 *num __attribute__ ((unused)), + const char* name, + const char *str) { if (!strcmp(name, ".map$")) { diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c index d62d4bc..809e091 100644 --- a/src/emap/script_buildins.c +++ b/src/emap/script_buildins.c @@ -331,7 +331,7 @@ BUILDIN(requestItem) int item = 0; - if (!sd->npc_str) + if (!*sd->npc_str) { ShowWarning("npc string not found\n"); script_pushint(st, 0); @@ -379,7 +379,7 @@ BUILDIN(requestItems) // take received text/value and store it in the designated variable sd->state.menu_or_input = 0; - if (!sd->npc_str) + if (!*sd->npc_str) { ShowWarning("npc string not found\n"); script_pushstr(st, aStrdup("0,0")); @@ -416,7 +416,7 @@ BUILDIN(requestItemIndex) int item = -1; - if (!sd->npc_str) + if (!*sd->npc_str) { script_pushint(st, -1); ShowWarning("npc string not found\n"); @@ -467,7 +467,7 @@ BUILDIN(requestItemsIndex) // take received text/value and store it in the designated variable sd->state.menu_or_input = 0; - if (!sd->npc_str) + if (!*sd->npc_str) { script_pushstr(st, aStrdup("-1")); ShowWarning("npc string not found\n"); @@ -511,7 +511,7 @@ BUILDIN(requestCraft) // take received text/value and store it in the designated variable sd->state.menu_or_input = 0; - if (!sd->npc_str) + if (!*sd->npc_str) { ShowWarning("npc string not found\n"); script->reportsrc(st); diff --git a/src/emap/send.c b/src/emap/send.c index 7078410..da321fb 100644 --- a/src/emap/send.c +++ b/src/emap/send.c @@ -274,7 +274,7 @@ void send_changemusic_brodcast(const int map, const char *music) return; struct block_list bl; - const int sz = strlen (music) + 5; + const int sz = (int)strlen(music) + 5; char *buf; CREATE(buf, char, sz); @@ -292,7 +292,7 @@ void send_changenpc_title (TBL_PC *sd, const int npcId, const char *name) return; const int fd = sd->fd; - const int len = strlen (name); + const int len = (int)strlen(name); const int sz = len + 5 + 4 + 2; WFIFOHEAD (fd, sz); WFIFOW (fd, 0) = 0xb06; @@ -322,7 +322,7 @@ void send_slave_say(TBL_PC *sd, { if (!sd || !message) return; - const int len = 24 + 7 + strlen(message); + const int len = 24 + 7 + (int)strlen(message); char *buf = NULL; CREATE(buf, char, len); @@ -353,7 +353,7 @@ void send_client_command(TBL_PC *sd, const char *const command) if (!data || data->clientVersion < 8) return; - const unsigned int len = strlen(command); + const unsigned int len = (unsigned int)strlen(command); const int fd = sd->fd; WFIFOHEAD (fd, len); WFIFOW (fd, 0) = 0xb16; @@ -451,7 +451,7 @@ void send_pc_skin(int fd, int npcId, const char *const skin) if (!data || data->clientVersion < 15) return; - const int sz = strlen(skin) + 9; + const int sz = (int)strlen(skin) + 9; WFIFOHEAD (fd, sz); WFIFOW(fd, 0) = 0xb1c; WFIFOW(fd, 2) = sz; diff --git a/src/emap/status.c b/src/emap/status.c index 2463254..46b705d 100644 --- a/src/emap/status.c +++ b/src/emap/status.c @@ -52,7 +52,7 @@ void estatus_set_viewdata_post(struct block_list *bl, if (npc->u.scr.script) { // here some magic to set npc local variable .id to bl.id - const int num = reference_uid(script->add_str(".id"), 0); + const int num = (int)reference_uid(script->add_str(".id"), 0); if (!npc->u.scr.script->local.vars) npc->u.scr.script->local.vars = i64db_alloc(DB_OPT_RELEASE_DATA); i64db_iput(npc->u.scr.script->local.vars, num, npc->bl.id); @@ -135,8 +135,8 @@ int estatus_calc_pc_additional(struct map_session_data* sd, unsigned short estatus_calc_speed_post(unsigned short retVal, struct block_list *bl, - struct status_change *sc, - int *speed) + struct status_change *sc __attribute__ ((unused)), + int *speed __attribute__ ((unused))) { return horse_add_speed_bonus(BL_CAST(BL_PC, bl), retVal); } diff --git a/src/emap/utils/formatutils.c b/src/emap/utils/formatutils.c index 57f27cc..00ea637 100644 --- a/src/emap/utils/formatutils.c +++ b/src/emap/utils/formatutils.c @@ -97,14 +97,14 @@ int format_sub(struct script_state* st, int translate) } char *ptr = line; - int sz = strlen(line); + int sz = (int)strlen(line); while (script_hasdata(st, idx)) { char *tmp = strstr(ptr, "@@"); if (!tmp) break; const char *item = script_getstr(st, idx); - int len = strlen(item); + int len = (int)strlen(item); if (len > 50) break; sz += len - 2; |