diff options
| author | void_17 <heroerror3@gmail.com> | 2026-03-02 15:53:32 +0700 |
|---|---|---|
| committer | void_17 <heroerror3@gmail.com> | 2026-03-02 15:53:32 +0700 |
| commit | d63f79325f85e014361eb8cf1e41eaebedb1ae71 (patch) | |
| tree | d9f28714afd516bc2450f33b0a77c5e05ff4de90 /Minecraft.World/RegionFile.cpp | |
| parent | d6ec138710461294c3ffd2723bc8a9f212d3471f (diff) | |
Get rid of MSVC's __int64
Use either int64_t, uint64_t or long long and unsigned long long, defined as per C++11 standard
Diffstat (limited to 'Minecraft.World/RegionFile.cpp')
| -rw-r--r-- | Minecraft.World/RegionFile.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/Minecraft.World/RegionFile.cpp b/Minecraft.World/RegionFile.cpp index 2cfd9078..5c29f94e 100644 --- a/Minecraft.World/RegionFile.cpp +++ b/Minecraft.World/RegionFile.cpp @@ -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); } |
