mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-11-12 11:14:45 +01:00
Modified the offset parameter of template_context::execute() from pointer to reference.
This commit is contained in:
@@ -213,11 +213,11 @@ public:
|
|||||||
return user_;
|
return user_;
|
||||||
}
|
}
|
||||||
|
|
||||||
int execute(const char* data, size_t len, size_t* off)
|
int execute(const char* data, size_t len, size_t& off)
|
||||||
{
|
{
|
||||||
assert(len >= *off);
|
assert(len >= off);
|
||||||
|
|
||||||
const unsigned char* p = (unsigned char*)data + *off;
|
const unsigned char* p = (unsigned char*)data + off;
|
||||||
const unsigned char* const pe = (unsigned char*)data + len;
|
const unsigned char* const pe = (unsigned char*)data + len;
|
||||||
const void* n = nullptr;
|
const void* n = nullptr;
|
||||||
|
|
||||||
@@ -501,7 +501,7 @@ _end:
|
|||||||
cs_ = cs;
|
cs_ = cs;
|
||||||
trail_ = trail;
|
trail_ = trail;
|
||||||
top_ = top;
|
top_ = top;
|
||||||
*off = p - (const unsigned char*)data;
|
off = p - (const unsigned char*)data;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -850,7 +850,7 @@ inline bool unpacker::execute()
|
|||||||
inline int unpacker::execute_imp()
|
inline int unpacker::execute_imp()
|
||||||
{
|
{
|
||||||
size_t off = off_;
|
size_t off = off_;
|
||||||
int ret = ctx_.execute(buffer_, used_, &off_);
|
int ret = ctx_.execute(buffer_, used_, off_);
|
||||||
if(off_ > off) {
|
if(off_ > off) {
|
||||||
parsed_ += off_ - off;
|
parsed_ += off_ - off;
|
||||||
}
|
}
|
||||||
@@ -958,7 +958,7 @@ unpack_imp(const char* data, size_t len, size_t* off,
|
|||||||
ctx.user().set_z(result_zone);
|
ctx.user().set_z(result_zone);
|
||||||
ctx.user().set_referenced(false);
|
ctx.user().set_referenced(false);
|
||||||
|
|
||||||
int e = ctx.execute(data, len, &noff);
|
int e = ctx.execute(data, len, noff);
|
||||||
if(e < 0) {
|
if(e < 0) {
|
||||||
return UNPACK_PARSE_ERROR;
|
return UNPACK_PARSE_ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user