Skip to content

Commit

Permalink
Fix radareorg#7495 - Avoid always-false conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed May 15, 2017
1 parent edba3d1 commit f5948a9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
30 changes: 15 additions & 15 deletions libr/anal/p/anal_h8300.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ static int analop_esil(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf) {
return 0;
case H8300_ADDS:
r_strbuf_appendf (&op->esil, "%d,r%u,+=",
((buf[1] & 0xf0) == 0x08) ? 2 : 1, rd());
((buf[1] & 0xf0) == 0x80) ? 2 : 1, rd());
return 0;
case H8300_MOV_1:
/*TODO check if flags are set internally or not*/
Expand Down Expand Up @@ -305,23 +305,23 @@ static int analop_esil(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf) {
r_strbuf_appendf(&op->esil, "r%u%c,r%u%c,-=", rsB(), rdB(1));
//setZ
setHb_B;
setV("%o") ;
setCb_B ;
setV("%o");
setCb_B;
setN;
maskB(1);
setZ;
return 0;
case H8300_SUBW:
r_strbuf_appendf(&op->esil, "r%u,r%u,-=", rs(), rd());
r_strbuf_appendf (&op->esil, "r%u,r%u,-=", rs(), rd());
setHb_W;
setV("%o") ;
setCb_W ;
setV ("%o");
setCb_W;
setN;
mask();
setZ;
return 0;
case H8300_DEC:
r_strbuf_appendf(&op->esil, "1,r%u%c,-=", rdB(1));
r_strbuf_appendf (&op->esil, "1,r%u%c,-=", rdB(1));
//setZ
setV("%o");
setN;
Expand All @@ -330,13 +330,13 @@ static int analop_esil(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf) {
return 0;
case H8300_SUBS:
r_strbuf_appendf(&op->esil, "%d,r%u,-=",
( (buf[1] & 0xf0) == 0x08) ? 2 : 1, rd());
( (buf[1] & 0xf0) == 0x80) ? 2 : 1, rd());
return 0;
case H8300_CMP_1:
r_strbuf_appendf(&op->esil, "r%u%c,r%u%c,-", rsB(), rdB(1));
//setZ
setHb_B;
setV("%o") ;
setV("%o");
setCb_B;
setN;
maskB(1);
Expand All @@ -345,21 +345,21 @@ static int analop_esil(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf) {
case H8300_CMP_2:
r_strbuf_appendf(&op->esil, "r%u,r%u,-", rs(), rd());
//setZ
setHb_W ;
setHb_W;
setV("%o");
setCb_W ;
setCb_W;
setN;
mask();
setZ;
return 0;
case H8300_SUBX:
//Rd – (Rs) – C → Rd
r_strbuf_appendf(&op->esil, "r%u%c,r%u%c,-=,C,r%u%c,-=",
rsB(), rdB(1), rdB(1));
rsB(), rdB(1), rdB(1));
//setZ
setHb_B ;
setV("%o") ;
setCb_B ;
setHb_B;
setV("%o");
setCb_B;
setN;
maskB(1);
setZ;
Expand Down
2 changes: 1 addition & 1 deletion libr/anal/p/anal_mips_gnu.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ static int mips_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *b, int len) {
break;
}
//family = 'J';
} else if ((optype & 0x10) == 0x1c) {
} else if ((optype & 0x1c) == 0x1c) {
/*
C-TYPE
======
Expand Down
11 changes: 8 additions & 3 deletions sys/translate.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#!/bin/sh
if [ -z "$1" ]; then
echo "Usage: sys/translate.sh [--list,--reset] [lang|path]"
echo "Usage:"
echo " sys/translate.sh [--options] [lang|path]"
echo "Options:"
echo " --list list all supported languages"
echo " --update update from radare2-translations git"
echo " --reset restore default strings"
echo "Languages:"
echo "- english"
echo " - english"
if [ -d "sys/lang" ]; then
cd sys/lang && ls | xargs echo -
cd sys/lang && ls | xargs echo ' -'
else
echo "Run --update for more languages"
fi
Expand Down

0 comments on commit f5948a9

Please sign in to comment.