Silence more signedness warnings

This commit is contained in:
libretroadmin 2023-06-14 19:51:31 +02:00
parent c4f43ff28b
commit 246cceeb27
26 changed files with 756 additions and 787 deletions

View File

@ -238,7 +238,7 @@ static bool wasapi_select_device_format(WAVEFORMATEXTENSIBLE *format, IAudioClie
* and Windows was unable to suggest another.
* Usually happens with exclusive mode.
* RetroArch will try selecting a format. */
int i, j;
size_t i, j;
WAVEFORMATEXTENSIBLE possible_format;
HRESULT format_check_hr;
RARCH_WARN("[WASAPI]: Requested format not supported, and Windows could not suggest one. RetroArch will do so.\n");
@ -591,7 +591,7 @@ IMMDevice *wasapi_init_device(const char *id, EDataFlow data_flow)
goto error;
}
if (i == idx_found)
if (i == (UINT32)idx_found)
break;
IFACE_RELEASE(device);
@ -743,4 +743,4 @@ IAudioClient *wasapi_init_client(IMMDevice *device, bool *exclusive,
device_period * (*rate) / 10000000, (double)device_period / 10000.0);
return client;
}
}

View File

@ -82,7 +82,7 @@ static void sdl_audio_playback_cb(void *data, Uint8 *stream, int len)
{
sdl_audio_t *sdl = (sdl_audio_t*)data;
size_t avail = FIFO_READ_AVAIL(sdl->speaker_buffer);
size_t write_size = len > (int)avail ? avail : len;
size_t write_size = (len > (int)avail) ? avail : (size_t)len;
fifo_read(sdl->speaker_buffer, stream, write_size);
#ifdef HAVE_THREADS

View File

@ -68,27 +68,41 @@ static void *sdl_microphone_init(void)
return NULL;
}
sdl = (sdl_microphone_t*)calloc(1, sizeof(*sdl));
if (!sdl)
if (!(sdl = (sdl_microphone_t*)calloc(1, sizeof(*sdl))))
return NULL;
return sdl;
error:
free(sdl);
return NULL;
}
static void sdl_microphone_close_mic(void *driver_context, void *microphone_context);
static void sdl_microphone_close_mic(void *driver_context, void *microphone_context)
{
sdl_microphone_handle_t *microphone = (sdl_microphone_handle_t *)microphone_context;
if (microphone)
{
/* If the microphone was originally initialized successfully... */
if (microphone->device_id > 0)
SDL_CloseAudioDevice(microphone->device_id);
fifo_free(microphone->sample_buffer);
#ifdef HAVE_THREADS
slock_free(microphone->lock);
scond_free(microphone->cond);
#endif
RARCH_LOG("[SDL audio]: Freed microphone with former device ID %u\n", microphone->device_id);
free(microphone);
}
}
static void sdl_microphone_free(void *data)
{
sdl_microphone_t *sdl = (sdl_microphone_t*)data;
if (sdl)
{
SDL_QuitSubSystem(SDL_INIT_AUDIO);
}
free(sdl);
/* NOTE: The microphone frontend should've closed the mics by now */
}
@ -107,10 +121,10 @@ static void sdl_audio_record_cb(void *data, Uint8 *stream, int len)
}
static void *sdl_microphone_open_mic(void *driver_context,
const char *device,
unsigned rate,
unsigned latency,
unsigned *new_rate)
const char *device,
unsigned rate,
unsigned latency,
unsigned *new_rate)
{
int frames;
size_t bufsize;
@ -118,33 +132,32 @@ static void *sdl_microphone_open_mic(void *driver_context,
SDL_AudioSpec desired_spec = {0};
void *tmp = NULL;
(void)driver_context;
/* If the audio driver wasn't initialized yet... */
if (!SDL_WasInit(SDL_INIT_AUDIO))
{ /* If the audio driver wasn't initialized yet... */
{
RARCH_ERR("[SDL mic]: Attempted to initialize input device before initializing the audio subsystem\n");
return NULL;
}
microphone = (sdl_microphone_handle_t *)calloc(1, sizeof(sdl_microphone_handle_t));
if (!microphone)
if (!(microphone = (sdl_microphone_handle_t *)
calloc(1, sizeof(sdl_microphone_handle_t))))
return NULL;
/* Only print SDL audio devices if verbose logging is enabled */
if (verbosity_is_enabled())
{ /* Only print SDL audio devices if verbose logging is enabled */
{
int i;
int num_available_microphones = SDL_GetNumAudioDevices(true);
RARCH_DBG("[SDL mic]: %d audio capture devices found:\n", num_available_microphones);
for (i = 0; i < num_available_microphones; ++i) {
for (i = 0; i < num_available_microphones; ++i)
RARCH_DBG("[SDL mic]: - %s\n", SDL_GetAudioDeviceName(i, true));
}
}
/* We have to buffer up some data ourselves, so we let SDL
* carry approximately half of the latency.
*
* SDL double buffers audio and we do as well. */
frames = find_num_frames(rate, latency / 4);
frames = find_num_frames(rate, latency / 4);
desired_spec.freq = rate;
desired_spec.format = AUDIO_F32SYS;
@ -218,46 +231,18 @@ error:
return NULL;
}
static void sdl_microphone_close_mic(void *driver_context, void *microphone_context)
{
sdl_microphone_handle_t *microphone = (sdl_microphone_handle_t *)microphone_context;
(void)driver_context;
if (microphone)
{
if (microphone->device_id > 0)
{ /* If the microphone was originally initialized successfully... */
SDL_CloseAudioDevice(microphone->device_id);
}
fifo_free(microphone->sample_buffer);
#ifdef HAVE_THREADS
slock_free(microphone->lock);
scond_free(microphone->cond);
#endif
RARCH_LOG("[SDL audio]: Freed microphone with former device ID %u\n", microphone->device_id);
free(microphone);
}
}
static bool sdl_microphone_mic_alive(const void *data, const void *microphone_context)
{
const sdl_microphone_handle_t *microphone = (const sdl_microphone_handle_t*)microphone_context;
(void)data;
if (!microphone)
return false;
/* Both params must be non-null */
return SDL_GetAudioDeviceStatus(microphone->device_id) == SDL_AUDIO_PLAYING;
}
static bool sdl_microphone_start_mic(void *driver_context, void *microphone_context)
{
sdl_microphone_handle_t *microphone = (sdl_microphone_handle_t*)microphone_context;
(void)driver_context;
if (!microphone)
return false;
@ -286,18 +271,20 @@ static bool sdl_microphone_stop_mic(void *driver_context, void *microphone_conte
switch (SDL_GetAudioDeviceStatus(microphone->device_id))
{
case SDL_AUDIO_PAUSED:
return true;
case SDL_AUDIO_PLAYING:
RARCH_ERR("[SDL mic]: Microphone %u failed to pause\n", microphone->device_id);
return false;
case SDL_AUDIO_STOPPED:
RARCH_WARN("[SDL mic]: Microphone %u is in state STOPPED; it may not start again\n", microphone->device_id);
return true;
/* fall-through */
case SDL_AUDIO_PAUSED:
break;
default:
RARCH_ERR("[SDL mic]: Microphone %u is in unknown state\n", microphone->device_id);
return false;
}
return true;
}
static void sdl_microphone_set_nonblock_state(void *driver_context, bool state)
@ -378,8 +365,6 @@ static int sdl_microphone_read(void *driver_context, void *microphone_context, v
static bool sdl_microphone_mic_use_float(const void *driver_context, const void *microphone_context)
{
sdl_microphone_handle_t *microphone = (sdl_microphone_handle_t*)microphone_context;
(void)driver_context;
return SDL_AUDIO_ISFLOAT(microphone->device_spec.format);
}
@ -397,4 +382,4 @@ microphone_driver_t microphone_sdl = {
sdl_microphone_start_mic,
sdl_microphone_stop_mic,
sdl_microphone_mic_use_float,
};
};

View File

@ -102,13 +102,12 @@ static int wasapi_microphone_fetch_fifo(wasapi_microphone_handle_t *microphone)
do
{
BYTE *mic_input = NULL;
UINT32 frames_read = 0;
UINT32 bytes_read = 0;
BYTE *mic_input = NULL;
UINT32 frames_read = 0;
UINT32 bytes_read = 0;
DWORD buffer_status_flags = 0;
HRESULT hr;
hr = _IAudioCaptureClient_GetBuffer(microphone->capture, &mic_input, &frames_read, &buffer_status_flags, NULL, NULL);
HRESULT hr = _IAudioCaptureClient_GetBuffer(microphone->capture,
&mic_input, &frames_read, &buffer_status_flags, NULL, NULL);
if (FAILED(hr))
{
RARCH_ERR("[WASAPI]: Failed to get capture device \"%s\"'s buffer: %s\n",
@ -118,15 +117,14 @@ static int wasapi_microphone_fetch_fifo(wasapi_microphone_handle_t *microphone)
}
bytes_read = frames_read * microphone->frame_size;
/* If the queue has room for the packets we just got... */
if (FIFO_WRITE_AVAIL(microphone->buffer) >= bytes_read && bytes_read > 0)
{ /* If the queue has room for the packets we just got... */
{
fifo_write(microphone->buffer, mic_input, bytes_read);
/* ...then enqueue the bytes directly from the mic's buffer */
}
else
{ /* Not enough space for new frames, so we can't consume this packet right now */
else /* Not enough space for new frames, so we can't consume this packet right now */
frames_read = 0;
}
/* If there's insufficient room in the queue, then we can't read the packet.
* In that case, we leave the packet for next time. */
@ -140,20 +138,21 @@ static int wasapi_microphone_fetch_fifo(wasapi_microphone_handle_t *microphone)
return -1;
}
/* If this is a shared-mode stream and we didn't run out of room in the sample queue... */
if (!microphone->exclusive && frames_read > 0)
{ /* If this is a shared-mode stream and we didn't run out of room in the sample queue... */
{
hr = _IAudioCaptureClient_GetNextPacketSize(microphone->capture, &next_packet_size);
/* Get the number of frames that the mic has for us. */
if (FAILED(hr))
{ /* Get the number of frames that the mic has for us. */
{
RARCH_ERR("[WASAPI]: Failed to get capture device \"%s\"'s next packet size: %s\n",
microphone->device_name, hresult_name(hr));
return -1;
}
}
/* Exclusive-mode streams only deliver one packet at a time, though it's bigger. */
else
{ /* Exclusive-mode streams only deliver one packet at a time, though it's bigger. */
next_packet_size = 0;
}
}
while (next_packet_size != 0);
@ -170,19 +169,21 @@ static int wasapi_microphone_fetch_fifo(wasapi_microphone_handle_t *microphone)
*/
static bool wasapi_microphone_wait_for_capture_event(wasapi_microphone_handle_t *microphone, DWORD timeout)
{
/*...then let's wait for the mic to tell us that samples are ready. */
switch (WaitForSingleObject(microphone->read_event, timeout))
{ /*...then let's wait for the mic to tell us that samples are ready. */
{
case WAIT_OBJECT_0:
/* Okay, there's data available. */
return true;
case WAIT_TIMEOUT:
/* Time out; there's nothing here for us. */
RARCH_ERR("[WASAPI]: Failed to wait for capture device \"%s\" event: Timeout after %ums\n", microphone->device_name, timeout);
return false;
break;
default:
RARCH_ERR("[WASAPI]: Failed to wait for capture device \"%s\" event: %s\n", microphone->device_name, wasapi_error(GetLastError()));
return false;
break;
}
return false;
}
/**
@ -209,18 +210,17 @@ static int wasapi_microphone_read_buffered(
int bytes_read = 0; /* Number of bytes sent to the core */
int bytes_available = FIFO_READ_AVAIL(microphone->buffer);
/* If we don't have any queued samples to give to the core... */
if (!bytes_available)
{ /* If we don't have any queued samples to give to the core... */
{
/* If we couldn't wait for the microphone to signal a capture event... */
if (!wasapi_microphone_wait_for_capture_event(microphone, timeout))
{ /* If we couldn't wait for the microphone to signal a capture event... */
return -1;
}
bytes_available = wasapi_microphone_fetch_fifo(microphone);
/* If we couldn't fetch samples from the microphone... */
if (bytes_available < 0)
{ /* If we couldn't fetch samples from the microphone... */
return -1;
}
}
/* Now that we have samples available, let's give them to the core */
@ -241,18 +241,19 @@ static int wasapi_microphone_read(void *driver_context, void *mic_context, void
if (!wasapi || !microphone || !buffer)
return -1;
/* If microphones shouldn't block... */
if (wasapi->nonblock)
{ /* If microphones shouldn't block... */
return wasapi_microphone_read_buffered(microphone, buffer, buffer_size, 0);
}
if (microphone->exclusive)
{
int read;
for (read = -1; bytes_read < buffer_size; bytes_read += read)
for (read = -1; (size_t)bytes_read < buffer_size; bytes_read += read)
{
read = wasapi_microphone_read_buffered(microphone, (char *) buffer + bytes_read, buffer_size - bytes_read,
INFINITE);
read = wasapi_microphone_read_buffered(microphone,
(char *)buffer + bytes_read,
buffer_size - bytes_read,
INFINITE);
if (read == -1)
return -1;
}
@ -260,11 +261,12 @@ static int wasapi_microphone_read(void *driver_context, void *mic_context, void
else
{
int read;
for (read = -1; bytes_read < buffer_size; bytes_read += read)
for (read = -1; (size_t)bytes_read < buffer_size; bytes_read += read)
{
read = wasapi_microphone_read_buffered(microphone, (char *) buffer + bytes_read, buffer_size - bytes_read,
INFINITE);
read = wasapi_microphone_read_buffered(microphone,
(char *)buffer + bytes_read,
buffer_size - bytes_read,
INFINITE);
if (read == -1)
return -1;
}
@ -283,10 +285,10 @@ static void wasapi_microphone_set_nonblock_state(void *driver_context, bool nonb
}
static void *wasapi_microphone_open_mic(void *driver_context, const char *device, unsigned rate,
unsigned latency, unsigned *new_rate)
unsigned latency, unsigned *new_rate)
{
settings_t *settings = config_get_ptr();
HRESULT hr;
settings_t *settings = config_get_ptr();
DWORD flags = 0;
UINT32 frame_count = 0;
REFERENCE_TIME dev_period = 0;
@ -295,15 +297,16 @@ static void *wasapi_microphone_open_mic(void *driver_context, const char *device
bool exclusive_mode = settings->bools.microphone_wasapi_exclusive_mode;
unsigned sh_buffer_length = settings->uints.microphone_wasapi_sh_buffer_length;
wasapi_microphone_handle_t *microphone = calloc(1, sizeof(wasapi_microphone_handle_t));
(void)driver_context;
if (!microphone)
return NULL;
microphone->exclusive = exclusive_mode;
microphone->device = wasapi_init_device(device, eCapture);
microphone->exclusive = exclusive_mode;
microphone->device = wasapi_init_device(device, eCapture);
/* If we requested a particular capture device, but couldn't open it... */
if (device && !microphone->device)
{ /* If we requested a particular capture device, but couldn't open it... */
{
RARCH_WARN("[WASAPI]: Failed to open requested capture device \"%s\", attempting to open default device\n", device);
microphone->device = wasapi_init_device(NULL, eCapture);
}
@ -340,8 +343,9 @@ static void *wasapi_microphone_open_mic(void *driver_context, const char *device
microphone->frame_size = float_format ? sizeof(float) : sizeof(int16_t);
microphone->engine_buffer_size = frame_count * microphone->frame_size;
/* If this mic should be used *exclusively* by RetroArch... */
if (microphone->exclusive)
{ /* If this mic should be used *exclusively* by RetroArch... */
{
microphone->buffer = fifo_new(microphone->engine_buffer_size);
if (!microphone->buffer)
{
@ -354,8 +358,9 @@ static void *wasapi_microphone_open_mic(void *driver_context, const char *device
}
else
{
/* If the user selected the "default" shared buffer length... */
if (sh_buffer_length <= 0)
{ /* If the user selected the "default" shared buffer length... */
{
hr = _IAudioClient_GetDevicePeriod(microphone->client, &dev_period, NULL);
if (FAILED(hr))
goto error;
@ -388,7 +393,7 @@ static void *wasapi_microphone_open_mic(void *driver_context, const char *device
}
hr = _IAudioClient_GetService(microphone->client,
IID_IAudioCaptureClient, (void**)&microphone->capture);
IID_IAudioCaptureClient, (void**)&microphone->capture);
if (FAILED(hr))
{
RARCH_ERR("[WASAPI]: Failed to get capture device's IAudioCaptureClient service: %s\n", hresult_name(hr));
@ -562,4 +567,4 @@ microphone_driver_t microphone_wasapi = {
wasapi_microphone_start_mic,
wasapi_microphone_stop_mic,
wasapi_microphone_use_float
};
};

View File

@ -856,15 +856,16 @@ static void rcheevos_client_copy_achievements(
* we don't need to keep the definition around
* as it won't be reactivated. Otherwise,
* we do have to keep a copy of it. */
if ((achievement->active & (RCHEEVOS_ACTIVE_HARDCORE
if ((achievement->active & (
RCHEEVOS_ACTIVE_HARDCORE
| RCHEEVOS_ACTIVE_SOFTCORE)) != 0)
achievement->memaddr = strdup(definition->definition);
++achievement;
}
rcheevos_locals->game.achievement_count = achievement
- rcheevos_locals->game.achievements;
rcheevos_locals->game.achievement_count = (unsigned)(achievement
- rcheevos_locals->game.achievements);
}
static void rcheevos_client_copy_leaderboards(

View File

@ -141,9 +141,9 @@ const struct win32_lang_pair win32_lang_pairs[] =
unsigned short win32_get_langid_from_retro_lang(enum retro_language lang)
{
int i;
size_t i;
for (i = 0; i < sizeof(win32_lang_pairs) / sizeof(win32_lang_pairs[0]); i++)
for (i = 0; i < ARRAY_SIZE(win32_lang_pairs); i++)
{
if (win32_lang_pairs[i].lang == lang)
return win32_lang_pairs[i].lang_ident;
@ -154,9 +154,9 @@ unsigned short win32_get_langid_from_retro_lang(enum retro_language lang)
enum retro_language win32_get_retro_lang_from_langid(unsigned short langid)
{
int i;
size_t i;
for (i = 0; i < sizeof(win32_lang_pairs) / sizeof(win32_lang_pairs[0]); i++)
for (i = 0; i < ARRAY_SIZE(win32_lang_pairs); i++)
{
if (win32_lang_pairs[i].lang_ident > 0x3ff)
{

View File

@ -161,19 +161,19 @@ DXGI_FORMAT* dxgi_get_format_fallback_list(DXGI_FORMAT format)
dst_gb, dst_bb, dst_ab, dst_rs, dst_gs, dst_bs, dst_as) \
do \
{ \
if ((sizeof(src_type) == sizeof(dst_type)) && \
((src_rs == dst_rs && src_rb == dst_rb) || !dst_rb) && \
((src_gs == dst_gs && src_gb == dst_gb) || !dst_gb) && \
((src_bs == dst_bs && src_bb == dst_bb) || !dst_bb) && \
((src_as == dst_as && src_ab == dst_ab) || !dst_ab)) \
if ( (sizeof(src_type) == sizeof(dst_type)) \
&& ((src_rs == dst_rs && src_rb == dst_rb) || !dst_rb) \
&& ((src_gs == dst_gs && src_gb == dst_gb) || !dst_gb) \
&& ((src_bs == dst_bs && src_bb == dst_bb) || !dst_bb) \
&& ((src_as == dst_as && src_ab == dst_ab) || !dst_ab)) \
{ \
const UINT8* in = (const UINT8*)src_data; \
UINT8* out = (UINT8*)dst_data; \
for (i = 0; i < height; i++) \
{ \
memcpy(out, in, width * sizeof(src_type)); \
in += src_pitch ? src_pitch : width * sizeof(src_type); \
out += dst_pitch ? dst_pitch : width * sizeof(dst_type); \
in += src_pitch ? (int)src_pitch : (int)(width * sizeof(src_type)); \
out += dst_pitch ? (int)dst_pitch : (int)(width * sizeof(dst_type)); \
} \
} \
else \

View File

@ -2010,7 +2010,7 @@ static const char *meta_key_to_name(unsigned int meta_key)
const struct input_key_map* entry = &input_config_key_map[i];
if (!entry->str)
break;
if (entry->key == key_code)
if (entry->key == (enum retro_key)key_code)
return entry->str;
i++;
}

View File

@ -273,7 +273,7 @@ static bool win32_display_server_set_resolution(void *data,
continue;
if (dm.dmBitsPerPel != curr_bpp)
continue;
if (dm.dmDisplayFrequency != int_hz)
if (dm.dmDisplayFrequency != (DWORD)int_hz)
continue;
#if _WIN32_WINNT >= 0x0500
if (dm.dmDisplayOrientation != curr_orientation)
@ -459,10 +459,10 @@ void win32_display_server_set_screen_orientation(void *data,
if (( dm.dmDisplayOrientation == DMDO_90
|| dm.dmDisplayOrientation == DMDO_270)
&& width != dm.dmPelsHeight)
&& (width != (int)dm.dmPelsHeight))
{
/* device is changing orientations, swap the aspect */
dm.dmPelsWidth = dm.dmPelsHeight;
/* Device is changing orientations, swap the aspect */
dm.dmPelsWidth = dm.dmPelsHeight;
dm.dmPelsHeight = width;
}
@ -475,10 +475,10 @@ void win32_display_server_set_screen_orientation(void *data,
if (( dm.dmDisplayOrientation == DMDO_DEFAULT
|| dm.dmDisplayOrientation == DMDO_180)
&& width != dm.dmPelsHeight)
&& (width != (int)dm.dmPelsHeight))
{
/* device is changing orientations, swap the aspect */
dm.dmPelsWidth = dm.dmPelsHeight;
/* Device is changing orientations, swap the aspect */
dm.dmPelsWidth = dm.dmPelsHeight;
dm.dmPelsHeight = width;
}
@ -491,10 +491,10 @@ void win32_display_server_set_screen_orientation(void *data,
if (( dm.dmDisplayOrientation == DMDO_90
|| dm.dmDisplayOrientation == DMDO_270)
&& width != dm.dmPelsHeight)
&& (width != (int)dm.dmPelsHeight))
{
/* device is changing orientations, swap the aspect */
dm.dmPelsWidth = dm.dmPelsHeight;
/* Device is changing orientations, swap the aspect */
dm.dmPelsWidth = dm.dmPelsHeight;
dm.dmPelsHeight = width;
}
@ -507,10 +507,10 @@ void win32_display_server_set_screen_orientation(void *data,
if (( dm.dmDisplayOrientation == DMDO_DEFAULT
|| dm.dmDisplayOrientation == DMDO_180)
&& width != dm.dmPelsHeight)
&& (width != (int)dm.dmPelsHeight))
{
/* device is changing orientations, swap the aspect */
dm.dmPelsWidth = dm.dmPelsHeight;
/* Device is changing orientations, swap the aspect */
dm.dmPelsWidth = dm.dmPelsHeight;
dm.dmPelsHeight = width;
}

View File

@ -644,7 +644,7 @@ static void d3d10_font_free(void* data, bool is_threaded)
static int d3d10_font_get_message_width(void* data,
const char* msg, size_t msg_len, float scale)
{
int i;
size_t i;
int delta_x = 0;
const struct font_glyph* glyph_q = NULL;
d3d10_font_t* font = (d3d10_font_t*)data;
@ -806,7 +806,7 @@ static void d3d10_font_render_message(
for (;;)
{
const char* delim = strchr(msg, '\n');
size_t msg_len = delim ? (delim - msg) : strlen(msg);
size_t msg_len = delim ? (size_t)((delim - msg)) : strlen(msg);
/* Draw the line */
if (msg_len <= (unsigned)d3d10->sprites.capacity)

View File

@ -630,7 +630,7 @@ static void gl1_raster_font_render_message(gl1_t *gl,
for (;;)
{
const char *delim = strchr(msg, '\n');
size_t msg_len = delim ? (delim - msg) : strlen(msg);
size_t msg_len = delim ? (size_t)(delim - msg) : strlen(msg);
/* Draw the line */
gl1_raster_font_render_line(gl, font, glyph_q,

View File

@ -930,7 +930,7 @@ static void gl2_raster_font_render_message(gl2_t *gl,
for (;;)
{
const char *delim = strchr(msg, '\n');
size_t msg_len = delim ? (delim - msg) : strlen(msg);
size_t msg_len = delim ? (size_t)(delim - msg) : strlen(msg);
/* Draw the line */
gl2_raster_font_render_line(gl, font,

View File

@ -673,7 +673,7 @@ static void gl3_raster_font_render_message(
for (;;)
{
const char *delim = strchr(msg, '\n');
size_t msg_len = delim ? (delim - msg) : strlen(msg);
size_t msg_len = delim ? (size_t)(delim - msg) : strlen(msg);
/* Draw the line */
gl3_raster_font_render_line(gl, font,

View File

@ -1509,7 +1509,7 @@ static void vulkan_font_render_message(vk_t *vk,
for (;;)
{
const char *delim = strchr(msg, '\n');
size_t msg_len = delim ? (delim - msg) : strlen(msg);
size_t msg_len = delim ? (size_t)(delim - msg) : strlen(msg);
/* Draw the line */
vulkan_font_render_line(vk, font, glyph_q, msg, msg_len,

View File

@ -18,9 +18,9 @@
/* Win32/WGL context. */
/* necessary for mingw32 multimon defines: */
/* Necessary for mingw32 multimon defines: */
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0500 //_WIN32_WINNT_WIN2K
#define _WIN32_WINNT 0x0500 /* _WIN32_WINNT_WIN2K */
#endif
#include <tchar.h>
@ -323,8 +323,8 @@ void create_gl_context(HWND hwnd, bool *quit)
break;
}
else if (
versions[i][0] == win32_major &&
versions[i][1] == win32_minor)
(versions[i][0] == (int)win32_major)
&& (versions[i][1] == (int)win32_minor))
{
/* The requested version was tried and
* is not supported, go ahead and fail

View File

@ -353,14 +353,11 @@ static const char *font_renderer_ct_get_default_font(void)
return default_font;
}
static bool font_renderer_ct_get_line_metrics(
static void font_renderer_ct_get_line_metrics(
void* data, struct font_line_metrics **metrics)
{
ct_font_renderer_t *handle = (ct_font_renderer_t*)data;
if (!handle)
return false;
*metrics = &handle->line_metrics;
return true;
}
font_renderer_driver_t coretext_font_renderer = {

View File

@ -438,15 +438,11 @@ static const char *font_renderer_ft_get_default_font(void)
#endif
}
static bool font_renderer_ft_get_line_metrics(
static void font_renderer_ft_get_line_metrics(
void* data, struct font_line_metrics **metrics)
{
ft_font_renderer_t *handle = (ft_font_renderer_t*)data;
if (!handle)
return false;
*metrics = &handle->line_metrics;
return true;
}
font_renderer_driver_t freetype_font_renderer = {

View File

@ -217,7 +217,7 @@ static bool dinput_joypad_get_vidpid_from_xinput_index(
int32_t index, int32_t *vid,
int32_t *pid, int32_t *dinput_index)
{
int i;
size_t i;
for (i = 0; i < ARRAY_SIZE(g_xinput_pad_indexes); i++)
{

File diff suppressed because it is too large Load Diff

View File

@ -963,9 +963,6 @@ void input_config_get_bind_string_joykey(
char *buf, const char *prefix,
const struct retro_keybind *bind, size_t size);
int16_t input_state_internal(unsigned port, unsigned device,
unsigned idx, unsigned id);
bool input_key_pressed(int key, bool keyboard_pressed);
bool input_set_rumble_state(unsigned port,

View File

@ -1446,13 +1446,13 @@ struct string_list* cdrom_get_available_drives(void)
DWORD drive_mask = GetLogicalDrives();
int i;
for (i = 0; i < sizeof(DWORD) * 8; i++)
for (i = 0; i < (int)(sizeof(DWORD) * 8); i++)
{
char path[] = {"a:\\"};
char path[] = {"a:\\"};
char cdrom_path[] = {"cdrom://a:/drive-track01.bin"};
path[0] += i;
cdrom_path[8] += i;
path[0] += i;
cdrom_path[8] += i;
/* this drive letter doesn't exist */
if (!(drive_mask & (1 << i)))
@ -1460,15 +1460,14 @@ struct string_list* cdrom_get_available_drives(void)
if (GetDriveType(path) != DRIVE_CDROM)
continue;
else
{
char drive_model[32] = {0};
char drive_string[33] = {0};
libretro_vfs_implementation_file *stream;
bool is_cdrom = false;
char drive_model[32] = {0};
char drive_string[33] = {0};
union string_list_elem_attr attr = {0};
RFILE *file = filestream_open(cdrom_path, RETRO_VFS_FILE_ACCESS_READ, 0);
libretro_vfs_implementation_file *stream;
bool is_cdrom = false;
if (!file)
continue;
@ -1524,9 +1523,7 @@ bool cdrom_drive_has_media(const char drive)
if (file)
{
libretro_vfs_implementation_file *stream = filestream_get_vfs_handle(file);
bool has_media = false;
has_media = cdrom_is_media_inserted(stream);
bool has_media = cdrom_is_media_inserted(stream);
filestream_close(file);
@ -1538,14 +1535,14 @@ bool cdrom_drive_has_media(const char drive)
bool cdrom_set_read_cache(libretro_vfs_implementation_file *stream, bool enabled)
{
int i;
/* MMC Command: MODE SENSE (10) and MODE SELECT (10) */
unsigned char cdb_sense_changeable[] = {0x5A, 0, 0x48, 0, 0, 0, 0, 0, 0x14, 0};
unsigned char cdb_sense[] = {0x5A, 0, 0x8, 0, 0, 0, 0, 0, 0x14, 0};
unsigned char cdb_select[] = {0x55, 0x10, 0, 0, 0, 0, 0, 0, 0x14, 0};
unsigned char buf[20] = {0};
int rv, i;
rv = cdrom_send_command(stream, DIRECTION_IN, buf, sizeof(buf), cdb_sense_changeable, sizeof(cdb_sense_changeable), 0);
unsigned char cdb_sense[] = {0x5A, 0, 0x8, 0, 0, 0, 0, 0, 0x14, 0};
unsigned char cdb_select[] = {0x55, 0x10, 0, 0, 0, 0, 0, 0, 0x14, 0};
unsigned char buf[20] = {0};
int rv = cdrom_send_command(stream, DIRECTION_IN, buf, sizeof(buf),
cdb_sense_changeable, sizeof(cdb_sense_changeable), 0);
#ifdef CDROM_DEBUG
printf("[CDROM] mode sense changeable status code %d\n", rv);
@ -1581,9 +1578,7 @@ bool cdrom_set_read_cache(libretro_vfs_implementation_file *stream, bool enabled
printf("Mode sense data for caching mode page: ");
for (i = 0; i < (int)sizeof(buf); i++)
{
printf("%02X ", buf[i]);
}
printf("\n");
fflush(stdout);
@ -1596,7 +1591,7 @@ bool cdrom_set_read_cache(libretro_vfs_implementation_file *stream, bool enabled
if (enabled)
buf[10] &= ~1;
else
buf[10] |= 1;
buf[10] |= 1;
rv = cdrom_send_command(stream, DIRECTION_OUT, buf, sizeof(buf), cdb_select, sizeof(cdb_select), 0);
@ -1645,9 +1640,7 @@ bool cdrom_get_timeouts(libretro_vfs_implementation_file *stream, cdrom_group_ti
printf("Mode sense data for timeout groups: ");
for (i = 0; i < (int)sizeof(buf); i++)
{
printf("%02X ", buf[i]);
}
printf("\n");
@ -1669,8 +1662,8 @@ bool cdrom_get_timeouts(libretro_vfs_implementation_file *stream, cdrom_group_ti
bool cdrom_has_atip(libretro_vfs_implementation_file *stream)
{
/* MMC Command: READ TOC/PMA/ATIP */
unsigned char cdb[] = {0x43, 0x2, 0x4, 0, 0, 0, 0, 0x9, 0x30, 0};
unsigned char buf[32] = {0};
unsigned char cdb[] = {0x43, 0x2, 0x4, 0, 0, 0, 0, 0x9, 0x30, 0};
unsigned char buf[32] = {0};
unsigned short atip_len = 0;
int rv = cdrom_send_command(stream, DIRECTION_IN, buf, sizeof(buf), cdb, sizeof(cdb), 0);
@ -1680,7 +1673,10 @@ bool cdrom_has_atip(libretro_vfs_implementation_file *stream)
atip_len = buf[0] << 8 | buf[1];
#ifdef CDROM_DEBUG
printf("ATIP Length %d, Disc Type %d, Disc Sub-Type %d\n", atip_len, (buf[6] >> 6) & 0x1, ((buf[6] >> 5) & 0x1) << 2 | ((buf[6] >> 4) & 0x1) << 1 | ((buf[6] >> 3) & 0x1) << 0);
printf("ATIP Length %d, Disc Type %d, Disc Sub-Type %d\n",
atip_len,
(buf[6] >> 6) & 0x1,
((buf[6] >> 5) & 0x1) << 2 | ((buf[6] >> 4) & 0x1) << 1 | ((buf[6] >> 3) & 0x1) << 0);
#endif
if (atip_len < 5)
@ -1691,30 +1687,23 @@ bool cdrom_has_atip(libretro_vfs_implementation_file *stream)
void cdrom_device_fillpath(char *path, size_t len, char drive, unsigned char track, bool is_cue)
{
size_t pos = 0;
if (!path || len == 0)
return;
if (is_cue)
{
#ifdef _WIN32
pos = strlcpy(path, "cdrom://", len);
size_t pos = strlcpy(path, "cdrom://", len);
if (len > pos)
path[pos++] = drive;
pos = strlcat(path, ":/drive.cue", len);
#else
#ifdef __linux__
pos = strlcpy(path, "cdrom://drive", len);
size_t pos = strlcpy(path, "cdrom://drive", len);
if (len > pos + 1)
{
path[pos++] = drive;
path[pos] = '\0';
path[pos] = '\0';
}
pos = strlcat(path, ".cue", len);
#endif
#endif
@ -1722,22 +1711,18 @@ void cdrom_device_fillpath(char *path, size_t len, char drive, unsigned char tra
else
{
#ifdef _WIN32
pos = strlcpy(path, "cdrom://", len);
size_t pos = strlcpy(path, "cdrom://", len);
if (len > pos + 1)
{
path[pos++] = drive;
path[pos] = '\0';
path[pos] = '\0';
}
pos += snprintf(path + pos, len - pos, ":/drive-track%02d.bin", track);
#else
#ifdef __linux__
pos = strlcpy(path, "cdrom://drive", len);
size_t pos = strlcpy(path, "cdrom://drive", len);
if (len > pos)
path[pos++] = drive;
pos += snprintf(path + pos, len - pos, "-track%02d.bin", track);
#endif
#endif

View File

@ -699,8 +699,8 @@ int64_t retro_vfs_file_read_impl(libretro_vfs_implementation_file *stream,
int64_t retro_vfs_file_write_impl(libretro_vfs_implementation_file *stream, const void *s, uint64_t len)
{
int64_t pos = 0;
size_t result = -1;
int64_t pos = 0;
ssize_t result = -1;
if (!stream)
return -1;

View File

@ -8025,7 +8025,7 @@ static enum menu_action ozone_parse_menu_entry_action(
? ozone_get_onscreen_category_selection(ozone)
: ozone->categories_selection_ptr;
if (tab_selection < ozone->system_tab_end + 1)
if (tab_selection < (size_t)(ozone->system_tab_end + 1))
break;
new_selection = tab_selection - ozone->system_tab_end - 1;
@ -8126,7 +8126,7 @@ static enum menu_action ozone_parse_menu_entry_action(
new_selection = (int)(selection + 1);
if (new_selection >= (int)(ozone->system_tab_end + horizontal_list_size + 1))
new_selection = 0;
new_selection = 0;
ozone_sidebar_goto(ozone, new_selection);
new_action = MENU_ACTION_ACCESSIBILITY_SPEAK_TITLE;
@ -8368,7 +8368,7 @@ static enum menu_action ozone_parse_menu_entry_action(
? ozone_get_onscreen_category_selection(ozone)
: ozone->categories_selection_ptr;
new_selection = tab_selection;
new_selection = (int)tab_selection;
if (menu_st->scroll.mode == MENU_SCROLL_PAGE)
new_selection = (int)(tab_selection - 10);
@ -8385,7 +8385,7 @@ static enum menu_action ozone_parse_menu_entry_action(
new_selection = ozone->sidebar_index_list[l - 1];
}
if (tab_selection < ozone->system_tab_end + 1)
if (tab_selection < (size_t)(ozone->system_tab_end + 1))
new_selection = 0;
else if ((int)tab_selection > (int)ozone->system_tab_end - new_selection
|| new_selection < 0)
@ -8429,7 +8429,7 @@ static enum menu_action ozone_parse_menu_entry_action(
? ozone_get_onscreen_category_selection(ozone)
: ozone->categories_selection_ptr;
new_selection = tab_selection;
new_selection = (int)tab_selection;
if (menu_st->scroll.mode == MENU_SCROLL_PAGE)
new_selection = (int)(tab_selection + 10);
@ -8438,16 +8438,16 @@ static enum menu_action ozone_parse_menu_entry_action(
/* Alphabetical scroll */
size_t l = 0;
while (l < ozone->sidebar_index_size - 1
&& ozone->sidebar_index_list[l + 1] <= tab_selection)
while ( (l < (size_t)(ozone->sidebar_index_size - 1))
&& (ozone->sidebar_index_list[l + 1] <= tab_selection))
l++;
if (l < ozone->sidebar_index_size - 1)
if (l < (size_t)(ozone->sidebar_index_size - 1))
new_selection = ozone->sidebar_index_list[l + 1];
else if (l == ozone->sidebar_index_size - 1)
else if (l == (size_t)(ozone->sidebar_index_size - 1))
new_selection = ozone->system_tab_end + horizontal_list_size;
if (tab_selection < ozone->system_tab_end + 1)
if (tab_selection < (size_t)(ozone->system_tab_end + 1))
new_selection = ozone->system_tab_end + 1;
}
@ -12493,7 +12493,7 @@ static int ozone_pointer_up(void *userdata,
case MENU_INPUT_GESTURE_LONG_PRESS:
/* 'Reset to default' action */
if ( ((int)y > ozone->dimensions.header_height)
&& ((int)y < height - ozone->dimensions.footer_height)
&& ((int)y < (int)(height - ozone->dimensions.footer_height))
&& (ptr < entries_end)
&& (ptr == selection)
&& ((int)x > ozone->dimensions_sidebar_width + ozone->sidebar_offset)

View File

@ -1853,12 +1853,12 @@ static bool INLINE rgui_draw_particle(
/* This great convoluted mess just saves us
* having to perform comparisons on every
* iteration of the for loops... */
int x_start_i = (x > 0) ? x : 0;
int y_start_i = (y > 0) ? y : 0;
int x_end = x + width;
int y_end = y + height;
int x_start = (x_start_i <= (int)fb_width) ? x_start_i : fb_width;
int y_start = (y_start_i <= (int)fb_height) ? y_start_i : fb_height;
unsigned x_start_i = (x > 0) ? x : 0;
unsigned y_start_i = (y > 0) ? y : 0;
int x_end = x + width;
int y_end = y + height;
int x_start = (x_start_i <= fb_width) ? x_start_i : fb_width;
int y_start = (y_start_i <= fb_height) ? y_start_i : fb_height;
if (x_end <= 0)
x_end = 0;
@ -5246,7 +5246,9 @@ static void rgui_render(
title_width = (unsigned)(utf8len(thumbnail_title_buf) * rgui->font_width_stride);
}
title_x = rgui->term_layout.start_x + ((rgui->term_layout.width * rgui->font_width_stride) - title_width) / 2;
title_x = (unsigned)(rgui->term_layout.start_x
+ ((rgui->term_layout.width * rgui->font_width_stride)
- title_width) / 2);
/* Draw thumbnail title background */
rgui_fill_rect(rgui->frame_buf.data, fb_width, fb_height,
@ -5387,7 +5389,7 @@ static void rgui_render(
if (use_smooth_ticker)
{
ticker_smooth.selected = true;
ticker_smooth.field_width = title_max_len * rgui->font_width_stride;
ticker_smooth.field_width = (unsigned)(title_max_len * rgui->font_width_stride);
ticker_smooth.src_str = rgui->menu_title;
ticker_smooth.dst_str = title_buf;
ticker_smooth.dst_str_len = sizeof(title_buf);
@ -5395,9 +5397,9 @@ static void rgui_render(
/* If title is scrolling, then title_len == title_max_len */
if (gfx_animation_ticker_smooth(&ticker_smooth))
title_len = title_max_len;
title_len = title_max_len;
else
title_len = utf8len(title_buf);
title_len = utf8len(title_buf);
}
else
{
@ -5413,8 +5415,10 @@ static void rgui_render(
string_to_upper(title_buf);
title_x = ticker_x_offset + rgui->term_layout.start_x +
(rgui->term_layout.width - title_len) * rgui->font_width_stride / 2;
title_x = (unsigned)(ticker_x_offset
+ rgui->term_layout.start_x
+ (rgui->term_layout.width - title_len)
* rgui->font_width_stride / 2);
/* Title is always centred, unless it is long enough
* to infringe upon the battery indicator, in which case
@ -5470,7 +5474,7 @@ static void rgui_render(
{
unsigned term_offset = rgui_swap_thumbnails
? (unsigned)(rgui->term_layout.height - (i - new_start) - 1)
: (i - new_start);
: (unsigned)(i - new_start);
unsigned thumbnail_width = 0;
/* Note:
@ -5551,7 +5555,7 @@ static void rgui_render(
if (use_smooth_ticker)
{
ticker_smooth.selected = entry_selected;
ticker_smooth.field_width = entry_title_max_len * rgui->font_width_stride;
ticker_smooth.field_width = (unsigned)(entry_title_max_len * rgui->font_width_stride);
if (!string_is_empty(entry.rich_label))
ticker_smooth.src_str = entry.rich_label;
else
@ -7861,11 +7865,11 @@ static void rgui_thumbnail_cycle_dupe(rgui_t *rgui)
if (settings->uints.gfx_thumbnails == settings->uints.menu_left_thumbnails)
{
unsigned tmp = (rgui->gfx_thumbnails_prev > 0)
? (unsigned)rgui->gfx_thumbnails_prev
: settings->uints.gfx_thumbnails + 1;
configuration_set_uint(settings,
settings->uints.gfx_thumbnails,
(rgui->gfx_thumbnails_prev > 0)
? rgui->gfx_thumbnails_prev
: settings->uints.gfx_thumbnails + 1);
settings->uints.gfx_thumbnails, tmp);
if (settings->uints.gfx_thumbnails > 3)
configuration_set_uint(settings,

View File

@ -595,7 +595,7 @@ explore_state_t *menu_explore_build_list(const char *directory_playlist,
RHMAP_SET(rdb_indices, rdb_hash, rdb_num);
}
if (rdb_num == (uintptr_t)-1)
if ((uintptr_t)rdb_num == (uintptr_t)-1)
continue;
rdb = &rdbs[rdb_num - 1];

View File

@ -1646,7 +1646,7 @@ void MainWindow::onFileBrowserTableDirLoaded(const QString &path)
QVector<QPair<QString, QString> > MainWindow::getPlaylists()
{
int i;
size_t i;
QVector<QPair<QString, QString> > playlists;
size_t size = m_listWidget->count();
@ -2243,7 +2243,7 @@ void MainWindow::onThumbnailDropped(const QImage &image,
QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
{
int i;
size_t i;
QVector<QHash<QString, QString> > infoList;
runloop_state_t *runloop_st = runloop_state_get_ptr();
QHash<QString, QString> currentCore = getSelectedCore();
@ -2753,7 +2753,7 @@ void MainWindow::loadContent(const QHash<QString, QString> &contentHash)
{
if (list->size > 0)
{
int i;
size_t i;
for (i = 0; i < list->size; i++)
{
const char *filePath = list->elems[i].data;
@ -3724,10 +3724,10 @@ void MainWindow::initContentTableWidget()
if (path == ALL_PLAYLISTS_TOKEN)
{
int i;
size_t i;
QStringList playlists;
settings_t *settings = config_get_ptr();
QDir playlistDir(settings->paths.directory_playlist);
QStringList playlists;
size_t list_size = (size_t)m_playlistFiles.count();
for (i = 0; i < list_size; i++)
@ -3910,7 +3910,7 @@ void MainWindow::onShowInfoMessage(QString msg)
int MainWindow::onExtractArchive(QString path, QString extractionDir, QString tempExtension, retro_task_callback_t cb)
{
int i;
size_t i;
file_archive_transfer_t state;
struct archive_extract_userdata userdata;
QByteArray pathArray = path.toUtf8();