Remove all MSVC __int64 (#742)
This commit is contained in:
@@ -19,7 +19,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path)
|
||||
chunkTimestamps = new int[SECTOR_INTS];
|
||||
memset(chunkTimestamps,0,SECTOR_BYTES);
|
||||
|
||||
/* 4J Jev, using files instead of strings:
|
||||
/* 4J Jev, using files instead of strings:
|
||||
strncpy(fileName,path,MAX_PATH_SIZE); */
|
||||
|
||||
fileName = path;
|
||||
@@ -30,7 +30,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path)
|
||||
|
||||
// 4J - removed try/catch
|
||||
// try {
|
||||
|
||||
|
||||
/* 4J - Removed as _lastModifed not used and this is always failing as checking wrong thing
|
||||
if( path->exists() )
|
||||
{
|
||||
@@ -45,7 +45,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path)
|
||||
{
|
||||
// 4J altered - the original code used to write out 2 empty sectors here, which we don't want to do as we might be at a point where we shouldn't be touching the save file.
|
||||
// This now happens in insertInitialSectors when we do a first write to the region
|
||||
m_bIsEmpty = true;
|
||||
m_bIsEmpty = true;
|
||||
|
||||
sizeDelta += SECTOR_BYTES * 2;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path)
|
||||
}
|
||||
|
||||
/* set up the available sector map */
|
||||
|
||||
|
||||
int nSectors;
|
||||
if( m_bIsEmpty ) // 4J - added this case for our empty files that we now don't create
|
||||
{
|
||||
@@ -133,7 +133,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path)
|
||||
|
||||
void RegionFile::writeAllOffsets() // used for the file ConsoleSaveFile conversion between platforms
|
||||
{
|
||||
if(m_bIsEmpty == false)
|
||||
if(m_bIsEmpty == false)
|
||||
{
|
||||
// save all the offsets and timestamps
|
||||
m_saveFile->LockSaveAccess();
|
||||
@@ -158,7 +158,7 @@ RegionFile::~RegionFile()
|
||||
m_saveFile->closeHandle( fileEntry );
|
||||
}
|
||||
|
||||
__int64 RegionFile::lastModified()
|
||||
int64_t RegionFile::lastModified()
|
||||
{
|
||||
return _lastModified;
|
||||
}
|
||||
@@ -198,9 +198,9 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was
|
||||
|
||||
m_saveFile->LockSaveAccess();
|
||||
|
||||
//SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN);
|
||||
//SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN);
|
||||
m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, NULL, FILE_BEGIN);
|
||||
|
||||
|
||||
unsigned int length;
|
||||
unsigned int decompLength;
|
||||
unsigned int readDecompLength;
|
||||
@@ -227,7 +227,7 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was
|
||||
if (length > SECTOR_BYTES * numSectors)
|
||||
{
|
||||
// debugln("READ", x, z, "invalid length: " + length + " > 4096 * " + numSectors);
|
||||
|
||||
|
||||
m_saveFile->ReleaseSaveAccess();
|
||||
return NULL;
|
||||
}
|
||||
@@ -257,7 +257,7 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was
|
||||
delete [] data;
|
||||
|
||||
// 4J - was InflaterInputStream in here too, but we've already decompressed
|
||||
DataInputStream *ret = new DataInputStream(new ByteArrayInputStream( byteArray( decomp, readDecompLength) ));
|
||||
DataInputStream *ret = new DataInputStream(new ByteArrayInputStream( byteArray( decomp, readDecompLength) ));
|
||||
return ret;
|
||||
|
||||
// } catch (IOException e) {
|
||||
@@ -269,7 +269,7 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was
|
||||
DataOutputStream *RegionFile::getChunkDataOutputStream(int x, int z)
|
||||
{
|
||||
// 4J - was DeflatorOutputStream in here too, but we've already compressed
|
||||
return new DataOutputStream( new ChunkBuffer(this, x, z));
|
||||
return new DataOutputStream( new ChunkBuffer(this, x, z));
|
||||
}
|
||||
|
||||
/* write a chunk at (x,z) with length bytes of data to disk */
|
||||
@@ -372,7 +372,7 @@ void RegionFile::write(int x, int z, byte *data, int length) // TODO - was sync
|
||||
* file
|
||||
*/
|
||||
// debug("SAVE", x, z, length, "grow");
|
||||
//SetFilePointer(file,0,0,FILE_END);
|
||||
//SetFilePointer(file,0,0,FILE_END);
|
||||
m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_END );
|
||||
|
||||
sectorNumber = (int)sectorFree->size();
|
||||
@@ -406,12 +406,12 @@ void RegionFile::write(int x, int z, byte *data, int length) // TODO - was sync
|
||||
void RegionFile::write(int sectorNumber, byte *data, int length, unsigned int compLength)
|
||||
{
|
||||
DWORD numberOfBytesWritten = 0;
|
||||
//SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN);
|
||||
//SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN);
|
||||
m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, NULL, FILE_BEGIN );
|
||||
|
||||
// 4J - this differs a bit from the java file format. Java has length stored as an int, then a type as a byte, then length-1 bytes of data
|
||||
// We store length and decompression length as ints, then length bytes of xbox LZX compressed data
|
||||
|
||||
|
||||
// 4J Stu - We need to do the compression at a level above this, where it is checking for free space
|
||||
|
||||
compLength |= 0x80000000; // 4J - signify that this has been encoded with RLE method ( see code in getChunkDataInputStream() for matching detection of this)
|
||||
@@ -425,7 +425,7 @@ void RegionFile::write(int sectorNumber, byte *data, int length, unsigned int co
|
||||
void RegionFile::zero(int sectorNumber, int length)
|
||||
{
|
||||
DWORD numberOfBytesWritten = 0;
|
||||
//SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN);
|
||||
//SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN);
|
||||
m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, NULL, FILE_BEGIN );
|
||||
m_saveFile->zeroFile( fileEntry, length, &numberOfBytesWritten );
|
||||
}
|
||||
@@ -473,7 +473,7 @@ void RegionFile::setOffset(int x, int z, int offset)
|
||||
DWORD numberOfBytesWritten = 0;
|
||||
offsets[x + z * 32] = offset;
|
||||
m_saveFile->setFilePointer( fileEntry, (x + z * 32) * 4, NULL, FILE_BEGIN );
|
||||
|
||||
|
||||
m_saveFile->writeFile(fileEntry,&offset,4,&numberOfBytesWritten);
|
||||
}
|
||||
|
||||
@@ -487,7 +487,7 @@ void RegionFile::setTimestamp(int x, int z, int value)
|
||||
DWORD numberOfBytesWritten = 0;
|
||||
chunkTimestamps[x + z * 32] = value;
|
||||
m_saveFile->setFilePointer( fileEntry, SECTOR_BYTES + (x + z * 32) * 4, NULL, FILE_BEGIN );
|
||||
|
||||
|
||||
m_saveFile->writeFile(fileEntry,&value,4,&numberOfBytesWritten);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user