summaryrefslogtreecommitdiff
path: root/src/char/char.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-01-07 16:47:24 +0100
committerHaru <haru@dotalux.com>2016-02-24 21:00:26 +0100
commit3188738be5ee78651e31c1340fac7fed81bbefb5 (patch)
tree97ea854a3c77884e817c02dc069b980ccc42ee74 /src/char/char.c
parenta79ab6c3d11c7d6fcd1f04400f50b93f72e570e1 (diff)
downloadhercules-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/char.c')
-rw-r--r--src/char/char.c25
1 files changed, 12 insertions, 13 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 ||