Merge pull request #11223 from hawkwood/patch-6

Remove use of autorelease NSString and NSURL
This commit is contained in:
minggo 2015-03-31 11:57:00 +08:00
commit 6ef27df2fc
1 changed files with 4 additions and 2 deletions

View File

@ -99,8 +99,10 @@ void AudioCache::readDataTask()
AudioBufferList theDataBuffer; AudioBufferList theDataBuffer;
ExtAudioFileRef extRef = nullptr; ExtAudioFileRef extRef = nullptr;
auto fileURL = (CFURLRef)[[NSURL fileURLWithPath:[NSString stringWithCString:_fileFullPath.c_str() encoding:[NSString defaultCStringEncoding]]] retain]; NSString *fileFullPath = [[NSString alloc] initWithCString:_fileFullPath.c_str() encoding:[NSString defaultCStringEncoding]];
auto fileURL = (CFURLRef)[[NSURL alloc] initFileURLWithPath:fileFullPath];
[fileFullPath release];
auto error = ExtAudioFileOpenURL(fileURL, &extRef); auto error = ExtAudioFileOpenURL(fileURL, &extRef);
if(error) { if(error) {
printf("%s: ExtAudioFileOpenURL FAILED, Error = %ld\n", __PRETTY_FUNCTION__, (long)error); printf("%s: ExtAudioFileOpenURL FAILED, Error = %ld\n", __PRETTY_FUNCTION__, (long)error);