diff options
author | Paul Gilbert | 2019-09-25 20:11:12 -0700 |
---|---|---|
committer | Paul Gilbert | 2019-09-25 20:13:28 -0700 |
commit | 239fbce8e3741a4b02339c2ecc5fce53cee6562e (patch) | |
tree | 732180aea423b438f2177db2df4897af1ad60fce /engines | |
parent | 9e17ff0c75ea790b2619a920b77b580f9d8d1ce2 (diff) | |
download | scummvm-rg350-239fbce8e3741a4b02339c2ecc5fce53cee6562e.tar.gz scummvm-rg350-239fbce8e3741a4b02339c2ecc5fce53cee6562e.tar.bz2 scummvm-rg350-239fbce8e3741a4b02339c2ecc5fce53cee6562e.zip |
GLK: ADRIFT: gcc compilation fixes
Diffstat (limited to 'engines')
-rw-r--r-- | engines/glk/adrift/os_glk.cpp | 58 | ||||
-rw-r--r-- | engines/glk/adrift/scare.h | 3 | ||||
-rw-r--r-- | engines/glk/adrift/scexpr.cpp | 2 | ||||
-rw-r--r-- | engines/glk/adrift/sclibrar.cpp | 6 | ||||
-rw-r--r-- | engines/glk/adrift/sctaffil.cpp | 16 | ||||
-rw-r--r-- | engines/glk/adrift/sctafpar.cpp | 8 | ||||
-rw-r--r-- | engines/glk/adrift/sxmain.cpp | 4 | ||||
-rw-r--r-- | engines/glk/detection.cpp | 4 |
8 files changed, 50 insertions, 51 deletions
diff --git a/engines/glk/adrift/os_glk.cpp b/engines/glk/adrift/os_glk.cpp index b08dfbb93a..dce48f81c6 100644 --- a/engines/glk/adrift/os_glk.cpp +++ b/engines/glk/adrift/os_glk.cpp @@ -82,9 +82,9 @@ static int gsc_commands_enabled = TRUE, gsc_abbreviations_enabled = TRUE, sc_game gsc_game = nullptr; /* Special out-of-band os_confirm() options used locally with os_glk. */ -static const sc_int GSC_CONF_SUBTLE_HINT = INT_MAX, - GSC_CONF_UNSUBTLE_HINT = INT_MAX - 1, - GSC_CONF_CONTINUE_HINTS = INT_MAX - 2; +static const sc_int GSC_CONF_SUBTLE_HINT = INTEGER_MAX, + GSC_CONF_UNSUBTLE_HINT = INTEGER_MAX - 1, + GSC_CONF_CONTINUE_HINTS = INTEGER_MAX - 2; /* Forward declaration of event wait functions, and a short delay. */ static void gsc_event_wait_2(glui32 wait_type_1, @@ -120,7 +120,7 @@ static void gsc_fatal(const char *string) { g_vm->glk_set_window(gsc_main_window); g_vm->glk_set_style(style_Normal); g_vm->glk_put_string("\n\nINTERNAL ERROR: "); - g_vm->glk_put_string((char *) string); + g_vm->glk_put_string((const char *)string); g_vm->glk_put_string("\n\nPlease record the details of this error, try to" " note down everything you did to cause it, and email" @@ -549,7 +549,7 @@ static void gsc_put_char_uni(glui32 unicode, const char *ascii) { /* Print ascii to the transcript, then reattach it. */ if (gsc_transcript_stream) { if (ascii) - g_vm->glk_put_string_stream(gsc_transcript_stream, (char *) ascii); + g_vm->glk_put_string_stream(gsc_transcript_stream, (const char *)ascii); else g_vm->glk_put_char_stream(gsc_transcript_stream, '?'); @@ -630,7 +630,7 @@ static void gsc_put_char_locale(sc_char ch, const gsc_locale_t *locale, sc_bool * directly with Glk. */ if (ascii) { - g_vm->glk_put_string((char *) ascii); + g_vm->glk_put_string((const char *)ascii); return; } @@ -1484,7 +1484,7 @@ static void gsc_styled_string(glui32 style, const char *message) { assert(message); g_vm->glk_set_style(style); - g_vm->glk_put_string((char *) message); + g_vm->glk_put_string((const char *)message); g_vm->glk_set_style(style_Normal); } @@ -1585,6 +1585,7 @@ void os_display_hints(sc_game game) { * Stub functions. The unused variables defeat gcc warnings. */ void os_play_sound(const sc_char *filepath, sc_int offset, sc_int length, sc_bool is_looping) { +/* const sc_char *unused1; sc_int unused2, unused3; sc_bool unused4; @@ -1592,6 +1593,7 @@ void os_play_sound(const sc_char *filepath, sc_int offset, sc_int length, sc_boo unused2 = offset; unused3 = length; unused4 = is_looping; +*/ } void os_stop_sound() { @@ -1640,11 +1642,13 @@ void os_show_graphic(const sc_char *filepath, sc_int offset, sc_int length) { } #else void os_show_graphic(const sc_char *filepath, sc_int offset, sc_int length) { +/* const sc_char *unused1; sc_int unused2, unused3; unused1 = filepath; unused2 = offset; unused3 = length; +*/ } #endif @@ -2527,7 +2531,7 @@ sc_bool os_confirm(sc_int type) { do { g_vm->glk_request_char_event(gsc_main_window); gsc_event_wait(evtype_CharInput, &event); - } while (event.val1 > UCHAR_MAX); + } while (event.val1 > BYTE_MAX); response = g_vm->glk_char_to_upper(event.val1); } while (response != 'Y' && response != 'N'); @@ -2601,6 +2605,9 @@ static void gsc_event_wait_2(glui32 wait_type_1, glui32 wait_type_2, event_t *ev /* Refresh any sensitive windows on size events. */ gsc_status_redraw(); break; + + default: + break; } } while (!(event->type == (EvType)wait_type_1 || event->type == (EvType)wait_type_2)); } @@ -2656,14 +2663,14 @@ void os_write_file(void *opaque, const sc_byte *buffer, sc_int length) { strid_t stream = (strid_t) opaque; assert(opaque && buffer); - g_vm->glk_put_buffer_stream(stream, (char *) buffer, length); + g_vm->glk_put_buffer_stream(stream, (const char *)buffer, length); } sc_int os_read_file(void *opaque, sc_byte *buffer, sc_int length) { strid_t stream = (strid_t) opaque; assert(opaque && buffer); - return g_vm->glk_get_buffer_stream(stream, (char *) buffer, length); + return g_vm->glk_get_buffer_stream(stream, (char *)buffer, length); } @@ -2694,7 +2701,7 @@ enum gsc_end_option { GAME_RESTART, GAME_UNDO, GAME_QUIT }; * The following value needs to be passed between the startup_code and main * functions. */ -static char *gsc_game_message = nullptr; +static const char *gsc_game_message; /* @@ -2737,7 +2744,7 @@ static enum gsc_end_option gsc_get_ending_option() { { g_vm->glk_request_char_event(gsc_main_window); gsc_event_wait(evtype_CharInput, &event); - } while (event.val1 > UCHAR_MAX); + } while (event.val1 > BYTE_MAX); response = g_vm->glk_char_to_upper(event.val1); } while (response != 'R' && response != 'U' && response != 'Q'); @@ -2844,8 +2851,9 @@ static int gsc_startup_code(Common::SeekableReadStream *game_stream, int restore if (!gsc_game) { gsc_game = nullptr; gsc_game_message = "Unable to load an Adrift game from the requested file."; - } else + } else { gsc_game_message = nullptr; + } /* * If the game was created successfully and there is a restore stream, try @@ -3037,30 +3045,30 @@ void adrift_main() { */ glkunix_argumentlist_t glkunix_arguments[] = { { - (char *) "-nc", glkunix_arg_NoValue, - (char *) "-nc No local handling for Glk special commands" + (const char *)"-nc", glkunix_arg_NoValue, + (const char *)"-nc No local handling for Glk special commands" }, { - (char *) "-na", glkunix_arg_NoValue, - (char *) "-na Turn off abbreviation expansions" + (const char *)"-na", glkunix_arg_NoValue, + (const char *)"-na Turn off abbreviation expansions" }, { - (char *) "-nu", glkunix_arg_NoValue, - (char *) "-nu Turn off any use of Unicode output" + (const char *)"-nu", glkunix_arg_NoValue, + (const char *)"-nu Turn off any use of Unicode output" }, #ifdef LINUX_GRAPHICS { - (char *) "-ng", glkunix_arg_NoValue, - (char *) "-ng Turn off attempts at game graphics" + (const char *)"-ng", glkunix_arg_NoValue, + (const char *)"-ng Turn off attempts at game graphics" }, #endif { - (char *) "-r", glkunix_arg_ValueFollows, - (char *) "-r FILE Restore from FILE on starting the game" + (const char *)"-r", glkunix_arg_ValueFollows, + (const char *)"-r FILE Restore from FILE on starting the game" }, { - (char *) "", glkunix_arg_ValueCanFollow, - (char *) "filename game to run" + (const char *)"", glkunix_arg_ValueCanFollow, + (const char *)"filename game to run" }, {nullptr, glkunix_arg_End, nullptr} }; diff --git a/engines/glk/adrift/scare.h b/engines/glk/adrift/scare.h index 1dc7c6e964..04a287229e 100644 --- a/engines/glk/adrift/scare.h +++ b/engines/glk/adrift/scare.h @@ -47,6 +47,9 @@ typedef long sc_int; typedef unsigned long sc_uint; typedef int sc_bool; +#define BYTE_MAX 0xff +#define INTEGER_MAX 0x7fff + /* Enumerated confirmation types, passed to os_confirm(). */ enum { SC_CONF_QUIT = 0, diff --git a/engines/glk/adrift/scexpr.cpp b/engines/glk/adrift/scexpr.cpp index 0f4c2be4ce..0078f2c7ac 100644 --- a/engines/glk/adrift/scexpr.cpp +++ b/engines/glk/adrift/scexpr.cpp @@ -114,7 +114,7 @@ static sc_int expr_multichar_search(const sc_char *name, const sc_expr_multichar } /* Return the token matched, or TOK_NONE. */ - return entry->name ? entry->token : TOK_NONE; + return entry->name ? entry->token : (sc_int)TOK_NONE; } diff --git a/engines/glk/adrift/sclibrar.cpp b/engines/glk/adrift/sclibrar.cpp index c17a3a7ae3..89f2dee7b8 100644 --- a/engines/glk/adrift/sclibrar.cpp +++ b/engines/glk/adrift/sclibrar.cpp @@ -1363,7 +1363,7 @@ sc_bool lib_cmd_redo_number(sc_gameref_t game) { * for the ugliness. */ game->do_again = FALSE; - game->redo_sequence = INT_MAX; + game->redo_sequence = INTEGER_MAX; } game->is_admin = TRUE; @@ -1393,7 +1393,7 @@ static sc_bool lib_cmd_redo_text_last_common(sc_gameref_t game, const sc_char *t /* As with failed numeric redo above, special-case this return. */ game->do_again = FALSE; - game->redo_sequence = INT_MAX; + game->redo_sequence = INTEGER_MAX; game->is_admin = TRUE; return TRUE; @@ -1450,7 +1450,7 @@ static sc_bool lib_cmd_redo_text_last_common(sc_gameref_t game, const sc_char *t /* As with failed numeric redo above, special-case this return. */ game->do_again = FALSE; - game->redo_sequence = INT_MAX; + game->redo_sequence = INTEGER_MAX; } game->is_admin = TRUE; diff --git a/engines/glk/adrift/sctaffil.cpp b/engines/glk/adrift/sctaffil.cpp index 321f08a192..0cda5ec20b 100644 --- a/engines/glk/adrift/sctaffil.cpp +++ b/engines/glk/adrift/sctaffil.cpp @@ -26,18 +26,6 @@ #include "common/zlib.h" #include "common/memstream.h" -#if defined(USE_ZLIB) -#ifdef __SYMBIAN32__ -#include <zlib\zlib.h> -#else -#include <zlib.h> -#endif - -#if ZLIB_VERNUM < 0x1204 -#error Version 1.2.0.4 or newer of zlib is required for this code -#endif -#endif - namespace Glk { namespace Adrift { @@ -129,7 +117,7 @@ static sc_int taf_random_state = 0x00a09e86; static sc_byte taf_random(void) { /* Generate and return the next pseudo-random number. */ taf_random_state = (taf_random_state * PRNG_CST1 + PRNG_CST2) & PRNG_CST3; - return (UCHAR_MAX * (sc_uint) taf_random_state) / (sc_uint)(PRNG_CST3 + 1); + return (BYTE_MAX * (sc_uint) taf_random_state) / (sc_uint)(PRNG_CST3 + 1); } static void taf_random_reset(void) { @@ -419,7 +407,7 @@ static sc_bool taf_unobfuscate(sc_tafref_t taf, sc_read_callbackref_t callback, */ static sc_bool taf_decompress(sc_tafref_t taf, sc_read_callbackref_t callback, void *opaque, sc_bool is_gamefile) { -#if USE_ZLIB +#if defined(USE_ZLIB) Common::SeekableReadStream *src = (Common::SeekableReadStream *)opaque; assert(src); Common::MemoryWriteStreamDynamic dest(DisposeAfterUse::YES); diff --git a/engines/glk/adrift/sctafpar.cpp b/engines/glk/adrift/sctafpar.cpp index 7dd7edfb4d..046cb24d33 100644 --- a/engines/glk/adrift/sctafpar.cpp +++ b/engines/glk/adrift/sctafpar.cpp @@ -884,14 +884,14 @@ static void parse_vector(CONTEXT, const sc_char *vector) { } static void parse_vector_alternate(CONTEXT, const sc_char *vector) { - sc_int count; + sc_int count1; if (parse_trace) sc_trace("Parse: entering alternate vector %s\n", vector); /* Element count, this is a vector described by size - 1. */ - FUNC0(parse_get_taf_integer, count) + 1; - CALL2(parse_vector_common, vector, count); + FUNC0(parse_get_taf_integer, count1); + CALL2(parse_vector_common, vector, count1 + 1); if (parse_trace) sc_trace("Parse: leaving alternate vector %s\n", vector); @@ -3240,7 +3240,7 @@ static void parse_add_alrs_index(sc_prop_setref_t bundle) { * get the shortest and longest defined. */ alr_lengths = (sc_int *)sc_malloc(alr_count * sizeof(*alr_lengths)); - shortest = INT_MAX; + shortest = INTEGER_MAX; longest = 0; for (index_ = 0; index_ < alr_count; index_++) { const sc_char *original; diff --git a/engines/glk/adrift/sxmain.cpp b/engines/glk/adrift/sxmain.cpp index d01e226716..63ff12ea61 100644 --- a/engines/glk/adrift/sxmain.cpp +++ b/engines/glk/adrift/sxmain.cpp @@ -113,13 +113,13 @@ int glk_main(int argc, const char *argv[]) { script = sx_fopen(name, "scr", "r"); if (!script) { - error("%s: %s.scr: %s\n", program, name, strerror(errno)); + error("%s: %s.scr: %s\n", program, name, "open"); continue; } stream = sx_fopen(name, "taf", "rb"); if (!stream) { - error("%s: %s.taf: %s\n", program, name, strerror(errno)); + error("%s: %s.taf: %s\n", program, name, "open"); delete script; continue; } diff --git a/engines/glk/detection.cpp b/engines/glk/detection.cpp index cce1ec1ef0..4be0c38041 100644 --- a/engines/glk/detection.cpp +++ b/engines/glk/detection.cpp @@ -70,9 +70,9 @@ GlkDetectedGame::GlkDetectedGame(const char *id, const char *desc, const Common: addExtraEntry("filename", filename); } -GlkDetectedGame::GlkDetectedGame(const char *id, const char *desc, const char *extra, +GlkDetectedGame::GlkDetectedGame(const char *id, const char *desc, const char *xtra, const Common::String &filename, Common::Language lang) : - DetectedGame(id, desc, lang, Common::kPlatformUnknown, extra) { + DetectedGame(id, desc, lang, Common::kPlatformUnknown, xtra) { setGUIOptions(GUIO3(GUIO_NOSPEECH, GUIO_NOMUSIC, GUIO_NOSUBTITLES)); addExtraEntry("filename", filename); } |