From 935adbe978143aeda7aff04588bd0fd852ec463d Mon Sep 17 00:00:00 2001 From: Hunter Kvalevog Date: Sat, 3 Oct 2026 16:47:36 -0700 Subject: flacdec: fix MSVC build --- flacdec/build.bat | 3 +++ flacdec/flacdec.c | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 flacdec/build.bat diff --git a/flacdec/build.bat b/flacdec/build.bat new file mode 100644 index 0000000..4d2327c --- /dev/null +++ b/flacdec/build.bat @@ -0,0 +1,3 @@ +@echo off +if not exist bin mkdir bin +cl /W4 /Od /Zi /Fe:bin\flacdec.exe flacdec.c /Fd:bin\ /Fo:bin\ diff --git a/flacdec/flacdec.c b/flacdec/flacdec.c index 8d927a5..e148c23 100644 --- a/flacdec/flacdec.c +++ b/flacdec/flacdec.c @@ -18,8 +18,17 @@ // WITH REGARD TO THIS SOFTWARE. // ================================================================================================ +#ifdef _MSC_VER +# pragma warning(disable: 4244) +# pragma warning(disable: 4267) +# define _CRT_SECURE_NO_WARNINGS +# define popen(A, B) _popen(A, "wb") +# define pclose _pclose +#endif + #include #include +#include #include #include #include @@ -103,7 +112,7 @@ void read_coded_residuals(BitR *br, uint32_t block_size, uint8_t order, int32_t // (9.2.7) uint8_t rice_bits = read_bits(br, 2) ? 5 : 4; uint8_t rice_order = read_bits(br, 4); - size_t rice_partitions = 1 << rice_order; + size_t rice_partitions = (size_t)1 << rice_order; assert(block_size % rice_partitions == 0); for (size_t i = 0; i < rice_partitions; ++i) { -- cgit v1.2.3