Index: src/OFINICategory.m ================================================================== --- src/OFINICategory.m +++ src/OFINICategory.m @@ -495,24 +495,24 @@ { if ([_lines count] == 0) return false; if (first) - [stream writeFormat: @"[%@]\n", _name]; + [stream writeFormat: @"[%@]\r\n", _name]; else - [stream writeFormat: @"\n[%@]\n", _name]; + [stream writeFormat: @"\r\n[%@]\r\n", _name]; for (id line in _lines) { if ([line isKindOfClass: [OFINICategory_Comment class]]) { OFINICategory_Comment *comment = line; - [stream writeLine: comment->_comment]; + [stream writeFormat: @"%@\r\n", comment->_comment]; } else if ([line isKindOfClass: [OFINICategory_Pair class]]) { OFINICategory_Pair *pair = line; OFString *key = escapeString(pair->_key); OFString *value = escapeString(pair->_value); OFString *line = [OFString - stringWithFormat: @"%@=%@\n", key, value]; + stringWithFormat: @"%@=%@\r\n", key, value]; [stream writeString: line encoding: encoding]; } else @throw [OFInvalidArgumentException exception]; Index: tests/OFINIFileTests.m ================================================================== --- tests/OFINIFileTests.m +++ tests/OFINIFileTests.m @@ -25,42 +25,36 @@ #import "OFFileManager.h" #import "OFAutoreleasePool.h" #import "TestsAppDelegate.h" -#if defined(OF_WINDOWS) || defined(OF_MSDOS) -# define NL @"\r\n" -#else -# define NL @"\n" -#endif - static OFString *module = @"OFINIFile"; @implementation TestsAppDelegate (OFINIFileTests) - (void)INIFileTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; - OFString *output = @"[tests]" NL - @"foo=baz" NL - @"foobar=baz" NL - @";comment" NL - @"new=new" NL - NL - @"[foobar]" NL - @";foobarcomment" NL - @"qux=\" asd\"" NL - @"quxquxqux=\"hello\\\"wörld\"" NL - @"qux2=\"a\\f\"" NL - @"qux3=a\fb" NL - NL - @"[types]" NL - @"integer=16" NL - @"bool=false" NL - @"float=0.25" NL - @"array1=foo" NL - @"array1=bar" NL - @"double=0.75" NL; + OFString *output = @"[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" + @"bool=false\r\n" + @"float=0.25\r\n" + @"array1=foo\r\n" + @"array1=bar\r\n" + @"double=0.75\r\n"; OFINIFile *file; OFINICategory *tests, *foobar, *types; OFArray *array; #ifndef OF_NINTENDO_DS OFString *writePath; Index: tests/testfile.ini ================================================================== --- tests/testfile.ini +++ tests/testfile.ini @@ -1,21 +1,21 @@ -[tests] -foo = bar -foobar=baz -;comment - -[foobar] -;foobarcomment -qux=" asd" -"quxqux " = asd -quxquxqux="hello\"w”rld" -qux2="a\f" - -[types] -integer = 0x20 -bool = true -float = 0.5 -array1 = 1 -array2 = 1 -double = 0.25 -array1 = 2 -array2 = 2 +[tests] +foo = bar +foobar=baz +;comment + +[foobar] +;foobarcomment +qux=" asd" +"quxqux " = asd +quxquxqux="hello\"w”rld" +qux2="a\f" + +[types] +integer = 0x20 +bool = true +float = 0.5 +array1 = 1 +array2 = 1 +double = 0.25 +array1 = 2 +array2 = 2