diff --git a/desktop_version/src/CWrappers.cpp b/desktop_version/src/CWrappers.cpp index 9f826196..959ed707 100644 --- a/desktop_version/src/CWrappers.cpp +++ b/desktop_version/src/CWrappers.cpp @@ -1,11 +1,10 @@ +#include "CWrappers.h" + #include #include "Localization.h" #include "UtilityClass.h" -extern "C" -{ - char* HELP_number_words(int _t) { /* C wrapper for UtilityClass::number_words. @@ -24,5 +23,3 @@ uint32_t LOC_toupper_ch(uint32_t ch) { return loc::toupper_ch(ch); } - -} /* extern "C" */ diff --git a/desktop_version/src/CWrappers.h b/desktop_version/src/CWrappers.h index f24e5e25..d1aad758 100644 --- a/desktop_version/src/CWrappers.h +++ b/desktop_version/src/CWrappers.h @@ -1,7 +1,17 @@ #ifndef CWRAPPERS_H #define CWRAPPERS_H +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + char* HELP_number_words(int _t); uint32_t LOC_toupper_ch(uint32_t ch); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* CWRAPPERS_H */ diff --git a/desktop_version/src/Textbook.c b/desktop_version/src/Textbook.c index d51ae979..b314d1b6 100644 --- a/desktop_version/src/Textbook.c +++ b/desktop_version/src/Textbook.c @@ -108,5 +108,5 @@ const char* textbook_store(Textbook* textbook, const char* text) return ""; } - return textbook_store_raw(textbook, text, SDL_strlen(text)+1); + return (const char*) textbook_store_raw(textbook, text, SDL_strlen(text)+1); } diff --git a/desktop_version/src/VFormat.c b/desktop_version/src/VFormat.c index 9147835d..81fd1aaf 100644 --- a/desktop_version/src/VFormat.c +++ b/desktop_version/src/VFormat.c @@ -39,7 +39,7 @@ int vformat_button(ActionSet actionset, int action) static void vformat_unbutton(ActionSet* actionset, Action* action, const int vararg_value) { // Unpack the ActionSet and Action from a packed vararg value. - *actionset = vararg_value >> 16; + *actionset = (ActionSet) (vararg_value >> 16); action->intval = vararg_value & 0xFFFF; } @@ -207,7 +207,11 @@ void vformat_cb_valist( * The arguments index string is comma-separated, * each argument is name:type. */ va_list args_copy; +#ifndef va_copy /* Older VS releases don't have this yet, just copy the old way */ + args_copy = args; +#else va_copy(args_copy, args); +#endif const char* args_index_cursor = args_index; @@ -385,11 +389,10 @@ size_t vformat_buf_valist( { /* Variant of vformat_buf which takes a va_list instead of `...` */ - buffer_info buf = { - .total_needed = 1, - .buffer_cursor = buffer, - .buffer_left = buffer_len - }; + buffer_info buf; + buf.total_needed = 1; + buf.buffer_cursor = buffer; + buf.buffer_left = buffer_len; if (buf.buffer_left != 0) { @@ -438,7 +441,7 @@ char* vformat_alloc_valist( /* Variant of vformat_alloc which takes a va_list instead of `...` */ size_t needed = vformat_buf_valist(NULL, 0, format_string, args_index, args); - char* buffer = SDL_malloc(needed); + char* buffer = (char*) SDL_malloc(needed); if (buffer == NULL) { return NULL; diff --git a/desktop_version/src/Vlogging.c b/desktop_version/src/Vlogging.c index 5e61bf57..2b00095c 100644 --- a/desktop_version/src/Vlogging.c +++ b/desktop_version/src/Vlogging.c @@ -1,4 +1,5 @@ -#include +#include "Vlogging.h" + #include #include @@ -258,6 +259,10 @@ static void check_color_support(void) return; } + /* Older VS releases don't have this defined yet */ + #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING + #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 + #endif const BOOL success = SetConsoleMode( hStdout, ENABLE_PROCESSED_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING ); diff --git a/desktop_version/src/Xoshiro.c b/desktop_version/src/Xoshiro.c index c10d8d07..667c9969 100644 --- a/desktop_version/src/Xoshiro.c +++ b/desktop_version/src/Xoshiro.c @@ -1,4 +1,4 @@ -#include +#include "Xoshiro.h" #include "Vlogging.h"