Skip to content

Commit

Permalink
Tidy up decode-related headers
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurence Lundblade committed Dec 6, 2024
1 parent 41e40d5 commit d49d109
Show file tree
Hide file tree
Showing 17 changed files with 1,945 additions and 2,031 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ add_library(qcbor)
target_sources(qcbor
PRIVATE
src/ieee754.c
src/qcbor_decode.c
src/qcbor_main_decode.c
src/qcbor_spiffy_decode.c
src/qcbor_tag_decode.c
src/qcbor_number_decode.c
Expand Down
28 changes: 24 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ LIBS=-lm
CFLAGS=$(CMD_LINE) -I inc -I test -Os -fPIC


QCBOR_OBJ=src/UsefulBuf.o src/qcbor_encode.o src/qcbor_decode.o src/qcbor_spiffy_decode.o src/qcbor_number_decode.o src/qcbor_tag_decode.o src/ieee754.o src/qcbor_err_to_str.o
QCBOR_OBJ=src/UsefulBuf.o src/qcbor_encode.o src/qcbor_main_decode.o src/qcbor_spiffy_decode.o src/qcbor_number_decode.o src/qcbor_tag_decode.o src/ieee754.o src/qcbor_err_to_str.o

TEST_OBJ=test/UsefulBuf_Tests.o test/qcbor_encode_tests.o \
test/qcbor_decode_tests.o test/run_tests.o \
Expand Down Expand Up @@ -54,11 +54,31 @@ warn:
libqcbor.so: $(QCBOR_OBJ)
$(CC) -shared $^ $(CFLAGS) -o $@

PUBLIC_INTERFACE=inc/qcbor/UsefulBuf.h inc/qcbor/qcbor_private.h inc/qcbor/qcbor_common.h inc/qcbor/qcbor_encode.h inc/qcbor/qcbor_decode.h inc/qcbor/qcbor_spiffy_decode.h
PUBLIC_INTERFACE=inc/qcbor/UsefulBuf.h \
inc/qcbor/qcbor_private.h \
inc/qcbor/qcbor_common.h \
inc/qcbor/qcbor_encode.h \
inc/qcbor/qcbor_main_decode.h \
inc/qcbor/qcbor_spiffy_decode.h \
inc/qcbor/qcbor_tag_decode.h \
inc/qcbor/qcbor_number_decode.h

src/UsefulBuf.o: inc/qcbor/UsefulBuf.h
src/qcbor_encode.o: inc/qcbor/UsefulBuf.h inc/qcbor/qcbor_private.h inc/qcbor/qcbor_common.h inc/qcbor/qcbor_encode.h src/ieee754.h
src/qcbor_decode.o: inc/qcbor/UsefulBuf.h inc/qcbor/qcbor_private.h inc/qcbor/qcbor_common.h inc/qcbor/qcbor_decode.h inc/qcbor/qcbor_spiffy_decode.h src/ieee754.h

src/qcbor_encode.o: inc/qcbor/UsefulBuf.h \
inc/qcbor/qcbor_private.h \
inc/qcbor/qcbor_common.h \
inc/qcbor/qcbor_encode.h \
src/ieee754.h

src/qcbor_main_decode.o: inc/qcbor/UsefulBuf.h \
inc/qcbor/qcbor_private.h \
inc/qcbor/qcbor_common.h \
inc/qcbor/qcbor_main_decode.h \
inc/qcbor/qcbor_spiffy_decode.h \
src/decode_nesting.h \
src/ieee754.h

src/tag_decode.o: inc/qcbor/UsefulBuf.h inc/qcbor/qcbor_private.h inc/qcbor/qcbor_common.h inc/qcbor/qcbor_decode.h inc/qcbor/qcbor_tag_decode.h
src/number_decode.o: inc/qcbor/UsefulBuf.h inc/qcbor/qcbor_private.h inc/qcbor/qcbor_common.h inc/qcbor/qcbor_decode.h inc/qcbor/qcbor_tag_decode.h src/ieee754.h src/decode_private.h
src/iee754.o: src/ieee754.h
Expand Down
32 changes: 13 additions & 19 deletions QCBOR.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions inc/qcbor/UsefulBuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -1471,7 +1471,7 @@ static UsefulBuf UsefulOutBuf_RetrieveOutputStorage(UsefulOutBuf *pUOutBuf);
*
* @return 0 for equality, positive if uStart1 is lexographically larger,
* negative if uStart2 is lexographically larger.
*
*
* This looks into bytes that have been output at the offsets @c start1
* and @c start2. It compares bytes at those two starting points until
* they are not equal or @c uLen1 or @c uLen2 is reached. If the
Expand Down Expand Up @@ -1894,7 +1894,7 @@ static UsefulBufC UsefulInputBuf_RetrieveUndecodedInput(UsefulInputBuf *pUInBuf)
* @param[in] uLen2 Length of second range of bytes.
*
* This returns the same as UsefulBuf_Compare().
*
*
* If the offset or the length plus offset or a range extends outside
* the input buffer, that range of bytes will be considered greater
* than the other string. If both are outside this is considered a
Expand Down
10 changes: 7 additions & 3 deletions inc/qcbor/qcbor_common.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* ==========================================================================
* qcbor_common -- Common definitions for encding and decoding.
*
* Copyright (c) 2016-2018, The Linux Foundation.
* Copyright (c) 2018-2024, Laurence Lundblade.
* Copyright (c) 2021, Arm Limited.
Expand Down Expand Up @@ -30,6 +32,7 @@
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ========================================================================= */

#ifndef qcbor_common_h
#define qcbor_common_h

Expand Down Expand Up @@ -433,8 +436,9 @@ typedef enum {
QCBOR_ERR_TAGS_DISABLED = 51,

// TODO: maybe reduce number of conformance codes to not use up unrecoverable errors

/** Decoded CBOR is does not conform to preferred serialization. The CBOR head's argument is not encoded in shortest form, or indefinite lengths are used.*/

/** Decoded CBOR is does not conform to preferred serialization. The CBOR head's argument is not
* encoded in shortest form, or indefinite lengths are used. */
QCBOR_ERR_PREFERRED_CONFORMANCE = 52,

/** Decoded CBOR does not conform to CDE. This occurs when a map is not sorted. Other
Expand Down Expand Up @@ -569,7 +573,7 @@ typedef enum {
/** An unconsumed tag number was encountered. */
QCBOR_ERR_UNEXPECTED_TAG_NUMBER = 89, // TODO: rid of this in favor of below?

/** In QCBOR v2, tag numbers must be processed by QCBORDecode_GetNextTagNumber().
/** In QCBOR v2, tag numbers must be processed by QCBORDecode_GetNextTagNumber().
* See @ref QCBOR_DECODE_CONFIG_UNPROCESSED_TAG_NUMBERS. */
QCBOR_ERR_UNPROCESSED_TAG_NUMBER = 90,

Expand Down
Loading

0 comments on commit d49d109

Please sign in to comment.