Re: Bug#1116657: src:libgig: fails to migrate to testing for too long: FTBFS on s390x
Hi,
I was able to figure out what was causing the issue in `test_load24BytesRAM` and got a fix for it.
And now since RIFF tests are passing GIG tests are getting executed and a few tests are failing.
I was able to find fixes for a few of them. But some are still pending and I am still continuing my work on it.
The changes that I have made are as follows.
diff --git a/src/RIFF.cpp b/src/RIFF.cpp
index d5c761e..75bf7a6 100644
--- a/src/RIFF.cpp
+++ b/src/RIFF.cpp
@@ -225,7 +225,13 @@ struct _FileProgress {
#if POSIX
if (lseek(hRead, filePos, SEEK_SET) != -1) {
read(hRead, &ChunkID, 4);
- read(hRead, &ullCurrentChunkSize, pFile->FileOffsetSize);
+ if (pFile->FileOffsetSize == 4) {
+ uint32_t uiTempCurrentChunkSize;
+ read(hRead, &uiTempCurrentChunkSize, pFile->FileOffsetSize);
+ ullCurrentChunkSize = uiTempCurrentChunkSize;
+ }
+ else
+ read(hRead, &ullCurrentChunkSize, pFile->FileOffsetSize);
#elif defined(WIN32)
LARGE_INTEGER liFilePos;
liFilePos.QuadPart = filePos;
@@ -287,7 +293,12 @@ struct _FileProgress {
#if POSIX
if (lseek(hWrite, filePos, SEEK_SET) != -1) {
write(hWrite, &uiNewChunkID, 4);
- write(hWrite, &ullNewChunkSize, pFile->FileOffsetSize);
+ if (pFile->FileOffsetSize == 4) {
+ uint32_t uiTempNewChunkSize = ullNewChunkSize;
+ write(hWrite, &uiTempNewChunkSize, pFile->FileOffsetSize);
+ }
+ else
+ write(hWrite, &ullNewChunkSize, pFile->FileOffsetSize);
}
#elif defined(WIN32)
LARGE_INTEGER liFilePos;
@@ -591,6 +602,28 @@ struct _FileProgress {
}
file_offset_t writtenWords = fwrite(pData, WordSize, WordCount, io.hWrite);
#endif // POSIX
+
+ //To revert pData to its native endianness
+ if (!pFile->bEndianNative && WordSize != 1) {
+ switch (WordSize) {
+ case 2:
+ for (file_offset_t iWord = 0; iWord < WordCount; iWord++)
+ swapBytes_16((uint16_t*) pData + iWord);
+ break;
+ case 4:
+ for (file_offset_t iWord = 0; iWord < WordCount; iWord++)
+ swapBytes_32((uint32_t*) pData + iWord);
+ break;
+ case 8:
+ for (file_offset_t iWord = 0; iWord < WordCount; iWord++)
+ swapBytes_64((uint64_t*) pData + iWord);
+ break;
+ default:
+ for (file_offset_t iWord = 0; iWord < WordCount; iWord++)
+ swapBytes((uint8_t*) pData + iWord * WordSize, WordSize);
+ break;
+ }
Thanks,
Pranav
Reply to: