From 0417e552cf36e28f562c2d16824b8ec3f2520e11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Thu, 17 Oct 2013 17:27:47 -0400 Subject: [PATCH] libwinpr-utils: fix bug in ListDictionary --- channels/drive/client/drive_main.c | 5 ----- winpr/libwinpr/utils/collections/ListDictionary.c | 6 ++++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/channels/drive/client/drive_main.c b/channels/drive/client/drive_main.c index 01e83f341..b54fc4e4a 100644 --- a/channels/drive/client/drive_main.c +++ b/channels/drive/client/drive_main.c @@ -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) { diff --git a/winpr/libwinpr/utils/collections/ListDictionary.c b/winpr/libwinpr/utils/collections/ListDictionary.c index 94f06231e..d1df02125 100644 --- a/winpr/libwinpr/utils/collections/ListDictionary.c +++ b/winpr/libwinpr/utils/collections/ListDictionary.c @@ -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; }