mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Added comments
This commit is contained in:
parent
c901a657f8
commit
3019ca3408
@ -143,6 +143,8 @@ static size_t computeWidthImpl(const UInt8 * data, size_t size, size_t prefix, s
|
|||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Now i points to position in bytes after regular ASCII sequence
|
||||||
|
/// and if width > limit, then (width - limit) is the number of extra ASCII characters after width limit.
|
||||||
if (mode == BytesBeforLimit && width > limit)
|
if (mode == BytesBeforLimit && width > limit)
|
||||||
return i - (width - limit);
|
return i - (width - limit);
|
||||||
|
|
||||||
|
@ -99,7 +99,17 @@ int queryConvert(const CharT * bytes, int length)
|
|||||||
/// and include `\t` to the nearest longer length with multiple of eight.
|
/// and include `\t` to the nearest longer length with multiple of eight.
|
||||||
size_t computeWidth(const UInt8 * data, size_t size, size_t prefix = 0) noexcept;
|
size_t computeWidth(const UInt8 * data, size_t size, size_t prefix = 0) noexcept;
|
||||||
|
|
||||||
/// Calculate the maximum number of bytes, so that substring of this size fits in 'limit' width.
|
|
||||||
|
/** Calculate the maximum number of bytes, so that substring of this size fits in 'limit' width.
|
||||||
|
*
|
||||||
|
* For example, we have string "x你好", it has 3 code points and visible width of 5 and byte size of 7.
|
||||||
|
|
||||||
|
* Suppose we have limit = 3.
|
||||||
|
* Then we have to return 4 as maximum number of bytes
|
||||||
|
* and the truncated string will be "x你": two code points, visible width 3, byte size 4.
|
||||||
|
*
|
||||||
|
* The same result will be for limit 4, because the last character would not fit.
|
||||||
|
*/
|
||||||
size_t computeBytesBeforeWidth(const UInt8 * data, size_t size, size_t prefix, size_t limit) noexcept;
|
size_t computeBytesBeforeWidth(const UInt8 * data, size_t size, size_t prefix, size_t limit) noexcept;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user