Truncate bytes when output them to string.
GitOrigin-RevId: 07e394956b13579ad54c47ba02f0507e55feb9c3
This commit is contained in:
parent
5b4b54a177
commit
3fad0a7693
@ -6,6 +6,7 @@
|
|||||||
//
|
//
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "td/utils/common.h"
|
||||||
#include "td/utils/int_types.h"
|
#include "td/utils/int_types.h"
|
||||||
#include "td/utils/logging.h"
|
#include "td/utils/logging.h"
|
||||||
#include "td/utils/misc.h"
|
#include "td/utils/misc.h"
|
||||||
@ -221,13 +222,19 @@ class TlStorerToString {
|
|||||||
result.append("bytes [");
|
result.append("bytes [");
|
||||||
store_long(static_cast<int64>(value.size()));
|
store_long(static_cast<int64>(value.size()));
|
||||||
result.append("] { ");
|
result.append("] { ");
|
||||||
for (size_t i = 0; i < value.size(); i++) {
|
size_t len = min(static_cast<size_t>(64), value.size());
|
||||||
|
for (size_t i = 0; i < len; i++) {
|
||||||
int b = value[static_cast<int>(i)] & 0xff;
|
int b = value[static_cast<int>(i)] & 0xff;
|
||||||
result += hex[b >> 4];
|
result += hex[b >> 4];
|
||||||
result += hex[b & 15];
|
result += hex[b & 15];
|
||||||
result += ' ';
|
if (i != len) {
|
||||||
|
result += ' ';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
result.append("}");
|
if (len < value.size()) {
|
||||||
|
result.append(" ...");
|
||||||
|
}
|
||||||
|
result += '}';
|
||||||
store_field_end();
|
store_field_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user