From 9da5343f935620478caadae3baddf33843d4ad46 Mon Sep 17 00:00:00 2001 From: philippegorley <philippe.gorley@savoirfairelinux.com> Date: Fri, 26 Jul 2019 11:08:28 -0400 Subject: [PATCH] test: write little endian wav file for decoder RIFF identifier supposes little endian data. Change-Id: I56aa829c49388daf04f0249151ca7ef3e35416f4 --- test/unitTest/media/test_media_decoder.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/test/unitTest/media/test_media_decoder.cpp b/test/unitTest/media/test_media_decoder.cpp index 4b51aa4834..e44755bd41 100644 --- a/test/unitTest/media/test_media_decoder.cpp +++ b/test/unitTest/media/test_media_decoder.cpp @@ -113,21 +113,9 @@ MediaDecoderTest::testAudioFile() template<typename Word> static std::ostream& write(std::ostream& os, Word value, unsigned size) { - union { - uint32_t i; - char c[4]; - } big = {0x01020304}; - - // big endian if 0x01 is the first byte - if (big.c[0] == 1) { - while (size) - os.put(static_cast<char>((value >> (8 * --size)) & 0xFF)); - return os; - } else { - for (; size; --size, value >>= 8) - os.put(static_cast<char>(value & 0xFF)); - return os; - } + for (; size; --size, value >>= 8) + os.put(static_cast<char>(value & 0xFF)); + return os; } void -- GitLab