From c7cb211c07374051ea201c94720935c0bfb96219 Mon Sep 17 00:00:00 2001 From: Rodney Date: Sep 28 2020 00:47:49 +0000 Subject: Merge pull request #3504 from ericonr/endian Fix big endian code --- diff --git a/toonz/sources/image/tzl/tiio_tzl.cpp b/toonz/sources/image/tzl/tiio_tzl.cpp index bcdf7f6..34c0134 100644 --- a/toonz/sources/image/tzl/tiio_tzl.cpp +++ b/toonz/sources/image/tzl/tiio_tzl.cpp @@ -945,7 +945,7 @@ void TLevelWriterTzl::saveImage(const TImageP &img, const TFrameId &_fid, Header *header = (Header *)buff; TRasterP ras; - m_codec->decompress(buff, buffSize, ras); + m_codec->decompress(buff, buffSize, ras, false); delete[] buff; assert((TRasterCM32P)ras); assert(ras->getLx() == header->m_lx); diff --git a/toonz/sources/sound/wav/tsio_wav.cpp b/toonz/sources/sound/wav/tsio_wav.cpp index 51afc5e..4b15960 100644 --- a/toonz/sources/sound/wav/tsio_wav.cpp +++ b/toonz/sources/sound/wav/tsio_wav.cpp @@ -373,17 +373,17 @@ bool TSoundTrackWriterWav::save(const TSoundTrackP &sndtrack) { #if (!TNZ_LITTLE_ENDIAN) { if (fmtChunk.m_bitPerSample == 8) - memcpy((void *)waveData, (void *)sndtrack->getRawData(), soundDataLength); + memcpy((void *)waveData.get(), (void *)sndtrack->getRawData(), soundDataLength); else if (fmtChunk.m_bitPerSample == 16) { - swapAndCopySamples((short *)sndtrack->getRawData(), (short *)waveData, + swapAndCopySamples((short *)sndtrack->getRawData(), (short *)waveData.get(), sndtrack->getSampleCount() * fmtChunk.m_chans); } else if (fmtChunk.m_bitPerSample == 24) { // swap e togliere quarto byte UCHAR *begin = (UCHAR *)sndtrack->getRawData(); for (int i = 0; i < (int)sndtrack->getSampleCount() * fmtChunk.m_chans; ++i) { - *(waveData + 3 * i) = *(begin + 4 * i + 3); - *(waveData + 3 * i + 1) = *(begin + 4 * i + 2); - *(waveData + 3 * i + 2) = *(begin + 4 * i + 1); + *(waveData.get() + 3 * i) = *(begin + 4 * i + 3); + *(waveData.get() + 3 * i + 1) = *(begin + 4 * i + 2); + *(waveData.get() + 3 * i + 2) = *(begin + 4 * i + 1); } } }