aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/DataInputStream.cpp
diff options
context:
space:
mode:
authorModMaker101 <119018978+ModMaker101@users.noreply.github.com>2026-03-08 19:08:36 -0400
committerGitHub <noreply@github.com>2026-03-08 18:08:36 -0500
commit28614b922fb77149a54da1a87bebfbc98736f296 (patch)
tree7f828ba86a4ee18d0a80d29de64f6199a5412512 /Minecraft.World/DataInputStream.cpp
parent88798b501d0cf6287b6f87acb2592676e3cec58d (diff)
Modernize project codebase (#906)
* Fixed boats falling and a TP glitch #266 * Replaced every C-style cast with C++ ones * Replaced every C-style cast with C++ ones * Fixed boats falling and a TP glitch #266 * Updated NULL to nullptr and fixing some type issues * Modernized and fixed a few bugs - Replaced most instances of `NULL` with `nullptr`. - Replaced most `shared_ptr(new ...)` with `make_shared`. - Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances. * Fixing more conflicts * Replace int loops with size_t and start work on overrides * Add safety checks and fix a issue with vector going OOR
Diffstat (limited to 'Minecraft.World/DataInputStream.cpp')
-rw-r--r--Minecraft.World/DataInputStream.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/Minecraft.World/DataInputStream.cpp b/Minecraft.World/DataInputStream.cpp
index 18deed39..4e4f5cd1 100644
--- a/Minecraft.World/DataInputStream.cpp
+++ b/Minecraft.World/DataInputStream.cpp
@@ -92,12 +92,12 @@ bool DataInputStream::readBoolean()
//the 8-bit value read.
byte DataInputStream::readByte()
{
- return (byte) stream->read();
+ return static_cast<byte>(stream->read());
}
unsigned char DataInputStream::readUnsignedByte()
{
- return (unsigned char) stream->read();
+ return static_cast<unsigned char>(stream->read());
}
//Reads two input bytes and returns a char value. Let a be the first byte read and b be the second byte. The value returned is:
@@ -110,7 +110,7 @@ wchar_t DataInputStream::readChar()
{
int a = stream->read();
int b = stream->read();
- return (wchar_t)((a << 8) | (b & 0xff));
+ return static_cast<wchar_t>((a << 8) | (b & 0xff));
}
//Reads some bytes from an input stream and stores them into the buffer array b. The number of bytes read is equal to the length of b.
@@ -254,14 +254,14 @@ short DataInputStream::readShort()
{
int a = stream->read();
int b = stream->read();
- return (short)((a << 8) | (b & 0xff));
+ return static_cast<short>((a << 8) | (b & 0xff));
}
unsigned short DataInputStream::readUnsignedShort()
{
int a = stream->read();
int b = stream->read();
- return (unsigned short)((a << 8) | (b & 0xff));
+ return static_cast<unsigned short>((a << 8) | (b & 0xff));
}
//Reads in a string that has been encoded using a modified UTF-8 format. The general contract of readUTF is that it reads a representation
@@ -301,7 +301,7 @@ wstring DataInputStream::readUTF()
wstring outputString;
int a = stream->read();
int b = stream->read();
- unsigned short UTFLength = (unsigned short) (((a & 0xff) << 8) | (b & 0xff));
+ unsigned short UTFLength = static_cast<unsigned short>(((a & 0xff) << 8) | (b & 0xff));
//// 4J Stu - I decided while writing DataOutputStream that we didn't need to bother using the UTF8 format
//// used in the java libs, and just write in/out as wchar_t all the time
@@ -343,7 +343,7 @@ wstring DataInputStream::readUTF()
else if( (firstByte & 0x80) == 0x00 )
{
// One byte UTF
- wchar_t readChar = (wchar_t)firstByte;
+ wchar_t readChar = static_cast<wchar_t>(firstByte);
outputString.push_back( readChar );
continue;
}
@@ -374,7 +374,7 @@ wstring DataInputStream::readUTF()
break;
}
- wchar_t readChar = (wchar_t)( ((firstByte& 0x1F) << 6) | (secondByte & 0x3F) );
+ wchar_t readChar = static_cast<wchar_t>(((firstByte & 0x1F) << 6) | (secondByte & 0x3F));
outputString.push_back( readChar );
continue;
}
@@ -422,7 +422,7 @@ wstring DataInputStream::readUTF()
break;
}
- wchar_t readChar = (wchar_t)(((firstByte & 0x0F) << 12) | ((secondByte & 0x3F) << 6) | (thirdByte & 0x3F));
+ wchar_t readChar = static_cast<wchar_t>(((firstByte & 0x0F) << 12) | ((secondByte & 0x3F) << 6) | (thirdByte & 0x3F));
outputString.push_back( readChar );
continue;
}