diff options
author | Haru <haru@dotalux.com> | 2016-01-07 16:47:24 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-02-24 21:00:26 +0100 |
commit | 3188738be5ee78651e31c1340fac7fed81bbefb5 (patch) | |
tree | 97ea854a3c77884e817c02dc069b980ccc42ee74 /src/char | |
parent | a79ab6c3d11c7d6fcd1f04400f50b93f72e570e1 (diff) | |
download | hercules-3188738be5ee78651e31c1340fac7fed81bbefb5.tar.gz hercules-3188738be5ee78651e31c1340fac7fed81bbefb5.tar.bz2 hercules-3188738be5ee78651e31c1340fac7fed81bbefb5.tar.xz hercules-3188738be5ee78651e31c1340fac7fed81bbefb5.zip |
Removed several unnecessary RFIFOP typecasts
- While this is arguable, those explicit typecasts are potentially
dangerous/misleading (for example, a const specifier might get
accidentally dropped without even generating a compiler warning, or a
variable type might change during code changes, and any related
warning would get silenced by the explicit typecast).
- As a reminder Hercules is written in C, and not in C++ (and there's
no such thing as "compiling in C++ mode" - they're two different
languages.) As such, it is legal to let the compiler automatically
promote void* from/to any non-const pointer type, as well as const
void* from/to any const pointer type.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/char')
-rw-r--r-- | src/char/char.c | 25 | ||||
-rw-r--r-- | src/char/int_auction.c | 2 | ||||
-rw-r--r-- | src/char/int_elemental.c | 4 | ||||
-rw-r--r-- | src/char/int_guild.c | 22 | ||||
-rw-r--r-- | src/char/int_homun.c | 6 | ||||
-rw-r--r-- | src/char/int_mercenary.c | 4 | ||||
-rw-r--r-- | src/char/int_party.c | 6 | ||||
-rw-r--r-- | src/char/int_pet.c | 4 | ||||
-rw-r--r-- | src/char/int_quest.c | 2 | ||||
-rw-r--r-- | src/char/int_storage.c | 2 | ||||
-rw-r--r-- | src/char/inter.c | 13 | ||||
-rw-r--r-- | src/char/pincode.c | 8 |
12 files changed, 48 insertions, 50 deletions
diff --git a/src/char/char.c b/src/char/char.c index 1e477ba6e..7dad470ec 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -2378,8 +2378,8 @@ void char_parse_fromlogin_account_data(int fd) sd->char_slots = MAX_CHARS;/* cap to maximum */ } else if ( sd->char_slots <= 0 )/* no value aka 0 in sql */ sd->char_slots = MAX_CHARS;/* cap to maximum */ - safestrncpy(sd->birthdate, (const char*)RFIFOP(fd,52), sizeof(sd->birthdate)); - safestrncpy(sd->pincode, (const char*)RFIFOP(fd,63), sizeof(sd->pincode)); + safestrncpy(sd->birthdate, RFIFOP(fd,52), sizeof(sd->birthdate)); + safestrncpy(sd->pincode, RFIFOP(fd,63), sizeof(sd->pincode)); sd->pincode_change = RFIFOL(fd,68); // continued from chr->auth_ok... if( (max_connect_user == 0 && sd->group_id != gm_allow_group) || @@ -2606,9 +2606,8 @@ void char_parse_fromlogin_accinfo2_failed(int fd) void char_parse_fromlogin_accinfo2_ok(int fd) { mapif->parse_accinfo2(true, RFIFOL(fd,167), RFIFOL(fd,171), RFIFOL(fd,175), RFIFOL(fd,179), - (char*)RFIFOP(fd,2), (char*)RFIFOP(fd,26), (char*)RFIFOP(fd,59), - (char*)RFIFOP(fd,99), (char*)RFIFOP(fd,119), (char*)RFIFOP(fd,151), - (char*)RFIFOP(fd,156), RFIFOL(fd,115), RFIFOL(fd,143), RFIFOL(fd,147)); + RFIFOP(fd,2), RFIFOP(fd,26), RFIFOP(fd,59), RFIFOP(fd,99), RFIFOP(fd,119), + RFIFOP(fd,151), RFIFOP(fd,156), RFIFOL(fd,115), RFIFOL(fd,143), RFIFOL(fd,147)); RFIFOSKIP(fd,183); } @@ -3513,7 +3512,7 @@ void char_parse_frommap_change_account(int fd) char esc_name[NAME_LENGTH*2+1]; int acc = RFIFOL(fd,2); // account_id of who ask (-1 if server itself made this request) - const char* name = (char*)RFIFOP(fd,6); // name of the target character + const char *name = RFIFOP(fd,6); // name of the target character int type = RFIFOW(fd,30); // type of operation: 1-block, 2-ban, 3-unblock, 4-unban, 5 changesex, 6 charban, 7 charunban short year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0; int sex = SEX_MALE; @@ -3856,7 +3855,7 @@ void char_parse_frommap_request_stats_report(int fd) WFIFOHEAD(sfd, RFIFOW(fd,2) ); - memcpy((char*)WFIFOP(sfd,0), (char*)RFIFOP(fd, 0), RFIFOW(fd,2)); + memcpy((char*)WFIFOP(sfd,0), RFIFOP(fd, 0), RFIFOW(fd,2)); WFIFOSET(sfd, RFIFOW(fd,2) ); @@ -4734,9 +4733,9 @@ void char_parse_char_create_new_char(int fd, struct char_session_data* sd) result = -2; } else { #if PACKETVER >= 20120307 - result = chr->make_new_char_sql(sd, (char*)RFIFOP(fd,2), 1, 1, 1, 1, 1, 1, RFIFOB(fd,26),RFIFOW(fd,27),RFIFOW(fd,29)); + result = chr->make_new_char_sql(sd, RFIFOP(fd,2), 1, 1, 1, 1, 1, 1, RFIFOB(fd,26),RFIFOW(fd,27),RFIFOW(fd,29)); #else - result = chr->make_new_char_sql(sd, (char*)RFIFOP(fd,2),RFIFOB(fd,26),RFIFOB(fd,27),RFIFOB(fd,28),RFIFOB(fd,29),RFIFOB(fd,30),RFIFOB(fd,31),RFIFOB(fd,32),RFIFOW(fd,33),RFIFOW(fd,35)); + result = chr->make_new_char_sql(sd, RFIFOP(fd,2),RFIFOB(fd,26),RFIFOB(fd,27),RFIFOB(fd,28),RFIFOB(fd,29),RFIFOB(fd,30),RFIFOB(fd,31),RFIFOB(fd,32),RFIFOW(fd,33),RFIFOW(fd,35)); #endif } @@ -4850,7 +4849,7 @@ void char_parse_char_rename_char(int fd, struct char_session_data* sd) int i, cid =RFIFOL(fd,2); char name[NAME_LENGTH]; char esc_name[NAME_LENGTH*2+1]; - safestrncpy(name, (char *)RFIFOP(fd,6), NAME_LENGTH); + safestrncpy(name, RFIFOP(fd,6), NAME_LENGTH); RFIFOSKIP(fd,30); ARR_FIND( 0, MAX_CHARS, i, sd->found_char[i] == cid ); @@ -4875,7 +4874,7 @@ void char_parse_char_rename_char2(int fd, struct char_session_data* sd) int i, aid = RFIFOL(fd,2), cid =RFIFOL(fd,6); char name[NAME_LENGTH]; char esc_name[NAME_LENGTH*2+1]; - safestrncpy(name, (char *)RFIFOP(fd,10), NAME_LENGTH); + safestrncpy(name, RFIFOP(fd,10), NAME_LENGTH); RFIFOSKIP(fd,34); if( aid != sd->account_id ) @@ -4974,8 +4973,8 @@ void char_parse_char_login_map_server(int fd, uint32 ipl) { char l_user[24], l_pass[24]; int i; - safestrncpy(l_user, (char *)RFIFOP(fd,2), 24); - safestrncpy(l_pass, (char *)RFIFOP(fd,26), 24); + safestrncpy(l_user, RFIFOP(fd,2), 24); + safestrncpy(l_pass, RFIFOP(fd,26), 24); ARR_FIND( 0, ARRAYLENGTH(chr->server), i, chr->server[i].fd <= 0 ); if (core->runflag != CHARSERVER_ST_RUNNING || diff --git a/src/char/int_auction.c b/src/char/int_auction.c index 90dd75962..464a2092b 100644 --- a/src/char/int_auction.c +++ b/src/char/int_auction.c @@ -462,7 +462,7 @@ void mapif_parse_auction_bid(int fd) } auction->buyer_id = char_id; - safestrncpy(auction->buyer_name, (char*)RFIFOP(fd,16), NAME_LENGTH); + safestrncpy(auction->buyer_name, RFIFOP(fd,16), NAME_LENGTH); auction->price = bid; if( bid >= auction->buynow ) diff --git a/src/char/int_elemental.c b/src/char/int_elemental.c index 70275725d..fe8bab0de 100644 --- a/src/char/int_elemental.c +++ b/src/char/int_elemental.c @@ -212,10 +212,10 @@ int inter_elemental_parse_frommap(int fd) { unsigned short cmd = RFIFOW(fd,0); switch( cmd ) { - case 0x307c: mapif->parse_elemental_create(fd, (struct s_elemental*)RFIFOP(fd,4)); break; + case 0x307c: mapif->parse_elemental_create(fd, RFIFOP(fd,4)); break; case 0x307d: mapif->parse_elemental_load(fd, (int)RFIFOL(fd,2), (int)RFIFOL(fd,6)); break; case 0x307e: mapif->parse_elemental_delete(fd, (int)RFIFOL(fd,2)); break; - case 0x307f: mapif->parse_elemental_save(fd, (struct s_elemental*)RFIFOP(fd,4)); break; + case 0x307f: mapif->parse_elemental_save(fd, RFIFOP(fd,4)); break; default: return 0; } diff --git a/src/char/int_guild.c b/src/char/int_guild.c index 04de75a20..2ba50d277 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -1902,22 +1902,22 @@ int inter_guild_parse_frommap(int fd) { RFIFOHEAD(fd); switch(RFIFOW(fd,0)) { - case 0x3030: mapif->parse_CreateGuild(fd,RFIFOL(fd,4),(char*)RFIFOP(fd,8),(struct guild_member *)RFIFOP(fd,32)); break; + case 0x3030: mapif->parse_CreateGuild(fd, RFIFOL(fd,4), RFIFOP(fd,8), RFIFOP(fd,32)); break; case 0x3031: mapif->parse_GuildInfo(fd,RFIFOL(fd,2)); break; - case 0x3032: mapif->parse_GuildAddMember(fd,RFIFOL(fd,4),(struct guild_member *)RFIFOP(fd,8)); break; - case 0x3033: mapif->parse_GuildMasterChange(fd,RFIFOL(fd,4),(const char*)RFIFOP(fd,8),RFIFOW(fd,2)-8); break; - case 0x3034: mapif->parse_GuildLeave(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),(const char*)RFIFOP(fd,15)); break; + case 0x3032: mapif->parse_GuildAddMember(fd, RFIFOL(fd,4), RFIFOP(fd,8)); break; + case 0x3033: mapif->parse_GuildMasterChange(fd, RFIFOL(fd,4), RFIFOP(fd,8), RFIFOW(fd,2)-8); break; + case 0x3034: mapif->parse_GuildLeave(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOB(fd,14), RFIFOP(fd,15)); break; case 0x3035: mapif->parse_GuildChangeMemberInfoShort(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),RFIFOW(fd,15),RFIFOW(fd,17)); break; case 0x3036: mapif->parse_BreakGuild(fd,RFIFOL(fd,2)); break; - case 0x3037: mapif->parse_GuildMessage(fd,RFIFOL(fd,4),RFIFOL(fd,8),(char*)RFIFOP(fd,12),RFIFOW(fd,2)-12); break; - case 0x3039: mapif->parse_GuildBasicInfoChange(fd,RFIFOL(fd,4),RFIFOW(fd,8),(const int16 *)RFIFOP(fd,10),RFIFOW(fd,2)-10); break; - case 0x303A: mapif->parse_GuildMemberInfoChange(fd,RFIFOL(fd,4),RFIFOL(fd,8),RFIFOL(fd,12),RFIFOW(fd,16),(const char*)RFIFOP(fd,18),RFIFOW(fd,2)-18); break; - case 0x303B: mapif->parse_GuildPosition(fd,RFIFOL(fd,4),RFIFOL(fd,8),(struct guild_position *)RFIFOP(fd,12)); break; + case 0x3037: mapif->parse_GuildMessage(fd, RFIFOL(fd,4), RFIFOL(fd,8), RFIFOP(fd,12), RFIFOW(fd,2)-12); break; + case 0x3039: mapif->parse_GuildBasicInfoChange(fd, RFIFOL(fd,4), RFIFOW(fd,8), RFIFOP(fd,10), RFIFOW(fd,2)-10); break; + case 0x303A: mapif->parse_GuildMemberInfoChange(fd, RFIFOL(fd,4), RFIFOL(fd,8), RFIFOL(fd,12), RFIFOW(fd,16), RFIFOP(fd,18), RFIFOW(fd,2)-18); break; + case 0x303B: mapif->parse_GuildPosition(fd, RFIFOL(fd,4), RFIFOL(fd,8), RFIFOP(fd,12)); break; case 0x303C: mapif->parse_GuildSkillUp(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOL(fd,14)); break; case 0x303D: mapif->parse_GuildAlliance(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOL(fd,14),RFIFOB(fd,18)); break; - case 0x303E: mapif->parse_GuildNotice(fd,RFIFOL(fd,2),(const char*)RFIFOP(fd,6),(const char*)RFIFOP(fd,66)); break; - case 0x303F: mapif->parse_GuildEmblem(fd,RFIFOW(fd,2)-12,RFIFOL(fd,4),RFIFOL(fd,8),(const char*)RFIFOP(fd,12)); break; - case 0x3040: mapif->parse_GuildCastleDataLoad(fd,RFIFOW(fd,2),(int *)RFIFOP(fd,4)); break; + case 0x303E: mapif->parse_GuildNotice(fd, RFIFOL(fd,2), RFIFOP(fd,6), RFIFOP(fd,66)); break; + case 0x303F: mapif->parse_GuildEmblem(fd, RFIFOW(fd,2)-12, RFIFOL(fd,4), RFIFOL(fd,8), RFIFOP(fd,12)); break; + case 0x3040: mapif->parse_GuildCastleDataLoad(fd, RFIFOW(fd,2), RFIFOP(fd,4)); break; case 0x3041: mapif->parse_GuildCastleDataSave(fd,RFIFOW(fd,2),RFIFOB(fd,4),RFIFOL(fd,5)); break; default: diff --git a/src/char/int_homun.c b/src/char/int_homun.c index 1377bfbd8..2179b2aa3 100644 --- a/src/char/int_homun.c +++ b/src/char/int_homun.c @@ -347,11 +347,11 @@ int inter_homunculus_parse_frommap(int fd) switch( cmd ) { - case 0x3090: mapif->parse_homunculus_create(fd, (int)RFIFOW(fd,2), (int)RFIFOL(fd,4), (struct s_homunculus*)RFIFOP(fd,8)); break; + case 0x3090: mapif->parse_homunculus_create(fd, (int)RFIFOW(fd,2), (int)RFIFOL(fd,4), RFIFOP(fd,8)); break; case 0x3091: mapif->parse_homunculus_load (fd, (int)RFIFOL(fd,2), (int)RFIFOL(fd,6)); break; - case 0x3092: mapif->parse_homunculus_save (fd, (int)RFIFOW(fd,2), (int)RFIFOL(fd,4), (struct s_homunculus*)RFIFOP(fd,8)); break; + case 0x3092: mapif->parse_homunculus_save (fd, (int)RFIFOW(fd,2), (int)RFIFOL(fd,4), RFIFOP(fd,8)); break; case 0x3093: mapif->parse_homunculus_delete(fd, (int)RFIFOL(fd,2)); break; - case 0x3094: mapif->parse_homunculus_rename(fd, (int)RFIFOL(fd,2), (int)RFIFOL(fd,6), (char*)RFIFOP(fd,10)); break; + case 0x3094: mapif->parse_homunculus_rename(fd, (int)RFIFOL(fd,2), (int)RFIFOL(fd,6), RFIFOP(fd,10)); break; default: return 0; } diff --git a/src/char/int_mercenary.c b/src/char/int_mercenary.c index 671c71278..0c3a7fdf8 100644 --- a/src/char/int_mercenary.c +++ b/src/char/int_mercenary.c @@ -262,10 +262,10 @@ int inter_mercenary_parse_frommap(int fd) switch( cmd ) { - case 0x3070: mapif->parse_mercenary_create(fd, (struct s_mercenary*)RFIFOP(fd,4)); break; + case 0x3070: mapif->parse_mercenary_create(fd, RFIFOP(fd,4)); break; case 0x3071: mapif->parse_mercenary_load(fd, (int)RFIFOL(fd,2), (int)RFIFOL(fd,6)); break; case 0x3072: mapif->parse_mercenary_delete(fd, (int)RFIFOL(fd,2)); break; - case 0x3073: mapif->parse_mercenary_save(fd, (struct s_mercenary*)RFIFOP(fd,4)); break; + case 0x3073: mapif->parse_mercenary_save(fd, RFIFOP(fd,4)); break; default: return 0; } diff --git a/src/char/int_party.c b/src/char/int_party.c index 8ff9ca3a2..c011f1b8f 100644 --- a/src/char/int_party.c +++ b/src/char/int_party.c @@ -769,14 +769,14 @@ int inter_party_parse_frommap(int fd) { RFIFOHEAD(fd); switch(RFIFOW(fd,0)) { - case 0x3020: mapif->parse_CreateParty(fd, (char*)RFIFOP(fd,4), RFIFOB(fd,28), RFIFOB(fd,29), (struct party_member*)RFIFOP(fd,30)); break; + case 0x3020: mapif->parse_CreateParty(fd, RFIFOP(fd,4), RFIFOB(fd,28), RFIFOB(fd,29), RFIFOP(fd,30)); break; case 0x3021: mapif->parse_PartyInfo(fd, RFIFOL(fd,2), RFIFOL(fd,6)); break; - case 0x3022: mapif->parse_PartyAddMember(fd, RFIFOL(fd,4), (struct party_member*)RFIFOP(fd,8)); break; + case 0x3022: mapif->parse_PartyAddMember(fd, RFIFOL(fd,4), RFIFOP(fd,8)); break; case 0x3023: mapif->parse_PartyChangeOption(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOW(fd,10), RFIFOW(fd,12)); break; case 0x3024: mapif->parse_PartyLeave(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)); break; case 0x3025: mapif->parse_PartyChangeMap(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOW(fd,14), RFIFOB(fd,16), RFIFOW(fd,17)); break; case 0x3026: mapif->parse_BreakParty(fd, RFIFOL(fd,2)); break; - case 0x3027: mapif->parse_PartyMessage(fd, RFIFOL(fd,4), RFIFOL(fd,8), (char*)RFIFOP(fd,12), RFIFOW(fd,2)-12); break; + case 0x3027: mapif->parse_PartyMessage(fd, RFIFOL(fd,4), RFIFOL(fd,8), RFIFOP(fd,12), RFIFOW(fd,2)-12); break; case 0x3029: mapif->parse_PartyLeaderChange(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)); break; default: return 0; diff --git a/src/char/int_pet.c b/src/char/int_pet.c index 676ce6ed6..eb9bda8d0 100644 --- a/src/char/int_pet.c +++ b/src/char/int_pet.c @@ -311,7 +311,7 @@ int mapif_parse_CreatePet(int fd) { RFIFOHEAD(fd); mapif->create_pet(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOW(fd, 10), RFIFOW(fd, 12), RFIFOW(fd, 14), RFIFOW(fd, 16), RFIFOW(fd, 18), - RFIFOW(fd, 20), RFIFOB(fd, 22), RFIFOB(fd, 23), (char*)RFIFOP(fd, 24)); + RFIFOW(fd, 20), RFIFOB(fd, 22), RFIFOB(fd, 23), RFIFOP(fd, 24)); return 0; } @@ -325,7 +325,7 @@ int mapif_parse_LoadPet(int fd) int mapif_parse_SavePet(int fd) { RFIFOHEAD(fd); - mapif->save_pet(fd, RFIFOL(fd, 4), (struct s_pet *) RFIFOP(fd, 8)); + mapif->save_pet(fd, RFIFOL(fd, 4), RFIFOP(fd, 8)); return 0; } diff --git a/src/char/int_quest.c b/src/char/int_quest.c index 9478b532d..b28c81331 100644 --- a/src/char/int_quest.c +++ b/src/char/int_quest.c @@ -223,7 +223,7 @@ int mapif_parse_quest_save(int fd) bool success = true; if (new_n > 0) - new_qd = (struct quest*)RFIFOP(fd,8); + new_qd = RFIFOP(fd,8); old_qd = mapif->quests_fromsql(char_id, &old_n); diff --git a/src/char/int_storage.c b/src/char/int_storage.c index e98f538a2..b41e6382d 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -247,7 +247,7 @@ int mapif_parse_SaveGuildStorage(int fd) } else if(SQL->NumRows(inter->sql_handle) > 0) { // guild exists SQL->FreeResult(inter->sql_handle); - inter_storage->guild_storage_tosql(guild_id, (struct guild_storage*)RFIFOP(fd,12)); + inter_storage->guild_storage_tosql(guild_id, RFIFOP(fd,12)); mapif->save_guild_storage_ack(fd, RFIFOL(fd,4), guild_id, 0); return 0; } diff --git a/src/char/inter.c b/src/char/inter.c index 8dec21a77..1e122ec08 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -446,7 +446,7 @@ void mapif_parse_accinfo(int fd) int account_id; char *data; - safestrncpy(query, (char*) RFIFOP(fd,14), NAME_LENGTH); + safestrncpy(query, RFIFOP(fd,14), NAME_LENGTH); SQL->EscapeString(inter->sql_handle, query_esq, query); @@ -1101,7 +1101,7 @@ int mapif_parse_WisRequest(int fd) return 0; } - safestrncpy(name, (char*)RFIFOP(fd,28), NAME_LENGTH); //Received name may be too large and not contain \0! [Skotlex] + safestrncpy(name, RFIFOP(fd,28), NAME_LENGTH); //Received name may be too large and not contain \0! [Skotlex] SQL->EscapeStringLen(inter->sql_handle, esc_name, name, strnlen(name, NAME_LENGTH)); if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `name` FROM `%s` WHERE `name`='%s'", char_db, esc_name) ) @@ -1119,8 +1119,7 @@ int mapif_parse_WisRequest(int fd) memset(name, 0, NAME_LENGTH); memcpy(name, data, min(len, NAME_LENGTH)); // if source is destination, don't ask other servers. - if( strncmp((const char*)RFIFOP(fd,4), name, NAME_LENGTH) == 0 ) - { + if (strncmp(RFIFOP(fd,4), name, NAME_LENGTH) == 0) { mapif->wis_response(fd, RFIFOP(fd, 4), 1); } else @@ -1195,7 +1194,7 @@ int mapif_parse_Registry(int fd) for(i = 0; i < count; i++) { unsigned int index; int len = RFIFOB(fd, cursor); - safestrncpy(key, (char*)RFIFOP(fd, cursor + 1), min((int)sizeof(key), len)); + safestrncpy(key, RFIFOP(fd, cursor + 1), min((int)sizeof(key), len)); cursor += len + 1; index = RFIFOL(fd, cursor); @@ -1213,7 +1212,7 @@ int mapif_parse_Registry(int fd) /* str */ case 2: len = RFIFOB(fd, cursor); - safestrncpy(sval, (char*)RFIFOP(fd, cursor + 1), min((int)sizeof(sval), len)); + safestrncpy(sval, RFIFOP(fd, cursor + 1), min((int)sizeof(sval), len)); cursor += len + 1; inter->savereg(account_id,char_id,key,index,(intptr_t)sval,true); break; @@ -1267,7 +1266,7 @@ int mapif_parse_NameChangeRequest(int fd) account_id = RFIFOL(fd,2); char_id = RFIFOL(fd,6); type = RFIFOB(fd,10); - name = (char*)RFIFOP(fd,11); + name = RFIFOP(fd,11); // Check Authorized letters/symbols in the name if (char_name_option == 1) { // only letters/symbols in char_name_letters are authorized diff --git a/src/char/pincode.c b/src/char/pincode.c index 371442fac..83509576a 100644 --- a/src/char/pincode.c +++ b/src/char/pincode.c @@ -67,7 +67,7 @@ void pincode_check(int fd, struct char_session_data* sd) { char pin[5] = "\0\0\0\0"; nullpo_retv(sd); - safestrncpy(pin, (char*)RFIFOP(fd, 6), sizeof(pin)); + safestrncpy(pin, RFIFOP(fd, 6), sizeof(pin)); pincode->decrypt(sd->pincode_seed, pin); if( pincode->compare( fd, sd, pin ) ){ struct online_char_data* character; @@ -96,12 +96,12 @@ void pincode_change(int fd, struct char_session_data* sd) { char oldpin[5] = "\0\0\0\0", newpin[5] = "\0\0\0\0"; nullpo_retv(sd); - safestrncpy(oldpin, (char*)RFIFOP(fd,6), sizeof(oldpin)); + safestrncpy(oldpin, RFIFOP(fd,6), sizeof(oldpin)); pincode->decrypt(sd->pincode_seed,oldpin); if( !pincode->compare( fd, sd, oldpin ) ) return; - safestrncpy(newpin, (char*)RFIFOP(fd,10), sizeof(newpin)); + safestrncpy(newpin, RFIFOP(fd,10), sizeof(newpin)); pincode->decrypt(sd->pincode_seed,newpin); pincode->update( sd->account_id, newpin ); safestrncpy(sd->pincode, newpin, sizeof(sd->pincode)); @@ -112,7 +112,7 @@ void pincode_setnew(int fd, struct char_session_data* sd) { char newpin[5] = "\0\0\0\0"; nullpo_retv(sd); - safestrncpy(newpin, (char*)RFIFOP(fd,6), sizeof(newpin)); + safestrncpy(newpin, RFIFOP(fd,6), sizeof(newpin)); pincode->decrypt(sd->pincode_seed,newpin); pincode->update( sd->account_id, newpin ); safestrncpy(sd->pincode, newpin, sizeof(sd->pincode)); |