Remove several BroString escaping methods that are no longer useful.

This commit is contained in:
Seth Hall 2015-02-24 09:37:37 -05:00
parent d29679484d
commit 0d6292d5ca
3 changed files with 23 additions and 23 deletions

View file

@ -194,22 +194,22 @@ char* BroString::Render(int format, int* len) const
for ( int i = 0; i < n; ++i )
{
if ( b[i] == '\0' && (format & ESC_NULL) )
{
*sp++ = '\\'; *sp++ = '0';
}
//if ( b[i] == '\0' && (format & ESC_NULL) )
// {
// *sp++ = '\\'; *sp++ = 'x'; *sp++ = '0'; *sp++ = '0';
// }
//
//else if ( b[i] == '\x7f' && (format & ESC_DEL) )
// {
// *sp++ = '^'; *sp++ = '?';
// }
//
//else if ( b[i] <= 26 && (format & ESC_LOW) )
// {
// *sp++ = '^'; *sp++ = b[i] + 'A' - 1;
// }
else if ( b[i] == '\x7f' && (format & ESC_DEL) )
{
*sp++ = '^'; *sp++ = '?';
}
else if ( b[i] <= 26 && (format & ESC_LOW) )
{
*sp++ = '^'; *sp++ = b[i] + 'A' - 1;
}
else if ( b[i] == '\\' && (format & ESC_ESC) )
if ( b[i] == '\\' && (format & ESC_ESC) )
{
*sp++ = '\\'; *sp++ = '\\';
}

View file

@ -76,9 +76,9 @@ public:
enum render_style {
ESC_NONE = 0,
ESC_NULL = (1 << 0), // 0 -> "\0"
ESC_DEL = (1 << 1), // DEL -> "^?"
ESC_LOW = (1 << 2), // values <= 26 mapped into "^[A-Z]"
//ESC_NULL = (1 << 0), // 0 -> "\0"
//ESC_DEL = (1 << 1), // DEL -> "^?"
//ESC_LOW = (1 << 2), // values <= 26 mapped into "^[A-Z]"
ESC_ESC = (1 << 3), // '\' -> "\\"
ESC_QUOT = (1 << 4), // '"' -> "\"", ''' -> "\'"
ESC_HEX = (1 << 5), // Not in [32, 126]? -> "%XX"
@ -89,7 +89,7 @@ public:
};
static const int EXPANDED_STRING = // the original style
ESC_NULL | ESC_DEL | ESC_LOW | ESC_HEX;
ESC_ESC | ESC_HEX;
static const int BRO_STRING_LITERAL = // as in a Bro string literal
ESC_ESC | ESC_QUOT | ESC_HEX;

View file

@ -182,10 +182,10 @@ void ODesc::AddBytes(const BroString* s)
else
{
int render_style = BroString::EXPANDED_STRING;
if ( Style() == ALTERNATIVE_STYLE )
// Only change NULs, since we can't in any case
// cope with them.
render_style = BroString::ESC_NULL;
//if ( Style() == ALTERNATIVE_STYLE )
// // Only change NULs, since we can't in any case
// // cope with them.
// render_style = BroString::ESC_NULL;
const char* str = s->Render(render_style);
Add(str);