Add option to not use file I/O in libFLAC.

This commit is contained in:
2021-11-12 07:57:00 +00:00
parent 7d55296b5b
commit a01948c29a
5 changed files with 32 additions and 1 deletions

View File

@@ -49,6 +49,9 @@
#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__
#include <sys/types.h> /* for off_t */
#define FLAC__off_t __int64 /* use this instead of off_t to fix the 2 GB limit */
#ifndef FLAC__NO_FILEIO
#if !defined __MINGW32__
#define fseeko _fseeki64
#define ftello _ftelli64
@@ -58,6 +61,9 @@
#define ftello ftello64
#endif
#endif
#endif // FLAC__NO_FILEIO
#else
#define FLAC__off_t off_t
#endif
@@ -148,6 +154,8 @@
#define flac_fprintf fprintf_utf8
#define flac_vfprintf vfprintf_utf8
#ifndef FLAC__NO_FILEIO
#include "share/windows_unicode_filenames.h"
#define flac_fopen flac_internal_fopen_utf8
#define flac_chmod flac_internal_chmod_utf8
@@ -156,17 +164,21 @@
#define flac_rename flac_internal_rename_utf8
#define flac_stat flac_internal_stat64_utf8
#endif
#else
#define flac_printf printf
#define flac_fprintf fprintf
#define flac_vfprintf vfprintf
#ifndef FLAC__NO_FILEIO
#define flac_fopen fopen
#define flac_chmod chmod
#define flac_unlink unlink
#define flac_rename rename
#define flac_stat stat
#endif
#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L)
#define flac_utime(a, b) utimensat (AT_FDCWD, a, *b, 0)
@@ -175,6 +187,7 @@
#endif
#endif
#ifndef FLAC__NO_FILEIO
#ifdef _WIN32
#define flac_stat_s __stat64 /* stat struct */
#define flac_fstat _fstat64
@@ -182,6 +195,7 @@
#define flac_stat_s stat /* stat struct */
#define flac_fstat fstat
#endif
#endif
#ifdef ANDROID
#include <limits.h>

View File

@@ -50,8 +50,10 @@ int printf_utf8(const char *format, ...);
int fprintf_utf8(FILE *stream, const char *format, ...);
int vfprintf_utf8(FILE *stream, const char *format, va_list argptr);
#ifndef FLAC__NO_FILEIO
#include <windows.h>
HANDLE WINAPI CreateFile_utf8(const char *lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
#endif
#ifdef __cplusplus
} /* extern "C" */