Changeset 364 for trunk/Cocoa/Pester/Source/PSAlarms.m
- Timestamp:
- 11/28/07 01:29:26 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cocoa/Pester/Source/PSAlarms.m
r357 r364 178 178 unsigned indexCount = [indices count], i = 0, alarmIndex; 179 179 unsigned *indexArray = (unsigned *)malloc(indexCount * sizeof(unsigned)); 180 NS_DURING180 @try { 181 181 while ( (n = [e nextObject]) != nil) { 182 182 alarmIndex = [n intValue]; … … 186 186 } 187 187 [alarms removeObjectsFromIndices: indexArray numIndices: indexCount]; 188 } @finally { 188 189 free(indexArray); indexArray = NULL; 189 190 [self _changed]; 190 NS_HANDLER 191 free(indexArray); 192 [self _changed]; 193 [localException raise]; 194 NS_ENDHANDLER 191 } 195 192 } 196 193 … … 314 311 NSData *alarmData; 315 312 PSAlarm *alarm; 316 while ( (alarmData = [e nextObject]) != nil) { 317 NS_DURING 318 alarm = [NSUnarchiver unarchiveObjectWithData: alarmData]; 319 NS_HANDLER 320 alarm = nil; 321 // XXX 322 NS_ENDHANDLER 323 if (alarm != nil) 324 [alarms addObject: alarm]; 313 NSMutableArray *importedAlarms = [[NSMutableArray alloc] initWithCapacity: [alarmsData count]]; 314 @try { 315 while ( (alarmData = [e nextObject]) != nil) { 316 alarm = [NSUnarchiver unarchiveObjectWithData: alarmData]; 317 if (alarm == nil) 318 @throw [NSException exceptionWithName: NSInternalInconsistencyException reason: @"Failed to decode Pester 1.0 alarm." userInfo: nil]; 319 [importedAlarms addObject: alarm]; 320 if (![alarm setTimer]) // expired 321 [alarms addObject: alarm]; 322 } 323 } @catch (NSException *exception) { 324 [self removeAlarms: [NSSet setWithArray: importedAlarms]]; 325 @throw; 326 } @finally { 327 [importedAlarms release]; 325 328 } 326 329 }
Note:
See TracChangeset
for help on using the changeset viewer.