diff options
| author | qwasdrizzel <145519042+qwasdrizzel@users.noreply.github.com> | 2026-03-16 21:44:26 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-16 21:44:26 -0500 |
| commit | ce739f6045ec72127491286ea3f3f21e537c1b55 (patch) | |
| tree | f33bd42a47c1b4a7b2153a7fb77127ee3b407db9 /Minecraft.World/DataOutputStream.cpp | |
| parent | 255a18fe8e9b57377975f82e2b227afe2a12eda0 (diff) | |
| parent | 5a59f5d146b43811dde6a5a0245ee9875d7b5cd1 (diff) | |
Merge branch 'smartcmd:main' into main
Diffstat (limited to 'Minecraft.World/DataOutputStream.cpp')
| -rw-r--r-- | Minecraft.World/DataOutputStream.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Minecraft.World/DataOutputStream.cpp b/Minecraft.World/DataOutputStream.cpp index 8d350f0b..1a3931cf 100644 --- a/Minecraft.World/DataOutputStream.cpp +++ b/Minecraft.World/DataOutputStream.cpp @@ -78,7 +78,7 @@ void DataOutputStream::writeByte(byte a) //v - a double value to be written. void DataOutputStream::writeDouble(double a) { - __int64 bits = Double::doubleToLongBits( a ); + int64_t bits = Double::doubleToLongBits( a ); writeLong( bits ); // TODO 4J Stu - Error handling? @@ -116,7 +116,7 @@ void DataOutputStream::writeInt(int a) //In no exception is thrown, the counter written is incremented by 8. //Parameters: //v - a long to be written. -void DataOutputStream::writeLong(__int64 a) +void DataOutputStream::writeLong(int64_t a) { stream->write( (a >> 56) & 0xff ); stream->write( (a >> 48) & 0xff ); @@ -184,9 +184,9 @@ void DataOutputStream::writeChars(const wstring& str) //v - a boolean value to be written. void DataOutputStream::writeBoolean(bool b) { - stream->write( b ? (byte)1 : (byte)0 ); + stream->write( b ? static_cast<byte>(1) : static_cast<byte>(0) ); // TODO 4J Stu - Error handling? - written += 1; + written += 1; } //Writes a string to the underlying output stream using modified UTF-8 encoding in a machine-independent manner. @@ -199,7 +199,7 @@ void DataOutputStream::writeBoolean(bool b) //str - a string to be written. void DataOutputStream::writeUTF(const wstring& str) { - int strlen = (int)str.length(); + int strlen = static_cast<int>(str.length()); int utflen = 0; int c, count = 0; @@ -227,15 +227,15 @@ void DataOutputStream::writeUTF(const wstring& str) byteArray bytearr(utflen+2); - bytearr[count++] = (byte) ((utflen >> 8) & 0xFF); - bytearr[count++] = (byte) ((utflen >> 0) & 0xFF); + bytearr[count++] = static_cast<byte>((utflen >> 8) & 0xFF); + bytearr[count++] = static_cast<byte>((utflen >> 0) & 0xFF); int i=0; for (i=0; i<strlen; i++) { c = str.at(i); if (!((c >= 0x0001) && (c <= 0x007F))) break; - bytearr[count++] = (byte) c; + bytearr[count++] = static_cast<byte>(c); } for (;i < strlen; i++) @@ -243,19 +243,19 @@ void DataOutputStream::writeUTF(const wstring& str) c = str.at(i); if ((c >= 0x0001) && (c <= 0x007F)) { - bytearr[count++] = (byte) c; + bytearr[count++] = static_cast<byte>(c); } else if (c > 0x07FF) { - bytearr[count++] = (byte) (0xE0 | ((c >> 12) & 0x0F)); - bytearr[count++] = (byte) (0x80 | ((c >> 6) & 0x3F)); - bytearr[count++] = (byte) (0x80 | ((c >> 0) & 0x3F)); + bytearr[count++] = static_cast<byte>(0xE0 | ((c >> 12) & 0x0F)); + bytearr[count++] = static_cast<byte>(0x80 | ((c >> 6) & 0x3F)); + bytearr[count++] = static_cast<byte>(0x80 | ((c >> 0) & 0x3F)); } else { - bytearr[count++] = (byte) (0xC0 | ((c >> 6) & 0x1F)); - bytearr[count++] = (byte) (0x80 | ((c >> 0) & 0x3F)); + bytearr[count++] = static_cast<byte>(0xC0 | ((c >> 6) & 0x1F)); + bytearr[count++] = static_cast<byte>(0x80 | ((c >> 0) & 0x3F)); } } write(bytearr, 0, utflen+2); |
