diff options
author | (no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> | 2010-11-10 04:49:47 +0000 |
---|---|---|
committer | (no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> | 2010-11-10 04:49:47 +0000 |
commit | 2a63014742e62d7d036ba1009ced1a50cab16e93 (patch) | |
tree | 7bb729f44c501e88185d65dd946ff05e985eba2d /updater/common.h | |
parent | cca5b3bf138052f870cc4f6596f7bf18172e1f62 (diff) |
Added URL sorting to improve update performance
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@553 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'updater/common.h')
-rw-r--r-- | updater/common.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/updater/common.h b/updater/common.h index 2387c94..890fa47 100644 --- a/updater/common.h +++ b/updater/common.h @@ -69,11 +69,23 @@ typedef struct UpdateInternal_tag { struct UpdateList : OBJLIST<UpdateInternal>
{
UpdateList() : OBJLIST<UpdateInternal>(10) {}
- UpdateList(const UpdateList& upd) : OBJLIST<UpdateInternal>(10)
+ UpdateList(const UpdateList& upd) : OBJLIST<UpdateInternal>(10, compareUrl)
{
for (int i=0; i<upd.getCount(); ++i)
insert(new UpdateInternal(upd[i]));
}
+
+ static int compareUrl(const UpdateInternal* p1, const UpdateInternal* p2)
+ {
+ if (!p1->update.szBetaVersionURL && !p2->update.szBetaVersionURL)
+ return 0;
+ else if (!p1->update.szBetaVersionURL && p2->update.szBetaVersionURL)
+ return -1;
+ else if (p1->update.szBetaVersionURL && !p2->update.szBetaVersionURL)
+ return 1;
+ else
+ return _stricmp(p1->update.szBetaVersionURL, p2->update.szBetaVersionURL);
+ }
};
struct StrList : LIST<TCHAR>
|