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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user