Fixed some static analyizer warnings.

This commit is contained in:
Damiano Galassi committed 2016-01-27 13:30:00 +01:00
1 parent a7131d300c
commit 64163973f3
8 files changed
+25 -16

No files matched your search

+3 -3
View File
@@ -589,10 +589,9 @@
- (NSUInteger)timescaleForTrack:(MP42Track *)track { - (NSUInteger)timescaleForTrack:(MP42Track *)track {
AVAssetTrack *assetTrack = [_localAsset trackWithTrackID:[track sourceId]]; AVAssetTrack *assetTrack = [_localAsset trackWithTrackID:[track sourceId]];
CMFormatDescriptionRef formatDescription = NULL;
NSArray *formatDescriptions = assetTrack.formatDescriptions; NSArray *formatDescriptions = assetTrack.formatDescriptions;
if ([formatDescriptions count] > 0) CMFormatDescriptionRef formatDescription = (CMFormatDescriptionRef) formatDescriptions.firstObject;
formatDescription = (CMFormatDescriptionRef)[formatDescriptions objectAtIndex:0]; if (formatDescriptions) {
if ([[assetTrack mediaType] isEqualToString:AVMediaTypeAudio]) { if ([[assetTrack mediaType] isEqualToString:AVMediaTypeAudio]) {
const AudioStreamBasicDescription* const asbd = const AudioStreamBasicDescription* const asbd =
CMAudioFormatDescriptionGetStreamBasicDescription(formatDescription); CMAudioFormatDescriptionGetStreamBasicDescription(formatDescription);
@@ -600,6 +599,7 @@
double sampleRate = asbd->mSampleRate; double sampleRate = asbd->mSampleRate;
return (NSUInteger)sampleRate; return (NSUInteger)sampleRate;
}
} }
return [assetTrack naturalTimeScale]; return [assetTrack naturalTimeScale];
+1 -1
View File
@@ -41,7 +41,7 @@ struct AudioFileIO
UInt32 numPacketsPerRead; UInt32 numPacketsPerRead;
AudioStreamBasicDescription srcFormat; AudioStreamBasicDescription srcFormat;
AudioStreamPacketDescription *pktDescs; AudioStreamPacketDescription * _Nullable pktDescs;
MP42Fifo<MP42SampleBuffer *> *inputSamplesBuffer; MP42Fifo<MP42SampleBuffer *> *inputSamplesBuffer;
+2 -2
View File
@@ -543,7 +543,7 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
#endif #endif
if (tempURL) { if (tempURL) {
tempURL = [tempURL URLByAppendingPathComponent:[NSString stringWithFormat:@"%@.tmp", [self.URL lastPathComponent]]]; tempURL = [tempURL URLByAppendingPathComponent:[NSString stringWithFormat:@"%@.tmp", self.URL.lastPathComponent]];
} }
return tempURL; return tempURL;
@@ -568,7 +568,7 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
// Loop to check the progress // Loop to check the progress
while (!done) { 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]; [self progressStatus:((double)fileSize / originalFileSize) * 100];
usleep(450000); usleep(450000);
} }
+7 -2
View File
@@ -1034,13 +1034,18 @@ static const genreType_t genreType_strings[] = {
[ratingString release]; [ratingString release];
if (ratingItems.count > 2) { 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 { else {
ratingiTunesCode = nil; 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) { if (ratingItems.count >= 4) {
tagsDict[@"Rating Annotation"] = ratingItems[3]; tagsDict[@"Rating Annotation"] = ratingItems[3];
+1 -1
View File
@@ -800,7 +800,7 @@
SoundDescriptionHandle sndDesc = (SoundDescriptionHandle) desc; SoundDescriptionHandle sndDesc = (SoundDescriptionHandle) desc;
ByteCount formatDescSize; ByteCount formatDescSize;
AudioStreamBasicDescription formatDesc; AudioStreamBasicDescription formatDesc = {0};
err = QTSoundDescriptionGetPropertyInfo(sndDesc, kQTPropertyClass_SoundDescription, err = QTSoundDescriptionGetPropertyInfo(sndDesc, kQTPropertyClass_SoundDescription,
kQTSoundDescriptionPropertyID_AudioStreamBasicDescription, kQTSoundDescriptionPropertyID_AudioStreamBasicDescription,
+9 -5
View File
@@ -108,11 +108,15 @@
} }
- (NSUInteger) ratingIndexForiTunesCode:(NSString *)aiTunesCode { - (NSUInteger) ratingIndexForiTunesCode:(NSString *)aiTunesCode {
for (NSUInteger i = 0; i < [iTunesCodes count]; i++) { NSUInteger i = 0;
if ([[iTunesCodes objectAtIndex:i] isEqualToString:aiTunesCode]) {
return i; for (NSString *code in iTunesCodes) {
} if ([code isEqualToString:aiTunesCode]) {
} return i;
}
i++;
}
return [self unknownIndex]; return [self unknownIndex];
} }
+1 -1
View File
@@ -868,7 +868,7 @@
A9B9C1E4182391DF00416A4E /* Project object */ = { A9B9C1E4182391DF00416A4E /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 0720; LastUpgradeCheck = 0730;
ORGANIZATIONNAME = "Damiano Galassi"; ORGANIZATIONNAME = "Damiano Galassi";
TargetAttributes = { TargetAttributes = {
A9B9C203182391DF00416A4E = { A9B9C203182391DF00416A4E = {
@@ -449,7 +449,7 @@
0867D690FE84028FC02AAC07 /* Project object */ = { 0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 0720; LastUpgradeCheck = 0730;
}; };
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "UniversalDetector" */; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "UniversalDetector" */;
compatibilityVersion = "Xcode 3.2"; compatibilityVersion = "Xcode 3.2";