Lines Matching defs:length

28  * A length-safe version of strchr(). This function returns a pointer
32 * @param len The length of @p s.
289 if (dst && uri->host.length) {
297 size_t uri_host_len = uri->host.length;
315 uri->host.length,
345 if (uri->path.length) {
346 if (uri->path.length > buflen)
349 res = coap_split_path(uri->path.s, uri->path.length, buf, &buflen);
363 if (uri->query.length) {
366 if (uri->query.length > buflen)
369 res = coap_split_query(uri->query.s, uri->query.length, buf, &buflen);
387 if (host->length >= 3 && host->s[0] == '%' &&
392 if (host->length >= 1 && host->s[0] == '/')
408 * of size @p length to @p buf. The caller of this function must
415 * @param length Length of @p seg.
419 decode_segment(const uint8_t *seg, size_t length, unsigned char *buf) {
421 while (length--) {
427 length -= 2;
443 check_segment(const uint8_t *s, size_t length, size_t *segment_size) {
446 while (length) {
448 if (length < 2 || !(isxdigit(s[1]) && isxdigit(s[2])))
452 length -= 2;
457 --length;
468 * object. The created option will have type @c 0, and the length
475 * @param length The size of the percent-encoded string @p s.
486 make_decoded_option(const uint8_t *s, size_t length,
497 res = check_segment(s, length, &segmentlen);
501 /* write option header using delta 0 and length res */
509 buf += written; /* advance past option type/length */
517 decode_segment(s, length, buf);
544 * @param length The length of @p s.
551 coap_split_path_impl(const uint8_t *s, size_t length,
557 while (length > 0 && !strnchr((const uint8_t *)"?#", 2, *q)) {
568 length--;
591 res = make_decoded_option(s, len, state->buf.s, state->buf.length, &optionsize);
594 state->buf.length -= optionsize;
600 coap_split_path(const uint8_t *s, size_t length,
604 coap_split_path_impl(s, length, write_option, &tmp);
606 *buflen = *buflen - tmp.buf.length;
612 coap_split_query(const uint8_t *s, size_t length,
618 while (length > 0 && *s != '#') {
625 length--;
631 *buflen = *buflen - tmp.buf.length;
638 coap_new_uri(const uint8_t *uri, unsigned int length) {
641 result = (unsigned char *)coap_malloc_type(COAP_STRING, length + 1 + sizeof(coap_uri_t));
646 memcpy(URI_DATA(result), uri, length);
647 URI_DATA(result)[length] = '\0'; /* make it zero-terminated */
649 if (coap_split_uri(URI_DATA(result), length, (coap_uri_t *)result) < 0) {
664 result = (coap_uri_t *)coap_malloc_type(COAP_STRING, uri->query.length + uri->host.length +
665 uri->path.length + sizeof(coap_uri_t) + 1);
674 if (uri->host.length) {
676 result->host.length = uri->host.length;
678 memcpy(p, uri->host.s, uri->host.length);
681 if (uri->path.length) {
682 result->path.s = p = URI_DATA(result) + uri->host.length;
683 result->path.length = uri->path.length;
685 memcpy(p, uri->path.s, uri->path.length);
688 if (uri->query.length) {
689 result->query.s = p = URI_DATA(result) + uri->host.length + uri->path.length;
690 result->query.length = uri->query.length;
692 memcpy(p, uri->query.s, uri->query.length);
723 size_t length = 0;
734 length += 1;
736 length += 3;
738 length += 1;
740 if (length > 0)
741 length -= 1;
742 if (length > 0) {
743 query = coap_new_string(length);
745 query->length = length;
774 size_t length = 0;
785 uri_path = coap_new_string(uri.path.length);
787 memcpy(uri_path->s, uri.path.s, uri.path.length);
800 length += 1;
802 length += 3;
805 length += 1;
808 if (length > 0)
809 length -= 1;
812 uri_path = coap_new_string(length);
814 uri_path->length = length;