mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-23 19:24:46 +00:00
style cleanup and fix typos
This commit is contained in:
parent
097f326298
commit
89f9b096e7
@ -95,11 +95,10 @@ end:
|
||||
* Returns: pointer to the delimiter in the path if it contains
|
||||
* a compressed file, otherwise NULL.
|
||||
*/
|
||||
char *path_get_archive_delim(const char *path)
|
||||
const char *path_get_archive_delim(const char *path)
|
||||
{
|
||||
const char *last = find_last_slash(path);
|
||||
|
||||
#ifdef HAVE_COMPRESSION
|
||||
const char *last = find_last_slash(path);
|
||||
char *delim = NULL;
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
@ -483,7 +482,7 @@ void path_basedir(char *path)
|
||||
|
||||
#ifdef HAVE_COMPRESSION
|
||||
/* We want to find the directory with the zipfile in basedir. */
|
||||
last = path_get_archive_delim(path);
|
||||
last = path + (path_get_archive_delim(path) - path);
|
||||
if (last)
|
||||
*last = '\0';
|
||||
#endif
|
||||
@ -528,7 +527,7 @@ const char *path_basename(const char *path)
|
||||
const char *delim = path_get_archive_delim(path);
|
||||
|
||||
if (delim)
|
||||
return last + 1;
|
||||
return delim + 1;
|
||||
#endif
|
||||
|
||||
if (last)
|
||||
@ -724,15 +723,15 @@ void fill_short_pathname_representation(char* out_rep,
|
||||
{
|
||||
char path_short[PATH_MAX_LENGTH] = {0};
|
||||
#ifdef HAVE_COMPRESSION
|
||||
char *last_hash = NULL;
|
||||
char *last_slash = NULL;
|
||||
#endif
|
||||
|
||||
fill_pathname(path_short, path_basename(in_path), "",
|
||||
sizeof(path_short));
|
||||
|
||||
#ifdef HAVE_COMPRESSION
|
||||
last_hash = find_last_slash(path_short);
|
||||
if(last_hash != NULL)
|
||||
last_slash = find_last_slash(path_short);
|
||||
if(last_slash != NULL)
|
||||
{
|
||||
/* We handle paths like:
|
||||
* /path/to/file.7z#mygame.img
|
||||
@ -741,8 +740,8 @@ void fill_short_pathname_representation(char* out_rep,
|
||||
* We check whether something is actually
|
||||
* after the hash to avoid going over the buffer.
|
||||
*/
|
||||
retro_assert(strlen(last_hash) > 1);
|
||||
strlcpy(out_rep, last_hash + 1, size);
|
||||
retro_assert(strlen(last_slash) > 1);
|
||||
strlcpy(out_rep, last_slash + 1, size);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -94,7 +94,7 @@ bool path_file_exists(const char *path);
|
||||
* Returns: pointer to the delimiter in the path if it contains
|
||||
* a compressed file, otherwise NULL.
|
||||
*/
|
||||
char *path_get_archive_delim(const char *path);
|
||||
const char *path_get_archive_delim(const char *path);
|
||||
|
||||
/**
|
||||
* path_get_extension:
|
||||
|
@ -113,15 +113,15 @@ bool string_list_append(struct string_list *list, const char *elem,
|
||||
* string_list_append_n:
|
||||
* @list : pointer to string list
|
||||
* @elem : element to add to the string list
|
||||
* @attr : attributes of new element.
|
||||
* @length : read at most this many bytes from elem
|
||||
* @attr : attributes of new element.
|
||||
*
|
||||
* Appends a new element to the string list.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool string_list_append_n(struct string_list *list, const char *elem,
|
||||
union string_list_elem_attr attr, unsigned length);
|
||||
unsigned length, union string_list_elem_attr attr);
|
||||
|
||||
/**
|
||||
* string_list_free
|
||||
|
@ -134,15 +134,15 @@ bool string_list_append(struct string_list *list, const char *elem,
|
||||
* string_list_append_n:
|
||||
* @list : pointer to string list
|
||||
* @elem : element to add to the string list
|
||||
* @attr : attributes of new element.
|
||||
* @length : read at most this many bytes from elem
|
||||
* @attr : attributes of new element.
|
||||
*
|
||||
* Appends a new element to the string list.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool string_list_append_n(struct string_list *list, const char *elem,
|
||||
union string_list_elem_attr attr, unsigned length)
|
||||
unsigned length, union string_list_elem_attr attr)
|
||||
{
|
||||
char *data_dup = NULL;
|
||||
|
||||
@ -152,11 +152,11 @@ bool string_list_append_n(struct string_list *list, const char *elem,
|
||||
|
||||
data_dup = (char*)malloc(length + 1);
|
||||
|
||||
strlcpy(data_dup, elem, length + 1);
|
||||
|
||||
if (!data_dup)
|
||||
return false;
|
||||
|
||||
strlcpy(data_dup, elem, length + 1);
|
||||
|
||||
list->elems[list->size].data = data_dup;
|
||||
list->elems[list->size].attr = attr;
|
||||
|
||||
|
@ -328,14 +328,12 @@ struct string_list *filename_split_archive(const char *path)
|
||||
memset(&attr, 0, sizeof(attr));
|
||||
|
||||
#ifdef HAVE_COMPRESSION
|
||||
char *delim = path_get_archive_delim(path);
|
||||
const char *delim = path_get_archive_delim(path);
|
||||
|
||||
if (delim)
|
||||
{
|
||||
// add archive path to list first
|
||||
*delim = '\0';
|
||||
|
||||
if (!string_list_append_n(list, path, attr, delim - path))
|
||||
if (!string_list_append_n(list, path, delim - path, attr))
|
||||
goto error;
|
||||
|
||||
// now add the path within the archive
|
||||
@ -346,14 +344,11 @@ struct string_list *filename_split_archive(const char *path)
|
||||
if (!string_list_append(list, delim, attr))
|
||||
goto error;
|
||||
}
|
||||
}else{
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (!string_list_append(list, path, attr))
|
||||
goto error;
|
||||
}
|
||||
#else
|
||||
if (!string_list_append(list, path, attr))
|
||||
goto error;
|
||||
#endif
|
||||
|
||||
return list;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user