(libretro-common) Try to prevent implicit usage of stdio fprintf

This commit is contained in:
twinaphex 2020-05-24 20:18:36 +02:00
parent bc226305d7
commit 8bf11e9b18
3 changed files with 6 additions and 19 deletions

View File

@ -992,10 +992,12 @@ bool rpng_iterate_image(rpng_t *rpng)
goto error;
#if 0
#ifdef RPNG_TEST
for (i = 0; i < 4; i++)
{
fprintf(stderr, "chunktype: %c\n", chunk.type[i]);
}
#endif
#endif
switch (png_chunk_type(&chunk))

View File

@ -503,8 +503,8 @@ int64_t filestream_read_file(const char *path, void **buf, int64_t *len)
if (!file)
{
fprintf(stderr, "Failed to open %s: %s\n", path, strerror(errno));
goto error;
*buf = NULL;
return 0;
}
content_buf_size = filestream_get_size(file);
@ -521,10 +521,7 @@ int64_t filestream_read_file(const char *path, void **buf, int64_t *len)
ret = filestream_read(file, content_buf, (int64_t)content_buf_size);
if (ret < 0)
{
fprintf(stderr, "Failed to read %s: %s\n", path, strerror(errno));
goto error;
}
filestream_close(file);

View File

@ -648,8 +648,8 @@ bool rzipstream_read_file(const char *path, void **buf, int64_t *len)
if (!stream)
{
fprintf(stderr, "[rzipstream] Failed to open file: %s\n", path ? path : "");
goto error;
*buf = NULL;
return false;
}
/* Get file size */
@ -671,10 +671,7 @@ bool rzipstream_read_file(const char *path, void **buf, int64_t *len)
bytes_read = rzipstream_read(stream, content_buf, content_buf_size);
if (bytes_read < 0)
{
fprintf(stderr, "[rzipstream] Failed to read file: %s\n", path);
goto error;
}
/* Close file */
rzipstream_close(stream);
@ -888,28 +885,19 @@ bool rzipstream_write_file(const char *path, const void *data, int64_t len)
stream = rzipstream_open(path, RETRO_VFS_FILE_ACCESS_WRITE);
if (!stream)
{
fprintf(stderr, "[rzipstream] Failed to open file: %s\n", path ? path : "");
return false;
}
/* Write contents of data buffer to file */
bytes_written = rzipstream_write(stream, data, len);
/* Close file */
if (rzipstream_close(stream) == -1)
{
fprintf(stderr, "[rzipstream] Failed to close file: %s\nData will be lost...\n", path);
return false;
}
/* Check that the correct number of bytes
* were written */
if (bytes_written != len)
{
fprintf(stderr, "[rzipstream] Wrote incorrect number of bytes to file: %s\n", path);
return false;
}
return true;
}