ObjFW  Check-in [9e82f99f09]

Overview
Comment:Various small bugfixes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9e82f99f095d59bd628055420fe5d73ccf0cd603c45586264ccc9fe9d83db900
User & Date: js on 2011-09-28 14:38:45
Other Links: manifest | tags
Context
2011-10-04
13:14
Split OFXMLElement into OFXML{Element,Characters,CDATA,Comment}. check-in: 03f14bf019 user: js tags: trunk
2011-09-28
14:38
Various small bugfixes. check-in: 9e82f99f09 user: js tags: trunk
14:22
Don't depend on struct objc_class being defined by the GNU runtime. check-in: 8835fdb56d user: js tags: trunk
Changes

Modified src/OFCountedSet_hashtable.h from [7a070c2ba9] to [b96fac6490].

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFCountedSet.h"

@class OFDictionary_hashtable;

@interface OFCountedSet_hashtable: OFCountedSet
{
	OFDictionary_hashtable *dictionary;
	unsigned long mutations;
}
@end







|



|



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFCountedSet.h"

@class OFMutableDictionary_hashtable;

@interface OFCountedSet_hashtable: OFCountedSet
{
	OFMutableDictionary_hashtable *dictionary;
	unsigned long mutations;
}
@end

Modified src/OFCountedSet_hashtable.m from [5a2ad653a8] to [cc1777b6a8].

21
22
23
24
25
26
27

28
29
30
31
32
33
34
#import "OFMutableSet_hashtable.h"
#import "OFCountedSet_hashtable.h"
#import "OFMutableDictionary_hashtable.h"
#import "OFString.h"
#import "OFNumber.h"
#import "OFArray.h"
#import "OFXMLElement.h"

#import "OFAutoreleasePool.h"

#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"

@implementation OFCountedSet_hashtable
+ (void)initialize







>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#import "OFMutableSet_hashtable.h"
#import "OFCountedSet_hashtable.h"
#import "OFMutableDictionary_hashtable.h"
#import "OFString.h"
#import "OFNumber.h"
#import "OFArray.h"
#import "OFXMLElement.h"
#import "OFXMLAttribute.h"
#import "OFAutoreleasePool.h"

#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"

@implementation OFCountedSet_hashtable
+ (void)initialize

Modified src/OFFile.m from [c6a9166c97] to [3604f250d5].

277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299

300

301
302
303
304
305
306
307
#else
	HANDLE handle;
	WIN32_FIND_DATA fd;

	pool = [[OFAutoreleasePool alloc] init];
	path = [path stringByAppendingString: @"\\*"];

	if ((handle = FindFirstFile([path cString], &fd)) ==
	    INVALID_HANDLE_VALUE)
		@throw [OFOpenFileFailedException exceptionWithClass: self
								path: path
								mode: @"r"];

	@try {
		OFAutoreleasePool *pool2 = [[OFAutoreleasePool alloc] init];

		do {
			OFString *file;

			if (!strcmp(fd.cFileName, ".") ||
			    !strcmp(fd.cFileName, ".."))
				continue;


			file = [OFString stringWithCString: fd.cFileName];

			[files addObject: file];

			[pool2 releaseObjects];
		} while (FindNextFile(handle, &fd));

		[pool2 release];
	} @finally {







|
|














>
|
>







277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
#else
	HANDLE handle;
	WIN32_FIND_DATA fd;

	pool = [[OFAutoreleasePool alloc] init];
	path = [path stringByAppendingString: @"\\*"];

	if ((handle = FindFirstFile([path cStringWithEncoding:
	    OF_STRING_ENCODING_NATIVE], &fd)) == INVALID_HANDLE_VALUE)
		@throw [OFOpenFileFailedException exceptionWithClass: self
								path: path
								mode: @"r"];

	@try {
		OFAutoreleasePool *pool2 = [[OFAutoreleasePool alloc] init];

		do {
			OFString *file;

			if (!strcmp(fd.cFileName, ".") ||
			    !strcmp(fd.cFileName, ".."))
				continue;

			file = [OFString
			    stringWithCString: fd.cFileName
				     encoding: OF_STRING_ENCODING_NATIVE];
			[files addObject: file];

			[pool2 releaseObjects];
		} while (FindNextFile(handle, &fd));

		[pool2 release];
	} @finally {
331
332
333
334
335
336
337
338

339
340
341
342
343
344
345
346
347
348
349
350
351

352
353
354
355
356
357
358
# ifndef _WIN32
	if (chmod([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], mode))
		@throw [OFChangeFileModeFailedException
		    exceptionWithClass: self
				  path: path
				  mode: mode];
# else
	DWORD attributes = GetFileAttributes([path cString]);


	if (attributes == INVALID_FILE_ATTRIBUTES)
		@throw [OFChangeFileModeFailedException
		    exceptionWithClass: self
				  path: path
				  mode: mode];

	if ((mode / 100) & 2)
		attributes &= ~FILE_ATTRIBUTE_READONLY;
	else
		attributes |= FILE_ATTRIBUTE_READONLY;

	if (!SetFileAttributes([path cString], attributes))

		@throw [OFChangeFileModeFailedException
		    exceptionWithClass: self
				  path: path
				  mode: mode];
# endif
}
#endif







|
>












|
>







333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
# ifndef _WIN32
	if (chmod([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], mode))
		@throw [OFChangeFileModeFailedException
		    exceptionWithClass: self
				  path: path
				  mode: mode];
# else
	DWORD attributes = GetFileAttributes(
	    [path cStringWithEncoding: OF_STRING_ENCODING_NATIVE]);

	if (attributes == INVALID_FILE_ATTRIBUTES)
		@throw [OFChangeFileModeFailedException
		    exceptionWithClass: self
				  path: path
				  mode: mode];

	if ((mode / 100) & 2)
		attributes &= ~FILE_ATTRIBUTE_READONLY;
	else
		attributes |= FILE_ATTRIBUTE_READONLY;

	if (!SetFileAttributes([path cStringWithEncoding:
	    OF_STRING_ENCODING_NATIVE], attributes))
		@throw [OFChangeFileModeFailedException
		    exceptionWithClass: self
				  path: path
				  mode: mode];
# endif
}
#endif
470
471
472
473
474
475
476


477
478
479
480
481
482
483
		if (!override) {
			struct stat s;

			if (fstat(sourceFile->fileDescriptor, &s) == 0)
				fchmod(destinationFile->fileDescriptor,
				    s.st_mode);
		}


#endif
	} @finally {
		[sourceFile close];
		[destinationFile close];
		free(buffer);
	}








>
>







474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
		if (!override) {
			struct stat s;

			if (fstat(sourceFile->fileDescriptor, &s) == 0)
				fchmod(destinationFile->fileDescriptor,
				    s.st_mode);
		}
#else
		(void)override;
#endif
	} @finally {
		[sourceFile close];
		[destinationFile close];
		free(buffer);
	}

Modified src/OFMutableSet_hashtable.h from [991b4e82f3] to [e9efefbae7].

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFMutableSet.h"

@class OFDictionary_hashtable;

@interface OFMutableSet_hashtable: OFMutableSet
{
	OFDictionary_hashtable *dictionary;
	unsigned long mutations;
}
@end







|



|



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFMutableSet.h"

@class OFMutableDictionary_hashtable;

@interface OFMutableSet_hashtable: OFMutableSet
{
	OFMutableDictionary_hashtable *dictionary;
	unsigned long mutations;
}
@end

Modified src/OFNumber.m from [37c360709c] to [5cb0489783].

17
18
19
20
21
22
23

24
25
26
27
28
29
30
#include "config.h"

#include <math.h>

#import "OFNumber.h"
#import "OFString.h"
#import "OFXMLElement.h"

#import "OFAutoreleasePool.h"

#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFNotImplementedException.h"

#import "macros.h"







>







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "config.h"

#include <math.h>

#import "OFNumber.h"
#import "OFString.h"
#import "OFXMLElement.h"
#import "OFXMLAttribute.h"
#import "OFAutoreleasePool.h"

#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFNotImplementedException.h"

#import "macros.h"

Modified src/OFStreamObserver.h from [429a39bc00] to [c3f9253037].

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

#import "OFObject.h"

#ifdef _WIN32
# ifndef _WIN32_WINNT
#  define _WIN32_WINNT 0x0501
# endif
# include <windows.h>
# include <ws2tcpip.h>
#endif

@class OFStream;
@class OFMutableArray;
@class OFMutableDictionary;
@class OFDataArray;
@class OFMutex;







|
|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

#import "OFObject.h"

#ifdef _WIN32
# ifndef _WIN32_WINNT
#  define _WIN32_WINNT 0x0501
# endif
# include <ws2tcpip.h>
# include <windows.h>
#endif

@class OFStream;
@class OFMutableArray;
@class OFMutableDictionary;
@class OFDataArray;
@class OFMutex;

Modified src/OFString.m from [93030ae4fe] to [83cfd0201b].

1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
#endif
		pathCStringLength--;

	for (i = pathCStringLength - 1; i >= 0; i--) {
#ifndef _WIN32
		if (s->cString[i] == OF_PATH_DELIMITER) {
#else
		if (s->cString[i] == '/' || s->string[i] == '\\') {
#endif
			i++;
			break;
		}
	}

	/*







|







1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
#endif
		pathCStringLength--;

	for (i = pathCStringLength - 1; i >= 0; i--) {
#ifndef _WIN32
		if (s->cString[i] == OF_PATH_DELIMITER) {
#else
		if (s->cString[i] == '/' || s->cString[i] == '\\') {
#endif
			i++;
			break;
		}
	}

	/*

Modified src/OFXMLNode.m from [702f1c18a8] to [90856c905b].

13
14
15
16
17
18
19

20
21
22
23
24
25
26
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#import "OFXMLNode.h"


#import "OFNotImplementedException.h"

@implementation OFXMLNode
- initWithSerialization: (OFXMLElement*)element
{
	Class c = isa;







>







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#import "OFXMLNode.h"
#import "OFString.h"

#import "OFNotImplementedException.h"

@implementation OFXMLNode
- initWithSerialization: (OFXMLElement*)element
{
	Class c = isa;