diff --git a/include/slice.h b/include/slice.h index f4c037f..8ff8eb7 100644 --- a/include/slice.h +++ b/include/slice.h @@ -34,12 +34,16 @@ class Slice { // Create a slice that refers to d[0,n-1]. Slice(const char* d, size_t n) : data_(d), size_(n) { } + + Slice(const unsigned char* d, size_t n) : data_(reinterpret_cast(d)), size_(n) { } // Create a slice that refers to the contents of "s" - Slice(const std::string& s) : data_(s.data()), size_(s.size()) { } + Slice(const std::string& s) : data_(s.data()), size_(static_cast(s.size())) { } // Create a slice that refers to s[0,strlen(s)-1] Slice(const char* s) : data_(s), size_(strlen(s)) { } + + Slice(const unsigned char* s) : data_(reinterpret_cast(s)), size_(strlen(reinterpret_cast(s))) { } // Return a pointer to the beginning of the referenced data const char* data() const { return data_; }