ObjFW  Diff

Differences From Artifact [7c362d8c35]:

To Artifact [46a599b120]:


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
39
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
39







-
+







-
+

-
-
+
+







 */

#include "config.h"

#include <stdlib.h>
#include <string.h>

#import "OFString+URLEncoding.h"
#import "OFString+PercentEncoding.h"
#import "OFCharacterSet.h"

#import "OFInvalidFormatException.h"
#import "OFInvalidEncodingException.h"
#import "OFOutOfMemoryException.h"

/* Reference for static linking */
int _OFString_URLEncoding_reference;
int _OFString_PercentEncoding_reference;

@implementation OFString (URLEncoding)
- (OFString *)stringByURLEncodingWithAllowedCharacters:
@implementation OFString (PercentEncoding)
- (OFString *)stringByAddingPercentEncodingWithAllowedCharacters:
    (OFCharacterSet *)allowedCharacters
{
	OFMutableString *ret = [OFMutableString string];
	void *pool = objc_autoreleasePoolPush();
	const OFUnichar *characters = self.characters;
	size_t length = self.length;
	bool (*characterIsMember)(id, SEL, OFUnichar) =
71
72
73
74
75
76
77
78

79
80
81
82
83
84
85
71
72
73
74
75
76
77

78
79
80
81
82
83
84
85







-
+







	}

	objc_autoreleasePoolPop(pool);

	return ret;
}

- (OFString *)stringByURLDecoding
- (OFString *)stringByRemovingPercentEncoding
{
	void *pool = objc_autoreleasePoolPush();
	const char *string = self.UTF8String;
	size_t length = self.UTF8StringLength;
	char *retCString;
	char byte = 0;
	int state = 0;