(iOS) Build fix and use zlib_perform_mode in apple/iOS/browser.m

This commit is contained in:
Twinaphex 2015-03-28 21:07:56 +01:00
parent 9281595024
commit ff24ddcd1d

View File

@ -22,7 +22,6 @@
#include "../../content.h" #include "../../content.h"
#include "../../general.h" #include "../../general.h"
#include <file/dir_list.h> #include <file/dir_list.h>
#include "../../file_ops.h"
#include <file/file_path.h> #include <file/file_path.h>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
@ -44,23 +43,28 @@ static int zlib_extract_callback(const char *name, const char *valid_exts,
return false; return false;
} }
// Ignore directories /* Ignore directories */
if (name[strlen(name) - 1] == '/') if (name[strlen(name) - 1] == '/')
return 1; return 1;
fill_pathname_join(path, (const char*)userdata, name, sizeof(path)); fill_pathname_join(path, (const char*)userdata, name, sizeof(path));
switch (cmode) if (!zlib_perform_mode(path, valid_exts,
cdata, cmode, csize, size, crc32, userdata))
{ {
case 0: // Uncompressed if (cmode == 0)
write_file(path, cdata, size); {
break; RARCH_ERR("Failed to write file: %s.\n", path);
case 8: // Deflate return 0;
zlib_inflate_data_to_file(path, valid_exts, cdata, csize, size, crc32); }
break; goto error;
} }
return 1; return 1;
error:
RARCH_ERR("Failed to deflate to: %s.\n", path);
return 0;
} }
static void unzip_file(const char* path, const char* output_directory) static void unzip_file(const char* path, const char* output_directory)