Differences From Artifact [bf40b440c5]:
- File
src/OFArray_subarray.m
— part of check-in
[44f45c2e35]
at
2017-01-09 17:36:36
on branch trunk
— Update copyright
Forgot to add 2017, even though I already did quite some changes in
2017. (user: js, size: 2488) [annotate] [blame] [check-ins using]
To Artifact [b087bc3ca0]:
- File
src/OFArray_subarray.m
— part of check-in
[4af49a13c3]
at
2017-05-07 20:10:13
on branch trunk
— Small code style change
Casts are now written like types in variable declarations. (user: js, size: 2492) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
17 18 19 20 21 22 23 | #include "config.h" #import "OFArray_subarray.h" #import "OFOutOfRangeException.h" @implementation OFArray_subarray | | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #include "config.h" #import "OFArray_subarray.h" #import "OFOutOfRangeException.h" @implementation OFArray_subarray + (instancetype)arrayWithArray: (OFArray *)array range: (of_range_t)range { return [[[self alloc] initWithArray: array range: range] autorelease]; } - initWithArray: (OFArray *)array range: (of_range_t)range { self = [super init]; @try { /* Should usually be retain, as it's useless with a copy */ _array = [array copy]; |
︙ | ︙ | |||
61 62 63 64 65 66 67 | { if (index >= _range.length) @throw [OFOutOfRangeException exception]; return [_array objectAtIndex: index + _range.location]; } | | | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | { 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; |
︙ | ︙ | |||
104 105 106 107 108 109 110 | if (index >= _range.length) return OF_NOT_FOUND; return index; } | | | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | if (index >= _range.length) return OF_NOT_FOUND; 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 |