mirror of
git://git.psyc.eu/libpsyc
synced 2024-08-15 03:19:02 +00:00
Merge branch 'master' of supraverse.net:libpsyc
This commit is contained in:
commit
811156f98d
2 changed files with 7 additions and 0 deletions
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
/// Parse only the header
|
||||||
PSYC_PARSE_HEADER_ONLY = 1,
|
PSYC_PARSE_HEADER_ONLY = 1,
|
||||||
/// Expects only the content part of a packet. The length of the content must fit exactly in this case
|
/// Expects only the content part of a packet. The length of the content must fit exactly in this case
|
||||||
PSYC_PARSE_BEGIN_AT_CONTENT = 2,
|
PSYC_PARSE_BEGIN_AT_CONTENT = 2,
|
||||||
|
@ -32,6 +33,8 @@ typedef enum
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
/// Invalid combination of flags
|
||||||
|
PSYC_PARSE_ERROR_INVALID_FLAGS = -10,
|
||||||
PSYC_PARSE_ERROR_END = -9,
|
PSYC_PARSE_ERROR_END = -9,
|
||||||
PSYC_PARSE_ERROR_BODY = -8,
|
PSYC_PARSE_ERROR_BODY = -8,
|
||||||
PSYC_PARSE_ERROR_METHOD = -7,
|
PSYC_PARSE_ERROR_METHOD = -7,
|
||||||
|
|
|
@ -136,6 +136,10 @@ inline psycParseRC psyc_parseName(psycParseState* state, psycString* name)
|
||||||
*/
|
*/
|
||||||
inline psycParseRC psyc_parseBinaryValue(psycParseState* state, psycString* value, size_t* length, size_t* parsed)
|
inline psycParseRC psyc_parseBinaryValue(psycParseState* state, psycString* value, size_t* length, size_t* parsed)
|
||||||
{
|
{
|
||||||
|
if (state->flags & PSYC_PARSE_HEADER_ONLY &&
|
||||||
|
state->flags & PSYC_PARSE_BEGIN_AT_CONTENT)
|
||||||
|
return PSYC_PARSE_ERROR_INVALID_FLAGS;
|
||||||
|
|
||||||
size_t remaining = *length - *parsed;
|
size_t remaining = *length - *parsed;
|
||||||
value->ptr = state->buffer.ptr + state->cursor;
|
value->ptr = state->buffer.ptr + state->cursor;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue