88 |
#endif // POSIX |
#endif // POSIX |
89 |
#if WORDS_BIGENDIAN |
#if WORDS_BIGENDIAN |
90 |
if (ChunkID == CHUNK_ID_RIFF) { |
if (ChunkID == CHUNK_ID_RIFF) { |
91 |
bEndianNative = false; |
pFile->bEndianNative = false; |
92 |
} |
} |
93 |
#else // little endian |
#else // little endian |
94 |
if (ChunkID == CHUNK_ID_RIFX) { |
if (ChunkID == CHUNK_ID_RIFX) { |
676 |
* @see ReleaseChunkData() |
* @see ReleaseChunkData() |
677 |
*/ |
*/ |
678 |
void* Chunk::LoadChunkData() { |
void* Chunk::LoadChunkData() { |
679 |
if (!pChunkData) { |
if (!pChunkData && pFile->Filename != "") { |
680 |
#if POSIX |
#if POSIX |
681 |
if (lseek(pFile->hFileRead, ulStartPos, SEEK_SET) == -1) return NULL; |
if (lseek(pFile->hFileRead, ulStartPos, SEEK_SET) == -1) return NULL; |
682 |
#else |
#else |
1192 |
} |
} |
1193 |
} |
} |
1194 |
|
|
1195 |
|
void List::LoadSubChunksRecursively() { |
1196 |
|
for (List* pList = GetFirstSubList(); pList; pList = GetNextSubList()) |
1197 |
|
pList->LoadSubChunksRecursively(); |
1198 |
|
} |
1199 |
|
|
1200 |
/** @brief Write list chunk persistently e.g. to disk. |
/** @brief Write list chunk persistently e.g. to disk. |
1201 |
* |
* |
1202 |
* Stores the list chunk persistently to its actual "physical" file. All |
* Stores the list chunk persistently to its actual "physical" file. All |
1388 |
* chunk or any kind of IO error occured |
* chunk or any kind of IO error occured |
1389 |
*/ |
*/ |
1390 |
void File::Save() { |
void File::Save() { |
1391 |
|
// make sure the RIFF tree is built (from the original file) |
1392 |
|
LoadSubChunksRecursively(); |
1393 |
|
|
1394 |
// reopen file in write mode |
// reopen file in write mode |
1395 |
SetMode(stream_mode_read_write); |
SetMode(stream_mode_read_write); |
1396 |
|
|
1468 |
void File::Save(const String& path) { |
void File::Save(const String& path) { |
1469 |
//TODO: we should make a check here if somebody tries to write to the same file and automatically call the other Save() method in that case |
//TODO: we should make a check here if somebody tries to write to the same file and automatically call the other Save() method in that case |
1470 |
|
|
1471 |
|
// make sure the RIFF tree is built (from the original file) |
1472 |
|
LoadSubChunksRecursively(); |
1473 |
|
|
1474 |
if (Filename.length() > 0) SetMode(stream_mode_read); |
if (Filename.length() > 0) SetMode(stream_mode_read); |
1475 |
// open the other (new) file for writing and truncate it to zero size |
// open the other (new) file for writing and truncate it to zero size |
1476 |
#if POSIX |
#if POSIX |