ObjFW  Diff

Differences From Artifact [fe840b486f]:

To Artifact [68a0381598]:


110
111
112
113
114
115
116



117
118
119
120

121






122
123
124
125

126





127
128
129
130

131





132
133
134
135

136






137
138
139
140
141
142
143
144
145
146




147
148
149
150
151




152
153
154
155
156




157
158
159
160
161




162
163
164
165
166



167
168
169
170
171





172
173
174
175
176





177
178
179
180
181





182
183
184
185
186
187
188
189
190
191



192
193
194
195
196




197
198
199
200
201




202
203
204
205
206




207
208
209
210
211





212
213
214
215
216






217
218
219
220
221




222
223
224
225
226




227
228
229
230
231






232
233
234
235
236




237
238
239
240
241







242
243
244
245
246









247
248
249
250
251
252
253
110
111
112
113
114
115
116
117
118
119
120
121
122

123
124
125
126
127
128
129
130
131
132
133

134
135
136
137
138
139
140
141
142
143

144
145
146
147
148
149
150
151
152
153

154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
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
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
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
359
360
361
362
363
364
365
366
367
368
369
370
371
372







+
+
+



-
+

+
+
+
+
+
+



-
+

+
+
+
+
+



-
+

+
+
+
+
+



-
+

+
+
+
+
+
+










+
+
+
+





+
+
+
+





+
+
+
+





+
+
+
+





+
+
+





+
+
+
+
+





+
+
+
+
+





+
+
+
+
+










+
+
+





+
+
+
+





+
+
+
+





+
+
+
+





+
+
+
+
+





+
+
+
+
+
+





+
+
+
+





+
+
+
+





+
+
+
+
+
+





+
+
+
+





+
+
+
+
+
+
+





+
+
+
+
+
+
+
+
+







- (instancetype)initWithBool: (bool)bool_
{
	return (id)[[OFNumber of_alloc] initWithBool: bool_];
}

- (instancetype)initWithChar: (signed char)sChar
{
	if (sChar >= 0)
		return (id)[[OFNumber of_alloc] initWithUnsignedChar: sChar];

	return (id)[[OFNumber of_alloc] initWithChar: sChar];
}

- (instancetype)initWithShort: (signed short)sShort
- (instancetype)initWithShort: (short)sShort
{
	if (sShort >= 0)
		return (id)[[OFNumber of_alloc] initWithUnsignedShort: sShort];
	if (sShort >= SCHAR_MIN)
		return (id)[[OFNumber of_alloc]
		    initWithChar: (signed char)sShort];

	return (id)[[OFNumber of_alloc] initWithShort: sShort];
}

- (instancetype)initWithInt: (signed int)sInt
- (instancetype)initWithInt: (int)sInt
{
	if (sInt >= 0)
		return (id)[[OFNumber of_alloc] initWithUnsignedInt: sInt];
	if (sInt >= SHRT_MIN)
		return (id)[[OFNumber of_alloc] initWithShort: (short)sInt];

	return (id)[[OFNumber of_alloc] initWithInt: sInt];
}

- (instancetype)initWithLong: (signed long)sLong
- (instancetype)initWithLong: (long)sLong
{
	if (sLong >= 0)
		return (id)[[OFNumber of_alloc] initWithUnsignedLong: sLong];
	if (sLong >= INT_MIN)
		return (id)[[OFNumber of_alloc] initWithShort: (int)sLong];

	return (id)[[OFNumber of_alloc] initWithLong: sLong];
}

- (instancetype)initWithLongLong: (signed long long)sLongLong
- (instancetype)initWithLongLong: (long long)sLongLong
{
	if (sLongLong >= 0)
		return (id)[[OFNumber of_alloc]
		    initWithUnsignedLongLong: sLongLong];
	if (sLongLong >= LONG_MIN)
		return (id)[[OFNumber of_alloc] initWithLong: (long)sLongLong];

	return (id)[[OFNumber of_alloc] initWithLongLong: sLongLong];
}

- (instancetype)initWithUnsignedChar: (unsigned char)uChar
{
	return (id)[[OFNumber of_alloc] initWithUnsignedChar: uChar];
}

- (instancetype)initWithUnsignedShort: (unsigned short)uShort
{
	if (uShort <= UCHAR_MAX)
		return (id)[[OFNumber of_alloc]
		    initWithUnsignedChar: (unsigned char)uShort];

	return (id)[[OFNumber of_alloc] initWithUnsignedShort: uShort];
}

- (instancetype)initWithUnsignedInt: (unsigned int)uInt
{
	if (uInt <= USHRT_MAX)
		return (id)[[OFNumber of_alloc]
		    initWithUnsignedShort: (unsigned short)uInt];

	return (id)[[OFNumber of_alloc] initWithUnsignedInt: uInt];
}

- (instancetype)initWithUnsignedLong: (unsigned long)uLong
{
	if (uLong <= UINT_MAX)
		return (id)[[OFNumber of_alloc]
		    initWithUnsignedInt: (unsigned int)uLong];

	return (id)[[OFNumber of_alloc] initWithUnsignedLong: uLong];
}

- (instancetype)initWithUnsignedLongLong: (unsigned long long)uLongLong
{
	if (uLongLong <= ULONG_MAX)
		return (id)[[OFNumber of_alloc]
		    initWithUnsignedLong: (unsigned long)uLongLong];

	return (id)[[OFNumber of_alloc] initWithUnsignedLongLong: uLongLong];
}

- (instancetype)initWithInt8: (int8_t)int8
{
	if (int8 >= 0)
		return (id)[[OFNumber of_alloc] initWithUInt8: int8];

	return (id)[[OFNumber of_alloc] initWithInt8: int8];
}

- (instancetype)initWithInt16: (int16_t)int16
{
	if (int16 >= 0)
		return (id)[[OFNumber of_alloc] initWithUInt16: int16];
	if (int16 >= INT8_MIN)
		return (id)[[OFNumber of_alloc] initWithInt8: (int8_t)int16];

	return (id)[[OFNumber of_alloc] initWithInt16: int16];
}

- (instancetype)initWithInt32: (int32_t)int32
{
	if (int32 >= 0)
		return (id)[[OFNumber of_alloc] initWithUInt32: int32];
	if (int32 >= INT16_MIN)
		return (id)[[OFNumber of_alloc] initWithInt16: (int16_t)int32];

	return (id)[[OFNumber of_alloc] initWithInt32: int32];
}

- (instancetype)initWithInt64: (int64_t)int64
{
	if (int64 >= 0)
		return (id)[[OFNumber of_alloc] initWithUInt64: int64];
	if (int64 >= INT32_MIN)
		return (id)[[OFNumber of_alloc] initWithInt32: (int32_t)int64];

	return (id)[[OFNumber of_alloc] initWithInt64: int64];
}

- (instancetype)initWithUInt8: (uint8_t)uInt8
{
	return (id)[[OFNumber of_alloc] initWithUInt8: uInt8];
}

- (instancetype)initWithUInt16: (uint16_t)uInt16
{
	if (uInt16 <= UINT8_MAX)
		return (id)[[OFNumber of_alloc] initWithUInt8: (uint8_t)uInt16];

	return (id)[[OFNumber of_alloc] initWithUInt16: uInt16];
}

- (instancetype)initWithUInt32: (uint32_t)uInt32
{
	if (uInt32 <= UINT16_MAX)
		return (id)[[OFNumber of_alloc]
		    initWithUInt16: (uint16_t)uInt32];

	return (id)[[OFNumber of_alloc] initWithUInt32: uInt32];
}

- (instancetype)initWithUInt64: (uint64_t)uInt64
{
	if (uInt64 <= UINT32_MAX)
		return (id)[[OFNumber of_alloc]
		    initWithUInt32: (uint32_t)uInt64];

	return (id)[[OFNumber of_alloc] initWithUInt64: uInt64];
}

- (instancetype)initWithSize: (size_t)size
{
	if (size <= ULONG_MAX)
		return (id)[[OFNumber of_alloc]
		    initWithUnsignedLong: (unsigned long)size];

	return (id)[[OFNumber of_alloc] initWithSize: size];
}

- (instancetype)initWithSSize: (ssize_t)sSize
{
	if (sSize >= 0)
		return (id)[[OFNumber of_alloc] initWithSize: sSize];
	if (sSize <= LONG_MIN)
		return (id)[[OFNumber of_alloc] initWithLong: (long)sSize];

	return (id)[[OFNumber of_alloc] initWithSSize: sSize];
}

- (instancetype)initWithIntMax: (intmax_t)intMax
{
	if (intMax >= 0)
		return (id)[[OFNumber of_alloc] initWithUIntMax: intMax];
	if (intMax <= LLONG_MIN)
		return (id)[[OFNumber of_alloc]
		    initWithLongLong: (long long)intMax];

	return (id)[[OFNumber of_alloc] initWithIntMax: intMax];
}

- (instancetype)initWithUIntMax: (uintmax_t)uIntMax
{
	if (uIntMax <= ULLONG_MAX)
		return (id)[[OFNumber of_alloc]
		    initWithUnsignedLongLong: (unsigned long long)uIntMax];

	return (id)[[OFNumber of_alloc] initWithUIntMax: uIntMax];
}

- (instancetype)initWithPtrDiff: (ptrdiff_t)ptrDiff
{
	if (ptrDiff >= LLONG_MIN && ptrDiff <= LLONG_MAX)
		return (id)[[OFNumber of_alloc]
		    initWithLongLong: (long long)ptrDiff];

	return (id)[[OFNumber of_alloc] initWithPtrDiff: ptrDiff];
}

- (instancetype)initWithIntPtr: (intptr_t)intPtr
{
	if (intPtr >= 0)
		return (id)[[OFNumber of_alloc] initWithUIntPtr: intPtr];
	if (intPtr >= LLONG_MIN)
		return (id)[[OFNumber of_alloc]
		    initWithLongLong: (long long)intPtr];

	return (id)[[OFNumber of_alloc] initWithIntPtr: intPtr];
}

- (instancetype)initWithUIntPtr: (uintptr_t)uIntPtr
{
	if (uIntPtr <= ULLONG_MAX)
		return (id)[[OFNumber of_alloc]
		    initWithUnsignedLongLong: (unsigned long long)uIntPtr];

	return (id)[[OFNumber of_alloc] initWithUIntPtr: uIntPtr];
}

- (instancetype)initWithFloat: (float)float_
{
	if (float_ == (uintmax_t)float_)
		return (id)[[OFNumber of_alloc]
		    initWithUIntMax: (uintmax_t)float_];
	if (float_ == (intmax_t)float_)
		return (id)[[OFNumber of_alloc]
		    initWithIntMax: (intmax_t)float_];

	return (id)[[OFNumber of_alloc] initWithFloat: float_];
}

- (instancetype)initWithDouble: (double)double_
{
	if (double_ == (uintmax_t)double_)
		return (id)[[OFNumber of_alloc]
		    initWithUIntMax: (uintmax_t)double_];
	if (double_ == (intmax_t)double_)
		return (id)[[OFNumber of_alloc]
		    initWithIntMax: (intmax_t)double_];
	if (double_ == (float)double_)
		return (id)[[OFNumber of_alloc] initWithFloat: (float)double_];

	return (id)[[OFNumber of_alloc] initWithDouble: double_];
}

- (instancetype)initWithSerialization: (OFXMLElement *)element
{
	return (id)[[OFNumber of_alloc] initWithSerialization: element];
}
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
310
400
401
402
403
404
405
406

407
408
409
410
411

412
413
414
415
416

417
418
419
420
421

422
423
424
425
426
427
428
429







-
+




-
+




-
+




-
+







}

+ (instancetype)numberWithChar: (signed char)sChar
{
	return [[[self alloc] initWithChar: sChar] autorelease];
}

+ (instancetype)numberWithShort: (signed short)sShort
+ (instancetype)numberWithShort: (short)sShort
{
	return [[[self alloc] initWithShort: sShort] autorelease];
}

+ (instancetype)numberWithInt: (signed int)sInt
+ (instancetype)numberWithInt: (int)sInt
{
	return [[[self alloc] initWithInt: sInt] autorelease];
}

+ (instancetype)numberWithLong: (signed long)sLong
+ (instancetype)numberWithLong: (long)sLong
{
	return [[[self alloc] initWithLong: sLong] autorelease];
}

+ (instancetype)numberWithLongLong: (signed long long)sLongLong
+ (instancetype)numberWithLongLong: (long long)sLongLong
{
	return [[[self alloc] initWithLongLong: sLongLong] autorelease];
}

+ (instancetype)numberWithUnsignedChar: (unsigned char)uChar
{
	return [[[self alloc] initWithUnsignedChar: uChar] autorelease];
436
437
438
439
440
441
442
443

444
445
446
447
448
449
450
451
452
453

454
455
456
457
458
459
460
461
462
463

464
465
466
467
468
469
470
471
472
473

474
475
476
477
478
479
480
555
556
557
558
559
560
561

562
563
564
565
566
567
568
569
570
571

572
573
574
575
576
577
578
579
580
581

582
583
584
585
586
587
588
589
590
591

592
593
594
595
596
597
598
599







-
+









-
+









-
+









-
+








	_value.sChar = sChar;
	_type = OF_NUMBER_TYPE_CHAR;

	return self;
}

- (instancetype)initWithShort: (signed short)sShort
- (instancetype)initWithShort: (short)sShort
{
	self = [super init];

	_value.sShort = sShort;
	_type = OF_NUMBER_TYPE_SHORT;

	return self;
}

- (instancetype)initWithInt: (signed int)sInt
- (instancetype)initWithInt: (int)sInt
{
	self = [super init];

	_value.sInt = sInt;
	_type = OF_NUMBER_TYPE_INT;

	return self;
}

- (instancetype)initWithLong: (signed long)sLong
- (instancetype)initWithLong: (long)sLong
{
	self = [super init];

	_value.sLong = sLong;
	_type = OF_NUMBER_TYPE_LONG;

	return self;
}

- (instancetype)initWithLongLong: (signed long long)sLongLong
- (instancetype)initWithLongLong: (long long)sLongLong
{
	self = [super init];

	_value.sLongLong = sLongLong;
	_type = OF_NUMBER_TYPE_LONGLONG;

	return self;
759
760
761
762
763
764
765
766

767
768

769
770

771
772

773
774
775
776
777
778
779
878
879
880
881
882
883
884

885
886

887
888

889
890

891
892
893
894
895
896
897
898







-
+

-
+

-
+

-
+







{
	switch (_type) {
	case OF_NUMBER_TYPE_BOOL:
		return @encode(bool);
	case OF_NUMBER_TYPE_CHAR:
		return @encode(signed char);
	case OF_NUMBER_TYPE_SHORT:
		return @encode(signed short);
		return @encode(short);
	case OF_NUMBER_TYPE_INT:
		return @encode(signed int);
		return @encode(int);
	case OF_NUMBER_TYPE_LONG:
		return @encode(signed long);
		return @encode(long);
	case OF_NUMBER_TYPE_LONGLONG:
		return @encode(signed long long);
		return @encode(long long);
	case OF_NUMBER_TYPE_UCHAR:
		return @encode(unsigned char);
	case OF_NUMBER_TYPE_USHORT:
		return @encode(unsigned short);
	case OF_NUMBER_TYPE_UINT:
		return @encode(unsigned int);
	case OF_NUMBER_TYPE_ULONG:
832
833
834
835
836
837
838
839

840
841
842

843
844
845

846
847
848

849
850
851

852
853
854

855
856
857

858
859
860

861
862
863
864
865
866
867
951
952
953
954
955
956
957

958
959
960

961
962
963

964
965
966

967
968
969

970
971
972

973
974
975

976
977
978

979
980
981
982
983
984
985
986







-
+


-
+


-
+


-
+


-
+


-
+


-
+


-
+







	case OF_NUMBER_TYPE_CHAR:
		if (size != sizeof(signed char))
			@throw [OFOutOfRangeException exception];

		memcpy(value, &_value.sChar, sizeof(signed char));
		break;
	case OF_NUMBER_TYPE_SHORT:
		if (size != sizeof(signed short))
		if (size != sizeof(short))
			@throw [OFOutOfRangeException exception];

		memcpy(value, &_value.sShort, sizeof(signed short));
		memcpy(value, &_value.sShort, sizeof(short));
		break;
	case OF_NUMBER_TYPE_INT:
		if (size != sizeof(signed int))
		if (size != sizeof(int))
			@throw [OFOutOfRangeException exception];

		memcpy(value, &_value.sInt, sizeof(signed int));
		memcpy(value, &_value.sInt, sizeof(int));
		break;
	case OF_NUMBER_TYPE_LONG:
		if (size != sizeof(signed long))
		if (size != sizeof(long))
			@throw [OFOutOfRangeException exception];

		memcpy(value, &_value.sLong, sizeof(signed long));
		memcpy(value, &_value.sLong, sizeof(long));
		break;
	case OF_NUMBER_TYPE_LONGLONG:
		if (size != sizeof(signed long long))
		if (size != sizeof(long long))
			@throw [OFOutOfRangeException exception];

		memcpy(value, &_value.sLongLong, sizeof(signed long long));
		memcpy(value, &_value.sLongLong, sizeof(long long));
		break;
	case OF_NUMBER_TYPE_UCHAR:
		if (size != sizeof(unsigned char))
			@throw [OFOutOfRangeException exception];

		memcpy(value, &_value.uChar, sizeof(unsigned char));
		break;
1002
1003
1004
1005
1006
1007
1008
1009

1010
1011

1012
1013
1014

1015
1016

1017
1018
1019

1020
1021

1022
1023
1024

1025
1026

1027
1028
1029
1030
1031
1032
1033
1121
1122
1123
1124
1125
1126
1127

1128
1129

1130
1131
1132

1133
1134

1135
1136
1137

1138
1139

1140
1141
1142

1143
1144

1145
1146
1147
1148
1149
1150
1151
1152







-
+

-
+


-
+

-
+


-
+

-
+


-
+

-
+







}

- (signed char)charValue
{
	RETURN_AS(signed char)
}

- (signed short)shortValue
- (short)shortValue
{
	RETURN_AS(signed short)
	RETURN_AS(short)
}

- (signed int)intValue
- (int)intValue
{
	RETURN_AS(signed int)
	RETURN_AS(int)
}

- (signed long)longValue
- (long)longValue
{
	RETURN_AS(signed long)
	RETURN_AS(long)
}

- (signed long long)longLongValue
- (long long)longLongValue
{
	RETURN_AS(signed long long)
	RETURN_AS(long long)
}

- (unsigned char)unsignedCharValue
{
	RETURN_AS(unsigned char)
}