Skip to content

Commit

Permalink
split out spiffy decode source and DecodeNesting
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurence Lundblade committed Nov 29, 2024
1 parent 9fa48d8 commit 85e7011
Show file tree
Hide file tree
Showing 11 changed files with 1,862 additions and 1,734 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ target_sources(qcbor
PRIVATE
src/ieee754.c
src/qcbor_decode.c
src/qcbor_spiffy_decode.c
src/qcbor_tag_decode.c
src/qcbor_number_decode.c
src/qcbor_encode.c
Expand Down
2 changes: 1 addition & 1 deletion 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_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_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
6 changes: 6 additions & 0 deletions QCBOR.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
0FA9BEBA216DC7AD00BA646B /* qcbor_encode_tests.c in Sources */ = {isa = PBXBuildFile; fileRef = 0FA9BEB8216DC7AD00BA646B /* qcbor_encode_tests.c */; };
0FA9BEBD216DE31700BA646B /* UsefulBuf_Tests.c in Sources */ = {isa = PBXBuildFile; fileRef = 0FA9BEBC216DE31700BA646B /* UsefulBuf_Tests.c */; };
E7180F232CF1657B00513186 /* qcbor_number_decode.c in Sources */ = {isa = PBXBuildFile; fileRef = E7180F222CF1657A00513186 /* qcbor_number_decode.c */; };
E7180F262CF8F2EB00513186 /* qcbor_spiffy_decode.c in Sources */ = {isa = PBXBuildFile; fileRef = E7180F252CF8F2EB00513186 /* qcbor_spiffy_decode.c */; };
E73B57592161CA690080D658 /* ieee754.c in Sources */ = {isa = PBXBuildFile; fileRef = E73B57582161CA690080D658 /* ieee754.c */; };
E73B575E2161CA7C0080D658 /* float_tests.c in Sources */ = {isa = PBXBuildFile; fileRef = E73B575A2161CA7C0080D658 /* float_tests.c */; };
E73B575F2161CA7C0080D658 /* half_to_double_from_rfc7049.c in Sources */ = {isa = PBXBuildFile; fileRef = E73B575D2161CA7C0080D658 /* half_to_double_from_rfc7049.c */; };
Expand Down Expand Up @@ -161,6 +162,8 @@
E7180F212CF1638F00513186 /* decode_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = decode_private.h; path = src/decode_private.h; sourceTree = "<group>"; };
E7180F222CF1657A00513186 /* qcbor_number_decode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = qcbor_number_decode.c; path = src/qcbor_number_decode.c; sourceTree = "<group>"; };
E7180F242CF2390100513186 /* qcbor_number_decode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = qcbor_number_decode.h; path = inc/qcbor/qcbor_number_decode.h; sourceTree = "<group>"; };
E7180F252CF8F2EB00513186 /* qcbor_spiffy_decode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = qcbor_spiffy_decode.c; path = src/qcbor_spiffy_decode.c; sourceTree = "<group>"; };
E7180F272CF917D200513186 /* decode_nesting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = decode_nesting.h; path = src/decode_nesting.h; sourceTree = "<group>"; };
E73B57572161CA680080D658 /* ieee754.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.c.h; name = ieee754.h; path = src/ieee754.h; sourceTree = "<group>"; tabWidth = 3; };
E73B57582161CA690080D658 /* ieee754.c */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.c.c; name = ieee754.c; path = src/ieee754.c; sourceTree = "<group>"; tabWidth = 3; };
E73B575A2161CA7C0080D658 /* float_tests.c */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.c.c; name = float_tests.c; path = test/float_tests.c; sourceTree = "<group>"; tabWidth = 3; };
Expand Down Expand Up @@ -294,8 +297,10 @@
children = (
E776E08D214AE07500E67947 /* UsefulBuf.c */,
E776E08C214AE07400E67947 /* qcbor_encode.c */,
E7180F272CF917D200513186 /* decode_nesting.h */,
E7180F212CF1638F00513186 /* decode_private.h */,
E776E08E214AE07500E67947 /* qcbor_decode.c */,
E7180F252CF8F2EB00513186 /* qcbor_spiffy_decode.c */,
E7180F222CF1657A00513186 /* qcbor_number_decode.c */,
E7CA1F1D2C8C337E0008F454 /* qcbor_tag_decode.c */,
E73B57572161CA680080D658 /* ieee754.h */,
Expand Down Expand Up @@ -564,6 +569,7 @@
E7C960B92800A09E00FB537C /* ub-example.c in Sources */,
E743D0F324AD08020017899F /* example.c in Sources */,
0FA9BEBD216DE31700BA646B /* UsefulBuf_Tests.c in Sources */,
E7180F262CF8F2EB00513186 /* qcbor_spiffy_decode.c in Sources */,
E7180F232CF1657B00513186 /* qcbor_number_decode.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
2 changes: 0 additions & 2 deletions inc/qcbor/qcbor_decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -1437,8 +1437,6 @@ void
QCBORDecode_CompatibilityV1(QCBORDecodeContext *pCtx);




/* ========================================================================= *
* END OF DEPRECATED FUNCTIONS *
* ========================================================================= */
Expand Down
40 changes: 22 additions & 18 deletions inc/qcbor/qcbor_number_decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -1401,15 +1401,15 @@ QCBORDecode_GetBigFloatBigInMapSZ(QCBORDecodeContext *pCtx,
* ========================================================================= */


/* Semi-private funcion used by public inline functions. See qcbor_decode.c */
/* Semi-private funcion used by public inline functions. See qcbor_number_decode.c */
void
QCBORDecode_Private_GetUInt64Convert(QCBORDecodeContext *pCtx,
uint32_t uConvertTypes,
uint64_t *puValue,
QCBORItem *pItem);


/* Semi-private funcion used by public inline functions. See qcbor_decode.c */
/* Semi-private funcion used by public inline functions. See qcbor_number_decode.c */
void
QCBORDecode_Private_GetUInt64ConvertInMapN(QCBORDecodeContext *pCtx,
int64_t nLabel,
Expand All @@ -1418,30 +1418,30 @@ QCBORDecode_Private_GetUInt64ConvertInMapN(QCBORDecodeContext *pCtx,
QCBORItem *pItem);


/* Semi-private funcion used by public inline functions. See qcbor_decode.c */
/* Semi-private funcion used by public inline functions. See qcbor_number_decode.c */
void
QCBORDecode_Private_GetUInt64ConvertInMapSZ(QCBORDecodeContext *pCtx,
const char *szLabel,
uint32_t uConvertTypes,
uint64_t *puValue,
QCBORItem *pItem);

/* Semi-private funcion used by public inline functions. See qcbor_decode.c */
/* Semi-private funcion used by public inline functions. See qcbor_number_decode.c */
void
QCBORDecode_Private_GetInt64Convert(QCBORDecodeContext *pCtx,
uint32_t uConvertTypes,
int64_t *pnValue,
QCBORItem *pItem);

/* Semi-private funcion used by public inline functions. See qcbor_decode.c */
/* Semi-private funcion used by public inline functions. See qcbor_number_decode.c */
void
QCBORDecode_Private_GetInt64ConvertInMapN(QCBORDecodeContext *pCtx,
int64_t nLabel,
uint32_t uConvertTypes,
int64_t *pnValue,
QCBORItem *pItem);

/* Semi-private funcion used by public inline functions. See qcbor_decode.c */
/* Semi-private funcion used by public inline functions. See qcbor_number_decode.c */
void
QCBORDecode_Private_GetInt64ConvertInMapSZ(QCBORDecodeContext *pCtx,
const char *szLabel,
Expand All @@ -1451,22 +1451,22 @@ QCBORDecode_Private_GetInt64ConvertInMapSZ(QCBORDecodeContext *pCtx,


#ifndef USEFULBUF_DISABLE_ALL_FLOAT
/* Semi-private funcion used by public inline functions. See qcbor_decode.c */
/* Semi-private funcion used by public inline functions. See qcbor_number_decode.c */
void
QCBORDecode_Private_GetDoubleConvert(QCBORDecodeContext *pCtx,
uint32_t uConvertTypes,
double *pValue,
QCBORItem *pItem);

/* Semi-private funcion used by public inline functions. See qcbor_decode.c */
/* Semi-private funcion used by public inline functions. See qcbor_number_decode.c */
void
QCBORDecode_Private_GetDoubleConvertInMapN(QCBORDecodeContext *pCtx,
int64_t nLabel,
uint32_t uConvertTypes,
double *pdValue,
QCBORItem *pItem);

/* Semi-private funcion used by public inline functions. See qcbor_decode.c */
/* Semi-private funcion used by public inline functions. See qcbor_number_decode.c */
void
QCBORDecode_Private_GetDoubleConvertInMapSZ(QCBORDecodeContext *pCtx,
const char *szLabel,
Expand All @@ -1476,14 +1476,16 @@ QCBORDecode_Private_GetDoubleConvertInMapSZ(QCBORDecodeContext *pCtx,
#endif /* ! USEFULBUF_DISABLE_ALL_FLOAT */


/* Semi-private funcion used by public inline functions. See qcbor_decode.c */
/* Semi-private funcion used by public inline functions. See qcbor_tag_decode.c */
void
QCBORDecode_Private_GetTaggedString(QCBORDecodeContext *pMe,
uint8_t uTagRequirement,
uint8_t uQCBOR_Type,
uint64_t uTagNumber,
UsefulBufC *pBstr);


/* Semi-private funcion used by public inline functions. See qcbor_tag_decode.c */
void
QCBORDecode_Private_GetTaggedStringInMapN(QCBORDecodeContext *pMe,
const int64_t nLabel,
Expand All @@ -1493,11 +1495,7 @@ QCBORDecode_Private_GetTaggedStringInMapN(QCBORDecodeContext *pMe,
UsefulBufC *pString);







/* Semi-private funcion used by public inline functions. See qcbor_tag_decode.c */
void
QCBORDecode_Private_GetTaggedStringInMapSZ(QCBORDecodeContext *pMe,
const char *szLabel,
Expand Down Expand Up @@ -1650,7 +1648,7 @@ QCBORDecode_GetDoubleConvert(QCBORDecodeContext *pMe,
double *pdValue)
{
QCBORItem Item;
QCBORDecode_Private_GetDoubleConvert(pMe, uConvertTypes, pdValue, &Item);
QCBORDecode_Private_GetDoubleConvert(pMe, uConvertTypes, pdValue, &Item);
}

static inline void
Expand Down Expand Up @@ -1684,7 +1682,7 @@ QCBORDecode_GetDoubleConvertInMapSZ(QCBORDecodeContext *pMe,
static inline void
QCBORDecode_GetDouble(QCBORDecodeContext *pMe, double *pValue)
{
QCBORDecode_GetDoubleConvert(pMe, QCBOR_CONVERT_TYPE_FLOAT, pValue);
QCBORDecode_GetDoubleConvert(pMe, QCBOR_CONVERT_TYPE_FLOAT, pValue);
}

static inline void
Expand Down Expand Up @@ -1805,7 +1803,13 @@ QCBORDecode_GetDecimalFractionBigInMapN(QCBORDecodeContext *pMe,
bool *pbMantissaIsNegative,
int64_t *pnExponent)
{
QCBORDecode_GetTDecimalFractionBigMantissaRawInMapN(pMe, nLabel, uTagRequirement, MantissaBuffer, pMantissa, pbMantissaIsNegative, pnExponent);
QCBORDecode_GetTDecimalFractionBigMantissaRawInMapN(pMe,
nLabel,
uTagRequirement,
MantissaBuffer,
pMantissa,
pbMantissaIsNegative,
pnExponent);
}

static inline void /* Deprecated */
Expand Down
Loading

0 comments on commit 85e7011

Please sign in to comment.