Fixes a bunch of msvc warnings

This commit is contained in:
Linus Probert 2018-08-05 14:38:58 +02:00
parent 3720eb1c19
commit 41a902181a
4 changed files with 8 additions and 3 deletions

View File

@ -264,7 +264,7 @@ if (NOT DEBUG_BUILD)
"pitlayouts.dat" "pitlayouts.dat"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data
) )
if (WIN32) if (WIN32 AND NOT MSVC)
add_definitions(-mwindows) add_definitions(-mwindows)
endif() endif()
else() else()

View File

@ -68,8 +68,12 @@
#define C_YELLOW (SDL_Color) { 255, 255, 0, 255 } #define C_YELLOW (SDL_Color) { 255, 255, 0, 255 }
#define C_BLACK (SDL_Color) { 0, 0, 0, 255 } #define C_BLACK (SDL_Color) { 0, 0, 0, 255 }
// MSVC seems to have min/max defined.
// Haven't looked into it further.
#ifndef _MSC_VER
#define max(a, b) (a > b ? a : b) #define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b) #define min(a, b) (a < b ? a : b)
#endif // _MSC_VER
typedef enum Direction_t { typedef enum Direction_t {
UP, DOWN, LEFT, RIGHT UP, DOWN, LEFT, RIGHT

View File

@ -255,7 +255,7 @@ particle_engine_sparkle(Position pos, Dimension dim)
alpha = get_random(155) + 100; alpha = get_random(155) + 100;
yv = -(get_random(100) + 100); yv = 0 - (get_random(100) + 100);
lt = get_random(20); lt = get_random(20);

View File

@ -24,6 +24,7 @@
#include <setjmp.h> #include <setjmp.h>
#include <cmocka.h> #include <cmocka.h>
#include "../src/hashtable.h" #include "../src/hashtable.h"
#include "../src/util.h"
static void test_hashtable_create(void **state) static void test_hashtable_create(void **state)
{ {
@ -113,7 +114,7 @@ static void test_hashtable_foreach(void **state)
int *num = malloc(sizeof(int)); int *num = malloc(sizeof(int));
assert_non_null( num ); assert_non_null( num );
*num = i; *num = i;
sprintf(str, "%d", *num); m_sprintf(str, 4, "%d", *num);
ht_set(table, str, num); ht_set(table, str, num);
} }