Porting recently introduced fix.
This commit is contained in:
parent
9606343b2c
commit
389f8b514e
|
@ -10,18 +10,18 @@ ParsedJson::~ParsedJson() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ParsedJson::ParsedJson(ParsedJson && p)
|
ParsedJson::ParsedJson(ParsedJson && p)
|
||||||
: bytecapacity(std::move(p.bytecapacity)),
|
: bytecapacity(std::move(p.bytecapacity)),
|
||||||
depthcapacity(std::move(p.depthcapacity)),
|
depthcapacity(std::move(p.depthcapacity)),
|
||||||
tapecapacity(std::move(p.tapecapacity)),
|
tapecapacity(std::move(p.tapecapacity)),
|
||||||
stringcapacity(std::move(p.stringcapacity)),
|
stringcapacity(std::move(p.stringcapacity)),
|
||||||
current_loc(std::move(p.current_loc)),
|
current_loc(std::move(p.current_loc)),
|
||||||
n_structural_indexes(std::move(p.n_structural_indexes)),
|
n_structural_indexes(std::move(p.n_structural_indexes)),
|
||||||
structural_indexes(std::move(p.structural_indexes)),
|
structural_indexes(std::move(p.structural_indexes)),
|
||||||
tape(std::move(p.tape)),
|
tape(std::move(p.tape)),
|
||||||
containing_scope_offset(std::move(p.containing_scope_offset)),
|
containing_scope_offset(std::move(p.containing_scope_offset)),
|
||||||
ret_address(std::move(p.ret_address)),
|
ret_address(std::move(p.ret_address)),
|
||||||
string_buf(std::move(p.string_buf)),
|
string_buf(std::move(p.string_buf)),
|
||||||
current_string_buf_loc(std::move(p.current_string_buf_loc)),
|
current_string_buf_loc(std::move(p.current_string_buf_loc)),
|
||||||
isvalid(std::move(p.isvalid)) {
|
isvalid(std::move(p.isvalid)) {
|
||||||
p.structural_indexes=NULL;
|
p.structural_indexes=NULL;
|
||||||
p.tape=NULL;
|
p.tape=NULL;
|
||||||
|
@ -50,7 +50,7 @@ bool ParsedJson::allocateCapacity(size_t len, size_t maxdepth) {
|
||||||
uint32_t max_structures = ROUNDUP_N(len, 64) + 2 + 7;
|
uint32_t max_structures = ROUNDUP_N(len, 64) + 2 + 7;
|
||||||
structural_indexes = new uint32_t[max_structures];
|
structural_indexes = new uint32_t[max_structures];
|
||||||
size_t localtapecapacity = ROUNDUP_N(len, 64);
|
size_t localtapecapacity = ROUNDUP_N(len, 64);
|
||||||
size_t localstringcapacity = ROUNDUP_N(len, 64);
|
size_t localstringcapacity = ROUNDUP_N(len + 32, 64);
|
||||||
string_buf = new uint8_t[localstringcapacity];
|
string_buf = new uint8_t[localstringcapacity];
|
||||||
tape = new uint64_t[localtapecapacity];
|
tape = new uint64_t[localtapecapacity];
|
||||||
containing_scope_offset = new uint32_t[maxdepth];
|
containing_scope_offset = new uint32_t[maxdepth];
|
||||||
|
@ -114,7 +114,7 @@ bool ParsedJson::printjson(std::ostream &os) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (howmany > tapecapacity) {
|
if (howmany > tapecapacity) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"We may be exceeding the tape capacity. Is this a valid document?\n");
|
"We may be exceeding the tape capacity. Is this a valid document?\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue