1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

tools/ffhash: Use O_BINARY when available

This fixes reading files in Windows

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
James Almer 2013-05-16 19:10:28 -03:00 committed by Michael Niedermayer
parent ab074ab9fe
commit 54372848f3

View File

@ -71,10 +71,13 @@ static void finish(void)
static int check(char *file) static int check(char *file)
{ {
uint8_t buffer[SIZE]; uint8_t buffer[SIZE];
int fd; int fd, flags = O_RDONLY;
int ret = 0; int ret = 0;
if (file) fd = open(file, O_RDONLY); #ifdef O_BINARY
flags |= O_BINARY;
#endif
if (file) fd = open(file, flags);
else fd = 0; else fd = 0;
if (fd == -1) { if (fd == -1) {
printf("%s=OPEN-FAILED: %s:", av_hash_get_name(hash), strerror(errno)); printf("%s=OPEN-FAILED: %s:", av_hash_get_name(hash), strerror(errno));