Try to reserve 'error' keyword for goto labels, use 'err' for

variables and arguments instead
This commit is contained in:
libretroadmin 2025-08-05 21:02:21 +02:00
parent 93bd70cd48
commit 8181583298
42 changed files with 441 additions and 460 deletions

View File

@ -752,7 +752,7 @@ static int database_cursor_iterate(libretrodb_cursor_t *cur,
static int database_cursor_open(libretrodb_t *db,
libretrodb_cursor_t *cur, const char *path, const char *query)
{
const char *error = NULL;
const char *err = NULL;
libretrodb_query_t *q = NULL;
if ((libretrodb_open(path, db, false)) != 0)
@ -760,32 +760,27 @@ static int database_cursor_open(libretrodb_t *db,
if (query)
q = (libretrodb_query_t*)libretrodb_query_compile(db, query,
strlen(query), &error);
strlen(query), &err);
if (error)
goto error;
if ((libretrodb_cursor_open(db, cur, q)) != 0)
goto error;
if (err || (libretrodb_cursor_open(db, cur, q)) != 0)
{
if (q)
libretrodb_query_free(q);
libretrodb_close(db);
return -1;
}
if (q)
libretrodb_query_free(q);
return 0;
error:
if (q)
libretrodb_query_free(q);
libretrodb_close(db);
return -1;
}
static bool type_is_prioritized(const char *path)
{
const char *ext = path_get_extension(path);
if (string_is_equal_noncase(ext, "cue"))
return true;
if (string_is_equal_noncase(ext, "gdi"))
if ( string_is_equal_noncase(ext, "cue")
|| string_is_equal_noncase(ext, "gdi"))
return true;
return false;
}
@ -983,7 +978,7 @@ database_info_list_t *database_info_list_new(
db_info.enhancement_hw = NULL;
db_info.elspa_rating = NULL;
db_info.esrb_rating = NULL;
db_info.bbfc_rating = NULL;
db_info.bbfc_rating = NULL;
db_info.sha1 = NULL;
db_info.md5 = NULL;
@ -1111,7 +1106,7 @@ void database_info_list_free(database_info_list_t *database_info_list)
info->enhancement_hw = NULL;
info->elspa_rating = NULL;
info->esrb_rating = NULL;
info->bbfc_rating = NULL;
info->bbfc_rating = NULL;
info->sha1 = NULL;
info->md5 = NULL;
}

View File

@ -333,7 +333,7 @@ bool disk_control_set_eject_state(
disk_control_interface_t *disk_control,
bool eject, bool verbosity)
{
bool error = false;
bool err = false;
char msg[128];
size_t _len;
@ -350,8 +350,8 @@ bool disk_control_set_eject_state(
sizeof(msg));
else
{
error = true;
_len = strlcpy(
err = true;
_len = strlcpy(
msg,
eject
? msg_hash_to_str(MSG_VIRTUAL_DISK_TRAY_EJECT)
@ -361,21 +361,21 @@ bool disk_control_set_eject_state(
if (_len > 0)
{
if (error)
if (err)
RARCH_ERR("[Disc] %s\n", msg);
else
RARCH_LOG("[Disc] %s\n", msg);
/* Errors should always be displayed */
if (verbosity || error)
if (verbosity || err)
runloop_msg_queue_push(
msg, _len, 1, error ? 180 : 60, true, NULL,
msg, _len, 1, err ? 180 : 60, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT,
error ? MESSAGE_QUEUE_CATEGORY_ERROR : MESSAGE_QUEUE_CATEGORY_INFO);
err ? MESSAGE_QUEUE_CATEGORY_ERROR : MESSAGE_QUEUE_CATEGORY_INFO);
}
#ifdef HAVE_CHEEVOS
if (!error && !eject)
if (!err && !eject)
{
if (disk_control->cb.get_image_index && disk_control->cb.get_image_path)
{
@ -388,7 +388,7 @@ bool disk_control_set_eject_state(
}
#endif
return !error;
return !err;
}
/**
@ -403,7 +403,7 @@ bool disk_control_set_index(
unsigned index, bool verbosity)
{
size_t _len;
bool error = false;
bool err = false;
unsigned num_images = 0;
unsigned msg_duration = 0;
char msg[128];
@ -426,31 +426,31 @@ bool disk_control_set_index(
num_images = disk_control->cb.get_num_images();
/* Perform 'set index' action */
error = !disk_control->cb.set_image_index(index);
err = !disk_control->cb.set_image_index(index);
/* Get log/notification message */
_len = disk_control_get_index_set_msg(
disk_control, num_images, index, !error,
disk_control, num_images, index, !err,
&msg_duration, msg, sizeof(msg));
/* Output log/notification message */
if (_len > 0)
{
if (error)
if (err)
RARCH_ERR("[Disc] %s\n", msg);
else
RARCH_LOG("[Disc] %s\n", msg);
/* Errors should always be displayed */
if (verbosity || error)
if (verbosity || err)
runloop_msg_queue_push(msg, _len, 1, msg_duration, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT,
error ? MESSAGE_QUEUE_CATEGORY_ERROR : MESSAGE_QUEUE_CATEGORY_INFO);
err ? MESSAGE_QUEUE_CATEGORY_ERROR : MESSAGE_QUEUE_CATEGORY_INFO);
}
/* If operation was successful, update disk
* index record (if enabled) */
if (!error && disk_control->record_enabled)
if (!err && disk_control->record_enabled)
{
if ( disk_control->cb.get_image_index
&& disk_control->cb.get_image_path)
@ -471,7 +471,7 @@ bool disk_control_set_index(
}
}
return !error;
return !err;
}
/**

View File

@ -252,10 +252,10 @@ static void frontend_ctr_exec(const char *path, bool should_load_game)
/* couldnt launch new core, but context
is corrupt so we have to quit */
{
char error[PATH_MAX + 32];
size_t _len = strlcpy(error, "Can't launch core: ", sizeof(error));
strlcpy(error + _len, path, sizeof(error) - _len);
error_and_quit(error);
char err[PATH_MAX + 32];
size_t _len = strlcpy(err, "Can't launch core: ", sizeof(err));
strlcpy(err + _len, path, sizeof(err) - _len);
error_and_quit(err);
}
}
}

View File

@ -217,17 +217,16 @@ bool d3d9_initialize_symbols(enum gfx_ctx_api api)
#endif
if (!D3D9Create)
goto error;
{
d3d9_deinitialize_symbols();
return false;
}
#ifdef HAVE_DYNAMIC_D3D
d3d9_dylib_initialized = true;
#endif
return true;
error:
d3d9_deinitialize_symbols();
return false;
}
void d3d9_deinitialize_symbols(void)
@ -414,7 +413,7 @@ bool d3d9x_compile_shader(
const char *pprofile,
unsigned flags,
void *ppshader,
void *pperrormsgs,
void *pp_err_msgs,
void *ppconstanttable)
{
#if defined(HAVE_D3DX)
@ -427,7 +426,7 @@ bool d3d9x_compile_shader(
(LPCSTR)pprofile,
(DWORD)flags,
(LPD3DXBUFFER*)ppshader,
(LPD3DXBUFFER*)pperrormsgs,
(LPD3DXBUFFER*)pp_err_msgs,
(LPD3DXCONSTANTTABLE*)ppconstanttable) >= 0);
#else
return false;
@ -442,7 +441,7 @@ bool d3d9x_compile_shader_from_file(
const char *pprofile,
unsigned flags,
void *ppshader,
void *pperrormsgs,
void *pp_err_msgs,
void *ppconstanttable)
{
#if defined(HAVE_D3DX)
@ -455,7 +454,7 @@ bool d3d9x_compile_shader_from_file(
(LPCSTR)pprofile,
(DWORD)flags,
(LPD3DXBUFFER*)ppshader,
(LPD3DXBUFFER*)pperrormsgs,
(LPD3DXBUFFER*)pp_err_msgs,
(LPD3DXCONSTANTTABLE*)ppconstanttable) >= 0)
return true;
#endif

View File

@ -181,7 +181,7 @@ bool d3d9x_compile_shader(
const char *pprofile,
unsigned flags,
void *ppshader,
void *pperrormsgs,
void *pp_err_msgs,
void *ppconstanttable);
bool d3d9x_compile_shader_from_file(
@ -192,7 +192,7 @@ bool d3d9x_compile_shader_from_file(
const char *pprofile,
unsigned flags,
void *ppshader,
void *pperrormsgs,
void *pp_err_msgs,
void *ppconstanttable);
void d3d9x_constant_table_set_float_array(LPDIRECT3DDEVICE9 dev,

View File

@ -188,9 +188,9 @@ bool egl_init_dll(void)
void egl_report_error(void)
{
EGLint error = _egl_get_error();
EGLint err = _egl_get_error();
const char *str = NULL;
switch (error)
switch (err)
{
case EGL_SUCCESS:
str = "EGL_SUCCESS";
@ -249,7 +249,7 @@ void egl_report_error(void)
break;
}
RARCH_ERR("[EGL] #0x%x, %s.\n", (unsigned)error, str);
RARCH_ERR("[EGL] #0x%x, %s.\n", (unsigned)err, str);
}
gfx_ctx_proc_t egl_get_proc_address(const char *symbol)

View File

@ -748,7 +748,7 @@ bool gfx_ctx_wl_init_common(
if (!wl->input.dpy)
{
RARCH_ERR("[Wayland] Failed to connect to Wayland server.\n");
goto error;
return false;
}
frontend_driver_install_signal_handler();
@ -760,19 +760,19 @@ bool gfx_ctx_wl_init_common(
if (!wl->compositor)
{
RARCH_ERR("[Wayland] Failed to create compositor.\n");
goto error;
return false;
}
if (!wl->shm)
{
RARCH_ERR("[Wayland] Failed to create shm.\n");
goto error;
return false;
}
if (!wl->xdg_shell)
{
RARCH_ERR("[Wayland] Failed to create shell.\n");
goto error;
return false;
}
if (!wl->idle_inhibit_manager)
@ -856,7 +856,7 @@ bool gfx_ctx_wl_init_common(
if (!wl->libdecor_frame)
{
RARCH_ERR("[Wayland] Failed to create libdecor frame.\n");
goto error;
return false;
}
if (wl->xdg_toplevel_icon_manager)
@ -878,7 +878,7 @@ bool gfx_ctx_wl_init_common(
if (wl->libdecor_dispatch(wl->libdecor_context, 0) < 0)
{
RARCH_ERR("[Wayland] libdecor failed to dispatch.\n");
goto error;
return false;
}
}
}
@ -964,9 +964,6 @@ bool gfx_ctx_wl_init_common(
flush_wayland_fd(&wl->input);
return true;
error:
return false;
}
bool gfx_ctx_wl_set_video_mode_common_size(gfx_ctx_wayland_data_t *wl,
@ -1157,10 +1154,10 @@ static void xdg_surface_handle_configure(void *data,
#endif
#ifdef HAVE_LIBDECOR_H
static void libdecor_handle_error(struct libdecor *context,
enum libdecor_error error, const char *message)
static void libdecor_handle_err(struct libdecor *context,
enum libdecor_error err, const char *message)
{
RARCH_ERR("[Wayland] libdecor Caught error (%d): %s.\n", error, message);
RARCH_ERR("[Wayland] libdecor Caught error (%d): %s.\n", err, message);
}
#endif
@ -1170,6 +1167,6 @@ const struct wl_buffer_listener shm_buffer_listener = {
#ifdef HAVE_LIBDECOR_H
const struct libdecor_interface libdecor_interface = {
.error = libdecor_handle_error,
.error = libdecor_handle_err,
};
#endif

View File

@ -2777,7 +2777,7 @@ static void *gl3_init(const video_info_t *video,
const char *vendor = NULL;
const char *renderer = NULL;
const char *version = NULL;
char *error_string = NULL;
char *err_string = NULL;
gl3_t *gl = (gl3_t*)calloc(1, sizeof(gl3_t));
const gfx_ctx_driver_t *ctx_driver = gl3_get_context(gl);
struct retro_hw_render_callback *hwr = video_driver_get_hw_context();
@ -2957,10 +2957,10 @@ static void *gl3_init(const video_info_t *video,
else
gl->flags &= ~GL3_FLAG_PBO_READBACK_ENABLE;
if (!gl_check_error(&error_string))
if (!gl_check_error(&err_string))
{
RARCH_ERR("[GLCore] %s\n", error_string);
free(error_string);
RARCH_ERR("[GLCore] %s\n", err_string);
free(err_string);
goto error;
}

View File

@ -271,9 +271,9 @@ static void sdl_dingux_blit_text32(
}
}
static void sdl_dingux_blit_video_mode_error_msg(sdl_dingux_video_t *vid)
static void sdl_dingux_blit_video_mode_err_msg(sdl_dingux_video_t *vid)
{
const char *error_msg = msg_hash_to_str(MSG_UNSUPPORTED_VIDEO_MODE);
const char *err_msg = msg_hash_to_str(MSG_UNSUPPORTED_VIDEO_MODE);
char display_mode[64];
display_mode[0] = '\0';
@ -292,7 +292,7 @@ static void sdl_dingux_blit_video_mode_error_msg(sdl_dingux_video_t *vid)
{
sdl_dingux_blit_text32(vid,
FONT_WIDTH_STRIDE, FONT_WIDTH_STRIDE,
error_msg);
err_msg);
sdl_dingux_blit_text32(vid,
FONT_WIDTH_STRIDE, FONT_WIDTH_STRIDE + FONT_HEIGHT_STRIDE,
@ -302,7 +302,7 @@ static void sdl_dingux_blit_video_mode_error_msg(sdl_dingux_video_t *vid)
{
sdl_dingux_blit_text16(vid,
FONT_WIDTH_STRIDE, FONT_WIDTH_STRIDE,
error_msg);
err_msg);
sdl_dingux_blit_text16(vid,
FONT_WIDTH_STRIDE, FONT_WIDTH_STRIDE + FONT_HEIGHT_STRIDE,
@ -822,7 +822,7 @@ static bool sdl_dingux_gfx_frame(void *data, const void *frame,
/* If current display mode is invalid,
* just display an error message */
else
sdl_dingux_blit_video_mode_error_msg(vid);
sdl_dingux_blit_video_mode_err_msg(vid);
vid->was_in_menu = false;
}

View File

@ -669,9 +669,9 @@ static void sdl_rs90_blit_text32(
}
}
static void sdl_rs90_blit_video_mode_error_msg(sdl_rs90_video_t *vid)
static void sdl_rs90_blit_video_mode_err_msg(sdl_rs90_video_t *vid)
{
const char *error_msg = msg_hash_to_str(MSG_UNSUPPORTED_VIDEO_MODE);
const char *err_msg = msg_hash_to_str(MSG_UNSUPPORTED_VIDEO_MODE);
char display_mode[64];
display_mode[0] = '\0';
@ -690,7 +690,7 @@ static void sdl_rs90_blit_video_mode_error_msg(sdl_rs90_video_t *vid)
{
sdl_rs90_blit_text32(vid,
FONT_WIDTH_STRIDE, FONT_WIDTH_STRIDE,
error_msg);
err_msg);
sdl_rs90_blit_text32(vid,
FONT_WIDTH_STRIDE, FONT_WIDTH_STRIDE + FONT_HEIGHT_STRIDE,
@ -700,7 +700,7 @@ static void sdl_rs90_blit_video_mode_error_msg(sdl_rs90_video_t *vid)
{
sdl_rs90_blit_text16(vid,
FONT_WIDTH_STRIDE, FONT_WIDTH_STRIDE,
error_msg);
err_msg);
sdl_rs90_blit_text16(vid,
FONT_WIDTH_STRIDE, FONT_WIDTH_STRIDE + FONT_HEIGHT_STRIDE,
@ -1137,7 +1137,7 @@ static bool sdl_rs90_gfx_frame(void *data, const void *frame,
/* If current display mode is invalid,
* just display an error message */
else
sdl_rs90_blit_video_mode_error_msg(vid);
sdl_rs90_blit_video_mode_err_msg(vid);
vid->was_in_menu = false;
}

View File

@ -217,12 +217,9 @@ static void gl_cg_set_uniform_parameter(
}
#ifdef RARCH_CG_DEBUG
static void cg_error_handler(CGcontext ctx, CGerror error, void *data)
static void cg_err_handler(CGcontext ctx, CGerror err, void *data)
{
(void)ctx;
(void)data;
switch (error)
switch (err)
{
case CG_INVALID_PARAM_HANDLE_ERROR:
RARCH_ERR("[Cg] Invalid param handle.\n");
@ -236,7 +233,7 @@ static void cg_error_handler(CGcontext ctx, CGerror error, void *data)
break;
}
RARCH_ERR("[Cg] Error: \"%s\".\n", cgGetErrorString(error));
RARCH_ERR("[Cg] Error: \"%s\".\n", cgGetErrorString(err));
}
#endif
@ -639,15 +636,14 @@ static bool gl_cg_load_stock(void *data)
program_info.is_file = false;
if (!gl_cg_compile_program(data, 0, &cg->prg[0], &program_info))
goto error;
{
RARCH_ERR("[Cg] Failed to compile passthrough shader, is something wrong with your environment?\n");
return false;
}
gl_cg_set_program_base_attrib(data, 0);
return true;
error:
RARCH_ERR("[Cg] Failed to compile passthrough shader, is something wrong with your environment?\n");
return false;
}
static bool gl_cg_load_plain(void *data, const char *path)
@ -977,15 +973,15 @@ static void *gl_cg_init(void *data, const char *path)
#ifdef RARCH_CG_DEBUG
cgGLSetDebugMode(CG_TRUE);
cgSetErrorHandler(cg_error_handler, NULL);
cgSetErrorHandler(cg_err_handler, NULL);
#endif
cg->cgFProf = cgGLGetLatestProfile(CG_GL_FRAGMENT);
cg->cgVProf = cgGLGetLatestProfile(CG_GL_VERTEX);
if (
cg->cgFProf == CG_PROFILE_UNKNOWN ||
cg->cgVProf == CG_PROFILE_UNKNOWN)
cg->cgFProf == CG_PROFILE_UNKNOWN
|| cg->cgVProf == CG_PROFILE_UNKNOWN)
{
RARCH_ERR("[Cg] Invalid profile type.\n");
goto error;

View File

@ -1016,7 +1016,7 @@ static void *gl_glsl_init(void *data, const char *path)
struct shader_program_info shader_prog_info;
bool shader_support = false;
#ifdef GLSL_DEBUG
char *error_string = NULL;
char *err_string = NULL;
#endif
const char *stock_vertex = NULL;
const char *stock_fragment = NULL;
@ -1177,10 +1177,10 @@ static void *gl_glsl_init(void *data, const char *path)
gl_glsl_find_uniforms(glsl, i, glsl->prg[i].id, &glsl->uniforms[i]);
#ifdef GLSL_DEBUG
if (!gl_check_error(&error_string))
if (!gl_check_error(&err_string))
{
RARCH_ERR("%s\n", error_string);
free(error_string);
RARCH_ERR("%s\n", err_string);
free(err_string);
RARCH_WARN("[GLSL] Detected GL error in GLSL.\n");
}
#endif

View File

@ -26,13 +26,13 @@ static wiiu_adapter_list adapters;
/* Forward declarations */
static void wiiu_hid_attach(wiiu_hid_t *hid, wiiu_attach_event *event);
static void wiiu_hid_report_hid_error(const char *msg, wiiu_adapter_t *adapter, int32_t error)
static void wiiu_hid_report_hid_error(const char *msg, wiiu_adapter_t *adapter, int32_t err)
{
int16_t hid_error_code = error & 0xffff;
int16_t error_category = (error >> 16) & 0xffff;
const char *device = string_is_empty(adapter->device_name) ? "unknown" : adapter->device_name;
int16_t hid_err_code = err & 0xffff;
int16_t err_category = (err >> 16) & 0xffff;
const char *device = string_is_empty(adapter->device_name) ? "unknown" : adapter->device_name;
switch (hid_error_code)
switch (hid_err_code)
{
case -100:
RARCH_ERR("[HID] Invalid RM command (%s).\n", device);
@ -70,9 +70,9 @@ static void wiiu_hid_report_hid_error(const char *msg, wiiu_adapter_t *adapter,
default:
#if 0
RARCH_ERR("[HID] Unknown error (%d:%d: %s).\n",
error_category, hid_error_code, device);
err_category, hid_err_code, device);
#else
(void)error_category;
(void)err_category;
break;
#endif
}
@ -340,7 +340,7 @@ static void wiiu_handle_attach_events(wiiu_hid_t *hid, wiiu_attach_event *list)
}
}
static void wiiu_hid_read_loop_callback(uint32_t handle, int32_t error,
static void wiiu_hid_read_loop_callback(uint32_t handle, int32_t err,
uint8_t *buffer, uint32_t buffer_size, void *userdata)
{
wiiu_adapter_t *adapter = (wiiu_adapter_t *)userdata;
@ -350,14 +350,14 @@ static void wiiu_hid_read_loop_callback(uint32_t handle, int32_t error,
return;
}
if (error < 0)
wiiu_hid_report_hid_error("async read failed", adapter, error);
if (err < 0)
wiiu_hid_report_hid_error("async read failed", adapter, err);
if (adapter->state == ADAPTER_STATE_READING)
{
adapter->state = ADAPTER_STATE_READY;
if (error == 0)
if (err == 0)
adapter->pad_driver->packet_handler(adapter->pad_driver_data, buffer, buffer_size);
}
}

View File

@ -189,24 +189,25 @@ static void wpad_check_panic_button(uint32_t held_buttons)
static void wpad_poll(void)
{
VPADStatus vpad;
VPADReadError error;
VPADChan channel;
VPADReadError err;
for (channel = VPAD_CHAN_0; channel < WIIU_GAMEPAD_CHANNELS; channel++)
{
VPADRead(channel, &vpad, 1, &error);
VPADRead(channel, &vpad, 1, &err);
/* Gamepad is connected! */
if (error == VPAD_READ_SUCCESS || error == VPAD_READ_NO_SAMPLES)
if (err == VPAD_READ_SUCCESS || err == VPAD_READ_NO_SAMPLES)
wpad_register(channel);
else if (error == VPAD_READ_INVALID_CONTROLLER)
else if (err == VPAD_READ_INVALID_CONTROLLER)
wpad_deregister(channel);
if (error == VPAD_READ_SUCCESS)
if (err == VPAD_READ_SUCCESS)
{
wpad_update_button_state(&joypad_state.wpad.pads[channel].button_state, vpad.hold);
wpad_update_analog_state(joypad_state.wpad.pads[channel].analog_state, &vpad);
wpad_update_touch_state(joypad_state.wpad.pads[channel].analog_state, &joypad_state.wpad.pads[channel].button_state, &vpad, channel);
wpad_update_touch_state(joypad_state.wpad.pads[channel].analog_state,
&joypad_state.wpad.pads[channel].button_state, &vpad, channel);
wpad_check_panic_button(vpad.hold);
}
}

View File

@ -53,9 +53,9 @@
#endif
#ifdef _WIN32
static char last_dyn_error[512];
static char last_dyn_err[512];
static void set_dl_error(void)
static void set_dl_err(void)
{
DWORD err = GetLastError();
if (FormatMessage(
@ -63,9 +63,9 @@ static void set_dl_error(void)
| FORMAT_MESSAGE_FROM_SYSTEM,
NULL, err,
MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT),
last_dyn_error, sizeof(last_dyn_error) - 1,
last_dyn_err, sizeof(last_dyn_err) - 1,
NULL) == 0)
snprintf(last_dyn_error, sizeof(last_dyn_error) - 1,
snprintf(last_dyn_err, sizeof(last_dyn_err) - 1,
"unknown error %lu", err);
}
#endif
@ -121,10 +121,10 @@ dylib_t dylib_load(const char *path)
if (!lib)
{
set_dl_error();
set_dl_err();
return NULL;
}
last_dyn_error[0] = 0;
last_dyn_err[0] = 0;
#elif defined(ORBIS)
int res;
dylib_t lib = (dylib_t)sceKernelLoadStartModule(path, 0, NULL, 0, NULL, &res);
@ -153,8 +153,8 @@ dylib_t dylib_load(const char *path)
char *dylib_error(void)
{
#ifdef _WIN32
if (last_dyn_error[0])
return last_dyn_error;
if (last_dyn_err[0])
return last_dyn_err;
return NULL;
#else
return (char*)dlerror();
@ -181,10 +181,10 @@ function_t dylib_proc(dylib_t lib, const char *proc)
}
if (!(sym = (function_t)GetProcAddress(mod, proc)))
{
set_dl_error();
set_dl_err();
return NULL;
}
last_dyn_error[0] = 0;
last_dyn_err[0] = 0;
#elif defined(ORBIS)
void *ptr_sym = NULL;
sym = NULL;
@ -227,8 +227,8 @@ void dylib_close(dylib_t lib)
{
#ifdef _WIN32
if (!FreeLibrary((HMODULE)lib))
set_dl_error();
last_dyn_error[0] = 0;
set_dl_err();
last_dyn_err[0] = 0;
#elif defined(ORBIS)
int res;
sceKernelStopUnloadModule((SceKernelModule)lib, 0, NULL, 0, NULL, &res);

View File

@ -753,7 +753,7 @@ static int rpng_load_image_argb_process_inflate_init(
rpng_t *rpng, uint32_t **data)
{
bool zstatus;
enum trans_stream_error terror;
enum trans_stream_error err;
uint32_t rd, wn;
struct rpng_process *process = (struct rpng_process*)rpng->process;
bool to_continue = (process->avail_in > 0
@ -762,16 +762,16 @@ static int rpng_load_image_argb_process_inflate_init(
if (!to_continue)
goto end;
zstatus = process->stream_backend->trans(process->stream, false, &rd, &wn, &terror);
zstatus = process->stream_backend->trans(process->stream, false, &rd, &wn, &err);
if (!zstatus && terror != TRANS_STREAM_ERROR_BUFFER_FULL)
if (!zstatus && err != TRANS_STREAM_ERROR_BUFFER_FULL)
goto error;
process->avail_in -= rd;
process->avail_out -= wn;
process->total_out += wn;
if (terror)
if (err)
return 0;
end:

View File

@ -78,27 +78,27 @@ bool gl_query_extension(const char *ext)
return ret;
}
bool gl_check_error(char **error_string)
bool gl_check_error(char **err_string)
{
int error = glGetError();
switch (error)
int err = glGetError();
switch (err)
{
case GL_INVALID_ENUM:
*error_string = strdup("GL: Invalid enum.");
*err_string = strdup("GL: Invalid enum.");
break;
case GL_INVALID_VALUE:
*error_string = strdup("GL: Invalid value.");
*err_string = strdup("GL: Invalid value.");
break;
case GL_INVALID_OPERATION:
*error_string = strdup("GL: Invalid operation.");
*err_string = strdup("GL: Invalid operation.");
break;
case GL_OUT_OF_MEMORY:
*error_string = strdup("GL: Out of memory.");
*err_string = strdup("GL: Out of memory.");
break;
case GL_NO_ERROR:
return true;
default:
*error_string = strdup("Non specified GL error.");
*err_string = strdup("Non specified GL error.");
break;
}

View File

@ -82,7 +82,7 @@ static slock_t *conn_pool_lock = NULL;
struct http_t
{
bool error;
bool err;
struct conn_pool_entry *conn;
bool ssl;
@ -700,15 +700,15 @@ static void net_http_conn_pool_remove_expired(void)
if (!entry->in_use && FD_ISSET(entry->fd, &fds))
{
char buf[4096];
bool error = false;
bool err = false;
#ifdef HAVE_SSL
if (entry->ssl && entry->ssl_ctx)
ssl_socket_receive_all_nonblocking(entry->ssl_ctx, &error, buf, sizeof(buf));
ssl_socket_receive_all_nonblocking(entry->ssl_ctx, &err, buf, sizeof(buf));
else
#endif
socket_receive_all_nonblocking(entry->fd, &error, buf, sizeof(buf));
socket_receive_all_nonblocking(entry->fd, &err, buf, sizeof(buf));
if (!error)
if (!err)
continue;
if (prev)
@ -993,10 +993,10 @@ static bool net_http_connect(struct http_t *state)
return true;
}
}
conn->fd = -1; /* already closed */
conn->fd = -1; /* already closed */
net_http_conn_pool_remove(conn);
state->conn = NULL;
state->error = true;
state->err = true;
return false;
}
else
@ -1012,10 +1012,10 @@ static bool net_http_connect(struct http_t *state)
socket_close(conn->fd);
}
conn->fd = -1; /* already closed */
conn->fd = -1; /* already closed */
net_http_conn_pool_remove(conn);
state->conn = NULL;
state->error = true;
state->err = true;
return false;
}
}
@ -1023,21 +1023,21 @@ static bool net_http_connect(struct http_t *state)
static void net_http_send_str(
struct http_t *state, const char *text, size_t text_size)
{
if (state->error)
if (state->err)
return;
#ifdef HAVE_SSL
if (state->ssl)
{
if (!ssl_socket_send_all_blocking(
state->conn->ssl_ctx, text, text_size, true))
state->error = true;
state->err = true;
}
else
#endif
{
if (!socket_send_all_blocking(
state->conn->fd, text, text_size, true))
state->error = true;
state->err = true;
}
}
@ -1090,7 +1090,7 @@ static bool net_http_send_request(struct http_t *state)
if (!request->postdata && !string_is_equal(request->method, "PUT"))
{
state->error = true;
state->err = true;
return true;
}
@ -1133,7 +1133,7 @@ static bool net_http_send_request(struct http_t *state)
net_http_send_str(state, request->postdata, request->contentlength);
state->request_sent = true;
return state->error;
return state->err;
}
/**
@ -1175,7 +1175,7 @@ static ssize_t net_http_receive_header(struct http_t *state, ssize_t newlen)
if (strncmp(response->data, "HTTP/1.", STRLEN_CONST("HTTP/1."))!=0)
{
response->part = P_DONE;
state->error = true;
state->err = true;
return -1;
}
response->status = (int)strtoul(response->data
@ -1246,7 +1246,7 @@ static bool net_http_receive_body(struct http_t *state, ssize_t newlen)
{
struct response *response = &state->response;
if (newlen < 0 || state->error)
if (newlen < 0 || state->err)
{
if (response->bodytype != T_FULL)
return false;
@ -1412,7 +1412,7 @@ bool net_http_update(struct http_t *state, size_t* progress, size_t* total)
if (!state)
return true;
if (state->error)
if (state->err)
return true;
if (!state->conn)
@ -1421,16 +1421,16 @@ bool net_http_update(struct http_t *state, size_t* progress, size_t* total)
if (!state->conn)
{
if (!net_http_new_socket(state))
state->error = true;
return state->error;
state->err = true;
return state->err;
}
}
if (!state->conn->connected)
{
if (!net_http_connect(state))
state->error = true;
return state->error;
state->err = true;
return state->err;
}
if (!state->request_sent)
@ -1440,18 +1440,18 @@ bool net_http_update(struct http_t *state, size_t* progress, size_t* total)
#ifdef HAVE_SSL
if (state->ssl && state->conn->ssl_ctx)
newlen = ssl_socket_receive_all_nonblocking(state->conn->ssl_ctx, &state->error,
newlen = ssl_socket_receive_all_nonblocking(state->conn->ssl_ctx, &state->err,
(uint8_t*)response->data + response->pos,
response->buflen - response->pos);
else
#endif
newlen = socket_receive_all_nonblocking(state->conn->fd, &state->error,
newlen = socket_receive_all_nonblocking(state->conn->fd, &state->err,
(uint8_t*)response->data + response->pos,
response->buflen - response->pos);
if (response->part < P_BODY)
{
if (newlen < 0 || state->error)
if (newlen < 0 || state->err)
goto error;
newlen = net_http_receive_header(state, newlen);
}
@ -1505,7 +1505,7 @@ bool net_http_update(struct http_t *state, size_t* progress, size_t* total)
error:
net_http_conn_pool_remove(state->conn);
state->error = true;
state->err = true;
response->part = P_DONE;
response->status = -1;
return true;
@ -1534,14 +1534,14 @@ int net_http_status(struct http_t *state)
*
* @return the response headers. The returned buffer is owned by the
* caller of net_http_new; it is not freed by net_http_delete().
* If the status is not 20x and accept_error is false, it returns NULL.
* If the status is not 20x and accept_err is false, it returns NULL.
**/
struct string_list *net_http_headers(struct http_t *state)
{
if (!state)
return NULL;
if (state->error)
if (state->err)
return NULL;
return state->response.headers;
@ -1554,14 +1554,14 @@ struct string_list *net_http_headers(struct http_t *state)
*
* @return the downloaded data. The returned buffer is owned by the
* HTTP handler; it's freed by net_http_delete().
* If the status is not 20x and accept_error is false, it returns NULL.
* If the status is not 20x and accept_err is false, it returns NULL.
**/
uint8_t* net_http_data(struct http_t *state, size_t* len, bool accept_error)
uint8_t* net_http_data(struct http_t *state, size_t* len, bool accept_err)
{
if (!state)
return NULL;
if (!accept_error && (state->error || state->response.status < 200 || state->response.status > 299))
if (!accept_err && (state->err || state->response.status < 200 || state->response.status > 299))
{
if (len)
*len = 0;
@ -1610,5 +1610,5 @@ void net_http_delete(struct http_t *state)
**/
bool net_http_error(struct http_t *state)
{
return (state->error || state->response.status < 200 || state->response.status > 299);
return (state->err || state->response.status < 200 || state->response.status > 299);
}

View File

@ -91,7 +91,7 @@ int socket_next(void **address)
return -1;
}
ssize_t socket_receive_all_nonblocking(int fd, bool *error,
ssize_t socket_receive_all_nonblocking(int fd, bool *err,
void *data_, size_t len)
{
ssize_t ret = recv(fd, (char*)data_, len, 0);
@ -99,7 +99,7 @@ ssize_t socket_receive_all_nonblocking(int fd, bool *error,
return ret;
if (ret < 0 && isagain((int)ret))
return 0;
*error = true;
*err = true;
return -1;
}
@ -218,10 +218,10 @@ int socket_close(int fd)
}
int socket_select(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *errorfds, struct timeval *timeout)
fd_set *err_fds, struct timeval *timeout)
{
#if defined(__PS3__)
return socketselect(nfds, readfds, writefds, errorfds, timeout);
return socketselect(nfds, readfds, writefds, err_fds, timeout);
#elif defined(VITA)
int i, j;
fd_set rfds, wfds, efds;
@ -250,7 +250,7 @@ int socket_select(int nfds, fd_set *readfds, fd_set *writefds,
event_count++;
else if (writefds && FD_ISSET(i, writefds))
event_count++;
else if (errorfds && FD_ISSET(i, errorfds))
else if (err_fds && FD_ISSET(i, err_fds))
event_count++;
}
@ -275,7 +275,7 @@ int socket_select(int nfds, fd_set *readfds, fd_set *writefds,
if (writefds && FD_ISSET(i, writefds))
event->events |= SCE_NET_EPOLLOUT;
if (event->events || (errorfds && FD_ISSET(i, errorfds)))
if (event->events || (err_fds && FD_ISSET(i, err_fds)))
{
event->data.fd = i;
@ -306,8 +306,8 @@ int socket_select(int nfds, fd_set *readfds, fd_set *writefds,
memcpy(&rfds, readfds, sizeof(rfds));
if (writefds)
memcpy(&wfds, writefds, sizeof(wfds));
if (errorfds)
memcpy(&efds, errorfds, sizeof(efds));
if (err_fds)
memcpy(&efds, err_fds, sizeof(efds));
}
else
{
@ -322,8 +322,8 @@ int socket_select(int nfds, fd_set *readfds, fd_set *writefds,
FD_ZERO(readfds);
if (writefds)
FD_ZERO(writefds);
if (errorfds)
FD_ZERO(errorfds);
if (err_fds)
FD_ZERO(err_fds);
/* Vita's epoll takes a microsecond timeout parameter. */
if (timeout)
@ -350,7 +350,7 @@ int socket_select(int nfds, fd_set *readfds, fd_set *writefds,
EPOLL_FD_SET(SCE_NET_EPOLLIN, &rfds, readfds)
EPOLL_FD_SET(SCE_NET_EPOLLOUT, &wfds, writefds)
EPOLL_FD_SET(SCE_NET_EPOLLERR, &efds, errorfds)
EPOLL_FD_SET(SCE_NET_EPOLLERR, &efds, err_fds)
}
ret = j;
@ -363,7 +363,7 @@ done:
return ret;
#else
return select(nfds, readfds, writefds, errorfds, timeout);
return select(nfds, readfds, writefds, err_fds, timeout);
#endif
}
@ -479,7 +479,6 @@ done:
for (i = 0; i < timeout_quotient; i++)
{
ret = poll(fds, nfds, TIMEOUT_DIVISOR);
/* Success or error. */
if (ret)
return ret;
@ -768,11 +767,11 @@ bool socket_connect_with_timeout(int fd, void *data, int timeout)
return false;
#else
{
int error = -1;
socklen_t errsz = sizeof(error);
int err = -1;
socklen_t errsz = sizeof(err);
getsockopt(fd, SOL_SOCKET, SO_ERROR, (char*)&error, &errsz);
if (error)
getsockopt(fd, SOL_SOCKET, SO_ERROR, (char*)&err, &errsz);
if (err)
return false;
}
#endif

View File

@ -252,7 +252,7 @@ int ssl_socket_connect(void *state_data,
}
ssize_t ssl_socket_receive_all_nonblocking(void *state_data,
bool *error, void *data_, size_t len)
bool *err, void *data_, size_t len)
{
size_t __len;
uint8_t *bear_data;
@ -260,7 +260,7 @@ ssize_t ssl_socket_receive_all_nonblocking(void *state_data,
socket_set_block(state->fd, false);
if (!process_inner(state, false))
{
*error = true;
*err = true;
return -1;
}
bear_data = br_ssl_engine_recvapp_buf(&state->sc.eng, &__len);

View File

@ -191,7 +191,7 @@ int ssl_socket_connect(void *state_data,
}
ssize_t ssl_socket_receive_all_nonblocking(void *state_data,
bool *error, void *data_, size_t len)
bool *err, void *data_, size_t len)
{
ssize_t ret;
struct ssl_state *state = (struct ssl_state*)state_data;
@ -208,14 +208,14 @@ ssize_t ssl_socket_receive_all_nonblocking(void *state_data,
if (ret == 0)
{
/* Socket closed */
*error = true;
*err = true;
return -1;
}
if (isagain((int)ret) || ret == MBEDTLS_ERR_SSL_WANT_READ)
return 0;
*error = true;
*err = true;
return -1;
}

View File

@ -943,12 +943,12 @@ bool task_is_on_main_thread(void)
#endif
}
void task_set_error(retro_task_t *task, char *error)
void task_set_error(retro_task_t *task, char *err)
{
#ifdef HAVE_THREADS
slock_lock(property_lock);
#endif
task->error = error;
task->error = err;
#ifdef HAVE_THREADS
slock_unlock(property_lock);
#endif

View File

@ -280,13 +280,12 @@ chdstream_t *chdstream_open(const char *path, int32_t track)
stream->frames_per_hunk = hd->hunkbytes / hd->unitbytes;
stream->track_frame = meta.frame_offset;
stream->track_start = (size_t)pregap * stream->frame_size;
stream->track_end = stream->track_start +
stream->track_end = stream->track_start +
(size_t)meta.frames * stream->frame_size;
return stream;
error:
chdstream_close(stream);
if (chd)
@ -359,7 +358,7 @@ ssize_t chdstream_read(chdstream_t *stream, void *data, size_t bytes)
uint32_t chd_frame = (uint32_t)(stream->track_frame +
(stream->offset - stream->track_start) / stream->frame_size);
uint32_t hunk = chd_frame / stream->frames_per_hunk;
uint32_t hunk_offset = (chd_frame % stream->frames_per_hunk)
uint32_t hunk_offset = (chd_frame % stream->frames_per_hunk)
* hd->unitbytes;
if (!chdstream_load_hunk(stream, hunk))

View File

@ -46,7 +46,7 @@
struct RFILE
{
struct retro_vfs_file_handle *hfile;
bool error_flag;
bool err_flag;
};
static retro_vfs_get_path_t filestream_get_path_cb = NULL;
@ -133,7 +133,7 @@ int64_t filestream_get_size(RFILE *stream)
(libretro_vfs_implementation_file*)stream->hfile);
if (output == VFS_ERROR_RETURN_VALUE)
stream->error_flag = true;
stream->err_flag = true;
return output;
}
@ -149,7 +149,7 @@ int64_t filestream_truncate(RFILE *stream, int64_t length)
(libretro_vfs_implementation_file*)stream->hfile, length);
if (output == VFS_ERROR_RETURN_VALUE)
stream->error_flag = true;
stream->err_flag = true;
return output;
}
@ -175,8 +175,8 @@ RFILE* filestream_open(const char *path, unsigned mode, unsigned hints)
return NULL;
}
output->error_flag = false;
output->hfile = fp;
output->err_flag = false;
output->hfile = fp;
return output;
}
@ -356,7 +356,7 @@ int64_t filestream_seek(RFILE *stream, int64_t offset, int seek_position)
offset, seek_position);
if (output == VFS_ERROR_RETURN_VALUE)
stream->error_flag = true;
stream->err_flag = true;
return output;
}
@ -377,7 +377,7 @@ int64_t filestream_tell(RFILE *stream)
(libretro_vfs_implementation_file*)stream->hfile);
if (output == VFS_ERROR_RETURN_VALUE)
stream->error_flag = true;
stream->err_flag = true;
return output;
}
@ -387,7 +387,7 @@ void filestream_rewind(RFILE *stream)
if (!stream)
return;
filestream_seek(stream, 0L, RETRO_VFS_SEEK_POSITION_START);
stream->error_flag = false;
stream->err_flag = false;
}
int64_t filestream_read(RFILE *stream, void *s, int64_t len)
@ -401,7 +401,7 @@ int64_t filestream_read(RFILE *stream, void *s, int64_t len)
(libretro_vfs_implementation_file*)stream->hfile, s, len);
if (output == VFS_ERROR_RETURN_VALUE)
stream->error_flag = true;
stream->err_flag = true;
return output;
}
@ -417,7 +417,7 @@ int filestream_flush(RFILE *stream)
(libretro_vfs_implementation_file*)stream->hfile);
if (output == VFS_ERROR_RETURN_VALUE)
stream->error_flag = true;
stream->err_flag = true;
return output;
}
@ -529,7 +529,7 @@ int64_t filestream_write(RFILE *stream, const void *s, int64_t len)
(libretro_vfs_implementation_file*)stream->hfile, s, len);
if (output == VFS_ERROR_RETURN_VALUE)
stream->error_flag = true;
stream->err_flag = true;
return output;
}
@ -568,7 +568,7 @@ int filestream_printf(RFILE *stream, const char* format, ...)
int filestream_error(RFILE *stream)
{
return (stream && stream->error_flag);
return (stream && stream->err_flag);
}
int filestream_close(RFILE *stream)

View File

@ -30,7 +30,7 @@
* @in_size : input size
* @s : output data
* @len : output size
* @error : (optional) output for error code
* @err : (optional) output for error code
*
* Perform a full transcoding from a source to a destination.
*/
@ -38,7 +38,7 @@ bool trans_stream_trans_full(
struct trans_stream_backend *backend, void **data,
const uint8_t *in, uint32_t in_size,
uint8_t *s, uint32_t len,
enum trans_stream_error *error)
enum trans_stream_error *err)
{
void *rdata;
bool ret;
@ -50,15 +50,15 @@ bool trans_stream_trans_full(
{
if (!(rdata = backend->stream_new()))
{
if (error)
*error = TRANS_STREAM_ERROR_ALLOCATION_FAILURE;
if (err)
*err = TRANS_STREAM_ERROR_ALLOCATION_FAILURE;
return false;
}
}
backend->set_in(rdata, in, in_size);
backend->set_out(rdata, s, len);
ret = backend->trans(rdata, true, &rd, &wn, error);
ret = backend->trans(rdata, true, &rd, &wn, err);
if (data)
*data = rdata;

View File

@ -34,7 +34,7 @@ struct pipe_trans_stream
static void *pipe_stream_new(void)
{
struct pipe_trans_stream *stream =
struct pipe_trans_stream *stream =
(struct pipe_trans_stream*)malloc(sizeof(*stream));
if (!stream)
return NULL;
@ -58,7 +58,7 @@ static void pipe_set_in(void *data, const uint8_t *in, uint32_t in_size)
if (!p)
return;
p->in = in;
p->in_size = in_size;
}
@ -66,7 +66,7 @@ static void pipe_set_in(void *data, const uint8_t *in, uint32_t in_size)
static void pipe_set_out(void *data, uint8_t *out, uint32_t out_size)
{
struct pipe_trans_stream *p = (struct pipe_trans_stream *) data;
if (!p)
return;
@ -74,10 +74,8 @@ static void pipe_set_out(void *data, uint8_t *out, uint32_t out_size)
p->out_size = out_size;
}
static bool pipe_trans(
void *data, bool flush,
uint32_t *rd, uint32_t *wn,
enum trans_stream_error *error)
static bool pipe_trans(void *data, bool flush,
uint32_t *rd, uint32_t *wn, enum trans_stream_error *err)
{
struct pipe_trans_stream *p = (struct pipe_trans_stream *) data;
@ -87,7 +85,7 @@ static bool pipe_trans(
*rd = *wn = p->out_size;
p->in += p->out_size;
p->out += p->out_size;
*error = TRANS_STREAM_ERROR_BUFFER_FULL;
*err = TRANS_STREAM_ERROR_BUFFER_FULL;
return false;
}
@ -95,7 +93,7 @@ static bool pipe_trans(
*rd = *wn = p->in_size;
p->in += p->in_size;
p->out += p->in_size;
*error = TRANS_STREAM_ERROR_NONE;
*err = TRANS_STREAM_ERROR_NONE;
return true;
}

View File

@ -192,7 +192,7 @@ static void zlib_set_out(void *data, uint8_t *out, uint32_t out_size)
static bool zlib_deflate_trans(
void *data, bool flush,
uint32_t *rd, uint32_t *wn,
enum trans_stream_error *error)
enum trans_stream_error *err)
{
int zret = 0;
bool ret = false;
@ -213,18 +213,18 @@ static bool zlib_deflate_trans(
if (zret == Z_OK)
{
if (error)
*error = TRANS_STREAM_ERROR_AGAIN;
if (err)
*err = TRANS_STREAM_ERROR_AGAIN;
}
else if (zret == Z_STREAM_END)
{
if (error)
*error = TRANS_STREAM_ERROR_NONE;
if (err)
*err = TRANS_STREAM_ERROR_NONE;
}
else
{
if (error)
*error = TRANS_STREAM_ERROR_OTHER;
if (err)
*err = TRANS_STREAM_ERROR_OTHER;
return false;
}
ret = true;
@ -235,8 +235,8 @@ static bool zlib_deflate_trans(
if (z->avail_in != 0)
{
ret = false;
if (error)
*error = TRANS_STREAM_ERROR_BUFFER_FULL;
if (err)
*err = TRANS_STREAM_ERROR_BUFFER_FULL;
}
}
@ -255,7 +255,7 @@ static bool zlib_deflate_trans(
static bool zlib_inflate_trans(
void *data, bool flush,
uint32_t *rd, uint32_t *wn,
enum trans_stream_error *error)
enum trans_stream_error *err)
{
int zret;
bool ret = false;
@ -276,18 +276,18 @@ static bool zlib_inflate_trans(
if (zret == Z_OK)
{
if (error)
*error = TRANS_STREAM_ERROR_AGAIN;
if (err)
*err = TRANS_STREAM_ERROR_AGAIN;
}
else if (zret == Z_STREAM_END)
{
if (error)
*error = TRANS_STREAM_ERROR_NONE;
if (err)
*err = TRANS_STREAM_ERROR_NONE;
}
else
{
if (error)
*error = TRANS_STREAM_ERROR_OTHER;
if (err)
*err = TRANS_STREAM_ERROR_OTHER;
return false;
}
ret = true;
@ -298,8 +298,8 @@ static bool zlib_inflate_trans(
if (z->avail_in != 0)
{
ret = false;
if (error)
*error = TRANS_STREAM_ERROR_BUFFER_FULL;
if (err)
*err = TRANS_STREAM_ERROR_BUFFER_FULL;
}
}

View File

@ -977,11 +977,11 @@ int retro_vfs_stat_impl(const char *path, int32_t *size)
}
#if defined(VITA)
#define path_mkdir_error(ret) (((ret) == SCE_ERROR_ERRNO_EEXIST))
#define path_mkdir_err(ret) (((ret) == SCE_ERROR_ERRNO_EEXIST))
#elif defined(PSP) || defined(PS2) || defined(_3DS) || defined(WIIU) || defined(SWITCH)
#define path_mkdir_error(ret) ((ret) == -1)
#define path_mkdir_err(ret) ((ret) == -1)
#else
#define path_mkdir_error(ret) ((ret) < 0 && errno == EEXIST)
#define path_mkdir_err(ret) ((ret) < 0 && errno == EEXIST)
#endif
int retro_vfs_mkdir_impl(const char *dir)
@ -1031,7 +1031,7 @@ int retro_vfs_mkdir_impl(const char *dir)
int ret = mkdir(dir, 0750);
#endif
if (path_mkdir_error(ret))
if (path_mkdir_err(ret))
return -2;
return ret < 0 ? -1 : 0;
}
@ -1065,7 +1065,7 @@ struct libretro_vfs_implementation_dir
#endif
};
static bool dirent_check_error(libretro_vfs_implementation_dir *rdir)
static bool dirent_check_err(libretro_vfs_implementation_dir *rdir)
{
#if defined(_WIN32)
return (rdir->directory == INVALID_HANDLE_VALUE);
@ -1144,7 +1144,7 @@ libretro_vfs_implementation_dir *retro_vfs_opendir_impl(
(void)include_hidden;
#endif
if (rdir->directory && !dirent_check_error(rdir))
if (rdir->directory && !dirent_check_err(rdir))
return rdir;
retro_vfs_closedir_impl(rdir);

View File

@ -98,7 +98,7 @@ int libretrodb_cursor_reset(libretrodb_cursor_t *cursor);
void libretrodb_cursor_close(libretrodb_cursor_t *cursor);
void *libretrodb_query_compile(libretrodb_t *db, const char *query,
size_t buff_len, const char **error);
size_t buff_len, const char **err);
void libretrodb_query_free(void *q);

View File

@ -35,7 +35,7 @@ int main(int argc, char ** argv)
const char *command = NULL;
const char *path = NULL;
const char *query_exp = NULL;
const char *error = NULL;
const char *err = NULL;
libretrodb_t *db = NULL;
libretrodb_cursor_t *cur = NULL;
libretrodb_query_t *q = NULL;
@ -95,12 +95,12 @@ int main(int argc, char ** argv)
}
query_exp = argv[3];
error = NULL;
q = libretrodb_query_compile(db, query_exp, strlen(query_exp), &error);
err = NULL;
q = libretrodb_query_compile(db, query_exp, strlen(query_exp), &err);
if (error)
if (err)
{
printf("%s\n", error);
printf("%s\n", err);
goto error;
}
@ -126,12 +126,12 @@ int main(int argc, char ** argv)
}
query_exp = argv[3];
error = NULL;
q = libretrodb_query_compile(db, query_exp, strlen(query_exp), &error);
err = NULL;
q = libretrodb_query_compile(db, query_exp, strlen(query_exp), &err);
if (error)
if (err)
{
printf("%s\n", error);
printf("%s\n", err);
goto error;
}

View File

@ -92,9 +92,9 @@ struct registered_func
/* Forward declarations */
static struct buffer query_parse_method_call(char *s, size_t len,
struct buffer buff, struct invocation *invocation, const char **error);
struct buffer buff, struct invocation *invocation, const char **err);
static struct buffer query_parse_table(char *s, size_t len, struct buffer buff,
struct invocation *invocation, const char **error);
struct invocation *invocation, const char **err);
/* Errors */
static struct rmsgpack_dom_value query_func_is_true(
@ -266,7 +266,7 @@ struct registered_func registered_functions[100] = {
static void query_raise_unknown_function(
char *s, size_t _len,
ssize_t where, const char *name,
ssize_t len, const char **error)
ssize_t len, const char **err)
{
int __len = snprintf(s, _len,
"%" PRIu64 "::Unknown function '",
@ -275,7 +275,7 @@ static void query_raise_unknown_function(
if (len < ((ssize_t)_len - __len - 3))
strncpy(s + __len, name, len);
strcpy(s + __len + len, "'");
*error = s;
*err = s;
}
static void query_argument_free(struct argument *arg)
@ -298,7 +298,7 @@ static struct buffer query_parse_integer(
char *s, size_t len,
struct buffer buff,
struct rmsgpack_dom_value *value,
const char **error)
const char **err)
{
value->type = RDT_INT;
if (sscanf(buff.data + buff.offset,
@ -308,7 +308,7 @@ static struct buffer query_parse_integer(
snprintf(s, len,
"%" PRIu64 "::Expected number",
(uint64_t)buff.offset);
*error = s;
*err = s;
}
else
{
@ -327,7 +327,7 @@ static struct buffer query_chomp(struct buffer buff)
}
static struct buffer query_expect_eof(char *s, size_t len,
struct buffer buff, const char ** error)
struct buffer buff, const char ** err)
{
buff = query_chomp(buff);
if ((unsigned)buff.offset < buff.len)
@ -337,7 +337,7 @@ static struct buffer query_expect_eof(char *s, size_t len,
(uint64_t)buff.offset,
buff.data[buff.offset]
);
*error = s;
*err = s;
}
return buff;
}
@ -354,7 +354,7 @@ static int query_peek(struct buffer buff, const char * data,
static struct buffer query_get_char(
char *s, size_t len,
struct buffer buff, char * c,
const char ** error)
const char ** err)
{
if ((unsigned)buff.offset >= buff.len)
{
@ -362,7 +362,7 @@ static struct buffer query_get_char(
"%" PRIu64 "::Unexpected EOF",
(uint64_t)buff.offset
);
*error = s;
*err = s;
return buff;
}
@ -374,21 +374,21 @@ static struct buffer query_get_char(
static struct buffer query_parse_string(
char *s, size_t len,
struct buffer buff,
struct rmsgpack_dom_value *value, const char **error)
struct rmsgpack_dom_value *value, const char **err)
{
const char * str_start = NULL;
char terminator = '\0';
char c = '\0';
int is_binstr = 0;
buff = query_get_char(s, len,buff, &terminator, error);
buff = query_get_char(s, len,buff, &terminator, err);
if (*error)
if (*err)
return buff;
if (terminator == 'b')
{
is_binstr = 1;
buff = query_get_char(s, len, buff, &terminator, error);
buff = query_get_char(s, len, buff, &terminator, err);
}
if (terminator != '"' && terminator != '\'')
@ -397,20 +397,20 @@ static struct buffer query_parse_string(
snprintf(s, len,
"%" PRIu64 "::Expected string",
(uint64_t)buff.offset);
*error = s;
*err = s;
}
str_start = buff.data + buff.offset;
buff = query_get_char(s, len, buff, &c, error);
buff = query_get_char(s, len, buff, &c, err);
while (!*error)
while (!*err)
{
if (c == terminator)
break;
buff = query_get_char(s, len, buff, &c, error);
buff = query_get_char(s, len, buff, &c, err);
}
if (!*error)
if (!*err)
{
size_t count;
value->type = is_binstr ? RDT_BINARY : RDT_STRING;
@ -423,11 +423,11 @@ static struct buffer query_parse_string(
if (!value->val.string.buff)
{
s[0] = 'O';
s[1] = 'O';
s[2] = 'M';
s[3] = '\0';
*error = s;
s[0] = 'O';
s[1] = 'O';
s[2] = 'M';
s[3] = '\0';
*err = s;
}
else if (is_binstr)
{
@ -464,7 +464,7 @@ static struct buffer query_parse_string(
static struct buffer query_parse_value(char *s, size_t len,
struct buffer buff, struct rmsgpack_dom_value *value,
const char **error)
const char **err)
{
buff = query_chomp(buff);
@ -489,15 +489,14 @@ static struct buffer query_parse_value(char *s, size_t len,
query_peek(buff, "b", STRLEN_CONST("b"))
|| query_peek(buff, "\"", STRLEN_CONST("\""))
|| query_peek(buff, "'", STRLEN_CONST("'")))
buff = query_parse_string(s, len,
buff, value, error);
buff = query_parse_string(s, len, buff, value, err);
else if (ISDIGIT((int)buff.data[buff.offset]))
buff = query_parse_integer(s, len, buff, value, error);
buff = query_parse_integer(s, len, buff, value, err);
return buff;
}
static void query_peek_char(char *s, size_t len,
struct buffer buff, char *c, const char **error)
struct buffer buff, char *c, const char **err)
{
if ((unsigned)buff.offset >= buff.len)
{
@ -505,7 +504,7 @@ static void query_peek_char(char *s, size_t len,
"%" PRIu64 "::Unexpected EOF",
(uint64_t)buff.offset
);
*error = s;
*err = s;
return;
}
@ -514,7 +513,7 @@ static void query_peek_char(char *s, size_t len,
static struct buffer query_get_ident(char *s, size_t _len,
struct buffer buff, const char **ident,
size_t *len, const char **error)
size_t *len, const char **err)
{
char c = '\0';
@ -524,28 +523,28 @@ static struct buffer query_get_ident(char *s, size_t _len,
"%" PRIu64 "::Unexpected EOF",
(uint64_t)buff.offset
);
*error = s;
*err = s;
return buff;
}
*ident = buff.data + buff.offset;
*len = 0;
query_peek_char(s, _len, buff, &c, error);
query_peek_char(s, _len, buff, &c, err);
if (*error || !ISALPHA((int)c))
if (*err || !ISALPHA((int)c))
return buff;
buff.offset++;
*len = *len + 1;
query_peek_char(s, _len, buff, &c, error);
query_peek_char(s, _len, buff, &c, err);
while (!*error)
while (!*err)
{
if (!(ISALNUM((int)c) || c == '_'))
break;
buff.offset++;
*len = *len + 1;
query_peek_char(s, _len, buff, &c, error);
query_peek_char(s, _len, buff, &c, err);
}
return buff;
@ -554,7 +553,7 @@ static struct buffer query_get_ident(char *s, size_t _len,
static struct buffer query_expect_char(
char *s, size_t len,
struct buffer buff,
char c, const char ** error)
char c, const char ** err)
{
if ((unsigned)buff.offset >= buff.len)
{
@ -562,14 +561,14 @@ static struct buffer query_expect_char(
"%" PRIu64 "::Unexpected EOF",
(uint64_t)buff.offset
);
*error = s;
*err = s;
}
else if (buff.data[buff.offset] != c)
{
snprintf(s, len,
"%" PRIu64 "::Expected '%c' found '%c'",
(uint64_t)buff.offset, c, buff.data[buff.offset]);
*error = s;
*err = s;
}
else
buff.offset++;
@ -579,7 +578,7 @@ static struct buffer query_expect_char(
static struct buffer query_parse_argument(
char *s, size_t len,
struct buffer buff,
struct argument *arg, const char **error)
struct argument *arg, const char **err)
{
buff = query_chomp(buff);
@ -597,19 +596,19 @@ static struct buffer query_parse_argument(
{
arg->type = AT_FUNCTION;
buff = query_parse_method_call(s, len, buff,
&arg->a.invocation, error);
&arg->a.invocation, err);
}
else if (query_peek(buff, "{", STRLEN_CONST("{")))
{
arg->type = AT_FUNCTION;
buff = query_parse_table(s, len,
buff, &arg->a.invocation, error);
buff, &arg->a.invocation, err);
}
else
{
arg->type = AT_VALUE;
buff = query_parse_value(s,
len, buff, &arg->a.value, error);
len, buff, &arg->a.value, err);
}
return buff;
}
@ -669,7 +668,7 @@ static struct rmsgpack_dom_value query_func_all_map(
static struct buffer query_parse_table(
char *s, size_t len,
struct buffer buff,
struct invocation *invocation, const char **error)
struct invocation *invocation, const char **err)
{
unsigned i;
size_t _len;
@ -678,9 +677,9 @@ static struct buffer query_parse_table(
const char *ident_name = NULL;
buff = query_chomp(buff);
buff = query_expect_char(s, len, buff, '{', error);
buff = query_expect_char(s, len, buff, '{', err);
if (*error)
if (*err)
return buff;
buff = query_chomp(buff);
@ -690,16 +689,16 @@ static struct buffer query_parse_table(
if (argi >= QUERY_MAX_ARGS)
{
strlcpy(s, "Too many arguments in function call.", len);
*error = s;
*err = s;
goto clean;
}
if (ISALPHA((int)buff.data[buff.offset]))
{
buff = query_get_ident(s, len,
buff, &ident_name, &_len, error);
buff, &ident_name, &_len, err);
if (!*error)
if (!*err)
{
args[argi].a.value.type = RDT_STRING;
args[argi].a.value.val.string.len = (uint32_t)_len;
@ -716,17 +715,17 @@ static struct buffer query_parse_table(
}
else
buff = query_parse_string(s, len,
buff, &args[argi].a.value, error);
buff, &args[argi].a.value, err);
if (*error)
if (*err)
goto clean;
args[argi].type = AT_VALUE;
buff = query_chomp(buff);
argi++;
buff = query_expect_char(s, len, buff, ':', error);
buff = query_expect_char(s, len, buff, ':', err);
if (*error)
if (*err)
goto clean;
buff = query_chomp(buff);
@ -734,29 +733,29 @@ static struct buffer query_parse_table(
if (argi >= QUERY_MAX_ARGS)
{
strlcpy(s, "Too many arguments in function call.", len);
*error = s;
*err = s;
goto clean;
}
buff = query_parse_argument(s, len, buff, &args[argi], error);
buff = query_parse_argument(s, len, buff, &args[argi], err);
if (*error)
if (*err)
goto clean;
argi++;
buff = query_chomp(buff);
buff = query_expect_char(s, len, buff, ',', error);
buff = query_expect_char(s, len, buff, ',', err);
if (*error)
if (*err)
{
*error = NULL;
*err = NULL;
break;
}
buff = query_chomp(buff);
}
buff = query_expect_char(s, len, buff, '}', error);
buff = query_expect_char(s, len, buff, '}', err);
if (*error)
if (*err)
goto clean;
invocation->func = query_func_all_map;
@ -766,11 +765,11 @@ static struct buffer query_parse_table(
if (!invocation->argv)
{
s[0] = 'O';
s[1] = 'O';
s[2] = 'M';
s[3] = '\0';
*error = s;
s[0] = 'O';
s[1] = 'O';
s[2] = 'M';
s[3] = '\0';
*err = s;
goto clean;
}
@ -787,7 +786,7 @@ clean:
static struct buffer query_parse_method_call(
char *s, size_t len, struct buffer buff,
struct invocation *invocation, const char **error)
struct invocation *invocation, const char **err)
{
unsigned i;
size_t _len;
@ -798,13 +797,13 @@ static struct buffer query_parse_method_call(
invocation->func = NULL;
buff = query_get_ident(s, len, buff, &func_name, &_len, error);
if (*error)
buff = query_get_ident(s, len, buff, &func_name, &_len, err);
if (*err)
return buff;
buff = query_chomp(buff);
buff = query_expect_char(s, len, buff, '(', error);
if (*error)
buff = query_expect_char(s, len, buff, '(', err);
if (*err)
goto clean;
while (rf->name)
@ -820,7 +819,7 @@ static struct buffer query_parse_method_call(
if (!invocation->func)
{
query_raise_unknown_function(s, len,
buff.offset, func_name, _len, error);
buff.offset, func_name, _len, err);
goto clean;
}
@ -830,29 +829,29 @@ static struct buffer query_parse_method_call(
if (argi >= QUERY_MAX_ARGS)
{
strlcpy(s, "Too many arguments in function call.", len);
*error = s;
*err = s;
goto clean;
}
buff = query_parse_argument(s, len, buff, &args[argi], error);
buff = query_parse_argument(s, len, buff, &args[argi], err);
if (*error)
if (*err)
goto clean;
argi++;
buff = query_chomp(buff);
buff = query_expect_char(s, len, buff, ',', error);
buff = query_expect_char(s, len, buff, ',', err);
if (*error)
if (*err)
{
*error = NULL;
*err = NULL;
break;
}
buff = query_chomp(buff);
}
buff = query_expect_char(s, len, buff, ')', error);
buff = query_expect_char(s, len, buff, ')', err);
if (*error)
if (*err)
goto clean;
invocation->argc = argi;
@ -861,11 +860,11 @@ static struct buffer query_parse_method_call(
if (!invocation->argv)
{
s[0] = 'O';
s[1] = 'O';
s[2] = 'M';
s[3] = '\0';
*error = s;
s[0] = 'O';
s[1] = 'O';
s[2] = 'M';
s[3] = '\0';
*err = s;
goto clean;
}
memcpy(invocation->argv, args,
@ -898,55 +897,55 @@ void libretrodb_query_free(void *q)
}
void *libretrodb_query_compile(libretrodb_t *db,
const char *query, size_t len, const char **error_string)
const char *query, size_t len, const char **err_string)
{
struct buffer buff;
/* TODO/FIXME - static local variable */
static char tmp_error_buff [MAX_ERROR_LEN] = {0};
struct query *q = (struct query*)malloc(sizeof(*q));
size_t error_buff_len = sizeof(tmp_error_buff);
static char tmp_err_buff [MAX_ERROR_LEN] = {0};
struct query *q = (struct query*)malloc(sizeof(*q));
size_t err_buff_len = sizeof(tmp_err_buff);
if (!q)
return NULL;
q->ref_count = 1;
q->root.argc = 0;
q->root.func = NULL;
q->root.argv = NULL;
q->ref_count = 1;
q->root.argc = 0;
q->root.func = NULL;
q->root.argv = NULL;
buff.data = query;
buff.len = len;
buff.offset = 0;
*error_string = NULL;
buff.data = query;
buff.len = len;
buff.offset = 0;
*err_string = NULL;
buff = query_chomp(buff);
if (query_peek(buff, "{", STRLEN_CONST("{")))
{
buff = query_parse_table(tmp_error_buff,
error_buff_len, buff, &q->root, error_string);
if (*error_string)
buff = query_parse_table(tmp_err_buff,
err_buff_len, buff, &q->root, err_string);
if (*err_string)
goto error;
}
else if (ISALPHA((int)buff.data[buff.offset]))
buff = query_parse_method_call(tmp_error_buff,
error_buff_len,
buff, &q->root, error_string);
buff = query_parse_method_call(tmp_err_buff,
err_buff_len,
buff, &q->root, err_string);
buff = query_expect_eof(tmp_error_buff,
error_buff_len,
buff, error_string);
buff = query_expect_eof(tmp_err_buff,
err_buff_len,
buff, err_string);
if (*error_string)
if (*err_string)
goto error;
if (!q->root.func)
{
snprintf(tmp_error_buff, error_buff_len,
snprintf(tmp_err_buff, err_buff_len,
"%" PRIu64 "::Unexpected EOF",
(uint64_t)buff.offset
);
*error_string = tmp_error_buff;
*err_string = tmp_err_buff;
goto error;
}

View File

@ -6663,7 +6663,7 @@ static int action_ok_open_picker(const char *path,
#ifdef HAVE_WIFI
static void wifi_menu_refresh_callback(retro_task_t *task,
void *task_data,
void *user_data, const char *error)
void *user_data, const char *err)
{
struct menu_state *menu_st = menu_state_get_ptr();
@ -6713,7 +6713,7 @@ static int action_ok_netplay_connect_room(const char *path, const char *label,
}
static void netplay_refresh_rooms_cb(retro_task_t *task, void *task_data,
void *user_data, const char *error)
void *user_data, const char *err)
{
char *room_data = NULL;
const char *path = NULL;
@ -6735,9 +6735,9 @@ static void netplay_refresh_rooms_cb(retro_task_t *task, void *task_data,
&& !string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_NETPLAY)))
return;
if (error)
if (err)
{
RARCH_ERR("[Netplay] %s: %s.\n", msg_hash_to_str(MSG_DOWNLOAD_FAILED), error);
RARCH_ERR("[Netplay] %s: %s.\n", msg_hash_to_str(MSG_DOWNLOAD_FAILED), err);
goto done;
}
if (!data || !data->data || !data->len || data->status != 200)

View File

@ -6377,7 +6377,7 @@ static int menu_displaylist_parse_playlist_generic(
#ifdef HAVE_BLUETOOTH
static void bluetooth_scan_callback(retro_task_t *task,
void *task_data, void *user_data, const char *error)
void *task_data, void *user_data, const char *err)
{
unsigned i;
struct string_list *device_list = NULL;
@ -6419,7 +6419,7 @@ static void bluetooth_scan_callback(retro_task_t *task,
#if defined(HAVE_NETWORKING) && defined(HAVE_WIFI)
static void wifi_scan_callback(retro_task_t *task,
void *task_data,
void *user_data, const char *error)
void *user_data, const char *err)
{
struct menu_state *menu_st = menu_state_get_ptr();
menu_st->flags |= MENU_ST_FLAG_PREVENT_POPULATE

View File

@ -146,11 +146,11 @@ static void handle_discord_ready(const DiscordUser* connectedUser)
}
static void handle_discord_disconnected(int errcode, const char *msg) { }
static void handle_discord_error(int errcode, const char *msg) { }
static void handle_discord_err(int errcode, const char *msg) { }
static void handle_discord_spectate(const char *secret) { }
static void handle_discord_join_cb(retro_task_t *task, void *task_data,
void *user_data, const char *error)
void *user_data, const char *err)
{
char hostname[512];
struct netplay_room *room;
@ -158,7 +158,7 @@ static void handle_discord_join_cb(retro_task_t *task, void *task_data,
http_transfer_data_t *data = (http_transfer_data_t*)task_data;
discord_state_t *discord_st = &discord_state_st;
if (error)
if (err)
goto done;
if (!data || !data->data || !data->len)
goto done;
@ -420,7 +420,7 @@ void discord_init(const char *discord_app_id, char *args)
handlers.ready = handle_discord_ready;
handlers.disconnected = handle_discord_disconnected;
handlers.errored = handle_discord_error;
handlers.errored = handle_discord_err;
handlers.joinGame = handle_discord_join;
handlers.spectateGame = handle_discord_spectate;
handlers.joinRequest = handle_discord_join_request;

View File

@ -322,7 +322,7 @@ static bool natt_parse_desc_node(rxml_node_t *node,
}
static void natt_query_device_cb(retro_task_t *task, void *task_data,
void *user_data, const char *error)
void *user_data, const char *err)
{
char *xml = NULL;
rxml_document_t *document = NULL;
@ -332,7 +332,7 @@ static void natt_query_device_cb(retro_task_t *task, void *task_data,
*device->control = '\0';
*device->service_type = '\0';
if (error)
if (err)
goto done;
if (!data || !data->data || !data->len)
goto done;
@ -429,7 +429,7 @@ static bool natt_parse_external_address_node(rxml_node_t *node,
}
static void natt_external_address_cb(retro_task_t *task, void *task_data,
void *user_data, const char *error)
void *user_data, const char *err)
{
char *xml = NULL;
rxml_document_t *document = NULL;
@ -438,7 +438,7 @@ static void natt_external_address_cb(retro_task_t *task, void *task_data,
memset(&device->ext_addr, 0, sizeof(device->ext_addr));
if (error)
if (err)
goto done;
if (!data || !data->data || !data->len)
goto done;
@ -512,7 +512,7 @@ static bool natt_parse_open_port_node(rxml_node_t *node,
}
static void natt_open_port_cb(retro_task_t *task, void *task_data,
void *user_data, const char *error)
void *user_data, const char *err)
{
char *xml = NULL;
rxml_document_t *document = NULL;
@ -522,7 +522,7 @@ static void natt_open_port_cb(retro_task_t *task, void *task_data,
request->success = false;
if (error)
if (err)
goto done;
if (!data || !data->data || !data->len)
goto done;
@ -553,7 +553,7 @@ done:
}
static void natt_close_port_cb(retro_task_t *task, void *task_data,
void *user_data, const char *error)
void *user_data, const char *err)
{
http_transfer_data_t *data = (http_transfer_data_t*)task_data;
struct natt_request *request = (struct natt_request*)user_data;
@ -561,7 +561,7 @@ static void natt_close_port_cb(retro_task_t *task, void *task_data,
request->success = false;
if (error)
if (err)
goto done;
if (!data || !data->data || !data->len)
goto done;

View File

@ -2497,7 +2497,7 @@ ssize_t netplay_recv(struct socket_buffer *sbuf, int sockfd,
void *buf, size_t len)
{
ssize_t recvd;
bool error = false;
bool err = false;
if (buf_unread(sbuf) >= len || !buf_remaining(sbuf))
goto copy;
@ -2505,11 +2505,11 @@ ssize_t netplay_recv(struct socket_buffer *sbuf, int sockfd,
/* Receive whatever we can into the buffer */
if (sbuf->end >= sbuf->start)
{
recvd = socket_receive_all_nonblocking(sockfd, &error,
recvd = socket_receive_all_nonblocking(sockfd, &err,
sbuf->data + sbuf->end, sbuf->bufsz - sbuf->end -
((sbuf->start == 0) ? 1 : 0));
if (recvd < 0 || error)
if (recvd < 0 || err)
return -1;
sbuf->end += recvd;
@ -2520,11 +2520,11 @@ ssize_t netplay_recv(struct socket_buffer *sbuf, int sockfd,
if (sbuf->start > 1 && buf_unread(sbuf) < len)
{
error = false;
recvd = socket_receive_all_nonblocking(sockfd, &error,
err = false;
recvd = socket_receive_all_nonblocking(sockfd, &err,
sbuf->data, sbuf->start - 1);
if (recvd < 0 || error)
if (recvd < 0 || err)
return -1;
sbuf->end += recvd;
@ -2534,10 +2534,10 @@ ssize_t netplay_recv(struct socket_buffer *sbuf, int sockfd,
else
{
recvd = socket_receive_all_nonblocking(
sockfd, &error, sbuf->data + sbuf->end,
sockfd, &err, sbuf->data + sbuf->end,
sbuf->start - sbuf->end - 1);
if (recvd < 0 || error)
if (recvd < 0 || err)
return -1;
sbuf->end += recvd;
@ -3256,14 +3256,14 @@ static void netplay_handle_frame_hash(netplay_t *netplay,
* handle_connection
* @netplay : pointer to netplay object
* @addr : value of pointer is set to the address of the peer on a completed connection
* @error : value of pointer is set to true if a critical error occurs
* @err : value of pointer is set to true if a critical error occurs
*
* Accepts a new client connection.
*
* Returns: fd of a new connection or -1 if there was no new connection.
*/
static int handle_connection(netplay_t *netplay, netplay_address_t *addr,
bool *error)
bool *err)
{
struct sockaddr_storage their_addr;
socklen_t addr_size = sizeof(their_addr);
@ -3272,7 +3272,7 @@ static int handle_connection(netplay_t *netplay, netplay_address_t *addr,
if (new_fd < 0)
{
if (!isagain(new_fd))
*error = true;
*err = true;
return -1;
}
@ -3315,7 +3315,7 @@ static int handle_connection(netplay_t *netplay, netplay_address_t *addr,
if (!socket_nonblock(new_fd))
{
socket_close(new_fd);
*error = true;
*err = true;
return -1;
}
@ -3347,7 +3347,7 @@ static bool netplay_tunnel_connect(int fd, const struct addrinfo *addr)
* handle_mitm_connection
* @netplay : pointer to netplay object
* @addr : value of pointer is set to the address of the peer on a completed connection
* @error : value of pointer is set to true if a critical error occurs
* @err : value of pointer is set to true if a critical error occurs
*
* Do three things here.
* 1: Check if any pending tunnel connection is ready.
@ -3359,7 +3359,7 @@ static bool netplay_tunnel_connect(int fd, const struct addrinfo *addr)
* Returns: fd of a new completed connection or -1 if no connection was completed.
*/
static int handle_mitm_connection(netplay_t *netplay, netplay_address_t *addr,
bool *error)
bool *err)
{
size_t i;
int new_fd = -1;
@ -3438,7 +3438,7 @@ static int handle_mitm_connection(netplay_t *netplay, netplay_address_t *addr,
len = sizeof(netplay->mitm_handler->id_buf) -
netplay->mitm_handler->id_recvd;
recvd = socket_receive_all_nonblocking(netplay->listen_fd, error,
recvd = socket_receive_all_nonblocking(netplay->listen_fd, err,
(((uint8_t*)&netplay->mitm_handler->id_buf) +
netplay->mitm_handler->id_recvd),
len);
@ -3460,7 +3460,7 @@ static int handle_mitm_connection(netplay_t *netplay, netplay_address_t *addr,
size_t len = sizeof(netplay->mitm_handler->addr_buf) -
netplay->mitm_handler->addr_recvd;
ssize_t recvd = socket_receive_all_nonblocking(
netplay->listen_fd, error,
netplay->listen_fd, err,
(((uint8_t*)&netplay->mitm_handler->addr_buf) +
netplay->mitm_handler->addr_recvd),
len);
@ -3620,7 +3620,7 @@ critical_failure:
if (new_fd >= 0)
socket_close(new_fd);
*error = true;
*err = true;
return -1;
}
@ -3737,13 +3737,13 @@ static bool netplay_sync_pre_frame(netplay_t *netplay)
{
int new_fd = -1;
netplay_address_t new_addr = {0};
bool server_error = false;
bool server_err = false;
if (netplay->mitm_handler)
new_fd = handle_mitm_connection(netplay, &new_addr, &server_error);
new_fd = handle_mitm_connection(netplay, &new_addr, &server_err);
else
new_fd = handle_connection(netplay, &new_addr, &server_error);
if (server_error)
new_fd = handle_connection(netplay, &new_addr, &server_err);
if (server_err)
{
ret = false;
goto process;
@ -8465,7 +8465,7 @@ size_t audio_sample_batch_net(const int16_t *data, size_t frames)
}
static void netplay_announce_cb(retro_task_t *task, void *task_data,
void *user_data, const char *error)
void *user_data, const char *err)
{
char *buf, *buf_data;
size_t remaining;
@ -8481,7 +8481,7 @@ static void netplay_announce_cb(retro_task_t *task, void *task_data,
net_st->data->next_announce =
cpu_features_get_time_usec() + NETPLAY_ANNOUNCE_TIME;
if (error || !data || !data->data || !data->len || data->status != 200)
if (err || !data || !data->data || !data->len || data->status != 200)
{
RARCH_ERR("[Netplay] Failed to announce session to the lobby server.");
return;
@ -8733,7 +8733,7 @@ static void netplay_announce(netplay_t *netplay)
}
static void netplay_mitm_query_cb(retro_task_t *task, void *task_data,
void *user_data, const char *error)
void *user_data, const char *err)
{
char *buf, *buf_data;
size_t remaining;
@ -8741,7 +8741,7 @@ static void netplay_mitm_query_cb(retro_task_t *task, void *task_data,
net_driver_state_t *net_st = &networking_driver_st;
struct netplay_room *host_room = &net_st->host_room;
if (error || !data || !data->data || !data->len || data->status != 200)
if (err || !data || !data->data || !data->len || data->status != 200)
{
RARCH_ERR("[Netplay] Failed to query the lobby server for tunnel information.");
return;

View File

@ -239,11 +239,11 @@ static bool netplay_json_start_array(void* ctx)
return true;
}
static void netplay_rooms_error(void *context,
int line, int col, const char* error)
static void netplay_rooms_err(void *context,
int line, int col, const char* err)
{
RARCH_ERR("[Netplay] Error: Invalid JSON at line %d, column %d - %s.\n",
line, col, error);
line, col, err);
}
void netplay_rooms_free(void)
@ -294,7 +294,7 @@ int netplay_rooms_parse(const char *buf, size_t len)
NULL /* end_array_handler */,
netplay_json_boolean,
NULL /* null handler */,
netplay_rooms_error);
netplay_rooms_err);
return 0;
}

View File

@ -8514,15 +8514,15 @@ size_t retroarch_get_capabilities(enum rarch_capabilities type,
return _len;
}
void retroarch_fail(int error_code, const char *error)
void retroarch_fail(int err_code, const char *err)
{
global_t *global = global_get_ptr();
/* We cannot longjmp unless we're in retroarch_main_init().
* If not, something went very wrong, and we should
* just exit right away. */
strlcpy(global->error_string, error,
strlcpy(global->error_string, err,
sizeof(global->error_string));
longjmp(global->error_sjlj_context, error_code);
longjmp(global->error_sjlj_context, err_code);
}
/* Called on close content, checks if we need to also exit retroarch */

View File

@ -1008,7 +1008,7 @@ static void runahead_add_hooks(runloop_state_t *runloop_st)
/* Runahead Code */
static void runahead_error(runloop_state_t *runloop_st)
static void runahead_err(runloop_state_t *runloop_st)
{
runloop_st->flags &= ~RUNLOOP_FLAG_RUNAHEAD_AVAILABLE;
mylist_destroy(&runloop_st->runahead_save_state_list);
@ -1032,7 +1032,7 @@ static bool runahead_create(runloop_state_t *runloop_st)
if ( (runloop_st->runahead_save_state_size == 0)
|| !(runloop_st->flags & RUNLOOP_FLAG_RUNAHEAD_SAVE_STATE_SIZE_KNOWN))
{
runahead_error(runloop_st);
runahead_err(runloop_st);
return false;
}
@ -1051,7 +1051,7 @@ static bool runahead_save_state(runloop_state_t *runloop_st)
(retro_ctx_serialize_info_t*)runloop_st->runahead_save_state_list->data[0];
if (core_serialize_special(serialize_info))
return true;
runahead_error(runloop_st);
runahead_err(runloop_st);
}
return false;
}
@ -1069,7 +1069,7 @@ static bool runahead_load_state(runloop_state_t *runloop_st)
runloop_st->flags &= ~RUNLOOP_FLAG_INPUT_IS_DIRTY;
if (!ret)
runahead_error(runloop_st);
runahead_err(runloop_st);
return ret;
}
@ -1084,7 +1084,7 @@ static bool runahead_load_state_secondary(runloop_state_t *runloop_st, settings_
serialize_info->data_const, serialize_info->size))
{
runloop_st->flags &= ~RUNLOOP_FLAG_RUNAHEAD_SECONDARY_CORE_AVAILABLE;
runahead_error(runloop_st);
runahead_err(runloop_st);
return false;
}
@ -1145,7 +1145,7 @@ void runahead_run(void *data,
* support level */
if (!core_info_current_supports_runahead())
{
runahead_error(runloop_st);
runahead_err(runloop_st);
/* If core is incompatible with runahead,
* log a warning but do not spam OSD messages.
* Runahead menu entries are hidden when using

View File

@ -5551,7 +5551,7 @@ static enum runloop_state_enum runloop_check_state(
audio_driver_state_t *audio_st,
video_driver_state_t *video_st,
uico_driver_state_t *uico_st,
bool error_on_init,
bool err_on_init,
settings_t *settings,
retro_time_t current_time,
bool netplay_allow_pause,
@ -6141,7 +6141,7 @@ static enum runloop_state_enum runloop_check_state(
else if (!menu_driver_iterate(menu_st, p_disp, anim_get_ptr(),
settings, action, current_time))
{
if (error_on_init)
if (err_on_init)
{
content_ctx_info_t content_info = {0};
task_push_start_dummy_core(&content_info);

View File

@ -753,7 +753,7 @@ static bool content_file_extract_from_archive(
content_state_t *p_content,
const char *valid_exts,
const char **content_path,
char **error_string)
char **err_string)
{
const char *tmp_path_ptr = NULL;
char tmp_path[PATH_MAX_LENGTH];
@ -775,7 +775,7 @@ static bool content_file_extract_from_archive(
snprintf(msg, sizeof(msg), "%s: \"%s\".\n",
msg_hash_to_str(MSG_FAILED_TO_EXTRACT_CONTENT_FROM_COMPRESSED_FILE),
*content_path);
*error_string = strdup(msg);
*err_string = strdup(msg);
return false;
}
@ -917,7 +917,7 @@ static bool content_file_load(
struct string_list *content,
content_information_ctx_t *content_ctx,
enum msg_hash_enums *error_enum,
char **error_string,
char **err_string,
const struct retro_subsystem_info *special)
{
size_t i;
@ -980,7 +980,7 @@ static bool content_file_load(
snprintf(msg, sizeof(msg), "%s \"%s\"\n",
msg_hash_to_str(MSG_COULD_NOT_READ_CONTENT_FILE),
content_path);
*error_string = strdup(msg);
*err_string = strdup(msg);
return false;
}
}
@ -992,7 +992,7 @@ static bool content_file_load(
if ( content_compressed
&& !((content->elems[i].attr.i & BLCK_BLOCK_EXTRACT) != 0)
&& !content_file_extract_from_archive(content_ctx, p_content,
valid_exts, &content_path, error_string))
valid_exts, &content_path, err_string))
return false;
#endif
#ifdef __WINRT__
@ -1061,7 +1061,7 @@ static bool content_file_load(
snprintf(msg, sizeof(msg), "%s \"%s\". (during copy read or write)\n",
msg_hash_to_str(MSG_COULD_NOT_READ_CONTENT_FILE),
content_path);
*error_string = strdup(msg);
*err_string = strdup(msg);
return false;
}
@ -1148,7 +1148,7 @@ static const struct retro_subsystem_info *content_file_init_subsystem(
const struct retro_subsystem_info *subsystem_data,
size_t subsystem_current_count,
enum msg_hash_enums *error_enum,
char **error_string,
char **err_string,
bool *ret)
{
struct string_list *subsystem = path_get_subsystem_list();
@ -1163,7 +1163,7 @@ static const struct retro_subsystem_info *content_file_init_subsystem(
snprintf(msg, sizeof(msg),
"Failed to find subsystem \"%s\" in libretro implementation.\n",
path_get(RARCH_PATH_SUBSYSTEM));
*error_string = strdup(msg);
*err_string = strdup(msg);
*ret = false;
return NULL;
}
@ -1186,7 +1186,7 @@ static const struct retro_subsystem_info *content_file_init_subsystem(
"subsystem \"%s\", but %u content files were provided.\n",
special->num_roms, special->desc,
(unsigned)subsystem->size);
*error_string = strdup(msg);
*err_string = strdup(msg);
*ret = false;
return NULL;
}
@ -1200,7 +1200,7 @@ static const struct retro_subsystem_info *content_file_init_subsystem(
"but %u content files were provided.\n",
special->desc,
(unsigned)subsystem->size);
*error_string = strdup(msg);
*err_string = strdup(msg);
*ret = false;
return NULL;
}
@ -1212,8 +1212,7 @@ static const struct retro_subsystem_info *content_file_init_subsystem(
static void content_file_set_attributes(
struct string_list *content,
const struct retro_subsystem_info *special,
content_information_ctx_t *content_ctx,
char **error_string)
content_information_ctx_t *content_ctx)
{
struct string_list *subsystem = path_get_subsystem_list();
@ -1285,18 +1284,18 @@ static bool content_file_init(
content_state_t *p_content,
struct string_list *content,
enum msg_hash_enums *error_enum,
char **error_string)
char **err_string)
{
bool subsystem_path_is_empty = path_is_empty(RARCH_PATH_SUBSYSTEM);
bool ret = subsystem_path_is_empty;
const struct retro_subsystem_info *special = subsystem_path_is_empty ?
NULL : content_file_init_subsystem(content_ctx->subsystem.data,
content_ctx->subsystem.size, error_enum, error_string, &ret);
content_ctx->subsystem.size, error_enum, err_string, &ret);
if (!ret)
return false;
content_file_set_attributes(content, special, content_ctx, error_string);
content_file_set_attributes(content, special, content_ctx);
if (content->size > 0)
{
@ -1305,7 +1304,7 @@ static bool content_file_init(
{
p_content->content_list = file_list;
ret = content_file_load(p_content, content, content_ctx,
error_enum, error_string, special);
error_enum, err_string, special);
content_file_list_free_transient_data(p_content->content_list);
return ret;
@ -3017,7 +3016,7 @@ bool content_init(void)
enum msg_hash_enums error_enum = MSG_UNKNOWN;
content_state_t *p_content = content_state_get_ptr();
bool ret = true;
char *error_string = NULL;
char *err_string = NULL;
runloop_state_t *runloop_st = runloop_state_get_ptr();
rarch_system_info_t *sys_info = &runloop_st->system;
settings_t *settings = config_get_ptr();
@ -3098,7 +3097,7 @@ bool content_init(void)
if (string_list_initialize(&content))
{
if (!content_file_init(&content_ctx, p_content,
&content, &error_enum, &error_string))
&content, &error_enum, &err_string))
{
content_deinit();
ret = false;
@ -3142,19 +3141,19 @@ bool content_init(void)
}
}
if (error_string)
if (err_string)
{
if (ret)
RARCH_LOG("[Content] %s\n", error_string);
RARCH_LOG("[Content] %s\n", err_string);
else
RARCH_ERR("[Content] %s\n", error_string);
RARCH_ERR("[Content] %s\n", err_string);
/* Do not flush the message queue here
* > This allows any core-generated error messages
* to propagate through to the frontend */
runloop_msg_queue_push(error_string, strlen(error_string), 2, ret ? 1 : 180, false, NULL,
runloop_msg_queue_push(err_string, strlen(err_string), 2, ret ? 1 : 180, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
free(error_string);
free(err_string);
}
return ret;

View File

@ -168,7 +168,7 @@ typedef struct play_feature_delivery_switch_cores_handle
{
char *path_dir_libretro;
char *path_libretro_info;
char *error_msg;
char *err_msg;
core_updater_list_t* core_list;
retro_task_t *install_task;
size_t list_size;
@ -1910,8 +1910,8 @@ static void free_play_feature_delivery_switch_cores_handle(
if (pfd_switch_cores_handle->path_libretro_info)
free(pfd_switch_cores_handle->path_libretro_info);
if (pfd_switch_cores_handle->error_msg)
free(pfd_switch_cores_handle->error_msg);
if (pfd_switch_cores_handle->err_msg)
free(pfd_switch_cores_handle->err_msg);
core_updater_list_free(pfd_switch_cores_handle->core_list);
@ -2103,16 +2103,15 @@ static void task_play_feature_delivery_switch_cores_handler(
case PLAY_FEATURE_DELIVERY_SWITCH_CORES_WAIT_INSTALL:
{
bool install_complete = false;
const char* error_msg = NULL;
const char* err_msg = NULL;
/* > If task is running, check 'is finished' status
* > If task is NULL, then it is finished by
* definition */
if (pfd_switch_cores_handle->install_task)
{
uint8_t _flg = task_get_flags(pfd_switch_cores_handle->install_task);
error_msg = task_get_error(
uint8_t _flg = task_get_flags(pfd_switch_cores_handle->install_task);
err_msg = task_get_error(
pfd_switch_cores_handle->install_task);
if ((_flg & RETRO_TASK_FLG_FINISHED) > 0)
install_complete = true;
@ -2123,9 +2122,9 @@ static void task_play_feature_delivery_switch_cores_handler(
/* Check for installation errors
* > These should be considered 'serious', and
* will trigger the task to end early */
if (!string_is_empty(error_msg))
if (!string_is_empty(err_msg))
{
pfd_switch_cores_handle->error_msg = strdup(error_msg);
pfd_switch_cores_handle->err_msg = strdup(err_msg);
pfd_switch_cores_handle->install_task = NULL;
pfd_switch_cores_handle->status =
PLAY_FEATURE_DELIVERY_SWITCH_CORES_END;
@ -2155,8 +2154,8 @@ static void task_play_feature_delivery_switch_cores_handler(
if (pfd_switch_cores_handle->list_size > 0)
{
/* Check whether any installation errors occurred */
if (!string_is_empty(pfd_switch_cores_handle->error_msg))
task_title = pfd_switch_cores_handle->error_msg;
if (!string_is_empty(pfd_switch_cores_handle->err_msg))
task_title = pfd_switch_cores_handle->err_msg;
else
task_title = msg_hash_to_str(MSG_ALL_CORES_SWITCHED_PFD);
}
@ -2213,7 +2212,7 @@ void task_push_play_feature_delivery_switch_installed_cores(
/* Configure handle */
pfd_switch_cores_handle->path_dir_libretro = strdup(path_dir_libretro);
pfd_switch_cores_handle->path_libretro_info = strdup(path_libretro_info);
pfd_switch_cores_handle->error_msg = NULL;
pfd_switch_cores_handle->err_msg = NULL;
pfd_switch_cores_handle->core_list = core_updater_list_init();
pfd_switch_cores_handle->install_task = NULL;
pfd_switch_cores_handle->list_size = 0;