Merge pull request #3769 from akallabeth/queue_fix
libwinpr-utils: fix 3 logic errors
This commit is contained in:
commit
a1d87fee97
@ -86,9 +86,10 @@ BOOL MessageQueue_Dispatch(wMessageQueue* queue, wMessage* message)
|
||||
goto out;
|
||||
queue->array = new_arr;
|
||||
queue->capacity = new_capacity;
|
||||
ZeroMemory(&(queue->array[old_capacity]), old_capacity * sizeof(wMessage));
|
||||
ZeroMemory(&(queue->array[old_capacity]), (new_capacity - old_capacity) * sizeof(wMessage));
|
||||
|
||||
if (queue->tail < old_capacity)
|
||||
/* rearrange wrapped entries */
|
||||
if (queue->tail <= queue->head)
|
||||
{
|
||||
CopyMemory(&(queue->array[old_capacity]), queue->array, queue->tail * sizeof(wMessage));
|
||||
queue->tail += old_capacity;
|
||||
|
@ -164,9 +164,10 @@ BOOL Queue_Enqueue(wQueue* queue, void* obj)
|
||||
|
||||
queue->capacity = new_capacity;
|
||||
queue->array = newArray;
|
||||
ZeroMemory(&(queue->array[old_capacity]), old_capacity * sizeof(void*));
|
||||
ZeroMemory(&(queue->array[old_capacity]), (new_capacity - old_capacity) * sizeof(void*));
|
||||
|
||||
if (queue->tail < old_capacity)
|
||||
/* rearrange wrapped entries */
|
||||
if (queue->tail <= queue->head)
|
||||
{
|
||||
CopyMemory(&(queue->array[old_capacity]), queue->array, queue->tail * sizeof(void*));
|
||||
queue->tail += old_capacity;
|
||||
|
Loading…
Reference in New Issue
Block a user