ObjFW  Check-in [c1e949a8c6]

Overview
Comment:Several minor fixes
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c1e949a8c691569fef4e7b0de0c5e3d7e37d31cc1e986b62e89ef0c1a62053d8
User & Date: js on 2019-03-09 10:48:04
Other Links: manifest | tags
Context
2019-03-12
21:47
OFDate: Avoid property access in OF_BSWAP64_IF_LE check-in: 8aba9d8a33 user: js tags: trunk
2019-03-09
10:48
Several minor fixes check-in: c1e949a8c6 user: js tags: trunk
2019-03-08
00:35
Use dot syntax check-in: bceb7ed4c9 user: js tags: trunk
Changes

Modified src/OFCountedSet_hashtable.m from [73078b5bc4] to [730baf31e4].

145
146
147
148
149
150
151
152

153
154
155
156
157
158
159
160
145
146
147
148
149
150
151

152

153
154
155
156
157
158
159







-
+
-







			    OF_SERIALIZATION_NS].firstObject;
			countAttribute =
			    [objectElement attributeForName: @"count"];

			if (object == nil || countAttribute == nil)
				@throw [OFInvalidFormatException exception];

			signedCount =
			signedCount = countAttribute.decimalValue;
			    countAttribute.stringValue.decimalValue;
			if (signedCount < 0)
			       @throw [OFOutOfRangeException exception];

			count = signedCount;
			if (count > SIZE_MAX || count > UINTPTR_MAX)
				@throw [OFOutOfRangeException exception];

Modified src/OFLHAArchive.m from [12097984b6] to [ba6f864ebc].

36
37
38
39
40
41
42
43

44
45
46
47
48
49
50
51
36
37
38
39
40
41
42

43

44
45
46
47
48
49
50







-
+
-







#import "OFNotOpenException.h"
#import "OFOutOfRangeException.h"
#import "OFTruncatedDataException.h"
#import "OFWriteFailedException.h"

@interface OFLHAArchive_FileReadStream: OFStream <OFReadyForReadingObserving>
{
	OFStream *_stream;
	OFStream *_stream, *_decompressedStream;
	OFStream *_decompressedStream;
	OFLHAArchiveEntry *_entry;
	uint32_t _toRead, _bytesConsumed;
	uint16_t _CRC16;
	bool _atEndOfStream, _skipped;
}

- (instancetype)of_initWithStream: (OFStream *)stream

Modified src/OFLHAArchive_LHStream.m from [8ad89a82c7] to [ee397f8bd5].

16
17
18
19
20
21
22

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







+







 */

#include "config.h"

#include <assert.h>

#import "OFLHAArchive_LHStream.h"
#import "OFKernelEventObserver.h"

#import "huffman_tree.h"

#import "OFInvalidFormatException.h"
#import "OFNotOpenException.h"

enum state {

Modified src/OFProcess.m from [c46d227848] to [c878371199].

425
426
427
428
429
430
431
432

433
434
435
436
437
438
439
425
426
427
428
429
430
431

432
433
434
435
436
437
438
439







-
+







			count: object.UTF16StringLength];
		[env addItems: &zero
			count: 1];
	}
	[env addItems: zero
		count: 2];

	return env.items;
	return env.mutableItems;
}
#endif

- (bool)lowlevelIsAtEndOfStream
{
#ifndef OF_WINDOWS
	if (_readPipe[0] == -1)

Modified src/OFStdIOStream_Win32Console.m from [801fb56bc9] to [4abac542f9].

164
165
166
167
168
169
170
171

172
173
174
175
176
177
178
164
165
166
167
168
169
170

171
172
173
174
175
176
177
178







-
+







			if ((c & 0xFC00) == 0xD800) {
				of_char16_t next;

				if (UTF16Len <= i + 1) {
					_incompleteUTF16Surrogate = c;

					if (rest != nil) {
						char *items = rest.items;
						const char *items = rest.items;
						size_t count = rest.count;

						[self unreadFromBuffer: items
								length: count];
					}

					objc_autoreleasePoolPop(pool);

Modified src/OFString+PropertyListValue.m from [06291ad3fb] to [4cef91397d].

115
116
117
118
119
120
121
122

123
124
125
126
127
128

129
130
131
132
133
134
135
115
116
117
118
119
120
121

122
123
124
125
126
127

128
129
130
131
132
133
134
135







-
+





-
+








	return [OFNumber numberWithBool: false];
}

static OFNumber *
parseRealElement(OFXMLElement *element)
{
	return [OFNumber numberWithDouble: element.stringValue.doubleValue];
	return [OFNumber numberWithDouble: element.doubleValue];
}

static OFNumber *
parseIntegerElement(OFXMLElement *element)
{
	return [OFNumber numberWithIntMax: element.stringValue.decimalValue];
	return [OFNumber numberWithIntMax: element.decimalValue];
}

static id
parseElement(OFXMLElement *element)
{
	OFString *elementName;

Modified src/OFTarArchive.m from [c1512afd3b] to [b446679d60].

105
106
107
108
109
110
111
112
113
114



115
116
117
118
119
120
121
105
106
107
108
109
110
111



112
113
114
115
116
117
118
119
120
121







-
-
-
+
+
+







				uint32_t u32[1024 / sizeof(uint32_t)];
			} buffer;
			bool empty = true;

			if (![_stream isKindOfClass: [OFSeekableStream class]])
				@throw [OFInvalidArgumentException exception];

			[(OFSeekableStream *)stream seekToOffset: -1024
							  whence: SEEK_END];
			[stream readIntoBuffer: buffer.c
			[(OFSeekableStream *)_stream seekToOffset: -1024
							   whence: SEEK_END];
			[_stream readIntoBuffer: buffer.c
				    exactLength: 1024];

			for (size_t i = 0; i < 1024 / sizeof(uint32_t); i++)
				if (buffer.u32[i] != 0)
					empty = false;

			if (!empty)

Modified src/OFWindowsRegistryKey.m from [e2b1c254bf] to [e4d1f0156e].

204
205
206
207
208
209
210
211

212
213
214
215
216
217
218
204
205
206
207
208
209
210

211
212
213
214
215
216
217
218







-
+







			return nil;
		case ERROR_MORE_DATA:
			objc_autoreleasePoolPop(pool);
			pool = objc_autoreleasePoolPush();

			ret = [OFMutableData dataWithCapacity: length];
			[ret increaseCountBy: length];
			buffer = ret.items;
			buffer = ret.mutableItems;

			continue;
		default:
			@throw [OFGetWindowsRegistryValueFailedException
			    exceptionWithRegistryKey: self
					       value: value
					  subkeyPath: subkeyPath

Modified src/OFXMLElement.m from [5fc577399d] to [cbd628ecff].

532
533
534
535
536
537
538
539

540
541

542
543
544
545
546
547
548
532
533
534
535
536
537
538

539


540
541
542
543
544
545
546
547







-
+
-
-
+







		if (attribute->_namespace != nil &&
		    (attributePrefix = [allNamespaces objectForKey:
		    attribute->_namespace]) == nil)
			@throw [OFUnboundNamespaceException
			    exceptionWithNamespace: [attribute namespace]
					   element: self];

		length += attributeNameLength +
		length += attributeNameLength + (attributePrefix != nil
		    (attributePrefix != nil ?
		    attributePrefix.UTF8StringLength + 1 : 0) +
		    ? attributePrefix.UTF8StringLength + 1 : 0) +
		    tmp.UTF8StringLength + 4;

		@try {
			cString = [self resizeMemory: cString
						size: length];
		} @catch (id e) {
			[self freeMemory: cString];

Modified src/OFZIPArchive.m from [ebb48a8010] to [4ebe3c89c2].

72
73
74
75
76
77
78
79

80
81
82
83
84
85
86
87
72
73
74
75
76
77
78

79

80
81
82
83
84
85
86







-
+
-








- (instancetype)initWithStream: (OFStream *)stream;
- (bool)matchesEntry: (OFZIPArchiveEntry *)entry;
@end

@interface OFZIPArchive_FileReadStream: OFStream
{
	OFStream *_stream;
	OFStream *_stream, *_decompressedStream;
	OFStream *_decompressedStream;
	OFZIPArchiveEntry *_entry;
	uint64_t _toRead;
	uint32_t _CRC32;
	bool _atEndOfStream;
}

- (instancetype)of_initWithStream: (OFStream *)stream

Modified src/bridge/NSBridging.h from [1b3ca80d51] to [b9ec6aa2e5].

31
32
33
34
35
36
37
38

39
40
41
42
43
44
45
46
47
48
31
32
33
34
35
36
37

38
39
40
41


42
43
44
45
46







-
+



-
-





 * @protocol NSBridging NSBridging.h ObjFW-Bridge/NSBridging.h
 *
 * @brief A protocol implemented by classes supporting bridging Foundation
 *	  objects to ObjFW objects.
 */
@protocol NSBridging
/*!
 * @brief Returns an instance of an ObjFW object corresponding to the receiver.
 * @brief An instance of an ObjFW object corresponding to the object.
 *
 * If possible, the original object is wrapped. If this is not possible, an
 * autoreleased copy is created.
 *
 * @return The receiver as an ObjFW object
 */
@property (readonly, nonatomic) id OFObject;
@end

OF_ASSUME_NONNULL_END

Modified src/bridge/OFBridging.h from [441e4ae6c2] to [35465b0136].

31
32
33
34
35
36
37
38

39
40
41
42
43
44
45
46
47
48
49
31
32
33
34
35
36
37

38

39
40
41


42
43
44
45
46







-
+
-



-
-





 * @protocol OFBridging OFBridging.h ObjFW-Bridge/OFBridging.h
 *
 * @brief A protocol implemented by classes supporting bridging ObjFW objects
 *	  to Foundation objects.
 */
@protocol OFBridging
/*!
 * @brief Returns an instance of a Foundation object corresponding to the
 * @brief An instance of a Foundation object corresponding to the object.
 *	  receiver.
 *
 * If possible, the original object is wrapped. If this is not possible, an
 * autoreleased copy is created.
 *
 * @return The receiver as Foundation object
 */
@property (readonly, nonatomic) id NSObject;
@end

OF_ASSUME_NONNULL_END