@@ -31,13 +31,15 @@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31
31
*/
32
32
33
33
#import " common.h"
34
- #import " IFSiTunesLibrary.h"
35
34
#import < AppKit/AppKit.h>
35
+ #import " IFSiTunesLibrary.h"
36
+
37
+ #import " NSObject+FUSEOFS.h"
36
38
#import " NSString+Extensions.h"
39
+
37
40
#import " IFSiTunesPlaylist.h"
38
41
#import " IFSM3UPlaylist.h"
39
42
#import " IFSiTunesTrack.h"
40
- #import " NSObject+FUSEOFS.h"
41
43
#import " IFSFormatter.h"
42
44
#import " FUSEOFSMemoryContainer.h"
43
45
#ifndef GNU_GUI_LIBRARY
@@ -169,24 +171,18 @@ - (void)dealloc {
169
171
/* setup */
170
172
171
173
- (void )reload {
172
- NSData *plist;
173
- NSDictionary *lib;
174
- NSArray *playlists;
175
- NSDictionary *tracks;
176
- NSArray *trackIDs;
177
- NSUInteger i, count;
178
-
179
174
if (doDebug)
180
175
NSLog (@" %s " , __PRETTY_FUNCTION__);
181
176
182
177
[self ->plMap removeAllObjects ];
183
178
[self ->m3uMap removeAllObjects ];
184
179
[self ->trackMap removeAllObjects ];
185
180
186
- plist = [NSData dataWithContentsOfFile: [self libraryPath ]];
181
+ NSData * plist = [NSData dataWithContentsOfFile: [self libraryPath ]];
187
182
NSAssert1 (plist != nil , @" Couldn't read contents of %@ !" ,
188
183
[self libraryPath ]);
189
184
185
+ NSDictionary *lib;
190
186
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101000
191
187
lib = [NSPropertyListSerialization propertyListFromData: plist
192
188
mutabilityOption: NSPropertyListImmutable
@@ -205,10 +201,10 @@ - (void)reload {
205
201
self->name = [[NSString stringWithFormat: @" iTunes (v%@ )" ,
206
202
[lib objectForKey: @" Application Version" ]] copy ];
207
203
208
- tracks = [lib objectForKey: @" Tracks" ];
209
- trackIDs = [tracks allKeys ];
210
- count = [trackIDs count ];
211
- for (i = 0 ; i < count; i++) {
204
+ NSDictionary *tracks = [lib objectForKey: @" Tracks" ];
205
+ NSArray *trackIDs = [tracks allKeys ];
206
+ NSUInteger count = [trackIDs count ];
207
+ for (NSUInteger i = 0 ; i < count; i++) {
212
208
NSString *trackID;
213
209
NSDictionary *rep;
214
210
IFSiTunesTrack *track;
@@ -221,50 +217,39 @@ - (void)reload {
221
217
[track release ];
222
218
}
223
219
224
- NSMutableDictionary *idPlMap ;
225
- playlists = [lib objectForKey: @" Playlists " ];
226
- count = [playlists count ];
227
- idPlMap = [[ NSMutableDictionary alloc ] initWithCapacity: count];
220
+ NSArray *playlists = [lib objectForKey: @" Playlists " ] ;
221
+ count = [playlists count ];
222
+ NSMutableDictionary *idPlMap = [[ NSMutableDictionary alloc ]
223
+ initWithCapacity: count];
228
224
229
- for (i = 0 ; i < count; i++) {
230
- NSDictionary *plRep;
231
- IFSiTunesPlaylist *pl;
232
- NSString *plId;
233
-
234
- plRep = [playlists objectAtIndex: i];
235
- pl = [[IFSiTunesPlaylist alloc ] initWithLibraryRepresentation: plRep
236
- lib: self ];
225
+ for (NSUInteger i = 0 ; i < count; i++) {
226
+ NSDictionary *plRep = [playlists objectAtIndex: i];
227
+ IFSiTunesPlaylist *pl = [[IFSiTunesPlaylist alloc ]
228
+ initWithLibraryRepresentation: plRep
229
+ lib: self ];
237
230
238
231
// only record top-level playlist, if playlist isn't a folder itself
239
232
if (![pl parentId ]) {
240
233
[self ->plMap setItem: pl
241
234
forName: [self burnFolderNameFromFolderName: [pl name ]]];
242
235
}
243
236
244
- plId = [pl persistentId ];
237
+ id plId = [pl persistentId ];
245
238
if (plId)
246
239
[idPlMap setObject: pl forKey: plId];
247
240
[pl release ];
248
241
}
249
242
250
243
// connect children to their parents
251
244
if ([idPlMap count ]) {
252
- NSArray *ids;
253
-
254
- ids = [idPlMap allKeys ];
245
+ NSArray *ids = [idPlMap allKeys ];
255
246
count = [ids count ];
256
- for (i = 0 ; i < count; i++) {
257
- NSString *plId;
258
- IFSiTunesPlaylist *pl;
259
- NSString *parentId;
260
-
261
- plId = [ids objectAtIndex: i];
262
- pl = [idPlMap objectForKey: plId];
263
- parentId = [pl parentId ];
247
+ for (NSUInteger i = 0 ; i < count; i++) {
248
+ id plId = [ids objectAtIndex: i];
249
+ IFSiTunesPlaylist *pl = [idPlMap objectForKey: plId];
250
+ id parentId = [pl parentId ];
264
251
if (parentId) {
265
- IFSiTunesPlaylist *parent;
266
-
267
- parent = [idPlMap objectForKey: parentId];
252
+ IFSiTunesPlaylist *parent = [idPlMap objectForKey: parentId];
268
253
if (parent) {
269
254
[parent addChild: pl
270
255
withName: [self burnFolderNameFromFolderName: [pl name ]]];
@@ -282,8 +267,8 @@ - (void)reload {
282
267
continue ;
283
268
284
269
IFSM3UPlaylist *m3uPl = [[IFSM3UPlaylist alloc ]
285
- initWithPlaylist: pl
286
- useRelativePaths: NO ];
270
+ initWithPlaylist: pl
271
+ useRelativePaths: NO ];
287
272
[self ->m3uMap setItem: m3uPl forName: [m3uPl fileName ]];
288
273
[m3uPl release ];
289
274
}
@@ -460,7 +445,7 @@ - (IFSiTunesPlaylist *)playlistNamed:(NSString *)_plName {
460
445
}
461
446
462
447
463
- - (IFSiTunesTrack *)trackWithID : (NSString * )_trackID {
448
+ - (IFSiTunesTrack *)trackWithID : (id )_trackID {
464
449
return [self ->trackMap objectForKey: _trackID];
465
450
}
466
451
0 commit comments