Skip to content

Commit

Permalink
Resync libretro-common
Browse files Browse the repository at this point in the history
  • Loading branch information
LibretroAdmin committed Sep 5, 2024
1 parent 4b86886 commit 0f7a665
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
2 changes: 2 additions & 0 deletions libretro-common/file/file_path.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ size_t strftime_am_pm(char *s, size_t len, const char* format,
const void *ptr)
{
size_t _len = 0;
#if !(defined(__linux__) && !defined(ANDROID))
char *local = NULL;
#endif
const struct tm *timeptr = (const struct tm*)ptr;
/* Ensure correct locale is set
* > Required for localised AM/PM strings */
Expand Down
38 changes: 23 additions & 15 deletions libretro-common/streams/trans_stream_zlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
struct zlib_trans_stream
{
z_stream z;
int ex; /* window_bits or level */
int window_bits;
int level;
bool inited;
};

Expand All @@ -41,7 +42,8 @@ static void *zlib_deflate_stream_new(void)
if (!ret)
return NULL;
ret->inited = false;
ret->ex = 9;
ret->level = 9;
ret->window_bits = 15;

ret->z.next_in = NULL;
ret->z.avail_in = 0;
Expand Down Expand Up @@ -70,7 +72,7 @@ static void *zlib_inflate_stream_new(void)
if (!ret)
return NULL;
ret->inited = false;
ret->ex = MAX_WBITS;
ret->window_bits = MAX_WBITS;

ret->z.next_in = NULL;
ret->z.avail_in = 0;
Expand Down Expand Up @@ -115,23 +117,29 @@ static void zlib_inflate_stream_free(void *data)

static bool zlib_deflate_define(void *data, const char *prop, uint32_t val)
{
if (!data)
return false;

struct zlib_trans_stream *z = (struct zlib_trans_stream *) data;
if (string_is_equal(prop, "level"))
{
if (z)
z->ex = (int) val;
return true;
}
return false;
z->level = (int) val;
else if (string_is_equal(prop, "window_bits"))
z->window_bits = (int) val;
else
return false;

return true;
}

static bool zlib_inflate_define(void *data, const char *prop, uint32_t val)
{
if (!data)
return false;

struct zlib_trans_stream *z = (struct zlib_trans_stream *) data;
if (string_is_equal(prop, "window_bits"))
{
if (z)
z->ex = (int) val;
z->window_bits = (int) val;
return true;
}
return false;
Expand All @@ -149,7 +157,7 @@ static void zlib_deflate_set_in(void *data, const uint8_t *in, uint32_t in_size)

if (!z->inited)
{
deflateInit(&z->z, z->ex);
deflateInit2(&z->z, z->level, Z_DEFLATED , z->window_bits, 8, Z_DEFAULT_STRATEGY );
z->inited = true;
}
}
Expand All @@ -165,7 +173,7 @@ static void zlib_inflate_set_in(void *data, const uint8_t *in, uint32_t in_size)
z->z.avail_in = in_size;
if (!z->inited)
{
inflateInit2(&z->z, z->ex);
inflateInit2(&z->z, z->window_bits);
z->inited = true;
}
}
Expand Down Expand Up @@ -195,7 +203,7 @@ static bool zlib_deflate_trans(

if (!zt->inited)
{
deflateInit(z, zt->ex);
deflateInit2(z, zt->level, Z_DEFLATED , zt->window_bits, 8, Z_DEFAULT_STRATEGY );
zt->inited = true;
}

Expand Down Expand Up @@ -258,7 +266,7 @@ static bool zlib_inflate_trans(

if (!zt->inited)
{
inflateInit2(z, zt->ex);
inflateInit2(z, zt->window_bits);
zt->inited = true;
}

Expand Down

0 comments on commit 0f7a665

Please sign in to comment.