ObjFW  Check-in [750e870490]

Overview
Comment:OFINIFile: Properly quote ; and #
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 1.2
Files: files | file ages | folders
SHA3-256: 750e870490ffb601fabb776fad2e3c9e1a065fc6e3f4672f027022426326f8fc
User & Date: js on 2024-11-18 21:18:55
Other Links: branch diff | manifest | tags
Context
2024-11-18
23:28
GitHub Actions: Remove macOS 12 Leaf check-in: df271d3182 user: js tags: 1.2
21:18
OFINIFile: Properly quote ; and # check-in: 750e870490 user: js tags: 1.2
21:18
OFINIFile: Properly quote ; and # check-in: 92d0f0b9d4 user: js tags: trunk
21:10
Make sure ofarc and ofhash reference ObjFWTLS check-in: f010109a70 user: js tags: 1.2
Changes

Modified src/OFINISection.m from [1775218a4e] to [f5a74f6cad].

106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

+ (void)initialize
{
	if (self != [OFINISection class])
		return;

	needsEscapeCharacterSet = [[OFCharacterSet alloc]
	    initWithCharactersInString: @"\r\n\f\"\\="];
}

- (instancetype)of_initWithName: (OFString *)name OF_DIRECT
{
	self = [super init];

	@try {







|







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

+ (void)initialize
{
	if (self != [OFINISection class])
		return;

	needsEscapeCharacterSet = [[OFCharacterSet alloc]
	    initWithCharactersInString: @"\r\n\f\"\\=;#"];
}

- (instancetype)of_initWithName: (OFString *)name OF_DIRECT
{
	self = [super init];

	@try {

Modified tests/OFINIFileTests.m from [f3bbd53585] to [00795e5f81].

115
116
117
118
119
120
121

122
123
124
125
126
127
128
	    @"global=yes\r\n"
	    @"\r\n"
	    @"[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\\n\"\r\n"
	    @"\"asd=asd\"=foobar\r\n"







>







115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
	    @"global=yes\r\n"
	    @"\r\n"
	    @"[tests]\r\n"
	    @"foo=baz\r\n"
	    @"foobar=baz\r\n"
	    @";comment\r\n"
	    @"new=new\r\n"
	    @"\"#quoted\"=\";comment\"\r\n"
	    @"\r\n"
	    @"[foobar]\r\n"
	    @"#foobarcomment\r\n"
	    @"qux=\" asd\"\r\n"
	    @"quxquxqux=\"hello\\\"wörld\"\r\n"
	    @"qux2=\"a\\n\"\r\n"
	    @"\"asd=asd\"=foobar\r\n"
141
142
143
144
145
146
147

148
149
150
151
152
153
154
	OFArray *array = [OFArray arrayWithObjects: @"foo", @"bar", nil];
#if defined(OF_HAVE_FILES) && !defined(OF_NINTENDO_DS)
	OFIRI *writeIRI;
#endif

	[tests setStringValue: @"baz" forKey: @"foo"];
	[tests setStringValue: @"new" forKey: @"new"];

	[foobar setStringValue: @"a\fb" forKey: @"qux3"];
	[types setLongLongValue: 0x10 forKey: @"integer"];
	[types setBoolValue: false forKey: @"bool"];
	[types setFloatValue: 0.25f forKey: @"float"];
	[types setDoubleValue: 0.75 forKey: @"double"];
	[types setArrayValue: array forKey: @"array1"];








>







142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
	OFArray *array = [OFArray arrayWithObjects: @"foo", @"bar", nil];
#if defined(OF_HAVE_FILES) && !defined(OF_NINTENDO_DS)
	OFIRI *writeIRI;
#endif

	[tests setStringValue: @"baz" forKey: @"foo"];
	[tests setStringValue: @"new" forKey: @"new"];
	[tests setStringValue: @";comment" forKey: @"#quoted"];
	[foobar setStringValue: @"a\fb" forKey: @"qux3"];
	[types setLongLongValue: 0x10 forKey: @"integer"];
	[types setBoolValue: false forKey: @"bool"];
	[types setFloatValue: 0.25f forKey: @"float"];
	[types setDoubleValue: 0.75 forKey: @"double"];
	[types setArrayValue: array forKey: @"array1"];