mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
Refactor various hex escaping code.
This commit is contained in:
parent
80d7a1482c
commit
e8a5ea8844
7 changed files with 102 additions and 60 deletions
|
@ -122,10 +122,8 @@ bool Ascii::Describe(ODesc* desc, threading::Value* val, const string& name) con
|
|||
// place-holder we use for unset optional fields. We
|
||||
// escape the first character so that the output
|
||||
// won't be ambigious.
|
||||
static const char hex_chars[] = "0123456789abcdef";
|
||||
char hex[6] = "\\x00";
|
||||
hex[2] = hex_chars[((*data) & 0xf0) >> 4];
|
||||
hex[3] = hex_chars[(*data) & 0x0f];
|
||||
char hex[4] = {'\\', 'x', '0', '0'};
|
||||
bytetohex(*data, hex + 2);
|
||||
desc->AddRaw(hex, 4);
|
||||
|
||||
++data;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue