Use size_t for String size types

This commit is contained in:
Phil Nash 2017-08-05 22:53:21 +01:00
parent cff3818e68
commit b3b29f4b4c
5 changed files with 15 additions and 8 deletions

View file

@ -8,6 +8,7 @@
#define CATCH_STRINGDATA_H_INCLUDED
#include <atomic>
#include <cstddef>
namespace Catch {
@ -16,7 +17,7 @@ namespace Catch {
class StringData {
mutable std::atomic<unsigned int> m_refs;
public:
unsigned int size;
size_t size;
union {
char chars[1];
};
@ -26,7 +27,7 @@ namespace Catch {
}
static auto getEmpty() -> StringData*;
static auto create( StringRef const& stringRef ) -> StringData*;
static auto create( StringRef const& stringRef, unsigned long capacity ) -> StringData*;
static auto create( StringRef const& stringRef, size_t capacity ) -> StringData*;
void addRef() const noexcept {
if( m_refs > 0 )
@ -41,7 +42,7 @@ namespace Catch {
}
private:
StringData( unsigned int initialRef = 1 );
StringData( StringRef const& stringRef, unsigned long capacity );
StringData( StringRef const& stringRef, size_t capacity );
StringData( StringData const& ) = delete;
StringData& operator=( StringData const& ) = delete;