Skip to content

Commit

Permalink
[GitHub Issue #86] -[NSIndexPath initWithIndexes:length:] ignores al…
Browse files Browse the repository at this point in the history
…location return value.
  • Loading branch information
msft-Jeyaram committed Dec 8, 2015
1 parent 6ba9309 commit a26ee43
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
5 changes: 4 additions & 1 deletion Frameworks/Foundation/NSIndexPath.mm
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,14 @@ - (instancetype)initWithIndex:(unsigned)index {
- (instancetype)initWithIndexes:(unsigned*)indexes length:(unsigned)length {
_length = length;
_indexes = (unsigned*)EbrMalloc(length * sizeof(unsigned));
if (_indexes == nil) {
[self release];
return nil;
}

for (unsigned i = 0; i < length; i++) {
_indexes[i] = indexes[i];
}

return self;
}

Expand Down
14 changes: 10 additions & 4 deletions include/Foundation/NSIndexPath.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@
Portions Copyright (c) 2015 Microsoft Corporation. All rights reserved.
Portions Copyright (c) 2013 Peter Steinberger. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */

#import <Foundation/NSObject.h>

Expand Down Expand Up @@ -40,6 +46,6 @@ FOUNDATION_EXPORT_CLASS

// comparison support
- (NSComparisonResult)compare:(NSIndexPath*)otherObject; // sorting an array of indexPaths using this comparison results in an array
// representing nodes in depth-first traversal order
// representing nodes in depth-first traversal order

@end

0 comments on commit a26ee43

Please sign in to comment.