Differences From Artifact [387a1fe7bd]:
- File
src/OFString+URLEncoding.m
— part of check-in
[627511b032]
at
2020-11-14 12:23:55
on branch trunk
— Rename of_malloc and of_calloc
The new names should be more accurate. (user: js, size: 3583) [annotate] [blame] [check-ins using] [more...]
To Artifact [6ddd187364]:
- File src/OFString+URLEncoding.m — part of check-in [1b82d3bf4f] at 2021-03-07 20:25:21 on branch trunk — *.m: Fold methods into one line where it fits (user: js, size: 3471) [annotate] [blame] [check-ins using] [more...]
1 | /* | < < | | 1 2 3 4 5 6 7 8 9 | /* * Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * |
︙ | ︙ | |||
43 44 45 46 47 48 49 | methodForSelector: @selector(characterIsMember:)]; for (size_t i = 0; i < length; i++) { of_unichar_t c = characters[i]; if (characterIsMember(allowedCharacters, @selector(characterIsMember:), c)) | | < | < | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | methodForSelector: @selector(characterIsMember:)]; for (size_t i = 0; i < length; i++) { of_unichar_t c = characters[i]; if (characterIsMember(allowedCharacters, @selector(characterIsMember:), c)) [ret appendCharacters: &c length: 1]; else { char buffer[4]; size_t bufferLen; if ((bufferLen = of_string_utf8_encode(c, buffer)) == 0) @throw [OFInvalidEncodingException exception]; for (size_t j = 0; j < bufferLen; j++) { unsigned char byte = buffer[j]; unsigned char high = byte >> 4; unsigned char low = byte & 0x0F; char escaped[3]; escaped[0] = '%'; escaped[1] = (high > 9 ? high - 10 + 'A' : high + '0'); escaped[2] = (low > 9 ? low - 10 + 'A' : low + '0'); [ret appendUTF8String: escaped length: 3]; } } } objc_autoreleasePoolPop(pool); return ret; |
︙ | ︙ |