diff --git a/MP42/MP42AVFImporter.m b/MP42/MP42AVFImporter.m index 3230a3b..15e8019 100644 --- a/MP42/MP42AVFImporter.m +++ b/MP42/MP42AVFImporter.m @@ -589,10 +589,9 @@ - (NSUInteger)timescaleForTrack:(MP42Track *)track { AVAssetTrack *assetTrack = [_localAsset trackWithTrackID:[track sourceId]]; - CMFormatDescriptionRef formatDescription = NULL; NSArray *formatDescriptions = assetTrack.formatDescriptions; - if ([formatDescriptions count] > 0) - formatDescription = (CMFormatDescriptionRef)[formatDescriptions objectAtIndex:0]; + CMFormatDescriptionRef formatDescription = (CMFormatDescriptionRef) formatDescriptions.firstObject; + if (formatDescriptions) { if ([[assetTrack mediaType] isEqualToString:AVMediaTypeAudio]) { const AudioStreamBasicDescription* const asbd = CMAudioFormatDescriptionGetStreamBasicDescription(formatDescription); @@ -600,6 +599,7 @@ double sampleRate = asbd->mSampleRate; return (NSUInteger)sampleRate; + } } return [assetTrack naturalTimeScale]; diff --git a/MP42/MP42AudioConverter.h b/MP42/MP42AudioConverter.h index 92ee941..176a99c 100644 --- a/MP42/MP42AudioConverter.h +++ b/MP42/MP42AudioConverter.h @@ -41,7 +41,7 @@ struct AudioFileIO UInt32 numPacketsPerRead; AudioStreamBasicDescription srcFormat; - AudioStreamPacketDescription *pktDescs; + AudioStreamPacketDescription * _Nullable pktDescs; MP42Fifo *inputSamplesBuffer; diff --git a/MP42/MP42File.m b/MP42/MP42File.m index d354377..d842de8 100644 --- a/MP42/MP42File.m +++ b/MP42/MP42File.m @@ -543,7 +543,7 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) { #endif if (tempURL) { - tempURL = [tempURL URLByAppendingPathComponent:[NSString stringWithFormat:@"%@.tmp", [self.URL lastPathComponent]]]; + tempURL = [tempURL URLByAppendingPathComponent:[NSString stringWithFormat:@"%@.tmp", self.URL.lastPathComponent]]; } return tempURL; @@ -568,7 +568,7 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) { // Loop to check the progress while (!done) { - unsigned long long fileSize = [[[fileManager attributesOfItemAtPath:self.tempURL.path error:nil] valueForKey:NSFileSize] unsignedLongLongValue]; + unsigned long long fileSize = [[[fileManager attributesOfItemAtPath:tempURL.path error:nil] valueForKey:NSFileSize] unsignedLongLongValue]; [self progressStatus:((double)fileSize / originalFileSize) * 100]; usleep(450000); } diff --git a/MP42/MP42Metadata.m b/MP42/MP42Metadata.m index 0c7a856..2ac0465 100644 --- a/MP42/MP42Metadata.m +++ b/MP42/MP42Metadata.m @@ -1034,13 +1034,18 @@ static const genreType_t genreType_strings[] = { [ratingString release]; if (ratingItems.count > 2) { - ratingiTunesCode = [[NSString stringWithFormat:@"%@|%@|%@|",ratingItems[0], ratingItems[1], ratingItems[2]] retain]; + ratingiTunesCode = [[NSString stringWithFormat:@"%@|%@|%@|", ratingItems[0], ratingItems[1], ratingItems[2]] retain]; } else { ratingiTunesCode = nil; } - [tagsDict setObject:[NSNumber numberWithUnsignedInteger:[[MP42Ratings defaultManager] ratingIndexForiTunesCode:ratingiTunesCode]] forKey:@"Rating"]; + if (ratingiTunesCode) { + tagsDict[@"Rating"] = [NSNumber numberWithUnsignedInteger:[[MP42Ratings defaultManager] ratingIndexForiTunesCode:ratingiTunesCode]]; + } + else { + tagsDict[@"Rating"] = @(0); + } if (ratingItems.count >= 4) { tagsDict[@"Rating Annotation"] = ratingItems[3]; diff --git a/MP42/MP42QTImporter.m b/MP42/MP42QTImporter.m index e36c7d2..d6eecaa 100644 --- a/MP42/MP42QTImporter.m +++ b/MP42/MP42QTImporter.m @@ -800,7 +800,7 @@ SoundDescriptionHandle sndDesc = (SoundDescriptionHandle) desc; ByteCount formatDescSize; - AudioStreamBasicDescription formatDesc; + AudioStreamBasicDescription formatDesc = {0}; err = QTSoundDescriptionGetPropertyInfo(sndDesc, kQTPropertyClass_SoundDescription, kQTSoundDescriptionPropertyID_AudioStreamBasicDescription, diff --git a/MP42/MP42Ratings.m b/MP42/MP42Ratings.m index c48923c..9e37a2a 100644 --- a/MP42/MP42Ratings.m +++ b/MP42/MP42Ratings.m @@ -108,11 +108,15 @@ } - (NSUInteger) ratingIndexForiTunesCode:(NSString *)aiTunesCode { - for (NSUInteger i = 0; i < [iTunesCodes count]; i++) { - if ([[iTunesCodes objectAtIndex:i] isEqualToString:aiTunesCode]) { - return i; - } - } + NSUInteger i = 0; + + for (NSString *code in iTunesCodes) { + if ([code isEqualToString:aiTunesCode]) { + return i; + } + i++; + } + return [self unknownIndex]; } diff --git a/MP42Foundation.xcodeproj/project.pbxproj b/MP42Foundation.xcodeproj/project.pbxproj index 60dcb2e..b39922d 100644 --- a/MP42Foundation.xcodeproj/project.pbxproj +++ b/MP42Foundation.xcodeproj/project.pbxproj @@ -868,7 +868,7 @@ A9B9C1E4182391DF00416A4E /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0720; + LastUpgradeCheck = 0730; ORGANIZATIONNAME = "Damiano Galassi"; TargetAttributes = { A9B9C203182391DF00416A4E = { diff --git a/UniversalDetector/UniversalDetector.xcodeproj/project.pbxproj b/UniversalDetector/UniversalDetector.xcodeproj/project.pbxproj index e8ca014..ca84839 100644 --- a/UniversalDetector/UniversalDetector.xcodeproj/project.pbxproj +++ b/UniversalDetector/UniversalDetector.xcodeproj/project.pbxproj @@ -449,7 +449,7 @@ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0720; + LastUpgradeCheck = 0730; }; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "UniversalDetector" */; compatibilityVersion = "Xcode 3.2";