@@ -45,10 +45,14 @@ void bin_unpack_free(Bin_Unpack *bu);
4545non_null () bool bin_unpack_array (Bin_Unpack * bu , uint32_t * size );
4646
4747/** @brief Start unpacking a fixed size MessagePack array.
48+ *
49+ * Fails if the array size is not the required size. If `actual_size` is passed a non-null
50+ * pointer, the array size is written there.
4851 *
4952 * @retval false if the packed array size is not exactly the required size.
5053 */
51- non_null () bool bin_unpack_array_fixed (Bin_Unpack * bu , uint32_t required_size );
54+ non_null (1 ) nullable (3 )
55+ bool bin_unpack_array_fixed (Bin_Unpack * bu , uint32_t required_size , uint32_t * actual_size );
5256
5357/** @brief Unpack a MessagePack bool. */
5458non_null () bool bin_unpack_bool (Bin_Unpack * bu , bool * val );
@@ -71,10 +75,16 @@ non_null() bool bin_unpack_nil(Bin_Unpack *bu);
7175 * large allocation unless the input array was already that large.
7276 */
7377non_null () bool bin_unpack_bin (Bin_Unpack * bu , uint8_t * * data_ptr , uint32_t * data_length_ptr );
78+ /** @brief Unpack a variable size MessagePack bin into a fixed size byte array.
79+ *
80+ * Stores unpacked data into `data` with its length stored in `data_length_ptr`. This function does
81+ * not allocate memory and requires that `max_data_length` is less than or equal to `sizeof(arr)`
82+ * when `arr` is passed as `data` pointer.
83+ */
84+ non_null () bool bin_unpack_bin_max (Bin_Unpack * bu , uint8_t * data , uint16_t * data_length_ptr , uint16_t max_data_length );
7485/** @brief Unpack a MessagePack bin of a fixed length into a pre-allocated byte array.
7586 *
76- * Unlike the function above, this function does not allocate any memory, but requires the size to
77- * be known up front.
87+ * Similar to the function above, but doesn't output the data length.
7888 */
7989non_null () bool bin_unpack_bin_fixed (Bin_Unpack * bu , uint8_t * data , uint32_t data_length );
8090
0 commit comments