X-Git-Url: https://git.saurik.com/cydia.git/blobdiff_plain/646cfb37da913c97827d915cf2770a5cc9ac87c1..9c44cbca951c9f52c63e87181b28a7ba958e2ebb:/MobileCydia.mm diff --git a/MobileCydia.mm b/MobileCydia.mm index 46d5ddfb..c6ba06d0 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -121,6 +121,7 @@ extern "C" { #include #include "UICaboodle/BrowserView.h" +#include "SDURLCache/SDURLCache.h" #include "substrate.h" /* }}} */ @@ -1447,6 +1448,7 @@ struct PackageValue : struct MetaValue : Cytore::Block { + uint32_t active_; Cytore::Offset packages_[1 << 16]; }; @@ -2205,7 +2207,6 @@ struct PackageNameOrdering : _end _profile(Package$initWithVersion$Cache) - id_.set(NULL, iterator.Name()); name_.set(NULL, iterator.Display()); latest_.set(NULL, StripVersion_(version_.VerStr())); @@ -2215,19 +2216,6 @@ struct PackageNameOrdering : installed_.set(NULL, StripVersion_(current.VerStr())); _end - _profile(Package$initWithVersion$Lower) - // XXX: do not use tolower() as this is not locale-specific? :( - char *data(id_.data()); - for (size_t i(0), e(id_.size()); i != e; ++i) - if ((data[i] & 0x20) == 0) { - id_.copy(pool); - data = id_.data(); - for (; i != e; ++i) - data[i] |= 0x20; - break; - } - _end - _profile(Package$initWithVersion$Tags) pkgCache::TagIterator tag(iterator.TagList()); if (!tag.end()) { @@ -2252,9 +2240,19 @@ struct PackageNameOrdering : _end _profile(Package$initWithVersion$Metadata) - PackageValue *metadata(PackageFind(id_.data(), id_.size())); + const char *mixed(iterator.Name()); + size_t size(strlen(mixed)); + char lower[size + 1]; + + for (size_t i(0); i != size; ++i) + lower[i] = mixed[i] | 0x20; + lower[size] = '\0'; + + PackageValue *metadata(PackageFind(lower, size)); metadata_ = metadata; + id_.set(NULL, metadata->name_, size); + const char *latest(version_.VerStr()); size_t length(strlen(latest)); @@ -3154,7 +3152,13 @@ static NSString *Warning_; zone_ = NSCreateZone(1024 * 1024, 256 * 1024, NO); apr_pool_create(&pool_, NULL); - packages_ = CFArrayCreateMutable(kCFAllocatorDefault, 0, NULL); + size_t capacity(MetaFile_->active_); + if (capacity == 0) + capacity = 16384; + else + capacity += 1024; + + packages_ = CFArrayCreateMutable(kCFAllocatorDefault, capacity, NULL); int fds[2]; @@ -3356,7 +3360,9 @@ static NSString *Warning_; cache_.Close(); apr_pool_clear(pool_); + NSRecycleZone(zone_); + zone_ = NSCreateZone(1024 * 1024, 256 * 1024, NO); int chk(creat("/tmp/cydia.chk", 0644)); if (chk != -1) @@ -3477,6 +3483,8 @@ static NSString *Warning_; _trace(); size_t count(CFArrayGetCount(packages_)); + MetaFile_->active_ = count; + for (size_t index(0); index != count; ++index) [(Package *) CFArrayGetValueAtIndex(packages_, index) setIndex:index]; @@ -8737,6 +8745,12 @@ static _finline void _setHomePage(Cydia *self) { - (void) applicationDidFinishLaunching:(id)unused { _trace(); + [NSURLCache setSharedURLCache:[[[SDURLCache alloc] + initWithMemoryCapacity:524288 + diskCapacity:10485760 + diskPath:[NSString stringWithFormat:@"%@/Library/Caches/com.saurik.Cydia/SDURLCache", @"/var/root"] + ] autorelease]]; + [CYBrowserController _initialize]; [NSURLProtocol registerClass:[CydiaURLProtocol class]];