diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-04-11 14:06:50 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-04-11 14:06:50 +0000 |
commit | cb413146428ce5db5e281d70f2b3b7df27c1aaab (patch) | |
tree | 4961e9dcb107f2ca1f0a4298faf5135ba8611d92 /libs/ardour/audiofilesource.cc | |
parent | 9aa8af5a28abbb86c9ae86c6991838eb6828d0a9 (diff) |
merge 3.0 from 2.0-ongoing@3243
git-svn-id: svn://localhost/ardour2/branches/3.0@3248 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/audiofilesource.cc')
-rw-r--r-- | libs/ardour/audiofilesource.cc | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc index 268c4e18bb..026cb3e7c0 100644 --- a/libs/ardour/audiofilesource.cc +++ b/libs/ardour/audiofilesource.cc @@ -692,29 +692,39 @@ AudioFileSource::setup_peakfile () bool AudioFileSource::safe_file_extension(ustring file) { - return !(file.rfind(".wav") == ustring::npos && - file.rfind(".aiff")== ustring::npos && - file.rfind(".caf")== ustring::npos && - file.rfind(".aif") == ustring::npos && - file.rfind(".amb") == ustring::npos && - file.rfind(".snd") == ustring::npos && - file.rfind(".au") == ustring::npos && - file.rfind(".raw") == ustring::npos && - file.rfind(".sf") == ustring::npos && - file.rfind(".cdr") == ustring::npos && - file.rfind(".smp") == ustring::npos && - file.rfind(".maud")== ustring::npos && - file.rfind(".vwe") == ustring::npos && - file.rfind(".paf") == ustring::npos && + const char* suffixes[] = { + ".wav", ".WAV", + ".aiff", ".AIFF", + ".caf", ".CAF", + ".aif", ".AIF", + ".amb", ".AMB", + ".snd", ".SND", + ".au", ".AU", + ".raw", ".RAW", + ".sf", ".SF", + ".cdr", ".CDR", + ".smp", ".SMP", + ".maud", ".MAUD", + ".vwe", ".VWE", + ".paf", ".PAF", + ".voc", ".VOC", #ifdef HAVE_FLAC - file.rfind(".flac")== ustring::npos && + ".flac", ".FLAC", #endif // HAVE_FLAC #ifdef HAVE_COREAUDIO - file.rfind(".mp3") == ustring::npos && - file.rfind(".aac") == ustring::npos && - file.rfind(".mp4") == ustring::npos && + ".mp3", ".MP3", + ".aac", ".AAC", + ".mp4", ".MP4", #endif // HAVE_COREAUDIO - file.rfind(".voc") == ustring::npos); + }; + + for (size_t n = 0; n < sizeof(suffixes)/sizeof(suffixes[0]); ++n) { + if (file.rfind (suffixes[n]) == file.length() - strlen (suffixes[n])) { + return true; + } + } + + return false; } void |