diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2004-11-01 10:40:38 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2004-11-01 10:40:38 +0100 |
commit | 0b62aff0e3385ed0c11fda145c2a5167bbc1c56d (patch) | |
tree | 6067296e3f76b842a59919c3453a45c83538ad97 /eitscan.c | |
parent | c88e65b6385a9c72778ea46fe4c4c805976c7b96 (diff) | |
download | vdr-0b62aff0e3385ed0c11fda145c2a5167bbc1c56d.tar.gz vdr-0b62aff0e3385ed0c11fda145c2a5167bbc1c56d.tar.bz2 |
Now using qsort() to sort cListBase lists
Diffstat (limited to 'eitscan.c')
-rw-r--r-- | eitscan.c | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: eitscan.c 1.22 2004/04/16 13:33:34 kls Exp $ + * $Id: eitscan.c 1.23 2004/10/31 16:19:49 kls Exp $ */ #include "eitscan.h" @@ -20,10 +20,10 @@ private: cChannel channel; public: cScanData(const cChannel *Channel); - virtual bool operator< (const cListObject &ListObject); - int Source(void) { return channel.Source(); } - int Transponder(void) { return channel.Transponder(); } - const cChannel *GetChannel(void) { return &channel; } + virtual int Compare(const cListObject &ListObject) const; + int Source(void) const { return channel.Source(); } + int Transponder(void) const { return channel.Transponder(); } + const cChannel *GetChannel(void) const { return &channel; } }; cScanData::cScanData(const cChannel *Channel) @@ -31,10 +31,13 @@ cScanData::cScanData(const cChannel *Channel) channel = *Channel; } -bool cScanData::operator< (const cListObject &ListObject) +int cScanData::Compare(const cListObject &ListObject) const { - cScanData *sd = (cScanData *)&ListObject; - return Source() < sd->Source() || Source() == sd->Source() && Transponder() < sd->Transponder(); + const cScanData *sd = (const cScanData *)&ListObject; + int r = Source() - sd->Source(); + if (r == 0) + r = Transponder() - sd->Transponder(); + return r; } // --- cScanList ------------------------------------------------------------- |