Style nits - turn macro names into upper-case - some while style nits
This commit is contained in:
parent
fa50695b89
commit
1ae20ea17c
|
@ -606,13 +606,17 @@ void net_print_exp(const char *str)
|
||||||
sendto(wiiu_log_socket, str, strlen(str), 0, (struct sockaddr *)&broadcast, sizeof(broadcast));
|
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.
|
/* RFC 791 specifies that any IP host must be able
|
||||||
* Since we're generally never logging more than a line or two's worth of data (~100 bytes)
|
* 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. */
|
* this is a reasonable size for our use. */
|
||||||
#define DGRAM_SIZE 576
|
#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)
|
if (wiiu_log_socket < 0)
|
||||||
return len;
|
return len;
|
||||||
|
|
||||||
|
@ -621,13 +625,13 @@ static ssize_t wiiu_log_write(struct _reent *r, void *fd, const char *ptr, size_
|
||||||
|
|
||||||
wiiu_log_lock = 1;
|
wiiu_log_lock = 1;
|
||||||
|
|
||||||
int sent;
|
remaining = len;
|
||||||
int remaining = len;
|
|
||||||
|
|
||||||
while (remaining > 0)
|
while (remaining > 0)
|
||||||
{
|
{
|
||||||
int block = remaining < DGRAM_SIZE ? remaining : DGRAM_SIZE;
|
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)
|
if (sent < 0)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -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);
|
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 */
|
/* TODO alpha_handle */
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
/* TODO: Move viewport side effects to the caller: it's a source of bugs. */
|
/* TODO: Move viewport side effects to the caller: it's a source of bugs. */
|
||||||
|
|
||||||
#define gl1_raster_font_emit(c, vx, vy) do { \
|
#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) + 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_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) + 0] = (tex_x + vx * width) * inv_tex_size_x; \
|
||||||
|
@ -38,14 +38,10 @@
|
||||||
font_color[ 4 * (6 * i + c) + 2] = color[2]; \
|
font_color[ 4 * (6 * i + c) + 2] = color[2]; \
|
||||||
font_color[ 4 * (6 * i + c) + 3] = color[3]; \
|
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) + 0] = gl->coords.lut_tex_coord[0]; \
|
||||||
font_lut_tex_coord[ 2 * (6 * i + c) + 1] = gl->coords.lut_tex_coord[1]; \
|
font_lut_tex_coord[ 2 * (6 * i + c) + 1] = gl->coords.lut_tex_coord[1]
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define MAX_MSG_LEN_CHUNK 64
|
#define MAX_MSG_LEN_CHUNK 64
|
||||||
|
|
||||||
#ifdef VITA
|
|
||||||
static float *vertices3 = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct
|
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,
|
static void gl1_raster_font_draw_vertices(gl1_raster_t *font,
|
||||||
const video_coords_t *coords)
|
const video_coords_t *coords)
|
||||||
{
|
{
|
||||||
|
#ifdef VITA
|
||||||
|
static float *vertices3 = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (font->atlas->dirty)
|
if (font->atlas->dirty)
|
||||||
{
|
{
|
||||||
gl1_raster_font_upload_atlas(font);
|
gl1_raster_font_upload_atlas(font);
|
||||||
|
@ -270,11 +270,14 @@ static void gl1_raster_font_draw_vertices(gl1_raster_t *font,
|
||||||
if (vertices3)
|
if (vertices3)
|
||||||
free(vertices3);
|
free(vertices3);
|
||||||
vertices3 = (float*)malloc(sizeof(float) * 3 * coords->vertices);
|
vertices3 = (float*)malloc(sizeof(float) * 3 * coords->vertices);
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < coords->vertices; i++) {
|
for (i = 0; i < coords->vertices; i++)
|
||||||
|
{
|
||||||
memcpy(&vertices3[i*3], &coords->vertex[i*2], sizeof(float) * 2);
|
memcpy(&vertices3[i*3], &coords->vertex[i*2], sizeof(float) * 2);
|
||||||
vertices3[i*3+2] = 0.0f;
|
vertices3[i*3+2] = 0.0f;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
glVertexPointer(3, GL_FLOAT, 0, vertices3);
|
glVertexPointer(3, GL_FLOAT, 0, vertices3);
|
||||||
#else
|
#else
|
||||||
glVertexPointer(2, GL_FLOAT, 0, coords->vertex);
|
glVertexPointer(2, GL_FLOAT, 0, coords->vertex);
|
||||||
|
@ -350,13 +353,13 @@ static void gl1_raster_font_render_line(
|
||||||
width = glyph->width;
|
width = glyph->width;
|
||||||
height = glyph->height;
|
height = glyph->height;
|
||||||
|
|
||||||
gl1_raster_font_emit(0, 0, 1); /* Bottom-left */
|
GL1_RASTER_FONT_EMIT(0, 0, 1); /* Bottom-left */
|
||||||
gl1_raster_font_emit(1, 1, 1); /* Bottom-right */
|
GL1_RASTER_FONT_EMIT(1, 1, 1); /* Bottom-right */
|
||||||
gl1_raster_font_emit(2, 0, 0); /* Top-left */
|
GL1_RASTER_FONT_EMIT(2, 0, 0); /* Top-left */
|
||||||
|
|
||||||
gl1_raster_font_emit(3, 1, 0); /* Top-right */
|
GL1_RASTER_FONT_EMIT(3, 1, 0); /* Top-right */
|
||||||
gl1_raster_font_emit(4, 0, 0); /* Top-left */
|
GL1_RASTER_FONT_EMIT(4, 0, 0); /* Top-left */
|
||||||
gl1_raster_font_emit(5, 1, 1); /* Bottom-right */
|
GL1_RASTER_FONT_EMIT(5, 1, 1); /* Bottom-right */
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
/* TODO: Move viewport side effects to the caller: it's a source of bugs. */
|
/* 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) + 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_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) + 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) + 0] = color[0]; \
|
||||||
font_color[ 4 * (6 * i + c) + 1] = color[1]; \
|
font_color[ 4 * (6 * i + c) + 1] = color[1]; \
|
||||||
font_color[ 4 * (6 * i + c) + 2] = color[2]; \
|
font_color[ 4 * (6 * i + c) + 2] = color[2]; \
|
||||||
font_color[ 4 * (6 * i + c) + 3] = color[3]; \
|
font_color[ 4 * (6 * i + c) + 3] = color[3]
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define MAX_MSG_LEN_CHUNK 64
|
#define MAX_MSG_LEN_CHUNK 64
|
||||||
|
|
||||||
|
@ -261,13 +260,13 @@ static void gl_core_raster_font_render_line(
|
||||||
width = glyph->width;
|
width = glyph->width;
|
||||||
height = glyph->height;
|
height = glyph->height;
|
||||||
|
|
||||||
gl_core_raster_font_emit(0, 0, 1); /* Bottom-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(1, 1, 1); /* Bottom-right */
|
||||||
gl_core_raster_font_emit(2, 0, 0); /* Top-left */
|
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(3, 1, 0); /* Top-right */
|
||||||
gl_core_raster_font_emit(4, 0, 0); /* Top-left */
|
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(5, 1, 1); /* Bottom-right */
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
/* TODO: Move viewport side effects to the caller: it's a source of bugs. */
|
/* 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) + 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_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) + 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) + 2] = color[2]; \
|
||||||
font_color[ 4 * (6 * i + c) + 3] = color[3]; \
|
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) + 0] = gl->coords.lut_tex_coord[0]; \
|
||||||
font_lut_tex_coord[ 2 * (6 * i + c) + 1] = gl->coords.lut_tex_coord[1]; \
|
font_lut_tex_coord[ 2 * (6 * i + c) + 1] = gl->coords.lut_tex_coord[1]
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define MAX_MSG_LEN_CHUNK 64
|
#define MAX_MSG_LEN_CHUNK 64
|
||||||
|
|
||||||
|
@ -330,13 +329,13 @@ static void gl_raster_font_render_line(
|
||||||
width = glyph->width;
|
width = glyph->width;
|
||||||
height = glyph->height;
|
height = glyph->height;
|
||||||
|
|
||||||
gl_raster_font_emit(0, 0, 1); /* Bottom-left */
|
GL_RASTER_FONT_EMIT(0, 0, 1); /* Bottom-left */
|
||||||
gl_raster_font_emit(1, 1, 1); /* Bottom-right */
|
GL_RASTER_FONT_EMIT(1, 1, 1); /* Bottom-right */
|
||||||
gl_raster_font_emit(2, 0, 0); /* Top-left */
|
GL_RASTER_FONT_EMIT(2, 0, 0); /* Top-left */
|
||||||
|
|
||||||
gl_raster_font_emit(3, 1, 0); /* Top-right */
|
GL_RASTER_FONT_EMIT(3, 1, 0); /* Top-right */
|
||||||
gl_raster_font_emit(4, 0, 0); /* Top-left */
|
GL_RASTER_FONT_EMIT(4, 0, 0); /* Top-left */
|
||||||
gl_raster_font_emit(5, 1, 1); /* Bottom-right */
|
GL_RASTER_FONT_EMIT(5, 1, 1); /* Bottom-right */
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
|
|
@ -81,10 +81,11 @@
|
||||||
length:(NSUInteger)(_stride * _atlas->height)
|
length:(NSUInteger)(_stride * _atlas->height)
|
||||||
options:MTLResourceStorageModeManaged];
|
options:MTLResourceStorageModeManaged];
|
||||||
|
|
||||||
// Even though newBufferWithBytes will copy the initial contents
|
/* Even though newBufferWithBytes will copy the initial contents
|
||||||
// from our atlas, it doesn't seem to invalidate the buffer when
|
* from our atlas, it doesn't seem to invalidate the buffer when
|
||||||
// doing so, causing corrupted text rendering if we hit this code
|
* doing so, causing corrupted text rendering if we hit this code
|
||||||
// path. To work around it we manually invalidate the buffer.
|
* path. To work around it we manually invalidate the buffer.
|
||||||
|
*/
|
||||||
[_buffer didModifyRange:NSMakeRange(0, _buffer.length)];
|
[_buffer didModifyRange:NSMakeRange(0, _buffer.length)];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -39,7 +39,42 @@ typedef struct
|
||||||
unsigned vertices;
|
unsigned vertices;
|
||||||
} vulkan_raster_t;
|
} 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,
|
static void *vulkan_raster_font_init_font(void *data,
|
||||||
const char *font_path, float font_size,
|
const char *font_path, float font_size,
|
||||||
|
@ -90,41 +125,6 @@ static void *vulkan_raster_font_init_font(void *data,
|
||||||
return font;
|
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,
|
static int vulkan_get_message_width(void *data, const char *msg,
|
||||||
unsigned msg_len, float scale)
|
unsigned msg_len, float scale)
|
||||||
{
|
{
|
||||||
|
@ -444,7 +444,8 @@ static const struct font_glyph *vulkan_raster_font_get_glyph(
|
||||||
return 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;
|
vulkan_raster_t *font = (vulkan_raster_t*)data;
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,8 @@ static void fill_content_img(gfx_thumbnail_path_data_t *path_data)
|
||||||
* No-Intro filename standard:
|
* No-Intro filename standard:
|
||||||
* http://datomatic.no-intro.org/stuff/The%20Official%20No-Intro%20Convention%20(20071030).zip
|
* http://datomatic.no-intro.org/stuff/The%20Official%20No-Intro%20Convention%20(20071030).zip
|
||||||
* Replace these characters in the entry name with underscores */
|
* 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 = '_';
|
*scrub_char_pointer = '_';
|
||||||
|
|
||||||
/* Add PNG extension */
|
/* Add PNG extension */
|
||||||
|
|
|
@ -593,7 +593,7 @@ static void wiiu_hid_polling_thread_cleanup(OSThread *thread, void *stack)
|
||||||
if (incomplete == 0)
|
if (incomplete == 0)
|
||||||
{
|
{
|
||||||
RARCH_LOG("All in-flight reads complete.\n");
|
RARCH_LOG("All in-flight reads complete.\n");
|
||||||
while(adapters.list != NULL)
|
while (adapters.list)
|
||||||
{
|
{
|
||||||
RARCH_LOG("[hid]: shutting down adapter..\n");
|
RARCH_LOG("[hid]: shutting down adapter..\n");
|
||||||
adapter = adapters.list;
|
adapter = adapters.list;
|
||||||
|
|
|
@ -37,6 +37,8 @@
|
||||||
#include <xtl.h>
|
#include <xtl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define UTF8_WALKBYTE(string) (*((*(string))++))
|
||||||
|
|
||||||
static unsigned leading_ones(uint8_t c)
|
static unsigned leading_ones(uint8_t c)
|
||||||
{
|
{
|
||||||
unsigned ones = 0;
|
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,
|
bool utf16_conv_utf8(uint8_t *out, size_t *out_chars,
|
||||||
const uint16_t *in, size_t in_size)
|
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 out_pos = 0;
|
||||||
size_t in_pos = 0;
|
size_t in_pos = 0;
|
||||||
|
static const
|
||||||
|
uint8_t utf8_limits[5] = { 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
unsigned numAdds;
|
unsigned num_adds;
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
|
|
||||||
if (in_pos == in_size)
|
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;
|
value = (((value - 0xD800) << 10) | (c2 - 0xDC00)) + 0x10000;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (numAdds = 1; numAdds < 5; numAdds++)
|
for (num_adds = 1; num_adds < 5; num_adds++)
|
||||||
if (value < (((uint32_t)1) << (numAdds * 5 + 6)))
|
if (value < (((uint32_t)1) << (num_adds * 5 + 6)))
|
||||||
break;
|
break;
|
||||||
if (out)
|
if (out)
|
||||||
out[out_pos] = (char)(kUtf8Limits[numAdds - 1]
|
out[out_pos] = (char)(utf8_limits[num_adds - 1]
|
||||||
+ (value >> (6 * numAdds)));
|
+ (value >> (6 * num_adds)));
|
||||||
out_pos++;
|
out_pos++;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
numAdds--;
|
num_adds--;
|
||||||
if (out)
|
if (out)
|
||||||
out[out_pos] = (char)(0x80
|
out[out_pos] = (char)(0x80
|
||||||
+ ((value >> (6 * numAdds)) & 0x3F));
|
+ ((value >> (6 * num_adds)) & 0x3F));
|
||||||
out_pos++;
|
out_pos++;
|
||||||
}while (numAdds != 0);
|
}while (num_adds != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
*out_chars = out_pos;
|
*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)
|
while (*sb && chars-- > 0)
|
||||||
{
|
{
|
||||||
sb++;
|
sb++;
|
||||||
while ((*sb & 0xC0) == 0x80) sb++;
|
while ((*sb & 0xC0) == 0x80)
|
||||||
|
sb++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((size_t)(sb - sb_org) > d_len-1 /* NUL */)
|
if ((size_t)(sb - sb_org) > d_len-1 /* NUL */)
|
||||||
{
|
{
|
||||||
sb = sb_org + d_len-1;
|
sb = sb_org + d_len-1;
|
||||||
while ((*sb & 0xC0) == 0x80) sb--;
|
while ((*sb & 0xC0) == 0x80)
|
||||||
|
sb--;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(d, sb_org, sb-sb_org);
|
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 char *utf8skip(const char *str, size_t chars)
|
||||||
{
|
{
|
||||||
const uint8_t *strb = (const uint8_t*)str;
|
const uint8_t *strb = (const uint8_t*)str;
|
||||||
|
|
||||||
if (!chars)
|
if (!chars)
|
||||||
return str;
|
return str;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
strb++;
|
strb++;
|
||||||
while ((*strb & 0xC0)==0x80) strb++;
|
while ((*strb & 0xC0)==0x80)
|
||||||
|
strb++;
|
||||||
chars--;
|
chars--;
|
||||||
}while (chars);
|
}while (chars);
|
||||||
|
|
||||||
return (const char*)strb;
|
return (const char*)strb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,24 +220,22 @@ size_t utf8len(const char *string)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define utf8_walkbyte(string) (*((*(string))++))
|
|
||||||
|
|
||||||
/* Does not validate the input, returns garbage if it's not UTF-8. */
|
/* Does not validate the input, returns garbage if it's not UTF-8. */
|
||||||
uint32_t utf8_walk(const char **string)
|
uint32_t utf8_walk(const char **string)
|
||||||
{
|
{
|
||||||
uint8_t first = utf8_walkbyte(string);
|
uint8_t first = UTF8_WALKBYTE(string);
|
||||||
uint32_t ret = 0;
|
uint32_t ret = 0;
|
||||||
|
|
||||||
if (first < 128)
|
if (first < 128)
|
||||||
return first;
|
return first;
|
||||||
|
|
||||||
ret = (ret << 6) | (utf8_walkbyte(string) & 0x3F);
|
ret = (ret << 6) | (UTF8_WALKBYTE(string) & 0x3F);
|
||||||
if (first >= 0xE0)
|
if (first >= 0xE0)
|
||||||
{
|
{
|
||||||
ret = (ret << 6) | (utf8_walkbyte(string) & 0x3F);
|
ret = (ret << 6) | (UTF8_WALKBYTE(string) & 0x3F);
|
||||||
if (first >= 0xF0)
|
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 & 7) << 18;
|
||||||
}
|
}
|
||||||
return ret | (first & 15) << 12;
|
return ret | (first & 15) << 12;
|
||||||
|
|
|
@ -705,7 +705,8 @@ static int png_reverse_filter_adam7_iterate(uint32_t **data_,
|
||||||
if (png_reverse_filter_init(&pngp->ihdr, pngp) == -1)
|
if (png_reverse_filter_init(&pngp->ihdr, pngp) == -1)
|
||||||
return IMAGE_PROCESS_ERROR;
|
return IMAGE_PROCESS_ERROR;
|
||||||
|
|
||||||
do{
|
do
|
||||||
|
{
|
||||||
ret = png_reverse_filter_regular_iterate(&pngp->data,
|
ret = png_reverse_filter_regular_iterate(&pngp->data,
|
||||||
&pngp->ihdr, pngp);
|
&pngp->ihdr, pngp);
|
||||||
} while (ret == IMAGE_PROCESS_NEXT);
|
} while (ret == IMAGE_PROCESS_NEXT);
|
||||||
|
|
|
@ -191,7 +191,8 @@ void manual_content_scan_scrub_system_name_custom(void)
|
||||||
* and/or violate the No-Intro filename standard:
|
* and/or violate the No-Intro filename standard:
|
||||||
* http://datomatic.no-intro.org/stuff/The%20Official%20No-Intro%20Convention%20(20071030).zip
|
* http://datomatic.no-intro.org/stuff/The%20Official%20No-Intro%20Convention%20(20071030).zip
|
||||||
* Replace these characters with underscores */
|
* 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 = '_';
|
*scrub_char_pointer = '_';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -396,7 +396,8 @@ static char **waiting_argv;
|
||||||
|
|
||||||
task_queue_check();
|
task_queue_check();
|
||||||
|
|
||||||
while(CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.002, FALSE) == kCFRunLoopRunHandledSource);
|
while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.002, FALSE)
|
||||||
|
== kCFRunLoopRunHandledSource);
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_QT
|
#ifdef HAVE_QT
|
||||||
|
|
Loading…
Reference in New Issue