Lines Matching refs:length
203 decode_segment(const unsigned char *seg, size_t length, unsigned char *buf) { in decode_segment() argument
205 while (length--) { in decode_segment()
210 seg += 2; length -= 2; in decode_segment()
225 check_segment(const unsigned char *s, size_t length) { in check_segment() argument
229 while (length) { in check_segment()
231 if (length < 2 || !(isxdigit(s[1]) && isxdigit(s[2]))) in check_segment()
235 length -= 2; in check_segment()
238 ++s; ++n; --length; in check_segment()
264 make_decoded_option(const unsigned char *s, size_t length, in make_decoded_option() argument
274 res = check_segment(s, length); in make_decoded_option()
294 decode_segment(s, length, buf); in make_decoded_option()
326 coap_split_path_impl(const unsigned char *s, size_t length, in coap_split_path_impl() argument
332 while (length > 0 && !strnchr((unsigned char *)"?#", 2, *q)) { in coap_split_path_impl()
343 length--; in coap_split_path_impl()
365 res = make_decoded_option(s, len, state->buf.s, state->buf.length); in write_option()
368 state->buf.length -= res; in write_option()
374 coap_split_path(const unsigned char *s, size_t length, in coap_split_path() argument
378 coap_split_path_impl(s, length, write_option, &tmp); in coap_split_path()
380 *buflen = *buflen - tmp.buf.length; in coap_split_path()
386 coap_split_query(const unsigned char *s, size_t length, in coap_split_query() argument
392 while (length > 0 && *s != '#') { in coap_split_query()
399 length--; in coap_split_query()
405 *buflen = *buflen - tmp.buf.length; in coap_split_query()
412 coap_new_uri(const unsigned char *uri, unsigned int length) { in coap_new_uri() argument
415 result = coap_malloc(length + 1 + sizeof(coap_uri_t)); in coap_new_uri()
420 memcpy(URI_DATA(result), uri, length); in coap_new_uri()
421 URI_DATA(result)[length] = '\0'; /* make it zero-terminated */ in coap_new_uri()
423 if (coap_split_uri(URI_DATA(result), length, (coap_uri_t *)result) < 0) { in coap_new_uri()
437 result = (coap_uri_t *)coap_malloc( uri->query.length + uri->host.length + in coap_clone_uri()
438 uri->path.length + sizeof(coap_uri_t) + 1); in coap_clone_uri()
447 if ( uri->host.length ) { in coap_clone_uri()
449 result->host.length = uri->host.length; in coap_clone_uri()
451 memcpy(result->host.s, uri->host.s, uri->host.length); in coap_clone_uri()
454 if ( uri->path.length ) { in coap_clone_uri()
455 result->path.s = URI_DATA(result) + uri->host.length; in coap_clone_uri()
456 result->path.length = uri->path.length; in coap_clone_uri()
458 memcpy(result->path.s, uri->path.s, uri->path.length); in coap_clone_uri()
461 if ( uri->query.length ) { in coap_clone_uri()
462 result->query.s = URI_DATA(result) + uri->host.length + uri->path.length; in coap_clone_uri()
463 result->query.length = uri->query.length; in coap_clone_uri()
465 memcpy(result->query.s, uri->query.s, uri->query.length); in coap_clone_uri()