This commit is contained in:
twinaphex 2015-04-26 05:38:38 +02:00
parent f78fbffc88
commit 6b6800a32b
37 changed files with 205 additions and 184 deletions

View File

@ -108,8 +108,8 @@ static int parse_short(const char *optstring, char * const *argv)
}
else if (embedded_arg)
{
/* If we see additional characters,
* and they don't take arguments, this
/* If we see additional characters,
* and they don't take arguments, this
* means we have multiple flags in one. */
memmove(&argv[0][1], &argv[0][2], strlen(&argv[0][2]) + 1);
return opt[0];
@ -136,7 +136,7 @@ static int parse_long(const struct option *longopts, char * const *argv)
if (!opt)
return '?';
/* getopt_long has an "optional" arg, but we don't bother with that. */
if (opt->has_arg && !argv[1])
return '?';

View File

@ -26,10 +26,10 @@
#include <compat/fnmatch.h>
/* Implemnentation of fnmatch(3) so it can be
/* Implemnentation of fnmatch(3) so it can be
* distributed to non *nix platforms.
*
* No flags are implemented ATM.
* No flags are implemented ATM.
* We don't use them. Add flags as needed. */
int rl_fnmatch(const char *pattern, const char *string, int flags)
@ -47,7 +47,7 @@ int rl_fnmatch(const char *pattern, const char *string, int flags)
{
/* Match any number of unknown chars */
case '*':
/* Find next node in the pattern
/* Find next node in the pattern
* ignoring multiple asterixes
*/
do {
@ -56,7 +56,7 @@ int rl_fnmatch(const char *pattern, const char *string, int flags)
return 0;
} while (*c == '*');
/* Match the remaining pattern
/* Match the remaining pattern
* ignoring more and more characters. */
do {
/* We reached the end of the string without a
@ -105,9 +105,9 @@ int rl_fnmatch(const char *pattern, const char *string, int flags)
c++;
/* Dangling escape at end of pattern.
* FIXME: Was c == '\0' (makes no sense).
* Not sure if c == NULL or *c == '\0'
* Not sure if c == NULL or *c == '\0'
* is intended. Assuming *c due to c++ right before. */
if (*c == '\0')
if (*c == '\0')
return FNM_NOMATCH;
default:
if (*c != *string)

View File

@ -11,7 +11,7 @@
documentation for any purpose is hereby granted without fee, provided
that this copyright and permissions notice appear in all copies and
derivatives.
This software is supplied "as is" without express or implied warranty.
But that said, if there are any problems please get in touch.

View File

@ -79,7 +79,7 @@ static char *getaline(FILE *file)
in = getc(file);
}
newline[idx] = '\0';
return newline;
return newline;
}
static char *extract_value(char *line, bool is_value)
@ -153,7 +153,7 @@ static void add_child_list(config_file_t *parent, config_file_t *child)
/* Rebase tail. */
if (parent->entries)
{
struct config_entry_list *head =
struct config_entry_list *head =
(struct config_entry_list*)parent->entries;
while (head->next)
@ -433,7 +433,7 @@ config_file_t *config_file_new_from_string(const char *from_string)
conf->path = NULL;
conf->include_depth = 0;
lines = string_split(from_string, "\n");
if (!lines)
return conf;

View File

@ -114,7 +114,7 @@ int config_userdata_get_string(void *userdata, const char *key_str,
if (got)
{
*output = str;
return true;
return true;
}
*output = strdup(default_output);

View File

@ -49,16 +49,16 @@
static int qstrcmp_plain(const void *a_, const void *b_)
{
const struct string_list_elem *a = (const struct string_list_elem*)a_;
const struct string_list_elem *b = (const struct string_list_elem*)b_;
const struct string_list_elem *a = (const struct string_list_elem*)a_;
const struct string_list_elem *b = (const struct string_list_elem*)b_;
return strcasecmp(a->data, b->data);
}
static int qstrcmp_dir(const void *a_, const void *b_)
{
const struct string_list_elem *a = (const struct string_list_elem*)a_;
const struct string_list_elem *b = (const struct string_list_elem*)b_;
const struct string_list_elem *a = (const struct string_list_elem*)a_;
const struct string_list_elem *b = (const struct string_list_elem*)b_;
int a_type = a->attr.i;
int b_type = b->attr.i;

View File

@ -336,7 +336,7 @@ bool file_list_search(const file_list_t *list, const char *needle, size_t *idx)
}
else if (str && !ret)
{
/* Found mid-string match, but try to find a match with
/* Found mid-string match, but try to find a match with
* first characters before we settle. */
*idx = i;
ret = true;

View File

@ -70,7 +70,7 @@
* path_get_extension:
* @path : path
*
* Gets extension of file. Only '.'s
* Gets extension of file. Only '.'s
* after the last slash are considered.
*
* Returns: extension part from the path.
@ -190,7 +190,7 @@ bool path_file_exists(const char *path)
* fill_pathname:
* @out_path : output path
* @in_path : input path
* @replace : what to replace
* @replace : what to replace
* @size : buffer size of output path
*
* FIXME: Verify
@ -202,10 +202,10 @@ bool path_file_exists(const char *path)
* Only '.'s after the last slash are considered as extensions.
* If no '.' is present, in_path and replace will simply be concatenated.
* 'size' is buffer size of 'out_path'.
* E.g.: in_path = "/foo/bar/baz/boo.c", replace = ".asm" =>
* out_path = "/foo/bar/baz/boo.asm"
* E.g.: in_path = "/foo/bar/baz/boo.c", replace = ".asm" =>
* out_path = "/foo/bar/baz/boo.asm"
* E.g.: in_path = "/foo/bar/baz/boo.c", replace = "" =>
* out_path = "/foo/bar/baz/boo"
* out_path = "/foo/bar/baz/boo"
*/
void fill_pathname(char *out_path, const char *in_path,
const char *replace, size_t size)
@ -226,7 +226,7 @@ void fill_pathname(char *out_path, const char *in_path,
* fill_pathname_noext:
* @out_path : output path
* @in_path : input path
* @replace : what to replace
* @replace : what to replace
* @size : buffer size of output path
*
* Appends a filename extension 'replace' to 'in_path', and outputs
@ -256,7 +256,7 @@ static char *find_last_slash(const char *str)
return (char*)slash;
}
/**
/**
* fill_pathname_slash:
* @path : path
* @size : size of path
@ -308,7 +308,7 @@ void fill_pathname_dir(char *in_dir, const char *in_basename,
/**
* fill_pathname_base:
* @out : output path
* @out : output path
* @in_path : input path
* @size : size of output path
*
@ -344,7 +344,7 @@ void fill_pathname_base(char *out, const char *in_path, size_t size)
/**
* fill_pathname_basedir:
* @out_dir : output directory
* @out_dir : output directory
* @in_path : input path
* @size : size of output directory
*
@ -361,7 +361,7 @@ void fill_pathname_basedir(char *out_dir,
/**
* fill_pathname_parent_dir:
* @out_dir : output directory
* @out_dir : output directory
* @in_dir : input directory
* @size : size of output directory
*
@ -381,10 +381,10 @@ void fill_pathname_parent_dir(char *out_dir,
* @ext : extension of output filename
* @size : buffer size of output filename
*
* Creates a 'dated' filename prefixed by 'RetroArch', and
* Creates a 'dated' filename prefixed by 'RetroArch', and
* concatenates extension (@ext) to it.
*
* E.g.:
* E.g.:
* out_filename = "RetroArch-{month}{day}-{Hours}{Minutes}.{@ext}"
**/
void fill_dated_filename(char *out_filename,
@ -400,7 +400,7 @@ void fill_dated_filename(char *out_filename,
/**
* path_basedir:
* @path : path
* @path : path
*
* Extracts base directory by mutating path.
* Keeps trailing '/'.
@ -620,12 +620,12 @@ void fill_pathname_resolve_relative(char *out_path,
/**
* fill_pathname_join:
* @out_path : output path
* @dir : directory
* @dir : directory
* @path : path
* @size : size of output path
*
* Joins a directory (@dir) and path (@path) together.
* Makes sure not to get two consecutive slashes
* Makes sure not to get two consecutive slashes
* between directory and path.
**/
void fill_pathname_join(char *out_path,
@ -642,12 +642,12 @@ void fill_pathname_join(char *out_path,
/**
* fill_pathname_join_delim:
* @out_path : output path
* @dir : directory
* @dir : directory
* @path : path
* @delim : delimiter
* @delim : delimiter
* @size : size of output path
*
* Joins a directory (@dir) and path (@path) together
* Joins a directory (@dir) and path (@path) together
* using the given delimiter (@delim).
**/
void fill_pathname_join_delim(char *out_path, const char *dir,
@ -691,7 +691,7 @@ void fill_short_pathname_representation(char* out_rep,
*/
if(last_hash != NULL)
{
/* We check whether something is actually
/* We check whether something is actually
* after the hash to avoid going over the buffer.
*/
rarch_assert(strlen(last_hash) > 1);

View File

@ -174,7 +174,7 @@ static void png_reverse_filter_copy_line_bw(uint32_t *data,
unsigned i, bit;
static const unsigned mul_table[] = { 0, 0xff, 0x55, 0, 0x11, 0, 0, 0, 0x01 };
unsigned mul, mask;
if (depth == 16)
{
for (i = 0; i < width; i++)
@ -296,7 +296,7 @@ static void png_reverse_filter_adam7_deinterlace_pass(uint32_t *data,
y++, data += ihdr->width * pass->stride_y, input += pass_width)
{
uint32_t *out = data;
for (x = 0; x < pass_width; x++, out += pass->stride_x)
*out = input[x];
}
@ -336,9 +336,9 @@ static int png_reverse_filter_init(const struct png_ihdr *ihdr,
ihdr->height <= passes[pngp->pass.pos].y) /* Empty pass */
return 1;
pngp->pass.width = (ihdr->width -
pngp->pass.width = (ihdr->width -
passes[pngp->pass.pos].x + passes[pngp->pass.pos].stride_x - 1) / passes[pngp->pass.pos].stride_x;
pngp->pass.height = (ihdr->height - passes[pngp->pass.pos].y +
pngp->pass.height = (ihdr->height - passes[pngp->pass.pos].y +
passes[pngp->pass.pos].stride_y - 1) / passes[pngp->pass.pos].stride_y;
pngp->data = (uint32_t*)malloc(
@ -613,10 +613,10 @@ end:
*height = rpng->ihdr.height;
#ifdef GEKKO
/* we often use these in textures, make sure they're 32-byte aligned */
*data = (uint32_t*)memalign(32, rpng->ihdr.width *
*data = (uint32_t*)memalign(32, rpng->ihdr.width *
rpng->ihdr.height * sizeof(uint32_t));
#else
*data = (uint32_t*)malloc(rpng->ihdr.width *
*data = (uint32_t*)malloc(rpng->ihdr.width *
rpng->ihdr.height * sizeof(uint32_t));
#endif
if (!*data)

View File

@ -255,7 +255,7 @@ static bool rpng_save_image(const char *path,
/* Try every filtering method, and choose the method
* which has most entries as zero.
*
* This is probably not very optimal, but it's very
* This is probably not very optimal, but it's very
* simple to implement.
*/
unsigned none_score = count_sad(rgba_line, width * bpp);

View File

@ -53,7 +53,7 @@ static bool png_read_chunk(FILE **fd, struct png_chunk *chunk)
if (!chunk->data)
return false;
if (fread(chunk->data, 1, chunk->size +
if (fread(chunk->data, 1, chunk->size +
sizeof(uint32_t), file) != (chunk->size + sizeof(uint32_t)))
{
free(chunk->data);
@ -175,6 +175,7 @@ bool rpng_load_image_argb_iterate(FILE **fd, struct rpng_t *rpng)
return false;
}
png_free_chunk(&chunk);
rpng->has_ihdr = true;
break;
@ -244,7 +245,7 @@ bool rpng_load_image_argb(const char *path, uint32_t **data,
GOTO_END_ERROR();
/* feof() apparently isn't triggered after a seek (IEND). */
for (pos = ftell(file);
for (pos = ftell(file);
pos < file_len && pos >= 0; pos = ftell(file))
{
if (!rpng_load_image_argb_iterate(&file, &rpng))
@ -280,5 +281,11 @@ end:
free(*data);
free(rpng.idat_buf.data);
free(rpng.process.inflate_buf);
if (rpng.process.stream)
{
zlib_stream_free(rpng.process.stream);
free(rpng.process.stream);
}
return ret;
}

View File

@ -77,7 +77,7 @@ static bool png_realloc_idat(const struct png_chunk *chunk, struct idat_buffer *
return true;
}
static bool png_read_plte_into_buf(uint8_t *buf,
static bool png_read_plte_into_buf(uint8_t *buf,
uint32_t *buffer, unsigned entries)
{
unsigned i;
@ -221,6 +221,11 @@ void rpng_nbio_load_image_free(struct rpng_t *rpng)
free(rpng->idat_buf.data);
if (rpng->process.inflate_buf)
free(rpng->process.inflate_buf);
if (rpng->process.stream)
{
zlib_stream_free(rpng->process.stream);
free(rpng->process.stream);
}
if (rpng)
free(rpng);
@ -233,7 +238,7 @@ bool rpng_nbio_load_image_argb_start(struct rpng_t *rpng)
if (!rpng)
return false;
for (i = 0; i < 8; i++)
header[i] = rpng->buff_data[i];

View File

@ -105,7 +105,7 @@ static bool rpng_nbio_load_image_argb(const char *path, uint32_t **data,
ret = false;
goto end;
}
do
{
retval = rpng_nbio_load_image_argb_process(rpng, data, width, height);

View File

@ -1,7 +1,7 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2015 - Daniel De Matteis
*
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.

View File

@ -63,7 +63,7 @@ static void rxml_free_node(struct rxml_node *node)
if (!attrib_node_head)
continue;
next_attrib = (struct rxml_attrib_node*)attrib_node_head->next;
if (!next_attrib)
@ -171,7 +171,7 @@ static struct rxml_attrib_node *rxml_parse_attrs(const char *str)
if (!attrib || !value)
goto end;
struct rxml_attrib_node *new_node =
struct rxml_attrib_node *new_node =
(struct rxml_attrib_node*)calloc(1, sizeof(*new_node));
if (!new_node)
goto end;
@ -298,7 +298,7 @@ static struct rxml_node *rxml_parse_node(const char **ptr_)
goto error;
}
node->data = strdup_range(cdata_start +
node->data = strdup_range(cdata_start +
strlen("<![CDATA["), cdata_end);
}
else if (closing_start && closing_start == child_start) /* Simple Data */
@ -314,7 +314,7 @@ static struct rxml_node *rxml_parse_node(const char **ptr_)
ptr = child_start;
first_start = strchr(ptr, '<');
first_closing = strstr(ptr, "</");
while (
first_start &&
first_closing &&
@ -322,7 +322,7 @@ static struct rxml_node *rxml_parse_node(const char **ptr_)
)
{
struct rxml_node *new_node = rxml_parse_node(&ptr);
if (!new_node)
{
free(closing_tag);
@ -395,7 +395,7 @@ static char *purge_xml_comments(const char *str)
copy_src = comment_end + strlen("-->");
}
/* Avoid strcpy() as OpenBSD is anal and hates you
/* Avoid strcpy() as OpenBSD is anal and hates you
* for using it even when it's perfectly safe. */
len = strlen(copy_src);
memcpy(copy_dest, copy_src, len);

View File

@ -29,7 +29,7 @@ static void print_siblings(struct rxml_node *node, unsigned level)
if (node->data)
fprintf(stderr, "%*sData: %s\n", level * 4, "", node->data);
for (const struct rxml_attrib_node *attrib =
for (const struct rxml_attrib_node *attrib =
node->attrib; attrib; attrib = attrib->next)
fprintf(stderr, "%*s Attrib: %s = %s\n", level * 4, "",
attrib->attrib, attrib->value);

View File

@ -760,7 +760,7 @@ void conv_argb8888_abgr8888(void *output_, const void *input_,
for (w = 0; w < width; w++)
{
uint32_t col = input[w];
output[w] = ((col << 16) & 0xff0000) |
output[w] = ((col << 16) & 0xff0000) |
((col >> 16) & 0xff) | (col & 0xff00ff00);
}
}

View File

@ -145,7 +145,7 @@ static bool gen_filter_sinc(struct scaler_ctx *ctx)
{
int x_pos, x_step, y_pos, y_step;
double phase_mul_horiz, phase_mul_vert;
/* Need to expand the filter when downsampling
/* Need to expand the filter when downsampling
* to get a proper low-pass effect. */
const int sinc_size = 8 * ((ctx->in_width > ctx->out_width)
? next_pow2(ctx->in_width / ctx->out_width) : 1);
@ -183,7 +183,7 @@ static bool validate_filter(struct scaler_ctx *ctx)
{
if (ctx->horiz.filter_pos[i] > max_w_pos || ctx->horiz.filter_pos[i] < 0)
{
fprintf(stderr, "Out X = %d => In X = %d\n", i, ctx->horiz.filter_pos[i]);
fprintf(stderr, "Out X = %d => In X = %d\n", i, ctx->horiz.filter_pos[i]);
return false;
}
}
@ -194,7 +194,7 @@ static bool validate_filter(struct scaler_ctx *ctx)
{
if (ctx->vert.filter_pos[i] > max_h_pos || ctx->vert.filter_pos[i] < 0)
{
fprintf(stderr, "Out Y = %d => In Y = %d\n", i, ctx->vert.filter_pos[i]);
fprintf(stderr, "Out Y = %d => In Y = %d\n", i, ctx->vert.filter_pos[i]);
return false;
}
}

View File

@ -2,7 +2,7 @@
"""
License statement applies to this file (glgen.py) only.
"""
"""
"""
Permission is hereby granted, free of charge,

View File

@ -28,13 +28,13 @@
#endif
/* Custom implementation of the GNU getopt_long for portability.
* Not designed to be fully compatible, but compatible with
* Not designed to be fully compatible, but compatible with
* the features RetroArch uses. */
#ifdef HAVE_GETOPT_LONG
#include <getopt.h>
#else
/* Avoid possible naming collisions during link since we
/* Avoid possible naming collisions during link since we
* prefer to use the actual name. */
#define getopt_long(argc, argv, optstring, longopts, longindex) __getopt_long_rarch(argc, argv, optstring, longopts, longindex)
@ -51,7 +51,7 @@ struct option
};
/* argv[] is declared with char * const argv[] in GNU,
* but this makes no sense, as non-POSIX getopt_long
* but this makes no sense, as non-POSIX getopt_long
* mutates argv (non-opts are moved to the end). */
int getopt_long(int argc, char *argv[],
const char *optstring, const struct option *longopts, int *longindex);

View File

@ -1,5 +1,5 @@
/* ISO C9x compliant stdint.h for Microsoft Visual Studio
* Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
* Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
*
* Copyright (c) 2006-2008 Alexander Chemeris
*
@ -22,7 +22,7 @@
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -35,7 +35,7 @@
extern "C" {
#endif
/* Avoid possible naming collisions during link
/* Avoid possible naming collisions during link
* since we prefer to use the actual name. */
#define strcasestr(haystack, needle) strcasestr_rarch__(haystack, needle)

View File

@ -35,7 +35,7 @@
#ifdef __cplusplus
extern "C" {
#endif
/* Avoid possible naming collisions during link since
/* Avoid possible naming collisions during link since
* we prefer to use the actual name. */
#define strlcpy(dst, src, size) strlcpy_rarch__(dst, src, size)

View File

@ -120,11 +120,11 @@ bool config_get_uint64(config_file_t *conf, const char *entry, uint64_t *in);
/* Extracts an unsigned int from config file treating input as hex. */
bool config_get_hex(config_file_t *conf, const char *entry, unsigned *in);
/* Extracts a single char. If value consists of several chars,
/* Extracts a single char. If value consists of several chars,
* this is an error. */
bool config_get_char(config_file_t *conf, const char *entry, char *in);
/* Extracts an allocated string in *in. This must be free()-d if
/* Extracts an allocated string in *in. This must be free()-d if
* this function succeeds. */
bool config_get_string(config_file_t *conf, const char *entry, char **in);
@ -140,7 +140,7 @@ bool config_get_path(config_file_t *conf, const char *entry, char *in, size_t si
* Other values will be treated as an error. */
bool config_get_bool(config_file_t *conf, const char *entry, bool *in);
/* Setters. Similar to the getters.
/* Setters. Similar to the getters.
* Will not write to entry if the entry was obtained from an #include. */
void config_set_double(config_file_t *conf, const char *entry, double value);
void config_set_float(config_file_t *conf, const char *entry, float value);

View File

@ -49,10 +49,10 @@ typedef struct file_list
} file_list_t;
void *file_list_get_userdata_at_offset(const file_list_t *list,
void *file_list_get_userdata_at_offset(const file_list_t *list,
size_t index);
void *file_list_get_actiondata_at_offset(const file_list_t *list,
void *file_list_get_actiondata_at_offset(const file_list_t *list,
size_t index);
void file_list_free(file_list_t *list);

View File

@ -98,7 +98,7 @@ bool path_file_exists(const char *path);
* path_get_extension:
* @path : path
*
* Gets extension of file. Only '.'s
* Gets extension of file. Only '.'s
* after the last slash are considered.
*
* Returns: extension part from the path.
@ -139,7 +139,7 @@ const char *path_basename(const char *path);
/**
* path_basedir:
* @path : path
* @path : path
*
* Extracts base directory by mutating path.
* Keeps trailing '/'.
@ -179,7 +179,7 @@ bool path_is_absolute(const char *path);
* fill_pathname:
* @out_path : output path
* @in_path : input path
* @replace : what to replace
* @replace : what to replace
* @size : buffer size of output path
*
* FIXME: Verify
@ -191,10 +191,10 @@ bool path_is_absolute(const char *path);
* Only '.'s after the last slash are considered as extensions.
* If no '.' is present, in_path and replace will simply be concatenated.
* 'size' is buffer size of 'out_path'.
* E.g.: in_path = "/foo/bar/baz/boo.c", replace = ".asm" =>
* out_path = "/foo/bar/baz/boo.asm"
* E.g.: in_path = "/foo/bar/baz/boo.c", replace = ".asm" =>
* out_path = "/foo/bar/baz/boo.asm"
* E.g.: in_path = "/foo/bar/baz/boo.c", replace = "" =>
* out_path = "/foo/bar/baz/boo"
* out_path = "/foo/bar/baz/boo"
*/
void fill_pathname(char *out_path, const char *in_path,
const char *replace, size_t size);
@ -205,10 +205,10 @@ void fill_pathname(char *out_path, const char *in_path,
* @ext : extension of output filename
* @size : buffer size of output filename
*
* Creates a 'dated' filename prefixed by 'RetroArch', and
* Creates a 'dated' filename prefixed by 'RetroArch', and
* concatenates extension (@ext) to it.
*
* E.g.:
* E.g.:
* out_filename = "RetroArch-{month}{day}-{Hours}{Minutes}.{@ext}"
**/
void fill_dated_filename(char *out_filename,
@ -218,7 +218,7 @@ void fill_dated_filename(char *out_filename,
* fill_pathname_noext:
* @out_path : output path
* @in_path : input path
* @replace : what to replace
* @replace : what to replace
* @size : buffer size of output path
*
* Appends a filename extension 'replace' to 'in_path', and outputs
@ -253,7 +253,7 @@ void fill_pathname_dir(char *in_dir, const char *in_basename,
/**
* fill_pathname_base:
* @out : output path
* @out : output path
* @in_path : input path
* @size : size of output path
*
@ -263,7 +263,7 @@ void fill_pathname_base(char *out_path, const char *in_path, size_t size);
/**
* fill_pathname_basedir:
* @out_dir : output directory
* @out_dir : output directory
* @in_path : input path
* @size : size of output directory
*
@ -275,7 +275,7 @@ void fill_pathname_basedir(char *out_path, const char *in_path, size_t size);
/**
* fill_pathname_parent_dir:
* @out_dir : output directory
* @out_dir : output directory
* @in_dir : input directory
* @size : size of output directory
*
@ -303,12 +303,12 @@ void fill_pathname_resolve_relative(char *out_path, const char *in_refpath,
/**
* fill_pathname_join:
* @out_path : output path
* @dir : directory
* @dir : directory
* @path : path
* @size : size of output path
*
* Joins a directory (@dir) and path (@path) together.
* Makes sure not to get two consecutive slashes
* Makes sure not to get two consecutive slashes
* between directory and path.
**/
void fill_pathname_join(char *out_path, const char *dir,
@ -317,12 +317,12 @@ void fill_pathname_join(char *out_path, const char *dir,
/**
* fill_pathname_join_delim:
* @out_path : output path
* @dir : directory
* @dir : directory
* @path : path
* @delim : delimiter
* @delim : delimiter
* @size : size of output path
*
* Joins a directory (@dir) and path (@path) together
* Joins a directory (@dir) and path (@path) together
* using the given delimiter (@delim).
**/
void fill_pathname_join_delim(char *out_path, const char *dir,
@ -385,7 +385,7 @@ static INLINE const char *path_default_slash(void)
#endif
}
/**
/**
* fill_pathname_slash:
* @path : path
* @size : size of path

View File

@ -1,7 +1,7 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2015 - Daniel De Matteis
*
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.

View File

@ -27,11 +27,11 @@ extern "C" {
#endif
/* Total NIH. Very trivial "XML" implementation for use in RetroArch.
* Error checking is minimal. Invalid documents may lead to very
* Error checking is minimal. Invalid documents may lead to very
* buggy behavior, but memory corruption should never happen.
*
* Only parts of standard that RetroArch cares about is supported.
* Nothing more, nothing less. "Clever" XML documents will
* Nothing more, nothing less. "Clever" XML documents will
* probably break the implementation.
*
* Do *NOT* try to use this for anything else. You have been warned.
@ -55,9 +55,9 @@ struct rxml_node
struct rxml_node *children;
struct rxml_node *next;
/* Dummy. Used by libxml2 compat.
/* Dummy. Used by libxml2 compat.
* Is always set to 0, so XML_ELEMENT_NODE check goes through. */
int type;
int type;
};
rxml_document_t *rxml_load_document(const char *path);
@ -65,9 +65,9 @@ void rxml_free_document(rxml_document_t *doc);
struct rxml_node *rxml_root_node(rxml_document_t *doc);
/* Drop const-correctness here to avoid warnings
/* Drop const-correctness here to avoid warnings
* when used as libxml2 compat.
* xmlGetProp() returns xmlChar*, which is supposed
* xmlGetProp() returns xmlChar*, which is supposed
* to be passed to xmlFree(). */
char *rxml_node_attrib(struct rxml_node *node, const char *attrib);

View File

@ -24,7 +24,7 @@
#define __LIBRETRO_SDK_GFX_MATH_MATRIX_4X4_H__
/* Column-major matrix (OpenGL-style).
* Reimplements functionality from FF OpenGL pipeline to be able
* Reimplements functionality from FF OpenGL pipeline to be able
* to work on GLES 2.0 and modern GL variants.
*/

View File

@ -49,11 +49,11 @@ sthread_t *sthread_create(void (*thread_func)(void*), void *userdata);
/**
* sthread_detach:
* @thread : pointer to thread object
* @thread : pointer to thread object
*
* Detach a thread. When a detached thread terminates, its
* resource sare automatically released back to the system
* without the need for another thread to join with the
* without the need for another thread to join with the
* terminated thread.
*
* Returns: 0 on success, otherwise it returns a non-zero error number.
@ -62,13 +62,13 @@ int sthread_detach(sthread_t *thread);
/**
* sthread_join:
* @thread : pointer to thread object
* @thread : pointer to thread object
*
* Join with a terminated thread. Waits for the thread specified by
* @thread to terminate. If that thread has already terminated, then
* it will return immediately. The thread specified by @thread must
* be joinable.
*
*
* Returns: 0 on success, otherwise it returns a non-zero error number.
*/
void sthread_join(sthread_t *thread);
@ -85,7 +85,7 @@ slock_t *slock_new(void);
/**
* slock_free:
* @lock : pointer to mutex object
* @lock : pointer to mutex object
*
* Frees a mutex.
**/
@ -93,7 +93,7 @@ void slock_free(slock_t *lock);
/**
* slock_lock:
* @lock : pointer to mutex object
* @lock : pointer to mutex object
*
* Locks a mutex. If a mutex is already locked by
* another thread, the calling thread shall block until
@ -103,7 +103,7 @@ void slock_lock(slock_t *lock);
/**
* slock_unlock:
* @lock : pointer to mutex object
* @lock : pointer to mutex object
*
* Unlocks a mutex.
**/
@ -122,7 +122,7 @@ scond_t *scond_new(void);
/**
* scond_free:
* @cond : pointer to condition variable object
* @cond : pointer to condition variable object
*
* Frees a condition variable.
**/
@ -130,17 +130,17 @@ void scond_free(scond_t *cond);
/**
* scond_wait:
* @cond : pointer to condition variable object
* @lock : pointer to mutex object
* @cond : pointer to condition variable object
* @lock : pointer to mutex object
*
* Block on a condition variable (i.e. wait on a condition).
* Block on a condition variable (i.e. wait on a condition).
**/
void scond_wait(scond_t *cond, slock_t *lock);
/**
* scond_wait_timeout:
* @cond : pointer to condition variable object
* @lock : pointer to mutex object
* @cond : pointer to condition variable object
* @lock : pointer to mutex object
* @timeout_us : timeout (in microseconds)
*
* Try to block on a condition variable (i.e. wait on a condition) until
@ -153,19 +153,19 @@ bool scond_wait_timeout(scond_t *cond, slock_t *lock, int64_t timeout_us);
/**
* scond_broadcast:
* @cond : pointer to condition variable object
* @cond : pointer to condition variable object
*
* Broadcast a condition. Unblocks all threads currently blocked
* on the specified condition variable @cond.
* on the specified condition variable @cond.
**/
int scond_broadcast(scond_t *cond);
/**
* scond_signal:
* @cond : pointer to condition variable object
* @cond : pointer to condition variable object
*
* Signal a condition. Unblocks at least one of the threads currently blocked
* on the specified condition variable @cond.
* on the specified condition variable @cond.
**/
void scond_signal(scond_t *cond);

View File

@ -124,7 +124,7 @@ void string_list_free(struct string_list *list);
* @list : pointer to string list.
* @delim : delimiter character for @list.
*
* A string list will be joined/concatenated as a
* A string list will be joined/concatenated as a
* string to @buffer, delimited by @delim.
*/
void string_list_join_concat(char *buffer, size_t size,

View File

@ -21,8 +21,6 @@ static thread_local long long co_active_buffer[64];
static thread_local cothread_t co_active_handle = 0;
#ifndef CO_USE_INLINE_ASM
static void (*co_swap)(cothread_t, cothread_t) = 0;
#else
void co_swap(cothread_t, cothread_t);
#endif
#ifdef _WIN32
@ -115,29 +113,7 @@ void co_init(void)
mprotect((void*)base, size, PROT_READ | PROT_WRITE | PROT_EXEC);
}
#else
__asm__(
".intel_syntax noprefix\n"
".globl co_swap \n"
"co_swap: \n"
".globl _co_swap \n" /* OSX ABI is different from Linux. */
"_co_swap: \n"
"mov [rsi],rsp \n"
"mov [rsi+0x08],rbp \n"
"mov [rsi+0x10],rbx \n"
"mov [rsi+0x18],r12 \n"
"mov [rsi+0x20],r13 \n"
"mov [rsi+0x28],r14 \n"
"mov [rsi+0x30],r15 \n"
"mov rsp,[rdi] \n"
"mov rbp,[rdi+0x08] \n"
"mov rbx,[rdi+0x10] \n"
"mov r12,[rdi+0x18] \n"
"mov r13,[rdi+0x20] \n"
"mov r14,[rdi+0x28] \n"
"mov r15,[rdi+0x30] \n"
"ret \n"
".att_syntax \n"
);
void co_init(void) {}
#endif
#endif
@ -186,11 +162,42 @@ void co_delete(cothread_t handle)
free(handle);
}
#ifndef CO_USE_INLINE_ASM
void co_switch(cothread_t handle)
{
register cothread_t co_previous_handle = co_active_handle;
co_swap(co_active_handle = handle, co_previous_handle);
}
#else
#ifdef __APPLE__
#define ASM_PREFIX "_"
#else
#define ASM_PREFIX ""
#endif
__asm__(
".intel_syntax noprefix \n"
".globl " ASM_PREFIX "co_switch \n"
ASM_PREFIX "co_switch: \n"
"mov rsi, [rip+" ASM_PREFIX "co_active_handle]\n"
"mov [rsi],rsp \n"
"mov [rsi+0x08],rbp \n"
"mov [rsi+0x10],rbx \n"
"mov [rsi+0x18],r12 \n"
"mov [rsi+0x20],r13 \n"
"mov [rsi+0x28],r14 \n"
"mov [rsi+0x30],r15 \n"
"mov [rip+" ASM_PREFIX "co_active_handle], rdi\n"
"mov rsp,[rdi] \n"
"mov rbp,[rdi+0x08] \n"
"mov rbx,[rdi+0x10] \n"
"mov r12,[rdi+0x18] \n"
"mov r13,[rdi+0x20] \n"
"mov r14,[rdi+0x28] \n"
"mov r15,[rdi+0x30] \n"
"ret \n"
".att_syntax \n"
);
#endif
#ifdef __cplusplus
}

View File

@ -28,7 +28,7 @@ asm (
".globl co_switch_arm\n"
".globl _co_switch_arm\n"
"co_switch_arm:\n"
"_co_switch_arm:\n"
"_co_switch_arm:\n"
" stmia r1!, {r4, r5, r6, r7, r8, r9, r10, r11, sp, lr}\n"
" ldmia r0!, {r4, r5, r6, r7, r8, r9, r10, r11, sp, pc}\n"
);

View File

@ -56,7 +56,7 @@ or are directly to function */
#ifdef __cplusplus
extern "C"
#endif
/* Swap code is in ppc.S */
void co_swap_asm( cothread_t, cothread_t );
#define CO_SWAP_ASM( x, y ) co_swap_asm( x, y )
@ -285,15 +285,15 @@ static const uint32_t libco_ppc_code [] = {
static uint32_t* co_create_( unsigned size, uintptr_t entry )
{
uint32_t* t = (uint32_t*) malloc( size );
(void) entry;
#if LIBCO_PPCDESC
if ( t )
{
/* Copy entry's descriptor */
memcpy( t, (void*) entry, sizeof (void*) * 3 );
/* Set function pointer to swap routine */
#ifdef LIBCO_PPC_ASM
*(const void**) t = *(void**) &co_swap_asm;
@ -302,7 +302,7 @@ static uint32_t* co_create_( unsigned size, uintptr_t entry )
#endif
}
#endif
return t;
}
@ -310,38 +310,38 @@ cothread_t co_create( unsigned int size, void (*entry_)( void ) )
{
uintptr_t entry = (uintptr_t) entry_;
uint32_t* t = NULL;
/* Be sure main thread was successfully allocated */
if ( co_active() )
{
size += state_size + above_stack + stack_align;
t = co_create_( size, entry );
}
if ( t )
{
uintptr_t sp;
int shift;
/* Save current registers into new thread, so that any special ones will
have proper values when thread is begun */
CO_SWAP_ASM( t, t );
#if LIBCO_PPCDESC
/* Get real address */
entry = (uintptr_t) *(void**) entry;
#endif
/* Put stack near end of block, and align */
sp = (uintptr_t) t + size - above_stack;
sp -= sp % stack_align;
/* On PPC32, we save and restore GPRs as 32 bits. For PPC64, we
save and restore them as 64 bits, regardless of the size the ABI
uses. So, we manually write pointers at the proper size. We always
save and restore at the same address, and since PPC is big-endian,
we must put the low byte first on PPC32. */
/* If uintptr_t is 32 bits, >>32 is undefined behavior, so we do two shifts
and don't have to care how many bits uintptr_t is. */
#if LIBCO_PPC64
@ -349,15 +349,15 @@ cothread_t co_create( unsigned int size, void (*entry_)( void ) )
#else
shift = 0;
#endif
/* Set up so entry will be called on next swap */
t [8] = (uint32_t) (entry >> shift >> shift);
t [9] = (uint32_t) entry;
t [10] = (uint32_t) (sp >> shift >> shift);
t [10] = (uint32_t) (sp >> shift >> shift);
t [11] = (uint32_t) sp;
}
return t;
}

View File

@ -59,7 +59,7 @@ msg_queue_t *msg_queue_new(size_t size)
queue->size = size + 1;
queue->elems = (struct queue_elem**)
calloc(queue->size,sizeof(struct queue_elem*));
calloc(queue->size,sizeof(struct queue_elem*));
if (!queue->elems)
{
@ -177,11 +177,11 @@ const char *msg_queue_pull(msg_queue_t *queue)
struct queue_elem *front = NULL, *last = NULL,
*parent = NULL, *child = NULL;
size_t tmp_ptr = 1;
(void)parent;
(void)child;
(void)tmp_ptr;
/* Nothing in queue. */
if (!queue || queue->ptr == 1)
return NULL;

View File

@ -84,6 +84,8 @@ static void *thread_wrap(void *data_)
#endif
{
struct thread_data *data = (struct thread_data*)data_;
if (!data)
return 0;
data->func(data->userdata);
free(data);
return 0;
@ -132,11 +134,11 @@ sthread_t *sthread_create(void (*thread_func)(void*), void *userdata)
/**
* sthread_detach:
* @thread : pointer to thread object
* @thread : pointer to thread object
*
* Detach a thread. When a detached thread terminates, its
* resource sare automatically released back to the system
* without the need for another thread to join with the
* without the need for another thread to join with the
* terminated thread.
*
* Returns: 0 on success, otherwise it returns a non-zero error number.
@ -154,13 +156,13 @@ int sthread_detach(sthread_t *thread)
/**
* sthread_join:
* @thread : pointer to thread object
* @thread : pointer to thread object
*
* Join with a terminated thread. Waits for the thread specified by
* @thread to terminate. If that thread has already terminated, then
* it will return immediately. The thread specified by @thread must
* be joinable.
*
*
* Returns: 0 on success, otherwise it returns a non-zero error number.
*/
void sthread_join(sthread_t *thread)
@ -204,7 +206,7 @@ slock_t *slock_new(void)
/**
* slock_free:
* @lock : pointer to mutex object
* @lock : pointer to mutex object
*
* Frees a mutex.
**/
@ -223,7 +225,7 @@ void slock_free(slock_t *lock)
/**
* slock_lock:
* @lock : pointer to mutex object
* @lock : pointer to mutex object
*
* Locks a mutex. If a mutex is already locked by
* another thread, the calling thread shall block until
@ -240,7 +242,7 @@ void slock_lock(slock_t *lock)
/**
* slock_unlock:
* @lock : pointer to mutex object
* @lock : pointer to mutex object
*
* Unlocks a mutex.
**/
@ -284,7 +286,7 @@ scond_t *scond_new(void)
/**
* scond_free:
* @cond : pointer to condition variable object
* @cond : pointer to condition variable object
*
* Frees a condition variable.
**/
@ -303,16 +305,16 @@ void scond_free(scond_t *cond)
/**
* scond_wait:
* @cond : pointer to condition variable object
* @lock : pointer to mutex object
* @cond : pointer to condition variable object
* @lock : pointer to mutex object
*
* Block on a condition variable (i.e. wait on a condition).
* Block on a condition variable (i.e. wait on a condition).
**/
void scond_wait(scond_t *cond, slock_t *lock)
{
#ifdef _WIN32
WaitForSingleObject(cond->event, 0);
SignalObjectAndWait(lock->lock, cond->event, INFINITE, FALSE);
slock_lock(lock);
#else
@ -322,15 +324,15 @@ void scond_wait(scond_t *cond, slock_t *lock)
/**
* scond_broadcast:
* @cond : pointer to condition variable object
* @cond : pointer to condition variable object
*
* Broadcast a condition. Unblocks all threads currently blocked
* on the specified condition variable @cond.
* on the specified condition variable @cond.
**/
int scond_broadcast(scond_t *cond)
{
#ifdef _WIN32
/* FIXME _- check how this function should differ
/* FIXME _- check how this function should differ
* from scond_signal implementation. */
SetEvent(cond->event);
return 0;
@ -341,10 +343,10 @@ int scond_broadcast(scond_t *cond)
/**
* scond_signal:
* @cond : pointer to condition variable object
* @cond : pointer to condition variable object
*
* Signal a condition. Unblocks at least one of the threads currently blocked
* on the specified condition variable @cond.
* on the specified condition variable @cond.
**/
void scond_signal(scond_t *cond)
{
@ -357,8 +359,8 @@ void scond_signal(scond_t *cond)
/**
* scond_wait_timeout:
* @cond : pointer to condition variable object
* @lock : pointer to mutex object
* @cond : pointer to condition variable object
* @lock : pointer to mutex object
* @timeout_us : timeout (in microseconds)
*
* Try to block on a condition variable (i.e. wait on a condition) until

View File

@ -146,7 +146,7 @@ void string_list_set(struct string_list *list,
* @list : pointer to string list.
* @delim : delimiter character for @list.
*
* A string list will be joined/concatenated as a
* A string list will be joined/concatenated as a
* string to @buffer, delimited by @delim.
*/
void string_list_join_concat(char *buffer, size_t size,