CHDR_OBJS += $(CHDR)/src/libchdr_chd.o $(CHDR)/src/libchdr_cdrom.o
CHDR_OBJS += $(CHDR)/src/libchdr_flac.o
CHDR_OBJS += $(CHDR)/src/libchdr_bitstream.o $(CHDR)/src/libchdr_huffman.o
-$(CHDR_OBJS): CFLAGS += -DHAVE_FSEEKO
# flac
FLAC = $(CHDR)/deps/flac-1.3.3
FLAC_OBJS += $(FLAC)/src/bitmath.o $(FLAC)/src/bitreader.o $(FLAC)/src/md5.o
FLAC_OBJS += $(FLAC)/src/memory.o $(FLAC)/src/fixed.o $(FLAC)/src/crc.o
FLAC_OBJS += $(FLAC)/src/window.o $(FLAC)/src/stream_decoder.o
+FLAC_OBJS += $(FLAC)/src/windows_unicode_filenames.o
$(FLAC_OBJS): CFLAGS += -DPACKAGE_VERSION=\"1.3.3\" -DFLAC__HAS_OGG=0
$(FLAC_OBJS): CFLAGS += -DHAVE_FSEEKO -DHAVE_LROUND -DHAVE_STDINT_H -DHAVE_STDLIB_H # ugh...
strncpy(ext, fname + pos + 1, 4/*sizeof(ext)*/-1);
ext[4/*sizeof(ext)*/-1] = '\0';
- if (base != NULL) {
+ if (base != NULL && base_size > 0) {
if (pos + 1 < base_size)
pos = base_size - 1;
-Subproject commit 208212ae77f5c4fedca11d797e50cb1954b2c837
+Subproject commit 714fc3f268ebddf035a76cc883bd4543b5142a6f
#endif
-// There's no standard way to determine endianess at compile time.
-// Do not bother with mixed endian platforms, no one will ever compile on that.
+// There's no standard way to determine endianess at compile time. Try using
+// some well known non-standard macros for detection.
#if defined __BYTE_ORDER__
#define CPU_IS_LE __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#elif defined _BYTE_ORDER
#warning "can't detect byte order, assume little endian"
#define CPU_IS_LE 1
#endif
+// NB mixed endian integer platforms are not supported.
#if CPU_IS_LE
// address/offset operations
#define MEM_LE2(a) (a)
#define MEM_LE4(a) (a)
// swapping
-#define CPU_BE2(v) (((v)<<16)|((v)>>16))
+#define CPU_BE2(v) ((u32)((u64)(v)<<16)|((v)>>16))
#define CPU_BE4(v) (((u32)(v)>>24)|(((v)>>8)&0x00ff00)| \
(((v)<<8)&0xff0000)|(u32)((v)<<24))
#define CPU_LE2(v) (v) // swap of 2*u16 in u32
// swapping
#define CPU_BE2(v) (v)
#define CPU_BE4(v) (v)
-#define CPU_LE2(v) (((v)<<16)|((v)>>16))
+#define CPU_LE2(v) ((u32)((u64)(v)<<16)|((v)>>16))
#define CPU_LE4(v) (((u32)(v)>>24)|(((v)>>8)&0x00ff00)| \
(((v)<<8)&0xff0000)|(u32)((v)<<24))
#endif
typedef int16_t s16;\r
typedef uint32_t u32;\r
typedef int32_t s32;\r
+typedef uint64_t u64;\r
+typedef int64_t s64;\r
#endif\r
#endif\r
\r
}
/* stubs for libflac (embedded in libchdr) */
+#include <utime.h>
+#include <malloc.h>
+
int chown(const char *pathname, uid_t owner, gid_t group) { return -1; }
int chmod(const char *pathname, mode_t mode) { return -1; }
int utime(const char *filename, const struct utimbuf *times) { return -1; }