fixed bug #1080810 - const_iterators cannot be null in g++ (3.4.2)

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3816 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2004-12-10 10:21:50 +00:00
parent 0de534de59
commit fb60920df7

View file

@ -44,8 +44,8 @@ bool dir_reader::matches(const string& name, const string& spec) {
string::const_iterator spec_itr = spec.begin(); string::const_iterator spec_itr = spec.begin();
string::const_iterator spec_end = spec.end(); string::const_iterator spec_end = spec.end();
string::const_iterator last_good_spec = NULL; string::const_iterator last_good_spec = spec_end;
string::const_iterator last_good_name = NULL; string::const_iterator last_good_name = name_end;
while (name_itr != name_end && spec_itr != spec_end) { while (name_itr != name_end && spec_itr != spec_end) {
switch (*spec_itr) { switch (*spec_itr) {
@ -72,7 +72,7 @@ bool dir_reader::matches(const string& name, const string& spec) {
default: default:
if (::tolower(*name_itr) != ::tolower(*spec_itr)) { if (::tolower(*name_itr) != ::tolower(*spec_itr)) {
if (last_good_spec != NULL) { if (last_good_spec != spec_end) {
// matched wrong part of the name, try again // matched wrong part of the name, try again
spec_itr = last_good_spec; spec_itr = last_good_spec;
name_itr = ++last_good_name; name_itr = ++last_good_name;
@ -87,7 +87,7 @@ bool dir_reader::matches(const string& name, const string& spec) {
spec_itr++; spec_itr++;
name_itr++; name_itr++;
if (spec_itr == spec_end && name_itr != name_end && last_good_spec != NULL) { if (spec_itr == spec_end && name_itr != name_end && last_good_spec != spec_end) {
// asterisk hasn't matched enough, keep matching // asterisk hasn't matched enough, keep matching
spec_itr = last_good_spec; spec_itr = last_good_spec;
} }