1
0
Fork 0
mirror of git://git.psyc.eu/libpsyc synced 2024-08-15 03:19:02 +00:00

s/binary/length

This commit is contained in:
Gabor Adam Toth 2011-04-22 20:22:20 +02:00
parent ec76ea765e
commit 83e18a5f4a
2 changed files with 8 additions and 8 deletions

View file

@ -10,9 +10,9 @@
typedef enum
{
PSYC_RENDER_CHECK_BINARY = 0,
PSYC_RENDER_BINARY = 1,
PSYC_RENDER_NOT_BINARY = 2,
PSYC_RENDER_CHECK_LENGTH = 0,
PSYC_RENDER_NEED_LENGTH = 1,
PSYC_RENDER_NO_LENGTH = 2,
PSYC_RENDER_ROUTING = 3,
} PSYC_RenderFlag;

View file

@ -51,17 +51,17 @@ PSYC_RenderRC PSYC_renderBody(PSYC_RenderState* state,
const char* method, size_t mlength,
const char* data, size_t dlength)
{
if (state->flag == PSYC_RENDER_CHECK_BINARY)
if (state->flag == PSYC_RENDER_CHECK_LENGTH)
{
// find out if this packet needs a prepended length
if (dlength == 1 && data[0] == C_GLYPH_PACKET_DELIMITER)
state->flag = PSYC_RENDER_BINARY;
state->flag = PSYC_RENDER_NEED_LENGTH;
else if (dlength > 404)
state->flag = PSYC_RENDER_BINARY;
state->flag = PSYC_RENDER_NEED_LENGTH;
else if (memmem(data, dlength, PSYC_PACKET_DELIMITER, sizeof(PSYC_PACKET_DELIMITER)))
state->flag = PSYC_RENDER_BINARY;
state->flag = PSYC_RENDER_NEED_LENGTH;
else
state->flag = PSYC_RENDER_NOT_BINARY;
state->flag = PSYC_RENDER_NO_LENGTH;
}
// TBD