} else {
/* If context is not given, be security-conscious anyway */
memset(&s_codec_ctx, 0, sizeof(s_codec_ctx));
- s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX;
+ s_codec_ctx.max_stack_size = ASN__DEFAULT_STACK_MAX;
opt_codec_ctx = &s_codec_ctx;
}
if(ret < 0) return -1;
if(arg.callback_not_invoked) {
assert(ret == 0); /* No data was consumed */
+ *ch_type = PXER_WMORE;
return 0; /* Try again with more data */
} else {
assert(arg.chunk_size);
case PXML_TEXT:
*ch_type = PXER_TEXT;
break;
- case PXML_TAG: return 0; /* Want more */
+ case PXML_TAG:
+ *ch_type = PXER_WMORE;
+ return 0; /* Want more */
case PXML_TAG_END:
*ch_type = PXER_TAG;
break;
if(size < 2 || buf[0] != LANGLE || buf[size-1] != RANGLE) {
if(size >= 2)
- ASN_DEBUG("Broken XML tag: \"%c...%c\"", buf[0], buf[size - 1]);
+ ASN_DEBUG("Broken XML tag: \"%c...%c\"",
+ buf[0], buf[size - 1]);
return XCT_BROKEN;
}
*/
ch_size = xer_next_token(&ctx->context, buf_ptr, size,
&ch_type);
- switch(ch_size) {
- case -1: RETURN(RC_FAIL);
- case 0:
- RETURN(RC_WMORE);
- default:
+ if(ch_size == -1) {
+ RETURN(RC_FAIL);
+ } else {
switch(ch_type) {
+ case PXER_WMORE:
+ RETURN(RC_WMORE);
case PXER_COMMENT: /* Got XML comment */
ADVANCE(ch_size); /* Skip silently */
continue;
}
-int
-xer_is_whitespace(const void *chunk_buf, size_t chunk_size) {
+size_t
+xer_whitespace_span(const void *chunk_buf, size_t chunk_size) {
const char *p = (const char *)chunk_buf;
const char *pend = p + chunk_size;
* SPACE (32)
*/
case 0x09: case 0x0a: case 0x0d: case 0x20:
- break;
+ continue;
default:
- return 0;
+ break;
}
+ break;
}
- return 1; /* All whitespace */
+ return (p - (const char *)chunk_buf);
}
/*