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/pincode.c | |
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/pincode.c')
-rw-r--r-- | src/char/pincode.c | 8 |
1 files changed, 4 insertions, 4 deletions
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)); |