Fix bug in unescape filter, but still manage not to fix build issue.

pull/29/head
AnyOldName3 8 years ago
parent 423919abb5
commit 32f0ded8f6

@ -237,25 +237,46 @@ int escape_hash_filter::get(Source & src)
return retval;
}
unescape_hash_filter::unescape_hash_filter() : expectingIdentifier(false)
{
}
unescape_hash_filter::~unescape_hash_filter()
{
}
template <typename Source>
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)
{
int nextChar = boost::iostreams::get(src);
int intended;
switch (nextChar)
{
case escape_hash_filter::sEscapeIdentifier:
return escape_hash_filter::sEscape;
intended = escape_hash_filter::sEscape;
break;
case escape_hash_filter::sHashIdentifier:
return '#';
intended = '#';
break;
case boost::iostreams::WOULD_BLOCK:
expectingIdentifier = true;
intended = nextChar;
break;
default:
return '?';
intended = '?';
break;
}
return intended;
}
else
return character;

@ -90,7 +90,13 @@ struct escape_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);
private:
bool expectingIdentifier;
};
/**

Loading…
Cancel
Save