forked from mirror/openmw-tes3mp
Fix bug in unescape filter, but still manage not to fix build issue.
This commit is contained in:
parent
423919abb5
commit
32f0ded8f6
2 changed files with 31 additions and 4 deletions
|
@ -237,25 +237,46 @@ int escape_hash_filter::get(Source & src)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unescape_hash_filter::unescape_hash_filter() : expectingIdentifier(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
unescape_hash_filter::~unescape_hash_filter()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Source>
|
template <typename Source>
|
||||||
int unescape_hash_filter::get(Source & src)
|
int unescape_hash_filter::get(Source & src)
|
||||||
{
|
{
|
||||||
int character = boost::iostreams::get(src);
|
int character;
|
||||||
|
if (!expectingIdentifier)
|
||||||
|
character = boost::iostreams::get(src);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
character = escape_hash_filter::sEscape;
|
||||||
|
expectingIdentifier = false;
|
||||||
|
}
|
||||||
if (character == escape_hash_filter::sEscape)
|
if (character == escape_hash_filter::sEscape)
|
||||||
{
|
{
|
||||||
int nextChar = boost::iostreams::get(src);
|
int nextChar = boost::iostreams::get(src);
|
||||||
|
int intended;
|
||||||
switch (nextChar)
|
switch (nextChar)
|
||||||
{
|
{
|
||||||
case escape_hash_filter::sEscapeIdentifier:
|
case escape_hash_filter::sEscapeIdentifier:
|
||||||
return escape_hash_filter::sEscape;
|
intended = escape_hash_filter::sEscape;
|
||||||
break;
|
break;
|
||||||
case escape_hash_filter::sHashIdentifier:
|
case escape_hash_filter::sHashIdentifier:
|
||||||
return '#';
|
intended = '#';
|
||||||
|
break;
|
||||||
|
case boost::iostreams::WOULD_BLOCK:
|
||||||
|
expectingIdentifier = true;
|
||||||
|
intended = nextChar;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return '?';
|
intended = '?';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return intended;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return character;
|
return character;
|
||||||
|
|
|
@ -90,7 +90,13 @@ struct escape_hash_filter : public boost::iostreams::input_filter
|
||||||
|
|
||||||
struct unescape_hash_filter : public boost::iostreams::input_filter
|
struct unescape_hash_filter : public boost::iostreams::input_filter
|
||||||
{
|
{
|
||||||
|
unescape_hash_filter();
|
||||||
|
virtual ~unescape_hash_filter();
|
||||||
|
|
||||||
template <typename Source> int get(Source & src);
|
template <typename Source> int get(Source & src);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool expectingIdentifier;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue