summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2009-04-20 09:48:19 +0000
committerJay Freeman (saurik) <saurik@saurik.com>2010-09-30 07:13:13 +0000
commit843e75b8b18cd5eb0ce88b6f65ba37aa5b17a0f5 (patch)
tree4253f62b1a1d5cedaa3d9e99f3bf838b17575919
parent68d927e20c9a9bf2e6dcc2f175fcb2f8fdc1a0d7 (diff)
Minor tweaks.
-rw-r--r--Cydia.mm21
1 files changed, 13 insertions, 8 deletions
diff --git a/Cydia.mm b/Cydia.mm
index 266415a..1a9d8d0 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<const uint8_t *>(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<pkgIndexFile *> *indices = (*source)->GetIndexFiles();
for (std::vector<pkgIndexFile *>::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)