diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:17:51 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:17:51 +0200 |
commit | 237aedc590b58c0e69d7dfcac92b5f767b7c004a (patch) | |
tree | 83f361a82ba483f2daf83b677e8685cd953812d9 /zen/string_base.h | |
parent | 4.5 (diff) | |
download | FreeFileSync-237aedc590b58c0e69d7dfcac92b5f767b7c004a.tar.gz FreeFileSync-237aedc590b58c0e69d7dfcac92b5f767b7c004a.tar.bz2 FreeFileSync-237aedc590b58c0e69d7dfcac92b5f767b7c004a.zip |
4.6
Diffstat (limited to 'zen/string_base.h')
-rw-r--r-- | zen/string_base.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/zen/string_base.h b/zen/string_base.h index ffc2f839..88da13bf 100644 --- a/zen/string_base.h +++ b/zen/string_base.h @@ -9,6 +9,7 @@ #include <algorithm> #include <cassert> +#include <cstdint> #include "string_tools.h" #include <boost/detail/atomic_count.hpp> @@ -76,7 +77,7 @@ protected: newDescr->length = size; newDescr->capacity = newCapacity; - return reinterpret_cast<Char*>(newDescr + 1); + return reinterpret_cast<Char*>(newDescr + 1); //alignment note: "newDescr + 1" is Descriptor-aligned, which is larger than alignment for Char-array! => no problem! } static Char* clone(Char* ptr) @@ -101,8 +102,8 @@ protected: private: struct Descriptor { - size_t length; - size_t capacity; //allocated size without null-termination + std::uint32_t length; + std::uint32_t capacity; //allocated size without null-termination }; static Descriptor* descr( Char* ptr) { return reinterpret_cast< Descriptor*>(ptr) - 1; } @@ -173,8 +174,8 @@ private: Descriptor(long rc, size_t len, size_t cap) : refCount(rc), length(len), capacity(cap) {} boost::detail::atomic_count refCount; //practically no perf loss: ~0.2%! (FFS comparison) - size_t length; - size_t capacity; //allocated size without null-termination + std::uint32_t length; + std::uint32_t capacity; //allocated size without null-termination }; static Descriptor* descr( Char* ptr) { return reinterpret_cast< Descriptor*>(ptr) - 1; } |