Replace size_t with std::size_t
For some reason Clang's AST API doesn't like size_tmaster
parent
6ca0757fec
commit
61ec101b11
|
@ -19,6 +19,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
|
||||
/**
|
||||
|
@ -36,7 +37,7 @@ inline std::unique_ptr<T> MakeUnique(Args&&... args)
|
|||
* It can be replaced with std::make_unique once we use C++14
|
||||
*/
|
||||
template<typename T>
|
||||
inline std::unique_ptr<T[]> MakeUniqueArray(size_t size)
|
||||
inline std::unique_ptr<T[]> MakeUniqueArray(std::size_t size)
|
||||
{
|
||||
return std::unique_ptr<T[]>(new T[size]);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ bool CInputStream::is_open()
|
|||
}
|
||||
|
||||
|
||||
size_t CInputStream::size()
|
||||
std::size_t CInputStream::size()
|
||||
{
|
||||
return static_cast<CInputStreamBuffer *>(rdbuf())->size();
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
|
@ -33,5 +34,5 @@ public:
|
|||
void open(const std::string& filename);
|
||||
void close();
|
||||
bool is_open();
|
||||
size_t size();
|
||||
std::size_t size();
|
||||
};
|
||||
|
|
|
@ -26,13 +26,13 @@
|
|||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
|
||||
CInputStreamBuffer::CInputStreamBuffer(size_t bufferSize)
|
||||
CInputStreamBuffer::CInputStreamBuffer(std::size_t bufferSize)
|
||||
: m_bufferSize(bufferSize)
|
||||
, m_file(nullptr)
|
||||
{
|
||||
if (bufferSize <= 0)
|
||||
{
|
||||
throw std::runtime_error("File buffer must be larger then 0 bytes");
|
||||
throw std::runtime_error("File buffer must be larger than 0 bytes");
|
||||
}
|
||||
|
||||
m_buffer = MakeUniqueArray<char>(bufferSize);
|
||||
|
@ -65,7 +65,7 @@ bool CInputStreamBuffer::is_open()
|
|||
}
|
||||
|
||||
|
||||
size_t CInputStreamBuffer::size()
|
||||
std::size_t CInputStreamBuffer::size()
|
||||
{
|
||||
return PHYSFS_fileLength(m_file);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <streambuf>
|
||||
#include <string>
|
||||
|
@ -28,7 +29,7 @@
|
|||
class CInputStreamBuffer : public std::streambuf
|
||||
{
|
||||
public:
|
||||
CInputStreamBuffer(size_t bufferSize = 512);
|
||||
CInputStreamBuffer(std::size_t bufferSize = 512);
|
||||
virtual ~CInputStreamBuffer();
|
||||
|
||||
CInputStreamBuffer(const CInputStreamBuffer &) = delete;
|
||||
|
@ -37,7 +38,7 @@ public:
|
|||
void open(const std::string &filename);
|
||||
void close();
|
||||
bool is_open();
|
||||
size_t size();
|
||||
std::size_t size();
|
||||
|
||||
private:
|
||||
int_type underflow() override;
|
||||
|
@ -45,7 +46,7 @@ private:
|
|||
std::streampos seekpos(std::streampos sp, std::ios_base::openmode which) override;
|
||||
std::streampos seekoff(std::streamoff off, std::ios_base::seekdir way, std::ios_base::openmode which) override;
|
||||
|
||||
const size_t m_bufferSize;
|
||||
const std::size_t m_bufferSize;
|
||||
PHYSFS_File *m_file;
|
||||
std::unique_ptr<char[]> m_buffer;
|
||||
};
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
|
||||
COutputStreamBuffer::COutputStreamBuffer(size_t bufferSize)
|
||||
COutputStreamBuffer::COutputStreamBuffer(std::size_t bufferSize)
|
||||
: m_file(nullptr)
|
||||
{
|
||||
if (bufferSize <= 0)
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <streambuf>
|
||||
#include <string>
|
||||
|
@ -28,7 +29,7 @@
|
|||
class COutputStreamBuffer : public std::streambuf
|
||||
{
|
||||
public:
|
||||
COutputStreamBuffer(size_t bufferSize = 512);
|
||||
COutputStreamBuffer(std::size_t bufferSize = 512);
|
||||
virtual ~COutputStreamBuffer();
|
||||
|
||||
COutputStreamBuffer(const COutputStreamBuffer &) = delete;
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace
|
|||
|
||||
std::string VFormat(const char *fmt, va_list ap)
|
||||
{
|
||||
size_t size = 1024;
|
||||
std::size_t size = 1024;
|
||||
char stackbuf[1024];
|
||||
std::vector<char> dynamicbuf;
|
||||
char *buf = &stackbuf[0];
|
||||
|
@ -41,7 +41,7 @@ std::string VFormat(const char *fmt, va_list ap)
|
|||
|
||||
if (needed <= static_cast<int>(size) && needed >= 0)
|
||||
{
|
||||
return std::string(buf, static_cast<size_t>(needed));
|
||||
return std::string(buf, static_cast<std::size_t>(needed));
|
||||
}
|
||||
|
||||
size = (needed > 0) ? (needed+1) : (size*2);
|
||||
|
@ -64,7 +64,7 @@ std::string StrUtils::Format(const char *fmt, ...)
|
|||
std::string StrUtils::Replace(const std::string &str, const std::string &oldStr, const std::string &newStr)
|
||||
{
|
||||
std::string result = str;
|
||||
size_t pos = 0;
|
||||
std::size_t pos = 0;
|
||||
while ((pos = str.find(oldStr, pos)) != std::string::npos)
|
||||
{
|
||||
result.replace(pos, oldStr.length(), newStr);
|
||||
|
@ -174,9 +174,9 @@ int StrUtils::Utf8CharSizeAt(const std::string &str, unsigned int pos)
|
|||
return 0;
|
||||
}
|
||||
|
||||
size_t StrUtils::Utf8StringLength(const std::string &str)
|
||||
std::size_t StrUtils::Utf8StringLength(const std::string &str)
|
||||
{
|
||||
size_t result = 0;
|
||||
std::size_t result = 0;
|
||||
unsigned int i = 0;
|
||||
while (i < str.size())
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
|
@ -82,7 +82,7 @@ std::wstring Utf8StringToUnicode(const std::string &str);
|
|||
int Utf8CharSizeAt(const std::string &str, unsigned int pos);
|
||||
|
||||
//! Returns the length in characters of UTF-8 string \a str
|
||||
size_t Utf8StringLength(const std::string &str);
|
||||
std::size_t Utf8StringLength(const std::string &str);
|
||||
|
||||
} // namespace StrUtil
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ bool CTerrain::InitTextures(const std::string& baseName, int* table, int dx, int
|
|||
m_useMaterials = false;
|
||||
|
||||
m_texBaseName = baseName;
|
||||
size_t pos = baseName.rfind('.');
|
||||
auto pos = baseName.rfind('.');
|
||||
if(pos < baseName.find_last_of('/')) pos = std::string::npos; // If last . is not a part of filename (some directory, possibly . or ..)
|
||||
|
||||
if (pos == std::string::npos)
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <array>
|
||||
|
||||
/**
|
||||
|
@ -42,4 +43,4 @@ enum class ObjectInterfaceType
|
|||
Max //!< maximum value (for getting number of items in enum)
|
||||
};
|
||||
|
||||
using ObjectInterfaceTypes = std::array<bool, static_cast<size_t>(ObjectInterfaceType::Max)>;
|
||||
using ObjectInterfaceTypes = std::array<bool, static_cast<std::size_t>(ObjectInterfaceType::Max)>;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "sound/oalsound/check.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
|
||||
|
||||
|
@ -78,7 +79,7 @@ bool Buffer::LoadFromFile(std::string filename, SoundType sound)
|
|||
std::vector<uint16_t> data;
|
||||
std::array<int16_t, 4096> buffer;
|
||||
data.reserve(file->GetFileInfo().frames);
|
||||
size_t read = 0;
|
||||
std::size_t read = 0;
|
||||
while ((read = file->Read(buffer.data(), buffer.size())) != 0)
|
||||
{
|
||||
data.insert(data.end(), buffer.begin(), buffer.begin() + read);
|
||||
|
|
Loading…
Reference in New Issue