ObjFW  Diff

Differences From Artifact [4d0eadf9ff]:

To Artifact [83e4ee3b65]:

  • File src/OFArray_subarray.m — part of check-in [3d16a30f41] at 2013-06-22 12:12:36 on branch trunk — Rework exceptions.

    This mostly removes the argument for the class in which the exception
    occurred. As backtraces were recently added for all platforms, the
    passed class does not give any extra information on where the exception
    occurred anymore.

    This also removes a few other arguments which were not too helpful. In
    the past, the idea was to pass as many arguments as possible so that it
    is easier to find the origin of the exception. However, as backtraces
    are a much better way to find the origin, those are not useful anymore
    and just make the exception more cumbersome to use. The rule is now to
    only pass arguments that might help in recovering from the exception or
    provide information that is otherwise not easily accessible. (user: js, size: 2473) [annotate] [blame] [check-ins using]


56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{
	return _range.length;
}

- (id)objectAtIndex: (size_t)index
{
	if (index >= _range.length)
		@throw [OFOutOfRangeException exceptionWithClass: [self class]];

	return [_array objectAtIndex: index + _range.location];
}

- (void)getObjects: (id*)buffer
	   inRange: (of_range_t)range
{
	if (range.length > SIZE_MAX - range.location ||
	    range.location + range.length > _range.length)
		@throw [OFOutOfRangeException exceptionWithClass: [self class]];

	range.location += _range.location;

	return [_array getObjects: buffer
			  inRange: range];
}








|









|







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{
	return _range.length;
}

- (id)objectAtIndex: (size_t)index
{
	if (index >= _range.length)
		@throw [OFOutOfRangeException exception];

	return [_array objectAtIndex: index + _range.location];
}

- (void)getObjects: (id*)buffer
	   inRange: (of_range_t)range
{
	if (range.length > SIZE_MAX - range.location ||
	    range.location + range.length > _range.length)
		@throw [OFOutOfRangeException exception];

	range.location += _range.location;

	return [_array getObjects: buffer
			  inRange: range];
}

108
109
110
111
112
113
114
115
116
117
118
119
120
121
	return index;
}

- (OFArray*)objectsInRange: (of_range_t)range
{
	if (range.length > SIZE_MAX - range.location ||
	    range.location + range.length > _range.length)
		@throw [OFOutOfRangeException exceptionWithClass: [self class]];

	range.location += _range.location;

	return [_array objectsInRange: range];
}
@end







|






108
109
110
111
112
113
114
115
116
117
118
119
120
121
	return index;
}

- (OFArray*)objectsInRange: (of_range_t)range
{
	if (range.length > SIZE_MAX - range.location ||
	    range.location + range.length > _range.length)
		@throw [OFOutOfRangeException exception];

	range.location += _range.location;

	return [_array objectsInRange: range];
}
@end