3535 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3636 */
3737
38- #ifdef HAVE_CONFIG_H
39- #include "config.h"
40- #include "config_unix.h"
41- #include "config_win32.h"
42- #endif // HAVE_CONFIG_H
43-
38+ #include <assert.h>
39+ #include <errno.h>
4440#include <inttypes.h>
4541#include <limits.h>
4642#include <stdbool.h>
4743#include <stdint.h>
44+ #include <stdio.h>
45+ #include <string.h>
4846
4947#include "audio/utils.h"
5048#include "audio/wav_reader.h"
49+ #define WANT_FSEEKO64
50+ #include "compat/misc.h"
5151#include "debug.h"
5252#include "utils/macros.h"
5353#include "utils/misc.h"
@@ -144,8 +144,8 @@ static _Bool is_member(const char *needle, const char **haystack) {
144144 return 0 ;
145145}
146146
147- static int fskip (FILE * f , long off ) {
148- if (_fseeki64 (f , off , SEEK_CUR ) == 0 ) {
147+ static int fskip (FILE * f , long long off ) {
148+ if (fseeko (f , off , SEEK_CUR ) == 0 ) {
149149 return 1 ;
150150 }
151151 while (off -- > 0 ) {
@@ -162,21 +162,21 @@ static _Bool process_data_chunk(FILE *wav_file, uint32_t chunk_size, struct wav_
162162 if (!found_ds64_chunk ) { // RF64 has this chunk size always -1, value from ds64 is used instead
163163 metadata -> data_size = chunk_size ;
164164 }
165- metadata -> data_offset = _ftelli64 (wav_file );
165+ metadata -> data_offset = ftello (wav_file );
166166 if (metadata -> data_size != UINT32_MAX || metadata -> data_offset == -1 ) {
167167 return 1 ;
168168 }
169169
170170 // for UINT32_MAX deduce the length from file length (as FFmpeg does)
171- if (_fseeki64 (wav_file , 0 , SEEK_END ) != 0 ) {
171+ if (fseeko (wav_file , 0 , SEEK_END ) != 0 ) {
172172 return 1 ;
173173 }
174- int64_t data_end = _ftelli64 (wav_file );
174+ int64_t data_end = ftello (wav_file );
175175 if (data_end == -1 ) {
176176 ug_perror (MOD_NAME "cannot get length of file" );
177177 return 0 ;
178178 }
179- if (_fseeki64 (wav_file , metadata -> data_offset , SEEK_SET ) != 0 ) {
179+ if (fseeko (wav_file , metadata -> data_offset , SEEK_SET ) != 0 ) {
180180 ug_perror (MOD_NAME "cannot seek back to data chunk" );
181181 return 0 ;
182182 }
0 commit comments