mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #2491 from janisozaur/fixes
Fix some compiler warnings
This commit is contained in:
commit
e0195fcffd
|
@ -1,7 +1,11 @@
|
||||||
#include "addresses.h"
|
#include "addresses.h"
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
#define DISABLE_OPT __attribute__((noinline,optimize("O0")))
|
#ifdef __clang__
|
||||||
|
#define DISABLE_OPT __attribute__((noinline,optnone))
|
||||||
|
#else
|
||||||
|
#define DISABLE_OPT __attribute__((noinline,optimize("O0")))
|
||||||
|
#endif // __clang__
|
||||||
#else
|
#else
|
||||||
#define DISABLE_OPT
|
#define DISABLE_OPT
|
||||||
#endif // defined(__GNUC__)
|
#endif // defined(__GNUC__)
|
||||||
|
|
|
@ -98,7 +98,7 @@ int cmdline_run(const char **argv, int argc)
|
||||||
*/
|
*/
|
||||||
char** mutableArgv = malloc(argvsize);
|
char** mutableArgv = malloc(argvsize);
|
||||||
memcpy(mutableArgv,argv,argvsize);
|
memcpy(mutableArgv,argv,argvsize);
|
||||||
argc = argparse_parse(&argparse, argc, mutableArgv);
|
argc = argparse_parse(&argparse, argc, (const char**)mutableArgv);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
print_version();
|
print_version();
|
||||||
|
@ -130,7 +130,7 @@ int cmdline_run(const char **argv, int argc)
|
||||||
|
|
||||||
if (argc != 0) {
|
if (argc != 0) {
|
||||||
// see comment next to cmdline_call_action for expected return codes
|
// see comment next to cmdline_call_action for expected return codes
|
||||||
gExitCode = cmdline_call_action(mutableArgv, argc);
|
gExitCode = cmdline_call_action((const char**)mutableArgv, argc);
|
||||||
free(mutableArgv);
|
free(mutableArgv);
|
||||||
if (gExitCode < 0) {
|
if (gExitCode < 0) {
|
||||||
// action failed, don't change exit code
|
// action failed, don't change exit code
|
||||||
|
@ -236,7 +236,7 @@ struct { const char *firstArg; cmdline_action action; } cmdline_table[] = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function delegates starting the game to different handlers, if found.
|
* This function delegates starting the game to different handlers, if found.
|
||||||
*
|
*
|
||||||
* Three cases of return values are supported:
|
* Three cases of return values are supported:
|
||||||
* - result < 0 means failure, will exit with error code
|
* - result < 0 means failure, will exit with error code
|
||||||
* This case is useful when user provided wrong arguments or the requested
|
* This case is useful when user provided wrong arguments or the requested
|
||||||
|
|
|
@ -434,8 +434,8 @@ int cmdline_for_sprite(const char **argv, int argc)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("sprites: %lu\n", spriteFileHeader.num_entries);
|
printf("sprites: %u\n", spriteFileHeader.num_entries);
|
||||||
printf("data size: %lu\n", spriteFileHeader.total_size);
|
printf("data size: %u\n", spriteFileHeader.total_size);
|
||||||
|
|
||||||
sprite_file_close();
|
sprite_file_close();
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -459,7 +459,7 @@ int cmdline_for_sprite(const char **argv, int argc)
|
||||||
printf("height: %d\n", g1->height);
|
printf("height: %d\n", g1->height);
|
||||||
printf("x offset: %d\n", g1->x_offset);
|
printf("x offset: %d\n", g1->x_offset);
|
||||||
printf("y offset: %d\n", g1->y_offset);
|
printf("y offset: %d\n", g1->y_offset);
|
||||||
printf("data offset: 0x%lX\n", (uint32)g1->offset);
|
printf("data offset: 0x%X\n", (uint32)g1->offset);
|
||||||
|
|
||||||
sprite_file_close();
|
sprite_file_close();
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -11,6 +11,7 @@ void http_dispose() { }
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
#include "../core/Math.hpp"
|
||||||
|
|
||||||
// cURL includes windows.h, but we don't need all of it.
|
// cURL includes windows.h, but we don't need all of it.
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
@ -65,7 +66,7 @@ static size_t http_request_write_func(void *ptr, size_t size, size_t nmemb, void
|
||||||
int newCapacity = writeBuffer->capacity;
|
int newCapacity = writeBuffer->capacity;
|
||||||
int newLength = writeBuffer->length + newBytesLength;
|
int newLength = writeBuffer->length + newBytesLength;
|
||||||
while (newLength > newCapacity) {
|
while (newLength > newCapacity) {
|
||||||
newCapacity = max(4096, newCapacity * 2);
|
newCapacity = Math::Max(4096, newCapacity * 2);
|
||||||
}
|
}
|
||||||
if (newCapacity != writeBuffer->capacity) {
|
if (newCapacity != writeBuffer->capacity) {
|
||||||
writeBuffer->ptr = (char*)realloc(writeBuffer->ptr, newCapacity);
|
writeBuffer->ptr = (char*)realloc(writeBuffer->ptr, newCapacity);
|
||||||
|
|
|
@ -1343,7 +1343,7 @@ int Network::Client_Handle_MAP(NetworkConnection& connection, NetworkPacket& pac
|
||||||
chunk_buffer.resize(offset + chunksize);
|
chunk_buffer.resize(offset + chunksize);
|
||||||
}
|
}
|
||||||
char status[256];
|
char status[256];
|
||||||
sprintf(status, "Downloading map ... (%lu / %lu)", (offset + chunksize) / 1000, size / 1000);
|
sprintf(status, "Downloading map ... (%u / %u)", (offset + chunksize) / 1000, size / 1000);
|
||||||
window_network_status_open(status);
|
window_network_status_open(status);
|
||||||
memcpy(&chunk_buffer[offset], (void*)packet.Read(chunksize), chunksize);
|
memcpy(&chunk_buffer[offset], (void*)packet.Read(chunksize), chunksize);
|
||||||
if (offset + chunksize == size) {
|
if (offset + chunksize == size) {
|
||||||
|
|
|
@ -64,12 +64,17 @@ typedef utf16* utf16string;
|
||||||
#define ror32(x, shift) (((uint32)(x) >> (shift)) | ((uint32)(x) << (32 - (shift))))
|
#define ror32(x, shift) (((uint32)(x) >> (shift)) | ((uint32)(x) << (32 - (shift))))
|
||||||
#define rol64(x, shift) (((uint64)(x) << (shift)) | ((uint32)(x) >> (64 - (shift))))
|
#define rol64(x, shift) (((uint64)(x) << (shift)) | ((uint32)(x) >> (64 - (shift))))
|
||||||
#define ror64(x, shift) (((uint64)(x) >> (shift)) | ((uint32)(x) << (64 - (shift))))
|
#define ror64(x, shift) (((uint64)(x) >> (shift)) | ((uint32)(x) << (64 - (shift))))
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
// in C++ you should be using Math::Min and Math::Max
|
||||||
#ifndef min
|
#ifndef min
|
||||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
#ifndef max
|
#ifndef max
|
||||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
#define sgn(x) ((x > 0) ? 1 : ((x < 0) ? -1 : 0))
|
#define sgn(x) ((x > 0) ? 1 : ((x < 0) ? -1 : 0))
|
||||||
#define clamp(l, x, h) (min(h, max(l, x)))
|
#define clamp(l, x, h) (min(h, max(l, x)))
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ void window_server_start_open()
|
||||||
window->colours[1] = 26;
|
window->colours[1] = 26;
|
||||||
window->colours[2] = 26;
|
window->colours[2] = 26;
|
||||||
|
|
||||||
sprintf(_port, "%lu", gConfigNetwork.default_port);
|
sprintf(_port, "%u", gConfigNetwork.default_port);
|
||||||
safe_strncpy(_name, gConfigNetwork.server_name, sizeof(_name));
|
safe_strncpy(_name, gConfigNetwork.server_name, sizeof(_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue