From e01a658cea8f637781669ac664d0d4c2ca117282 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 22 Apr 2016 21:01:54 +0100 Subject: [PATCH] Make use of strongly typed number to size_t conversion --- src/buffer.inl.hh | 2 +- 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 { 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;