1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 09:32:29 +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

@@ -51,6 +51,7 @@ if (NOT PNG_FOUND)
endif (NOT PNG_FOUND) endif (NOT PNG_FOUND)
PKG_CHECK_MODULES(ZLIB REQUIRED zlib) PKG_CHECK_MODULES(ZLIB REQUIRED zlib)
PKG_CHECK_MODULES(JANSSON REQUIRED jansson>=2.7)
# Handle creating the rct2 text and data files on OS X and Linux # Handle creating the rct2 text and data files on OS X and Linux
# See details in src/openrct2.c:openrct2_setup_rct2_segment for how the values # See details in src/openrct2.c:openrct2_setup_rct2_segment for how the values
@@ -143,23 +144,22 @@ else (STATIC)
endif (STATIC) endif (STATIC)
if (STATIC) if (STATIC)
SET(REQUIREDLIBS ${PNG_STATIC_LIBRARIES} ${ZLIB_STATIC_LIBRARIES}) SET(REQUIREDLIBS ${PNG_STATIC_LIBRARIES} ${JANSSON_STATIC_LIBRARIES} ${ZLIB_STATIC_LIBRARIES})
else (STATIC) else (STATIC)
SET(REQUIREDLIBS ${PNG_LIBRARIES} ${ZLIB_LIBRARIES}) SET(REQUIREDLIBS ${PNG_LIBRARIES} ${JANSSON_LIBRARIES} ${ZLIB_LIBRARIES})
endif (STATIC) endif (STATIC)
if (NOT DISABLE_HTTP_TWITCH) if (NOT DISABLE_HTTP_TWITCH)
PKG_CHECK_MODULES(LIBCURL REQUIRED libcurl) PKG_CHECK_MODULES(LIBCURL REQUIRED libcurl)
PKG_CHECK_MODULES(JANSSON REQUIRED jansson>=2.7)
if (WIN32) if (WIN32)
# Curl depends on openssl and ws2 in mingw builds, but is not wired up in pkg-config # Curl depends on openssl and ws2 in mingw builds, but is not wired up in pkg-config
PKG_CHECK_MODULES(SSL REQUIRED openssl) PKG_CHECK_MODULES(SSL REQUIRED openssl)
set(WSLIBS ws2_32) set(WSLIBS ws2_32)
endif (WIN32) endif (WIN32)
if (STATIC) if (STATIC)
SET(HTTPLIBS ${LIBCURL_STATIC_LIBRARIES} ${JANSSON_STATIC_LIBRARIES} ${SSL_STATIC_LIBRARIES} ${WSLIBS}) SET(HTTPLIBS ${LIBCURL_STATIC_LIBRARIES} ${SSL_STATIC_LIBRARIES} ${WSLIBS})
else (STATIC) else (STATIC)
SET(HTTPLIBS ${LIBCURL_LIBRARIES} ${JANSSON_LIBRARIES} ${SSL_LIBRARIES} ${WSLIBS}) SET(HTTPLIBS ${LIBCURL_LIBRARIES} ${SSL_LIBRARIES} ${WSLIBS})
endif (STATIC) endif (STATIC)
endif (NOT DISABLE_HTTP_TWITCH) endif (NOT DISABLE_HTTP_TWITCH)

View File

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

View File

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

View File

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

View File

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