-
Notifications
You must be signed in to change notification settings - Fork 806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fall back on CoreFoundation for some core NSString/NSCFString behaviours #671
Changes from 1 commit
5984d18
f88b14c
5025d2d
6a1e615
b2caf13
fedf79d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -537,6 +537,10 @@ - (BOOL)getBytes:(void*)buffer | |
@Status Interoperable | ||
*/ | ||
- (void)getCharacters:(unichar*)dest range:(NSRange)range { | ||
if (range.location + range.length > self.length) { | ||
[self _raiseBoundsExceptionForSelector:_cmd andRange:range]; | ||
} | ||
|
||
for (unsigned int i = 0; i < range.length; i++) { | ||
dest[i] = [self characterAtIndex:(i + range.location)]; | ||
} | ||
|
@@ -1093,7 +1097,15 @@ - (NSRange)rangeOfString:(NSString*)searchString options:(NSStringCompareOptions | |
@Status Interoperable | ||
*/ | ||
- (BOOL)isAbsolutePath { | ||
return ([self hasPrefix:_NSGetSlashStr()]) || ((_isLetter([self characterAtIndex:0])) && ([self characterAtIndex:1] == ':')); | ||
if ([self hasPrefix:_NSGetSlashStr()]) { | ||
return YES; | ||
} | ||
|
||
if (self.length >= 2) { | ||
return _isLetter([self characterAtIndex:0]) && [self characterAtIndex:1] == ':'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function is technically wrong, because Fixing it is out-of-scope for this change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Talked to DHowett offline, he's going to take a closer look at drive paths next iteration, and leave this slightly-wrong state for now. Be sure to add a comment about this status. |
||
} | ||
|
||
return NO; | ||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
surprised we didn't have this check already. use NSLocationInRange instead, though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't exactly want that here; if length is 5,
NSLocationInRange(5, {1,2})
will be false but that doesn't make this invalid.