This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit b9e9544ec3c0ee7ead72ac974436a82cf4cde146
Author: Christopher Collins <ccoll...@apache.org>
AuthorDate: Fri May 10 12:51:32 2019 -0700

    encoding/tinycbor: encode indefinite text strings
    
    There was already a function to encode indefinite length byte strings.
    This commit adds a text string counterpart.
---
 encoding/tinycbor/include/tinycbor/cbor.h |  1 +
 encoding/tinycbor/src/cborencoder.c       | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/encoding/tinycbor/include/tinycbor/cbor.h 
b/encoding/tinycbor/include/tinycbor/cbor.h
index ce45d5b..9ef16c0 100644
--- a/encoding/tinycbor/include/tinycbor/cbor.h
+++ b/encoding/tinycbor/include/tinycbor/cbor.h
@@ -215,6 +215,7 @@ CBOR_INLINE_API CborError cbor_encode_double(CborEncoder 
*encoder, double value)
 
 CBOR_API CborError cbor_encoder_create_array(CborEncoder *encoder, CborEncoder 
*arrayEncoder, size_t length);
 CBOR_API CborError cbor_encoder_create_map(CborEncoder *encoder, CborEncoder 
*mapEncoder, size_t length);
+CBOR_API CborError cbor_encoder_create_indef_text_string(CborEncoder *encoder, 
CborEncoder *stringEncoder);
 CBOR_API CborError cbor_encoder_create_indef_byte_string(CborEncoder *encoder, 
CborEncoder *stringEncoder);
 CBOR_API CborError cbor_encoder_close_container(CborEncoder *encoder, const 
CborEncoder *containerEncoder);
 CBOR_API CborError cbor_encoder_close_container_checked(CborEncoder *encoder, 
const CborEncoder *containerEncoder);
diff --git a/encoding/tinycbor/src/cborencoder.c 
b/encoding/tinycbor/src/cborencoder.c
index ab19b54..3827a84 100644
--- a/encoding/tinycbor/src/cborencoder.c
+++ b/encoding/tinycbor/src/cborencoder.c
@@ -522,6 +522,20 @@ CborError cbor_encoder_create_map(CborEncoder *encoder, 
CborEncoder *mapEncoder,
 }
 
 /**
+ * Creates a indefinite-length text string in the CBOR stream provided by
+ * \a encoder and initializes \a stringEncoder so that chunks of original 
string
+ * can be added using the CborEncoder functions. The string must be terminated 
by
+ * calling cbor_encoder_close_container() with the same \a encoder and
+ * \a stringEncoder parameters.
+ *
+ * \sa cbor_encoder_create_array
+ */
+CborError cbor_encoder_create_indef_text_string(CborEncoder *encoder, 
CborEncoder *stringEncoder)
+{
+    return create_container(encoder, stringEncoder, CborIndefiniteLength, 
TextStringType << MajorTypeShift);
+}
+
+/**
  * Creates a indefinite-length byte string in the CBOR stream provided by
  * \a encoder and initializes \a stringEncoder so that chunks of original 
string
  * can be added using the CborEncoder functions. The string must be terminated 
by

Reply via email to