-
Notifications
You must be signed in to change notification settings - Fork 869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parsed bytes offset not updated when visitor returns false
#637
Comments
Hi @rcjmurillo ,
It's simply "if an error happens, do not update" policy.
Do you mean user can get the information where the error is occurred ? Let me consider the original behavior. If offset is NOT updated, and if the user get an error, the user doesn't have much options. At most one byte advance and retry :< Hence, I think that always updating the offset is acceptable breaking change. |
<<< Breaking change >>> In the functions unpack() and parse(), Old behavior: If any parse error is happend, offset is NOT updated. New behavior: If any parse error is happend, offset is updated to the position the error happened. It helps MessagePack format error analysis. If you want to old behavior, copy the original value of offset and then call unpack() and/or parse().
<<< Breaking change >>> In the functions unpack() and parse(), Old behavior: If any parse error is happend, offset is NOT updated. New behavior: If any parse error is happend, offset is updated to the position the error happened. It helps MessagePack format error analysis. If you want to old behavior, copy the original value of offset and then call unpack() and/or parse().
@rcjmurillo , I've just implemented the feature. Here is the test cases corresponding to visitor returns false: |
@rcjmurillo , does #639 work as you expected? |
merged. |
Hi, is there any particular reason of why the parsed bytes offset is not updated when the returned code is not
PARSE_SUCCESS
orPARSE_CONTINUE
? That's the case when the visitor returnsfalse
from any of it's methods, I'm needing this for a particular case but I think it could also be pretty useful to know the offset if the visitor stops the parse process.msgpack-c/include/msgpack/v2/parse.hpp
Lines 1023 to 1049 in b02c6be
The text was updated successfully, but these errors were encountered: