Skip to content

Commit

Permalink
fixed alerts on lgtm
Browse files Browse the repository at this point in the history
  • Loading branch information
wargio committed Jul 26, 2019
1 parent 51f40b0 commit eae9418
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion libdec/arch/arm.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
return assign_stack;
}

signed = signed || false;
//signed = signed || false;
var e = instr.parsed.opd;
var mem, arg;
if (e[0] == 'lr') {
Expand Down
4 changes: 1 addition & 3 deletions libdec/arch/dalvik.js
Original file line number Diff line number Diff line change
Expand Up @@ -973,11 +973,9 @@
parse: function(assembly) {
const regex = /^([\w-]+)(\/?(from|high|range|jumbo|2addr|lit\d+)?(\d+)?(\s.+$)$)?(\s.+$)?$/;
var token = assembly.trim().replace(/^\+/, '').match(regex);
var operands;
var bits = 32;
var operands, bits, mnem;
var cast = false;
var args = [];
var mnem = 'illegal';
mnem = token[1] || token[0];
cast = token[3] ? true : false;
bits = token[4] ? parseInt(token[4]) : 32;
Expand Down
2 changes: 1 addition & 1 deletion libdec/arch/mips.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@
'sltu': function(instr) {
var e = instr.parsed;
if (e.opd[2] == 'zero') {
e.opd[2] == '0';
e.opd[2] = '0';
}
var arg0 = Variable.local(e.opd[1], 32);
var arg1 = Variable.local(e.opd[2], 32);
Expand Down
2 changes: 1 addition & 1 deletion libdec/arch/ppc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1859,7 +1859,7 @@
postanalisys: function(instructions, context) {
/* simplifies any load address 32/64 bit */
for (var i = 0; i < instructions.length; i++) {
i = _load_address_32_64(i, instructions, context);
i = _load_address_32_64(i, instructions);
}
},
localvars: function(context) {
Expand Down
2 changes: 1 addition & 1 deletion libdec/arch/wasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
lt: _conditional,
le: _conditional,
const: function(instr, context, instructions) {
var s = new StackVar('const ' + _type(instr), instr);
var s = StackVar('const ' + _type(instr), instr);
context.stack.push(s);
var num = parseInt(instr.parsed.opd[0]);
if (num > 1023) {
Expand Down
6 changes: 2 additions & 4 deletions libdec/arch/x86.js
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@
};

var _call_function = function(instr, context, instrs, is_pointer, cannot_return) {
var start = instrs.indexOf(instr);
var call, start = instrs.indexOf(instr);
var i, j;
// indicates the function call return type (if used)
var returnval = undefined;
Expand Down Expand Up @@ -945,7 +945,7 @@
callname = Variable.functionPointer(callname, 0, args);
}

var call = Base.call(callname, args);
call = Base.call(callname, args);

if (tailcall) {
// ControlFlow does not interpret well the specific case of a tail jmp through
Expand Down Expand Up @@ -1550,8 +1550,6 @@
var opd1 = instrs[i].parsed.opd[0];

if (mnem === 'push') {
mnem = 'nop';

var value = instrs[i].string ?
Variable.string(instrs[i].string) :
opd1.token;
Expand Down
2 changes: 1 addition & 1 deletion libdec/core/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@
return new _generic_method_call(object_this, function_name, function_arguments, method_separator, prefix, postfix);
},
objc_call: function(object_this, function_name, function_arguments) {
return new _generic_objc_call(object_this, function_name, function_arguments, null);
return new _generic_objc_call(object_this, function_name, function_arguments);
},
/* Object based langs */
assign_to_object_field: function(destination, object, method_separator, field) {
Expand Down
1 change: 0 additions & 1 deletion libdec/core/instruction.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
}
if (Global.evars.honor.offsets) {
t = Global.printer.theme;
b = Global.printer.auto;
addr = Extra.align_address(instr.location);
if (instr.code && instr.code.composed) {
Global.context.printLine(Global.context.identfy(addr.length, t.integers(addr)) + instr.code.composed[0] + ';', instr.location);
Expand Down
2 changes: 1 addition & 1 deletion libdec/db/c_calls.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
this.data.push(' ((n & 0x00ff0000) >> 8) | \\');
this.data.push(' ((n & 0xff000000) >> 24)))');
} else {
bits = 64;
this.bits = 64;
this.data.push('#define SWAP64(val) ((uint64_t) (((val & 0x00000000000000ffull) << 56) | \\');
this.data.push(' ((val & 0x000000000000ff00ull) << 40) | \\');
this.data.push(' ((val & 0x0000000000ff0000ull) << 24) | \\');
Expand Down
2 changes: 1 addition & 1 deletion libdec/printer.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@
var _apply_regex = function(input, type, regex) {
var x = input.split(regex);
var p = input.match(regex);
var s = '';
if (!p) {
return s;
}
var s = '';
var i = 0;
for (i = 0; i < p.length; i++) {
if (p[i].length > 0) {
Expand Down
2 changes: 1 addition & 1 deletion r2dec-duk.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function decompile_offset(architecture, fcnname) {
* r2dec main function.
* @param {Array} args - r2dec arguments to be used to configure the output.
*/
function r2dec_main(args) {
function r2dec_main(args) { // lgtm [js/unused-local-variable]
var Printer = require('libdec/printer');
var lines = null;
var errors = [];
Expand Down
2 changes: 1 addition & 1 deletion r2dec-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const r2cmd = null;
* r2dec main function.
* @param {String} filename - Issue filename to analyze (relative/fullpath)
*/
function r2dec_main(filename) {
function r2dec_main(filename) { // lgtm [js/unused-local-variable]
try {
// imports
var Printer = require('libdec/printer');
Expand Down

0 comments on commit eae9418

Please sign in to comment.