1
0
Fork 0
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:
tg(x) 2011-04-30 16:06:58 +02:00
commit 811156f98d
2 changed files with 7 additions and 0 deletions

View file

@ -21,6 +21,7 @@
typedef enum
{
/// Parse only the header
PSYC_PARSE_HEADER_ONLY = 1,
/// 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,
@ -32,6 +33,8 @@ typedef enum
*/
typedef enum
{
/// Invalid combination of flags
PSYC_PARSE_ERROR_INVALID_FLAGS = -10,
PSYC_PARSE_ERROR_END = -9,
PSYC_PARSE_ERROR_BODY = -8,
PSYC_PARSE_ERROR_METHOD = -7,

View file

@ -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)
{
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;
value->ptr = state->buffer.ptr + state->cursor;