Browse Source

fixed Bytes.fastGet in JS (close #4032)

Nicolas Cannasse 10 years ago
parent
commit
f011fa3b37
2 changed files with 6 additions and 1 deletions
  1. 4 1
      std/js/_std/haxe/io/Bytes.hx
  2. 2 0
      tests/unit/src/unitstd/haxe/crypto/Crc32.hx

+ 4 - 1
std/js/_std/haxe/io/Bytes.hx

@@ -33,7 +33,10 @@ class Bytes {
 	function new(b:BytesData) {
 		this.length = b.byteLength;
 		this.b = new js.html.Uint8Array(b);
-		untyped b.hxBytes = this;
+		untyped {
+			b.hxBytes = this;
+			b.bytes = b;
+		}
 	}
 
 	public inline function get( pos : Int ) : Int {

+ 2 - 0
tests/unit/src/unitstd/haxe/crypto/Crc32.hx

@@ -0,0 +1,2 @@
+haxe.crypto.Crc32.make(haxe.io.Bytes.fromString("")) == 0;
+haxe.crypto.Crc32.make(haxe.io.Bytes.fromString("The quick brown fox jumps over the lazy dog")) == 0x414FA339;