mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 08:43:10 +00:00
Have rhash.c use retro_file
This commit is contained in:
parent
d74be88d0a
commit
4ed3d66c04
@ -31,6 +31,7 @@
|
|||||||
#include <rhash.h>
|
#include <rhash.h>
|
||||||
#include <retro_miscellaneous.h>
|
#include <retro_miscellaneous.h>
|
||||||
#include <retro_endianness.h>
|
#include <retro_endianness.h>
|
||||||
|
#include <retro_file.h>
|
||||||
|
|
||||||
#define LSL32(x, n) ((uint32_t)(x) << (n))
|
#define LSL32(x, n) ((uint32_t)(x) << (n))
|
||||||
#define LSR32(x, n) ((uint32_t)(x) >> (n))
|
#define LSR32(x, n) ((uint32_t)(x) >> (n))
|
||||||
@ -504,16 +505,16 @@ int sha1_calculate(const char *path, char *result)
|
|||||||
unsigned char buff[4096] = {0};
|
unsigned char buff[4096] = {0};
|
||||||
SHA1Context sha;
|
SHA1Context sha;
|
||||||
int rv = 1;
|
int rv = 1;
|
||||||
int fd = open(path, O_RDONLY);
|
RFILE *fd = retro_fopen(path, RFILE_MODE_READ, -1);
|
||||||
|
|
||||||
if (fd < 0)
|
if (!fd)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
SHA1Reset(&sha);
|
SHA1Reset(&sha);
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
rv = read(fd, buff, 4096);
|
rv = retro_fread(fd, buff, 4096);
|
||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -529,12 +530,12 @@ int sha1_calculate(const char *path, char *result)
|
|||||||
sha.Message_Digest[2],
|
sha.Message_Digest[2],
|
||||||
sha.Message_Digest[3], sha.Message_Digest[4]);
|
sha.Message_Digest[3], sha.Message_Digest[4]);
|
||||||
|
|
||||||
close(fd);
|
retro_fclose(fd);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (fd >= 0)
|
if (fd)
|
||||||
close(fd);
|
retro_fclose(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "retroarch-joyconfig.c"
|
#include "retroarch-joyconfig.c"
|
||||||
|
|
||||||
#include "../libretro-common/dynamic/dylib.c"
|
#include "../libretro-common/dynamic/dylib.c"
|
||||||
|
#include "../libretro-common/file/retro_file.c"
|
||||||
|
|
||||||
#if defined(__linux) && !defined(ANDROID)
|
#if defined(__linux) && !defined(ANDROID)
|
||||||
#include "../input/drivers/linuxraw_input.c"
|
#include "../input/drivers/linuxraw_input.c"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user