Remove asserts

This commit is contained in:
libretroadmin 2023-01-09 00:50:43 +01:00
parent 84b0546965
commit daa9e352cc
52 changed files with 67 additions and 320 deletions

View file

@ -24,7 +24,6 @@
#include <string/stdstring.h> #include <string/stdstring.h>
#include <encodings/utf.h> #include <encodings/utf.h>
#include <clamping.h> #include <clamping.h>
#include <retro_assert.h>
#include <memalign.h> #include <memalign.h>
#include <audio/conversion/float_to_s16.h> #include <audio/conversion/float_to_s16.h>
#include <audio/conversion/s16_to_float.h> #include <audio/conversion/s16_to_float.h>
@ -584,10 +583,6 @@ bool audio_driver_init_internal(
convert_s16_to_float_init_simd(); convert_s16_to_float_init_simd();
convert_float_to_s16_init_simd(); convert_float_to_s16_init_simd();
/* Used for recording even if audio isn't enabled. */
retro_assert(conv_buf != NULL);
retro_assert(audio_buf != NULL);
if (!conv_buf || !audio_buf) if (!conv_buf || !audio_buf)
goto error; goto error;
@ -602,10 +597,7 @@ bool audio_driver_init_internal(
#ifdef HAVE_REWIND #ifdef HAVE_REWIND
/* Needs to be able to hold full content of a full max_bufsamples /* Needs to be able to hold full content of a full max_bufsamples
* in addition to its own. */ * in addition to its own. */
rewind_buf = (int16_t*)memalign_alloc(64, max_bufsamples * sizeof(int16_t)); if (!(rewind_buf = (int16_t*)memalign_alloc(64, max_bufsamples * sizeof(int16_t))))
retro_assert(rewind_buf != NULL);
if (!rewind_buf)
goto error; goto error;
audio_driver_st.rewind_buf = rewind_buf; audio_driver_st.rewind_buf = rewind_buf;
@ -727,14 +719,7 @@ bool audio_driver_init_internal(
audio_driver_st.data_ptr = 0; audio_driver_st.data_ptr = 0;
retro_assert(settings->uints.audio_output_sample_rate < if (!(samples_buf = (float*)memalign_alloc(64, outsamples_max * sizeof(float))))
audio_driver_st.input * AUDIO_MAX_RATIO);
samples_buf = (float*)memalign_alloc(64, outsamples_max * sizeof(float));
retro_assert(samples_buf != NULL);
if (!samples_buf)
goto error; goto error;
audio_driver_st.output_samples_buf = (float*)samples_buf; audio_driver_st.output_samples_buf = (float*)samples_buf;

View file

@ -83,7 +83,6 @@
#include <compat/strl.h> #include <compat/strl.h>
#include <retro_inline.h> #include <retro_inline.h>
#include <retro_assert.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include <retro_timers.h> #include <retro_timers.h>
@ -224,7 +223,6 @@ static INLINE int rsnd_format_to_samplesize ( uint16_t fmt )
int rsd_samplesize( rsound_t *rd ) int rsd_samplesize( rsound_t *rd )
{ {
retro_assert(rd != NULL);
return rd->samplesize; return rd->samplesize;
} }
@ -1315,7 +1313,6 @@ int rsd_stop(rsound_t *rd)
{ {
const char buf[] = "RSD 5 STOP"; const char buf[] = "RSD 5 STOP";
retro_assert(rd != NULL);
rsnd_stop_thread(rd); rsnd_stop_thread(rd);
/* Do not really care about errors here. /* Do not really care about errors here.
@ -1329,7 +1326,6 @@ int rsd_stop(rsound_t *rd)
size_t rsd_write( rsound_t *rsound, const void* buf, size_t size) size_t rsd_write( rsound_t *rsound, const void* buf, size_t size)
{ {
size_t max_write, written = 0; size_t max_write, written = 0;
retro_assert(rsound != NULL);
if ( !rsound->ready_for_data ) if ( !rsound->ready_for_data )
return 0; return 0;
@ -1354,21 +1350,13 @@ size_t rsd_write( rsound_t *rsound, const void* buf, size_t size)
int rsd_start(rsound_t *rsound) int rsd_start(rsound_t *rsound)
{ {
retro_assert(rsound != NULL);
retro_assert(rsound->rate > 0);
retro_assert(rsound->channels > 0);
retro_assert(rsound->host != NULL);
retro_assert(rsound->port != NULL);
if ( rsnd_create_connection(rsound) < 0 ) if ( rsnd_create_connection(rsound) < 0 )
return -1; return -1;
return 0; return 0;
} }
int rsd_exec(rsound_t *rsound) int rsd_exec(rsound_t *rsound)
{ {
retro_assert(rsound != NULL);
RSD_DEBUG("[RSound] rsd_exec().\n"); RSD_DEBUG("[RSound] rsd_exec().\n");
/* Makes sure we have a working connection */ /* Makes sure we have a working connection */
@ -1419,8 +1407,6 @@ int rsd_exec(rsound_t *rsound)
/* ioctl()-ish param setting :D */ /* ioctl()-ish param setting :D */
int rsd_set_param(rsound_t *rd, enum rsd_settings option, void* param) int rsd_set_param(rsound_t *rd, enum rsd_settings option, void* param)
{ {
retro_assert(rd != NULL);
retro_assert(param != NULL);
int retval = 0; int retval = 0;
switch(option) switch(option)
@ -1517,27 +1503,18 @@ void rsd_delay_wait(rsound_t *rd)
size_t rsd_pointer(rsound_t *rsound) size_t rsd_pointer(rsound_t *rsound)
{ {
retro_assert(rsound != NULL); return rsnd_get_ptr(rsound);
int ptr;
ptr = rsnd_get_ptr(rsound);
return ptr;
} }
size_t rsd_get_avail(rsound_t *rd) size_t rsd_get_avail(rsound_t *rd)
{ {
retro_assert(rd != NULL); return rd->buffer_size - rsnd_get_ptr(rd);
int ptr;
ptr = rsnd_get_ptr(rd);
return rd->buffer_size - ptr;
} }
size_t rsd_delay(rsound_t *rd) size_t rsd_delay(rsound_t *rd)
{ {
retro_assert(rd != NULL);
int ptr = rsnd_get_delay(rd); int ptr = rsnd_get_delay(rd);
if ( ptr < 0 ) if (ptr < 0)
ptr = 0; ptr = 0;
return ptr; return ptr;
@ -1545,16 +1522,12 @@ size_t rsd_delay(rsound_t *rd)
size_t rsd_delay_ms(rsound_t* rd) size_t rsd_delay_ms(rsound_t* rd)
{ {
retro_assert(rd);
retro_assert(rd->rate > 0 && rd->channels > 0);
return (rsd_delay(rd) * 1000) / ( rd->rate * rd->channels * rd->samplesize ); return (rsd_delay(rd) * 1000) / ( rd->rate * rd->channels * rd->samplesize );
} }
int rsd_pause(rsound_t* rsound, int enable) int rsd_pause(rsound_t* rsound, int enable)
{ {
retro_assert(rsound != NULL); if (enable)
if ( enable )
return rsd_stop(rsound); return rsd_stop(rsound);
return rsd_start(rsound); return rsd_start(rsound);
@ -1567,8 +1540,6 @@ int rsd_init(rsound_t** rsound)
if (*rsound == NULL) if (*rsound == NULL)
return -1; return -1;
retro_assert(rsound != NULL);
(*rsound)->conn.socket = -1; (*rsound)->conn.socket = -1;
(*rsound)->conn.ctl_socket = -1; (*rsound)->conn.ctl_socket = -1;
@ -1629,17 +1600,10 @@ int rsd_simple_start(rsound_t** rsound, const char* host, const char* port, cons
void rsd_set_callback(rsound_t *rsound, rsd_audio_callback_t audio_cb, rsd_error_callback_t err_cb, size_t max_size, void *userdata) void rsd_set_callback(rsound_t *rsound, rsd_audio_callback_t audio_cb, rsd_error_callback_t err_cb, size_t max_size, void *userdata)
{ {
retro_assert(rsound != NULL);
rsound->audio_callback = audio_cb; rsound->audio_callback = audio_cb;
rsound->error_callback = err_cb; rsound->error_callback = err_cb;
rsound->cb_max_size = max_size; rsound->cb_max_size = max_size;
rsound->cb_data = userdata; rsound->cb_data = userdata;
if (rsound->audio_callback)
{
retro_assert(rsound->error_callback);
}
} }
void rsd_callback_lock(rsound_t *rsound) void rsd_callback_lock(rsound_t *rsound)
@ -1654,7 +1618,6 @@ void rsd_callback_unlock(rsound_t *rsound)
int rsd_free(rsound_t *rsound) int rsd_free(rsound_t *rsound)
{ {
retro_assert(rsound != NULL);
if (rsound->fifo_buffer) if (rsound->fifo_buffer)
fifo_free(rsound->fifo_buffer); fifo_free(rsound->fifo_buffer);
if (rsound->host) if (rsound->host)

View file

@ -20,7 +20,6 @@
#include <malloc.h> #include <malloc.h>
#endif #endif
#include <string.h> #include <string.h>
#include <assert.h>
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
#include <fcntl.h> #include <fcntl.h>
@ -37,7 +36,6 @@
#include <memmap.h> #include <memmap.h>
#include <retro_assert.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include <gfx/scaler/scaler.h> #include <gfx/scaler/scaler.h>
#include <gfx/video_frame.h> #include <gfx/video_frame.h>
@ -380,8 +378,6 @@ static bool preprocess_image(void *data)
return false; return false;
} }
retro_assert(buf.index < v4l->n_buffers);
ctx = &v4l->scaler; ctx = &v4l->scaler;
scaler_ctx_scale_direct(ctx, v4l->buffer_output, (const uint8_t*)v4l->buffers[buf.index].start); scaler_ctx_scale_direct(ctx, v4l->buffer_output, (const uint8_t*)v4l->buffers[buf.index].start);

View file

@ -24,7 +24,6 @@
#include <file/file_path.h> #include <file/file_path.h>
#include <compat/strl.h> #include <compat/strl.h>
#include <compat/posix_string.h> #include <compat/posix_string.h>
#include <retro_assert.h>
#include <string/stdstring.h> #include <string/stdstring.h>
#include <streams/file_stream.h> #include <streams/file_stream.h>
#include <array/rhmap.h> #include <array/rhmap.h>
@ -2717,22 +2716,6 @@ void config_set_defaults(void *data)
input_remapping_deinit(false); input_remapping_deinit(false);
input_remapping_set_defaults(false); input_remapping_set_defaults(false);
/* Verify that binds are in proper order. */
for (i = 0; i < MAX_USERS; i++)
{
for (j = 0; j < RARCH_BIND_LIST_END; j++)
{
const struct retro_keybind *keyval = &input_config_binds[i][j];
/* No need to verify hotkeys for all users */
if (i > 0 && j > RARCH_CUSTOM_BIND_LIST_END)
continue;
if (keyval->valid)
retro_assert(j == keyval->id);
}
}
configuration_set_string(settings, configuration_set_string(settings,
settings->paths.network_buildbot_url, DEFAULT_BUILDBOT_SERVER_URL); settings->paths.network_buildbot_url, DEFAULT_BUILDBOT_SERVER_URL);
configuration_set_string(settings, configuration_set_string(settings,

View file

@ -15,7 +15,6 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <retro_assert.h>
#include <compat/strl.h> #include <compat/strl.h>
#include <string/stdstring.h> #include <string/stdstring.h>
#include <file/config_file.h> #include <file/config_file.h>
@ -386,7 +385,6 @@ static bool CCJSONEndObjectHandler(void *context)
&& (pCtx->array_depth == 1)) && (pCtx->array_depth == 1))
pCtx->to_core_file_id = false; pCtx->to_core_file_id = false;
retro_assert(pCtx->object_depth > 0);
pCtx->object_depth--; pCtx->object_depth--;
return true; return true;
@ -406,7 +404,6 @@ static bool CCJSONEndArrayHandler(void *context)
if ((pCtx->object_depth == 2) && (pCtx->array_depth == 2)) if ((pCtx->object_depth == 2) && (pCtx->array_depth == 2))
pCtx->to_firmware = false; pCtx->to_firmware = false;
retro_assert(pCtx->array_depth > 0);
pCtx->array_depth--; pCtx->array_depth--;
return true; return true;

View file

@ -3,7 +3,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <assert.h>
#include <stdarg.h> #include <stdarg.h>
#ifdef RARCH_INTERNAL #ifdef RARCH_INTERNAL

View file

@ -2,7 +2,6 @@
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <assert.h>
#include <boolean.h> #include <boolean.h>
#include <lists/dir_list.h> #include <lists/dir_list.h>

View file

@ -49,7 +49,6 @@
#include <boolean.h> #include <boolean.h>
#include <compat/apple_compat.h> #include <compat/apple_compat.h>
#include <retro_assert.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include <file/file_path.h> #include <file/file_path.h>
#include <streams/file_stream.h> #include <streams/file_stream.h>
@ -368,17 +367,13 @@ static void frontend_darwin_get_env(int *argc, char *argv[],
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
if (realpath(home_dir_buf, resolved_home_dir_buf)) if (realpath(home_dir_buf, resolved_home_dir_buf))
{ strlcpy(home_dir_buf,
retro_assert(strlcpy(home_dir_buf,
resolved_home_dir_buf, resolved_home_dir_buf,
sizeof(home_dir_buf)) < sizeof(home_dir_buf)); sizeof(home_dir_buf));
}
if (realpath(bundle_path_buf, resolved_bundle_dir_buf)) if (realpath(bundle_path_buf, resolved_bundle_dir_buf))
{ strlcpy(bundle_path_buf,
retro_assert(strlcpy(bundle_path_buf, resolved_bundle_dir_buf,
resolved_bundle_dir_buf, sizeof(bundle_path_buf);
sizeof(bundle_path_buf)) < sizeof(bundle_path_buf));
}
#endif #endif
strlcat(home_dir_buf, "/RetroArch", sizeof(home_dir_buf)); strlcat(home_dir_buf, "/RetroArch", sizeof(home_dir_buf));

View file

@ -15,8 +15,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <retro_assert.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "../../config.h" #include "../../config.h"
#endif #endif

View file

@ -179,7 +179,6 @@ d3d10_get_closest_match(D3D10Device device,
break; break;
format++; format++;
} }
assert(*format);
return *format; return *format;
} }

View file

@ -200,7 +200,6 @@ d3d11_get_closest_match(D3D11Device device, DXGI_FORMAT desired_format, UINT des
break; break;
format++; format++;
} }
assert(*format);
return *format; return *format;
} }

View file

@ -25,7 +25,6 @@
#endif #endif
#include <d3d11.h> #include <d3d11.h>
#include <assert.h>
#include <boolean.h> #include <boolean.h>
#include <retro_math.h> #include <retro_math.h>
#include <gfx/math/matrix_4x4.h> #include <gfx/math/matrix_4x4.h>

View file

@ -143,10 +143,7 @@ HRESULT WINAPI D3D12SerializeVersionedRootSignature(
static void static void
d3d12_descriptor_heap_slot_free(d3d12_descriptor_heap_t* heap, D3D12_CPU_DESCRIPTOR_HANDLE handle) d3d12_descriptor_heap_slot_free(d3d12_descriptor_heap_t* heap, D3D12_CPU_DESCRIPTOR_HANDLE handle)
{ {
unsigned i = (handle.ptr - heap->cpu.ptr) / heap->stride; unsigned i = (handle.ptr - heap->cpu.ptr) / heap->stride;
assert(i >= 0 && i < heap->desc.NumDescriptors);
assert(heap->map[i]);
heap->map[i] = false; heap->map[i] = false;
if (heap->start > (int)i) if (heap->start > (int)i)
heap->start = i; heap->start = i;
@ -211,7 +208,6 @@ D3D12_CPU_DESCRIPTOR_HANDLE d3d12_descriptor_heap_slot_alloc(d3d12_descriptor_he
} }
} }
/* if you get here try increasing NumDescriptors for this heap */ /* if you get here try increasing NumDescriptors for this heap */
assert(0);
return handle; return handle;
} }
@ -233,7 +229,6 @@ static DXGI_FORMAT d3d12_get_closest_match(D3D12Device device, D3D12_FEATURE_DAT
break; break;
format++; format++;
} }
assert(*format);
return *format; return *format;
} }
@ -285,8 +280,6 @@ void d3d12_init_texture(D3D12Device device, d3d12_texture_t* texture)
D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, NULL, &texture->handle); D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, NULL, &texture->handle);
} }
assert(texture->srv_heap);
{ {
D3D12_SHADER_RESOURCE_VIEW_DESC desc = { texture->desc.Format }; D3D12_SHADER_RESOURCE_VIEW_DESC desc = { texture->desc.Format };
@ -316,7 +309,6 @@ void d3d12_init_texture(D3D12Device device, d3d12_texture_t* texture)
if (texture->desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET) if (texture->desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET)
{ {
assert(texture->rt_view.ptr);
D3D12CreateRenderTargetView(device, texture->handle, NULL, texture->rt_view); D3D12CreateRenderTargetView(device, texture->handle, NULL, texture->rt_view);
} }
else else

View file

@ -17,8 +17,6 @@
#include <string/stdstring.h> #include <string/stdstring.h>
#include <retro_environment.h> #include <retro_environment.h>
#include <assert.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "../../config.h" #include "../../config.h"
#endif #endif
@ -287,7 +285,6 @@ DXGI_FORMAT* dxgi_get_format_fallback_list(DXGI_FORMAT format)
break; \ break; \
} \ } \
default: \ default: \
assert(0); \
break; \ break; \
} \ } \
break; \ break; \
@ -323,7 +320,6 @@ void dxgi_copy(
FORMAT_SRC(DXGI_FORMAT_EX_A4R4G4B4_UNORM); FORMAT_SRC(DXGI_FORMAT_EX_A4R4G4B4_UNORM);
default: default:
assert(0);
break; break;
} }
} }

View file

@ -19,7 +19,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <retro_assert.h>
#include <string/stdstring.h> #include <string/stdstring.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H

View file

@ -29,7 +29,6 @@
#include <exynos/exynos_fimg2d.h> #include <exynos/exynos_fimg2d.h>
#include <retro_inline.h> #include <retro_inline.h>
#include <retro_assert.h>
#include <string/stdstring.h> #include <string/stdstring.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -267,7 +266,6 @@ static const char *exynos_buffer_name(enum exynos_buffer_type type)
case EXYNOS_BUFFER_AUX: case EXYNOS_BUFFER_AUX:
return "aux"; return "aux";
default: default:
retro_assert(false);
break; break;
} }

View file

@ -33,7 +33,6 @@
#include <retro_inline.h> #include <retro_inline.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include <retro_math.h> #include <retro_math.h>
#include <retro_assert.h>
#include <libretro.h> #include <libretro.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H

View file

@ -24,7 +24,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <ctype.h> #include <ctype.h>
#include <assert.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <linux/omapfb.h> #include <linux/omapfb.h>
@ -38,7 +37,6 @@
#endif #endif
#include <retro_inline.h> #include <retro_inline.h>
#include <retro_assert.h>
#include <gfx/scaler/scaler.h> #include <gfx/scaler/scaler.h>
#include <gfx/video_frame.h> #include <gfx/video_frame.h>
#include <string/stdstring.h> #include <string/stdstring.h>
@ -682,13 +680,9 @@ static void omapfb_prepare(omapfb_data_t *pdata)
/* issue flip before getting free page */ /* issue flip before getting free page */
omapfb_page_flip(pdata); omapfb_page_flip(pdata);
page = omapfb_get_page(pdata); page = omapfb_get_page(pdata);
pdata->old_page = pdata->cur_page;
retro_assert(page != NULL); pdata->cur_page = page;
pdata->old_page = pdata->cur_page;
pdata->cur_page = page;
pdata->cur_page->used = true; pdata->cur_page->used = true;
} }

View file

@ -21,7 +21,6 @@
#include <pspgum.h> #include <pspgum.h>
#include <psprtc.h> #include <psprtc.h>
#include <retro_assert.h>
#include <retro_inline.h> #include <retro_inline.h>
#include <retro_math.h> #include <retro_math.h>
@ -678,14 +677,6 @@ static void psp_set_texture_frame(void *data, const void *frame, bool rgb32,
{ {
psp1_video_t *psp = (psp1_video_t*)data; psp1_video_t *psp = (psp1_video_t*)data;
(void) rgb32;
(void) alpha;
#ifdef DEBUG
/* psp->menu.frame buffer size is (480 * 272)*2 Bytes */
retro_assert((width*height) < (480 * 272));
#endif
psp_set_screen_coords(psp->menu.frame_coords, 0, 0, psp_set_screen_coords(psp->menu.frame_coords, 0, 0,
SCEGU_SCR_WIDTH, SCEGU_SCR_HEIGHT, 0); SCEGU_SCR_WIDTH, SCEGU_SCR_HEIGHT, 0);
psp_set_tex_coords(psp->menu.frame_coords, width, height); psp_set_tex_coords(psp->menu.frame_coords, width, height);

View file

@ -22,9 +22,7 @@
#include <SDL/SDL.h> #include <SDL/SDL.h>
#include <SDL/SDL_video.h> #include <SDL/SDL_video.h>
#include <retro_assert.h>
#include <gfx/video_frame.h> #include <gfx/video_frame.h>
#include <retro_assert.h>
#include <string/stdstring.h> #include <string/stdstring.h>
#include <encodings/utf.h> #include <encodings/utf.h>
#include <features/features_cpu.h> #include <features/features_cpu.h>

View file

@ -18,10 +18,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <retro_assert.h>
#include <gfx/scaler/scaler.h> #include <gfx/scaler/scaler.h>
#include <gfx/video_frame.h> #include <gfx/video_frame.h>
#include <retro_assert.h>
#include "../../verbosity.h" #include "../../verbosity.h"
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -270,14 +268,12 @@ static void *sdl_gfx_init(const video_info_t *video,
return NULL; return NULL;
} }
vid = (sdl_video_t*)calloc(1, sizeof(*vid)); if (!(vid = (sdl_video_t*)calloc(1, sizeof(*vid))))
if (!vid)
return NULL; return NULL;
video_info = SDL_GetVideoInfo(); video_info = SDL_GetVideoInfo();
retro_assert(video_info); full_x = video_info->current_w;
full_x = video_info->current_w; full_y = video_info->current_h;
full_y = video_info->current_h;
RARCH_LOG("[SDL]: Detecting desktop resolution %ux%u.\n", full_x, full_y); RARCH_LOG("[SDL]: Detecting desktop resolution %ux%u.\n", full_x, full_y);
if (!video->fullscreen) if (!video->fullscreen)

View file

@ -23,9 +23,7 @@
#include <SDL/SDL.h> #include <SDL/SDL.h>
#include <SDL/SDL_video.h> #include <SDL/SDL_video.h>
#include <retro_assert.h>
#include <gfx/video_frame.h> #include <gfx/video_frame.h>
#include <retro_assert.h>
#include <string/stdstring.h> #include <string/stdstring.h>
#include <encodings/utf.h> #include <encodings/utf.h>
#include <features/features_cpu.h> #include <features/features_cpu.h>

View file

@ -24,7 +24,6 @@
#include <EGL/eglext.h> #include <EGL/eglext.h>
#include <retro_inline.h> #include <retro_inline.h>
#include <retro_assert.h>
#include <gfx/math/matrix_3x3.h> #include <gfx/math/matrix_3x3.h>
#include <libretro.h> #include <libretro.h>
@ -387,8 +386,6 @@ static void vg_copy_frame(void *data, const void *frame,
0, 0,
&img); &img);
retro_assert(img != EGL_NO_IMAGE_KHR);
if (new_egl) if (new_egl)
{ {
vgDestroyImage(vg->mImage); vgDestroyImage(vg->mImage);

View file

@ -25,7 +25,6 @@
#include <retro_inline.h> #include <retro_inline.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include <retro_math.h> #include <retro_math.h>
#include <retro_assert.h>
#include <string/stdstring.h> #include <string/stdstring.h>
#include <libretro.h> #include <libretro.h>
@ -65,8 +64,6 @@ static struct vk_descriptor_manager vulkan_create_descriptor_manager(
int i; int i;
struct vk_descriptor_manager manager; struct vk_descriptor_manager manager;
retro_assert(num_sizes <= VULKAN_MAX_DESCRIPTOR_POOL_SIZES);
manager.current = NULL; manager.current = NULL;
manager.count = 0; manager.count = 0;
@ -80,7 +77,6 @@ static struct vk_descriptor_manager vulkan_create_descriptor_manager(
manager.num_sizes = num_sizes; manager.num_sizes = num_sizes;
manager.head = vulkan_alloc_descriptor_pool(device, &manager); manager.head = vulkan_alloc_descriptor_pool(device, &manager);
retro_assert(manager.head);
return manager; return manager;
} }
@ -580,7 +576,6 @@ static void vulkan_init_pipelines(vk_t *vk)
break; break;
default: default:
retro_assert(0 && "No shader for menu pipeline.");
break; break;
} }
@ -617,7 +612,6 @@ static void vulkan_init_pipelines(vk_t *vk)
break; break;
default: default:
retro_assert(0 && "No shader for menu pipeline.");
break; break;
} }
@ -1226,11 +1220,8 @@ static void vulkan_set_image(void *handle,
VkSemaphore *new_semaphores = (VkSemaphore*)realloc(vk->hw.semaphores, VkSemaphore *new_semaphores = (VkSemaphore*)realloc(vk->hw.semaphores,
sizeof(VkSemaphore) * (vk->hw.num_semaphores + 1)); sizeof(VkSemaphore) * (vk->hw.num_semaphores + 1));
/* If this fails, we're screwed anyways. */
retro_assert(stage_flags && new_semaphores);
vk->hw.wait_dst_stages = stage_flags; vk->hw.wait_dst_stages = stage_flags;
vk->hw.semaphores = new_semaphores; vk->hw.semaphores = new_semaphores;
for (i = 0; i < (int) vk->hw.num_semaphores; i++) for (i = 0; i < (int) vk->hw.num_semaphores; i++)
{ {
@ -1245,7 +1236,6 @@ static void vulkan_set_image(void *handle,
static void vulkan_wait_sync_index(void *handle) static void vulkan_wait_sync_index(void *handle)
{ {
(void)handle;
/* no-op. RetroArch already waits for this /* no-op. RetroArch already waits for this
* in gfx_ctx_swap_buffers(). */ * in gfx_ctx_swap_buffers(). */
} }
@ -1261,29 +1251,26 @@ static void vulkan_set_command_buffers(void *handle, uint32_t num_cmd,
realloc(vk->hw.cmd, realloc(vk->hw.cmd,
sizeof(VkCommandBuffer) * required_capacity); sizeof(VkCommandBuffer) * required_capacity);
/* If this fails, we're just screwed. */ vk->hw.cmd = hw_cmd;
retro_assert(hw_cmd); vk->hw.capacity_cmd = required_capacity;
vk->hw.cmd = hw_cmd;
vk->hw.capacity_cmd = required_capacity;
} }
vk->hw.num_cmd = num_cmd; vk->hw.num_cmd = num_cmd;
memcpy(vk->hw.cmd, cmd, sizeof(VkCommandBuffer) * num_cmd); memcpy(vk->hw.cmd, cmd, sizeof(VkCommandBuffer) * num_cmd);
} }
static void vulkan_lock_queue(void *handle) static void vulkan_lock_queue(void *handle)
{ {
vk_t *vk = (vk_t*)handle;
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
vk_t *vk = (vk_t*)handle;
slock_lock(vk->context->queue_lock); slock_lock(vk->context->queue_lock);
#endif #endif
} }
static void vulkan_unlock_queue(void *handle) static void vulkan_unlock_queue(void *handle)
{ {
vk_t *vk = (vk_t*)handle;
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
vk_t *vk = (vk_t*)handle;
slock_unlock(vk->context->queue_lock); slock_unlock(vk->context->queue_lock);
#endif #endif
} }
@ -1304,26 +1291,26 @@ static void vulkan_init_hw_render(vk_t *vk)
if (hwr->context_type != RETRO_HW_CONTEXT_VULKAN) if (hwr->context_type != RETRO_HW_CONTEXT_VULKAN)
return; return;
vk->flags |= VK_FLAG_HW_ENABLE; vk->flags |= VK_FLAG_HW_ENABLE;
iface->interface_type = RETRO_HW_RENDER_INTERFACE_VULKAN; iface->interface_type = RETRO_HW_RENDER_INTERFACE_VULKAN;
iface->interface_version = RETRO_HW_RENDER_INTERFACE_VULKAN_VERSION; iface->interface_version = RETRO_HW_RENDER_INTERFACE_VULKAN_VERSION;
iface->instance = vk->context->instance; iface->instance = vk->context->instance;
iface->gpu = vk->context->gpu; iface->gpu = vk->context->gpu;
iface->device = vk->context->device; iface->device = vk->context->device;
iface->queue = vk->context->queue; iface->queue = vk->context->queue;
iface->queue_index = vk->context->graphics_queue_index; iface->queue_index = vk->context->graphics_queue_index;
iface->handle = vk; iface->handle = vk;
iface->set_image = vulkan_set_image; iface->set_image = vulkan_set_image;
iface->get_sync_index = vulkan_get_sync_index; iface->get_sync_index = vulkan_get_sync_index;
iface->get_sync_index_mask = vulkan_get_sync_index_mask; iface->get_sync_index_mask = vulkan_get_sync_index_mask;
iface->wait_sync_index = vulkan_wait_sync_index; iface->wait_sync_index = vulkan_wait_sync_index;
iface->set_command_buffers = vulkan_set_command_buffers; iface->set_command_buffers = vulkan_set_command_buffers;
iface->lock_queue = vulkan_lock_queue; iface->lock_queue = vulkan_lock_queue;
iface->unlock_queue = vulkan_unlock_queue; iface->unlock_queue = vulkan_unlock_queue;
iface->set_signal_semaphore = vulkan_set_signal_semaphore; iface->set_signal_semaphore = vulkan_set_signal_semaphore;
iface->get_device_proc_addr = vkGetDeviceProcAddr; iface->get_device_proc_addr = vkGetDeviceProcAddr;
iface->get_instance_proc_addr = vulkan_symbol_wrapper_instance_proc_addr(); iface->get_instance_proc_addr = vulkan_symbol_wrapper_instance_proc_addr();
@ -2058,7 +2045,6 @@ static void vulkan_inject_black_frame(vk_t *vk, video_frame_info_t *video_info)
static const VkPipelineStageFlags wait_stage = static const VkPipelineStageFlags wait_stage =
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
assert(!vk->context->swapchain_wait_semaphores[frame_index]);
vk->context->swapchain_wait_semaphores[frame_index] = vk->context->swapchain_wait_semaphores[frame_index] =
vk->context->swapchain_acquire_semaphore; vk->context->swapchain_acquire_semaphore;
vk->context->swapchain_acquire_semaphore = VK_NULL_HANDLE; vk->context->swapchain_acquire_semaphore = VK_NULL_HANDLE;
@ -2169,8 +2155,6 @@ static bool vulkan_frame(void *data, const void *frame,
vk->hw.src_queue_family != VK_QUEUE_FAMILY_IGNORED && vk->hw.src_queue_family != VK_QUEUE_FAMILY_IGNORED &&
vk->hw.src_queue_family != vk->context->graphics_queue_index) vk->hw.src_queue_family != vk->context->graphics_queue_index)
{ {
retro_assert(vk->hw.image);
/* Acquire ownership of image from other queue family. */ /* Acquire ownership of image from other queue family. */
VULKAN_TRANSFER_IMAGE_OWNERSHIP(vk->cmd, VULKAN_TRANSFER_IMAGE_OWNERSHIP(vk->cmd,
vk->hw.image->create_info.image, vk->hw.image->create_info.image,
@ -2659,8 +2643,6 @@ static bool vulkan_frame(void *data, const void *frame,
vk->hw.src_queue_family != VK_QUEUE_FAMILY_IGNORED && vk->hw.src_queue_family != VK_QUEUE_FAMILY_IGNORED &&
vk->hw.src_queue_family != vk->context->graphics_queue_index) vk->hw.src_queue_family != vk->context->graphics_queue_index)
{ {
retro_assert(vk->hw.image);
/* Release ownership of image back to other queue family. */ /* Release ownership of image back to other queue family. */
VULKAN_TRANSFER_IMAGE_OWNERSHIP(vk->cmd, VULKAN_TRANSFER_IMAGE_OWNERSHIP(vk->cmd,
vk->hw.image->create_info.image, vk->hw.image->create_info.image,
@ -2705,12 +2687,11 @@ static bool vulkan_frame(void *data, const void *frame,
if ( (vk->context->flags & VK_CTX_FLAG_HAS_ACQUIRED_SWAPCHAIN) if ( (vk->context->flags & VK_CTX_FLAG_HAS_ACQUIRED_SWAPCHAIN)
&& (vk->context->swapchain_acquire_semaphore != VK_NULL_HANDLE)) && (vk->context->swapchain_acquire_semaphore != VK_NULL_HANDLE))
{ {
assert(!vk->context->swapchain_wait_semaphores[frame_index]); vk->context->swapchain_wait_semaphores[frame_index] =
vk->context->swapchain_wait_semaphores[frame_index] =
vk->context->swapchain_acquire_semaphore; vk->context->swapchain_acquire_semaphore;
vk->context->swapchain_acquire_semaphore = VK_NULL_HANDLE; vk->context->swapchain_acquire_semaphore = VK_NULL_HANDLE;
vk->hw.semaphores[submit_info.waitSemaphoreCount] = vk->context->swapchain_wait_semaphores[frame_index]; vk->hw.semaphores[submit_info.waitSemaphoreCount] = vk->context->swapchain_wait_semaphores[frame_index];
vk->hw.wait_dst_stages[submit_info.waitSemaphoreCount] = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; vk->hw.wait_dst_stages[submit_info.waitSemaphoreCount] = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
submit_info.waitSemaphoreCount++; submit_info.waitSemaphoreCount++;
} }
@ -2718,13 +2699,12 @@ static bool vulkan_frame(void *data, const void *frame,
else if ((vk->context->flags & VK_CTX_FLAG_HAS_ACQUIRED_SWAPCHAIN) else if ((vk->context->flags & VK_CTX_FLAG_HAS_ACQUIRED_SWAPCHAIN)
&& (vk->context->swapchain_acquire_semaphore != VK_NULL_HANDLE)) && (vk->context->swapchain_acquire_semaphore != VK_NULL_HANDLE))
{ {
static const VkPipelineStageFlags wait_stage = static const VkPipelineStageFlags wait_stage =
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
assert(!vk->context->swapchain_wait_semaphores[frame_index]);
vk->context->swapchain_wait_semaphores[frame_index] = vk->context->swapchain_wait_semaphores[frame_index] =
vk->context->swapchain_acquire_semaphore; vk->context->swapchain_acquire_semaphore;
vk->context->swapchain_acquire_semaphore = VK_NULL_HANDLE; vk->context->swapchain_acquire_semaphore = VK_NULL_HANDLE;
submit_info.waitSemaphoreCount = 1; submit_info.waitSemaphoreCount = 1;
submit_info.pWaitSemaphores = &vk->context->swapchain_wait_semaphores[frame_index]; submit_info.pWaitSemaphores = &vk->context->swapchain_wait_semaphores[frame_index];

View file

@ -32,7 +32,6 @@
#include <GLKit/GLKit.h> #include <GLKit/GLKit.h>
#endif #endif
#include <retro_assert.h>
#include <retro_timers.h> #include <retro_timers.h>
#include <compat/apple_compat.h> #include <compat/apple_compat.h>
#include <string/stdstring.h> #include <string/stdstring.h>

View file

@ -27,7 +27,6 @@
#include <AppKit/NSScreen.h> #include <AppKit/NSScreen.h>
#endif #endif
#include <retro_assert.h>
#include <retro_timers.h> #include <retro_timers.h>
#include <compat/apple_compat.h> #include <compat/apple_compat.h>
#include <string/stdstring.h> #include <string/stdstring.h>

View file

@ -26,7 +26,6 @@
#include <compat/posix_string.h> #include <compat/posix_string.h>
#include <file/config_file.h> #include <file/config_file.h>
#include <file/file_path.h> #include <file/file_path.h>
#include <retro_assert.h>
#include <string/stdstring.h> #include <string/stdstring.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -234,12 +233,8 @@ static void cg_error_handler(CGcontext ctx, CGerror error, void *data)
static void gl_cg_reset_attrib(void *data) static void gl_cg_reset_attrib(void *data)
{ {
unsigned i; int i;
cg_shader_data_t *cg = (cg_shader_data_t*)data; cg_shader_data_t *cg = (cg_shader_data_t*)data;
/* Add sanity check that we did not overflow. */
retro_assert(cg->attribs_index <= ARRAY_SIZE(cg->attribs_elems));
for (i = 0; i < cg->attribs_index; i++) for (i = 0; i < cg->attribs_index; i++)
cgGLDisableClientState(cg->attribs_elems[i]); cgGLDisableClientState(cg->attribs_elems[i]);
cg->attribs_index = 0; cg->attribs_index = 0;

View file

@ -20,7 +20,6 @@
#include <compat/strl.h> #include <compat/strl.h>
#include <compat/posix_string.h> #include <compat/posix_string.h>
#include <file/file_path.h> #include <file/file_path.h>
#include <retro_assert.h>
#include <streams/file_stream.h> #include <streams/file_stream.h>
#include <string/stdstring.h> #include <string/stdstring.h>
@ -615,10 +614,6 @@ static bool gl_glsl_compile_programs(
static void gl_glsl_reset_attrib(glsl_shader_data_t *glsl) static void gl_glsl_reset_attrib(glsl_shader_data_t *glsl)
{ {
unsigned i; unsigned i;
/* Add sanity check that we did not overflow. */
retro_assert(glsl->attribs_index <= ARRAY_SIZE(glsl->attribs_elems));
for (i = 0; i < glsl->attribs_index; i++) for (i = 0; i < glsl->attribs_index; i++)
glDisableVertexAttribArray(glsl->attribs_elems[i]); glDisableVertexAttribArray(glsl->attribs_elems[i]);
glsl->attribs_index = 0; glsl->attribs_index = 0;
@ -631,8 +626,7 @@ static void gl_glsl_set_vbo(GLfloat **buffer, size_t *buffer_elems,
{ {
GLfloat *new_buffer = (GLfloat*) GLfloat *new_buffer = (GLfloat*)
realloc(*buffer, elems * sizeof(GLfloat)); realloc(*buffer, elems * sizeof(GLfloat));
retro_assert(new_buffer); *buffer = new_buffer;
*buffer = new_buffer;
} }
memcpy(*buffer, data, elems * sizeof(GLfloat)); memcpy(*buffer, data, elems * sizeof(GLfloat));

View file

@ -17,7 +17,6 @@
#include <math.h> #include <math.h>
#include <string/stdstring.h> #include <string/stdstring.h>
#include <retro_math.h> #include <retro_math.h>
#include <retro_assert.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "../config.h" #include "../config.h"
@ -1986,11 +1985,9 @@ void video_driver_lock_new(void)
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
if (!video_st->display_lock) if (!video_st->display_lock)
video_st->display_lock = slock_new(); video_st->display_lock = slock_new();
retro_assert(video_st->display_lock);
if (!video_st->context_lock) if (!video_st->context_lock)
video_st->context_lock = slock_new(); video_st->context_lock = slock_new();
retro_assert(video_st->context_lock);
#endif #endif
} }

View file

@ -4,7 +4,6 @@
/* Common implementation of NTSC filters */ /* Common implementation of NTSC filters */
#include <retro_assert.h>
#include <math.h> #include <math.h>
/* Copyright (C) 2006 Shay Green. This module is free software; you /* Copyright (C) 2006 Shay Green. This module is free software; you
@ -119,9 +118,8 @@ static void init_filters( init_t* impl, snes_ntsc_setup_t const* setup )
sum = 1.0f / sum; sum = 1.0f / sum;
for ( i = 0; i < kernel_half * 2 + 1; i++ ) for ( i = 0; i < kernel_half * 2 + 1; i++ )
{ {
int x = kernel_size * 3 / 2 - kernel_half + i; int x = kernel_size * 3 / 2 - kernel_half + i;
kernels [x] *= sum; kernels [x] *= sum;
retro_assert( kernels [x] == kernels [x] ); /* catch numerical instability */
} }
} }
@ -147,17 +145,14 @@ static void init_filters( init_t* impl, snes_ntsc_setup_t const* setup )
/* normalize even and odd phases separately */ /* normalize even and odd phases separately */
for ( i = 0; i < 2; i++ ) for ( i = 0; i < 2; i++ )
{ {
float sum = 0;
int x; int x;
float sum = 0;
for ( x = i; x < kernel_size; x += 2 ) for ( x = i; x < kernel_size; x += 2 )
sum += kernels [x]; sum += kernels [x];
sum = 1.0f / sum; sum = 1.0f / sum;
for ( x = i; x < kernel_size; x += 2 ) for ( x = i; x < kernel_size; x += 2 )
{
kernels [x] *= sum; kernels [x] *= sum;
retro_assert( kernels [x] == kernels [x] ); /* catch numerical instability */
}
} }
} }

View file

@ -19,7 +19,6 @@
#include <string.h> #include <string.h>
#include <boolean.h> #include <boolean.h>
#include <retro_assert.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include <encodings/crc32.h> #include <encodings/crc32.h>
#include <encodings/utf.h> #include <encodings/utf.h>
@ -205,12 +204,8 @@ static void rwebinput_generate_lut(void)
int i; int i;
struct rarch_key_map *key_map; struct rarch_key_map *key_map;
retro_assert(ARRAY_SIZE(rarch_key_map_rwebinput) ==
ARRAY_SIZE(rwebinput_key_to_code_map) + 1);
for (i = 0; i < ARRAY_SIZE(rwebinput_key_to_code_map); i++) for (i = 0; i < ARRAY_SIZE(rwebinput_key_to_code_map); i++)
{ {
int j;
uint32_t crc; uint32_t crc;
const rwebinput_key_to_code_map_entry_t *key_to_code = const rwebinput_key_to_code_map_entry_t *key_to_code =
&rwebinput_key_to_code_map[i]; &rwebinput_key_to_code_map[i];
@ -218,10 +213,6 @@ static void rwebinput_generate_lut(void)
crc = encoding_crc32(0, (const uint8_t *)key_to_code->key, crc = encoding_crc32(0, (const uint8_t *)key_to_code->key,
strlen(key_to_code->key)); strlen(key_to_code->key));
/* sanity check: make sure there's no collisions */
for (j = 0; j < i; j++)
retro_assert(rarch_key_map_rwebinput[j].sym != crc);
key_map->rk = key_to_code->rk; key_map->rk = key_to_code->rk;
key_map->sym = crc; key_map->sym = crc;
} }
@ -246,7 +237,6 @@ static EM_BOOL rwebinput_keyboard_cb(int event_type,
size_t new_max = MAX(1, rwebinput->keyboard.max_size << 1); size_t new_max = MAX(1, rwebinput->keyboard.max_size << 1);
rwebinput->keyboard.events = realloc(rwebinput->keyboard.events, rwebinput->keyboard.events = realloc(rwebinput->keyboard.events,
new_max * sizeof(rwebinput->keyboard.events[0])); new_max * sizeof(rwebinput->keyboard.events[0]));
retro_assert(rwebinput->keyboard.events != NULL);
rwebinput->keyboard.max_size = new_max; rwebinput->keyboard.max_size = new_max;
} }

View file

@ -23,7 +23,6 @@
#include <string/stdstring.h> #include <string/stdstring.h>
#include <encodings/utf.h> #include <encodings/utf.h>
#include <clamping.h> #include <clamping.h>
#include <retro_assert.h>
#include "input_driver.h" #include "input_driver.h"
#include "input_keymaps.h" #include "input_keymaps.h"
@ -560,8 +559,6 @@ bool input_driver_button_combo(
retro_time_t current_time, retro_time_t current_time,
input_bits_t* p_input) input_bits_t* p_input)
{ {
retro_assert(p_input != NULL);
switch (mode) switch (mode)
{ {
case INPUT_COMBO_DOWN_Y_L_R: case INPUT_COMBO_DOWN_Y_L_R:
@ -3290,9 +3287,6 @@ void input_config_reset(void)
unsigned i; unsigned i;
input_driver_state_t *input_st = &input_driver_st; input_driver_state_t *input_st = &input_driver_st;
retro_assert(sizeof(input_config_binds[0]) >= sizeof(retro_keybinds_1));
retro_assert(sizeof(input_config_binds[1]) >= sizeof(retro_keybinds_rest));
memcpy(input_config_binds[0], retro_keybinds_1, sizeof(retro_keybinds_1)); memcpy(input_config_binds[0], retro_keybinds_1, sizeof(retro_keybinds_1));
for (i = 1; i < MAX_USERS; i++) for (i = 1; i < MAX_USERS; i++)

View file

@ -20,7 +20,6 @@
#include <ctype.h> #include <ctype.h>
#include <compat/strl.h> #include <compat/strl.h>
#include <retro_assert.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -2039,7 +2038,6 @@ void input_keymaps_translate_rk_to_str(enum retro_key key, char *buf, size_t siz
{ {
unsigned i; unsigned i;
retro_assert(size >= 2);
*buf = '\0'; *buf = '\0';
if (key >= RETROK_a && key <= RETROK_z) if (key >= RETROK_a && key <= RETROK_z)

View file

@ -35,8 +35,6 @@
#include <compat/strcasestr.h> #include <compat/strcasestr.h>
#include <compat/posix_string.h> #include <compat/posix_string.h>
#include <retro_assert.h>
char *optarg; char *optarg;
int optind, opterr, optopt; int optind, opterr, optopt;
@ -184,8 +182,6 @@ static void shuffle_block(char **begin, char **last, char **end)
ptrdiff_t len = last - begin; ptrdiff_t len = last - begin;
const char **tmp = (const char**)calloc(len, sizeof(const char*)); const char **tmp = (const char**)calloc(len, sizeof(const char*));
retro_assert(tmp);
memcpy((void*)tmp, begin, len * sizeof(const char*)); memcpy((void*)tmp, begin, len * sizeof(const char*));
memmove(begin, last, (end - last) * sizeof(const char*)); memmove(begin, last, (end - last) * sizeof(const char*));
memcpy(end - len, tmp, len * sizeof(const char*)); memcpy(end - len, tmp, len * sizeof(const char*));
@ -198,8 +194,6 @@ int getopt_long(int argc, char *argv[],
{ {
int short_index, long_index; int short_index, long_index;
(void)longindex;
if (optind == 0) if (optind == 0)
optind = 1; optind = 1;
@ -227,8 +221,6 @@ int getopt_long(int argc, char *argv[],
long_index = 0; long_index = 0;
} }
retro_assert(short_index == 0 || long_index == 0);
if (short_index == 0) if (short_index == 0)
return parse_short(optstring, &argv[optind]); return parse_short(optstring, &argv[optind]);
if (long_index == 0) if (long_index == 0)

View file

@ -29,7 +29,6 @@
#include <boolean.h> #include <boolean.h>
#include <file/file_path.h> #include <file/file_path.h>
#include <retro_assert.h>
#include <compat/strl.h> #include <compat/strl.h>
#include <compat/posix_string.h> #include <compat/posix_string.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>

View file

@ -28,7 +28,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <retro_assert.h>
#include <retro_inline.h> #include <retro_inline.h>
#include <boolean.h> #include <boolean.h>
#include <formats/image.h> #include <formats/image.h>
@ -412,7 +411,6 @@ static INLINE int rjpeg_jpeg_huff_decode(rjpeg_jpeg *j, rjpeg_huffman *h)
/* convert the huffman code to the symbol id */ /* convert the huffman code to the symbol id */
c = ((j->code_buffer >> (32 - k)) & rjpeg_bmask[k]) + h->delta[k]; c = ((j->code_buffer >> (32 - k)) & rjpeg_bmask[k]) + h->delta[k];
retro_assert((((j->code_buffer) >> (32 - h->size[c])) & rjpeg_bmask[h->size[c]]) == h->code[c]);
/* convert the id to a symbol */ /* convert the id to a symbol */
j->code_bits -= k; j->code_bits -= k;
@ -432,9 +430,8 @@ static INLINE int rjpeg_extend_receive(rjpeg_jpeg *j, int n)
if (j->code_bits < n) if (j->code_bits < n)
rjpeg_grow_buffer_unsafe(j); rjpeg_grow_buffer_unsafe(j);
sgn = (int32_t)j->code_buffer >> 31; /* sign bit is always in MSB */ sgn = (int32_t)j->code_buffer >> 31; /* sign bit is always in MSB */
k = RJPEG_LROT(j->code_buffer, n); k = RJPEG_LROT(j->code_buffer, n);
retro_assert(n >= 0 && n < (int) (sizeof(rjpeg_bmask)/sizeof(*rjpeg_bmask)));
j->code_buffer = k & ~rjpeg_bmask[n]; j->code_buffer = k & ~rjpeg_bmask[n];
k &= rjpeg_bmask[n]; k &= rjpeg_bmask[n];
j->code_bits -= n; j->code_bits -= n;

View file

@ -29,7 +29,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <retro_assert.h>
#include <retro_inline.h> #include <retro_inline.h>
#include <formats/image.h> #include <formats/image.h>

View file

@ -22,7 +22,6 @@
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
#include <rthreads/rthreads.h> #include <rthreads/rthreads.h>
#include <retro_assert.h>
#include <stdlib.h> #include <stdlib.h>
#endif #endif
@ -41,8 +40,6 @@ void rtime_init(void)
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
if (!rtime_localtime_lock) if (!rtime_localtime_lock)
rtime_localtime_lock = slock_new(); rtime_localtime_lock = slock_new();
retro_assert(rtime_localtime_lock);
#endif #endif
} }

View file

@ -48,7 +48,6 @@
#include <encodings/utf.h> #include <encodings/utf.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include <file/file_path.h> #include <file/file_path.h>
#include <retro_assert.h>
#include <string/stdstring.h> #include <string/stdstring.h>
#include <retro_environment.h> #include <retro_environment.h>
#include <uwp/uwp_async.h> #include <uwp/uwp_async.h>

View file

@ -18,7 +18,6 @@
#include <compat/strl.h> #include <compat/strl.h>
#include <array/rbuf.h> #include <array/rbuf.h>
#include <file/file_path.h> #include <file/file_path.h>
#include <retro_assert.h>
#include <string/stdstring.h> #include <string/stdstring.h>
#include <streams/file_stream.h> #include <streams/file_stream.h>
#include <lists/string_list.h> #include <lists/string_list.h>
@ -5967,8 +5966,6 @@ static int action_ok_open_uwp_permission_settings(const char *path,
{ {
#ifdef __WINRT__ #ifdef __WINRT__
uwp_open_broadfilesystemaccess_settings(); uwp_open_broadfilesystemaccess_settings();
#else
retro_assert(false);
#endif #endif
return 0; return 0;
} }
@ -5976,11 +5973,8 @@ static int action_ok_open_uwp_permission_settings(const char *path,
static int action_ok_open_picker(const char *path, static int action_ok_open_picker(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx) const char *label, unsigned type, size_t idx, size_t entry_idx)
{ {
int ret;
char *new_path = NULL; char *new_path = NULL;
retro_assert(false); int ret = generic_action_ok_displaylist_push(path, new_path,
ret = generic_action_ok_displaylist_push(path, new_path,
msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES), msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES),
MENU_SETTING_ACTION_FAVORITES_DIR, idx, MENU_SETTING_ACTION_FAVORITES_DIR, idx,
entry_idx, ACTION_OK_DL_CONTENT_LIST); entry_idx, ACTION_OK_DL_CONTENT_LIST);

View file

@ -20,7 +20,6 @@
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
#include <rthreads/rthreads.h> #include <rthreads/rthreads.h>
#include <retro_assert.h>
#include <stdlib.h> #include <stdlib.h>
#endif #endif
@ -207,13 +206,8 @@ void play_feature_delivery_init(void)
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
if (!state->enabled_lock) if (!state->enabled_lock)
state->enabled_lock = slock_new(); state->enabled_lock = slock_new();
retro_assert(state->enabled_lock);
if (!state->status_lock) if (!state->status_lock)
state->status_lock = slock_new(); state->status_lock = slock_new();
retro_assert(state->status_lock);
#endif #endif
/* Note: Would like to cache whether this /* Note: Would like to cache whether this

View file

@ -15,14 +15,12 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <libretro.h> #include <libretro.h>
#include <boolean.h> #include <boolean.h>
#include <retro_assert.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include <compat/posix_string.h> #include <compat/posix_string.h>
#include <string/stdstring.h> #include <string/stdstring.h>
@ -2127,8 +2125,6 @@ static bool JSONEndArrayHandler(void *context)
{ {
JSONContext *pCtx = (JSONContext *)context; JSONContext *pCtx = (JSONContext *)context;
retro_assert(pCtx->array_depth > 0);
pCtx->array_depth--; pCtx->array_depth--;
if (pCtx->in_items && pCtx->array_depth == 0 && pCtx->object_depth <= 1) if (pCtx->in_items && pCtx->array_depth == 0 && pCtx->object_depth <= 1)
@ -2193,8 +2189,6 @@ static bool JSONEndObjectHandler(void *context)
RBUF_LEN(pCtx->playlist->entries) + 1); RBUF_LEN(pCtx->playlist->entries) + 1);
} }
retro_assert(pCtx->object_depth > 0);
pCtx->object_depth--; pCtx->object_depth--;
return true; return true;

View file

@ -19,7 +19,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <retro_assert.h>
#include <compat/msvc.h> #include <compat/msvc.h>
#include <compat/strl.h> #include <compat/strl.h>
@ -869,22 +868,18 @@ static void ffmpeg_thread(void *data);
static bool init_thread(ffmpeg_t *handle) static bool init_thread(ffmpeg_t *handle)
{ {
handle->lock = slock_new(); handle->lock = slock_new();
handle->cond_lock = slock_new(); handle->cond_lock = slock_new();
handle->cond = scond_new(); handle->cond = scond_new();
handle->audio_fifo = fifo_new(32000 * sizeof(int16_t) * handle->audio_fifo = fifo_new(32000 * sizeof(int16_t) *
handle->params.channels * MAX_FRAMES / 60); /* Some arbitrary max size. */ handle->params.channels * MAX_FRAMES / 60); /* Some arbitrary max size. */
handle->attr_fifo = fifo_new(sizeof(struct record_video_data) * MAX_FRAMES); handle->attr_fifo = fifo_new(sizeof(struct record_video_data) * MAX_FRAMES);
handle->video_fifo = fifo_new(handle->params.fb_width * handle->params.fb_height * handle->video_fifo = fifo_new(handle->params.fb_width * handle->params.fb_height *
handle->video.pix_size * MAX_FRAMES); handle->video.pix_size * MAX_FRAMES);
handle->alive = true; handle->alive = true;
handle->can_sleep = true; handle->can_sleep = true;
handle->thread = sthread_create(ffmpeg_thread, handle); handle->thread = sthread_create(ffmpeg_thread, handle);
retro_assert(handle->lock && handle->cond_lock &&
handle->cond && handle->audio_fifo &&
handle->attr_fifo && handle->video_fifo && handle->thread);
return true; return true;
} }
@ -1643,19 +1638,14 @@ static bool ffmpeg_finalize(void *data)
static void ffmpeg_thread(void *data) static void ffmpeg_thread(void *data)
{ {
size_t audio_buf_size; ffmpeg_t *ff = (ffmpeg_t*)data;
void *audio_buf = NULL;
ffmpeg_t *ff = (ffmpeg_t*)data;
/* For some reason, FFmpeg has a tendency to crash /* For some reason, FFmpeg has a tendency to crash
* if we don't overallocate a bit. */ * if we don't overallocate a bit. */
void *video_buf = av_malloc(2 * ff->params.fb_width * void *video_buf = av_malloc(2 * ff->params.fb_width *
ff->params.fb_height * ff->video.pix_size); ff->params.fb_height * ff->video.pix_size);
size_t audio_buf_size = ff->config.audio_enable ?
retro_assert(video_buf);
audio_buf_size = ff->config.audio_enable ?
(ff->audio.codec->frame_size * ff->params.channels * sizeof(int16_t)) : 0; (ff->audio.codec->frame_size * ff->params.channels * sizeof(int16_t)) : 0;
audio_buf = audio_buf_size ? av_malloc(audio_buf_size) : NULL; void *audio_buf = audio_buf_size ? av_malloc(audio_buf_size) : NULL;
while (ff->alive) while (ff->alive)
{ {

View file

@ -81,7 +81,6 @@
#include <compat/getopt.h> #include <compat/getopt.h>
#include <compat/posix_string.h> #include <compat/posix_string.h>
#include <file/file_path.h> #include <file/file_path.h>
#include <retro_assert.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include <lists/dir_list.h> #include <lists/dir_list.h>
@ -5861,7 +5860,6 @@ void retroarch_fail(int error_code, const char *error)
/* We cannot longjmp unless we're in retroarch_main_init(). /* We cannot longjmp unless we're in retroarch_main_init().
* If not, something went very wrong, and we should * If not, something went very wrong, and we should
* just exit right away. */ * just exit right away. */
retro_assert(global->error_on_init);
strlcpy(global->error_string, strlcpy(global->error_string,
error, sizeof(global->error_string)); error, sizeof(global->error_string));
longjmp(global->error_sjlj_context, error_code); longjmp(global->error_sjlj_context, error_code);

View file

@ -84,7 +84,6 @@
#include <compat/posix_string.h> #include <compat/posix_string.h>
#include <streams/file_stream.h> #include <streams/file_stream.h>
#include <file/file_path.h> #include <file/file_path.h>
#include <retro_assert.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include <queues/message_queue.h> #include <queues/message_queue.h>
#include <lists/dir_list.h> #include <lists/dir_list.h>
@ -3486,7 +3485,6 @@ static bool init_libretro_symbols(
/* for a secondary core, we already have a /* for a secondary core, we already have a
* primary library loaded, so we can skip * primary library loaded, so we can skip
* some checks and just load the library */ * some checks and just load the library */
retro_assert(lib_path != NULL && lib_handle_p != NULL);
lib_handle_local = dylib_load(lib_path); lib_handle_local = dylib_load(lib_path);
if (!lib_handle_local) if (!lib_handle_local)
@ -8987,7 +8985,6 @@ void runloop_path_set_special(char **argv, unsigned num_content)
string_list_initialize(&subsystem_paths); string_list_initialize(&subsystem_paths);
runloop_st->subsystem_fullpaths = string_list_new(); runloop_st->subsystem_fullpaths = string_list_new();
retro_assert(runloop_st->subsystem_fullpaths);
attr.i = 0; attr.i = 0;

View file

@ -14,7 +14,6 @@
#include <string.h> #include <string.h>
#include <compat/strl.h> #include <compat/strl.h>
#include <retro_assert.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include <string/stdstring.h> #include <string/stdstring.h>

View file

@ -60,7 +60,6 @@
#include <array/rbuf.h> #include <array/rbuf.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include <retro_assert.h>
#ifdef HAVE_MENU #ifdef HAVE_MENU
#include "../menu/menu_driver.h" #include "../menu/menu_driver.h"
@ -1418,8 +1417,6 @@ static bool content_load(content_ctx_info_t *info,
malloc(sizeof(*wrap_args)))) malloc(sizeof(*wrap_args))))
return false; return false;
retro_assert(wrap_args);
wrap_args->argv = NULL; wrap_args->argv = NULL;
wrap_args->content_path = NULL; wrap_args->content_path = NULL;
wrap_args->sram_path = NULL; wrap_args->sram_path = NULL;

View file

@ -406,7 +406,6 @@ void* task_push_http_transfer_with_user_agent(const char *url, bool mute,
if (user_agent) if (user_agent)
net_http_connection_set_user_agent(conn, user_agent); net_http_connection_set_user_agent(conn, user_agent);
/* assert: task_push_http_transfer_generic will free conn on failure */
return task_push_http_transfer_generic(conn, url, mute, type, cb, user_data); return task_push_http_transfer_generic(conn, url, mute, type, cb, user_data);
} }
@ -425,7 +424,6 @@ void* task_push_http_transfer_with_headers(const char *url, bool mute,
if (headers) if (headers)
net_http_connection_set_headers(conn, headers); net_http_connection_set_headers(conn, headers);
/* assert: task_push_http_transfer_generic will free conn on failure */
return task_push_http_transfer_generic(conn, url, mute, type, cb, user_data); return task_push_http_transfer_generic(conn, url, mute, type, cb, user_data);
} }
@ -456,7 +454,6 @@ void* task_push_http_post_transfer_with_user_agent(const char *url,
if (user_agent) if (user_agent)
net_http_connection_set_user_agent(conn, user_agent); net_http_connection_set_user_agent(conn, user_agent);
/* assert: task_push_http_transfer_generic will free conn on failure */
return task_push_http_transfer_generic(conn, url, mute, type, cb, user_data); return task_push_http_transfer_generic(conn, url, mute, type, cb, user_data);
} }
@ -476,7 +473,6 @@ void* task_push_http_post_transfer_with_headers(const char *url,
if (headers) if (headers)
net_http_connection_set_headers(conn, headers); net_http_connection_set_headers(conn, headers);
/* assert: task_push_http_transfer_generic will free conn on failure */
return task_push_http_transfer_generic(conn, url, mute, type, cb, user_data); return task_push_http_transfer_generic(conn, url, mute, type, cb, user_data);
} }

View file

@ -26,7 +26,6 @@
#endif #endif
#include <compat/strl.h> #include <compat/strl.h>
#include <retro_assert.h>
#include <lists/string_list.h> #include <lists/string_list.h>
#include <streams/interface_stream.h> #include <streams/interface_stream.h>
#include <streams/file_stream.h> #include <streams/file_stream.h>
@ -2132,7 +2131,6 @@ void path_deinit_savefile(void)
void path_init_savefile_new(void) void path_init_savefile_new(void)
{ {
task_save_files = string_list_new(); task_save_files = string_list_new();
retro_assert(task_save_files);
} }
void *savefile_ptr_get(void) void *savefile_ptr_get(void)

View file

@ -15,7 +15,6 @@
#include <string.h> #include <string.h>
#include <compat/strl.h> #include <compat/strl.h>
#include <retro_assert.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include <string/stdstring.h> #include <string/stdstring.h>

View file

@ -17,8 +17,6 @@
#import <AvailabilityMacros.h> #import <AvailabilityMacros.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <retro_assert.h>
#include "cocoa_common.h" #include "cocoa_common.h"
#include "apple_platform.h" #include "apple_platform.h"
#include "../ui_cocoa.h" #include "../ui_cocoa.h"

View file

@ -53,7 +53,6 @@ extern "C" {
#include "../../config.h" #include "../../config.h"
#endif #endif
#include <retro_assert.h>
#include <retro_common_api.h> #include <retro_common_api.h>
#include <queues/task_queue.h> #include <queues/task_queue.h>
@ -182,7 +181,7 @@ class ThumbnailWidget : public QStackedWidget
public: public:
ThumbnailWidget(QWidget *parent = 0); ThumbnailWidget(QWidget *parent = 0);
ThumbnailWidget(ThumbnailType type, QWidget *parent = 0); ThumbnailWidget(ThumbnailType type, QWidget *parent = 0);
ThumbnailWidget(const ThumbnailWidget& other) { retro_assert(false && "DONT EVER USE THIS"); } ThumbnailWidget(const ThumbnailWidget& other) { /* DONT EVER USE THIS */ }
void setPixmap(const QPixmap &pixmap, bool acceptDrops); void setPixmap(const QPixmap &pixmap, bool acceptDrops);
signals: signals: