[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11796: convert filename to lower ca
From: |
Rob Savoye |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11796: convert filename to lower case when trying to do a string compare on the suffix. |
Date: |
Sun, 24 Jan 2010 10:09:43 -0700 |
User-agent: |
Bazaar (2.0.2) |
------------------------------------------------------------
revno: 11796
committer: Rob Savoye <address@hidden>
branch nick: trunk
timestamp: Sun 2010-01-24 10:09:43 -0700
message:
convert filename to lower case when trying to do a string compare on the
suffix.
modified:
libnet/diskstream.cpp
=== modified file 'libnet/diskstream.cpp'
--- a/libnet/diskstream.cpp 2010-01-19 23:35:43 +0000
+++ b/libnet/diskstream.cpp 2010-01-24 17:09:43 +0000
@@ -28,6 +28,7 @@
#include <iostream>
#include <string>
#include <cerrno>
+#include <algorithm>
#if !defined(_WIN32) && !defined(__amigaos4__)
#include <sys/mman.h>
#elif defined(__amigaos4__)
@@ -983,9 +984,17 @@
}
string::size_type pos;
- pos = filespec.rfind(".");
+
+ string name = filespec;
+
+ // transform to lower case so we match filenames which may
+ // have the suffix in upper case, or this test fails.
+ std::transform(name.begin(), name.end(), name.begin(),
+ (int(*)(int)) tolower);
+
+ pos = name.rfind(".");
if (pos != string::npos) {
- string suffix = filespec.substr(pos+1, filespec.size());
+ string suffix = name.substr(pos+1, name.size());
_filetype = FILETYPE_NONE;
if (suffix == "htm") {
_filetype = FILETYPE_HTML;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11796: convert filename to lower case when trying to do a string compare on the suffix.,
Rob Savoye <=