Make use of strongly typed number to size_t conversion
This commit is contained in:
parent
717e37f2f3
commit
e01a658cea
|
@ -164,7 +164,7 @@ inline const char& BufferIterator::operator[](size_t n) const
|
||||||
inline size_t BufferIterator::operator-(const BufferIterator& iterator) const
|
inline size_t BufferIterator::operator-(const BufferIterator& iterator) const
|
||||||
{
|
{
|
||||||
kak_assert(m_buffer == iterator.m_buffer);
|
kak_assert(m_buffer == iterator.m_buffer);
|
||||||
return (size_t)(int)m_buffer->distance(iterator.m_coord, m_coord);
|
return (size_t)m_buffer->distance(iterator.m_coord, m_coord);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline BufferIterator BufferIterator::operator+(ByteCount size) const
|
inline BufferIterator BufferIterator::operator+(ByteCount size) const
|
||||||
|
|
|
@ -95,8 +95,8 @@ class String : public StringOps<String, char>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
String() {}
|
String() {}
|
||||||
String(const char* content) : m_data(content, (size_t)(int)strlen(content)) {}
|
String(const char* content) : m_data(content, (size_t)strlen(content)) {}
|
||||||
String(const char* content, ByteCount len) : m_data(content, (size_t)(int)len) {}
|
String(const char* content, ByteCount len) : m_data(content, (size_t)len) {}
|
||||||
explicit String(Codepoint cp, CharCount count = 1)
|
explicit String(Codepoint cp, CharCount count = 1)
|
||||||
{
|
{
|
||||||
reserve(utf8::codepoint_size(cp) * (int)count);
|
reserve(utf8::codepoint_size(cp) * (int)count);
|
||||||
|
@ -118,13 +118,13 @@ public:
|
||||||
const char* c_str() const { return m_data.data(); }
|
const char* c_str() const { return m_data.data(); }
|
||||||
|
|
||||||
[[gnu::always_inline]]
|
[[gnu::always_inline]]
|
||||||
void append(const char* data, ByteCount count) { m_data.append(data, (size_t)(int)count); }
|
void append(const char* data, ByteCount count) { m_data.append(data, (size_t)count); }
|
||||||
|
|
||||||
void clear() { m_data.clear(); }
|
void clear() { m_data.clear(); }
|
||||||
|
|
||||||
void push_back(char c) { m_data.append(&c, 1); }
|
void push_back(char c) { m_data.append(&c, 1); }
|
||||||
void force_size(ByteCount size) { m_data.force_size((size_t)(int)size); }
|
void force_size(ByteCount size) { m_data.force_size((size_t)size); }
|
||||||
void reserve(ByteCount size) { m_data.reserve((size_t)(int)size); }
|
void reserve(ByteCount size) { m_data.reserve((size_t)size); }
|
||||||
|
|
||||||
static const String ms_empty;
|
static const String ms_empty;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user