aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/js/RrdRpn.js
diff options
context:
space:
mode:
authorPeter Wu2014-07-25 23:28:21 +0200
committerPim van den Berg2014-08-02 12:29:32 +0200
commitb6be82b8edefa452e72ed53391971e53d9dccf83 (patch)
tree01a33ac72f6ef7e6e5c607238bc5e4dd3a8751fe /js/RrdRpn.js
parentsupport php versions without json support and show a warning message (diff)
downloadapt-panopticon_cgp-b6be82b8edefa452e72ed53391971e53d9dccf83.zip
apt-panopticon_cgp-b6be82b8edefa452e72ed53391971e53d9dccf83.tar.gz
apt-panopticon_cgp-b6be82b8edefa452e72ed53391971e53d9dccf83.tar.bz2
apt-panopticon_cgp-b6be82b8edefa452e72ed53391971e53d9dccf83.tar.xz
jsrrdgraph: Fixed jshint warnings/errors
Many fall in the category missing semicolon, but there are legitimate bugs (like throwing an error with an undefined variable, using isInfinite instead of !isFinite or fabs instead of Math.abs). At some places, I moved the variable declarations to avoid duplicate definition warnings. Redundant breaks have been removed (after return / throw). Global variables were implicitly defined in RrdDataFile (which caught my attention) and Base64, these have been made local. Also fixed some whitespace errors. Yay, the consistency. Not all (style) issues are fixed.
Diffstat (limited to 'js/RrdRpn.js')
-rw-r--r--js/RrdRpn.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/js/RrdRpn.js b/js/RrdRpn.js
index cbb5e8f..5ca8daf 100644
--- a/js/RrdRpn.js
+++ b/js/RrdRpn.js
@@ -478,7 +478,7 @@ RrdRpn.prototype.calc = function (data_idx, output, output_idx)
478 break; 478 break;
479 case RrdRpn.OP_ISINF: 479 case RrdRpn.OP_ISINF:
480 if(stptr < 0) throw new RrdRpnError(); 480 if(stptr < 0) throw new RrdRpnError();
481 this.rpnstack[stptr] = isInfinite(this.rpnstack[stptr]) ? 1.0 : 0.0; 481 this.rpnstack[stptr] = !isFinite(this.rpnstack[stptr]) ? 1.0 : 0.0;
482 break; 482 break;
483 case RrdRpn.OP_SQRT: 483 case RrdRpn.OP_SQRT:
484 if(stptr < 0) throw new RrdRpnError(); 484 if(stptr < 0) throw new RrdRpnError();
@@ -603,7 +603,7 @@ RrdRpn.prototype.calc = function (data_idx, output, output_idx)
603 break; 603 break;
604 case RrdRpn.OP_ABS: 604 case RrdRpn.OP_ABS:
605 if(stptr < 0) throw new RrdRpnError(); 605 if(stptr < 0) throw new RrdRpnError();
606 this.rpnstack[stptr] = fabs(this.rpnstack[stptr]); 606 this.rpnstack[stptr] = Math.abs(this.rpnstack[stptr]);
607 break; 607 break;
608 case RrdRpn.OP_END: 608 case RrdRpn.OP_END:
609 break; 609 break;