From 5f42b92027fcaff9bd1263c9e832ce407cedb4d6 Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 14 Mar 2011 20:09:06 +0000 Subject: [PATCH] filename extension check should be case-insensitive --- panda/src/pnmimage/pnmFileTypeRegistry.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/panda/src/pnmimage/pnmFileTypeRegistry.cxx b/panda/src/pnmimage/pnmFileTypeRegistry.cxx index 283e945ac4..b967714d68 100644 --- a/panda/src/pnmimage/pnmFileTypeRegistry.cxx +++ b/panda/src/pnmimage/pnmFileTypeRegistry.cxx @@ -164,8 +164,15 @@ get_type_from_extension(const string &filename) const { Extensions::const_iterator ei; ei = _extensions.find(extension); if (ei == _extensions.end() || (*ei).second.empty()) { - // Nothing matches that string. - return NULL; + // Nothing matches that string. Try again with a downcased string + // in case we got an all-uppercase filename (most of our + // extensions are downcased). + ei = _extensions.find(downcase(extension)); + + if (ei == _extensions.end() || (*ei).second.empty()) { + // Nothing matches that string. + return NULL; + } } // Return the first file type associated with the given extension.