diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2016-04-22 21:01:54 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2016-04-27 09:46:53 +0100 |
| commit | e01a658cea8f637781669ac664d0d4c2ca117282 (patch) | |
| tree | 91d54f9e5d4338afd5a84a2d50ad0688d0289344 /src | |
| parent | 717e37f2f36e80fd27b07e71fbafec048d1ef635 (diff) | |
Make use of strongly typed number to size_t conversion
Diffstat (limited to 'src')
| -rw-r--r-- | src/buffer.inl.hh | 2 | ||||
| -rw-r--r-- | src/string.hh | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/buffer.inl.hh b/src/buffer.inl.hh index 25ccb674..4417536d 100644 --- a/src/buffer.inl.hh +++ b/src/buffer.inl.hh @@ -164,7 +164,7 @@ inline const char& BufferIterator::operator[](size_t n) const inline size_t BufferIterator::operator-(const BufferIterator& iterator) const { 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 diff --git a/src/string.hh b/src/string.hh index c4bd86a4..390eacf1 100644 --- a/src/string.hh +++ b/src/string.hh @@ -95,8 +95,8 @@ class String : public StringOps<String, char> { public: String() {} - String(const char* content) : m_data(content, (size_t)(int)strlen(content)) {} - String(const char* content, ByteCount len) : m_data(content, (size_t)(int)len) {} + String(const char* content) : m_data(content, (size_t)strlen(content)) {} + String(const char* content, ByteCount len) : m_data(content, (size_t)len) {} explicit String(Codepoint cp, CharCount count = 1) { reserve(utf8::codepoint_size(cp) * (int)count); @@ -118,13 +118,13 @@ public: const char* c_str() const { return m_data.data(); } [[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 push_back(char c) { m_data.append(&c, 1); } - void force_size(ByteCount size) { m_data.force_size((size_t)(int)size); } - void reserve(ByteCount size) { m_data.reserve((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)size); } static const String ms_empty; |
