mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 00:39:53 +00:00
Silence code warnings
This commit is contained in:
parent
726de8e447
commit
e5b9ca5187
@ -101,39 +101,40 @@ uint32_t encoding_crc32(uint32_t crc, const uint8_t *buf, size_t len)
|
||||
*
|
||||
* Returns: the crc32, or 0 if there was an error.
|
||||
*/
|
||||
uint32_t file_crc32(uint32_t crc, const char *path) {
|
||||
if(path == NULL)
|
||||
return 0;
|
||||
|
||||
RFILE *file = NULL;
|
||||
uint32_t file_crc32(uint32_t crc, const char *path)
|
||||
{
|
||||
unsigned i;
|
||||
RFILE *file = NULL;
|
||||
unsigned char *buf = NULL;
|
||||
int i, nread;
|
||||
if (!path)
|
||||
return 0;
|
||||
|
||||
file = filestream_open(path, RETRO_VFS_FILE_ACCESS_READ, 0);
|
||||
if(file == NULL)
|
||||
if (!file)
|
||||
goto error;
|
||||
|
||||
buf = (char *)malloc(CRC32_BUFFER_SIZE);
|
||||
if(buf == NULL)
|
||||
goto error;
|
||||
buf = (unsigned char*)malloc(CRC32_BUFFER_SIZE);
|
||||
if (!buf)
|
||||
goto error;
|
||||
|
||||
for(i = 0; i < CRC32_MAX_MB; i++) {
|
||||
nread = filestream_read(file, buf, CRC32_BUFFER_SIZE);
|
||||
if(nread < 0)
|
||||
goto error;
|
||||
for(i = 0; i < CRC32_MAX_MB; i++)
|
||||
{
|
||||
int nread = filestream_read(file, buf, CRC32_BUFFER_SIZE);
|
||||
if (nread < 0)
|
||||
goto error;
|
||||
|
||||
crc = encoding_crc32(crc, buf, nread);
|
||||
if(filestream_eof(file))
|
||||
if (filestream_eof(file))
|
||||
break;
|
||||
}
|
||||
free(buf);
|
||||
filestream_close(file);
|
||||
return crc;
|
||||
|
||||
error:
|
||||
if(buf)
|
||||
free(buf);
|
||||
if(file)
|
||||
filestream_close(file);
|
||||
return 0;
|
||||
error:
|
||||
if (buf)
|
||||
free(buf);
|
||||
if (file)
|
||||
filestream_close(file);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user