summaryrefslogtreecommitdiff
path: root/src/lib/rrdFile.js
diff options
context:
space:
mode:
authorIgor Sfiligoi <isfiligoi@ucsd.edu>2013-11-01 19:43:56 +0000
committerIgor Sfiligoi <isfiligoi@ucsd.edu>2013-11-01 19:43:56 +0000
commitefd809ebc45ef23c06a02f53217241567f02d544 (patch)
tree919074eb0b82fe31bd2482f567aa5d4e6e59c84f /src/lib/rrdFile.js
parentf0a32ea520eff26cdabf6f9ff09c591d514a559b (diff)
Add support for other endian
Diffstat (limited to 'src/lib/rrdFile.js')
-rw-r--r--src/lib/rrdFile.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/rrdFile.js b/src/lib/rrdFile.js
index 81f7731..35a892b 100644
--- a/src/lib/rrdFile.js
+++ b/src/lib/rrdFile.js
@@ -217,6 +217,10 @@ RRDHeader.prototype.validate_rrd = function() {
if (this.rrd_data.getLongAt(12)==0) {
// not a double here... likely 64 bit
this.float_align=8;
+ if (! (this.rrd_data.getDoubleAt(16)==8.642135e+130)) {
+ // uhm... wrong endian?
+ this.rrd_data.switch_endian=true;
+ }
if (this.rrd_data.getDoubleAt(16)==8.642135e+130) {
// now, is it all 64bit or only float 64 bit?
if (this.rrd_data.getLongAt(28)==0) {
@@ -233,6 +237,10 @@ RRDHeader.prototype.validate_rrd = function() {
}
} else {
/// should be 32 bit alignment
+ if (! (this.rrd_data.getDoubleAt(12)==8.642135e+130)) {
+ // uhm... wrong endian?
+ this.rrd_data.switch_endian=true;
+ }
if (this.rrd_data.getDoubleAt(12)==8.642135e+130) {
this.float_align=4;
this.int_align=4;