Nicolas Cannasse 17 rokov pred
rodič
commit
1d4215f632
2 zmenil súbory, kde vykonal 12 pridanie a 1 odobranie
  1. 10 0
      std/haxe/io/Bytes.hx
  2. 2 1
      std/haxe/io/BytesBuffer.hx

+ 10 - 0
std/haxe/io/Bytes.hx

@@ -222,4 +222,14 @@ class Bytes {
 		#end
 	}
 
+	public static function ofData( b : BytesData ) {
+		#if flash9
+		return new Bytes(b.length,b);
+		#elseif neko
+		return new Bytes(untyped __dollar__ssize(b),b);
+		#else
+		return new Bytes(b.length,b);
+		#end
+	}
+
 }

+ 2 - 1
std/haxe/io/BytesBuffer.hx

@@ -92,7 +92,8 @@ class BytesBuffer {
 		var str = StringBuf.__string(b);
 		var bytes =  new Bytes(__dollar__ssize(str),str);
 		#elseif flash9
-		var bytes = new Bytes(b.position,b);
+		var bytes = new Bytes(b.length,b);
+		b.position = 0;
 		#else
 		var bytes = new Bytes(b.length,b);
 		#end