Overview
Comment: | Replace OFASN1Boolean with bool OFNumber |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | asn1 |
Files: | files | file ages | folders |
SHA3-256: |
90ee6a8373259b60c0b97753a0320531 |
User & Date: | js on 2024-01-14 13:00:50 |
Original Comment: | Replace OFASN1Boolean with bool OFValue |
Other Links: | branch diff | manifest | tags |
Context
2024-01-14
| ||
13:24 | Replace OFASN1Integer with long long OFNumber check-in: 523aea1c7b user: js tags: asn1 | |
13:00 | Replace OFASN1Boolean with bool OFNumber check-in: 90ee6a8373 user: js tags: asn1 | |
2024-01-11
| ||
20:12 | Merge trunk into branch "asn1" check-in: 4320b1bf7d user: js tags: asn1 | |
Changes
Modified src/Makefile from [58eab480cd] to [fd6e700a0b].
︙ | ︙ | |||
8 9 10 11 12 13 14 | STATIC_LIB = ${OBJFW_STATIC_LIB} FRAMEWORK = ${OBJFW_FRAMEWORK} LIB_MAJOR = ${OBJFW_LIB_MAJOR} LIB_MINOR = ${OBJFW_LIB_MINOR} LIB_PATCH = ${OBJFW_LIB_PATCH} SRCS = OFASN1BitString.m \ | < | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | STATIC_LIB = ${OBJFW_STATIC_LIB} FRAMEWORK = ${OBJFW_FRAMEWORK} LIB_MAJOR = ${OBJFW_LIB_MAJOR} LIB_MINOR = ${OBJFW_LIB_MINOR} LIB_PATCH = ${OBJFW_LIB_PATCH} SRCS = OFASN1BitString.m \ OFASN1Enumerated.m \ OFASN1IA5String.m \ OFASN1Integer.m \ OFASN1NumericString.m \ OFASN1ObjectIdentifier.m \ OFASN1OctetString.m \ OFASN1PrintableString.m \ |
︙ | ︙ |
Deleted src/OFASN1Boolean.h version [b9c65fd898].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted src/OFASN1Boolean.m version [574b738a35].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Modified src/OFData+ASN1DERParsing.m from [b0aa916c3e] to [d08f994c7d].
︙ | ︙ | |||
13 14 15 16 17 18 19 | * file. */ #include "config.h" #import "OFData+ASN1DERParsing.h" #import "OFASN1BitString.h" | < > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | * file. */ #include "config.h" #import "OFData+ASN1DERParsing.h" #import "OFASN1BitString.h" #import "OFASN1Enumerated.h" #import "OFASN1IA5String.h" #import "OFASN1Integer.h" #import "OFASN1NumericString.h" #import "OFASN1ObjectIdentifier.h" #import "OFASN1OctetString.h" #import "OFASN1PrintableString.h" #import "OFASN1UTF8String.h" #import "OFASN1Value.h" #import "OFArray.h" #import "OFNull.h" #import "OFNumber.h" #import "OFSet.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFOutOfRangeException.h" #import "OFTruncatedDataException.h" |
︙ | ︙ | |||
155 156 157 158 159 160 161 | @throw [OFTruncatedDataException exception]; contents = [self subdataWithRange: OFMakeRange(bytesConsumed, contentsLength)]; bytesConsumed += contentsLength; switch (tag & ~tagConstructedMask) { | | > | > > | > > > > > > > > > > | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | @throw [OFTruncatedDataException exception]; contents = [self subdataWithRange: OFMakeRange(bytesConsumed, contentsLength)]; bytesConsumed += contentsLength; switch (tag & ~tagConstructedMask) { case OFASN1TagNumberBoolean:; unsigned char boolValue; if (tag & tagConstructedMask) @throw [OFInvalidFormatException exception]; if (contents.count != 1) @throw [OFInvalidFormatException exception]; boolValue = *(unsigned char *)[contents itemAtIndex: 0]; if (boolValue != 0 && boolValue != 0xFF) @throw [OFInvalidFormatException exception]; *object = [OFNumber numberWithBool: boolValue]; return bytesConsumed; case OFASN1TagNumberInteger: valueClass = [OFASN1Integer class]; break; case OFASN1TagNumberBitString: valueClass = [OFASN1BitString class]; break; case OFASN1TagNumberOctetString: |
︙ | ︙ |
Modified src/OFNumber.h from [e8b2d0d74a] to [bed7e6a8c1].
︙ | ︙ | |||
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #include "objfw-defs.h" #ifdef OF_HAVE_SYS_TYPES_H # include <sys/types.h> #endif #import "OFJSONRepresentation.h" #import "OFMessagePackRepresentation.h" #import "OFValue.h" OF_ASSUME_NONNULL_BEGIN /** @file */ /** * @class OFNumber OFNumber.h ObjFW/OFNumber.h * * @brief Provides a way to store a number in an object. */ | > | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | #include "objfw-defs.h" #ifdef OF_HAVE_SYS_TYPES_H # include <sys/types.h> #endif #import "OFASN1DERRepresentation.h" #import "OFJSONRepresentation.h" #import "OFMessagePackRepresentation.h" #import "OFValue.h" OF_ASSUME_NONNULL_BEGIN /** @file */ /** * @class OFNumber OFNumber.h ObjFW/OFNumber.h * * @brief Provides a way to store a number in an object. */ @interface OFNumber: OFValue <OFComparing, OFASN1DERRepresentation, OFJSONRepresentation, OFMessagePackRepresentation> /** * @brief The OFNumber as a `bool`. */ @property (readonly, nonatomic) bool boolValue; /** * @brief The OFNumber as a `signed char`. |
︙ | ︙ |
Modified src/OFNumber.m from [e5b90c57f3] to [f54894ca09].
︙ | ︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #import "OFConcreteNumber.h" #import "OFData.h" #import "OFString.h" #import "OFTaggedPointerNumber.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFOutOfRangeException.h" @interface OFNumber () - (OFString *) of_JSONRepresentationWithOptions: (OFJSONRepresentationOptions)options depth: (size_t)depth; @end | > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #import "OFConcreteNumber.h" #import "OFData.h" #import "OFString.h" #import "OFTaggedPointerNumber.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFNotImplementedException.h" #import "OFOutOfRangeException.h" @interface OFNumber () - (OFString *) of_JSONRepresentationWithOptions: (OFJSONRepresentationOptions)options depth: (size_t)depth; @end |
︙ | ︙ | |||
706 707 708 709 710 711 712 713 714 715 716 717 718 719 | return [OFString stringWithFormat: @"%lld", self.longLongValue]; if (isUnsigned(self)) return [OFString stringWithFormat: @"%llu", self.unsignedLongLongValue]; @throw [OFInvalidFormatException exception]; } - (OFString *)JSONRepresentation { return [self of_JSONRepresentationWithOptions: 0 depth: 0]; } - (OFString *)JSONRepresentationWithOptions: | > > > > > > > > > > > > > > > | 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 | return [OFString stringWithFormat: @"%lld", self.longLongValue]; if (isUnsigned(self)) return [OFString stringWithFormat: @"%llu", self.unsignedLongLongValue]; @throw [OFInvalidFormatException exception]; } - (OFData *)ASN1DERRepresentation { if (self.objCType[0] == 'B' && self.objCType[1] == '\0') { char buffer[] = { OFASN1TagNumberBoolean, 1, (self.boolValue ? 0xFF : 0x00) }; return [OFData dataWithItems: buffer count: sizeof(buffer)]; } else @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; } - (OFString *)JSONRepresentation { return [self of_JSONRepresentationWithOptions: 0 depth: 0]; } - (OFString *)JSONRepresentationWithOptions: |
︙ | ︙ |
Modified src/ObjFW.h from [010bad87c9] to [72efcf8773].
︙ | ︙ | |||
141 142 143 144 145 146 147 | #import "OFMatrix4x4.h" #ifdef OF_WINDOWS # import "OFWindowsRegistryKey.h" #endif #import "OFASN1BitString.h" | < | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | #import "OFMatrix4x4.h" #ifdef OF_WINDOWS # import "OFWindowsRegistryKey.h" #endif #import "OFASN1BitString.h" #import "OFASN1Enumerated.h" #import "OFASN1IA5String.h" #import "OFASN1Integer.h" #import "OFASN1NumericString.h" #import "OFASN1ObjectIdentifier.h" #import "OFASN1OctetString.h" #import "OFASN1PrintableString.h" |
︙ | ︙ |
Modified tests/OFASN1DERRepresentationTests.m from [08cf18d206] to [40dae6ed10].
︙ | ︙ | |||
36 37 38 39 40 41 42 | ASN1DERRepresentation] isEqual: [OFData dataWithItems: "\x03\x0D\x00" "abcdefäöü" count: 15]] && (data = [OFData dataWithItems: "" count: 0]) && [[[OFASN1BitString bitStringWithBitString: data length: 0] ASN1DERRepresentation] isEqual: [OFData dataWithItems: "\x03\x01\x00" count: 3]]) | | | | | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | ASN1DERRepresentation] isEqual: [OFData dataWithItems: "\x03\x0D\x00" "abcdefäöü" count: 15]] && (data = [OFData dataWithItems: "" count: 0]) && [[[OFASN1BitString bitStringWithBitString: data length: 0] ASN1DERRepresentation] isEqual: [OFData dataWithItems: "\x03\x01\x00" count: 3]]) module = @"OFNumber"; TEST(@"-[ASN1DERRepresentation] for bool", [[[OFNumber numberWithBool: false] ASN1DERRepresentation] isEqual: [OFData dataWithItems: "\x01\x01\x00" count: 3]] && [[[OFNumber numberWithBool: true] ASN1DERRepresentation] isEqual: [OFData dataWithItems: "\x01\x01\xFF" count: 3]]) module = @"OFNull"; TEST(@"-[OFASN1DERRepresentation]", [[[OFNull null] ASN1DERRepresentation] isEqual: [OFData dataWithItems: "\x05\x00" count: 2]]) objc_autoreleasePoolPop(pool); } @end |