mirror of
https://github.com/Z3Prover/z3
synced 2025-06-13 01:16:15 +00:00
fix part of #5519
generation of escape sequences for output was not handling non-printable character ranges correctly and also not offsetting hexadecimal characters right.
This commit is contained in:
parent
7c782a7ef8
commit
90f98d5791
1 changed files with 6 additions and 2 deletions
|
@ -187,14 +187,18 @@ extern "C" {
|
||||||
svector<char> buff;
|
svector<char> buff;
|
||||||
for (unsigned i = 0; i < str.length(); ++i) {
|
for (unsigned i = 0; i < str.length(); ++i) {
|
||||||
unsigned ch = str[i];
|
unsigned ch = str[i];
|
||||||
if (ch >= 256) {
|
if (ch <= 32 || ch >= 127) {
|
||||||
buff.reset();
|
buff.reset();
|
||||||
buffer.push_back('\\');
|
buffer.push_back('\\');
|
||||||
buffer.push_back('\\'); // possibly replace by native non-escaped version?
|
buffer.push_back('\\'); // possibly replace by native non-escaped version?
|
||||||
buffer.push_back('u');
|
buffer.push_back('u');
|
||||||
buffer.push_back('{');
|
buffer.push_back('{');
|
||||||
while (ch > 0) {
|
while (ch > 0) {
|
||||||
buff.push_back('0' + (ch & 0xF));
|
unsigned d = ch & 0xF;
|
||||||
|
if (d < 10)
|
||||||
|
buff.push_back('0' + d);
|
||||||
|
else
|
||||||
|
buff.push_back('a' + (d - 10));
|
||||||
ch /= 16;
|
ch /= 16;
|
||||||
}
|
}
|
||||||
for (unsigned j = buff.size(); j-- > 0; ) {
|
for (unsigned j = buff.size(); j-- > 0; ) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue