Giter VIP home page Giter VIP logo

Comments (8)

vjeux avatar vjeux commented on September 26, 2024

I cannot reproduce the error :( Do you have a test file somewhere?

Here is what I did to reproduce the issue:

==== With the createBuffer facility:

On this page ( http://fooo.fr/~vjeux/github/jsWoWModelViewer/modelviewer.html ) I open up the console and tests:

var file = jDataView.createBuffer(0x7f, 0x80, 0x81, 0xff);
var view = new jDataView(file);
view.getInt8().toString(16);
>> "7f"
view.getInt8().toString(16);
>> "-80"
view.getInt8().toString(16);
>> "-7f"
view.getInt8().toString(16);
>> "-1"

==== With the jQuery Ajax plugin:

I generate a file with some values with Python.
>>> import struct
>>> f = open('test.bin', 'wb')
>>> f.write(struct.pack('B', 0x7f))
>>> f.write(struct.pack('B', 0x80))
>>> f.write(struct.pack('B', 0x81))
>>> f.write(struct.pack('B', 0xff))
>>> f.close()
http://fooo.fr/~vjeux/github/jsWoWModelViewer/test.bin

Then on this page ( http://fooo.fr/~vjeux/github/jsWoWModelViewer/modelviewer.html ) I open up the console and tests:

$.get(
  'test.bin',
  function (data) {
    var view = new jDataView(data);
    console.log(view.getInt8().toString(16)); // 7f
    console.log(view.getInt8().toString(16)); // -80
    console.log(view.getInt8().toString(16)); // -7f
    console.log(view.getInt8().toString(16)); // -1
  },
  'binary'
);

from jdataview.

zonez avatar zonez commented on September 26, 2024

It's strange, the behavior seems to be intermittent, I was able to replicate it using the test procedure from your web page but right now, the error doesn't always happen (while running the same code)... Even though it sometime gives back the right results, here is what I got using webkit nightly builds earlier :

$.get(
'test.bin',
function (data) {
var view = new jDataView(data);
console.log(view.getInt8().toString(16)); // 7f
console.log(view.getInt8().toString(16)); // -80
console.log(view.getInt8().toString(16)); // -7f
console.log(view.getInt8().toString(16)); // -1
},
'binary'
);
XMLHttpRequest
7f
-3
-3
-3

from jdataview.

vjeux avatar vjeux commented on September 26, 2024

This is really weird!

I tried with the latest Windows version of Safari 5.0.4 (7533.20.27) and the latest Windows version of webkit (r82477) and I am unable to reproduce the issue.

Maybe (big maybe) this only happens on 64bits version of Windows? I'm running a 32bit one.

from jdataview.

zonez avatar zonez commented on September 26, 2024

Maybe... I'm on a 64bin win7 and I got the error with latest nightly builts of webkit for sure and maybe on safari.

from jdataview.

vjeux avatar vjeux commented on September 26, 2024

When it bugs, can you try

$.get( 'test.bin', function (data) {
  var view = new jDataView(data);
  console.log('arrayBuffer?', view._isArrayBuffer);
  console.log('dataView?', view._isDataView);
}, 'binary' );

and tell me the results. It will tell me which code is being used (string, arraybuffer or dataview). I will get a better view of the problem.

from jdataview.

zonez avatar zonez commented on September 26, 2024

arrayBuffer? false
dataView? false

from jdataview.

vjeux avatar vjeux commented on September 26, 2024

I have made some updates. Can you retest please?

from jdataview.

zonez avatar zonez commented on September 26, 2024

Ok, I'll be testing that today.

Date: Fri, 8 Apr 2011 03:05:51 -0700
From: [email protected]
To: [email protected]
Subject: Re: [GitHub] Values don't read right in Safari and Webkit under windows [vjeux/jsDataView GH-1]

I have made some updates. Can you retest please?

Reply to this email directly or view it on GitHub:
https://github.com/vjeux/jsDataView/issues/1#comment_973063

from jdataview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.