mirror of
git://git.psyc.eu/libpsyc
synced 2024-08-15 03:19:02 +00:00
fixed bug in bin-var parsing
This commit is contained in:
parent
472314568f
commit
a96f01f355
2 changed files with 26 additions and 26 deletions
48
src/parser.c
48
src/parser.c
|
@ -307,19 +307,8 @@ inline int PSYC_parseElement(
|
||||||
*vlength= dlength - *cursor -3;
|
*vlength= dlength - *cursor -3;
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
*vlength=0;
|
*vlength=0;
|
||||||
while(1)
|
while(1)
|
||||||
{
|
|
||||||
if(dlength<=++(*cursor)) // incremented cursor inside lenght?
|
|
||||||
{
|
|
||||||
*cursor=startc; // set to start value
|
|
||||||
return 1; // return insufficient
|
|
||||||
}
|
|
||||||
|
|
||||||
if(0 == method && data[*cursor] == '\n')
|
|
||||||
break;
|
|
||||||
|
|
||||||
if(1 == method && data[*cursor] == '|')
|
|
||||||
{
|
{
|
||||||
if(dlength<=++(*cursor)) // incremented cursor inside lenght?
|
if(dlength<=++(*cursor)) // incremented cursor inside lenght?
|
||||||
{
|
{
|
||||||
|
@ -327,15 +316,26 @@ inline int PSYC_parseElement(
|
||||||
return 1; // return insufficient
|
return 1; // return insufficient
|
||||||
}
|
}
|
||||||
|
|
||||||
/* packet finishes here */
|
if(0 == method && data[*cursor] == '\n')
|
||||||
if(data[*cursor] == '\n')
|
break;
|
||||||
{
|
|
||||||
*cursor+=1;
|
if(1 == method && data[*cursor] == '|')
|
||||||
return 3;
|
{
|
||||||
|
if(dlength<=++(*cursor)) // incremented cursor inside lenght?
|
||||||
|
{
|
||||||
|
*cursor=startc; // set to start value
|
||||||
|
return 1; // return insufficient
|
||||||
|
}
|
||||||
|
|
||||||
|
/* packet finishes here */
|
||||||
|
if(data[*cursor] == '\n')
|
||||||
|
{
|
||||||
|
*cursor+=1;
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
++(*vlength);
|
||||||
++(*vlength);
|
}}
|
||||||
}}
|
|
||||||
}
|
}
|
||||||
}else if(inHeader == 0 && method==0 && data[*cursor] == ' ') // oi, its a binary var!
|
}else if(inHeader == 0 && method==0 && data[*cursor] == ' ') // oi, its a binary var!
|
||||||
{ // after SP the length follows.
|
{ // after SP the length follows.
|
||||||
|
@ -355,7 +355,7 @@ inline int PSYC_parseElement(
|
||||||
// after the length a TAB follows
|
// after the length a TAB follows
|
||||||
if(data[*cursor] != '\t')
|
if(data[*cursor] != '\t')
|
||||||
return -8;
|
return -8;
|
||||||
|
|
||||||
// now we have the length. convert it to int
|
// now we have the length. convert it to int
|
||||||
int binLength = atoi(bin_length_str);
|
int binLength = atoi(bin_length_str);
|
||||||
// is that still in this buffer?
|
// is that still in this buffer?
|
||||||
|
@ -365,9 +365,9 @@ inline int PSYC_parseElement(
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*value = data + *cursor;
|
*value = data + *cursor+1;
|
||||||
*vlength=binLength;
|
*vlength=binLength;
|
||||||
*cursor += binLength;
|
*cursor += binLength+1;
|
||||||
}else
|
}else
|
||||||
return -8;
|
return -8;
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,9 @@ _request_context_enter
|
||||||
:_target psyc://p5B084547.dip.t-dialin.net/@test
|
:_target psyc://p5B084547.dip.t-dialin.net/@test
|
||||||
|
|
||||||
:_more vars
|
:_more vars
|
||||||
:_bin 4 1
|
:_bin 6 "1
|
||||||
3
|
3
|
||||||
|
"
|
||||||
:_entity variablevalue
|
:_entity variablevalue
|
||||||
_notice_context_leave
|
_notice_context_leave
|
||||||
|
|
|
|
||||||
|
|
Loading…
Reference in a new issue