From 1ae20ea17cfe817f873fc030ab8b2b20360d1aa5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 26 Jun 2020 20:00:19 +0200 Subject: [PATCH] Style nits - turn macro names into upper-case - some while style nits --- audio/drivers/gx_audio.c | 2 +- audio/drivers/opensl.c | 2 +- audio/drivers/switch_libnx_audren_audio.c | 4 +- audio/drivers/wiiu_audio.c | 2 +- frontend/drivers/platform_ps2.c | 4 +- frontend/drivers/platform_wiiu.c | 20 +++-- gfx/drivers/ctr_gfx.c | 2 +- gfx/drivers/gcm_gfx.c | 2 +- gfx/drivers/gl.c | 12 +-- gfx/drivers_font/gl1_raster_font.c | 51 +++++++------ gfx/drivers_font/gl_core_raster_font.c | 17 ++--- gfx/drivers_font/gl_raster_font.c | 17 ++--- gfx/drivers_font/metal_raster_font.m | 9 ++- gfx/drivers_font/vulkan_raster_font.c | 75 ++++++++++--------- gfx/drivers_font_renderer/freetype.c | 4 +- gfx/drivers_font_renderer/stb_unicode.c | 16 ++-- gfx/gfx_thumbnail_path.c | 3 +- input/drivers_hid/libusb_hid.c | 2 +- input/drivers_hid/wiiu_hid.c | 8 +- .../resampler/drivers/nearest_resampler.c | 6 +- libretro-common/encodings/encoding_utf.c | 57 +++++++------- libretro-common/file/archive_file.c | 2 +- libretro-common/file/archive_file_zlib.c | 4 +- libretro-common/formats/bmp/rbmp.c | 2 +- libretro-common/formats/image_texture.c | 2 +- libretro-common/formats/png/rpng.c | 5 +- libretro-common/formats/png/rpng_encode.c | 2 +- libretro-common/formats/png/rpng_internal.h | 2 +- libretro-common/hash/rhash.c | 8 +- libretro-common/include/string/stdstring.h | 2 +- libretro-common/string/stdstring.c | 14 ++-- manual_content_scan.c | 3 +- menu/cbs/menu_cbs_title.c | 2 +- menu/drivers/stripes.c | 2 +- menu/drivers/xmb.c | 2 +- network/netplay/netplay_io.c | 8 +- record/drivers/record_ffmpeg.c | 2 +- retroarch.c | 4 +- tasks/task_database_cue.c | 6 +- tasks/task_image.c | 2 +- ui/drivers/ui_cocoa.m | 3 +- verbosity.h | 18 ++--- wiiu/slang/main.c | 10 +-- wiiu/system/dynamic.c | 2 +- 44 files changed, 221 insertions(+), 201 deletions(-) diff --git a/audio/drivers/gx_audio.c b/audio/drivers/gx_audio.c index f4f2be0ca8..29679fd986 100644 --- a/audio/drivers/gx_audio.c +++ b/audio/drivers/gx_audio.c @@ -109,7 +109,7 @@ static INLINE void copy_swapped(uint32_t * restrict dst, { uint32_t s = *src++; *dst++ = (s >> 16) | (s << 16); - }while(--size); + } while (--size); } static ssize_t gx_audio_write(void *data, const void *buf_, size_t size) diff --git a/audio/drivers/opensl.c b/audio/drivers/opensl.c index fac2335fc7..4d02b15d14 100644 --- a/audio/drivers/opensl.c +++ b/audio/drivers/opensl.c @@ -67,7 +67,7 @@ static void opensl_callback(SLAndroidSimpleBufferQueueItf bq, void *ctx) #define GOTO_IF_FAIL(x) do { \ if ((res = (x)) != SL_RESULT_SUCCESS) \ goto error; \ -} while(0) +} while (0) static void sl_free(void *data) { diff --git a/audio/drivers/switch_libnx_audren_audio.c b/audio/drivers/switch_libnx_audren_audio.c index 0820e68001..144c6b6b4b 100644 --- a/audio/drivers/switch_libnx_audren_audio.c +++ b/audio/drivers/switch_libnx_audren_audio.c @@ -241,7 +241,7 @@ static ssize_t libnx_audren_audio_write(void *data, if (aud->nonblock) { - while(written < size) + while (written < size) { written += libnx_audren_audio_append( aud, buf + written, size - written); @@ -251,7 +251,7 @@ static ssize_t libnx_audren_audio_write(void *data, } else { - while(written < size) + while (written < size) { written += libnx_audren_audio_append( aud, buf + written, size - written); diff --git a/audio/drivers/wiiu_audio.c b/audio/drivers/wiiu_audio.c index 6d4339f2f8..62a868ae32 100644 --- a/audio/drivers/wiiu_audio.c +++ b/audio/drivers/wiiu_audio.c @@ -219,7 +219,7 @@ static ssize_t ax_audio_write(void* data, const void* buf, size_t size) else if (count_avail < count) { /* Sync, wait for free memory */ - while(AXIsMultiVoiceRunning(ax->mvoice) && (count_avail < count)) + while (AXIsMultiVoiceRunning(ax->mvoice) && (count_avail < count)) { OSYieldThread(); /* Gives threads with same priority time to run */ count_avail = (ax->written > AX_AUDIO_MAX_FREE ? 0 : (AX_AUDIO_MAX_FREE - ax->written)); diff --git a/frontend/drivers/platform_ps2.c b/frontend/drivers/platform_ps2.c index a59d289946..3a4dcfafc8 100644 --- a/frontend/drivers/platform_ps2.c +++ b/frontend/drivers/platform_ps2.c @@ -145,10 +145,10 @@ static void frontend_ps2_init(void *data) SifInitRpc(0); #if !defined(DEBUG) || defined(BUILD_FOR_PCSX2) /* Comment this line if you don't wanna debug the output */ - while(!SifIopReset(NULL, 0)){}; + while (!SifIopReset(NULL, 0)) { }; #endif - while(!SifIopSync()){}; + while (!SifIopSync()) { }; SifInitRpc(0); sbv_patch_enable_lmb(); diff --git a/frontend/drivers/platform_wiiu.c b/frontend/drivers/platform_wiiu.c index efa677e130..dde19827bd 100644 --- a/frontend/drivers/platform_wiiu.c +++ b/frontend/drivers/platform_wiiu.c @@ -606,28 +606,32 @@ void net_print_exp(const char *str) sendto(wiiu_log_socket, str, strlen(str), 0, (struct sockaddr *)&broadcast, sizeof(broadcast)); } -/* RFC 791 specifies that any IP host must be able to receive a datagram of 576 bytes. - * Since we're generally never logging more than a line or two's worth of data (~100 bytes) +/* RFC 791 specifies that any IP host must be able + * to receive a datagram of 576 bytes. + * Since we're generally never logging more than a + * line or two's worth of data (~100 bytes) * this is a reasonable size for our use. */ #define DGRAM_SIZE 576 -static ssize_t wiiu_log_write(struct _reent *r, void *fd, const char *ptr, size_t len) +static ssize_t wiiu_log_write(struct _reent *r, + void *fd, const char *ptr, size_t len) { + int remaining; if (wiiu_log_socket < 0) return len; - while(wiiu_log_lock) + while (wiiu_log_lock) OSSleepTicks(((248625000 / 4)) / 1000); wiiu_log_lock = 1; - int sent; - int remaining = len; + remaining = len; - while(remaining > 0) + while (remaining > 0) { int block = remaining < DGRAM_SIZE ? remaining : DGRAM_SIZE; - sent = sendto(wiiu_log_socket, ptr, block, 0, (struct sockaddr *)&broadcast, sizeof(broadcast)); + int sent = sendto(wiiu_log_socket, ptr, block, 0, + (struct sockaddr *)&broadcast, sizeof(broadcast)); if (sent < 0) break; diff --git a/gfx/drivers/ctr_gfx.c b/gfx/drivers/ctr_gfx.c index aa374ce82d..1a77643e94 100644 --- a/gfx/drivers/ctr_gfx.c +++ b/gfx/drivers/ctr_gfx.c @@ -582,7 +582,7 @@ static bool ctr_frame(void* data, const void* frame, #if 0 ctr->vsync_event_pending = true; #endif - while(ctr->vsync_event_pending) + while (ctr->vsync_event_pending) { task_queue_check(); svcSleepThread(0); diff --git a/gfx/drivers/gcm_gfx.c b/gfx/drivers/gcm_gfx.c index 6b58243dc9..d53f5d177c 100644 --- a/gfx/drivers/gcm_gfx.c +++ b/gfx/drivers/gcm_gfx.c @@ -261,7 +261,7 @@ waitFinish(gcmContextData *context, u32 sLabelVal) rsxFlushBuffer (context); - while(*(vu32 *) gcmGetLabelAddress (GCM_LABEL_INDEX) != sLabelVal) + while (*(vu32 *) gcmGetLabelAddress (GCM_LABEL_INDEX) != sLabelVal) usleep(30); sLabelVal++; diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 16d37c1b5a..3dafe4a553 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -2666,7 +2666,9 @@ static void gl2_video_layout_layer_begin(const video_layout_render_info_t *info) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } -static void gl2_video_layout_image(const video_layout_render_info_t *info, void *image_handle, void *alpha_handle) +static void gl2_video_layout_image( + const video_layout_render_info_t *info, + void *image_handle, void *alpha_handle) { /* TODO alpha_handle */ int i; @@ -2690,7 +2692,7 @@ static void gl2_video_layout_image(const video_layout_render_info_t *info, void coord[7] = 1.f - (b.y + b.h); i = 0; - while(i < 16) + while (i < 16) { color[i++] = info->color.r; color[i++] = info->color.g; @@ -2698,10 +2700,10 @@ static void gl2_video_layout_image(const video_layout_render_info_t *info, void color[i++] = info->color.a; } - gl->coords.vertex = coord; + gl->coords.vertex = coord; gl->coords.tex_coord = tex_coords; - gl->coords.color = color; - gl->coords.vertices = 4; + gl->coords.color = color; + gl->coords.vertices = 4; gl->shader->set_coords(gl->shader_data, &gl->coords); gl->shader->set_mvp(gl->shader_data, &gl->mvp_no_rot); diff --git a/gfx/drivers_font/gl1_raster_font.c b/gfx/drivers_font/gl1_raster_font.c index 118d42e903..414882d39d 100644 --- a/gfx/drivers_font/gl1_raster_font.c +++ b/gfx/drivers_font/gl1_raster_font.c @@ -28,24 +28,20 @@ /* TODO: Move viewport side effects to the caller: it's a source of bugs. */ -#define gl1_raster_font_emit(c, vx, vy) do { \ - font_vertex[ 2 * (6 * i + c) + 0] = (x + (delta_x + off_x + vx * width) * scale) * inv_win_width; \ - font_vertex[ 2 * (6 * i + c) + 1] = (y + (delta_y - off_y - vy * height) * scale) * inv_win_height; \ - font_tex_coords[ 2 * (6 * i + c) + 0] = (tex_x + vx * width) * inv_tex_size_x; \ - font_tex_coords[ 2 * (6 * i + c) + 1] = (tex_y + vy * height) * inv_tex_size_y; \ - font_color[ 4 * (6 * i + c) + 0] = color[0]; \ - font_color[ 4 * (6 * i + c) + 1] = color[1]; \ - font_color[ 4 * (6 * i + c) + 2] = color[2]; \ - font_color[ 4 * (6 * i + c) + 3] = color[3]; \ +#define GL1_RASTER_FONT_EMIT(c, vx, vy) \ + font_vertex[ 2 * (6 * i + c) + 0] = (x + (delta_x + off_x + vx * width) * scale) * inv_win_width; \ + font_vertex[ 2 * (6 * i + c) + 1] = (y + (delta_y - off_y - vy * height) * scale) * inv_win_height; \ + font_tex_coords[ 2 * (6 * i + c) + 0] = (tex_x + vx * width) * inv_tex_size_x; \ + font_tex_coords[ 2 * (6 * i + c) + 1] = (tex_y + vy * height) * inv_tex_size_y; \ + font_color[ 4 * (6 * i + c) + 0] = color[0]; \ + font_color[ 4 * (6 * i + c) + 1] = color[1]; \ + font_color[ 4 * (6 * i + c) + 2] = color[2]; \ + font_color[ 4 * (6 * i + c) + 3] = color[3]; \ font_lut_tex_coord[ 2 * (6 * i + c) + 0] = gl->coords.lut_tex_coord[0]; \ - font_lut_tex_coord[ 2 * (6 * i + c) + 1] = gl->coords.lut_tex_coord[1]; \ -} while(0) + font_lut_tex_coord[ 2 * (6 * i + c) + 1] = gl->coords.lut_tex_coord[1] #define MAX_MSG_LEN_CHUNK 64 -#ifdef VITA -static float *vertices3 = NULL; -#endif typedef struct { @@ -248,6 +244,10 @@ static int gl1_get_message_width(void *data, const char *msg, static void gl1_raster_font_draw_vertices(gl1_raster_t *font, const video_coords_t *coords) { +#ifdef VITA + static float *vertices3 = NULL; +#endif + if (font->atlas->dirty) { gl1_raster_font_upload_atlas(font); @@ -270,10 +270,13 @@ static void gl1_raster_font_draw_vertices(gl1_raster_t *font, if (vertices3) free(vertices3); vertices3 = (float*)malloc(sizeof(float) * 3 * coords->vertices); - int i; - for (i = 0; i < coords->vertices; i++) { - memcpy(&vertices3[i*3], &coords->vertex[i*2], sizeof(float) * 2); - vertices3[i*3+2] = 0.0f; + { + int i; + for (i = 0; i < coords->vertices; i++) + { + memcpy(&vertices3[i*3], &coords->vertex[i*2], sizeof(float) * 2); + vertices3[i*3+2] = 0.0f; + } } glVertexPointer(3, GL_FLOAT, 0, vertices3); #else @@ -350,13 +353,13 @@ static void gl1_raster_font_render_line( width = glyph->width; height = glyph->height; - gl1_raster_font_emit(0, 0, 1); /* Bottom-left */ - gl1_raster_font_emit(1, 1, 1); /* Bottom-right */ - gl1_raster_font_emit(2, 0, 0); /* Top-left */ + GL1_RASTER_FONT_EMIT(0, 0, 1); /* Bottom-left */ + GL1_RASTER_FONT_EMIT(1, 1, 1); /* Bottom-right */ + GL1_RASTER_FONT_EMIT(2, 0, 0); /* Top-left */ - gl1_raster_font_emit(3, 1, 0); /* Top-right */ - gl1_raster_font_emit(4, 0, 0); /* Top-left */ - gl1_raster_font_emit(5, 1, 1); /* Bottom-right */ + GL1_RASTER_FONT_EMIT(3, 1, 0); /* Top-right */ + GL1_RASTER_FONT_EMIT(4, 0, 0); /* Top-left */ + GL1_RASTER_FONT_EMIT(5, 1, 1); /* Bottom-right */ i++; diff --git a/gfx/drivers_font/gl_core_raster_font.c b/gfx/drivers_font/gl_core_raster_font.c index b3094699c9..6d95c73d5e 100644 --- a/gfx/drivers_font/gl_core_raster_font.c +++ b/gfx/drivers_font/gl_core_raster_font.c @@ -29,7 +29,7 @@ /* TODO: Move viewport side effects to the caller: it's a source of bugs. */ -#define gl_core_raster_font_emit(c, vx, vy) do { \ +#define GL_CORE_RASTER_FONT_EMIT(c, vx, vy) \ font_vertex[ 2 * (6 * i + c) + 0] = (x + (delta_x + off_x + vx * width) * scale) * inv_win_width; \ font_vertex[ 2 * (6 * i + c) + 1] = (y + (delta_y - off_y - vy * height) * scale) * inv_win_height; \ font_tex_coords[ 2 * (6 * i + c) + 0] = (tex_x + vx * width) * inv_tex_size_x; \ @@ -37,8 +37,7 @@ font_color[ 4 * (6 * i + c) + 0] = color[0]; \ font_color[ 4 * (6 * i + c) + 1] = color[1]; \ font_color[ 4 * (6 * i + c) + 2] = color[2]; \ - font_color[ 4 * (6 * i + c) + 3] = color[3]; \ -} while(0) + font_color[ 4 * (6 * i + c) + 3] = color[3] #define MAX_MSG_LEN_CHUNK 64 @@ -261,13 +260,13 @@ static void gl_core_raster_font_render_line( width = glyph->width; height = glyph->height; - gl_core_raster_font_emit(0, 0, 1); /* Bottom-left */ - gl_core_raster_font_emit(1, 1, 1); /* Bottom-right */ - gl_core_raster_font_emit(2, 0, 0); /* Top-left */ + GL_CORE_RASTER_FONT_EMIT(0, 0, 1); /* Bottom-left */ + GL_CORE_RASTER_FONT_EMIT(1, 1, 1); /* Bottom-right */ + GL_CORE_RASTER_FONT_EMIT(2, 0, 0); /* Top-left */ - gl_core_raster_font_emit(3, 1, 0); /* Top-right */ - gl_core_raster_font_emit(4, 0, 0); /* Top-left */ - gl_core_raster_font_emit(5, 1, 1); /* Bottom-right */ + GL_CORE_RASTER_FONT_EMIT(3, 1, 0); /* Top-right */ + GL_CORE_RASTER_FONT_EMIT(4, 0, 0); /* Top-left */ + GL_CORE_RASTER_FONT_EMIT(5, 1, 1); /* Bottom-right */ i++; diff --git a/gfx/drivers_font/gl_raster_font.c b/gfx/drivers_font/gl_raster_font.c index 783d6e84b9..505e9b8ca6 100644 --- a/gfx/drivers_font/gl_raster_font.c +++ b/gfx/drivers_font/gl_raster_font.c @@ -28,7 +28,7 @@ /* TODO: Move viewport side effects to the caller: it's a source of bugs. */ -#define gl_raster_font_emit(c, vx, vy) do { \ +#define GL_RASTER_FONT_EMIT(c, vx, vy) \ font_vertex[ 2 * (6 * i + c) + 0] = (x + (delta_x + off_x + vx * width) * scale) * inv_win_width; \ font_vertex[ 2 * (6 * i + c) + 1] = (y + (delta_y - off_y - vy * height) * scale) * inv_win_height; \ font_tex_coords[ 2 * (6 * i + c) + 0] = (tex_x + vx * width) * inv_tex_size_x; \ @@ -38,8 +38,7 @@ font_color[ 4 * (6 * i + c) + 2] = color[2]; \ font_color[ 4 * (6 * i + c) + 3] = color[3]; \ font_lut_tex_coord[ 2 * (6 * i + c) + 0] = gl->coords.lut_tex_coord[0]; \ - font_lut_tex_coord[ 2 * (6 * i + c) + 1] = gl->coords.lut_tex_coord[1]; \ -} while(0) + font_lut_tex_coord[ 2 * (6 * i + c) + 1] = gl->coords.lut_tex_coord[1] #define MAX_MSG_LEN_CHUNK 64 @@ -330,13 +329,13 @@ static void gl_raster_font_render_line( width = glyph->width; height = glyph->height; - gl_raster_font_emit(0, 0, 1); /* Bottom-left */ - gl_raster_font_emit(1, 1, 1); /* Bottom-right */ - gl_raster_font_emit(2, 0, 0); /* Top-left */ + GL_RASTER_FONT_EMIT(0, 0, 1); /* Bottom-left */ + GL_RASTER_FONT_EMIT(1, 1, 1); /* Bottom-right */ + GL_RASTER_FONT_EMIT(2, 0, 0); /* Top-left */ - gl_raster_font_emit(3, 1, 0); /* Top-right */ - gl_raster_font_emit(4, 0, 0); /* Top-left */ - gl_raster_font_emit(5, 1, 1); /* Bottom-right */ + GL_RASTER_FONT_EMIT(3, 1, 0); /* Top-right */ + GL_RASTER_FONT_EMIT(4, 0, 0); /* Top-left */ + GL_RASTER_FONT_EMIT(5, 1, 1); /* Bottom-right */ i++; diff --git a/gfx/drivers_font/metal_raster_font.m b/gfx/drivers_font/metal_raster_font.m index 235f5831f3..5b165905fe 100644 --- a/gfx/drivers_font/metal_raster_font.m +++ b/gfx/drivers_font/metal_raster_font.m @@ -81,10 +81,11 @@ length:(NSUInteger)(_stride * _atlas->height) options:MTLResourceStorageModeManaged]; - // Even though newBufferWithBytes will copy the initial contents - // from our atlas, it doesn't seem to invalidate the buffer when - // doing so, causing corrupted text rendering if we hit this code - // path. To work around it we manually invalidate the buffer. + /* Even though newBufferWithBytes will copy the initial contents + * from our atlas, it doesn't seem to invalidate the buffer when + * doing so, causing corrupted text rendering if we hit this code + * path. To work around it we manually invalidate the buffer. + */ [_buffer didModifyRange:NSMakeRange(0, _buffer.length)]; } else diff --git a/gfx/drivers_font/vulkan_raster_font.c b/gfx/drivers_font/vulkan_raster_font.c index 70d10c9c5b..60f6a473c6 100644 --- a/gfx/drivers_font/vulkan_raster_font.c +++ b/gfx/drivers_font/vulkan_raster_font.c @@ -39,7 +39,42 @@ typedef struct unsigned vertices; } vulkan_raster_t; -static void vulkan_raster_font_free_font(void *data, bool is_threaded); +static INLINE void vulkan_raster_font_update_glyph( + vulkan_raster_t *font, const struct font_glyph *glyph) +{ + if(font->atlas->dirty) + { + unsigned row; + for (row = glyph->atlas_offset_y; row < (glyph->atlas_offset_y + glyph->height); row++) + { + uint8_t *src = font->atlas->buffer + row * font->atlas->width + glyph->atlas_offset_x; + uint8_t *dst = (uint8_t*)font->texture.mapped + row * font->texture.stride + glyph->atlas_offset_x; + memcpy(dst, src, glyph->width); + } + + font->atlas->dirty = false; + font->needs_update = true; + } +} + + +static void vulkan_raster_font_free_font(void *data, bool is_threaded) +{ + vulkan_raster_t *font = (vulkan_raster_t*)data; + if (!font) + return; + + if (font->font_driver && font->font_data) + font->font_driver->free(font->font_data); + + vkQueueWaitIdle(font->vk->context->queue); + vulkan_destroy_texture( + font->vk->context->device, &font->texture); + vulkan_destroy_texture( + font->vk->context->device, &font->texture_optimal); + + free(font); +} static void *vulkan_raster_font_init_font(void *data, const char *font_path, float font_size, @@ -90,41 +125,6 @@ static void *vulkan_raster_font_init_font(void *data, return font; } -static void vulkan_raster_font_free_font(void *data, bool is_threaded) -{ - vulkan_raster_t *font = (vulkan_raster_t*)data; - if (!font) - return; - - if (font->font_driver && font->font_data) - font->font_driver->free(font->font_data); - - vkQueueWaitIdle(font->vk->context->queue); - vulkan_destroy_texture( - font->vk->context->device, &font->texture); - vulkan_destroy_texture( - font->vk->context->device, &font->texture_optimal); - - free(font); -} - -static INLINE void vulkan_raster_font_update_glyph(vulkan_raster_t *font, const struct font_glyph *glyph) -{ - if(font->atlas->dirty) - { - unsigned row; - for (row = glyph->atlas_offset_y; row < (glyph->atlas_offset_y + glyph->height); row++) - { - uint8_t *src = font->atlas->buffer + row * font->atlas->width + glyph->atlas_offset_x; - uint8_t *dst = (uint8_t*)font->texture.mapped + row * font->texture.stride + glyph->atlas_offset_x; - memcpy(dst, src, glyph->width); - } - - font->atlas->dirty = false; - font->needs_update = true; - } -} - static int vulkan_get_message_width(void *data, const char *msg, unsigned msg_len, float scale) { @@ -444,7 +444,8 @@ static const struct font_glyph *vulkan_raster_font_get_glyph( return glyph; } -static bool vulkan_get_line_metrics(void* data, struct font_line_metrics **metrics) +static bool vulkan_get_line_metrics(void* data, + struct font_line_metrics **metrics) { vulkan_raster_t *font = (vulkan_raster_t*)data; diff --git a/gfx/drivers_font_renderer/freetype.c b/gfx/drivers_font_renderer/freetype.c index 189630e731..baf3a2ad1d 100644 --- a/gfx/drivers_font_renderer/freetype.c +++ b/gfx/drivers_font_renderer/freetype.c @@ -97,7 +97,7 @@ static freetype_atlas_slot_t* font_renderer_get_slot(ft_font_renderer_t *handle) else if (handle->uc_map[map_id]) { freetype_atlas_slot_t* ptr = handle->uc_map[map_id]; - while(ptr->next && ptr->next != &handle->atlas_slots[oldest]) + while (ptr->next && ptr->next != &handle->atlas_slots[oldest]) ptr = ptr->next; ptr->next = handle->atlas_slots[oldest].next; } @@ -120,7 +120,7 @@ static const struct font_glyph *font_renderer_ft_get_glyph( map_id = charcode & 0xFF; atlas_slot = handle->uc_map[map_id]; - while(atlas_slot) + while (atlas_slot) { if (atlas_slot->charcode == charcode) { diff --git a/gfx/drivers_font_renderer/stb_unicode.c b/gfx/drivers_font_renderer/stb_unicode.c index 2395e77dae..0e06724e66 100644 --- a/gfx/drivers_font_renderer/stb_unicode.c +++ b/gfx/drivers_font_renderer/stb_unicode.c @@ -87,18 +87,18 @@ static stb_unicode_atlas_slot_t* font_renderer_stb_unicode_get_slot(stb_unicode_ unsigned oldest = 0; for (i = 1; i < STB_UNICODE_ATLAS_SIZE; i++) - if((handle->usage_counter - handle->atlas_slots[i].last_used) > + if ((handle->usage_counter - handle->atlas_slots[i].last_used) > (handle->usage_counter - handle->atlas_slots[oldest].last_used)) oldest = i; /* remove from map */ map_id = handle->atlas_slots[oldest].charcode & 0xFF; - if(handle->uc_map[map_id] == &handle->atlas_slots[oldest]) + if (handle->uc_map[map_id] == &handle->atlas_slots[oldest]) handle->uc_map[map_id] = handle->atlas_slots[oldest].next; else if (handle->uc_map[map_id]) { stb_unicode_atlas_slot_t* ptr = handle->uc_map[map_id]; - while(ptr->next && ptr->next != &handle->atlas_slots[oldest]) + while (ptr->next && ptr->next != &handle->atlas_slots[oldest]) ptr = ptr->next; ptr->next = handle->atlas_slots[oldest].next; } @@ -121,15 +121,15 @@ static const struct font_glyph *font_renderer_stb_unicode_get_glyph( float glyph_advance_x = 0.0f; float glyph_draw_offset_y = 0.0f; - if(!self) + if (!self) return NULL; map_id = charcode & 0xFF; atlas_slot = self->uc_map[map_id]; - while(atlas_slot) + while (atlas_slot) { - if(atlas_slot->charcode == charcode) + if (atlas_slot->charcode == charcode) { atlas_slot->last_used = self->usage_counter++; return &atlas_slot->glyph; @@ -222,7 +222,7 @@ static bool font_renderer_stb_unicode_create_atlas( for (i = 0; i < 256; i++) { - if(isalnum(i)) + if (isalnum(i)) font_renderer_stb_unicode_get_glyph(self, i); } @@ -242,7 +242,7 @@ static void *font_renderer_stb_unicode_init(const char *font_path, float font_si font_size = STBTT_POINT_SIZE(font_size); #ifdef WIIU - if(!*font_path) + if (!*font_path) { uint32_t size = 0; if (!OSGetSharedData(SHARED_FONT_DEFAULT, 0, (void**)&self->font_data, &size)) diff --git a/gfx/gfx_thumbnail_path.c b/gfx/gfx_thumbnail_path.c index 4db54e2bd9..fa851c6824 100644 --- a/gfx/gfx_thumbnail_path.c +++ b/gfx/gfx_thumbnail_path.c @@ -217,7 +217,8 @@ static void fill_content_img(gfx_thumbnail_path_data_t *path_data) * No-Intro filename standard: * http://datomatic.no-intro.org/stuff/The%20Official%20No-Intro%20Convention%20(20071030).zip * Replace these characters in the entry name with underscores */ - while((scrub_char_pointer = strpbrk(path_data->content_img, "&*/:`\"<>?\\|"))) + while ((scrub_char_pointer = + strpbrk(path_data->content_img, "&*/:`\"<>?\\|"))) *scrub_char_pointer = '_'; /* Add PNG extension */ diff --git a/input/drivers_hid/libusb_hid.c b/input/drivers_hid/libusb_hid.c index 6d0c7f3c7b..97ae624260 100644 --- a/input/drivers_hid/libusb_hid.c +++ b/input/drivers_hid/libusb_hid.c @@ -512,7 +512,7 @@ static void libusb_hid_free(const void *data) { libusb_hid_t *hid = (libusb_hid_t*)data; - while(adapters.next) + while (adapters.next) if (remove_adapter(hid, adapters.next->device) == -1) RARCH_ERR("could not remove device %p\n", adapters.next->device); diff --git a/input/drivers_hid/wiiu_hid.c b/input/drivers_hid/wiiu_hid.c index 998bc1b479..8194f9dd29 100644 --- a/input/drivers_hid/wiiu_hid.c +++ b/input/drivers_hid/wiiu_hid.c @@ -136,7 +136,7 @@ static void wiiu_hid_free(const void *data) if (events.list) { wiiu_attach_event *event = NULL; - while( (event = events.list) != NULL) + while ((event = events.list) != NULL) { events.list = event->next; delete_attach_event(event); @@ -593,7 +593,7 @@ static void wiiu_hid_polling_thread_cleanup(OSThread *thread, void *stack) if (incomplete == 0) { RARCH_LOG("All in-flight reads complete.\n"); - while(adapters.list != NULL) + while (adapters.list) { RARCH_LOG("[hid]: shutting down adapter..\n"); adapter = adapters.list; @@ -610,7 +610,7 @@ static void wiiu_hid_polling_thread_cleanup(OSThread *thread, void *stack) RARCH_WARN("[hid]: timed out waiting for in-flight read to finish.\n"); incomplete = 0; } - } while(incomplete); + } while (incomplete); } static void wiiu_handle_attach_events(wiiu_hid_t *hid, wiiu_attach_event *list) @@ -667,7 +667,7 @@ static int wiiu_hid_polling_thread(int argc, const char **argv) RARCH_LOG("[hid]: polling thread is starting\n"); - while(!hid->polling_thread_quit) + while (!hid->polling_thread_quit) { wiiu_handle_attach_events(hid, synchronized_get_events_list()); wiiu_poll_adapters(hid); diff --git a/libretro-common/audio/resampler/drivers/nearest_resampler.c b/libretro-common/audio/resampler/drivers/nearest_resampler.c index fef70147c1..a0da50bc62 100644 --- a/libretro-common/audio/resampler/drivers/nearest_resampler.c +++ b/libretro-common/audio/resampler/drivers/nearest_resampler.c @@ -40,11 +40,11 @@ static void resampler_nearest_process( audio_frame_float_t *outp = (audio_frame_float_t*)data->data_out; float ratio = 1.0 / data->ratio; - while(inp != inp_max) + while (inp != inp_max) { - while(re->fraction > 1) + while (re->fraction > 1) { - *outp++ = *inp; + *outp++ = *inp; re->fraction -= ratio; } re->fraction++; diff --git a/libretro-common/encodings/encoding_utf.c b/libretro-common/encodings/encoding_utf.c index fda119e8c1..190264a1f2 100644 --- a/libretro-common/encodings/encoding_utf.c +++ b/libretro-common/encodings/encoding_utf.c @@ -37,6 +37,8 @@ #include #endif +#define UTF8_WALKBYTE(string) (*((*(string))++)) + static unsigned leading_ones(uint8_t c) { unsigned ones = 0; @@ -89,13 +91,14 @@ size_t utf8_conv_utf32(uint32_t *out, size_t out_chars, bool utf16_conv_utf8(uint8_t *out, size_t *out_chars, const uint16_t *in, size_t in_size) { - static uint8_t kUtf8Limits[5] = { 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; - size_t out_pos = 0; - size_t in_pos = 0; + size_t out_pos = 0; + size_t in_pos = 0; + static const + uint8_t utf8_limits[5] = { 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; for (;;) { - unsigned numAdds; + unsigned num_adds; uint32_t value; if (in_pos == in_size) @@ -124,21 +127,21 @@ bool utf16_conv_utf8(uint8_t *out, size_t *out_chars, value = (((value - 0xD800) << 10) | (c2 - 0xDC00)) + 0x10000; } - for (numAdds = 1; numAdds < 5; numAdds++) - if (value < (((uint32_t)1) << (numAdds * 5 + 6))) + for (num_adds = 1; num_adds < 5; num_adds++) + if (value < (((uint32_t)1) << (num_adds * 5 + 6))) break; if (out) - out[out_pos] = (char)(kUtf8Limits[numAdds - 1] - + (value >> (6 * numAdds))); + out[out_pos] = (char)(utf8_limits[num_adds - 1] + + (value >> (6 * num_adds))); out_pos++; do { - numAdds--; + num_adds--; if (out) out[out_pos] = (char)(0x80 - + ((value >> (6 * numAdds)) & 0x3F)); + + ((value >> (6 * num_adds)) & 0x3F)); out_pos++; - }while (numAdds != 0); + }while (num_adds != 0); } *out_chars = out_pos; @@ -166,13 +169,15 @@ size_t utf8cpy(char *d, size_t d_len, const char *s, size_t chars) while (*sb && chars-- > 0) { sb++; - while ((*sb & 0xC0) == 0x80) sb++; + while ((*sb & 0xC0) == 0x80) + sb++; } if ((size_t)(sb - sb_org) > d_len-1 /* NUL */) { sb = sb_org + d_len-1; - while ((*sb & 0xC0) == 0x80) sb--; + while ((*sb & 0xC0) == 0x80) + sb--; } memcpy(d, sb_org, sb-sb_org); @@ -184,14 +189,18 @@ size_t utf8cpy(char *d, size_t d_len, const char *s, size_t chars) const char *utf8skip(const char *str, size_t chars) { const uint8_t *strb = (const uint8_t*)str; + if (!chars) return str; + do { strb++; - while ((*strb & 0xC0)==0x80) strb++; + while ((*strb & 0xC0)==0x80) + strb++; chars--; - } while(chars); + }while (chars); + return (const char*)strb; } @@ -211,24 +220,22 @@ size_t utf8len(const char *string) return ret; } -#define utf8_walkbyte(string) (*((*(string))++)) - /* Does not validate the input, returns garbage if it's not UTF-8. */ uint32_t utf8_walk(const char **string) { - uint8_t first = utf8_walkbyte(string); + uint8_t first = UTF8_WALKBYTE(string); uint32_t ret = 0; if (first < 128) return first; - ret = (ret << 6) | (utf8_walkbyte(string) & 0x3F); + ret = (ret << 6) | (UTF8_WALKBYTE(string) & 0x3F); if (first >= 0xE0) { - ret = (ret << 6) | (utf8_walkbyte(string) & 0x3F); + ret = (ret << 6) | (UTF8_WALKBYTE(string) & 0x3F); if (first >= 0xF0) { - ret = (ret << 6) | (utf8_walkbyte(string) & 0x3F); + ret = (ret << 6) | (UTF8_WALKBYTE(string) & 0x3F); return ret | (first & 7) << 18; } return ret | (first & 15) << 12; @@ -379,13 +386,13 @@ char* local_to_utf8_string_alloc(const char *str) wchar_t* utf8_to_utf16_string_alloc(const char *str) { #ifdef _WIN32 - int len = 0; - int out_len = 0; + int len = 0; + int out_len = 0; #else - size_t len = 0; + size_t len = 0; size_t out_len = 0; #endif - wchar_t *buf = NULL; + wchar_t *buf = NULL; if (!str || !*str) return NULL; diff --git a/libretro-common/file/archive_file.c b/libretro-common/file/archive_file.c index 3fa52b07f2..659140f1f3 100644 --- a/libretro-common/file/archive_file.c +++ b/libretro-common/file/archive_file.c @@ -648,7 +648,7 @@ bool file_archive_perform_mode(const char *path, const char *valid_exts, { ret = handle.backend->stream_decompress_data_to_file_iterate( handle.stream); - }while(ret == 0); + }while (ret == 0); if (!file_archive_decompress_data_to_file(&handle, ret, path, valid_exts, diff --git a/libretro-common/file/archive_file_zlib.c b/libretro-common/file/archive_file_zlib.c index 7cbc3b8e71..e2da2d7109 100644 --- a/libretro-common/file/archive_file_zlib.c +++ b/libretro-common/file/archive_file_zlib.c @@ -142,7 +142,7 @@ static bool zip_file_decompressed_handle( { ret = handle->backend->stream_decompress_data_to_file_iterate( handle->stream); - }while(ret == 0); + }while (ret == 0); #if 0 handle->real_checksum = handle->backend->stream_crc_calculate(0, @@ -272,7 +272,7 @@ static int zip_file_read( "", zip_file_decompressed, &userdata); if (!returnerr) break; - }while(ret == 0 && !userdata.decomp_state.found); + } while (ret == 0 && !userdata.decomp_state.found); file_archive_parse_file_iterate_stop(&zlib); diff --git a/libretro-common/formats/bmp/rbmp.c b/libretro-common/formats/bmp/rbmp.c index b206fcbc71..791c28b67a 100644 --- a/libretro-common/formats/bmp/rbmp.c +++ b/libretro-common/formats/bmp/rbmp.c @@ -735,7 +735,7 @@ static void rbmp_convert_frame(uint32_t *frame, unsigned width, unsigned height) { uint32_t *end = frame + (width * height * sizeof(uint32_t))/4; - while(frame < end) + while (frame < end) { uint32_t pixel = *frame; *frame = (pixel & 0xff00ff00) | ((pixel << 16) & 0x00ff0000) | ((pixel >> 16) & 0xff); diff --git a/libretro-common/formats/image_texture.c b/libretro-common/formats/image_texture.c index 1c4a605fe0..bfd7e78dd5 100644 --- a/libretro-common/formats/image_texture.c +++ b/libretro-common/formats/image_texture.c @@ -220,7 +220,7 @@ static bool image_texture_load_internal( ret = image_transfer_process(img, type, (uint32_t**)&out_img->pixels, len, &out_img->width, &out_img->height); - }while(ret == IMAGE_PROCESS_NEXT); + } while (ret == IMAGE_PROCESS_NEXT); if (ret == IMAGE_PROCESS_ERROR || ret == IMAGE_PROCESS_ERROR_END) goto end; diff --git a/libretro-common/formats/png/rpng.c b/libretro-common/formats/png/rpng.c index 57c26a7144..ae94b81ce8 100644 --- a/libretro-common/formats/png/rpng.c +++ b/libretro-common/formats/png/rpng.c @@ -705,10 +705,11 @@ static int png_reverse_filter_adam7_iterate(uint32_t **data_, if (png_reverse_filter_init(&pngp->ihdr, pngp) == -1) return IMAGE_PROCESS_ERROR; - do{ + do + { ret = png_reverse_filter_regular_iterate(&pngp->data, &pngp->ihdr, pngp); - }while(ret == IMAGE_PROCESS_NEXT); + } while (ret == IMAGE_PROCESS_NEXT); if (ret == IMAGE_PROCESS_ERROR || ret == IMAGE_PROCESS_ERROR_END) return IMAGE_PROCESS_ERROR; diff --git a/libretro-common/formats/png/rpng_encode.c b/libretro-common/formats/png/rpng_encode.c index ab071fa736..7bbe512a4e 100644 --- a/libretro-common/formats/png/rpng_encode.c +++ b/libretro-common/formats/png/rpng_encode.c @@ -36,7 +36,7 @@ fprintf(stderr, "[RPNG]: Error in line %d.\n", __LINE__); \ ret = false; \ goto end; \ -} while(0) +} while (0) double DEFLATE_PADDING = 1.1; int PNG_ROUGH_HEADER = 100; diff --git a/libretro-common/formats/png/rpng_internal.h b/libretro-common/formats/png/rpng_internal.h index 573b7765e9..3e4dcc990f 100644 --- a/libretro-common/formats/png/rpng_internal.h +++ b/libretro-common/formats/png/rpng_internal.h @@ -32,7 +32,7 @@ fprintf(stderr, "[RPNG]: Error in line %d.\n", __LINE__); \ ret = false; \ goto end; \ -} while(0) +} while (0) #ifndef ARRAY_SIZE #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) diff --git a/libretro-common/hash/rhash.c b/libretro-common/hash/rhash.c index 1711592e22..26d9dfc725 100644 --- a/libretro-common/hash/rhash.c +++ b/libretro-common/hash/rhash.c @@ -448,13 +448,13 @@ static void SHA1PadMessage(struct sha1_context *context) if (context->Message_Block_Index > 55) { - while(context->Message_Block_Index < 64) + while (context->Message_Block_Index < 64) context->Message_Block[context->Message_Block_Index++] = 0; SHA1ProcessMessageBlock(context); } - while(context->Message_Block_Index < 56) + while (context->Message_Block_Index < 56) context->Message_Block[context->Message_Block_Index++] = 0; /* Store the message length as the last 8 octets */ @@ -497,7 +497,7 @@ static void SHA1Input(struct sha1_context *context, return; } - while(length-- && !context->Corrupted) + while (length-- && !context->Corrupted) { context->Message_Block[context->Message_Block_Index++] = (*message_array & 0xFF); @@ -544,7 +544,7 @@ int sha1_calculate(const char *path, char *result) goto error; SHA1Input(&sha, buff, rv); - }while(rv); + } while (rv); if (!SHA1Result(&sha)) goto error; diff --git a/libretro-common/include/string/stdstring.h b/libretro-common/include/string/stdstring.h index 4f8e897529..07446bf920 100644 --- a/libretro-common/include/string/stdstring.h +++ b/libretro-common/include/string/stdstring.h @@ -148,7 +148,7 @@ char *word_wrap(char *buffer, const char *string, * char *str = "1,2,3,4,5,6,7,,,10,"; * char **str_ptr = &str; * char *token = NULL; - * while((token = string_tokenize(str_ptr, ","))) + * while ((token = string_tokenize(str_ptr, ","))) * { * printf("%s\n", token); * free(token); diff --git a/libretro-common/string/stdstring.c b/libretro-common/string/stdstring.c index 4beef252ec..ab8ade2c74 100644 --- a/libretro-common/string/stdstring.c +++ b/libretro-common/string/stdstring.c @@ -119,18 +119,18 @@ char *string_replace_substring(const char *in, /* Remove leading whitespaces */ char *string_trim_whitespace_left(char *const s) { - if(s && *s) + if (s && *s) { size_t len = strlen(s); char *current = s; - while(*current && isspace((unsigned char)*current)) + while (*current && isspace((unsigned char)*current)) { ++current; --len; } - if(s != current) + if (s != current) memmove(s, current, len + 1); } @@ -140,12 +140,12 @@ char *string_trim_whitespace_left(char *const s) /* Remove trailing whitespaces */ char *string_trim_whitespace_right(char *const s) { - if(s && *s) + if (s && *s) { size_t len = strlen(s); char *current = s + len - 1; - while(current != s && isspace((unsigned char)*current)) + while (current != s && isspace((unsigned char)*current)) { --current; --len; @@ -202,7 +202,7 @@ char *word_wrap(char* buffer, const char *string, int line_width, bool unicode, buffer[i] = string[i]; char_len--; i++; - } while(char_len); + } while (char_len); /* check for newlines embedded in the original input * and reset the index */ @@ -260,7 +260,7 @@ char *word_wrap(char* buffer, const char *string, int line_width, bool unicode, * char *str = "1,2,3,4,5,6,7,,,10,"; * char **str_ptr = &str; * char *token = NULL; - * while((token = string_tokenize(str_ptr, ","))) + * while ((token = string_tokenize(str_ptr, ","))) * { * printf("%s\n", token); * free(token); diff --git a/manual_content_scan.c b/manual_content_scan.c index 3b8feabb6c..ccc2ea025f 100644 --- a/manual_content_scan.c +++ b/manual_content_scan.c @@ -191,7 +191,8 @@ void manual_content_scan_scrub_system_name_custom(void) * and/or violate the No-Intro filename standard: * http://datomatic.no-intro.org/stuff/The%20Official%20No-Intro%20Convention%20(20071030).zip * Replace these characters with underscores */ - while((scrub_char_pointer = strpbrk(scan_settings.system_name_custom, "&*/:`\"<>?\\|"))) + while ((scrub_char_pointer = + strpbrk(scan_settings.system_name_custom, "&*/:`\"<>?\\|"))) *scrub_char_pointer = '_'; } diff --git a/menu/cbs/menu_cbs_title.c b/menu/cbs/menu_cbs_title.c index e74217bb0e..e94df630f9 100644 --- a/menu/cbs/menu_cbs_title.c +++ b/menu/cbs/menu_cbs_title.c @@ -41,7 +41,7 @@ { \ char *pos = NULL; \ strlcpy(s, label, len); \ - while((pos = strchr(s, '_'))) \ + while ((pos = strchr(s, '_'))) \ *pos = ' '; \ } diff --git a/menu/drivers/stripes.c b/menu/drivers/stripes.c index 2ce18e9cc5..30b765f7bf 100644 --- a/menu/drivers/stripes.c +++ b/menu/drivers/stripes.c @@ -998,7 +998,7 @@ static void stripes_update_thumbnail_path(void *data, unsigned i, char pos) tmp_new[0] = '\0'; - while((scrub_char_pointer = strpbrk(tmp, "&*/:`\"<>?\\|"))) + while ((scrub_char_pointer = strpbrk(tmp, "&*/:`\"<>?\\|"))) *scrub_char_pointer = '_'; /* Look for thumbnail file with this scrubbed filename */ diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 6158f71710..e9ceeb5278 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -4536,7 +4536,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) for(i = 0; i < 25 && *end; i++) { end++; - while((*end & 0xC0) == 0x80) + while ((*end & 0xC0) == 0x80) end++; } diff --git a/network/netplay/netplay_io.c b/network/netplay/netplay_io.c index 533e0bf848..e791dd9c8e 100644 --- a/network/netplay/netplay_io.c +++ b/network/netplay/netplay_io.c @@ -1217,14 +1217,14 @@ static bool netplay_get_cmd(netplay_t *netplay, #define START(which) \ do { \ - ptr = which; \ + ptr = which; \ dframe = &netplay->buffer[ptr]; \ - } while(0) + } while (0) #define NEXT() \ do { \ - ptr = NEXT_PTR(ptr); \ + ptr = NEXT_PTR(ptr); \ dframe = &netplay->buffer[ptr]; \ - } while(0) + } while (0) if (netplay->is_server) { diff --git a/record/drivers/record_ffmpeg.c b/record/drivers/record_ffmpeg.c index bfd6531098..996ad26313 100644 --- a/record/drivers/record_ffmpeg.c +++ b/record/drivers/record_ffmpeg.c @@ -1647,7 +1647,7 @@ static void ffmpeg_flush_buffers(ffmpeg_t *handle) did_work = true; } - }while(did_work); + }while (did_work); /* Flush out last audio. */ if (handle->config.audio_enable) diff --git a/retroarch.c b/retroarch.c index 7432555731..297272afe2 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1046,7 +1046,7 @@ static const camera_driver_t *camera_drivers[] = { #define FAIL_CPU(simd_type) do { \ RARCH_ERR(simd_type " code is compiled in, but CPU does not support this feature. Cannot continue.\n"); \ retroarch_fail(1, "validate_cpu_features()"); \ -}while(0) +} while (0) #ifdef HAVE_ZLIB #define DEFAULT_EXT "zip" @@ -12838,7 +12838,7 @@ static void handle_translation_cb( do { retval = rpng_process_image(rpng, &raw_image_data_alpha, new_image_size, &image_width, &image_height); - }while(retval == IMAGE_PROCESS_NEXT); + } while (retval == IMAGE_PROCESS_NEXT); /* Returned output from the png processor is an upside down RGBA * image, so we have to change that to RGB first. This should diff --git a/tasks/task_database_cue.c b/tasks/task_database_cue.c index 19ca2b788c..5a993f7af7 100644 --- a/tasks/task_database_cue.c +++ b/tasks/task_database_cue.c @@ -191,14 +191,14 @@ static int detect_ps1_game_sub(intfstream_t *fp, buffer[256] = '\0'; tmp = buffer; - while(*tmp && strncasecmp((const char*)tmp, "boot", 4)) + while (*tmp && strncasecmp((const char*)tmp, "boot", 4)) tmp++; if (!*tmp) return 0; boot_file = tmp; - while(*tmp && *tmp != '\n') + while (*tmp && *tmp != '\n') { if ((*tmp == '\\') || (*tmp == ':')) boot_file = tmp + 1; @@ -216,7 +216,7 @@ static int detect_ps1_game_sub(intfstream_t *fp, if (!isalnum(*tmp)) tmp++; - while(isalnum(*tmp)) + while (isalnum(*tmp)) { *game_id++ = *tmp++; if (*tmp == '.') diff --git a/tasks/task_image.c b/tasks/task_image.c index 850a07318c..e546d0bdda 100644 --- a/tasks/task_image.c +++ b/tasks/task_image.c @@ -144,7 +144,7 @@ static int task_image_iterate_process_transfer(struct nbio_image_handle *image) if (retval != IMAGE_PROCESS_NEXT) break; - }while(cpu_features_get_time_usec() - start_time + }while (cpu_features_get_time_usec() - start_time < image->frame_duration); if (retval == IMAGE_PROCESS_NEXT) diff --git a/ui/drivers/ui_cocoa.m b/ui/drivers/ui_cocoa.m index 4012f1f3a4..564d256726 100644 --- a/ui/drivers/ui_cocoa.m +++ b/ui/drivers/ui_cocoa.m @@ -396,7 +396,8 @@ static char **waiting_argv; task_queue_check(); - while(CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.002, FALSE) == kCFRunLoopRunHandledSource); + while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.002, FALSE) + == kCFRunLoopRunHandledSource); if (ret == -1) { #ifdef HAVE_QT diff --git a/verbosity.h b/verbosity.h index 95d038af4d..ff09227b14 100644 --- a/verbosity.h +++ b/verbosity.h @@ -59,7 +59,7 @@ void logger_send_v(const char *__format, va_list args); #define RARCH_LOG(...) do { \ logger_send("RetroArch Salamander: " __VA_ARGS__); \ -} while(0) +} while (0) #define RARCH_LOG_V(tag, fmt, vp) do { \ logger_send("RetroArch Salamander: " tag); \ @@ -68,7 +68,7 @@ void logger_send_v(const char *__format, va_list args); #define RARCH_LOG_OUTPUT(...) do { \ logger_send("[OUTPUT] " __VA_ARGS__); \ -} while(0) +} while (0) #define RARCH_LOG_OUTPUT_V(tag, fmt, vp) do { \ logger_send("[OUTPUT] " tag); \ @@ -77,7 +77,7 @@ void logger_send_v(const char *__format, va_list args); #define RARCH_ERR(...) do { \ logger_send("[ERROR] " __VA_ARGS__); \ -} while(0) +} while (0) #define RARCH_ERR_V(tag, fmt, vp) do { \ logger_send("[ERROR] " tag); \ @@ -86,7 +86,7 @@ void logger_send_v(const char *__format, va_list args); #define RARCH_WARN(...) do { \ logger_send("[WARN] " __VA_ARGS__); \ -} while(0) +} while (0) #define RARCH_WARN_V(tag, fmt, vp) do { \ logger_send("[WARN] " tag); \ @@ -97,7 +97,7 @@ void logger_send_v(const char *__format, va_list args); #define RARCH_LOG(...) do { \ logger_send("" __VA_ARGS__); \ -} while(0) +} while (0) #define RARCH_LOG_V(tag, fmt, vp) do { \ logger_send("" tag); \ @@ -106,7 +106,7 @@ void logger_send_v(const char *__format, va_list args); #define RARCH_ERR(...) do { \ logger_send("[ERROR] " __VA_ARGS__); \ -} while(0) +} while (0) #define RARCH_ERR_V(tag, fmt, vp) do { \ logger_send("[ERROR] " tag); \ @@ -115,7 +115,7 @@ void logger_send_v(const char *__format, va_list args); #define RARCH_WARN(...) do { \ logger_send("[WARN] " __VA_ARGS__); \ -} while(0) +} while (0) #define RARCH_WARN_V(tag, fmt, vp) do { \ logger_send("[WARN] :: " tag); \ @@ -124,7 +124,7 @@ void logger_send_v(const char *__format, va_list args); #define RARCH_LOG_OUTPUT(...) do { \ logger_send("[OUTPUT] " __VA_ARGS__); \ -} while(0) +} while (0) #define RARCH_LOG_OUTPUT_V(tag, fmt, vp) do { \ logger_send("[OUTPUT] " tag); \ @@ -132,7 +132,7 @@ void logger_send_v(const char *__format, va_list args); } while (0) #endif -#define RARCH_LOG_BUFFER(...) do { } while(0) +#define RARCH_LOG_BUFFER(...) do { } while (0) #else /* HAVE_LOGGER */ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap); diff --git a/wiiu/slang/main.c b/wiiu/slang/main.c index c81d2d21c2..38356dfca9 100644 --- a/wiiu/slang/main.c +++ b/wiiu/slang/main.c @@ -62,11 +62,11 @@ int main(int argc, const char** argv) bool vson = true; bool pson = true; - while(*next) + while (*next) { const char* line = next; - while(*next && *next != '\n' && *next != '\r') + while (*next && *next != '\n' && *next != '\r') next++; if (*next == '\r') @@ -75,7 +75,7 @@ int main(int argc, const char** argv) *next++ = '\0'; #if 0 - while((*next == '\n') || (*next == '\r')) + while ((*next == '\n') || (*next == '\r')) *next++ = '\0'; #endif @@ -101,12 +101,12 @@ int main(int argc, const char** argv) char* layout = strstr(line, "layout("); if(layout) { - while(*layout != ')') + while (*layout != ')') layout++; layout++; - while(*layout && isspace(*layout)) + while (*layout && isspace(*layout)) layout++; if(!strncmp(layout, "uniform", 7)) diff --git a/wiiu/system/dynamic.c b/wiiu/system/dynamic.c index 4bc859ef46..2ca62e91ca 100644 --- a/wiiu/system/dynamic.c +++ b/wiiu/system/dynamic.c @@ -10,7 +10,7 @@ #undef IMPORT_BEGIN #undef IMPORT_END -#define IMPORT(name) do{if(OSDynLoad_FindExport(handle, 0, #name, &addr_##name) < 0)OSFatal("Function " # name " is NULL");} while(0) +#define IMPORT(name) do{if(OSDynLoad_FindExport(handle, 0, #name, &addr_##name) < 0)OSFatal("Function " # name " is NULL");} while (0) #define IMPORT_BEGIN(lib) OSDynLoad_Acquire(#lib ".rpl", &handle) /* #define IMPORT_END() OSDynLoad_Release(handle) */ #define IMPORT_END()