ObjFW  Check-in [8dbc052d49]

Overview
Comment:gcc seems to accept a @throw instead of a return as well.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8dbc052d49ccd4fdad1a8aa4a021df4e78ff438ce767b2e847d717e98dde582c
User & Date: js on 2009-04-22 22:43:52
Other Links: manifest | tags
Context
2009-04-23
12:07
Free the list in the dictionary when the last object in it was removed. check-in: 69b468f9f2 user: js tags: trunk
2009-04-22
22:43
gcc seems to accept a @throw instead of a return as well. check-in: 8dbc052d49 user: js tags: trunk
22:37
Throw exception if the key was not found in the OFDictionary. check-in: 36d50170c9 user: js tags: trunk
Changes

Modified src/OFNumber.m from [d73afc0a37] to [d4f0e2b26d].

62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
		return (t)value.intptr;					\
	case OF_NUMBER_FLOAT:						\
		return (t)value.float_;					\
	case OF_NUMBER_DOUBLE:						\
		return (t)value.double_;				\
	default:							\
		@throw [OFInvalidFormatException newWithClass: isa];	\
		return 0;	/* Make gcc happy */			\
	}
#define CALCULATE(o)							\
	switch (type) {							\
	case OF_NUMBER_CHAR:						\
		value.char_ o;						\
		break;							\
	case OF_NUMBER_SHORT:						\







<







62
63
64
65
66
67
68

69
70
71
72
73
74
75
		return (t)value.intptr;					\
	case OF_NUMBER_FLOAT:						\
		return (t)value.float_;					\
	case OF_NUMBER_DOUBLE:						\
		return (t)value.double_;				\
	default:							\
		@throw [OFInvalidFormatException newWithClass: isa];	\

	}
#define CALCULATE(o)							\
	switch (type) {							\
	case OF_NUMBER_CHAR:						\
		value.char_ o;						\
		break;							\
	case OF_NUMBER_SHORT:						\
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
		value.float_ o;						\
		break;							\
	case OF_NUMBER_DOUBLE:						\
		value.double_ o;					\
		break;							\
	default:							\
		@throw [OFInvalidFormatException newWithClass: isa];	\
		break;							\
	}
#define CALCULATE2(o, n)						\
	switch ([n type]) { 						\
	case OF_NUMBER_CHAR:						\
		value.char_ o [n asChar];				\
		break;							\
	case OF_NUMBER_SHORT:						\







<







139
140
141
142
143
144
145

146
147
148
149
150
151
152
		value.float_ o;						\
		break;							\
	case OF_NUMBER_DOUBLE:						\
		value.double_ o;					\
		break;							\
	default:							\
		@throw [OFInvalidFormatException newWithClass: isa];	\

	}
#define CALCULATE2(o, n)						\
	switch ([n type]) { 						\
	case OF_NUMBER_CHAR:						\
		value.char_ o [n asChar];				\
		break;							\
	case OF_NUMBER_SHORT:						\
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
		value.float_ o [n asFloat];				\
		break;							\
	case OF_NUMBER_DOUBLE:						\
		value.double_ o [n asDouble];				\
		break;							\
	default:							\
		@throw [OFInvalidFormatException newWithClass: isa];	\
		break;							\
	}

@implementation OFNumber
+ numberWithChar: (char)char_
{
	return [[[OFNumber alloc] initWithChar: char_] autorelease];
}







<







216
217
218
219
220
221
222

223
224
225
226
227
228
229
		value.float_ o [n asFloat];				\
		break;							\
	case OF_NUMBER_DOUBLE:						\
		value.double_ o [n asDouble];				\
		break;							\
	default:							\
		@throw [OFInvalidFormatException newWithClass: isa];	\

	}

@implementation OFNumber
+ numberWithChar: (char)char_
{
	return [[[OFNumber alloc] initWithChar: char_] autorelease];
}

Modified src/OFObject.m from [290156f650] to [352bb910bc].

282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
			*iter = ptr;
			return ptr;
		}
	}

	@throw [OFMemNotPartOfObjException newWithClass: isa
					     andPointer: ptr];
	return NULL;	/* never reached, but makes gcc happy */
}

- (void*)resizeMem: (void*)ptr
	  toNItems: (size_t)nitems
	    ofSize: (size_t)size
{
	size_t memsize;







<







282
283
284
285
286
287
288

289
290
291
292
293
294
295
			*iter = ptr;
			return ptr;
		}
	}

	@throw [OFMemNotPartOfObjException newWithClass: isa
					     andPointer: ptr];

}

- (void*)resizeMem: (void*)ptr
	  toNItems: (size_t)nitems
	    ofSize: (size_t)size
{
	size_t memsize;
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370

			return self;
		}
	}

	@throw [OFMemNotPartOfObjException newWithClass: isa
					     andPointer: ptr];
	return self;	/* never reached, but makes gcc happy */
}

- retain
{
	PRE_IVAR->retain_count++;

	return self;







<







355
356
357
358
359
360
361

362
363
364
365
366
367
368

			return self;
		}
	}

	@throw [OFMemNotPartOfObjException newWithClass: isa
					     andPointer: ptr];

}

- retain
{
	PRE_IVAR->retain_count++;

	return self;