diff options
author | Martijn van Beurden <mvanb1@gmail.com> | 2022-05-17 22:05:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-17 22:05:45 +0200 |
commit | e5e99dcdc2e7814fedd8b4a7fcd6879366e8f928 (patch) | |
tree | 82b89084f8433c6198ac3506100e66bb141ad8b5 /include | |
parent | 3d4081848944463ff72da215044263ee29b22f79 (diff) | |
download | flac-e5e99dcdc2e7814fedd8b4a7fcd6879366e8f928.tar.gz |
Simplify and merge win_utf8 files and remove from DLL interface
libFLAC DLLs were exposing windows_unicode_filename.h functions
because flac and metaflac needed to set flac_internal_set_utf8_
filenames. Files windows_unicode_filename.{c/h} and
win_utf8_io.[c/h] are merged, and all non-utf8 parts are removed.
With this commit, the libFLAC DLL interface is the same as the
libFLAC interface of shared libraries on other platforms
Diffstat (limited to 'include')
-rw-r--r-- | include/FLAC++/export.h | 4 | ||||
-rw-r--r-- | include/FLAC/export.h | 4 | ||||
-rw-r--r-- | include/FLAC/stream_decoder.h | 16 | ||||
-rw-r--r-- | include/FLAC/stream_encoder.h | 14 | ||||
-rw-r--r-- | include/share/compat.h | 14 | ||||
-rw-r--r-- | include/share/win_utf8_io.h | 10 | ||||
-rw-r--r-- | include/share/windows_unicode_filenames.h | 66 |
7 files changed, 41 insertions, 87 deletions
diff --git a/include/FLAC++/export.h b/include/FLAC++/export.h index 2d7a8c97..f9b09bc4 100644 --- a/include/FLAC++/export.h +++ b/include/FLAC++/export.h @@ -84,9 +84,9 @@ /* These \#defines will mirror the libtool-based library version number, see * http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning */ -#define FLACPP_API_VERSION_CURRENT 9 +#define FLACPP_API_VERSION_CURRENT 10 #define FLACPP_API_VERSION_REVISION 0 -#define FLACPP_API_VERSION_AGE 3 +#define FLACPP_API_VERSION_AGE 0 /* \} */ diff --git a/include/FLAC/export.h b/include/FLAC/export.h index 40f8cea8..70b200db 100644 --- a/include/FLAC/export.h +++ b/include/FLAC/export.h @@ -84,9 +84,9 @@ /** These \#defines will mirror the libtool-based library version number, see * http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning */ -#define FLAC_API_VERSION_CURRENT 11 +#define FLAC_API_VERSION_CURRENT 12 #define FLAC_API_VERSION_REVISION 0 /**< see above */ -#define FLAC_API_VERSION_AGE 3 /**< see above */ +#define FLAC_API_VERSION_AGE 0 /**< see above */ #ifdef __cplusplus extern "C" { diff --git a/include/FLAC/stream_decoder.h b/include/FLAC/stream_decoder.h index 67be1a24..533ad192 100644 --- a/include/FLAC/stream_decoder.h +++ b/include/FLAC/stream_decoder.h @@ -1280,11 +1280,14 @@ FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_FILE( /** Initialize the decoder instance to decode native FLAC files. * * This flavor of initialization sets up the decoder to decode from a plain - * native FLAC file. If POSIX fopen() semantics are not sufficient, (for - * example, with Unicode filenames on Windows), you must use - * FLAC__stream_decoder_init_FILE(), or FLAC__stream_decoder_init_stream() + * native FLAC file. If POSIX fopen() semantics are not sufficient, you must + * use FLAC__stream_decoder_init_FILE(), or FLAC__stream_decoder_init_stream() * and provide callbacks for the I/O. * + * On Windows, filename must be a UTF-8 encoded filename, which libFLAC + * internally translates to a appropriate representation to use with + * _wfopen + * * This function should be called after FLAC__stream_decoder_new() and * FLAC__stream_decoder_set_*() but before any of the * FLAC__stream_decoder_process_*() functions. Will set and return the @@ -1322,11 +1325,14 @@ FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_file( /** Initialize the decoder instance to decode Ogg FLAC files. * * This flavor of initialization sets up the decoder to decode from a plain - * Ogg FLAC file. If POSIX fopen() semantics are not sufficient, (for - * example, with Unicode filenames on Windows), you must use + * Ogg FLAC file. If POSIX fopen() semantics are not sufficient, you must use * FLAC__stream_decoder_init_ogg_FILE(), or FLAC__stream_decoder_init_ogg_stream() * and provide callbacks for the I/O. * + * On Windows, filename must be a UTF-8 encoded filename, which libFLAC + * internally translates to a appropriate representation to use with + * _wfopen + * * This function should be called after FLAC__stream_decoder_new() and * FLAC__stream_decoder_set_*() but before any of the * FLAC__stream_decoder_process_*() functions. Will set and return the diff --git a/include/FLAC/stream_encoder.h b/include/FLAC/stream_encoder.h index 03c116aa..de66de54 100644 --- a/include/FLAC/stream_encoder.h +++ b/include/FLAC/stream_encoder.h @@ -1657,11 +1657,14 @@ FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_FILE(FLAC__ /** Initialize the encoder instance to encode native FLAC files. * * This flavor of initialization sets up the encoder to encode to a plain - * FLAC file. If POSIX fopen() semantics are not sufficient (for example, - * with Unicode filenames on Windows), you must use + * FLAC file. If POSIX fopen() semantics are not sufficient you must use * FLAC__stream_encoder_init_FILE(), or FLAC__stream_encoder_init_stream() * and provide callbacks for the I/O. * + * On Windows, filename must be a UTF-8 encoded filename, which libFLAC + * internally translates to a appropriate representation to use with + * _wfopen + * * This function should be called after FLAC__stream_encoder_new() and * FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process() * or FLAC__stream_encoder_process_interleaved(). @@ -1689,11 +1692,14 @@ FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_file(FLAC__Stre /** Initialize the encoder instance to encode Ogg FLAC files. * * This flavor of initialization sets up the encoder to encode to a plain - * Ogg FLAC file. If POSIX fopen() semantics are not sufficient (for example, - * with Unicode filenames on Windows), you must use + * Ogg FLAC file. If POSIX fopen() semantics are not sufficient, you must use * FLAC__stream_encoder_init_ogg_FILE(), or FLAC__stream_encoder_init_ogg_stream() * and provide callbacks for the I/O. * + * On Windows, filename must be a UTF-8 encoded filename, which libFLAC + * internally translates to a appropriate representation to use with + * _wfopen + * * This function should be called after FLAC__stream_encoder_new() and * FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process() * or FLAC__stream_encoder_process_interleaved(). diff --git a/include/share/compat.h b/include/share/compat.h index f72c209b..e9e522a7 100644 --- a/include/share/compat.h +++ b/include/share/compat.h @@ -147,14 +147,12 @@ #define flac_printf printf_utf8 #define flac_fprintf fprintf_utf8 #define flac_vfprintf vfprintf_utf8 - -#include "share/windows_unicode_filenames.h" -#define flac_fopen flac_internal_fopen_utf8 -#define flac_chmod flac_internal_chmod_utf8 -#define flac_utime flac_internal_utime_utf8 -#define flac_unlink flac_internal_unlink_utf8 -#define flac_rename flac_internal_rename_utf8 -#define flac_stat flac_internal_stat64_utf8 +#define flac_fopen fopen_utf8 +#define flac_chmod chmod_utf8 +#define flac_utime utime_utf8 +#define flac_unlink unlink_utf8 +#define flac_rename rename_utf8 +#define flac_stat stat64_utf8 #else diff --git a/include/share/win_utf8_io.h b/include/share/win_utf8_io.h index 6031b898..3f2a48cc 100644 --- a/include/share/win_utf8_io.h +++ b/include/share/win_utf8_io.h @@ -36,6 +36,9 @@ #include <stdio.h> #include <stdarg.h> +#include <sys/stat.h> +#include <sys/utime.h> +#include "FLAC/ordinals.h" #ifdef __cplusplus extern "C" { @@ -50,6 +53,13 @@ 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); +FILE* fopen_utf8(const char *filename, const char *mode); +int stat64_utf8(const char *path, struct __stat64 *buffer); +int chmod_utf8(const char *filename, int pmode); +int utime_utf8(const char *filename, struct utimbuf *times); +int unlink_utf8(const char *filename); +int rename_utf8(const char *oldname, const char *newname); + #include <windows.h> HANDLE WINAPI CreateFile_utf8(const char *lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile); diff --git a/include/share/windows_unicode_filenames.h b/include/share/windows_unicode_filenames.h deleted file mode 100644 index 94cbeb6c..00000000 --- a/include/share/windows_unicode_filenames.h +++ /dev/null @@ -1,66 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2013-2016 Xiph.Org Foundation - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * - Neither the name of the Xiph.org Foundation nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifdef _WIN32 - -#ifndef flac__windows_unicode_filenames_h -#define flac__windows_unicode_filenames_h - -#include <stdio.h> -#include <sys/stat.h> -#include <sys/utime.h> -#include "FLAC/ordinals.h" - -/***** FIXME: KLUDGE: export these syms for flac.exe, metaflac.exe, etc. *****/ -#include "FLAC/export.h" - -#ifdef __cplusplus -extern "C" { -#endif - -FLAC_API void flac_internal_set_utf8_filenames(FLAC__bool flag); -FLAC_API FLAC__bool flac_internal_get_utf8_filenames(void); -#define flac_set_utf8_filenames flac_internal_set_utf8_filenames -#define flac_get_utf8_filenames flac_internal_get_utf8_filenames - -FLAC_API FILE* flac_internal_fopen_utf8(const char *filename, const char *mode); -FLAC_API int flac_internal_stat64_utf8(const char *path, struct __stat64 *buffer); -FLAC_API int flac_internal_chmod_utf8(const char *filename, int pmode); -FLAC_API int flac_internal_utime_utf8(const char *filename, struct utimbuf *times); -FLAC_API int flac_internal_unlink_utf8(const char *filename); -FLAC_API int flac_internal_rename_utf8(const char *oldname, const char *newname); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif -#endif |