Style nits

This commit is contained in:
twinaphex 2016-01-26 05:48:31 +01:00
parent d8fef4df6e
commit 9c4b927b17
2 changed files with 35 additions and 16 deletions

View File

@ -99,7 +99,8 @@ static bool read_content_file(unsigned i, const char *path, void **buf,
#ifdef HAVE_ZLIB #ifdef HAVE_ZLIB
content_ctl(CONTENT_CTL_GET_CRC, &content_crc_ptr); content_ctl(CONTENT_CTL_GET_CRC, &content_crc_ptr);
*content_crc_ptr = stream_backend->stream_crc_calculate(0, ret_buf, *length); *content_crc_ptr = stream_backend->stream_crc_calculate(
0, ret_buf, *length);
RARCH_LOG("CRC32: 0x%x .\n", (unsigned)*content_crc_ptr); RARCH_LOG("CRC32: 0x%x .\n", (unsigned)*content_crc_ptr);
#endif #endif
@ -313,7 +314,8 @@ static bool load_ram_file(ram_type_t *ram)
{ {
if (rc > (ssize_t)size) if (rc > (ssize_t)size)
{ {
RARCH_WARN("SRAM is larger than implementation expects, doing partial load (truncating %u %s %s %u).\n", RARCH_WARN("SRAM is larger than implementation expects, "
"doing partial load (truncating %u %s %s %u).\n",
(unsigned)rc, (unsigned)rc,
msg_hash_to_str(MSG_BYTES), msg_hash_to_str(MSG_BYTES),
msg_hash_to_str(MSG_TO), msg_hash_to_str(MSG_TO),
@ -490,7 +492,8 @@ static bool load_content(
if (require_content && string_is_empty(path)) if (require_content && string_is_empty(path))
{ {
RARCH_LOG("libretro core requires content, but nothing was provided.\n"); RARCH_LOG("libretro core requires content, "
"but nothing was provided.\n");
return false; return false;
} }
@ -557,13 +560,15 @@ static bool init_content_file_subsystem(
if (special->num_roms && !global->subsystem_fullpaths) if (special->num_roms && !global->subsystem_fullpaths)
{ {
RARCH_ERR("libretro core requires special content, but none were provided.\n"); RARCH_ERR("libretro core requires special content, "
"but none were provided.\n");
return false; return false;
} }
else if (special->num_roms && special->num_roms else if (special->num_roms && special->num_roms
!= global->subsystem_fullpaths->size) != global->subsystem_fullpaths->size)
{ {
RARCH_ERR("libretro core requires %u content files for subsystem \"%s\", but %u content files were provided.\n", RARCH_ERR("libretro core requires %u content files for "
"subsystem \"%s\", but %u content files were provided.\n",
special->num_roms, special->desc, special->num_roms, special->desc,
(unsigned)global->subsystem_fullpaths->size); (unsigned)global->subsystem_fullpaths->size);
return false; return false;
@ -571,7 +576,8 @@ static bool init_content_file_subsystem(
else if (!special->num_roms && global->subsystem_fullpaths else if (!special->num_roms && global->subsystem_fullpaths
&& global->subsystem_fullpaths->size) && global->subsystem_fullpaths->size)
{ {
RARCH_ERR("libretro core takes no content for subsystem \"%s\", but %u content files were provided.\n", RARCH_ERR("libretro core takes no content for subsystem \"%s\", "
"but %u content files were provided.\n",
special->desc, special->desc,
(unsigned)global->subsystem_fullpaths->size); (unsigned)global->subsystem_fullpaths->size);
return false; return false;
@ -686,7 +692,8 @@ static bool init_content_file_set_attribs(
#ifdef HAVE_ZLIB #ifdef HAVE_ZLIB
/* Try to extract all content we're going to load if appropriate. */ /* Try to extract all content we're going to load if appropriate. */
if (!init_content_file_extract(temporary_content, content, system, special, &attr)) if (!init_content_file_extract(temporary_content,
content, system, special, &attr))
return false; return false;
#endif #endif
return true; return true;

View File

@ -161,7 +161,8 @@ static int read_7zip_file(
} }
SzArEx_GetFileNameUtf16(&db, i, temp); SzArEx_GetFileNameUtf16(&db, i, temp);
res = utf16_to_char_string(temp, infile, sizeof(infile)) ? SZ_OK : SZ_ERROR_FAIL; res = utf16_to_char_string(temp, infile, sizeof(infile))
? SZ_OK : SZ_ERROR_FAIL;
if (string_is_equal(infile, needle)) if (string_is_equal(infile, needle))
{ {
@ -307,7 +308,8 @@ static struct string_list *compressed_7zip_file_list_new(
} }
SzArEx_GetFileNameUtf16(&db, i, temp); SzArEx_GetFileNameUtf16(&db, i, temp);
res = utf16_to_char_string(temp, infile, sizeof(infile)) ? SZ_OK : SZ_ERROR_FAIL; res = utf16_to_char_string(temp, infile, sizeof(infile))
? SZ_OK : SZ_ERROR_FAIL;
file_ext = path_get_extension(infile); file_ext = path_get_extension(infile);
if (string_list_find_elem_prefix(ext_list, ".", file_ext)) if (string_list_find_elem_prefix(ext_list, ".", file_ext))
@ -395,14 +397,17 @@ static int zip_file_decompressed(const char *name, const char *valid_exts,
int ret = 0; int ret = 0;
file_archive_file_handle_t handle = {0}; file_archive_file_handle_t handle = {0};
handle.backend = file_archive_get_default_file_backend(); handle.backend = file_archive_get_default_file_backend();
if (!handle.backend->stream_decompress_data_to_file_init(&handle, cdata, csize, size)) if (!handle.backend->stream_decompress_data_to_file_init(
&handle, cdata, csize, size))
return false; return false;
do{ do{
ret = handle.backend->stream_decompress_data_to_file_iterate(handle.stream); ret = handle.backend->stream_decompress_data_to_file_iterate(
handle.stream);
}while(ret == 0); }while(ret == 0);
handle.real_checksum = handle.backend->stream_crc_calculate(0, handle.data, size); handle.real_checksum = handle.backend->stream_crc_calculate(0,
handle.data, size);
if (handle.real_checksum != crc32) if (handle.real_checksum != crc32)
{ {
@ -440,11 +445,16 @@ static int read_zip_file(const char *path,
zlib.type = ZLIB_TRANSFER_INIT; zlib.type = ZLIB_TRANSFER_INIT;
st.needle = needle ? strdup(needle) : NULL; st.needle = NULL;
st.opt_file = optional_outfile ? strdup(optional_outfile) : NULL; st.opt_file = NULL;
st.found = false; st.found = false;
st.buf = buf; st.buf = buf;
if (needle)
st.needle = strdup(needle);
if (optional_outfile)
st.opt_file = strdup(optional_outfile);
do do
{ {
ret = file_archive_parse_file_iterate(&zlib, &returnerr, path, ret = file_archive_parse_file_iterate(&zlib, &returnerr, path,
@ -509,7 +519,8 @@ int read_compressed_file(const char * path, void **buf,
#ifdef HAVE_7ZIP #ifdef HAVE_7ZIP
if (string_is_equal_noncase(file_ext, "7z")) if (string_is_equal_noncase(file_ext, "7z"))
{ {
*length = read_7zip_file(str_list->elems[0].data, str_list->elems[1].data, buf, optional_filename); *length = read_7zip_file(str_list->elems[0].data,
str_list->elems[1].data, buf, optional_filename);
if (*length != -1) if (*length != -1)
ret = 1; ret = 1;
} }
@ -518,7 +529,8 @@ int read_compressed_file(const char * path, void **buf,
if (string_is_equal_noncase(file_ext, "zip")) if (string_is_equal_noncase(file_ext, "zip"))
{ {
stream_backend = file_archive_get_default_file_backend(); stream_backend = file_archive_get_default_file_backend();
*length = read_zip_file(str_list->elems[0].data, str_list->elems[1].data, buf, optional_filename); *length = read_zip_file(str_list->elems[0].data,
str_list->elems[1].data, buf, optional_filename);
if (*length != -1) if (*length != -1)
ret = 1; ret = 1;
} }