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)
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
# See details in src/openrct2.c:openrct2_setup_rct2_segment for how the values
@ -143,23 +144,22 @@ else (STATIC)
endif (STATIC)
if (STATIC)
SET(REQUIREDLIBS ${PNG_STATIC_LIBRARIES} ${ZLIB_STATIC_LIBRARIES})
SET(REQUIREDLIBS ${PNG_STATIC_LIBRARIES} ${JANSSON_STATIC_LIBRARIES} ${ZLIB_STATIC_LIBRARIES})
else (STATIC)
SET(REQUIREDLIBS ${PNG_LIBRARIES} ${ZLIB_LIBRARIES})
SET(REQUIREDLIBS ${PNG_LIBRARIES} ${JANSSON_LIBRARIES} ${ZLIB_LIBRARIES})
endif (STATIC)
if (NOT DISABLE_HTTP_TWITCH)
PKG_CHECK_MODULES(LIBCURL REQUIRED libcurl)
PKG_CHECK_MODULES(JANSSON REQUIRED jansson>=2.7)
if (WIN32)
# Curl depends on openssl and ws2 in mingw builds, but is not wired up in pkg-config
PKG_CHECK_MODULES(SSL REQUIRED openssl)
set(WSLIBS ws2_32)
endif (WIN32)
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)
SET(HTTPLIBS ${LIBCURL_LIBRARIES} ${JANSSON_LIBRARIES} ${SSL_LIBRARIES} ${WSLIBS})
SET(HTTPLIBS ${LIBCURL_LIBRARIES} ${SSL_LIBRARIES} ${WSLIBS})
endif (STATIC)
endif (NOT DISABLE_HTTP_TWITCH)

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);