mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[ion] unicode: UTF8Helper::CopyAndRemoveCodePoints returns a boolean
which is true if the whole source was copied
This commit is contained in:
@@ -22,7 +22,7 @@ const char * NotCodePointSearch(const char * s, CodePoint c, bool goingLeft = fa
|
||||
|
||||
/* Copy src into dst while removing all code points in codePoints. Ensure null-
|
||||
* termination of dst. */
|
||||
void CopyAndRemoveCodePoints(char * dst, size_t dstSize, const char * src, CodePoint * codePoints, int numberOfCodePoints);
|
||||
bool CopyAndRemoveCodePoints(char * dst, size_t dstSize, const char * src, CodePoint * codePoints, int numberOfCodePoints);
|
||||
|
||||
/* Remove all code points c. and update an index that should be lower if code
|
||||
* points where removed before it. Ensure null-termination of dst. */
|
||||
|
||||
@@ -94,14 +94,14 @@ const char * NotCodePointSearch(const char * s, CodePoint c, bool goingLeft, con
|
||||
return codePointPointer;
|
||||
}
|
||||
|
||||
void CopyAndRemoveCodePoints(char * dst, size_t dstSize, const char * src, CodePoint * codePoints, int numberOfCodePoints) {
|
||||
bool CopyAndRemoveCodePoints(char * dst, size_t dstSize, const char * src, CodePoint * codePoints, int numberOfCodePoints) {
|
||||
UTF8Decoder decoder(src);
|
||||
CodePoint codePoint = decoder.nextCodePoint();
|
||||
if (dstSize <= 0) {
|
||||
return;
|
||||
return codePoint == UCodePointNull;
|
||||
}
|
||||
assert(numberOfCodePoints >= 1);
|
||||
UTF8Decoder decoder(src);
|
||||
const char * currentPointer = src;
|
||||
CodePoint codePoint = decoder.nextCodePoint();
|
||||
const char * nextPointer = decoder.stringPosition();
|
||||
size_t bufferIndex = 0;
|
||||
|
||||
@@ -128,6 +128,7 @@ void CopyAndRemoveCodePoints(char * dst, size_t dstSize, const char * src, CodeP
|
||||
nextPointer = decoder.stringPosition();
|
||||
}
|
||||
*(dst + bufferIndex) = 0;
|
||||
return codePoint == UCodePointNull;
|
||||
}
|
||||
|
||||
void RemoveCodePoint(char * buffer, CodePoint c, const char * * pointerToUpdate, const char * stoppingPosition) {
|
||||
|
||||
Reference in New Issue
Block a user