mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 22:13:51 +00:00
(libretro-common) Try to prevent implicit usage of stdio fprintf
This commit is contained in:
parent
bc226305d7
commit
8bf11e9b18
@ -992,10 +992,12 @@ bool rpng_iterate_image(rpng_t *rpng)
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
#ifdef RPNG_TEST
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "chunktype: %c\n", chunk.type[i]);
|
fprintf(stderr, "chunktype: %c\n", chunk.type[i]);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (png_chunk_type(&chunk))
|
switch (png_chunk_type(&chunk))
|
||||||
|
@ -503,8 +503,8 @@ int64_t filestream_read_file(const char *path, void **buf, int64_t *len)
|
|||||||
|
|
||||||
if (!file)
|
if (!file)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Failed to open %s: %s\n", path, strerror(errno));
|
*buf = NULL;
|
||||||
goto error;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
content_buf_size = filestream_get_size(file);
|
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);
|
ret = filestream_read(file, content_buf, (int64_t)content_buf_size);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
|
||||||
fprintf(stderr, "Failed to read %s: %s\n", path, strerror(errno));
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
|
||||||
|
|
||||||
filestream_close(file);
|
filestream_close(file);
|
||||||
|
|
||||||
|
@ -648,8 +648,8 @@ bool rzipstream_read_file(const char *path, void **buf, int64_t *len)
|
|||||||
|
|
||||||
if (!stream)
|
if (!stream)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[rzipstream] Failed to open file: %s\n", path ? path : "");
|
*buf = NULL;
|
||||||
goto error;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get file size */
|
/* 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);
|
bytes_read = rzipstream_read(stream, content_buf, content_buf_size);
|
||||||
|
|
||||||
if (bytes_read < 0)
|
if (bytes_read < 0)
|
||||||
{
|
|
||||||
fprintf(stderr, "[rzipstream] Failed to read file: %s\n", path);
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
|
||||||
|
|
||||||
/* Close file */
|
/* Close file */
|
||||||
rzipstream_close(stream);
|
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);
|
stream = rzipstream_open(path, RETRO_VFS_FILE_ACCESS_WRITE);
|
||||||
|
|
||||||
if (!stream)
|
if (!stream)
|
||||||
{
|
|
||||||
fprintf(stderr, "[rzipstream] Failed to open file: %s\n", path ? path : "");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
/* Write contents of data buffer to file */
|
/* Write contents of data buffer to file */
|
||||||
bytes_written = rzipstream_write(stream, data, len);
|
bytes_written = rzipstream_write(stream, data, len);
|
||||||
|
|
||||||
/* Close file */
|
/* Close file */
|
||||||
if (rzipstream_close(stream) == -1)
|
if (rzipstream_close(stream) == -1)
|
||||||
{
|
|
||||||
fprintf(stderr, "[rzipstream] Failed to close file: %s\nData will be lost...\n", path);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
/* Check that the correct number of bytes
|
/* Check that the correct number of bytes
|
||||||
* were written */
|
* were written */
|
||||||
if (bytes_written != len)
|
if (bytes_written != len)
|
||||||
{
|
|
||||||
fprintf(stderr, "[rzipstream] Wrote incorrect number of bytes to file: %s\n", path);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user