|
From: Felix B. <fbe...@us...> - 2010-05-12 05:19:14
|
Module: performous
Branch: master
Commit: 42828c6feb68201d5222edf79038e9314b8caec8
Author: Felix Bertram <fl...@be...>
Date: Tue May 11 22:16:22 2010 -0700
image type detection
The image type detection from the file extension was broken,
the extension was not properly converted to lower case.
---
game/surface.cc | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/game/surface.cc b/game/surface.cc
index fa4a2b5..e8c1edc 100644
--- a/game/surface.cc
+++ b/game/surface.cc
@@ -24,12 +24,15 @@ float Dimensions::screenY() const {
throw std::logic_error("Dimensions::screenY(): unknown m_screenAnchor value");
}
+
template <typename T> void loader(T& target, fs::path name) {
std::string const filename = name.string();
if (!fs::exists(name)) throw std::runtime_error("File not found: " + filename);
// Get file extension in lower case
std::string ext = name.extension();
- std::for_each(ext.begin(), ext.end(), static_cast<int(*)(int)>(std::tolower));
+ // somehow this does not convert the extension to lower case:
+ //std::for_each(ext.begin(), ext.end(), static_cast<int(*)(int)>(std::tolower));
+ std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower );
if (ext == ".svg") loadSVG(target, filename);
else if (ext == ".png") {
|