mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
Replaced eolLF with normalizeEolLf.
This commit is contained in:
@@ -255,7 +255,7 @@ namespace bx
|
||||
StringView strFindBlock(const StringView& _str, char _open, char _close);
|
||||
|
||||
// Normalize string to sane line endings.
|
||||
void eolLF(char* _out, int32_t _size, const char* _str);
|
||||
StringView normalizeEolLf(char* _out, int32_t _size, const StringView& _str);
|
||||
|
||||
// Finds identifier.
|
||||
StringView findIdentifierMatch(const StringView& _str, const StringView& _word);
|
||||
|
||||
@@ -643,12 +643,17 @@ namespace bx
|
||||
return StringView(term, term);
|
||||
}
|
||||
|
||||
void eolLF(char* _out, int32_t _size, const char* _str)
|
||||
StringView normalizeEolLf(char* _out, int32_t _size, const StringView& _str)
|
||||
{
|
||||
const char* start = _out;
|
||||
const char* end = _out;
|
||||
|
||||
if (0 < _size)
|
||||
{
|
||||
char* end = _out + _size - 1;
|
||||
for (char ch = *_str++; ch != '\0' && _out < end; ch = *_str++)
|
||||
const char* curr = _str.getPtr();
|
||||
const char* term = _str.getTerm();
|
||||
end = _out + _size;
|
||||
for (char ch = *curr; curr != term && _out < end; ch = *(++curr) )
|
||||
{
|
||||
if ('\r' != ch)
|
||||
{
|
||||
@@ -656,8 +661,10 @@ namespace bx
|
||||
}
|
||||
}
|
||||
|
||||
*_out = '\0';
|
||||
end = _out;
|
||||
}
|
||||
|
||||
return StringView(start, end);
|
||||
}
|
||||
|
||||
StringView findIdentifierMatch(const StringView& _str, const StringView& _word)
|
||||
|
||||
Reference in New Issue
Block a user