1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 06:44:38 +01:00

Fixes for GCC

Makes jansson library required as well
This commit is contained in:
Michał Janiszewski
2016-01-31 12:11:09 +01:00
committed by IntelOrca
parent c99ec93295
commit d274abdcce
5 changed files with 13 additions and 11 deletions

View File

@@ -14,6 +14,8 @@ template<typename T>
class List : public std::vector<T>
{
public:
typedef typename std::vector<T>::const_reference const_reference;
typedef typename std::vector<T>::reference reference;
size_t GetCapacity() const { return this->capacity(); }
size_t GetCount() const { return this->size(); }
const T * GetItems() const { return this->data(); }
@@ -54,7 +56,7 @@ public:
{
for (size_t i = 0; i < this->size(); i++)
{
if (_items[i] == item)
if (*this[i] == item)
{
RemoveAt(i);
return true;

View File

@@ -31,7 +31,7 @@ namespace Memory
template<typename T>
T * Reallocate(T * ptr, size_t size)
{
if (ptr == NULL)
if (ptr == nullptr)
{
return (T*)malloc(size);
}
@@ -44,7 +44,7 @@ namespace Memory
template<typename T>
T * ReallocateArray(T * ptr, size_t count)
{
if (ptr == NULL)
if (ptr == nullptr)
{
return (T*)malloc(count * sizeof(T));
}
@@ -105,7 +105,7 @@ namespace Memory
{
for (size_t i = 0; i < count; i++)
{
ptr[i]::~T();
ptr[i].~T();
}
Free(ptr);
}

View File

@@ -60,7 +60,7 @@ namespace String
{
const utf8 * lastOccurance = nullptr;
const utf8 * ch = str;
for (; ch != '\0'; ch++)
for (; *ch != '\0'; ch++)
{
if (*ch == match)
{

View File

@@ -7,7 +7,7 @@ extern "C"
namespace String
{
constexpr utf8 * Empty = "";
constexpr const utf8 * Empty = "";
bool IsNullOrEmpty(const utf8 * str);
bool Equals(const utf8 * a, const utf8 * b, bool ignoreCase = false);