ObjFW  Check-in [4fc1f15ab2]

Overview
Comment:Allow numbers for of_dns_{class,record_type}_parse
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4fc1f15ab2c55415c38b45e2bcc7b26aa50a042a50d1ba4f52aaf0edd27c394f
User & Date: js on 2019-12-14 19:00:31
Other Links: manifest | tags
Context
2019-12-15
14:42
Make +[OFSecureData isSecure] per instance check-in: 60caadeb5d user: js tags: trunk
2019-12-14
19:00
Allow numbers for of_dns_{class,record_type}_parse check-in: 4fc1f15ab2 user: js tags: trunk
18:48
OFNumber: Add -[stringValue] check-in: f5558d0919 user: js tags: trunk
Changes

Modified src/OFDNSResourceRecord.m from [817897253d] to [38d9eb9459].

74
75
76
77
78
79
80
81




82


83
84
85
86
87
88
89
74
75
76
77
78
79
80

81
82
83
84
85
86
87
88
89
90
91
92
93
94







-
+
+
+
+

+
+







	void *pool = objc_autoreleasePoolPush();
	of_dns_class_t DNSClass;

	string = string.uppercaseString;

	if ([string isEqual: @"IN"])
		DNSClass = OF_DNS_CLASS_IN;
	else
	else {
		@try {
			DNSClass = (of_dns_class_t)[string decimalValue];
		} @catch (OFInvalidFormatException *e) {
		@throw [OFInvalidArgumentException exception];
		}
	}

	objc_autoreleasePoolPop(pool);

	return DNSClass;
}

of_dns_record_type_t of_dns_record_type_parse(OFString *string)
111
112
113
114
115
116
117
118





119


120
121
122
123
124
125
126
116
117
118
119
120
121
122

123
124
125
126
127
128
129
130
131
132
133
134
135
136
137







-
+
+
+
+
+

+
+







		recordType = OF_DNS_RECORD_TYPE_TXT;
	else if ([string isEqual: @"RP"])
		recordType = OF_DNS_RECORD_TYPE_RP;
	else if ([string isEqual: @"AAAA"])
		recordType = OF_DNS_RECORD_TYPE_AAAA;
	else if ([string isEqual: @"SRV"])
		recordType = OF_DNS_RECORD_TYPE_SRV;
	else
	else {
		@try {
			recordType =
			    (of_dns_record_type_t)[string decimalValue];
		} @catch (OFInvalidFormatException *e) {
		@throw [OFInvalidArgumentException exception];
		}
	}

	objc_autoreleasePoolPop(pool);

	return recordType;
}

@implementation OFDNSResourceRecord