Overview
Context
Changes
Modified ChangeLog
from [825d836d59]
to [68dbb909a3].
1
2
3
4
5
6
7
|
1
2
3
4
5
6
7
8
9
10
11
12
13
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
40
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
Legend:
* Changes of existing features or bugfixes.
+ New features.
ObjFW 0.1.2 -> 0.2, 01.02.2010
+ Support for ObjC 2 Fast Enumerations on every platform which has
compiler support for fast enumerations.
+ Support for ObjC 2 properties on every platform with compiler support.
+ Fast Enumeration through arrays and dictionaries.
* OFIterator has been removed.
+ OFEnumerator was added to replace OFIterator, which is more general
and works with arrays and dictionaries.
+ Portable implementation for atomic operations.
+ Portable implementation for spinlocks. They use atomic operations if
available, if not they fall back to pthread spinlocks. If both are
unavailable, mutexes are used as a last fallback.
* -[retain] and -[release] are now atomic. If no atomic operations are
available, spinlocks are used (which can fall back to mutexes, see
above).
* -[readLine] now handles \r\n without having the \r included in the
returned line.
+ OFThread now has -[tryLock].
* Mutation methods have been removed from immutable interfaces, thus
already giving an error at compilation instead of at runtime.
* Dependencies between headers have been reduced, leading to faster
compile times.
* The interfaces of OFSocket and OFStream were cleaned up and some
methods were moved to OFTCPSocket, as they make sense only there.
* File methods unavailable on Windows don't throw an exception at
runtime anymore, but instead are not even in the interface on
Windows. This way, it is a compile time error instead of a runtime
error.
ObjFW 0.1.1 -> 0.1.2, 15.01.2010
* Fix a bug in OFMutableArray's -[removeObject:] and
-[removeObjectIdenticalTo:] that could lead to not removing all
occurrences of the object from the array and to out of bounds reads.
* Change the URL in the framework plist to the homepage.
ObjFW 0.1 -> 0.1.1, 04.01.2010
|
︙ | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Modified src/Makefile
from [cffb8debfd]
to [b004a3e1eb].
︙ | | |
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
-
|
${OFTHREAD_M} \
OFURLEncoding.m \
OFXMLElement.m \
OFXMLParser.m \
unicode.m
INCLUDES := ${SRCS:.m=.h} \
OFFastEnumeration.h \
OFMacros.h \
ObjFW.h \
asprintf.h \
${ATOMIC_H} \
objfw-defs.h \
${THREADING_H}
|
︙ | | |
Modified src/OFArray.h
from [f31644bdce]
to [3e0b6e88ce].
︙ | | |
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
-
|
* the packaging of this file.
*/
#include <stdarg.h>
#import "OFObject.h"
#import "OFEnumerator.h"
#import "OFFastEnumeration.h"
@class OFDataArray;
@class OFString;
/**
* The OFArray class is a class for storing objects in an array.
*/
|
︙ | | |
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
-
+
|
* \return A new autoreleased OFArray
*/
+ arrayWithObjects: (OFObject*)first, ...;
/**
* Creates a new OFArray with the objects from the specified C array.
*
* \param objs A C array of objects.
* \param objs A C array of objects, terminated with nil
* \return A new autoreleased OFArray
*/
+ arrayWithCArray: (OFObject**)objs;
/**
* Initializes an OFArray with the specified object.
*
|
︙ | | |
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
-
+
|
*/
- initWithObject: (OFObject*)first
argList: (va_list)args;
/**
* Initializes an OFArray with the objects from the specified C array.
*
* \param objs A C array of objects
* \param objs A C array of objects, terminated with nil
* \return An initialized OFArray
*/
- initWithCArray: (OFObject**)objs;
/**
* \return The number of objects in the array
*/
|
︙ | | |
Modified src/OFDictionary.h
from [520f646873]
to [bbde3d4fc4].
︙ | | |
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
-
|
* the packaging of this file.
*/
#include <stdarg.h>
#import "OFObject.h"
#import "OFEnumerator.h"
#import "OFFastEnumeration.h"
@class OFArray;
struct of_dictionary_bucket
{
OFObject <OFCopying> *key;
OFObject *object;
|
︙ | | |
Modified src/OFEnumerator.h
from [1e45836bf9]
to [95bf700ece].
︙ | | |
22
23
24
25
26
27
28
|
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
/**
* Resets the enumerator, so the next call to nextObject returns the first
* object again.
*/
- reset;
@end
/*
* This needs to be exactly like this because it's hardcoded in the compiler.
*
* We need this bad check to see if we already imported Cocoa, which defines
* this as well.
*/
#define of_fast_enumeration_state_t NSFastEnumerationState
#ifndef NSINTEGER_DEFINED
typedef struct __of_fast_enumeration_state {
unsigned long state;
id *itemsPtr;
unsigned long *mutationsPtr;
unsigned long extra[5];
} of_fast_enumeration_state_t;
#endif
/**
* The OFFastEnumeration protocol needs to be implemented by all classes
* supporting fast enumeration.
*/
@protocol OFFastEnumeration
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state
objects: (id*)objects
count: (int)count;
@end
|
Deleted src/OFFastEnumeration.h version [7da30d91d4].
1
2
3
4
5
6
7
8
9
10
11
12
13
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
|
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
/*
* Copyright (c) 2008 - 2009
* Jonathan Schleifer <js@webkeks.org>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE included in
* the packaging of this file.
*/
#import "OFObject.h"
/*
* This needs to be exactly like this because it's hardcoded in the compiler.
*
* We need this bad check to see if we already imported Cocoa, which defines
* this as well.
*/
#define of_fast_enumeration_state_t NSFastEnumerationState
#ifndef NSINTEGER_DEFINED
typedef struct __of_fast_enumeration_state {
unsigned long state;
id *itemsPtr;
unsigned long *mutationsPtr;
unsigned long extra[5];
} of_fast_enumeration_state_t;
#endif
/**
* The OFFastEnumeration protocol needs to be implemented by all classes
* supporting fast enumeration.
*/
@protocol OFFastEnumeration
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state
objects: (id*)objects
count: (int)count;
@end
|
Modified src/OFMutableString.m
from [5bfa0023ae]
to [2a95dc6ba0].
︙ | | |
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
+
-
-
+
+
|
size_t i, j, d;
char *nstr;
if (!is_utf8) {
assert(table_size >= 1);
uint8_t *p = (uint8_t*)*string + *length;
uint8_t t;
while (--p >= (uint8_t*)*string)
if (table[0][*p])
*p = table[0][*p];
if ((t = table[0][*p]) != 0)
*p = t;
return;
}
ulen = [self length];
ustr = [self allocMemoryForNItems: [self length]
withSize: ulen];
|
︙ | | |
Modified src/OFObject.m
from [695579ca2f]
to [357eadb4d2].
︙ | | |
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
-
+
-
+
|
# import <objc/runtime.h>
#endif
#ifdef OF_GNU_RUNTIME
# import <objc/sarray.h>
#endif
#ifdef OF_ATOMIC_OPS
#import "atomic.h"
# import "atomic.h"
#else
#import "threading.h"
# import "threading.h"
#endif
struct pre_ivar {
void **memchunks;
size_t memchunks_size;
int32_t retain_count; /* int32_t because atomic ops use int32_t */
#ifndef OF_ATOMIC_OPS
|
︙ | | |
Modified src/OFThread.m
from [acb2745598]
to [0239ec1e3d].
︙ | | |
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
-
+
|
@throw [OFNotImplementedException newWithClass: isa
selector: _cmd];
}
- initWithObject: (OFObject <OFCopying>*)obj
{
self = [super init];
object = [obj copy];
object = [obj retain];
if (!of_thread_new(&thread, call_main, self)) {
Class c = isa;
[object release];
[super dealloc];
@throw [OFInitializationFailedException newWithClass: c];
}
|
︙ | | |
Modified src/threading.h
from [ec6d801a5e]
to [bf0ea6d5c4].
︙ | | |
12
13
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
|
12
13
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
|
-
+
-
+
-
+
|
#import "OFMacros.h"
#if !defined(OF_THREADS) || (!defined(OF_HAVE_PTHREADS) && !defined(_WIN32))
# error No threads available!
#endif
#if defined(OF_HAVE_PTHREADS)
#include <pthread.h>
# include <pthread.h>
typedef pthread_t of_thread_t;
typedef pthread_mutex_t of_mutex_t;
typedef pthread_key_t of_tlskey_t;
#elif defined(_WIN32)
#include <windows.h>
# include <windows.h>
typedef HANDLE of_thread_t;
typedef CRITICAL_SECTION of_mutex_t;
typedef DWORD of_tlskey_t;
#endif
#if defined(OF_ATOMIC_OPS)
#import "atomic.h"
# import "atomic.h"
typedef int32_t of_spinlock_t;
#elif defined(OF_HAVE_PTHREAD_SPINLOCKS)
typedef pthread_spinlock_t of_spinlock_t;
#else
typedef pthread_mutex_t of_spinlock_t;
#endif
|
︙ | | |
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
-
+
|
#endif
}
static OF_INLINE BOOL
of_spinlock_unlock(of_spinlock_t *s)
{
#if defined(OF_ATOMIC_OPS)
*s = 0;
of_atomic_and32((uint32_t*)s, 0);
return YES;
#elif defined(OF_HAVE_PTHREAD_SPINLOCKS)
return (pthread_spin_unlock(s) ? NO : YES);
#else
return of_mutex_unlock(s);
#endif
}
|
︙ | | |