From 975ae6706b4ac868425193cf25bcbbb268051b5d Mon Sep 17 00:00:00 2001 From: Sunil Shetye Date: Wed, 18 Jul 2018 16:28:24 +0530 Subject: handle empty array in comparison --- js/Sources/CONST_m.js | 2 +- js/Sources/CURVE_c.js | 4 ++-- js/Sources/PULSE_SC.js | 2 +- js/Sources/READC_f.js | 4 ++-- js/Sources/RFILE_f.js | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'js/Sources') diff --git a/js/Sources/CONST_m.js b/js/Sources/CONST_m.js index f0dc3885..7cc3cd7f 100644 --- a/js/Sources/CONST_m.js +++ b/js/Sources/CONST_m.js @@ -32,7 +32,7 @@ function CONST_m() { break; } var nout = size(this.C); - if (find(nout==0)!=[]) { + if (find(nout==0).length!=0) { block_parameter_error(msprintf("Wrong size for \'%s\' parameter","Constant Value"),"Constant value must have at least one element."); } else { this.model.sim = list(new ScilabString(["cstblk4_m"]), new ScilabDouble([4])); diff --git a/js/Sources/CURVE_c.js b/js/Sources/CURVE_c.js index 77f72cc0..46004f4e 100644 --- a/js/Sources/CURVE_c.js +++ b/js/Sources/CURVE_c.js @@ -88,7 +88,7 @@ function CURVE_c() { if (this.graf=="y"||this.graf=="Y") { var ipar = [[N],[mtd],[PO]]; var rpar = []; - if ((winsid()==[])) { + if ((winsid().length==0)) { this.curwin = 0; } else { this.curwin = max(winsid())+1; @@ -148,7 +148,7 @@ function CURVE_c() { } if ((SaveExit)) { var xp = find(orpar.slice(1-1,oipar[1-1])>=0); - if ((xp!=[])) { + if ((xp.length!=0)) { this.model.firing = new ScilabDouble([orpar[xp[1-1]-1]]); } else { this.model.firing = new ScilabDouble([-1]); diff --git a/js/Sources/PULSE_SC.js b/js/Sources/PULSE_SC.js index 8a70dd1a..e6976819 100644 --- a/js/Sources/PULSE_SC.js +++ b/js/Sources/PULSE_SC.js @@ -88,7 +88,7 @@ function PULSE_SC() { break; } } else { - if ((lasterror()!=[])) { + if ((lasterror().length!=0)) { messagebox(lasterror()); } var ok = false; diff --git a/js/Sources/READC_f.js b/js/Sources/READC_f.js index a73d42f7..1c079a7f 100644 --- a/js/Sources/READC_f.js +++ b/js/Sources/READC_f.js @@ -87,7 +87,7 @@ function READC_f() { block_parameter_error(msprintf("Wrong value for \'%s\' parameter.","Input File Name"),"You must provide a file name."); } else if (this.M<1) { block_parameter_error(msprintf("Wrong value for \'%s\' parameter: %d.","Record Size",this.M),"Strictly positive integer expected."); - } else if (this.tmask1!=[]&&(this.tmask1<1||this.tmask1>this.M)) { + } else if (this.tmask1.length!=0&&(this.tmask1<1||this.tmask1>this.M)) { block_parameter_error(msprintf("Wrong value for \'%s\' parameter: %d.","Time Record Selection",this.tmask1),msprintf("Must be in the interval %s.","[1, Record Size = "+string(this.M)+"]")); } else if (nout==0) { block_parameter_error(msprintf("Wrong value for \'%s\' parameter: %d.","Outputs Record Selection",nout),"Strictly positive integer expected."); @@ -102,7 +102,7 @@ function READC_f() { } else if (this.offset<1) { block_parameter_error(msprintf("Wrong value for \'%s\' parameter: %d.","Initial Record Index",this.offset),"Strictly positive integer expected."); } else { - if (this.tmask1==[]) { + if (this.tmask1.length==0) { var ievt = 0; this.tmask1 = 0; var outpt = []; diff --git a/js/Sources/RFILE_f.js b/js/Sources/RFILE_f.js index 8c3ce1b7..d0e2060a 100644 --- a/js/Sources/RFILE_f.js +++ b/js/Sources/RFILE_f.js @@ -67,7 +67,7 @@ function RFILE_f() { var nout = size(this.outmask,"*"); if (prod(size(this.tmask1))>1) { block_parameter_error(msprintf("Wrong value for \'%s\' parameter: %s.","Time Record Selection",strcat(string(this.tmask1.slice())," ")),"Empty matrix or scalar expected."); - } else if (this.tmask1!=[]&&this.tmask1<1) { + } else if (this.tmask1.length!=0&&this.tmask1<1) { block_parameter_error(msprintf("Wrong value for \'%s\' parameter: %d","Time Record Selection",this.tmask1),"Strictly positive integer expected."); } else if (lunit>0&&min(length(frmt),1)!=min(length(this.frmt1),1)) { block_parameter_error(["Simulation running !!! You cannot switch
between formatted and unformatted"],"End current simulation first."); @@ -86,7 +86,7 @@ function RFILE_f() { } else if (min(this.outmask)<1) { block_parameter_error(msprintf("Wrong value for \'%s\' parameter: %s","Outputs Record Selection",strcat(string(this.outmask.slice())," ")),"Strictly positive indexes expected."); } else { - if (this.tmask1==[]) { + if (this.tmask1.length==0) { var ievt = 0; var cout = []; this.tmask1 = 0; -- cgit