mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Remove several BroString escaping methods that are no longer useful.
This commit is contained in:
parent
d29679484d
commit
0d6292d5ca
3 changed files with 23 additions and 23 deletions
|
@ -194,22 +194,22 @@ char* BroString::Render(int format, int* len) const
|
||||||
|
|
||||||
for ( int i = 0; i < n; ++i )
|
for ( int i = 0; i < n; ++i )
|
||||||
{
|
{
|
||||||
if ( b[i] == '\0' && (format & ESC_NULL) )
|
//if ( b[i] == '\0' && (format & ESC_NULL) )
|
||||||
{
|
// {
|
||||||
*sp++ = '\\'; *sp++ = '0';
|
// *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) )
|
if ( b[i] == '\\' && (format & ESC_ESC) )
|
||||||
{
|
|
||||||
*sp++ = '^'; *sp++ = '?';
|
|
||||||
}
|
|
||||||
|
|
||||||
else if ( b[i] <= 26 && (format & ESC_LOW) )
|
|
||||||
{
|
|
||||||
*sp++ = '^'; *sp++ = b[i] + 'A' - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if ( b[i] == '\\' && (format & ESC_ESC) )
|
|
||||||
{
|
{
|
||||||
*sp++ = '\\'; *sp++ = '\\';
|
*sp++ = '\\'; *sp++ = '\\';
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,9 +76,9 @@ public:
|
||||||
enum render_style {
|
enum render_style {
|
||||||
ESC_NONE = 0,
|
ESC_NONE = 0,
|
||||||
|
|
||||||
ESC_NULL = (1 << 0), // 0 -> "\0"
|
//ESC_NULL = (1 << 0), // 0 -> "\0"
|
||||||
ESC_DEL = (1 << 1), // DEL -> "^?"
|
//ESC_DEL = (1 << 1), // DEL -> "^?"
|
||||||
ESC_LOW = (1 << 2), // values <= 26 mapped into "^[A-Z]"
|
//ESC_LOW = (1 << 2), // values <= 26 mapped into "^[A-Z]"
|
||||||
ESC_ESC = (1 << 3), // '\' -> "\\"
|
ESC_ESC = (1 << 3), // '\' -> "\\"
|
||||||
ESC_QUOT = (1 << 4), // '"' -> "\"", ''' -> "\'"
|
ESC_QUOT = (1 << 4), // '"' -> "\"", ''' -> "\'"
|
||||||
ESC_HEX = (1 << 5), // Not in [32, 126]? -> "%XX"
|
ESC_HEX = (1 << 5), // Not in [32, 126]? -> "%XX"
|
||||||
|
@ -89,7 +89,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int EXPANDED_STRING = // the original style
|
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
|
static const int BRO_STRING_LITERAL = // as in a Bro string literal
|
||||||
ESC_ESC | ESC_QUOT | ESC_HEX;
|
ESC_ESC | ESC_QUOT | ESC_HEX;
|
||||||
|
|
|
@ -182,10 +182,10 @@ void ODesc::AddBytes(const BroString* s)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int render_style = BroString::EXPANDED_STRING;
|
int render_style = BroString::EXPANDED_STRING;
|
||||||
if ( Style() == ALTERNATIVE_STYLE )
|
//if ( Style() == ALTERNATIVE_STYLE )
|
||||||
// Only change NULs, since we can't in any case
|
// // Only change NULs, since we can't in any case
|
||||||
// cope with them.
|
// // cope with them.
|
||||||
render_style = BroString::ESC_NULL;
|
// render_style = BroString::ESC_NULL;
|
||||||
|
|
||||||
const char* str = s->Render(render_style);
|
const char* str = s->Render(render_style);
|
||||||
Add(str);
|
Add(str);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue