diff --git a/CONTRIBUTORS b/CONTRIBUTORS index b0991c44..301e1b1c 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2513,6 +2513,7 @@ Johan Schuring Sundararaj Reel for reporting a missing reset of maxNumber in cChannels::Renumber() for reporting some missing 'const' in tChannelID + for suggesting to add optional case insensitive sorting to cStringList::Sort() Ales Jurik for reporting broken SI data on Czech/Slovak channels after changing the default diff --git a/HISTORY b/HISTORY index 7dba3020..117f2a2b 100644 --- a/HISTORY +++ b/HISTORY @@ -6674,3 +6674,5 @@ Video Disk Recorder Revision History that broadcast the frame type within the first TS packet of a payload; it only kicks in if that information is not in the first TS packet. - Fixed handling the channelID in cMenuEditChanItem (thanks to Udo Richter). +- cStringList::Sort() can now be called with a boolean parameter that controls + case insensitive sorting (suggested by Sundararaj Reel). diff --git a/tools.h b/tools.h index f17c5642..c593c7f8 100644 --- a/tools.h +++ b/tools.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.h 2.7 2011/02/25 15:05:58 kls Exp $ + * $Id: tools.h 2.8 2011/08/12 14:04:00 kls Exp $ */ #ifndef __TOOLS_H @@ -506,12 +506,23 @@ inline int CompareStrings(const void *a, const void *b) return strcmp(*(const char **)a, *(const char **)b); } +inline int CompareStringsIgnoreCase(const void *a, const void *b) +{ + return strcasecmp(*(const char **)a, *(const char **)b); +} + class cStringList : public cVector { public: cStringList(int Allocated = 10): cVector(Allocated) {} virtual ~cStringList(); int Find(const char *s) const; - void Sort(void) { cVector::Sort(CompareStrings); } + void Sort(bool IgnoreCase = false) + { + if (IgnoreCase) + cVector::Sort(CompareStringsIgnoreCase); + else + cVector::Sort(CompareStrings); + } virtual void Clear(void); };