diff --git a/configuration.c b/configuration.c index af6ad3c3b7..5197b7dd29 100644 --- a/configuration.c +++ b/configuration.c @@ -1812,7 +1812,7 @@ bool config_load_override(void) /* Create a new config file from core_path */ new_conf = config_file_new(core_path); - /* If a core override exists, add it's location to append_config_path */ + /* If a core override exists, add its location to append_config_path */ if (new_conf) { if (settings->core_specific_config) diff --git a/file_path_special.c b/file_path_special.c index 4e097135ed..7b4eb549dc 100644 --- a/file_path_special.c +++ b/file_path_special.c @@ -127,7 +127,8 @@ void fill_pathname_abbreviate_special(char *out_path, * Keep application dir in front of home, moving app dir to a * new location inside home would break otherwise. */ - const char *candidates[3] = { application_dir, home, NULL }; /* ugly hack - use application_dir before filling it in. C89 reasons */ + /* ugly hack - use application_dir pointer before filling it in. C89 reasons */ + const char *candidates[3] = { application_dir, home, NULL }; const char *notations[3] = { ":", "~", NULL }; fill_pathname_application_path(application_dir, sizeof(application_dir)); diff --git a/gfx/drivers/xvideo.c b/gfx/drivers/xvideo.c index ed8828d7ff..9efabed9df 100644 --- a/gfx/drivers/xvideo.c +++ b/gfx/drivers/xvideo.c @@ -426,6 +426,7 @@ static void *xv_init(const video_info_t *video, const struct retro_game_geometry *geom = NULL; struct retro_system_av_info *av_info = NULL; xv_t *xv = (xv_t*)calloc(1, sizeof(*xv)); + XWindowAttributes target; if (!xv) return NULL; @@ -593,7 +594,6 @@ static void *xv_init(const video_info_t *video, if (!x11_create_input_context(xv->display, xv->window, &xv->xim, &xv->xic)) goto error; - XWindowAttributes target; XGetWindowAttributes(xv->display, xv->window, &target); calc_out_rect(xv->keep_aspect, &xv->vp, target.width, target.height); xv->vp.full_width = target.width; @@ -821,7 +821,7 @@ static bool xv_alive(void *data) break; case DestroyNotify: return false; - case MapNotify: // Find something that works better. + case MapNotify: /* Find something that works better. */ xv->focus = true; break; case UnmapNotify: diff --git a/gfx/video_state_python.c b/gfx/video_state_python.c index 4fffcaf128..b8e077b58e 100644 --- a/gfx/video_state_python.c +++ b/gfx/video_state_python.c @@ -299,13 +299,16 @@ static char *align_program(const char *program) py_state_t *py_state_new(const char *script, unsigned is_file, const char *pyclass) { + py_state_t *handle; + PyObject *hook; + RARCH_LOG("Initializing Python runtime ...\n"); PyImport_AppendInittab("rarch", &PyInit_Retro); Py_Initialize(); RARCH_LOG("Initialized Python runtime.\n"); - py_state_t *handle = (py_state_t*)calloc(1, sizeof(*handle)); - PyObject *hook = NULL; + handle = (py_state_t*)calloc(1, sizeof(*handle)); + hook = NULL; handle->main = PyImport_AddModule("__main__"); if (!handle->main) diff --git a/gfx/video_texture.h b/gfx/video_texture.h index 10db315e05..9531207a1c 100644 --- a/gfx/video_texture.h +++ b/gfx/video_texture.h @@ -22,7 +22,7 @@ enum texture_backend_type { TEXTURE_BACKEND_DEFAULT = 0, - TEXTURE_BACKEND_OPENGL, + TEXTURE_BACKEND_OPENGL }; #ifdef __cplusplus diff --git a/gfx/video_thread_wrapper.c b/gfx/video_thread_wrapper.c index 9cfcda634b..6585543483 100644 --- a/gfx/video_thread_wrapper.c +++ b/gfx/video_thread_wrapper.c @@ -622,8 +622,8 @@ static bool thread_init(thread_video_t *thr, const video_info_t *info, thread_send_and_wait(thr, &pkt); -// thr->send_cmd_func = thread_send_cmd; -// thr->wait_reply_func = thread_wait_reply; +/* thr->send_cmd_func = thread_send_cmd; */ +/* thr->wait_reply_func = thread_wait_reply; */ thr->send_and_wait = thread_send_and_wait; return pkt.data.b; diff --git a/gfx/video_thread_wrapper.h b/gfx/video_thread_wrapper.h index 656540be7a..2e01c7b8f4 100644 --- a/gfx/video_thread_wrapper.h +++ b/gfx/video_thread_wrapper.h @@ -194,8 +194,8 @@ typedef struct thread_video bool alpha_update; slock_t *alpha_lock; -// void (*send_cmd_func)(struct thread_video *, enum thread_cmd); -// void (*wait_reply_func)(struct thread_video *, enum thread_cmd); +/* void (*send_cmd_func)(struct thread_video *, enum thread_cmd); */ +/* void (*wait_reply_func)(struct thread_video *, enum thread_cmd); */ void (*send_and_wait)(struct thread_video *, thread_packet_t*); enum thread_cmd send_cmd; enum thread_cmd reply_cmd; diff --git a/input/drivers/sdl_input.c b/input/drivers/sdl_input.c index 5ce7f183df..df4a5ee23f 100644 --- a/input/drivers/sdl_input.c +++ b/input/drivers/sdl_input.c @@ -43,9 +43,11 @@ typedef struct sdl_input static void *sdl_input_init(void) { + settings_t *settings; + sdl_input_t *sdl; input_keymaps_init_keyboard_lut(rarch_key_map_sdl); - settings_t *settings = config_get_ptr(); - sdl_input_t *sdl = (sdl_input_t*)calloc(1, sizeof(*sdl)); + settings = config_get_ptr(); + sdl = (sdl_input_t*)calloc(1, sizeof(*sdl)); if (!sdl) return NULL; @@ -319,6 +321,7 @@ static void sdl_poll_mouse(sdl_input_t *sdl) static void sdl_input_poll(void *data) { sdl_input_t *sdl = (sdl_input_t*)data; + SDL_Event event; SDL_PumpEvents(); @@ -326,7 +329,6 @@ static void sdl_input_poll(void *data) sdl->joypad->poll(); sdl_poll_mouse(sdl); - SDL_Event event; #ifdef HAVE_SDL2 while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_KEYDOWN, SDL_MOUSEWHEEL) > 0) #else diff --git a/input/drivers/x11_input.c b/input/drivers/x11_input.c index b479f8aaf3..aab712e214 100644 --- a/input/drivers/x11_input.c +++ b/input/drivers/x11_input.c @@ -50,6 +50,7 @@ static void *x_input_init(void) { driver_t *driver = driver_get_ptr(); settings_t *settings = config_get_ptr(); + x11_input_t *x11; if (driver->display_type != RARCH_DISPLAY_X11) { @@ -57,7 +58,7 @@ static void *x_input_init(void) return NULL; } - x11_input_t *x11 = (x11_input_t*)calloc(1, sizeof(*x11)); + x11 = (x11_input_t*)calloc(1, sizeof(*x11)); if (!x11) return NULL; diff --git a/input/drivers_joypad/linuxraw_joypad.c b/input/drivers_joypad/linuxraw_joypad.c index 5467fdf5ea..973bbdce20 100644 --- a/input/drivers_joypad/linuxraw_joypad.c +++ b/input/drivers_joypad/linuxraw_joypad.c @@ -89,6 +89,8 @@ static bool linuxraw_joypad_init_pad(const char *path, struct linuxraw_joypad *p *pad->ident = '\0'; if (pad->fd >= 0) { + struct epoll_event event; + if (ioctl(pad->fd, JSIOCGNAME(sizeof(settings->input.device_names[0])), pad->ident) >= 0) { RARCH_LOG("[Device]: Found pad: %s on %s.\n", pad->ident, path); @@ -105,7 +107,6 @@ static bool linuxraw_joypad_init_pad(const char *path, struct linuxraw_joypad *p else RARCH_ERR("[Device]: Didn't find ident of %s.\n", path); - struct epoll_event event; event.events = EPOLLIN; event.data.ptr = pad; epoll_ctl(g_epoll, EPOLL_CTL_ADD, pad->fd, &event); diff --git a/input/drivers_joypad/sdl_joypad.c b/input/drivers_joypad/sdl_joypad.c index edbc44102e..16c9ad016d 100644 --- a/input/drivers_joypad/sdl_joypad.c +++ b/input/drivers_joypad/sdl_joypad.c @@ -324,14 +324,17 @@ static bool sdl_joypad_button(unsigned port, uint16_t joykey) static int16_t sdl_joypad_axis(unsigned port, uint32_t joyaxis) { + sdl_joypad_t *pad; + int16_t val; + if (joyaxis == AXIS_NONE) return 0; - sdl_joypad_t *pad = (sdl_joypad_t*)&sdl_pads[port]; + pad = (sdl_joypad_t*)&sdl_pads[port]; if (!pad->joypad) return false; - int16_t val = 0; + val = 0; if (AXIS_NEG_GET(joyaxis) < pad->num_axes) { val = sdl_pad_get_axis(pad, AXIS_NEG_GET(joyaxis)); @@ -380,11 +383,11 @@ static void sdl_joypad_poll(void) #ifdef HAVE_SDL2 static bool sdl_joypad_set_rumble(unsigned pad, enum retro_rumble_effect effect, uint16_t strength) { + sdl_joypad_t *joypad = (sdl_joypad_t*)&sdl_pads[pad]; + SDL_HapticEffect efx; memset(&efx, 0, sizeof(efx)); - sdl_joypad_t *joypad = (sdl_joypad_t*)&sdl_pads[pad]; - if (!joypad->joypad || !joypad->haptic) return false; diff --git a/input/drivers_joypad/udev_joypad.c b/input/drivers_joypad/udev_joypad.c index cd16299297..4932fc0a62 100644 --- a/input/drivers_joypad/udev_joypad.c +++ b/input/drivers_joypad/udev_joypad.c @@ -410,12 +410,15 @@ static void udev_joypad_destroy(void) static void udev_joypad_handle_hotplug(void) { struct udev_device *dev = udev_monitor_receive_device(g_udev_mon); + const char *val; + const char *action; + const char *devnode; if (!dev) return; - const char *val = udev_device_get_property_value(dev, "ID_INPUT_JOYSTICK"); - const char *action = udev_device_get_action(dev); - const char *devnode = udev_device_get_devnode(dev); + val = udev_device_get_property_value(dev, "ID_INPUT_JOYSTICK"); + action = udev_device_get_action(dev); + devnode = udev_device_get_devnode(dev); if (!val || strcmp(val, "1") || !devnode) goto end; diff --git a/input/input_autodetect.c b/input/input_autodetect.c index 51386b4701..949438e01b 100644 --- a/input/input_autodetect.c +++ b/input/input_autodetect.c @@ -30,7 +30,7 @@ enum AUTODETECT_MATCH_PID, AUTODETECT_MATCH_IDENT, AUTODETECT_MATCH_DRIVER, - AUTODETECT_MATCH_NAME, + AUTODETECT_MATCH_NAME }; static void input_autoconfigure_joypad_conf(config_file_t *conf, diff --git a/input/input_keymaps.c b/input/input_keymaps.c index 2d4294d686..a7e4538ec0 100644 --- a/input/input_keymaps.c +++ b/input/input_keymaps.c @@ -460,8 +460,8 @@ const struct rarch_key_map rarch_key_map_sdl[] = { { SDLK_RALT, RETROK_RALT }, { SDLK_LALT, RETROK_LALT }, #ifdef HAVE_SDL2 - //{ ?, RETROK_RMETA }, - //{ ?, RETROK_LMETA }, + /* { ?, RETROK_RMETA }, */ + /* { ?, RETROK_LMETA }, */ { SDLK_LGUI, RETROK_LSUPER }, { SDLK_RGUI, RETROK_RSUPER }, #else @@ -715,13 +715,13 @@ const struct rarch_key_map rarch_key_map_linux[] = { { KEY_PAUSE, RETROK_PAUSE }, { KEY_ESC, RETROK_ESCAPE }, { KEY_SPACE, RETROK_SPACE }, - //{ ?, RETROK_EXCLAIM }, - //{ ?, RETROK_QUOTEDBL }, - //{ ?, RETROK_HASH }, + /* { ?, RETROK_EXCLAIM }, */ + /* { ?, RETROK_QUOTEDBL }, */ + /* { ?, RETROK_HASH }, */ #ifndef ANDROID { KEY_DOLLAR, RETROK_DOLLAR }, #endif - //{ ?, RETROK_AMPERSAND }, + /* { ?, RETROK_AMPERSAND }, */ { KEY_APOSTROPHE, RETROK_QUOTE }, { KEY_KPLEFTPAREN, RETROK_LEFTPAREN }, { KEY_KPRIGHTPAREN, RETROK_RIGHTPAREN }, @@ -741,18 +741,18 @@ const struct rarch_key_map rarch_key_map_linux[] = { { KEY_7, RETROK_7 }, { KEY_8, RETROK_8 }, { KEY_9, RETROK_9 }, - //{ KEY_COLON, RETROK_COLON }, + /* { KEY_COLON, RETROK_COLON }, */ { KEY_SEMICOLON, RETROK_SEMICOLON }, - //{ KEY_LESS, RETROK_LESS }, + /* { KEY_LESS, RETROK_LESS }, */ { KEY_EQUAL, RETROK_EQUALS }, - //{ KEY_GREATER, RETROK_GREATER }, + /* { KEY_GREATER, RETROK_GREATER }, */ { KEY_QUESTION, RETROK_QUESTION }, - //{ KEY_AT, RETROK_AT }, + /* { KEY_AT, RETROK_AT }, */ { KEY_LEFTBRACE, RETROK_LEFTBRACKET }, { KEY_BACKSLASH, RETROK_BACKSLASH }, { KEY_RIGHTBRACE, RETROK_RIGHTBRACKET }, - //{ ?, RETROK_CARET }, - //{ ?, RETROK_UNDERSCORE }, + /* { ?, RETROK_CARET }, */ + /* { ?, RETROK_UNDERSCORE }, */ { KEY_GRAVE, RETROK_BACKQUOTE }, { KEY_A, RETROK_a }, { KEY_B, RETROK_b }, @@ -831,8 +831,8 @@ const struct rarch_key_map rarch_key_map_linux[] = { { KEY_LEFTCTRL, RETROK_LCTRL }, { KEY_RIGHTALT, RETROK_RALT }, { KEY_LEFTALT, RETROK_LALT }, - //{ ?, RETROK_RMETA }, - //{ ?, RETROK_LMETA }, + /* { ?, RETROK_RMETA }, */ + /* { ?, RETROK_LMETA }, */ { KEY_LEFTMETA, RETROK_LSUPER }, { KEY_RIGHTMETA, RETROK_RSUPER }, { KEY_MODE, RETROK_MODE }, @@ -855,21 +855,21 @@ const struct rarch_key_map rarch_key_map_linux[] = { const struct rarch_key_map rarch_key_map_apple_hid[] = { { KEY_Delete, RETROK_BACKSPACE }, { KEY_Tab, RETROK_TAB }, - //RETROK_CLEAR }, + /* { ?, RETROK_CLEAR }, */ { KEY_Enter, RETROK_RETURN }, { KEY_Pause, RETROK_PAUSE }, { KEY_Escape, RETROK_ESCAPE }, { KEY_Space, RETROK_SPACE }, - //RETROK_EXCLAIM }, - //RETROK_QUOTEDBL }, - //RETROK_HASH }, - //RETROK_DOLLAR }, - //RETROK_AMPERSAND }, + /* { ?, RETROK_EXCLAIM }, */ + /* { ?, RETROK_QUOTEDBL }, */ + /* { ?, RETROK_HASH }, */ + /* { ?, RETROK_DOLLAR }, */ + /* { ?, RETROK_AMPERSAND }, */ { KEY_Quote, RETROK_QUOTE }, - //RETROK_LEFTPAREN }, - //RETROK_RIGHTPAREN }, - //RETROK_ASTERISK }, - //RETROK_PLUS }, + /* { ?, RETROK_LEFTPAREN }, */ + /* { ?, RETROK_RIGHTPAREN }, */ + /* { ?, RETROK_ASTERISK }, */ + /* { ?, RETROK_PLUS }, */ { KEY_Comma, RETROK_COMMA }, { KEY_Minus, RETROK_MINUS }, { KEY_Period, RETROK_PERIOD }, @@ -884,18 +884,18 @@ const struct rarch_key_map rarch_key_map_apple_hid[] = { { KEY_7, RETROK_7 }, { KEY_8, RETROK_8 }, { KEY_9, RETROK_9 }, - //RETROK_COLON }, + /* { ?, RETROK_COLON }, */ { KEY_Semicolon, RETROK_SEMICOLON }, - //RETROK_LESS }, + /* { ?, RETROK_LESS }, */ { KEY_Equals, RETROK_EQUALS }, - //RETROK_GREATER }, - //RETROK_QUESTION }, - //RETROK_AT }, + /* { ?, RETROK_GREATER }, */ + /* { ?, RETROK_QUESTION }, */ + /* { ?, RETROK_AT }, */ { KEY_LeftBracket, RETROK_LEFTBRACKET }, { KEY_Backslash, RETROK_BACKSLASH }, { KEY_RightBracket, RETROK_RIGHTBRACKET }, - //RETROK_CARET }, - //RETROK_UNDERSCORE }, + /* { ?, RETROK_CARET }, */ + /* { ?, RETROK_UNDERSCORE }, */ { KEY_Grave, RETROK_BACKQUOTE }, { KEY_A, RETROK_a }, { KEY_B, RETROK_b }, @@ -969,9 +969,9 @@ const struct rarch_key_map rarch_key_map_apple_hid[] = { { KEY_F14, RETROK_F14 }, { KEY_F15, RETROK_F15 }, - //RETROK_NUMLOCK }, + /* { ?, RETROK_NUMLOCK }, */ { KEY_CapsLock, RETROK_CAPSLOCK }, - //RETROK_SCROLLOCK }, + /* { ?, RETROK_SCROLLOCK }, */ { KEY_RightShift, RETROK_RSHIFT }, { KEY_LeftShift, RETROK_LSHIFT }, { KEY_RightControl, RETROK_RCTRL }, @@ -980,19 +980,19 @@ const struct rarch_key_map rarch_key_map_apple_hid[] = { { KEY_LeftAlt, RETROK_LALT }, { KEY_RightGUI, RETROK_RMETA }, { KEY_LeftGUI, RETROK_RMETA }, - //RETROK_LSUPER }, - //RETROK_RSUPER }, - //RETROK_MODE }, - //RETROK_COMPOSE }, + /* { ?, RETROK_LSUPER }, */ + /* { ?, RETROK_RSUPER }, */ + /* { ?, RETROK_MODE }, */ + /* { ?, RETROK_COMPOSE }, */ - //RETROK_HELP }, + /* { ?, RETROK_HELP }, */ { KEY_PrintScreen, RETROK_PRINT }, - //RETROK_SYSREQ }, - //RETROK_BREAK }, + /* { ?, RETROK_SYSREQ }, */ + /* { ?, RETROK_BREAK }, */ { KEY_Menu, RETROK_MENU }, - //RETROK_POWER }, - //RETROK_EURO }, - //RETROK_UNDO }, + /* { ?, RETROK_POWER }, */ + /* { ?, RETROK_EURO }, */ + /* { ?, RETROK_UNDO }, */ { 0, RETROK_UNKNOWN } }; #endif diff --git a/libretro-common/file/file_extract.c b/libretro-common/file/file_extract.c index 6586cc7888..083e19b99e 100644 --- a/libretro-common/file/file_extract.c +++ b/libretro-common/file/file_extract.c @@ -673,7 +673,7 @@ struct zip_extract_userdata enum { ZLIB_MODE_UNCOMPRESSED = 0, - ZLIB_MODE_DEFLATE = 8, + ZLIB_MODE_DEFLATE = 8 } zlib_compression_mode; static int zip_extract_cb(const char *name, const char *valid_exts, diff --git a/libretro-common/formats/png/rpng_common.h b/libretro-common/formats/png/rpng_common.h index bd613800b3..676e68f2fd 100644 --- a/libretro-common/formats/png/rpng_common.h +++ b/libretro-common/formats/png/rpng_common.h @@ -58,7 +58,7 @@ enum png_line_filter PNG_FILTER_SUB, PNG_FILTER_UP, PNG_FILTER_AVERAGE, - PNG_FILTER_PAETH, + PNG_FILTER_PAETH }; enum png_ihdr_color_type @@ -67,7 +67,7 @@ enum png_ihdr_color_type PNG_IHDR_COLOR_RGB = 2, PNG_IHDR_COLOR_PLT = 3, PNG_IHDR_COLOR_GRAY_ALPHA = 4, - PNG_IHDR_COLOR_RGBA = 6, + PNG_IHDR_COLOR_RGBA = 6 }; struct adam7_pass diff --git a/libretro-common/formats/png/rpng_decode.h b/libretro-common/formats/png/rpng_decode.h index 1bf06d269e..e63f43ab89 100644 --- a/libretro-common/formats/png/rpng_decode.h +++ b/libretro-common/formats/png/rpng_decode.h @@ -28,7 +28,7 @@ enum png_process_code PNG_PROCESS_ERROR = -2, PNG_PROCESS_ERROR_END = -1, PNG_PROCESS_NEXT = 0, - PNG_PROCESS_END = 1, + PNG_PROCESS_END = 1 }; enum png_chunk_type png_chunk_type(const struct png_chunk *chunk); diff --git a/libretro-common/formats/png/rpng_encode.c b/libretro-common/formats/png/rpng_encode.c index 7efb1773e7..67a391fe2a 100644 --- a/libretro-common/formats/png/rpng_encode.c +++ b/libretro-common/formats/png/rpng_encode.c @@ -258,48 +258,50 @@ static bool rpng_save_image(const char *path, * This is probably not very optimal, but it's very * simple to implement. */ - unsigned none_score = count_sad(rgba_line, width * bpp); - unsigned up_score = filter_up(up_filtered, rgba_line, prev_encoded, width, bpp); - unsigned sub_score = filter_sub(sub_filtered, rgba_line, width, bpp); - unsigned avg_score = filter_avg(avg_filtered, rgba_line, prev_encoded, width, bpp); - unsigned paeth_score = filter_paeth(paeth_filtered, rgba_line, prev_encoded, width, bpp); - - uint8_t filter = 0; - unsigned min_sad = none_score; - const uint8_t *chosen_filtered = rgba_line; - - if (sub_score < min_sad) { - filter = 1; - chosen_filtered = sub_filtered; - min_sad = sub_score; + unsigned none_score = count_sad(rgba_line, width * bpp); + unsigned up_score = filter_up(up_filtered, rgba_line, prev_encoded, width, bpp); + unsigned sub_score = filter_sub(sub_filtered, rgba_line, width, bpp); + unsigned avg_score = filter_avg(avg_filtered, rgba_line, prev_encoded, width, bpp); + unsigned paeth_score = filter_paeth(paeth_filtered, rgba_line, prev_encoded, width, bpp); + + uint8_t filter = 0; + unsigned min_sad = none_score; + const uint8_t *chosen_filtered = rgba_line; + + if (sub_score < min_sad) + { + filter = 1; + chosen_filtered = sub_filtered; + min_sad = sub_score; + } + + if (up_score < min_sad) + { + filter = 2; + chosen_filtered = up_filtered; + min_sad = up_score; + } + + if (avg_score < min_sad) + { + filter = 3; + chosen_filtered = avg_filtered; + min_sad = avg_score; + } + + if (paeth_score < min_sad) + { + filter = 4; + chosen_filtered = paeth_filtered; + min_sad = paeth_score; + } + + *encode_target++ = filter; + memcpy(encode_target, chosen_filtered, width * bpp); + + memcpy(prev_encoded, rgba_line, width * bpp); } - - if (up_score < min_sad) - { - filter = 2; - chosen_filtered = up_filtered; - min_sad = up_score; - } - - if (avg_score < min_sad) - { - filter = 3; - chosen_filtered = avg_filtered; - min_sad = avg_score; - } - - if (paeth_score < min_sad) - { - filter = 4; - chosen_filtered = paeth_filtered; - min_sad = paeth_score; - } - - *encode_target++ = filter; - memcpy(encode_target, chosen_filtered, width * bpp); - - memcpy(prev_encoded, rgba_line, width * bpp); } deflate_buf = (uint8_t*)malloc(encode_buf_size * 2); /* Just to be sure. */ diff --git a/libretro-common/include/file/file_extract.h b/libretro-common/include/file/file_extract.h index b44613c6b5..7e16ff5e36 100644 --- a/libretro-common/include/file/file_extract.h +++ b/libretro-common/include/file/file_extract.h @@ -40,7 +40,7 @@ enum zlib_transfer_type ZLIB_TRANSFER_INIT, ZLIB_TRANSFER_ITERATE, ZLIB_TRANSFER_DEINIT, - ZLIB_TRANSFER_DEINIT_ERROR, + ZLIB_TRANSFER_DEINIT_ERROR }; typedef struct zlib_transfer diff --git a/libretro-common/include/file/file_path.h b/libretro-common/include/file/file_path.h index 1a9db7f89b..e36f174d74 100644 --- a/libretro-common/include/file/file_path.h +++ b/libretro-common/include/file/file_path.h @@ -44,7 +44,7 @@ enum RARCH_COMPRESSED_FILE_IN_ARCHIVE, RARCH_COMPRESSED_ARCHIVE, RARCH_DIRECTORY, - RARCH_FILE_UNSUPPORTED, + RARCH_FILE_UNSUPPORTED }; diff --git a/libretro-common/rthreads/rthreads.c b/libretro-common/rthreads/rthreads.c index 632da982aa..f4d20fd61e 100644 --- a/libretro-common/rthreads/rthreads.c +++ b/libretro-common/rthreads/rthreads.c @@ -104,10 +104,11 @@ static void *thread_wrap(void *data_) sthread_t *sthread_create(void (*thread_func)(void*), void *userdata) { sthread_t *thread = (sthread_t*)calloc(1, sizeof(*thread)); + struct thread_data *data; if (!thread) return NULL; - struct thread_data *data = (struct thread_data*)calloc(1, sizeof(*data)); + data = (struct thread_data*)calloc(1, sizeof(*data)); if (!data) { free(thread); diff --git a/libretro-db/libretrodb.c b/libretro-db/libretrodb.c index 4c6887b4f6..c834e001cd 100644 --- a/libretro-db/libretrodb.c +++ b/libretro-db/libretrodb.c @@ -28,7 +28,7 @@ struct node_iter_ctx static struct rmsgpack_dom_value sentinal; -static inline off_t flseek(FILE *fp, int offset, int whence) +static INLINE off_t flseek(FILE *fp, int offset, int whence) { if (fseek(fp, offset, whence) != 0) return (off_t)-1; diff --git a/libretro-db/query.c b/libretro-db/query.c index ab958e0467..63c85f79f2 100644 --- a/libretro-db/query.c +++ b/libretro-db/query.c @@ -18,7 +18,7 @@ #undef MAX_ARGS #define MAX_ARGS 50 -static char tmp_error_buff [MAX_ERROR_LEN] = {}; +static char tmp_error_buff [MAX_ERROR_LEN] = {0}; struct buffer { diff --git a/libretro-db/rmsgpack.c b/libretro-db/rmsgpack.c index df1941643f..3138273328 100644 --- a/libretro-db/rmsgpack.c +++ b/libretro-db/rmsgpack.c @@ -55,13 +55,13 @@ static const uint8_t MPF_UINT64 = 0xcf; static const uint8_t MPF_NIL = 0xc0; -static inline ssize_t fpwrite(FILE *fp, const void *buf, size_t count) +static INLINE ssize_t fpwrite(FILE *fp, const void *buf, size_t count) { size_t num_written = fwrite(buf, 1, count, fp); return num_written != count ? -1 : (ssize_t)count; } -static inline ssize_t fpread(FILE *fp, void *buf, size_t count) +static INLINE ssize_t fpread(FILE *fp, void *buf, size_t count) { size_t num_read = fread(buf, 1, count, fp); return num_read != count && ferror(fp) ? -1 : (ssize_t)num_read; diff --git a/libretro-db/rmsgpack_dom.c b/libretro-db/rmsgpack_dom.c index 578d62183f..279b6c2071 100644 --- a/libretro-db/rmsgpack_dom.c +++ b/libretro-db/rmsgpack_dom.c @@ -246,7 +246,7 @@ void rmsgpack_dom_value_free(struct rmsgpack_dom_value *v) case RDT_INT: case RDT_BOOL: case RDT_UINT: - // Do nothing + /* Do nothing */ break; } } diff --git a/menu/cbs/menu_cbs_iterate.c b/menu/cbs/menu_cbs_iterate.c index 10e402044e..7d7c34ba98 100644 --- a/menu/cbs/menu_cbs_iterate.c +++ b/menu/cbs/menu_cbs_iterate.c @@ -182,7 +182,7 @@ static int action_iterate_help(char *s, size_t len, const char *label) snprintf(s, len, "Welcome to RetroArch\n" - " \n" // strtok_r doesn't split empty strings. + " \n" /* strtok_r doesn't split empty strings. */ "Basic Menu controls:\n" " Scroll (Up): %-20s\n" @@ -463,7 +463,7 @@ enum action_iterate_type ITERATE_TYPE_ZIP, ITERATE_TYPE_MESSAGE, ITERATE_TYPE_VIEWPORT, - ITERATE_TYPE_BIND, + ITERATE_TYPE_BIND }; static enum action_iterate_type action_iterate_type(uint32_t hash) diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index 0c91150d58..6d64e3c249 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -222,6 +222,7 @@ static int action_right_shader_filter_pass(unsigned type, const char *label, struct video_shader *shader = NULL; struct video_shader_pass *shader_pass = NULL; menu_handle_t *menu = menu_driver_get_ptr(); + unsigned delta = 1; if (!menu) return -1; @@ -232,7 +233,6 @@ static int action_right_shader_filter_pass(unsigned type, const char *label, if (!shader_pass) return -1; - unsigned delta = 1; shader_pass->filter = ((shader_pass->filter + delta) % 3); #endif return 0; diff --git a/menu/cbs/menu_cbs_start.c b/menu/cbs/menu_cbs_start.c index 7a1e5d9d61..ae2ef579fa 100644 --- a/menu/cbs/menu_cbs_start.c +++ b/menu/cbs/menu_cbs_start.c @@ -127,9 +127,9 @@ static int action_start_shader_action_preset_parameter(unsigned type, const char static int action_start_shader_pass(unsigned type, const char *label) { #ifdef HAVE_SHADER_MANAGER - hack_shader_pass = type - MENU_SETTINGS_SHADER_PASS_0; struct video_shader *shader = NULL; struct video_shader_pass *shader_pass = NULL; + hack_shader_pass = type - MENU_SETTINGS_SHADER_PASS_0; menu_handle_t *menu = menu_driver_get_ptr(); if (!menu) return -1; diff --git a/menu/drivers/null.c b/menu/drivers/null.c index 79d18717eb..4b8ddf8c6d 100644 --- a/menu/drivers/null.c +++ b/menu/drivers/null.c @@ -24,33 +24,33 @@ #include "../../general.h" menu_ctx_driver_t menu_ctx_null = { - NULL, // set_texture - NULL, // render_messagebox - NULL, // render - NULL, // frame - NULL, // init - NULL, // free - NULL, // context_reset - NULL, // context_destroy - NULL, // populate_entries - NULL, // toggle - NULL, // navigation_clear - NULL, // navigation_decrement - NULL, // navigation_increment - NULL, // navigation_set - NULL, // navigation_set_last - NULL, // navigation_descend_alphabet - NULL, // navigation_ascend_alphabet - NULL, // list_insert - NULL, // list_delete - NULL, // list_clear - NULL, // list_cache + NULL, /* set_texture */ + NULL, /* render_messagebox */ + NULL, /* render */ + NULL, /* frame */ + NULL, /* init */ + NULL, /* free */ + NULL, /* context_reset */ + NULL, /* context_destroy */ + NULL, /* populate_entries */ + NULL, /* toggle */ + NULL, /* navigation_clear */ + NULL, /* navigation_decrement */ + NULL, /* navigation_increment */ + NULL, /* navigation_set */ + NULL, /* navigation_set_last */ + NULL, /* navigation_descend_alphabet */ + NULL, /* navigation_ascend_alphabet */ + NULL, /* list_insert */ + NULL, /* list_delete */ + NULL, /* list_clear */ + NULL, /* list_cache */ NULL, /* list_get_selection */ - NULL, // list_get_size - NULL, // list_get_entry - NULL, // list_set_selection - NULL, // bind_init - NULL, // load_image + NULL, /* list_get_size */ + NULL, /* list_get_entry */ + NULL, /* list_set_selection */ + NULL, /* bind_init */ + NULL, /* load_image */ "null", NULL, }; diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 4af5664372..882a471f72 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -404,7 +404,7 @@ static void rgui_render(void) return; } - // if the framebuffer changed size, recache the background + /* if the framebuffer changed size, recache the background */ if (rgui->last_width != frame_buf->width || rgui->last_height != frame_buf->height) { fill_rect(frame_buf, 0, frame_buf->height, diff --git a/menu/intl/menu_hash_de.c b/menu/intl/menu_hash_de.c index 4e375a235c..13938b3644 100644 --- a/menu/intl/menu_hash_de.c +++ b/menu/intl/menu_hash_de.c @@ -471,7 +471,7 @@ const char *menu_hash_to_str_de(uint32_t hash) case MENU_LABEL_VALUE_CURSOR_MANAGER: return "Cursormanager"; case MENU_VALUE_MAIN_MENU: - return "Main Menu"; // Don't change. Breaks everything. (Would be: "Hauptmenü") + return "Main Menu"; /* Don't change. Breaks everything. (Would be: "Hauptmenü") */ case MENU_LABEL_VALUE_SETTINGS: return "Einstellungen"; /* FIXME */ case MENU_LABEL_VALUE_QUIT_RETROARCH: @@ -579,9 +579,9 @@ const char *menu_hash_to_str_de(uint32_t hash) case MENU_VALUE_SECONDS: return "Sekunden"; case MENU_VALUE_OFF: - return "OFF"; // Don't change. Needed for XMB atm. (Would be: "AN") + return "OFF"; /* Don't change. Needed for XMB atm. (Would be: "AN") */ case MENU_VALUE_ON: - return "ON"; // Don't change. Needed for XMB atm. (Would be: "AUS") + return "ON"; /* Don't change. Needed for XMB atm. (Would be: "AUS") */ case MENU_LABEL_VALUE_UPDATE_ASSETS: return "Aktualisiere Assets"; case MENU_LABEL_VALUE_UPDATE_CHEATS: diff --git a/menu/intl/menu_hash_fr.c b/menu/intl/menu_hash_fr.c index 4e4bf4e660..145dfdbde0 100644 --- a/menu/intl/menu_hash_fr.c +++ b/menu/intl/menu_hash_fr.c @@ -322,9 +322,9 @@ const char *menu_hash_to_str_fr(uint32_t hash) case MENU_LABEL_VALUE_PAL60_ENABLE: return "Utiliser le mode PAL60"; case MENU_LABEL_VALUE_VIDEO_VFILTER: - return "Deflicker"; // TODO + return "Deflicker"; /* TODO */ case MENU_LABEL_VALUE_VIDEO_VI_WIDTH: - return "Set VI Screen Width"; // TODO + return "Set VI Screen Width"; /* TODO */ case MENU_LABEL_VALUE_VIDEO_BLACK_FRAME_INSERTION: return "Inserer des images noires"; case MENU_LABEL_VALUE_SORT_SAVEFILES_ENABLE: diff --git a/menu/menu_entry.c b/menu/menu_entry.c index 66bb3ea793..ca37ca4687 100644 --- a/menu/menu_entry.c +++ b/menu/menu_entry.c @@ -94,8 +94,7 @@ enum menu_entry_type menu_entry_get_type(uint32_t i) setting = menu_entry_get_setting(i); - // XXX Really a special kind of ST_ACTION, but this should be - // changed + /* XXX Really a special kind of ST_ACTION, but this should be changed */ if (menu_setting_is_of_path_type(setting)) return MENU_ENTRY_PATH; diff --git a/menu/menu_entry.h b/menu/menu_entry.h index 7bef83b8f9..cc8e629096 100644 --- a/menu/menu_entry.h +++ b/menu/menu_entry.h @@ -37,7 +37,7 @@ enum menu_entry_type MENU_ENTRY_STRING, MENU_ENTRY_HEX, MENU_ENTRY_BIND, - MENU_ENTRY_ENUM, + MENU_ENTRY_ENUM }; typedef struct menu_entry diff --git a/menu/menu_input.c b/menu/menu_input.c index d800bb6af0..0f232e25a3 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -1020,7 +1020,7 @@ unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input) if (menu_input->keyboard.display) { - // send return key to close keyboard input window + /* send return key to close keyboard input window */ if (trigger_input & (1ULL << settings->menu_cancel_btn)) input_keyboard_event(true, '\n', '\n', 0, RETRO_DEVICE_KEYBOARD); diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 919bcc5f64..796bb4f43c 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -2474,10 +2474,10 @@ static bool setting_append_list_main_menu_options( (*list)[list_info->index - 1].size = sizeof(settings->libretro); (*list)[list_info->index - 1].value.string = settings->libretro; (*list)[list_info->index - 1].values = EXT_EXECUTABLES; - // It is not a good idea to have chosen action_toggle as the place - // to put this callback. It should be called whenever the browser - // needs to get the directory to browse into. It's not quite like - // get_string_representation, but it is close. + /* It is not a good idea to have chosen action_toggle as the place + * to put this callback. It should be called whenever the browser + * needs to get the directory to browse into. It's not quite like + * get_string_representation, but it is close. */ (*list)[list_info->index - 1].action_left = core_list_action_toggle; (*list)[list_info->index - 1].action_right = core_list_action_toggle; menu_settings_list_current_add_cmd(list, list_info, EVENT_CMD_LOAD_CORE); @@ -6002,11 +6002,11 @@ static bool setting_append_list_input_player_options( void menu_setting_free(rarch_setting_t *list) { + rarch_setting_t *setting = list; + if (!list) return; - rarch_setting_t *setting = list; - for (; setting->type != ST_NONE; setting++) { if (setting->flags & SD_FLAG_IS_DRIVER) diff --git a/performance.c b/performance.c index 4585896e96..82a217d2d7 100644 --- a/performance.c +++ b/performance.c @@ -40,7 +40,7 @@ #elif defined(_XBOX360) #include #elif defined(_POSIX_MONOTONIC_CLOCK) || defined(ANDROID) || defined(__QNX__) -// POSIX_MONOTONIC_CLOCK is not being defined in Android headers despite support being present. +/* POSIX_MONOTONIC_CLOCK is not being defined in Android headers despite support being present. */ #include #endif @@ -63,7 +63,7 @@ #include #endif -// iOS/OSX specific. Lacks clock_gettime(), so implement it. +/* iOS/OSX specific. Lacks clock_gettime(), so implement it. */ #ifdef __MACH__ #include @@ -407,11 +407,10 @@ uint64_t rarch_get_cpu_features(void) { int flags[4]; uint64_t cpu = 0; - const unsigned MAX_FEATURES = \ - sizeof(" MMX MMXEXT SSE SSE2 SSE3 SSSE3 SS4 SSE4.2 AES AVX AVX2 NEON VMX VMX128 VFPU PS"); - char buf[MAX_FEATURES]; - memset(buf, 0, MAX_FEATURES); + char buf[sizeof(" MMX MMXEXT SSE SSE2 SSE3 SSSE3 SS4 SSE4.2 AES AVX AVX2 NEON VMX VMX128 VFPU PS")]; + + memset(buf, 0, sizeof(buf)); (void)flags; diff --git a/runloop_data.c b/runloop_data.c index fe4a528fb1..777946178c 100644 --- a/runloop_data.c +++ b/runloop_data.c @@ -32,7 +32,7 @@ enum { THREAD_CODE_INIT = 0, THREAD_CODE_DEINIT, - THREAD_CODE_ALIVE, + THREAD_CODE_ALIVE } thread_code_enum; diff --git a/tools/retroarch-joyconfig.c b/tools/retroarch-joyconfig.c index c3fcd54b6d..32f34c1919 100644 --- a/tools/retroarch-joyconfig.c +++ b/tools/retroarch-joyconfig.c @@ -457,7 +457,7 @@ void input_config_autoconfigure_joypad(autoconfig_params_t *params) (void)params; } -// Need SDL_main on OSX. +/* Need SDL_main on OSX. */ #ifndef __APPLE__ #undef main #endif