Option to disable indefinite length string decoding (#61)
No semantic or interface changes.
Allows #define of QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS to disable handling of indefinite length strings and the memory pool saving 400 bytes of object code.
Also some minor code improvements and lots of improvements to comments on code that handles indefinite length strings.
Co-authored-by: Laurence Lundblade <lgl@securitytheory.com>
diff --git a/QCBOR.xcodeproj/project.pbxproj b/QCBOR.xcodeproj/project.pbxproj
index 1983591..9733eb7 100644
--- a/QCBOR.xcodeproj/project.pbxproj
+++ b/QCBOR.xcodeproj/project.pbxproj
@@ -56,6 +56,19 @@
E776E091214AE07500E67947 /* qcbor_decode.c in Sources */ = {isa = PBXBuildFile; fileRef = E776E08E214AE07500E67947 /* qcbor_decode.c */; };
E776E097214AE0C700E67947 /* cmd_line_main.c in Sources */ = {isa = PBXBuildFile; fileRef = E776E096214AE0C700E67947 /* cmd_line_main.c */; };
E7864766252CE63100A0C11B /* qcbor_err_to_str.c in Sources */ = {isa = PBXBuildFile; fileRef = E7864765252CE63100A0C11B /* qcbor_err_to_str.c */; };
+ E7FDBF04256C969D007138A8 /* qcbor_encode.c in Sources */ = {isa = PBXBuildFile; fileRef = E776E08C214AE07400E67947 /* qcbor_encode.c */; };
+ E7FDBF05256C969D007138A8 /* ieee754.c in Sources */ = {isa = PBXBuildFile; fileRef = E73B57582161CA690080D658 /* ieee754.c */; };
+ E7FDBF06256C969D007138A8 /* qcbor_err_to_str.c in Sources */ = {isa = PBXBuildFile; fileRef = E7864765252CE63100A0C11B /* qcbor_err_to_str.c */; };
+ E7FDBF07256C969D007138A8 /* half_to_double_from_rfc7049.c in Sources */ = {isa = PBXBuildFile; fileRef = E73B575D2161CA7C0080D658 /* half_to_double_from_rfc7049.c */; };
+ E7FDBF08256C969D007138A8 /* run_tests.c in Sources */ = {isa = PBXBuildFile; fileRef = E73B57632161F8F70080D658 /* run_tests.c */; };
+ E7FDBF09256C969D007138A8 /* qcbor_decode.c in Sources */ = {isa = PBXBuildFile; fileRef = E776E08E214AE07500E67947 /* qcbor_decode.c */; };
+ E7FDBF0A256C969D007138A8 /* float_tests.c in Sources */ = {isa = PBXBuildFile; fileRef = E73B575A2161CA7C0080D658 /* float_tests.c */; };
+ E7FDBF0B256C969D007138A8 /* qcbor_decode_tests.c in Sources */ = {isa = PBXBuildFile; fileRef = 0FA9BEB5216CE6CA00BA646B /* qcbor_decode_tests.c */; };
+ E7FDBF0C256C969D007138A8 /* UsefulBuf.c in Sources */ = {isa = PBXBuildFile; fileRef = E776E08D214AE07500E67947 /* UsefulBuf.c */; };
+ E7FDBF0D256C969D007138A8 /* qcbor_encode_tests.c in Sources */ = {isa = PBXBuildFile; fileRef = 0FA9BEB8216DC7AD00BA646B /* qcbor_encode_tests.c */; };
+ E7FDBF0E256C969D007138A8 /* cmd_line_main.c in Sources */ = {isa = PBXBuildFile; fileRef = E776E096214AE0C700E67947 /* cmd_line_main.c */; };
+ E7FDBF0F256C969D007138A8 /* example.c in Sources */ = {isa = PBXBuildFile; fileRef = E743D0E124AC516D0017899F /* example.c */; };
+ E7FDBF10256C969D007138A8 /* UsefulBuf_Tests.c in Sources */ = {isa = PBXBuildFile; fileRef = 0FA9BEBC216DE31700BA646B /* UsefulBuf_Tests.c */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@@ -95,6 +108,15 @@
);
runOnlyForDeploymentPostprocessing = 1;
};
+ E7FDBF12256C969D007138A8 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = /usr/share/man/man1/;
+ dstSubfolderSpec = 0;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
@@ -134,6 +156,7 @@
E78C91DF240C90C100F4CECE /* qcbor_common.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.c.h; name = qcbor_common.h; path = inc/qcbor/qcbor_common.h; sourceTree = "<group>"; tabWidth = 3; };
E78C91E0240C90C100F4CECE /* qcbor_private.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.c.h; name = qcbor_private.h; path = inc/qcbor/qcbor_private.h; sourceTree = "<group>"; tabWidth = 3; };
E78C91E1240C90C100F4CECE /* qcbor_encode.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.c.h; name = qcbor_encode.h; path = inc/qcbor/qcbor_encode.h; sourceTree = "<group>"; tabWidth = 3; };
+ E7FDBF16256C969D007138A8 /* QCBOR_Disable_Indef */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = QCBOR_Disable_Indef; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -165,6 +188,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ E7FDBF11256C969D007138A8 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
@@ -199,6 +229,7 @@
E772022723B52C02006E966E /* QCBOR_Disable_Exp_Mantissa */,
E743D11B24DD4EF50017899F /* QCBOR_Disable_HW_Float */,
E743D13124DE05CC0017899F /* QCBOR_Disable_Preferred_Float */,
+ E7FDBF16256C969D007138A8 /* QCBOR_Disable_Indef */,
);
name = Products;
sourceTree = "<group>";
@@ -321,6 +352,23 @@
productReference = E776E07C214ADF7F00E67947 /* QCBOR */;
productType = "com.apple.product-type.tool";
};
+ E7FDBF02256C969D007138A8 /* QCBOR_Disable_Indef */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = E7FDBF13256C969D007138A8 /* Build configuration list for PBXNativeTarget "QCBOR_Disable_Indef" */;
+ buildPhases = (
+ E7FDBF03256C969D007138A8 /* Sources */,
+ E7FDBF11256C969D007138A8 /* Frameworks */,
+ E7FDBF12256C969D007138A8 /* CopyFiles */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = QCBOR_Disable_Indef;
+ productName = QCBOR;
+ productReference = E7FDBF16256C969D007138A8 /* QCBOR_Disable_Indef */;
+ productType = "com.apple.product-type.tool";
+ };
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -352,6 +400,7 @@
E772021523B52C02006E966E /* QCBOR_Disable_Exp_Mantissa */,
E743D10924DD4EF50017899F /* QCBOR_Disable_HW_Float */,
E743D11E24DE05CC0017899F /* QCBOR_Disable_Preferred_Float */,
+ E7FDBF02256C969D007138A8 /* QCBOR_Disable_Indef */,
);
};
/* End PBXProject section */
@@ -434,6 +483,26 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ E7FDBF03256C969D007138A8 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ E7FDBF04256C969D007138A8 /* qcbor_encode.c in Sources */,
+ E7FDBF05256C969D007138A8 /* ieee754.c in Sources */,
+ E7FDBF06256C969D007138A8 /* qcbor_err_to_str.c in Sources */,
+ E7FDBF07256C969D007138A8 /* half_to_double_from_rfc7049.c in Sources */,
+ E7FDBF08256C969D007138A8 /* run_tests.c in Sources */,
+ E7FDBF09256C969D007138A8 /* qcbor_decode.c in Sources */,
+ E7FDBF0A256C969D007138A8 /* float_tests.c in Sources */,
+ E7FDBF0B256C969D007138A8 /* qcbor_decode_tests.c in Sources */,
+ E7FDBF0C256C969D007138A8 /* UsefulBuf.c in Sources */,
+ E7FDBF0D256C969D007138A8 /* qcbor_encode_tests.c in Sources */,
+ E7FDBF0E256C969D007138A8 /* cmd_line_main.c in Sources */,
+ E7FDBF0F256C969D007138A8 /* example.c in Sources */,
+ E7FDBF10256C969D007138A8 /* UsefulBuf_Tests.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
@@ -670,6 +739,35 @@
};
name = Release;
};
+ E7FDBF14256C969D007138A8 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CLANG_UNDEFINED_BEHAVIOR_SANITIZER_INTEGER = YES;
+ CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES;
+ CODE_SIGN_STYLE = Automatic;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS;
+ GCC_TREAT_WARNINGS_AS_ERRORS = YES;
+ GCC_WARN_PEDANTIC = YES;
+ "HEADER_SEARCH_PATHS[arch=*]" = inc;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ E7FDBF15256C969D007138A8 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CLANG_UNDEFINED_BEHAVIOR_SANITIZER_INTEGER = YES;
+ CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES;
+ CODE_SIGN_STYLE = Automatic;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_TREAT_WARNINGS_AS_ERRORS = YES;
+ GCC_WARN_PEDANTIC = YES;
+ "HEADER_SEARCH_PATHS[arch=*]" = inc;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -718,6 +816,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
+ E7FDBF13256C969D007138A8 /* Build configuration list for PBXNativeTarget "QCBOR_Disable_Indef" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ E7FDBF14256C969D007138A8 /* Debug */,
+ E7FDBF15256C969D007138A8 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
/* End XCConfigurationList section */
};
rootObject = E776E074214ADF7F00E67947 /* Project object */;