Fix ByteArray resizing for js target

Originally, I encountered this problem with I was playing with luxeengine - https://github.com/underscorediscovery/snow/pull/68
Since ByteArray in show was based on ByteArray from lime, I checked lime's version, and found the same bug.
I don't know exact lime roadmap (will lime still use it own implementation of ByteArray or will use typedarrays like snow), but maybe this pull-request will be useful.
This commit is contained in:
Viachaslau Tratsiak
2015-03-04 15:02:09 +03:00
parent f52de39fb1
commit 7926f05581

View File

@@ -1131,7 +1131,7 @@ class ByteArray #if !js extends Bytes implements ArrayAccess<Int> implements IDa
#if js
if (allocated < value)
___resizeBuffer (allocated = Std.int (Math.max (value, allocated * 2)));
else if (allocated > value)
else if (allocated > value * 2)
___resizeBuffer (allocated = value);
length = value;
#end
@@ -1160,4 +1160,4 @@ class ByteArray #if !js extends Bytes implements ArrayAccess<Int> implements IDa
#else
typedef ByteArray = flash.utils.ByteArray;
#end
#end