From 5346d85099a19b49c24c1ac5492c302323103ddd Mon Sep 17 00:00:00 2001 From: matthewleon Date: Fri, 29 Feb 2008 20:09:59 +0000 Subject: [PATCH] Fixed compiler warnings by converting PlaylistEntry length property to NSNumber. --- Playlist/PlaylistController.m | 4 ++-- Playlist/PlaylistEntry.h | 2 +- Playlist/PlaylistEntry.m | 7 +++++-- Spotlight/SpotlightPlaylistEntry.h | 4 +--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Playlist/PlaylistController.m b/Playlist/PlaylistController.m index 4dfff0b75..446c47b01 100644 --- a/Playlist/PlaylistController.m +++ b/Playlist/PlaylistController.m @@ -102,8 +102,8 @@ ldiv_t hoursAndMinutes; for (PlaylistEntry *pe in [self arrangedObjects]) { - if (!isnan(pe.length)) - tt += pe.length; + if (!isnan([pe.length doubleValue])) + tt += [pe.length doubleValue]; } int sec = (int)(tt); diff --git a/Playlist/PlaylistEntry.h b/Playlist/PlaylistEntry.h index c24896057..834c45868 100644 --- a/Playlist/PlaylistEntry.h +++ b/Playlist/PlaylistEntry.h @@ -48,7 +48,7 @@ typedef enum { - (void)readPropertiesThread; @property(readonly) NSString *display; -@property(readonly) double length; +@property(retain, readonly) NSNumber *length; @property(readonly) NSString *path; @property(readonly) NSString *filename; diff --git a/Playlist/PlaylistEntry.m b/Playlist/PlaylistEntry.m index 9ed76c948..8789fcff2 100644 --- a/Playlist/PlaylistEntry.m +++ b/Playlist/PlaylistEntry.m @@ -105,16 +105,19 @@ } } -- (double)length +@dynamic length; +- (NSNumber *)length { - return ((double)self.totalFrames / self.sampleRate); + return [NSNumber numberWithDouble:((double)self.totalFrames / self.sampleRate)]; } +@dynamic path; - (NSString *)path { return [[self.URL path] stringByAbbreviatingWithTildeInPath]; } +@dynamic filename; - (NSString *)filename { return [[self.URL path] lastPathComponent]; diff --git a/Spotlight/SpotlightPlaylistEntry.h b/Spotlight/SpotlightPlaylistEntry.h index a5433001e..e34e8e0ce 100644 --- a/Spotlight/SpotlightPlaylistEntry.h +++ b/Spotlight/SpotlightPlaylistEntry.h @@ -16,7 +16,5 @@ + (SpotlightPlaylistEntry *)playlistEntryWithMetadataItem:(NSMetadataItem *)metadataItem; -// New length getters/setters - -@property(retain) NSNumber *length; +@property(retain, readwrite) NSNumber *length; @end