summaryrefslogtreecommitdiff
path: root/Cydia.mm
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2008-03-14 06:44:10 +0000
committerJay Freeman (saurik) <saurik@saurik.com>2008-03-14 06:44:10 +0000
commit723a007210a43e3a2320bdd5862828c64577c5fb (patch)
tree97b2cb016eeb9e2fd79f475ac212e4b87c65f322 /Cydia.mm
parent49048579e861fc02937c97d56a9d9f526d6d36b6 (diff)
Fixed a stupid bug involving now_ and FirstSeen.
Diffstat (limited to 'Cydia.mm')
-rw-r--r--Cydia.mm29
1 files changed, 18 insertions, 11 deletions
diff --git a/Cydia.mm b/Cydia.mm
index 0102f34..174fdfd 100644
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -1200,7 +1200,7 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
source_ = [[database_ getSource:file_.File()] retain];
NSMutableDictionary *metadata = [Packages_ objectForKey:id_];
- if (metadata == nil) {
+ if (metadata == nil || [metadata count] == 0) {
metadata = [NSMutableDictionary dictionaryWithObjectsAndKeys:
now_, @"FirstSeen",
nil];
@@ -1988,6 +1988,8 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
_assert(cache_.Open(progress_, true));
}
+ now_ = [NSDate date];
+
records_ = new pkgRecords(cache_);
resolver_ = new pkgProblemResolver(cache_);
fetcher_ = new pkgAcquire(&status_);
@@ -3049,11 +3051,19 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
else {
NSDate *seen = [package seen];
- CFLocaleRef locale = CFLocaleCopyCurrent();
- CFDateFormatterRef formatter = CFDateFormatterCreate(NULL, locale, kCFDateFormatterMediumStyle, kCFDateFormatterMediumStyle);
- CFStringRef formatted = CFDateFormatterCreateStringWithDate(NULL, formatter, (CFDateRef) seen);
-
- NSString *name = (NSString *) formatted;
+ NSString *name;
+ CFStringRef formatted = NULL;
+
+ if (seen == nil)
+ name = @"n/a ?";
+ else {
+ CFLocaleRef locale = CFLocaleCopyCurrent();
+ CFDateFormatterRef formatter = CFDateFormatterCreate(NULL, locale, kCFDateFormatterMediumStyle, kCFDateFormatterMediumStyle);
+ formatted = CFDateFormatterCreateStringWithDate(NULL, formatter, (CFDateRef) seen);
+ name = (NSString *) formatted;
+ CFRelease(formatter);
+ CFRelease(locale);
+ }
if (section == nil || ![[section name] isEqual:name]) {
section = [[[Section alloc] initWithName:name row:offset] autorelease];
@@ -3062,9 +3072,8 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
[section addPackage:package];
- CFRelease(formatter);
- CFRelease(formatted);
- CFRelease(locale);
+ if (formatted != NULL)
+ CFRelease(formatted);
}
}
@@ -3503,8 +3512,6 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
[Metadata_ setObject:Packages_ forKey:@"Packages"];
}
- now_ = [NSDate date];
-
NSArray *packages = [database_ packages];
[install_ setPackages:packages];