Overview
Comment: | OFURL: Improve nil handling for queryDictionary |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
a847536ef244948b20779a3d939d9df6 |
User & Date: | js on 2020-10-04 01:13:28 |
Other Links: | manifest | tags |
Context
2020-10-04
| ||
09:53 | Fix missing import check-in: 40fe98125b user: js tags: trunk | |
01:13 | OFURL: Improve nil handling for queryDictionary check-in: a847536ef2 user: js tags: trunk | |
2020-10-03
| ||
23:25 | OFURL: Add queryDictionary property check-in: a151f9c31f user: js tags: trunk | |
Changes
Modified src/OFMutableURL.m from [714703bda1] to [60338f9042].
︙ | ︙ | |||
233 234 235 236 237 238 239 | _URLEncodedQuery = [URLEncodedQuery copy]; [old release]; } - (void)setQueryDictionary: (OFDictionary OF_GENERIC(OFString *, OFString *) *)dictionary { | > > > > > > > > > > > > | | | | < | < | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | _URLEncodedQuery = [URLEncodedQuery copy]; [old release]; } - (void)setQueryDictionary: (OFDictionary OF_GENERIC(OFString *, OFString *) *)dictionary { void *pool; OFMutableString *URLEncodedQuery; OFEnumerator OF_GENERIC(OFString *) *keyEnumerator, *objectEnumerator; OFCharacterSet *characterSet; OFString *key, *object, *old; if (dictionary == nil) { [_URLEncodedQuery release]; _URLEncodedQuery = nil; return; } pool = objc_autoreleasePoolPush(); URLEncodedQuery = [OFMutableString string]; keyEnumerator = [dictionary keyEnumerator]; objectEnumerator = [dictionary objectEnumerator]; characterSet = [OFCharacterSet URLQueryKeyValueAllowedCharacterSet]; while ((key = [keyEnumerator nextObject]) != nil && (object = [objectEnumerator nextObject]) != nil) { key = [key stringByURLEncodingWithAllowedCharacters: characterSet]; object = [object stringByURLEncodingWithAllowedCharacters: characterSet]; |
︙ | ︙ |
Modified src/OFURL.m from [529e3fc99f] to [5cd00eb456].
︙ | ︙ | |||
1034 1035 1036 1037 1038 1039 1040 | - (OFString *)URLEncodedQuery { return _URLEncodedQuery; } - (OFDictionary OF_GENERIC(OFString *, OFString *) *)queryDictionary { | > > > > > > > | | < | | 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 | - (OFString *)URLEncodedQuery { return _URLEncodedQuery; } - (OFDictionary OF_GENERIC(OFString *, OFString *) *)queryDictionary { void *pool; OFArray OF_GENERIC(OFString *) *pairs; OFMutableDictionary OF_GENERIC(OFString *, OFString *) *ret; if (_URLEncodedQuery == nil) return nil; pool = objc_autoreleasePoolPush(); pairs = [_URLEncodedQuery componentsSeparatedByString: @"&"]; ret = [OFMutableDictionary dictionaryWithCapacity: pairs.count]; for (OFString *pair in pairs) { OFArray *parts = [pair componentsSeparatedByString: @"="]; if (parts.count != 2) @throw [OFInvalidFormatException exception]; |
︙ | ︙ |