Home
last modified time | relevance | path

Searched refs:buffer (Results 1 – 16 of 16) sorted by relevance

/tinycbor-2.7.6/tools/json2cbor/
Djson2cbor.c41 uint8_t *buffer; variable
58 uint8_t *buffer = malloc(*len); in decode_base64_generic() local
59 if (buffer == NULL) in decode_base64_generic()
62 uint8_t *out = buffer; in decode_base64_generic()
97 free(buffer); in decode_base64_generic()
100 *len = out - buffer; in decode_base64_generic()
101 return buffer; in decode_base64_generic()
154 uint8_t *buffer = malloc(*len); in decode_base16() local
155 if (buffer == NULL) in decode_base16()
161 buffer[i] = (c - '0') << 4; in decode_base16()
[all …]
/tinycbor-2.7.6/src/
Dcbor_buf_reader.c27 return cb->buffer[offset]; in cbuf_buf_reader_get8()
34 return get16(cb->buffer + offset); in cbuf_buf_reader_get16()
42 val = get32(cb->buffer + offset); in cbuf_buf_reader_get32()
50 return get64(cb->buffer + offset); in cbuf_buf_reader_get64()
58 return memcmp(dst, cb->buffer + src_offset, len) == 0; in cbor_buf_reader_cmp()
66 return (uintptr_t) memcpy(dst, cb->buffer + src_offset, len); in cbor_buf_reader_cpy()
70 cbor_buf_reader_init(struct cbor_buf_reader *cb, const uint8_t *buffer, in cbor_buf_reader_init() argument
73 cb->buffer = buffer; in cbor_buf_reader_init()
Dcborparser_dup_string.c92 CborError _cbor_value_dup_string(const CborValue *value, void **buffer, size_t *buflen, CborValue *… in _cbor_value_dup_string() argument
94 assert(buffer); in _cbor_value_dup_string()
102 *buffer = malloc(*buflen); in _cbor_value_dup_string()
103 if (!*buffer) { in _cbor_value_dup_string()
107 err = _cbor_value_copy_string(value, *buffer, buflen, next); in _cbor_value_dup_string()
109 free(*buffer); in _cbor_value_dup_string()
Dcborpretty.c116 static int hexDump(FILE *out, const uint8_t *buffer, size_t n) in hexDump() argument
119 int r = fprintf(out, "%02" PRIx8, *buffer++); in hexDump()
128 static int utf8EscapedDump(FILE *out, const char *buffer, size_t n) in utf8EscapedDump() argument
132 uc = (uint8_t)*buffer++; in utf8EscapedDump()
198 uint8_t b = (uint8_t)*buffer++; in utf8EscapedDump()
206 b = (uint8_t)*buffer++; in utf8EscapedDump()
214 b = (uint8_t)*buffer++; in utf8EscapedDump()
331 uint8_t *buffer; in value_to_pretty() local
332 err = cbor_value_dup_byte_string(it, &buffer, &n, it); in value_to_pretty()
336 … bool failed = fprintf(out, "h'") < 0 || hexDump(out, buffer, n) < 0 || fprintf(out, "'") < 0; in value_to_pretty()
[all …]
Dcbor_buf_writer.c48 cbor_buf_writer_init(struct cbor_buf_writer *cb, uint8_t *buffer, size_t size) in cbor_buf_writer_init() argument
50 cb->ptr = buffer; in cbor_buf_writer_init()
51 cb->end = buffer + size; in cbor_buf_writer_init()
57 cbor_buf_writer_buffer_size(struct cbor_buf_writer *cb, const uint8_t *buffer) in cbor_buf_writer_buffer_size() argument
59 return (size_t)(cb->ptr - buffer); in cbor_buf_writer_buffer_size()
Dcbortojson.c180 uint8_t *buffer; in dump_bytestring_base16() local
186 buffer = (uint8_t *)malloc(n * 2 + 1); in dump_bytestring_base16()
187 *result = (char *)buffer; in dump_bytestring_base16()
191 err = cbor_value_copy_byte_string(it, buffer + n - 1, &n, it); in dump_bytestring_base16()
195 uint8_t byte = buffer[n + i]; in dump_bytestring_base16()
196 buffer[2*i] = characters[byte >> 4]; in dump_bytestring_base16()
197 buffer[2*i + 1] = characters[byte & 0xf]; in dump_bytestring_base16()
205 uint8_t *buffer, *out, *in; in generic_dump_base64() local
212 out = buffer = (uint8_t *)malloc(len + 1); in generic_dump_base64()
213 *result = (char *)buffer; in generic_dump_base64()
[all …]
Dcborparser.c923 static CborError iterate_string_chunks(const CborValue *value, char *buffer, size_t *buflen, in iterate_string_chunks() argument
939 *result = !!func(value->parser->d, buffer, offset, total); in iterate_string_chunks()
978 *result = !!func(value->parser->d, buffer + total, offset, chunkLen); in iterate_string_chunks()
993 if(buffer) { in iterate_string_chunks()
994 *(buffer + total) = '\0'; in iterate_string_chunks()
1072 CborError _cbor_value_copy_string(const CborValue *value, void *buffer, in _cbor_value_copy_string() argument
1076 CborError err = iterate_string_chunks(value, (char*)buffer, buflen, &copied_all, next, in _cbor_value_copy_string()
1077buffer ? (IterateFunction) value->parser->d->cpy : iterate_noop); in _cbor_value_copy_string()
Dcborvalidation.c273 const uint8_t *buffer = (const uint8_t *)ptr; in validate_utf8_string() local
274 const uint8_t * const end = buffer + n; in validate_utf8_string()
275 while (buffer < end) { in validate_utf8_string()
276 uint32_t uc = get_utf8(&buffer, end); in validate_utf8_string()
/tinycbor-2.7.6/include/tinycbor/
Dutf8_p.h32 static inline uint32_t get_utf8(const uint8_t **buffer, const uint8_t *end) in get_utf8() argument
35 ptrdiff_t n = end - *buffer; in get_utf8()
39 uc = *(*buffer)++; in get_utf8()
73 uint8_t b = *(*buffer)++; in get_utf8()
81 b = *(*buffer)++; in get_utf8()
89 b = *(*buffer)++; in get_utf8()
Dcbor_buf_reader.h32 const uint8_t *buffer; member
35 void cbor_buf_reader_init(struct cbor_buf_reader *cb, const uint8_t *buffer,
Dcbor_buf_writer.h33 void cbor_buf_writer_init(struct cbor_buf_writer *cb, uint8_t *buffer,
36 const uint8_t *buffer);
Dcbor.h397 CBOR_PRIVATE_API CborError _cbor_value_copy_string(const CborValue *value, void *buffer,
399 CBOR_PRIVATE_API CborError _cbor_value_dup_string(const CborValue *value, void **buffer,
404 CBOR_INLINE_API CborError cbor_value_copy_text_string(const CborValue *value, char *buffer, in cbor_value_copy_text_string() argument
408 return _cbor_value_copy_string(value, buffer, buflen, next); in cbor_value_copy_text_string()
410 CBOR_INLINE_API CborError cbor_value_copy_byte_string(const CborValue *value, uint8_t *buffer, in cbor_value_copy_byte_string() argument
414 return _cbor_value_copy_string(value, buffer, buflen, next); in cbor_value_copy_byte_string()
417 CBOR_INLINE_API CborError cbor_value_dup_text_string(const CborValue *value, char **buffer, in cbor_value_dup_text_string() argument
421 return _cbor_value_dup_string(value, (void **)buffer, buflen, next); in cbor_value_dup_text_string()
423 CBOR_INLINE_API CborError cbor_value_dup_byte_string(const CborValue *value, uint8_t **buffer, in cbor_value_dup_byte_string() argument
427 return _cbor_value_dup_string(value, (void **)buffer, buflen, next); in cbor_value_dup_byte_string()
/tinycbor-2.7.6/tools/cbordump/
Dcbordump.c55 static uint8_t *buffer = NULL; in dumpFile() local
60 buffer = xrealloc(buffer, bufsize += chunklen, fname); in dumpFile()
62 size_t n = fread(buffer + buflen, 1, bufsize - buflen, in); in dumpFile()
74 CborError err = cbor_parser_init(buffer, buflen, 0, &parser, &value); in dumpFile()
/tinycbor-2.7.6/tests/encoder/
Dtst_encoder.cpp278 QByteArray buffer(output.length(), Qt::Uninitialized); in compare() local
279 uint8_t *bufptr = reinterpret_cast<quint8 *>(buffer.data()); in compare()
281 cbor_encoder_init(&encoder, bufptr, buffer.length(), 0); in compare()
287 buffer.resize(int(cbor_encoder_get_buffer_size(&encoder, bufptr))); in compare()
288 QCOMPARE(buffer, output); in compare()
643 QByteArray buffer(output.length(), Qt::Uninitialized); in shortBuffer() local
647 cbor_encoder_init(&encoder, reinterpret_cast<quint8 *>(buffer.data()), len, 0); in shortBuffer()
658 QByteArray buffer(output.length() + 1, Qt::Uninitialized); in tooShortArrays() local
661 cbor_encoder_init(&encoder, reinterpret_cast<quint8 *>(buffer.data()), buffer.length(), 0); in tooShortArrays()
672 QByteArray buffer(output.length() + 1, Qt::Uninitialized); in tooShortMaps() local
[all …]
/tinycbor-2.7.6/tests/tojson/
Dtst_tojson.cpp200 char *buffer; in parseOne() local
203 FILE *f = open_memstream(&buffer, &size); in parseOne()
207 *parsed = QString::fromLatin1(buffer); in parseOne()
208 free(buffer); in parseOne()
/tinycbor-2.7.6/tests/parser/
Dtst_parser.cpp933 QByteArray buffer(n, Qt::Uninitialized); in chunkedStringTest() local
936 err = cbor_value_copy_byte_string(&copy, (uint8_t *)buffer.data(), &n, nullptr); in chunkedStringTest()
938 QCOMPARE(int(n), buffer.size()); in chunkedStringTest()
940 formatted = QString::fromLatin1("h'" + buffer.toHex() + '\''); in chunkedStringTest()
942 err = cbor_value_copy_text_string(&copy, buffer.data(), &n, nullptr); in chunkedStringTest()
944 QCOMPARE(int(n), buffer.size()); in chunkedStringTest()
946 formatted = '"' + QString::fromUtf8(buffer.data(), n) + '"'; in chunkedStringTest()