瀏覽代碼

[c] Fixed memcpy bugs, closes #771

badlogic 9 年之前
父節點
當前提交
a0484cc63d
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      spine-c/src/spine/AnimationState.c

+ 2 - 2
spine-c/src/spine/AnimationState.c

@@ -75,7 +75,7 @@ void _spEventQueue_ensureCapacity (_spEventQueue* self, int newElements) {
 		_spEventQueueItem* newObjects;
 		self->objectsCapacity <<= 1;
 		newObjects = CALLOC(_spEventQueueItem, self->objectsCapacity);
-		memcpy(newObjects, self->objects, self->objectsCount);
+		memcpy(newObjects, self->objects, sizeof(_spEventQueueItem) * self->objectsCount);
 		FREE(self->objects);
 		self->objects = newObjects;
 	}
@@ -768,7 +768,7 @@ void _spAnimationState_ensureCapacityPropertyIDs(spAnimationState* self, int cap
 	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
 	if (internal->propertyIDsCapacity < capacity) {
 		int *newPropertyIDs = CALLOC(int, capacity << 1);
-		memcpy(newPropertyIDs, internal->propertyIDs, internal->propertyIDsCount);
+		memcpy(newPropertyIDs, internal->propertyIDs, sizeof(int) * internal->propertyIDsCount);
 		FREE(internal->propertyIDs);
 		internal->propertyIDs = newPropertyIDs;
 		internal->propertyIDsCapacity = capacity << 1;