浏览代码

Merge pull request #4565 from james4k/bytes-alloc-cpp

[cpp] haxe.io.Bytes.alloc use exact size
Hugh Sanderson 10 年之前
父节点
当前提交
29c44b44dd
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      std/haxe/io/Bytes.hx

+ 1 - 1
std/haxe/io/Bytes.hx

@@ -463,7 +463,7 @@ class Bytes {
 		return new Bytes(length, BytesData.alloc(length));
 		#elseif cpp
 		var a = new BytesData();
-		if (length>0) a[length-1] = untyped 0;
+		if (length>0) cpp.NativeArray.setSize(a, length);
 		return new Bytes(length, a);
 		#elseif cs
 		return new Bytes(length, new cs.NativeArray(length));