ecere/com/Containers/Array: Clear fix on resize
authorJerome St-Louis <jerome@ecere.com>
Wed, 9 Dec 2015 22:20:03 +0000 (17:20 -0500)
committerJerome St-Louis <jerome@ecere.com>
Wed, 9 Dec 2015 22:54:50 +0000 (17:54 -0500)
compiler/bootstrap/ecere/bootstrap/Array.c
ecere/src/com/containers/Array.ec

index af3cc85..55af4db 100644 (file)
@@ -558,7 +558,7 @@ if(__ecerePointer___ecereNameSpace__ecere__com__Array->count != value)
 if(value > __ecerePointer___ecereNameSpace__ecere__com__Array->minAllocSize)
 __ecerePointer___ecereNameSpace__ecere__com__Array->array = __ecereNameSpace__ecere__com__eSystem_Renew0(__ecerePointer___ecereNameSpace__ecere__com__Array->array, ((struct __ecereNameSpace__ecere__com__Instance *)(char *)this)->_class->templateArgs[0].__anon1.__anon1.dataTypeClass->typeSize * (value));
 else if(value > __ecerePointer___ecereNameSpace__ecere__com__Array->count)
-memset(((unsigned char *)__ecerePointer___ecereNameSpace__ecere__com__Array->array) + (__ecerePointer___ecereNameSpace__ecere__com__Array->count * ((struct __ecereNameSpace__ecere__com__Instance *)(char *)this)->_class->templateArgs[0].__anon1.__anon1.dataTypeClass->typeSize), 0, (value - __ecerePointer___ecereNameSpace__ecere__com__Array->count) * ((struct __ecereNameSpace__ecere__com__Instance *)(char *)this)->_class->templateArgs[0].__anon1.__anon1.dataTypeClass->typeSize);
+memset((unsigned char *)__ecerePointer___ecereNameSpace__ecere__com__Array->array + __ecerePointer___ecereNameSpace__ecere__com__Array->count * ((struct __ecereNameSpace__ecere__com__Instance *)(char *)this)->_class->templateArgs[0].__anon1.__anon1.dataTypeClass->typeSize, 0, (value - __ecerePointer___ecereNameSpace__ecere__com__Array->count) * ((struct __ecereNameSpace__ecere__com__Instance *)(char *)this)->_class->templateArgs[0].__anon1.__anon1.dataTypeClass->typeSize);
 __ecerePointer___ecereNameSpace__ecere__com__Array->count = value;
 }
 __ecereNameSpace__ecere__com__eInstance_FireSelfWatchers(this, __ecereProp___ecereNameSpace__ecere__com__Array_size), __ecereNameSpace__ecere__com__eInstance_FireSelfWatchers(this, __ecerePropM___ecereNameSpace__ecere__com__Array_size);
index 856aa44..f1f9b63 100644 (file)
@@ -128,7 +128,7 @@ public:
             if(value > minAllocSize)
                array = renew0 array T[value];
             else if(value > count)
-               memset(array + count, 0, (value - count) * class(T).typeSize);
+               memset((byte *)array + count * class(T).typeSize, 0, (value - count) * class(T).typeSize);
             count = value;
          }
       }