summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-09-18 17:33:58 +0200
committerHaru <haru@dotalux.com>2015-09-18 17:33:58 +0200
commit442a306a60d4529f5cae70c0a659b4bc31d2f07b (patch)
tree2f6c73fecfc736be316f43980d495b49dae7917d
parent9e2ae37d45a32a5dfcca2fc77ed61703d31dc468 (diff)
downloadhercules-442a306a60d4529f5cae70c0a659b4bc31d2f07b.tar.gz
hercules-442a306a60d4529f5cae70c0a659b4bc31d2f07b.tar.bz2
hercules-442a306a60d4529f5cae70c0a659b4bc31d2f07b.tar.xz
hercules-442a306a60d4529f5cae70c0a659b4bc31d2f07b.zip
Clarified intent in various side-effect assignments
While this doesn't change anything in the way those assignments work, it clarifies that they're intended to be side-effect assignments and not typos (to both human readers and static analyzers) Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--src/map/atcommand.c2
-rw-r--r--src/map/script.c30
2 files changed, 16 insertions, 16 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index acc9dff9f..f01311235 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -210,7 +210,7 @@ ACMD(send)
// read message type as hex number (without the 0x)
if (!*message
- || !((sscanf(message, "len %x", &type)==1 && (len=1))
+ || !((sscanf(message, "len %x", &type)==1 && (len=1, true))
|| sscanf(message, "%x", &type)==1)
) {
clif->message(fd, msg_fd(fd,900)); // Usage:
diff --git a/src/map/script.c b/src/map/script.c
index dc0edcb01..35142a4f5 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -978,8 +978,8 @@ const char* parse_variable(const char* p)
const char *p2 = NULL;
const char *var = p;
- if( ( p[0] == '+' && p[1] == '+' && (type = C_ADD_PRE) ) // pre ++
- || ( p[0] == '-' && p[1] == '-' && (type = C_SUB_PRE) ) // pre --
+ if( ( p[0] == '+' && p[1] == '+' && (type = C_ADD_PRE, true) ) // pre ++
+ || ( p[0] == '-' && p[1] == '-' && (type = C_SUB_PRE, true) ) // pre --
) {
var = p = script->skip_space(&p[2]);
}
@@ -1008,19 +1008,19 @@ const char* parse_variable(const char* p)
}
if( type == C_NOP &&
- !( ( p[0] == '=' && p[1] != '=' && (type = C_EQ) ) // =
- || ( p[0] == '+' && p[1] == '=' && (type = C_ADD) ) // +=
- || ( p[0] == '-' && p[1] == '=' && (type = C_SUB) ) // -=
- || ( p[0] == '^' && p[1] == '=' && (type = C_XOR) ) // ^=
- || ( p[0] == '|' && p[1] == '=' && (type = C_OR ) ) // |=
- || ( p[0] == '&' && p[1] == '=' && (type = C_AND) ) // &=
- || ( p[0] == '*' && p[1] == '=' && (type = C_MUL) ) // *=
- || ( p[0] == '/' && p[1] == '=' && (type = C_DIV) ) // /=
- || ( p[0] == '%' && p[1] == '=' && (type = C_MOD) ) // %=
- || ( p[0] == '+' && p[1] == '+' && (type = C_ADD_POST) ) // post ++
- || ( p[0] == '-' && p[1] == '-' && (type = C_SUB_POST) ) // post --
- || ( p[0] == '<' && p[1] == '<' && p[2] == '=' && (type = C_L_SHIFT) ) // <<=
- || ( p[0] == '>' && p[1] == '>' && p[2] == '=' && (type = C_R_SHIFT) ) // >>=
+ !( ( p[0] == '=' && p[1] != '=' && (type = C_EQ, true) ) // =
+ || ( p[0] == '+' && p[1] == '=' && (type = C_ADD, true) ) // +=
+ || ( p[0] == '-' && p[1] == '=' && (type = C_SUB, true) ) // -=
+ || ( p[0] == '^' && p[1] == '=' && (type = C_XOR, true) ) // ^=
+ || ( p[0] == '|' && p[1] == '=' && (type = C_OR, true) ) // |=
+ || ( p[0] == '&' && p[1] == '=' && (type = C_AND, true) ) // &=
+ || ( p[0] == '*' && p[1] == '=' && (type = C_MUL, true) ) // *=
+ || ( p[0] == '/' && p[1] == '=' && (type = C_DIV, true) ) // /=
+ || ( p[0] == '%' && p[1] == '=' && (type = C_MOD, true) ) // %=
+ || ( p[0] == '+' && p[1] == '+' && (type = C_ADD_POST, true) ) // post ++
+ || ( p[0] == '-' && p[1] == '-' && (type = C_SUB_POST, true) ) // post --
+ || ( p[0] == '<' && p[1] == '<' && p[2] == '=' && (type = C_L_SHIFT, true) ) // <<=
+ || ( p[0] == '>' && p[1] == '>' && p[2] == '=' && (type = C_R_SHIFT, true) ) // >>=
) )
{// failed to find a matching operator combination so invalid
return NULL;