From: Jay Freeman (saurik) Date: Fri, 25 Apr 2008 08:45:43 +0000 (+0000) Subject: Refresh sources after source update and sort sections without case. X-Git-Tag: v1.0.3366~455 X-Git-Url: https://git.saurik.com/cydia.git/commitdiff_plain/a72074b2e406983d9da08636bfe899043e619339?hp=4cf4165e8f0fc78a905fc9c421c0728e00ce4905 Refresh sources after source update and sort sections without case. --- diff --git a/Cydia.mm b/Cydia.mm index e5f198c4..70c5ff66 100644 --- a/Cydia.mm +++ b/Cydia.mm @@ -48,7 +48,6 @@ #include #include -#include #include #include @@ -1100,7 +1099,7 @@ NSString *Scour(const char *field, const char *begin, const char *end) { else if (lhs != NULL && rhs == NULL) return NSOrderedDescending; else if (lhs != NULL && rhs != NULL) { - NSComparisonResult result = [lhs compare:rhs]; + NSComparisonResult result = [lhs caseInsensitiveCompare:rhs]; if (result != NSOrderedSame) return result; } @@ -1411,14 +1410,12 @@ NSString *Scour(const char *field, const char *begin, const char *end) { } - (void) perform { - pkgSourceList list; - _assert(list.ReadMainList()); - - /*std::map before; - - for (pkgSourceList::const_iterator source = list_->begin(); source != list_->end(); ++source) - before.add((*source)->GetURI().c_str()); - exit(0);*/ + NSMutableArray *before = [NSMutableArray arrayWithCapacity:16]; { + pkgSourceList list; + _assert(list.ReadMainList()); + for (pkgSourceList::const_iterator source = list.begin(); source != list.end(); ++source) + [before addObject:[NSString stringWithUTF8String:(*source)->GetURI().c_str()]]; + } if (fetcher_->Run(PulseInterval_) != pkgAcquire::Continue) return; @@ -1433,7 +1430,15 @@ NSString *Scour(const char *field, const char *begin, const char *end) { if (result != pkgPackageManager::Completed) return; - _assert(list.ReadMainList()); + NSMutableArray *after = [NSMutableArray arrayWithCapacity:16]; { + pkgSourceList list; + _assert(list.ReadMainList()); + for (pkgSourceList::const_iterator source = list.begin(); source != list.end(); ++source) + [after addObject:[NSString stringWithUTF8String:(*source)->GetURI().c_str()]]; + } + + if (![before isEqualToArray:after]) + [self update]; } - (void) upgrade {