ObjFW  Check-in [55f5b88d26]

Overview
Comment:OFINIFile: Allow # for comments
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 1.1
Files: files | file ages | folders
SHA3-256: 55f5b88d26ce0b488eed335bf10aa652c926738a214d062df859649bcbd1108d
User & Date: js on 2024-08-24 10:40:54
Other Links: branch diff | manifest | tags
Context
2024-08-24
22:20
OFString: Fix converting from some encodings check-in: 6e79f005c4 user: js tags: 1.1
10:40
OFINIFile: Allow # for comments check-in: 55f5b88d26 user: js tags: 1.1
10:39
OFINIFile: Allow # for comments check-in: 16ebc2d82a user: js tags: trunk
10:32
OFINICategory: Allow values in global category check-in: e2f6eea34e user: js tags: 1.1
Changes

Modified src/OFINICategory.m from [128a34b63f] to [3ff03f8457].

150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
	[_lines release];

	[super dealloc];
}

- (void)of_parseLine: (OFString *)line
{
	if (![line hasPrefix: @";"]) {
		OFINICategoryPair *pair;
		OFString *key, *value;
		size_t pos;

		pair = [[[OFINICategoryPair alloc] init] autorelease];

		if ((pos = [line rangeOfString: @"="].location) == OFNotFound)







|







150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
	[_lines release];

	[super dealloc];
}

- (void)of_parseLine: (OFString *)line
{
	if (![line hasPrefix: @";"] && ![line hasPrefix: @"#"]) {
		OFINICategoryPair *pair;
		OFString *key, *value;
		size_t pos;

		pair = [[[OFINICategoryPair alloc] init] autorelease];

		if ((pos = [line rangeOfString: @"="].location) == OFNotFound)

Modified tests/OFINIFileTests.m from [eee41e5bc6] to [33885c1876].

117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
	    @"[tests]\r\n"
	    @"foo=baz\r\n"
	    @"foobar=baz\r\n"
	    @";comment\r\n"
	    @"new=new\r\n"
	    @"\r\n"
	    @"[foobar]\r\n"
	    @";foobarcomment\r\n"
	    @"qux=\" asd\"\r\n"
	    @"quxquxqux=\"hello\\\"wörld\"\r\n"
	    @"qux2=\"a\\f\"\r\n"
	    @"qux3=a\fb\r\n"
	    @"\r\n"
	    @"[types]\r\n"
	    @"integer=16\r\n"







|







117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
	    @"[tests]\r\n"
	    @"foo=baz\r\n"
	    @"foobar=baz\r\n"
	    @";comment\r\n"
	    @"new=new\r\n"
	    @"\r\n"
	    @"[foobar]\r\n"
	    @"#foobarcomment\r\n"
	    @"qux=\" asd\"\r\n"
	    @"quxquxqux=\"hello\\\"wörld\"\r\n"
	    @"qux2=\"a\\f\"\r\n"
	    @"qux3=a\fb\r\n"
	    @"\r\n"
	    @"[types]\r\n"
	    @"integer=16\r\n"

Modified tests/testfile.ini from [4c2a651a5b] to [01d8ae7a98].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
; Comment in global category
global=yes

[tests]
foo = bar
foobar=baz
;comment

[foobar]
;foobarcomment
qux=" asd"
"quxqux " = asd
quxquxqux="hello\"wörld"
qux2="a\f"

[types]
integer = 0x20









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
; Comment in global category
global=yes

[tests]
foo = bar
foobar=baz
;comment

[foobar]
#foobarcomment
qux=" asd"
"quxqux " = asd
quxquxqux="hello\"wörld"
qux2="a\f"

[types]
integer = 0x20