Fix several warnings

This commit is contained in:
Eric Warmenhoven 2023-07-01 14:56:20 -04:00 committed by LibretroAdmin
parent 1b953d7463
commit 280dcb32f9
11 changed files with 22 additions and 21 deletions

View File

@ -36,7 +36,7 @@
#include "../audio_driver.h"
#include "../../verbosity.h"
#define BUFSIZE 1024
#define OPENAL_BUFSIZE 1024
typedef struct al
{
@ -46,11 +46,11 @@ typedef struct al
ALCdevice *handle;
ALCcontext *ctx;
size_t res_ptr;
size_t num_buffers;
ALsizei num_buffers;
size_t tmpbuf_ptr;
int rate;
ALenum format;
uint8_t tmpbuf[BUFSIZE];
uint8_t tmpbuf[OPENAL_BUFSIZE];
bool nonblock;
bool is_paused;
} al_t;
@ -104,11 +104,11 @@ static void *al_init(const char *device, unsigned rate, unsigned latency,
al->rate = rate;
/* We already use one buffer for tmpbuf. */
al->num_buffers = (latency * rate * 2 * sizeof(int16_t)) / (1000 * BUFSIZE) - 1;
al->num_buffers = (latency * rate * 2 * sizeof(int16_t)) / (1000 * OPENAL_BUFSIZE) - 1;
if (al->num_buffers < 2)
al->num_buffers = 2;
RARCH_LOG("[OpenAL]: Using %u buffers of %u bytes.\n", (unsigned)al->num_buffers, BUFSIZE);
RARCH_LOG("[OpenAL]: Using %u buffers of %u bytes.\n", (unsigned)al->num_buffers, OPENAL_BUFSIZE);
al->buffers = (ALuint*)calloc(al->num_buffers, sizeof(ALuint));
al->res_buf = (ALuint*)calloc(al->num_buffers, sizeof(ALuint));
@ -165,7 +165,7 @@ static bool al_get_buffer(al_t *al, ALuint *buffer)
static size_t al_fill_internal_buf(al_t *al, const void *buf, size_t size)
{
size_t read_size = MIN(BUFSIZE - al->tmpbuf_ptr, size);
size_t read_size = MIN(OPENAL_BUFSIZE - al->tmpbuf_ptr, size);
memcpy(al->tmpbuf + al->tmpbuf_ptr, buf, read_size);
al->tmpbuf_ptr += read_size;
return read_size;
@ -187,13 +187,13 @@ static ssize_t al_write(void *data, const void *buf_, size_t size)
buf += rc;
size -= rc;
if (al->tmpbuf_ptr != BUFSIZE)
if (al->tmpbuf_ptr != OPENAL_BUFSIZE)
break;
if (!al_get_buffer(al, &buffer))
break;
alBufferData(buffer, AL_FORMAT_STEREO16, al->tmpbuf, BUFSIZE, al->rate);
alBufferData(buffer, AL_FORMAT_STEREO16, al->tmpbuf, OPENAL_BUFSIZE, al->rate);
al->tmpbuf_ptr = 0;
alSourceQueueBuffers(al->source, 1, &buffer);
if (alGetError() != AL_NO_ERROR)
@ -245,13 +245,13 @@ static size_t al_write_avail(void *data)
{
al_t *al = (al_t*)data;
al_unqueue_buffers(al);
return al->res_ptr * BUFSIZE + (BUFSIZE - al->tmpbuf_ptr);
return al->res_ptr * OPENAL_BUFSIZE + (OPENAL_BUFSIZE - al->tmpbuf_ptr);
}
static size_t al_buffer_size(void *data)
{
al_t *al = (al_t*)data;
return (al->num_buffers + 1) * BUFSIZE; /* Also got tmpbuf. */
return (al->num_buffers + 1) * OPENAL_BUFSIZE; /* Also got tmpbuf. */
}
static bool al_use_float(void *data)

2
deps/dr/dr_flac.h vendored
View File

@ -1353,7 +1353,7 @@ static DRFLAC_INLINE drflac_bool32 drflac__read_uint32(drflac_bs* bs, unsigned i
if (!drflac__reload_cache(bs))
return DRFLAC_FALSE;
*pResultOut = (drflac_uint32)(resultHi << bitCountLo) | DRFLAC_CACHE_L1_SELECT_AND_SHIFT(bs, bitCountLo);
*pResultOut = (drflac_uint32)(resultHi << bitCountLo) | (drflac_uint32)DRFLAC_CACHE_L1_SELECT_AND_SHIFT(bs, bitCountLo);
bs->consumedBits += bitCountLo;
bs->cache <<= bitCountLo;
return DRFLAC_TRUE;

View File

@ -71,6 +71,7 @@ enum IOHIDReportType translate_hid_report_type(
case HID_REPORT_OUTPUT:
return kIOHIDReportTypeOutput;
case HID_REPORT_COUNT:
default:
return kIOHIDReportTypeCount;
}
}

View File

@ -185,13 +185,12 @@ static void apple_gamecontroller_joypad_register(GCController *controller)
/* Don't let tvOS or iOS do anything with **our** buttons!!
* iOS will start a screen recording if you hold or doubleclick
* the OPTIONS button, we don't want that. */
if (@available(iOS 14.0, tvOS 14.0, macOS 10.15, *))
if (@available(iOS 14.0, tvOS 14.0, macOS 11, *))
{
GCExtendedGamepad *gp = (GCExtendedGamepad *)controller.extendedGamepad;
gp.buttonOptions.preferredSystemGestureState = GCSystemGestureStateDisabled;
gp.buttonMenu.preferredSystemGestureState = GCSystemGestureStateDisabled;
if (@available(macOS 11, *))
gp.buttonHome.preferredSystemGestureState = GCSystemGestureStateDisabled;
gp.buttonHome.preferredSystemGestureState = GCSystemGestureStateDisabled;
}
#endif

View File

@ -142,6 +142,7 @@ static enum IIRFilter str_to_type(const char *str)
return LPF; /* Fallback. */
}
#undef CHECK
static void make_poly_from_roots(
const double *roots, unsigned num_roots, float *poly)

View File

@ -407,7 +407,7 @@ int huffman_build_tree(struct huffman_decoder* decoder, uint32_t totaldata, uint
decoder->huffnode[curcode].bits = curcode;
/* scale the weight by the current effective length, ensuring we don't go to 0 */
decoder->huffnode[curcode].weight = ((uint64_t)decoder->datahisto[curcode]) * ((uint64_t)totalweight) / ((uint64_t)totaldata);
decoder->huffnode[curcode].weight = (uint32_t)(((uint64_t)decoder->datahisto[curcode]) * ((uint64_t)totalweight) / ((uint64_t)totaldata));
if (decoder->huffnode[curcode].weight == 0)
decoder->huffnode[curcode].weight = 1;
}

View File

@ -114,7 +114,7 @@ static void *lzma_fast_alloc(void *p, size_t size)
}
/* set the low bit of the size so we don't match next time */
*addr = size | 1;
*addr = (uint32_t)size | 1;
/* return aligned address */
return (void*)vaddr;

View File

@ -855,7 +855,7 @@ static int action_left_video_gpu_index(unsigned type, const char *label,
{
configuration_set_int(settings,
settings->ints.vulkan_gpu_index,
list->size - 1);
(int)list->size - 1);
}
}

View File

@ -2785,7 +2785,7 @@ static unsigned ozone_get_sidebar_height(ozone_handle_t *ozone)
: 0);
}
static unsigned ozone_get_selected_sidebar_y_position(ozone_handle_t *ozone)
static size_t ozone_get_selected_sidebar_y_position(ozone_handle_t *ozone)
{
return ozone->categories_selection_ptr * ozone->dimensions.sidebar_entry_height
+ (ozone->categories_selection_ptr - 1) * ozone->dimensions.sidebar_entry_padding_vertical

View File

@ -592,7 +592,7 @@ explore_state_t *menu_explore_build_list(const char *directory_playlist,
}
RBUF_PUSH(rdbs, newrdb);
rdb_num = (uintptr_t)RBUF_LEN(rdbs);
rdb_num = (int)RBUF_LEN(rdbs);
RHMAP_SET(rdb_indices, rdb_hash, rdb_num);
}
@ -1642,7 +1642,7 @@ unsigned menu_displaylist_explore(file_list_t *list, settings_t *settings)
#endif
else
explore_menu_entry(list, state, e->playlist_entry->label,
EXPLORE_TYPE_FIRSTITEM + (e - entries), explore_action_ok);
(unsigned)(EXPLORE_TYPE_FIRSTITEM + (e - entries)), explore_action_ok);
SKIP_ENTRY:;
}

View File

@ -153,7 +153,7 @@ static bool ui_browser_window_cocoa_open(ui_browser_window_state_t *state)
#endif
}
#if defined(MAC_OS_X_VERSION_10_5)
#if defined(MAC_OS_X_VERSION_10_5) && !defined(MAC_OS_X_VERSION_10_6)
[panel setMessage:BOXSTRING(state->title)];
if ([panel runModalForDirectory:BOXSTRING(state->startdir) file:nil] != 1)
return false;