Author: cwittich Date: Wed Jan 23 20:14:08 2008 New Revision: 31961
URL: http://svn.reactos.org/svn/reactos?rev=31961&view=rev Log: improve the genlist code a bit further
Modified: trunk/reactos/base/setup/usetup/genlist.c
Modified: trunk/reactos/base/setup/usetup/genlist.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/genlist.c... ============================================================================== --- trunk/reactos/base/setup/usetup/genlist.c (original) +++ trunk/reactos/base/setup/usetup/genlist.c Wed Jan 23 20:14:08 2008 @@ -21,6 +21,7 @@ * FILE: subsys/system/usetup/genlist.c * PURPOSE: Generic list functions * PROGRAMMER: Eric Kohl + * Christoph von Wittich <christoph at reactos.org> */
/* INCLUDES *****************************************************************/ @@ -318,17 +319,30 @@ PGENERIC_LIST_ENTRY ListEntry; PLIST_ENTRY Entry;
- Entry = GenericList->ListHead.Flink; + Entry = &GenericList->CurrentEntry->Entry; + ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); + +Reset: + + if (tolower(ListEntry->Text[0]) != AsciChar) + Entry = GenericList->ListHead.Flink; + while (Entry != &GenericList->ListHead) { ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); - if (strlen(ListEntry->Text) > 0) + if ((strlen(ListEntry->Text) > 0) && (tolower(ListEntry->Text[0]) == AsciChar)) { - if (tolower(ListEntry->Text[0]) == AsciChar) + if (CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry) == GenericList->CurrentEntry) { - GenericList->CurrentEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); - break; + Entry = Entry->Flink; + if (Entry == &GenericList->ListHead) + goto Reset; + ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); + if ((strlen(ListEntry->Text) < 1) || (tolower(ListEntry->Text[0]) != AsciChar)) + goto Reset; } + GenericList->CurrentEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); + break; } Entry = Entry->Flink; }