ObjFW  Diff

Differences From Artifact [59187f8565]:

  • File src/OFValue.m — part of check-in [9d802a786d] at 2025-01-01 12:58:18 on branch trunk — Update copyright (user: js size: 8129) [more...]

To Artifact [04bab4119a]:

  • File src/OFValue.m — part of check-in [305ad16fc4] at 2025-04-14 22:52:23 on branch trunk — Continue migrating to the ARC functions for RR (user: js size: 8296) [more...]

67
68
69
70
71
72
73

74
75
76
77
78
79
80
81
82
83
84
85
86

87
88
89
90
91
92

93
94
95
96
97
98

99
100
101
102
103
104

105
106
107
108
109
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

	return [super alloc];
}

+ (instancetype)valueWithBytes: (const void *)bytes
		      objCType: (const char *)objCType
{

	return [[[OFValue alloc] initWithBytes: bytes
				      objCType: objCType] autorelease];
}

+ (instancetype)valueWithPointer: (const void *)pointer
{
	return [[[OFValue alloc]
	    initWithBytes: &pointer
		 objCType: @encode(const void *)] autorelease];
}

+ (instancetype)valueWithNonretainedObject: (id)object
{

	return [[[OFValue alloc] initWithBytes: &object
				      objCType: @encode(id)] autorelease];
}

+ (instancetype)valueWithRange: (OFRange)range
{

	return [[[OFValue alloc] initWithBytes: &range
				      objCType: @encode(OFRange)] autorelease];
}

+ (instancetype)valueWithPoint: (OFPoint)point
{

	return [[[OFValue alloc] initWithBytes: &point
				      objCType: @encode(OFPoint)] autorelease];
}

+ (instancetype)valueWithSize: (OFSize)size
{

	return [[[OFValue alloc] initWithBytes: &size
				      objCType: @encode(OFSize)] autorelease];
}

+ (instancetype)valueWithRect: (OFRect)rect
{

	return [[[OFValue alloc] initWithBytes: &rect
				      objCType: @encode(OFRect)] autorelease];
}

+ (instancetype)valueWithVector3D: (OFVector3D)vector3D
{
	return [[[OFValue alloc]
	    initWithBytes: &vector3D
		 objCType: @encode(OFVector3D)] autorelease];
}

+ (instancetype)valueWithVector4D: (OFVector4D)vector4D
{
	return [[[OFValue alloc]
	    initWithBytes: &vector4D
		 objCType: @encode(OFVector4D)] autorelease];
}

- (instancetype)initWithBytes: (const void *)bytes
		     objCType: (const char *)objCType
{
	if ([self isMemberOfClass: [OFValue class]]) {
		@try {
			[self doesNotRecognizeSelector: _cmd];
		} @catch (id e) {
			[self release];
			@throw e;
		}

		abort();
	}

	return [super init];







>
|
|




|
|
|




>
|
|




>
|
|




>
|
|




>
|
|




>
|
|




|
|
|




|
|
|









|







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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

	return [super alloc];
}

+ (instancetype)valueWithBytes: (const void *)bytes
		      objCType: (const char *)objCType
{
	return objc_autoreleaseReturnValue(
	    [[OFValue alloc] initWithBytes: bytes
				  objCType: objCType]);
}

+ (instancetype)valueWithPointer: (const void *)pointer
{
	return objc_autoreleaseReturnValue(
	    [[OFValue alloc] initWithBytes: &pointer
				  objCType: @encode(const void *)]);
}

+ (instancetype)valueWithNonretainedObject: (id)object
{
	return objc_autoreleaseReturnValue(
	    [[OFValue alloc] initWithBytes: &object
				  objCType: @encode(id)]);
}

+ (instancetype)valueWithRange: (OFRange)range
{
	return objc_autoreleaseReturnValue(
	    [[OFValue alloc] initWithBytes: &range
				  objCType: @encode(OFRange)]);
}

+ (instancetype)valueWithPoint: (OFPoint)point
{
	return objc_autoreleaseReturnValue(
	    [[OFValue alloc] initWithBytes: &point
				  objCType: @encode(OFPoint)]);
}

+ (instancetype)valueWithSize: (OFSize)size
{
	return objc_autoreleaseReturnValue(
	    [[OFValue alloc] initWithBytes: &size
				  objCType: @encode(OFSize)]);
}

+ (instancetype)valueWithRect: (OFRect)rect
{
	return objc_autoreleaseReturnValue(
	    [[OFValue alloc] initWithBytes: &rect
				  objCType: @encode(OFRect)]);
}

+ (instancetype)valueWithVector3D: (OFVector3D)vector3D
{
	return objc_autoreleaseReturnValue(
	    [[OFValue alloc] initWithBytes: &vector3D
				  objCType: @encode(OFVector3D)]);
}

+ (instancetype)valueWithVector4D: (OFVector4D)vector4D
{
	return objc_autoreleaseReturnValue(
	    [[OFValue alloc] initWithBytes: &vector4D
				  objCType: @encode(OFVector4D)]);
}

- (instancetype)initWithBytes: (const void *)bytes
		     objCType: (const char *)objCType
{
	if ([self isMemberOfClass: [OFValue class]]) {
		@try {
			[self doesNotRecognizeSelector: _cmd];
		} @catch (id e) {
			objc_release(self);
			@throw e;
		}

		abort();
	}

	return [super init];
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
	}

	return hash;
}

- (id)copy
{
	return [self retain];
}

- (const char *)objCType
{
	OF_UNRECOGNIZED_SELECTOR
}








|







215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
	}

	return hash;
}

- (id)copy
{
	return objc_retain(self);
}

- (const char *)objCType
{
	OF_UNRECOGNIZED_SELECTOR
}