summaryrefslogtreecommitdiff
path: root/src/char/inter.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/inter.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/inter.c')
-rw-r--r--src/char/inter.c13
1 files changed, 6 insertions, 7 deletions
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