summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2019-11-09 21:09:03 +0800
committerJohn Hodge <tpg@mutabah.net>2019-11-09 21:09:03 +0800
commit6d1213a9cd039b68d9826de0a7f9204e101e6624 (patch)
treeff9ac05088da0ec293291ea66edc422a9ff7351e
parent6be15b07fb5d56e1b2064ef2dd9bbf8ec8658d9a (diff)
downloadmrust-6d1213a9cd039b68d9826de0a7f9204e101e6624.tar.gz
Misc - Fix some warnings from MSVC
-rw-r--r--src/include/rc_string.hpp2
-rw-r--r--src/mir/mir.hpp4
-rw-r--r--src/rc_string.cpp4
3 files changed, 5 insertions, 5 deletions
diff --git a/src/include/rc_string.hpp b/src/include/rc_string.hpp
index 0d6ab155..bdf675ad 100644
--- a/src/include/rc_string.hpp
+++ b/src/include/rc_string.hpp
@@ -18,7 +18,7 @@ public:
RcString():
m_ptr(nullptr)
{}
- RcString(const char* s, unsigned int len);
+ RcString(const char* s, size_t len);
RcString(const char* s):
RcString(s, ::std::strlen(s))
{
diff --git a/src/mir/mir.hpp b/src/mir/mir.hpp
index 99698134..b2a89542 100644
--- a/src/mir/mir.hpp
+++ b/src/mir/mir.hpp
@@ -94,8 +94,8 @@ struct LValue
bool is_Static() const { return (val & 3) == 2; }
const char as_Return () const { assert(is_Return()); return 0; }
- const unsigned as_Argument() const { assert(is_Argument()); return (val >> 2) - 1; }
- const unsigned as_Local () const { assert(is_Local()); return val >> 2; }
+ const unsigned as_Argument() const { assert(is_Argument()); return static_cast<unsigned>( (val >> 2) - 1 ); }
+ const unsigned as_Local () const { assert(is_Local()); return static_cast<unsigned>(val >> 2); }
const ::HIR::Path& as_Static() const { assert(is_Static()); return *reinterpret_cast<const ::HIR::Path*>(val & ~3llu); }
::HIR::Path& as_Static() { assert(is_Static()); return *reinterpret_cast< ::HIR::Path*>(val & ~3llu); }
diff --git a/src/rc_string.cpp b/src/rc_string.cpp
index b56f2e62..31656a3b 100644
--- a/src/rc_string.cpp
+++ b/src/rc_string.cpp
@@ -11,14 +11,14 @@
#include <iostream>
#include <algorithm> // std::max
-RcString::RcString(const char* s, unsigned int len):
+RcString::RcString(const char* s, size_t len):
m_ptr(nullptr)
{
if( len > 0 )
{
m_ptr = new unsigned int[2 + (len+1 + sizeof(unsigned int)-1) / sizeof(unsigned int)];
m_ptr[0] = 1;
- m_ptr[1] = len;
+ m_ptr[1] = static_cast<unsigned>(len);
char* data_mut = reinterpret_cast<char*>(m_ptr + 2);
for(unsigned int j = 0; j < len; j ++ )
data_mut[j] = s[j];