Skip to content

Commit

Permalink
Fixing compiler warnings (#17001)
Browse files Browse the repository at this point in the history
  • Loading branch information
warmenhoven authored Sep 14, 2024
1 parent 39c48f7 commit b557bc9
Show file tree
Hide file tree
Showing 20 changed files with 37 additions and 56 deletions.
4 changes: 2 additions & 2 deletions command.c
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,7 @@ static void scan_states(settings_t *settings,
{
/* Gap index: lowest free slot in the wraparound range */
if (gap_idx == UINT_MAX)
gap_idx = i;
gap_idx = (unsigned)i;
}
/* Occupied save slots */
else
Expand All @@ -1543,7 +1543,7 @@ static void scan_states(settings_t *settings,
after gap index */
if (gap_idx < UINT_MAX &&
del_idx == UINT_MAX)
del_idx = i;
del_idx = (unsigned)i;
}
}

Expand Down
8 changes: 4 additions & 4 deletions cores/libretro-ffmpeg/ffmpeg_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ void CORE_PREFIX(retro_reset)(void)
reset_triggered = true;
}

static void print_ffmpeg_version()
static void print_ffmpeg_version(void)
{
PRINT_VERSION(avformat)
PRINT_VERSION(avcodec)
Expand Down Expand Up @@ -491,7 +491,7 @@ static void check_variables(bool firststart)
}
else
{
sw_decoder_threads = strtoul(sw_threads_var.value, NULL, 0);
sw_decoder_threads = (unsigned)strtoul(sw_threads_var.value, NULL, 0);
}
/* Scale the sws threads based on core count but use at least 2 and at most 4 threads */
sw_sws_threads = MIN(MAX(2, sw_decoder_threads / 2), 4);
Expand Down Expand Up @@ -877,7 +877,7 @@ void CORE_PREFIX(retro_run)(void)
if (!temporal_interpolation)
mix_factor = 1.0f;

glBindFramebuffer(GL_FRAMEBUFFER, hw_render.get_current_framebuffer());
glBindFramebuffer(GL_FRAMEBUFFER, (GLuint)hw_render.get_current_framebuffer());
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
glViewport(0, 0, media.width, media.height);
Expand Down Expand Up @@ -1750,7 +1750,7 @@ static void decode_thread(void *data)
if (video_stream_index >= 0)
{
frame_size = av_image_get_buffer_size(AV_PIX_FMT_RGB32, media.width, media.height, 1);
video_buffer = video_buffer_create(4, frame_size, media.width, media.height);
video_buffer = video_buffer_create(4, (int)frame_size, media.width, media.height);
tpool = tpool_create(sw_sws_threads);
log_cb(RETRO_LOG_INFO, "[FFMPEG] Configured worker threads: %d\n", sw_sws_threads);
}
Expand Down
2 changes: 1 addition & 1 deletion cores/libretro-ffmpeg/packet_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ typedef struct packet_buffer packet_buffer_t;
*
* Returns: A packet buffer.
*/
packet_buffer_t *packet_buffer_create();
packet_buffer_t *packet_buffer_create(void);

/**
* packet_buffer_destroy:
Expand Down
2 changes: 1 addition & 1 deletion cores/libretro-net-retropad/net_retropad_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ static void retropad_update_input(void)
}
}

static void open_UDP_socket()
static void open_UDP_socket(void)
{
socket_target_t in_target;

Expand Down
2 changes: 2 additions & 0 deletions deps/libFLAC/include/share/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@
#endif

#if HAVE_INTTYPES_H
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
#include <inttypes.h>
#endif

Expand Down
3 changes: 0 additions & 3 deletions gfx/drivers/gl3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1568,9 +1568,6 @@ static void gl3_set_viewport(gl3_t *gl,
unsigned viewport_height,
bool force_full, bool allow_rotate)
{
unsigned height = gl->video_height;
int x = 0;
int y = 0;
settings_t *settings = config_get_ptr();
float device_aspect = (float)viewport_width / viewport_height;
bool video_scale_integer = settings->bools.video_scale_integer;
Expand Down
2 changes: 1 addition & 1 deletion gfx/drivers/sdl2_gfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ static void sdl2_poke_set_texture_frame(void *data,
sdl_refresh_input_size(vid, true, rgb32, width, height,
width * (rgb32 ? 4 : 2));

SDL_UpdateTexture(vid->menu.tex, NULL, frame, vid->menu.pitch);
SDL_UpdateTexture(vid->menu.tex, NULL, frame, (int)vid->menu.pitch);
}
}

Expand Down
2 changes: 1 addition & 1 deletion gfx/drivers_shader/shader_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2619,7 +2619,7 @@ void Framebuffer::init(DeferredDisposer *disposer)
info.extent.width = size.width;
info.extent.height = size.height;
info.extent.depth = 1;
info.mipLevels = MIN(max_levels, _y);
info.mipLevels = (uint32_t)MIN(max_levels, _y);
info.arrayLayers = 1;
info.samples = VK_SAMPLE_COUNT_1_BIT;
info.tiling = VK_IMAGE_TILING_OPTIMAL;
Expand Down
1 change: 0 additions & 1 deletion input/drivers/sdl_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ static void sdl_input_free(void *data)
#ifndef HAVE_SDL2
SDL_Event event;
#endif
sdl_input_t *sdl = (sdl_input_t*)data;

if (!data)
return;
Expand Down
6 changes: 3 additions & 3 deletions input/drivers_joypad/mfi_joypad.m
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ static void apple_gamecontroller_joypad_disconnect(GCController* controller)
}

#if TARGET_OS_IOS
static void apple_gamecontroller_device_haptics_setup() IPHONE_RUMBLE_AVAIL
static void apple_gamecontroller_device_haptics_setup(void) IPHONE_RUMBLE_AVAIL
{
if (!CHHapticEngine.capabilitiesForHardware.supportsHaptics)
return;
Expand Down Expand Up @@ -596,14 +596,14 @@ static void apple_gamecontroller_device_haptics_setup() IPHONE_RUMBLE_AVAIL
return player;
}

static id<CHHapticPatternPlayer> apple_gamecontroller_device_haptics_strong_player() IPHONE_RUMBLE_AVAIL
static id<CHHapticPatternPlayer> apple_gamecontroller_device_haptics_strong_player(void) IPHONE_RUMBLE_AVAIL
{
if (!deviceStrongPlayer)
deviceStrongPlayer = apple_gamecontroller_device_haptics_create_player(1.0f);
return deviceStrongPlayer;
}

static id<CHHapticPatternPlayer> apple_gamecontroller_device_haptics_weak_player() IPHONE_RUMBLE_AVAIL
static id<CHHapticPatternPlayer> apple_gamecontroller_device_haptics_weak_player(void) IPHONE_RUMBLE_AVAIL
{
if (!deviceWeakPlayer)
deviceWeakPlayer = apple_gamecontroller_device_haptics_create_player(0.5f);
Expand Down
2 changes: 2 additions & 0 deletions libretro-common/features/features_cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
/**
* TODO/FIXME: clock_gettime function is part of iOS 10 now
**/
#if __IPHONE_OS_VERSION_MIN_REQUIRED < 100000
static int ra_clock_gettime(int clk_ik, struct timespec *t)
{
struct timeval now;
Expand All @@ -134,6 +135,7 @@ static int ra_clock_gettime(int clk_ik, struct timespec *t)
return 0;
}
#endif
#endif

#if defined(__MACH__) && __IPHONE_OS_VERSION_MIN_REQUIRED < 100000
#else
Expand Down
1 change: 0 additions & 1 deletion menu/cbs/menu_cbs_ok.c
Original file line number Diff line number Diff line change
Expand Up @@ -4215,7 +4215,6 @@ static int action_ok_file_load_ffmpeg(const char *path,
char new_path[PATH_MAX_LENGTH];
const char *menu_path = NULL;
struct menu_state *menu_st = menu_state_get_ptr();
menu_handle_t *menu = menu_st->driver_data;
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *menu_stack = MENU_LIST_GET(menu_list, 0);

Expand Down
2 changes: 1 addition & 1 deletion menu/drivers/ozone.c
Original file line number Diff line number Diff line change
Expand Up @@ -8178,7 +8178,7 @@ static enum menu_action ozone_parse_menu_entry_action(

if ( !menu_navigation_wraparound_enable
&& selection == ozone->system_tab_end + horizontal_list_size)
new_selection = selection;
new_selection = (int)selection;

if (new_selection != (int)selection)
{
Expand Down
4 changes: 2 additions & 2 deletions pkg/apple/JITSupport.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
#define PT_TRACE_ME 0 /* child declares it's being traced */
#define PT_SIGEXC 12 /* signals as exceptions for current_proc */

static void *exception_handler(void *argument) {
#if !TARGET_OS_TV
static void *exception_handler(void *argument) {
mach_port_t port = *(mach_port_t *)argument;
mach_msg_server(exc_server, 2048, port, 0);
#endif
return NULL;
}
#endif

static bool jb_has_debugger_attached(void) {
int flags;
Expand Down
1 change: 1 addition & 0 deletions pkg/apple/RetroArchTopShelfExtension/ContentProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#define kRetroArchAppGroup @"group.com.libretro.dist.tvos.RetroArchAppGroup"
#endif

API_AVAILABLE(tvos(13.0))
@interface ContentProvider : TVTopShelfContentProvider


Expand Down
26 changes: 2 additions & 24 deletions pkg/apple/RetroArch_iOS13.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1800,20 +1800,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image";
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_ENTITLEMENTS = "$(TVOS_CODE_SIGN_ENTITLEMENTS)";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/tvOS/Frameworks",
);
INFOPLIST_FILE = "$(SRCROOT)/tvOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/Frameworks/MoltenVK.framework",
);
LIBRARY_SEARCH_PATHS = (
"$(PROJECT_DIR)/tvOS/modules",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "$(TVOS_BUNDLE_IDENTIFIER)";
PRODUCT_NAME = RetroArchTV;
SDKROOT = appletvos;
Expand All @@ -1827,20 +1819,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image";
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_ENTITLEMENTS = "$(TVOS_CODE_SIGN_ENTITLEMENTS)";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/tvOS/Frameworks",
);
INFOPLIST_FILE = "$(SRCROOT)/tvOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/Frameworks/MoltenVK.framework",
);
LIBRARY_SEARCH_PATHS = (
"$(PROJECT_DIR)/tvOS/modules",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "$(TVOS_BUNDLE_IDENTIFIER)";
PRODUCT_NAME = RetroArchTV;
SDKROOT = appletvos;
Expand Down Expand Up @@ -1942,10 +1926,7 @@
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.entertainment";
IOS_BUNDLE_IDENTIFIER = com.libretro.RetroArchiOS11;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LIBRARY_SEARCH_PATHS = (
"$(PROJECT_DIR)/iOS/modules",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = "";
LLVM_LTO = YES_THIN;
MARKETING_VERSION = 1.19.1;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
Expand Down Expand Up @@ -2004,10 +1985,7 @@
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.entertainment";
IOS_BUNDLE_IDENTIFIER = com.libretro.RetroArchiOS11;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LIBRARY_SEARCH_PATHS = (
"$(PROJECT_DIR)/iOS/modules",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = "";
LLVM_LTO = YES_THIN;
MARKETING_VERSION = 1.19.1;
MTL_ENABLE_DEBUG_INFO = NO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
static dispatch_queue_t _dateFormatterQueue = NULL;

// TODO: Handle RFC 850 and ANSI C's asctime() format
void GCDWebServerInitializeFunctions() {
void GCDWebServerInitializeFunctions(void) {
GWS_DCHECK([NSThread isMainThread]); // NSDateFormatter should be initialized on main thread
if (_dateFormatterRFC822 == nil) {
_dateFormatterRFC822 = [[NSDateFormatter alloc] init];
Expand Down
16 changes: 9 additions & 7 deletions record/drivers/record_ffmpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ extern "C" {
#include "../../retroarch.h"
#include "../../verbosity.h"

#ifndef FFMPEG3
#define FFMPEG3 (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 10, 100))
#endif
#define HAVE_CH_LAYOUT (LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100))

struct ff_video_info
Expand Down Expand Up @@ -1083,7 +1085,7 @@ static bool ffmpeg_push_video(void *data,
unsigned avail;

slock_lock(handle->lock);
avail = FIFO_WRITE_AVAIL(handle->attr_fifo);
avail = (unsigned)FIFO_WRITE_AVAIL(handle->attr_fifo);
slock_unlock(handle->lock);

if (!handle->alive)
Expand Down Expand Up @@ -1115,7 +1117,7 @@ static bool ffmpeg_push_video(void *data,
if (attr_data.is_dupe)
attr_data.width = attr_data.height = attr_data.pitch = 0;
else
attr_data.pitch = attr_data.width * handle->video.pix_size;
attr_data.pitch = (int)(attr_data.width * handle->video.pix_size);

fifo_write(handle->attr_fifo, &attr_data, sizeof(attr_data));

Expand Down Expand Up @@ -1145,7 +1147,7 @@ static bool ffmpeg_push_audio(void *data,
unsigned avail;

slock_lock(handle->lock);
avail = FIFO_WRITE_AVAIL(handle->audio_fifo);
avail = (unsigned)FIFO_WRITE_AVAIL(handle->audio_fifo);
slock_unlock(handle->lock);

if (!handle->alive)
Expand Down Expand Up @@ -1184,7 +1186,7 @@ static bool encode_video(ffmpeg_t *handle, AVFrame *frame)

pkt = handle->pkt;
pkt->data = handle->video.outbuf;
pkt->size = handle->video.outbuf_size;
pkt->size = (int)handle->video.outbuf_size;

ret = avcodec_send_frame(handle->video.codec, frame);
if (ret < 0)
Expand Down Expand Up @@ -1346,14 +1348,14 @@ static bool encode_audio(ffmpeg_t *handle, bool dry)
pkt = handle->pkt;

pkt->data = handle->audio.outbuf;
pkt->size = handle->audio.outbuf_size;
pkt->size = (int)handle->audio.outbuf_size;

frame = av_frame_alloc();

if (!frame)
return false;

frame->nb_samples = handle->audio.frames_in_buffer;
frame->nb_samples = (int)handle->audio.frames_in_buffer;
frame->format = handle->audio.codec->sample_fmt;
#if HAVE_CH_LAYOUT
av_channel_layout_copy(&frame->ch_layout, &handle->audio.codec->ch_layout);
Expand All @@ -1373,7 +1375,7 @@ static bool encode_audio(ffmpeg_t *handle, bool dry)
samples_size = av_samples_get_buffer_size(
NULL,
nb_channels,
handle->audio.frames_in_buffer,
(int)handle->audio.frames_in_buffer,
handle->audio.codec->sample_fmt, 0);

av_frame_get_buffer(frame, 0);
Expand Down
2 changes: 1 addition & 1 deletion record/drivers/record_wav.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static bool wav_write_hdr(record_wav_t *handle, unsigned channels, unsigned samp
handle->frame = 2 * channels;
/* set initial size to 4 hours; to be fixed inside record_wav_finalize */
length = 4 * 60 * 60 * samplerate * handle->frame;
header.riff_size = swap_if_big32(sizeof(wav_hdr_t) - offsetof(wav_hdr_t, fourcc) + length),
header.riff_size = swap_if_big32(sizeof(wav_hdr_t) - offsetof(wav_hdr_t, fourcc) + length);
memcpy(header.fourcc, "WAVE", sizeof(header.fourcc));
memcpy(header.fmt_tag, "fmt ", sizeof(header.fmt_tag));
header.fmt_size = swap_if_big32(sizeof(header.fmt));
Expand Down
5 changes: 3 additions & 2 deletions ui/drivers/ui_cocoatouch.m
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,8 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application
#endif

#if TARGET_OS_IOS
[MXMetricManager.sharedManager addSubscriber:self];
if (@available(iOS 13.0, *))
[MXMetricManager.sharedManager addSubscriber:self];
#endif

#ifdef HAVE_MFI
Expand Down Expand Up @@ -900,7 +901,7 @@ - (void)refreshSystemConfig
- (void)supportOtherAudioSessions { }

#if TARGET_OS_IOS
- (void)didReceiveMetricPayloads:(NSArray<MXMetricPayload *> *)payloads
- (void)didReceiveMetricPayloads:(NSArray<MXMetricPayload *> *)payloads API_AVAILABLE(ios(13.0))
{
for (MXMetricPayload *payload in payloads)
{
Expand Down

0 comments on commit b557bc9

Please sign in to comment.