From 4c3a4d66df260395fed6a7858e2ed0e99347d4b6 Mon Sep 17 00:00:00 2001 From: Autechre Date: Wed, 30 Mar 2022 16:30:20 +0100 Subject: [PATCH] Cxx buildfixes (#13803) * CXX_BUILD buildfixes * (D3D11) Buildfixes for CXX_BUILD * (Linux/qb) Disable KMS for Linux when building for C89, headers use inline which is not available for C89 --- cores/libretro-ffmpeg/ffmpeg_core.c | 23 +++--- deps/rcheevos/src/rhash/cdreader.c | 28 ++++--- gfx/common/dxgi_common.c | 114 +++++++++++++++++++++++----- gfx/common/dxgi_common.h | 3 + gfx/drivers/d3d11.c | 18 ++++- libretro-common/net/net_ifinfo.c | 17 ++--- libretro-common/net/net_natt.c | 16 ++-- network/netplay/netplay_frontend.c | 8 +- qb/config.params.sh | 1 + record/drivers/record_ffmpeg.c | 11 ++- tasks/task_netplay_nat_traversal.c | 2 +- uwp/uwp_main.cpp | 3 +- 12 files changed, 165 insertions(+), 79 deletions(-) diff --git a/cores/libretro-ffmpeg/ffmpeg_core.c b/cores/libretro-ffmpeg/ffmpeg_core.c index 6284be8d4c..645e63f6be 100644 --- a/cores/libretro-ffmpeg/ffmpeg_core.c +++ b/cores/libretro-ffmpeg/ffmpeg_core.c @@ -1085,11 +1085,9 @@ static enum AVPixelFormat select_decoder(AVCodecContext *ctx, if (!force_sw_decoder) { if (hw_decoder == AV_HWDEVICE_TYPE_NONE) - { - format = auto_hw_decoder(ctx, pix_fmts); - } + format = auto_hw_decoder(ctx, pix_fmts); else - format = init_hw_decoder(ctx, hw_decoder, pix_fmts); + format = init_hw_decoder(ctx, hw_decoder, pix_fmts); } /* Fallback to SW rendering */ @@ -1099,17 +1097,17 @@ static enum AVPixelFormat select_decoder(AVCodecContext *ctx, log_cb(RETRO_LOG_INFO, "[FFMPEG] Using SW decoding.\n"); - ctx->thread_type = FF_THREAD_FRAME; - ctx->thread_count = sw_decoder_threads; + ctx->thread_type = FF_THREAD_FRAME; + ctx->thread_count = sw_decoder_threads; log_cb(RETRO_LOG_INFO, "[FFMPEG] Configured software decoding threads: %d\n", sw_decoder_threads); - format = fctx->streams[video_stream_index]->codecpar->format; + format = (enum AVPixelFormat)fctx->streams[video_stream_index]->codecpar->format; #if ENABLE_HW_ACCEL - hw_decoding_enabled = false; + hw_decoding_enabled = false; } else - hw_decoding_enabled = true; + hw_decoding_enabled = true; #endif return format; @@ -1122,10 +1120,10 @@ static enum AVPixelFormat get_format(AVCodecContext *ctx, { /* Look if we can reuse the current decoder */ for (size_t i = 0; pix_fmts[i] != AV_PIX_FMT_NONE; i++) + { if (pix_fmts[i] == pix_fmt) - { return pix_fmt; - } + } pix_fmt = select_decoder(ctx, pix_fmts); @@ -1135,8 +1133,7 @@ static enum AVPixelFormat get_format(AVCodecContext *ctx, static bool open_codec(AVCodecContext **ctx, enum AVMediaType type, unsigned index) { - int ret = 0; - + int ret = 0; const AVCodec *codec = avcodec_find_decoder(fctx->streams[index]->codecpar->codec_id); if (!codec) { diff --git a/deps/rcheevos/src/rhash/cdreader.c b/deps/rcheevos/src/rhash/cdreader.c index 113f155933..27c93c7762 100644 --- a/deps/rcheevos/src/rhash/cdreader.c +++ b/deps/rcheevos/src/rhash/cdreader.c @@ -563,34 +563,32 @@ static void* cdreader_open_cue_track(const char* path, uint32_t track) static void* cdreader_open_gdi_track(const char* path, uint32_t track) { - void* file_handle; char buffer[1024]; char mode[16] = "MODE1/"; char sector_size[16]; char file[256]; int64_t track_size; int track_type; - char* bin_path = ""; - uint32_t current_track = 0; - char* ptr, *ptr2, *end; - int lba = 0; + char *ptr, *ptr2, *end; - uint32_t largest_track = 0; - int64_t largest_track_size = 0; char largest_track_file[256]; char largest_track_sector_size[16]; - int largest_track_lba = 0; + char *bin_path = NULL; + uint32_t current_track = 0; + int lba = 0; + uint32_t largest_track = 0; + int64_t largest_track_size = 0; + int largest_track_lba = 0; - int found = 0; - size_t num_read = 0; - int64_t file_offset = 0; - struct cdrom_t* cdrom = NULL; - - file_handle = rc_file_open(path); + int found = 0; + size_t num_read = 0; + int64_t file_offset = 0; + struct cdrom_t* cdrom = NULL; + void *file_handle = rc_file_open(path); if (!file_handle) return NULL; - file[0] = '\0'; + file[0] = '\0'; do { num_read = rc_file_read(file_handle, buffer, sizeof(buffer) - 1); diff --git a/gfx/common/dxgi_common.c b/gfx/common/dxgi_common.c index 6cde8bb030..972c0d379d 100644 --- a/gfx/common/dxgi_common.c +++ b/gfx/common/dxgi_common.c @@ -23,16 +23,21 @@ #include "../../config.h" #endif +#include "win32_common.h" #include "dxgi_common.h" #include "../../configuration.h" #include "../../verbosity.h" #include "../../ui/ui_companion_driver.h" #include "../../retroarch.h" #include "../frontend/frontend_driver.h" -#include "win32_common.h" +#ifdef __cplusplus +extern const GUID DECLSPEC_SELECTANY libretro_IID_IDXGIOutput6 = { 0x068346e8,0xaaec, +0x4b84, {0xad,0xd7,0x13,0x7f,0x51,0x3f,0x77,0xa1 } }; +#else const GUID DECLSPEC_SELECTANY libretro_IID_IDXGIOutput6 = { 0x068346e8,0xaaec, 0x4b84, {0xad,0xd7,0x13,0x7f,0x51,0x3f,0x77,0xa1 } }; +#endif #ifdef HAVE_DXGI_HDR /* TODO/FIXME - globals */ @@ -400,8 +405,11 @@ bool dxgi_check_display_hdr_support(DXGIFactory factory, HWND hwnd) float best_intersect_area = -1; #ifdef __WINRT__ - if (!DXGIIsCurrent2(factory)) - +#ifdef __cplusplus + if (!factory->IsCurrent()) +#else + if (!factory->lpVtbl->IsCurrent(factory)) +#endif { if (FAILED(DXGICreateFactory2(&factory))) { @@ -410,14 +418,21 @@ bool dxgi_check_display_hdr_support(DXGIFactory factory, HWND hwnd) } } - if (FAILED(DXGIEnumAdapters2(factory, 0, &dxgi_adapter))) +#ifdef __cplusplus + if (FAILED(factory->EnumAdapters1(0, &dxgi_adapter))) +#else + if (FAILED(factory->lpVtbl->EnumAdapters1(factory, 0, &dxgi_adapter))) +#endif { RARCH_ERR("[DXGI]: Failed to enumerate adapters\n"); return false; } #else - if (!DXGIIsCurrent(factory)) - +#ifdef __cplusplus + if (!factory->IsCurrent()) +#else + if (!factory->lpVtbl->IsCurrent(factory)) +#endif { if (FAILED(DXGICreateFactory(&factory))) { @@ -426,15 +441,24 @@ bool dxgi_check_display_hdr_support(DXGIFactory factory, HWND hwnd) } } - if (FAILED(DXGIEnumAdapters(factory, 0, &dxgi_adapter))) +#ifdef __cplusplus + if (FAILED(factory->EnumAdapters1(0, &dxgi_adapter))) +#else + if (FAILED(factory->lpVtbl->EnumAdapters1(factory, 0, &dxgi_adapter))) +#endif { RARCH_ERR("[DXGI]: Failed to enumerate adapters\n"); return false; } #endif - while ( DXGIEnumOutputs(dxgi_adapter, i, ¤t_output) +#ifdef __cplusplus + while ( dxgi_adapter->EnumOutputs(i, ¤t_output) != DXGI_ERROR_NOT_FOUND) +#else + while ( dxgi_adapter->lpVtbl->EnumOutputs(dxgi_adapter, i, ¤t_output) + != DXGI_ERROR_NOT_FOUND) +#endif { RECT r, rect; DXGI_OUTPUT_DESC desc; @@ -454,7 +478,11 @@ bool dxgi_check_display_hdr_support(DXGIFactory factory, HWND hwnd) } /* Get the rectangle bounds of current output */ - if (FAILED(DXGIGetOutputDesc(current_output, &desc))) +#ifdef __cplusplus + if (FAILED(current_output->GetDesc(&desc))) +#else + if (FAILED(current_output->lpVtbl->GetDesc(current_output, &desc))) +#endif { RARCH_ERR("[DXGI]: Failed to get DXGI output description\n"); goto error; @@ -474,19 +502,32 @@ bool dxgi_check_display_hdr_support(DXGIFactory factory, HWND hwnd) if (intersect_area > best_intersect_area) { best_output = current_output; +#if defined(__cplusplus) + best_output->AddRef(); +#else AddRef(best_output); +#endif best_intersect_area = (float)intersect_area; } i++; } +#ifdef __cplusplus + if (SUCCEEDED(best_output->QueryInterface( + libretro_IID_IDXGIOutput6, (void**)&output6))) +#else if (SUCCEEDED(best_output->lpVtbl->QueryInterface( best_output, &libretro_IID_IDXGIOutput6, (void**)&output6))) +#endif { DXGI_OUTPUT_DESC1 desc1; - if (SUCCEEDED(DXGIGetOutputDesc1(output6, &desc1))) +#ifdef __cplusplus + if (SUCCEEDED(output6->GetDesc1(&desc1))) +#else + if (SUCCEEDED(output6->lpVtbl->GetDesc1(output6, &desc1))) +#endif { supported = (desc1.ColorSpace == DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020); @@ -505,7 +546,11 @@ bool dxgi_check_display_hdr_support(DXGIFactory factory, HWND hwnd) { RARCH_ERR("[DXGI]: Failed to get DXGI Output 6 description\n"); } +#ifdef __cplusplus + output6->Release(); +#else Release(output6); +#endif } else { @@ -513,9 +558,15 @@ bool dxgi_check_display_hdr_support(DXGIFactory factory, HWND hwnd) } error: +#ifdef __cplusplus + best_output->Release(); + current_output->Release(); + dxgi_adapter->Release(); +#else Release(best_output); Release(current_output); Release(dxgi_adapter); +#endif return supported; } @@ -528,14 +579,25 @@ void dxgi_swapchain_color_space( if (*chain_color_space != color_space) { UINT color_space_support = 0; - if (SUCCEEDED(DXGICheckColorSpaceSupport( - chain_handle, color_space, - &color_space_support)) +#ifdef __cplusplus + if (SUCCEEDED(chain_handle->CheckColorSpaceSupport( + color_space, &color_space_support)) && ((color_space_support & DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT) == DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT)) +#else + if (SUCCEEDED(chain_handle->lpVtbl->CheckColorSpaceSupport( + chain_handle, color_space, &color_space_support)) + && ((color_space_support & + DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT) + == DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT)) +#endif { - if (FAILED(DXGISetColorSpace1(chain_handle, color_space))) +#ifdef __cplusplus + if (FAILED(chain_handle->SetColorSpace1(color_space))) +#else + if (FAILED(chain_handle->lpVtbl->SetColorSpace1(chain_handle, color_space))) +#endif { RARCH_ERR("[DXGI]: Failed to set DXGI swapchain colour space\n"); /* TODO/FIXME/CLARIFICATION: Was this fall-through intentional? @@ -577,8 +639,13 @@ void dxgi_set_hdr_metadata( /* Clear the hdr meta data if the monitor does not support HDR */ if (!hdr_supported) { - if (FAILED(DXGISetHDRMetaData(handle, +#ifdef __cplusplus + if (FAILED(handle->SetHDRMetaData( DXGI_HDR_METADATA_TYPE_NONE, 0, NULL))) +#else + if (FAILED(handle->lpVtbl->SetHDRMetaData(handle, + DXGI_HDR_METADATA_TYPE_NONE, 0, NULL))) +#endif { RARCH_ERR("[DXGI]: Failed to set HDR meta data to none\n"); } @@ -593,8 +660,13 @@ void dxgi_set_hdr_metadata( selected_chroma = 1; else { - if (FAILED(DXGISetHDRMetaData(handle, +#ifdef __cplusplus + if (FAILED(handle->SetHDRMetaData( DXGI_HDR_METADATA_TYPE_NONE, 0, NULL))) +#else + if (FAILED(handle->lpVtbl->SetHDRMetaData(handle, + DXGI_HDR_METADATA_TYPE_NONE, 0, NULL))) +#endif { RARCH_ERR("[DXGI]: Failed to set HDR meta data to none\n"); } @@ -638,9 +710,13 @@ void dxgi_set_hdr_metadata( g_hdr10_meta_data.MinMasteringLuminance != hdr10_meta_data.MinMasteringLuminance || g_hdr10_meta_data.MaxFrameAverageLightLevel != hdr10_meta_data.MaxFrameAverageLightLevel) { - if (FAILED(DXGISetHDRMetaData(handle, - DXGI_HDR_METADATA_TYPE_HDR10, - sizeof(DXGI_HDR_METADATA_HDR10), &hdr10_meta_data))) +#ifdef __cplusplus + if (FAILED(handle->SetHDRMetaData( + DXGI_HDR_METADATA_TYPE_HDR10, sizeof(DXGI_HDR_METADATA_HDR10), &hdr10_meta_data))) +#else + if (FAILED(handle->lpVtbl->SetHDRMetaData(handle, + DXGI_HDR_METADATA_TYPE_HDR10, sizeof(DXGI_HDR_METADATA_HDR10), &hdr10_meta_data))) +#endif { RARCH_ERR("[DXGI]: Failed to set HDR meta data for HDR10\n"); return; diff --git a/gfx/common/dxgi_common.h b/gfx/common/dxgi_common.h index acda79beba..02414daa05 100644 --- a/gfx/common/dxgi_common.h +++ b/gfx/common/dxgi_common.h @@ -2,6 +2,7 @@ #define _DXGI_COMMON_H #include +#include #ifndef HAVE_DXGI_HDR #define HAVE_DXGI_HDR @@ -18,6 +19,8 @@ #include +RETRO_BEGIN_DECLS + typedef struct ALIGN(16) { math_matrix_4x4 mvp; diff --git a/gfx/drivers/d3d11.c b/gfx/drivers/d3d11.c index 70389a7b19..31f10c3db9 100644 --- a/gfx/drivers/d3d11.c +++ b/gfx/drivers/d3d11.c @@ -68,8 +68,12 @@ #ifdef __WINRT__ #include "../../uwp/uwp_func.h" #else +#ifdef __cplusplus +extern const GUID DECLSPEC_SELECTANY libretro_IID_IDXGIFactory5 = { 0x7632e1f5,0xee65,0x4dca, { 0x87,0xfd,0x84,0xcd,0x75,0xf8,0x83,0x8d } }; +#else const GUID DECLSPEC_SELECTANY libretro_IID_IDXGIFactory5 = { 0x7632e1f5,0xee65,0x4dca, { 0x87,0xfd,0x84,0xcd,0x75,0xf8,0x83,0x8d } }; #endif +#endif /* Temporary workaround for d3d11 not being able to poll flags during init */ static gfx_ctx_driver_t d3d11_fake_context; @@ -997,8 +1001,13 @@ static bool d3d11_init_swapchain(d3d11_video_t* d3d11, /* Check for ALLOW_TEARING support before trying to use it. * Also don't use the flip model if it's not supported, because then we can't uncap our * present rate. */ +#ifdef __cplusplus + if (SUCCEEDED(dxgiFactory->lpVtbl->QueryInterface(dxgiFactory, + libretro_IID_IDXGIFactory5, (void**)&dxgiFactory5))) +#else if (SUCCEEDED(dxgiFactory->lpVtbl->QueryInterface( dxgiFactory, &libretro_IID_IDXGIFactory5, (void**)&dxgiFactory5))) +#endif { BOOL allow_tearing_supported = FALSE; if (SUCCEEDED(dxgiFactory5->lpVtbl->CheckFeatureSupport( @@ -1036,10 +1045,11 @@ static bool d3d11_init_swapchain(d3d11_video_t* d3d11, } #ifdef HAVE_WINDOW - /* Don't let DXGI mess with the full screen state, because otherwise we end up with a mismatch - * between the window size and the buffers. RetroArch only uses windowed mode (see above). */ - if (FAILED(dxgiFactory->lpVtbl->MakeWindowAssociation(dxgiFactory, desc.OutputWindow, - DXGI_MWA_NO_ALT_ENTER))) + /* Don't let DXGI mess with the full screen state, + * because otherwise we end up with a mismatch + * between the window size and the buffers. + * RetroArch only uses windowed mode (see above). */ + if (FAILED(dxgiFactory->lpVtbl->MakeWindowAssociation(dxgiFactory, desc.OutputWindow, DXGI_MWA_NO_ALT_ENTER))) { RARCH_ERR("[D3D11]: Failed to make disable DXGI ALT+ENTER handling.\n"); } diff --git a/libretro-common/net/net_ifinfo.c b/libretro-common/net/net_ifinfo.c index 10a794e854..4951cb4bb3 100644 --- a/libretro-common/net/net_ifinfo.c +++ b/libretro-common/net/net_ifinfo.c @@ -129,7 +129,6 @@ bool net_ifinfo_new(net_ifinfo_t *list) #ifdef HAVE_LIBNX Result rc; #endif - char hostname[128]; struct net_ifinfo_entry *ptr = NULL; @@ -186,14 +185,12 @@ bool net_ifinfo_new(net_ifinfo_t *list) return true; #elif defined(_WIN32) && !defined(_XBOX) PIP_ADAPTER_ADDRESSES adapter_addresses = NULL, aa = NULL; - PIP_ADAPTER_UNICAST_ADDRESS ua = NULL; + PIP_ADAPTER_UNICAST_ADDRESS ua = NULL; #ifdef _WIN32_WINNT_WINXP - DWORD size = 0; - DWORD rv = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX, NULL, NULL, &size); - - adapter_addresses = (PIP_ADAPTER_ADDRESSES)malloc(size); - - rv = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX, NULL, adapter_addresses, &size); + DWORD size = 0; + DWORD rv = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX, NULL, NULL, &size); + adapter_addresses = (PIP_ADAPTER_ADDRESSES)malloc(size); + rv = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX, NULL, adapter_addresses, &size); memset(list, 0, sizeof(net_ifinfo_t)); @@ -323,7 +320,7 @@ bool net_ifinfo_best(const char *dst, void *src, bool ipv6) { /* Microsoft docs recommend doing it this way. */ ULONG len = 15 * 1024; - PIP_ADAPTER_ADDRESSES addresses = calloc(1, len); + PIP_ADAPTER_ADDRESSES addresses = (PIP_ADAPTER_ADDRESSES)calloc(1, len); if (addresses) { @@ -336,7 +333,7 @@ bool net_ifinfo_best(const char *dst, void *src, bool ipv6) if (result == ERROR_BUFFER_OVERFLOW) { - PIP_ADAPTER_ADDRESSES new_addresses = realloc(addresses, len); + PIP_ADAPTER_ADDRESSES new_addresses = (PIP_ADAPTER_ADDRESSES)realloc(addresses, len); if (new_addresses) { diff --git a/libretro-common/net/net_natt.c b/libretro-common/net/net_natt.c index 0e010f141b..236074dfb4 100644 --- a/libretro-common/net/net_natt.c +++ b/libretro-common/net/net_natt.c @@ -606,7 +606,7 @@ static bool natt_action(struct natt_device *device, const char *action, const char *data, retro_task_callback_t cb, struct natt_request *request) { - static const char headers_template[] = + static const char headers_tmpl[] = "Content-Type: text/xml\r\n" "SOAPAction: \"%s#%s\"\r\n"; char headers[512]; @@ -615,7 +615,7 @@ static bool natt_action(struct natt_device *device, if (string_is_empty(device->control)) return false; - snprintf(headers, sizeof(headers), headers_template, + snprintf(headers, sizeof(headers), headers_tmpl, device->service_type, action); if (request) @@ -632,7 +632,7 @@ static bool natt_action(struct natt_device *device, bool natt_external_address(struct natt_device *device, bool block) { - static const char template[] = + static const char tmpl[] = "" "service_type); if (device->busy) @@ -671,7 +671,7 @@ bool natt_open_port(struct natt_device *device, struct natt_request *request, enum natt_forward_type forward_type, bool block) { - static const char template[] = + static const char tmpl[] = "" "proto == SOCKET_PROTOCOL_UDP) ? "UDP" : "TCP"; - snprintf(buf, sizeof(buf), template, + snprintf(buf, sizeof(buf), tmpl, action, device->service_type, port, protocol, port, host, action); @@ -733,7 +733,7 @@ bool natt_open_port(struct natt_device *device, bool natt_close_port(struct natt_device *device, struct natt_request *request, bool block) { - static const char template[] = + static const char tmpl[] = "" "proto == SOCKET_PROTOCOL_UDP) ? "UDP" : "TCP"; - snprintf(buf, sizeof(buf), template, + snprintf(buf, sizeof(buf), tmpl, device->service_type, port, protocol); if (device->busy) diff --git a/network/netplay/netplay_frontend.c b/network/netplay/netplay_frontend.c index 9a9d35dc76..51a9b87b6c 100644 --- a/network/netplay/netplay_frontend.c +++ b/network/netplay/netplay_frontend.c @@ -7771,7 +7771,7 @@ static void netplay_announce_cb(retro_task_t *task, size_t remaining; net_driver_state_t *net_st = &networking_driver_st; struct netplay_room *host_room = &net_st->host_room; - http_transfer_data_t *data = task_data; + http_transfer_data_t *data = (http_transfer_data_t*)task_data; bool first = !host_room->id; if (error) @@ -8358,7 +8358,7 @@ bool init_netplay(const char *server, unsigned port, const char *mitm_session) net_st->lan_ad_server_fd = -1; #endif - net_st->chat = calloc(1, sizeof(*net_st->chat)); + net_st->chat = (struct netplay_chat*)calloc(1, sizeof(*net_st->chat)); if (!net_st->chat) goto failure; net_st->chat->message_slots = ARRAY_SIZE(net_st->chat->messages); @@ -8633,8 +8633,8 @@ static void gfx_widget_netplay_chat_iterate(void *user_data, bool is_threaded) { size_t i; - net_driver_state_t *net_st = &networking_driver_st; - struct netplay_chat *chat = net_st->chat; + net_driver_state_t *net_st = &networking_driver_st; + struct netplay_chat *chat = net_st->chat; struct netplay_chat_buffer *chat_buffer = &net_st->chat_buffer; if (chat) diff --git a/qb/config.params.sh b/qb/config.params.sh index 6eb7901d50..f457ae4263 100644 --- a/qb/config.params.sh +++ b/qb/config.params.sh @@ -92,6 +92,7 @@ HAVE_XRANDR=auto # Xrandr support. HAVE_OMAP=no # OMAP video support HAVE_XINERAMA=auto # Xinerama support. HAVE_KMS=auto # KMS context support +C89_KMS=no HAVE_PLAIN_DRM=no # Plain DRM video support HAVE_EXYNOS=no # Exynos video support HAVE_DISPMANX=no # Dispmanx video support diff --git a/record/drivers/record_ffmpeg.c b/record/drivers/record_ffmpeg.c index 3db4118ec4..d07ff913ba 100644 --- a/record/drivers/record_ffmpeg.c +++ b/record/drivers/record_ffmpeg.c @@ -802,11 +802,14 @@ static bool ffmpeg_init_config(struct ff_config_param *params, static bool ffmpeg_init_muxer_pre(ffmpeg_t *handle) { - ctx = avformat_alloc_context(); - handle->muxer.ctx = ctx; #if !FFMPEG3 - unsigned short int len = MIN(strlen(handle->params.filename) + 1, PATH_MAX_LENGTH); - ctx->url = av_malloc(len); + unsigned short int len; +#endif + ctx = avformat_alloc_context(); + handle->muxer.ctx = ctx; +#if !FFMPEG3 + len = MIN(strlen(handle->params.filename) + 1, PATH_MAX_LENGTH); + ctx->url = (char*)av_malloc(len); av_strlcpy(ctx->url, handle->params.filename, len); #else av_strlcpy(ctx->filename, handle->params.filename, sizeof(ctx->filename)); diff --git a/tasks/task_netplay_nat_traversal.c b/tasks/task_netplay_nat_traversal.c index 3e35f81d21..1aebbb2815 100644 --- a/tasks/task_netplay_nat_traversal.c +++ b/tasks/task_netplay_nat_traversal.c @@ -52,7 +52,7 @@ static bool find_local_address(struct natt_device *device, struct addrinfo hints = {0}; uint8_t *dev_addr8 = (uint8_t *)&device->addr.sin_addr; - addrs = (struct addrinfo*)calloc(interfaces.size, sizeof(*addrs)); + addrs = (struct addrinfo**)calloc(interfaces.size, sizeof(*addrs)); if (!addrs) goto done; scores = (uint32_t*)calloc(interfaces.size, sizeof(*scores)); diff --git a/uwp/uwp_main.cpp b/uwp/uwp_main.cpp index 29919b6164..d65a5a2564 100644 --- a/uwp/uwp_main.cpp +++ b/uwp/uwp_main.cpp @@ -696,10 +696,11 @@ void App::ParseProtocolArgs(Windows::ApplicationModel::Activation::IActivatedEve // "cmd" and "launchOnExit" are optional. If none specified, it will normally launch into menu if (args->Kind == ActivationKind::Protocol) { + unsigned i; ProtocolActivatedEventArgs^ protocolArgs = dynamic_cast(args); Windows::Foundation::WwwFormUrlDecoder^ query = protocolArgs->Uri->QueryParsed; - for (int i = 0; i < query->Size; i++) + for (i = 0; i < query->Size; i++) { IWwwFormUrlDecoderEntry^ arg = query->GetAt(i);