libwinpr-utils: fix bug in ListDictionary

This commit is contained in:
Marc-André Moreau 2013-10-17 17:27:47 -04:00
parent 359c31b360
commit 0417e552cf
2 changed files with 4 additions and 7 deletions

View File

@ -103,8 +103,6 @@ static DRIVE_FILE* drive_get_file_by_id(DRIVE_DEVICE* disk, UINT32 id)
file = (DRIVE_FILE*) ListDictionary_GetItemValue(disk->files, key);
fprintf(stderr, "drive_get_file_by_id: %d / %p\n", id, file);
return file;
}
@ -158,8 +156,6 @@ static void drive_process_irp_create(DRIVE_DEVICE* disk, IRP* irp)
key = (void*) (size_t) file->id;
ListDictionary_Add(disk->files, key, file);
fprintf(stderr, "drive_file_new: %d / %p\n", file->id, file);
switch (CreateDisposition)
{
case FILE_SUPERSEDE:
@ -196,7 +192,6 @@ static void drive_process_irp_close(DRIVE_DEVICE* disk, IRP* irp)
file = drive_get_file_by_id(disk, irp->FileId);
key = (void*) (size_t) irp->FileId;
fprintf(stderr, "drive_process_irp_close: %d / %p / %d\n", irp->FileId, file, file->id);
if (!file)
{

View File

@ -255,11 +255,11 @@ BOOL ListDictionary_Contains(wListDictionary* listDictionary, void* key)
* Removes the entry with the specified key from the ListDictionary.
*/
void *ListDictionary_Remove(wListDictionary* listDictionary, void* key)
void* ListDictionary_Remove(wListDictionary* listDictionary, void* key)
{
void* value = NULL;
wListDictionaryItem* item;
wListDictionaryItem* prevItem;
void *value = NULL;
if (listDictionary->synchronized)
EnterCriticalSection(&listDictionary->lock);
@ -291,6 +291,7 @@ void *ListDictionary_Remove(wListDictionary* listDictionary, void* key)
break;
}
prevItem = item;
item = item->next;
}
}
@ -299,6 +300,7 @@ void *ListDictionary_Remove(wListDictionary* listDictionary, void* key)
if (listDictionary->synchronized)
LeaveCriticalSection(&listDictionary->lock);
return value;
}