mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-25 16:26:18 +00:00
Changed: #1249 Endianness problems while access to disk or memory
This commit is contained in:
parent
3100f477d3
commit
4939840995
1 changed files with 17 additions and 0 deletions
|
@ -155,6 +155,10 @@ bool CBigFile::add (const std::string &sBigFileName, uint32 nOptions)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NL_BIG_ENDIAN
|
||||||
|
NLMISC_BSWAP32(nOffsetFromBeginning);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (nlfseek64 (handle.File, nOffsetFromBeginning, SEEK_SET) != 0)
|
if (nlfseek64 (handle.File, nOffsetFromBeginning, SEEK_SET) != 0)
|
||||||
{
|
{
|
||||||
fclose (handle.File);
|
fclose (handle.File);
|
||||||
|
@ -170,6 +174,11 @@ bool CBigFile::add (const std::string &sBigFileName, uint32 nOptions)
|
||||||
handle.File = NULL;
|
handle.File = NULL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NL_BIG_ENDIAN
|
||||||
|
NLMISC_BSWAP32(nNbFile);
|
||||||
|
#endif
|
||||||
|
|
||||||
map<string,BNPFile> tempMap;
|
map<string,BNPFile> tempMap;
|
||||||
for (uint32 i = 0; i < nNbFile; ++i)
|
for (uint32 i = 0; i < nNbFile; ++i)
|
||||||
{
|
{
|
||||||
|
@ -198,6 +207,10 @@ bool CBigFile::add (const std::string &sBigFileName, uint32 nOptions)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NL_BIG_ENDIAN
|
||||||
|
NLMISC_BSWAP32(nFileSize2);
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32 nFilePos;
|
uint32 nFilePos;
|
||||||
if (fread (&nFilePos, sizeof(uint32), 1, handle.File) != 1)
|
if (fread (&nFilePos, sizeof(uint32), 1, handle.File) != 1)
|
||||||
{
|
{
|
||||||
|
@ -206,6 +219,10 @@ bool CBigFile::add (const std::string &sBigFileName, uint32 nOptions)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NL_BIG_ENDIAN
|
||||||
|
NLMISC_BSWAP32(nFilePos);
|
||||||
|
#endif
|
||||||
|
|
||||||
BNPFile bnpfTmp;
|
BNPFile bnpfTmp;
|
||||||
bnpfTmp.Pos = nFilePos;
|
bnpfTmp.Pos = nFilePos;
|
||||||
bnpfTmp.Size = nFileSize2;
|
bnpfTmp.Size = nFileSize2;
|
||||||
|
|
Loading…
Reference in a new issue