From: Jay Freeman (saurik) Date: Mon, 20 Apr 2009 09:48:19 +0000 (+0000) Subject: Minor tweaks. X-Git-Tag: v1.0.3366~271 X-Git-Url: https://git.saurik.com/cydia.git/commitdiff_plain/843e75b8b18cd5eb0ce88b6f65ba37aa5b17a0f5?ds=sidebyside;hp=68d927e20c9a9bf2e6dcc2f175fcb2f8fdc1a0d7 Minor tweaks. --- diff --git a/Cydia.mm b/Cydia.mm index 266415a3..1a9d8d00 100644 --- a/Cydia.mm +++ b/Cydia.mm @@ -1138,11 +1138,11 @@ NSString *SizeString(double size) { return [NSString stringWithFormat:@"%s%.1f %s", (negative ? "-" : ""), size, powers_[power]]; } -NSString *StripVersion(const char *version) { +CFStringRef StripVersion(const char *version) { const char *colon(strchr(version, ':')); if (colon != NULL) version = colon + 1; - return [NSString stringWithUTF8String:version]; + return CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast(version), strlen(version), kCFStringEncodingUTF8, NO, kCFAllocatorNull); } NSString *LocalizeSection(NSString *section) { @@ -2038,14 +2038,14 @@ struct PackageNameOrdering : database_ = database; _profile(Package$initWithVersion$Latest) - latest_ = [StripVersion(version_.VerStr()) retain]; + latest_ = (NSString *) StripVersion(version_.VerStr()); _end pkgCache::VerIterator current; _profile(Package$initWithVersion$Versions) current = iterator_.CurrentVer(); if (!current.end()) - installed_ = [StripVersion(current.VerStr()) retain]; + installed_ = (NSString *) StripVersion(current.VerStr()); if (!version_.end()) file_ = version_.FileList(); @@ -2086,7 +2086,7 @@ struct PackageNameOrdering : metadata_ = [Packages_ objectForKey:key]; if (metadata_ == nil) { - firstSeen_ = [now_ retain]; + firstSeen_ = now_; metadata_ = [[NSMutableDictionary dictionaryWithObjectsAndKeys: firstSeen_, @"FirstSeen", @@ -3101,6 +3101,9 @@ static NSArray *Finishes_; ++era_; } + [packages_ removeAllObjects]; + sources_.clear(); + _error->Discard(); delete list_; @@ -3117,6 +3120,11 @@ static NSArray *Finishes_; delete policy_; policy_ = NULL; + if (now_ != nil) { + [now_ release]; + now_ = nil; + } + cache_.Close(); apr_pool_clear(pool_); @@ -3171,7 +3179,6 @@ static NSArray *Finishes_; _trace(); - sources_.clear(); for (pkgSourceList::const_iterator source = list_->begin(); source != list_->end(); ++source) { std::vector *indices = (*source)->GetIndexFiles(); for (std::vector::const_iterator index = indices->begin(); index != indices->end(); ++index) @@ -3191,8 +3198,6 @@ static NSArray *Finishes_; [packages_ release]; packages_ = nil;*/ - [packages_ removeAllObjects]; - _trace(); for (pkgCache::PkgIterator iterator = cache_->PkgBegin(); !iterator.end(); ++iterator)