From 7926f055811be352381662c83dcff54a6ecee33c Mon Sep 17 00:00:00 2001 From: Viachaslau Tratsiak Date: Wed, 4 Mar 2015 15:02:09 +0300 Subject: [PATCH] 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. --- lime/utils/ByteArray.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lime/utils/ByteArray.hx b/lime/utils/ByteArray.hx index 1b795af2b..1909a34ef 100644 --- a/lime/utils/ByteArray.hx +++ b/lime/utils/ByteArray.hx @@ -1131,7 +1131,7 @@ class ByteArray #if !js extends Bytes implements ArrayAccess 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 implements IDa #else typedef ByteArray = flash.utils.ByteArray; -#end \ No newline at end of file +#end