diff --git a/Makefile.common b/Makefile.common index d9af654f72..8dd0137255 100644 --- a/Makefile.common +++ b/Makefile.common @@ -840,6 +840,8 @@ endif # Record +ifneq ($(C89_BUILD), 1) +# ffmpeg and friends are not C89-compliant APIs. ifeq ($(HAVE_FFMPEG), 1) OBJ += record/drivers/record_ffmpeg.o \ cores/ffmpeg_core.o @@ -847,6 +849,7 @@ ifeq ($(HAVE_FFMPEG), 1) DEFINES += $(AVCODEC_CFLAGS) $(AVFORMAT_CFLAGS) $(AVUTIL_CFLAGS) $(SWSCALE_CFLAGS) $(SWRESAMPLE_CFLAGS) DEFINES += -DHAVE_FFMPEG -Iffmpeg endif +endif ifeq ($(HAVE_COMPRESSION), 1) DEFINES += -DHAVE_COMPRESSION diff --git a/cores/ffmpeg_core.c b/cores/ffmpeg_core.c index c8f6f0636b..a0cd0484a6 100644 --- a/cores/ffmpeg_core.c +++ b/cores/ffmpeg_core.c @@ -305,12 +305,13 @@ void CORE_PREFIX(retro_reset)(void) static void check_variables(void) { - struct retro_variable color_var; + struct retro_variable color_var, var, fft_var, fft_ms_var; + + (void)var; + (void)fft_var; #ifdef HAVE_OPENGL - struct retro_variable var = { - .key = "ffmpeg_temporal_interp" - }; + var.key = "ffmpeg_temporal_interp"; if (CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) { @@ -322,9 +323,7 @@ static void check_variables(void) #endif #ifdef HAVE_GL_FFT - struct retro_variable fft_var = { - .key = "ffmpeg_fft_resolution", - }; + fft_var.key = "ffmpeg_fft_resolution"; fft_width = 1280; fft_height = 720; @@ -339,9 +338,7 @@ static void check_variables(void) } } - struct retro_variable fft_ms_var = { - .key = "ffmpeg_fft_multisample", - }; + fft_ms_var.key = "ffmpeg_fft_multisample"; if (CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &fft_ms_var) && fft_ms_var.value) fft_multisample = strtoul(fft_ms_var.value, NULL, 0); @@ -1107,7 +1104,7 @@ static void decode_thread(void *data) { unsigned i; AVFrame *aud_frame, *vid_frame; - SwrContext *swr[audio_streams_num]; + SwrContext *swr[audio_streams_num] = {NULL}; void *conv_frame_buf = NULL; size_t frame_size = 0; int16_t *audio_buffer = NULL; diff --git a/gfx/drivers_context/drm_egl_ctx.c b/gfx/drivers_context/drm_egl_ctx.c index 786042231b..ca64e8ba79 100644 --- a/gfx/drivers_context/drm_egl_ctx.c +++ b/gfx/drivers_context/drm_egl_ctx.c @@ -236,7 +236,8 @@ static void wait_flip(bool block) /* This buffer is not on-screen anymore. Release it to GBM. */ gbm_surface_release_buffer(drm->g_gbm_surface, drm->g_bo); - drm->g_bo = drm->g_next_bo; // This buffer is being shown now. + /* This buffer is being shown now. */ + drm->g_bo = drm->g_next_bo; } static void queue_flip(void) diff --git a/gfx/drivers_shader/shader_glsl.c b/gfx/drivers_shader/shader_glsl.c index e31a7cbcae..b78fb56b42 100644 --- a/gfx/drivers_shader/shader_glsl.c +++ b/gfx/drivers_shader/shader_glsl.c @@ -315,7 +315,9 @@ static bool compile_shader(glsl_shader_data_t *glsl, const char *define, const char *program) { GLint status; + const char *source[4]; char version[32] = {0}; + if (glsl_core && !strstr(program, "#version")) { unsigned version_no = 0; @@ -341,11 +343,13 @@ static bool compile_shader(glsl_shader_data_t *glsl, RARCH_LOG("[GL]: Using GLSL version %u.\n", version_no); } - { - const char *source[] = { version, define, glsl->glsl_alias_define, program }; - glShaderSource(shader, ARRAY_SIZE(source), source, NULL); - glCompileShader(shader); - } + source[0]= version; + source[1] = define; + source[2] = glsl->glsl_alias_define; + source[3] = program; + + glShaderSource(shader, ARRAY_SIZE(source), source, NULL); + glCompileShader(shader); glGetShaderiv(shader, GL_COMPILE_STATUS, &status); print_shader_log(shader); diff --git a/input/connect/connect_ps3.c b/input/connect/connect_ps3.c index 18cf51d651..f1cb865291 100644 --- a/input/connect/connect_ps3.c +++ b/input/connect/connect_ps3.c @@ -139,7 +139,7 @@ static void hidpad_ps3_packet_handler(void *data, uint8_t *packet, uint16_t size RETRO_DEVICE_ID_JOYPAD_A, RETRO_DEVICE_ID_JOYPAD_B, RETRO_DEVICE_ID_JOYPAD_Y, - 16 //< PS Button + 16 /* PS Button */ }; struct hidpad_ps3_data *device = (struct hidpad_ps3_data*)data; diff --git a/input/connect/connect_ps4.c b/input/connect/connect_ps4.c index d16fab2360..f0227bcd79 100644 --- a/input/connect/connect_ps4.c +++ b/input/connect/connect_ps4.c @@ -31,7 +31,7 @@ enum connect_ps4_dpad_states DPAD_DOWN_LEFT = 0x5, DPAD_LEFT = 0x6, DPAD_LEFT_UP = 0x7, - DPAD_OFF = 0x8, + DPAD_OFF = 0x8 }; struct ps4buttons diff --git a/libretro-common/formats/png/rpng_encode.c b/libretro-common/formats/png/rpng_encode.c index 67a391fe2a..c78ed3e963 100644 --- a/libretro-common/formats/png/rpng_encode.c +++ b/libretro-common/formats/png/rpng_encode.c @@ -54,18 +54,29 @@ static bool png_write_crc(FILE *file, const uint8_t *data, size_t size) static bool png_write_ihdr(FILE *file, const struct png_ihdr *ihdr) { - uint8_t ihdr_raw[] = { - '0', '0', '0', '0', /* Size */ - 'I', 'H', 'D', 'R', - - 0, 0, 0, 0, /* Width */ - 0, 0, 0, 0, /* Height */ - ihdr->depth, - ihdr->color_type, - ihdr->compression, - ihdr->filter, - ihdr->interlace, - }; + uint8_t ihdr_raw[21]; + + ihdr_raw[0] = '0'; /* Size */ + ihdr_raw[1] = '0'; + ihdr_raw[2] = '0'; + ihdr_raw[3] = '0'; + ihdr_raw[4] = 'I'; + ihdr_raw[5] = 'H'; + ihdr_raw[6] = 'D'; + ihdr_raw[7] = 'R'; + ihdr_raw[8] = 0; /* Width */ + ihdr_raw[9] = 0; + ihdr_raw[10] = 0; + ihdr_raw[11] = 0; + ihdr_raw[12] = 0; /* Height */ + ihdr_raw[13] = 0; + ihdr_raw[14] = 0; + ihdr_raw[15] = 0; + ihdr_raw[16] = ihdr->depth; /* Depth */ + ihdr_raw[17] = ihdr->color_type; + ihdr_raw[18] = ihdr->compression; + ihdr_raw[19] = ihdr->filter; + ihdr_raw[20] = ihdr->interlace; dword_write_be(ihdr_raw + 0, sizeof(ihdr_raw) - 8); dword_write_be(ihdr_raw + 8, ihdr->width);