fix: remove byte type alias

This commit is contained in:
Tropical
2026-03-06 05:03:37 -06:00
parent 09eae49d21
commit 15af35eef2
208 changed files with 700 additions and 701 deletions
@@ -79,7 +79,7 @@ void BufferedOutputStream::write(byteArray b)
//b - the byte to be written.
void BufferedOutputStream::write(unsigned int b)
{
buf[count++] = (byte) b;
buf[count++] = (uint8_t) b;
if( count == buf.length )
{
flush();
@@ -33,7 +33,7 @@ void ByteArrayOutputStream::write(unsigned int b)
if( count + 1 >= buf.length )
buf.resize( buf.length * 2 );
buf[count] = (byte) b;
buf[count] = (uint8_t) b;
count++;
}
+45 -45
View File
@@ -7,8 +7,8 @@
ByteBuffer::ByteBuffer( unsigned int capacity ) : Buffer( capacity )
{
hasBackingArray = false;
buffer = new byte[capacity];
memset( buffer,0,sizeof(byte)*capacity);
buffer = new uint8_t[capacity];
memset( buffer,0,sizeof(uint8_t)*capacity);
byteOrder = BIGENDIAN;
}
@@ -25,7 +25,7 @@ ByteBuffer *ByteBuffer::allocateDirect(int capacity)
}
ByteBuffer::ByteBuffer( unsigned int capacity, byte *backingArray ) : Buffer( capacity )
ByteBuffer::ByteBuffer( unsigned int capacity, uint8_t *backingArray ) : Buffer( capacity )
{
hasBackingArray = true;
buffer = backingArray;
@@ -38,7 +38,7 @@ ByteBuffer::~ByteBuffer()
}
//Wraps a byte array into a buffer.
//The new buffer will be backed by the given byte array; that is, modifications to the buffer will cause the array
//The new buffer will be backed by the given uint8_t array; that is, modifications to the buffer will cause the array
//to be modified and vice versa. The new buffer's capacity and limit will be array.length, its position will be zero,
//and its mark will be undefined. Its backing array will be the given array, and its array offset will be zero.
//
@@ -85,7 +85,7 @@ ByteBuffer *ByteBuffer::flip()
}
// 4J Added so we can write this to a file
byte *ByteBuffer::getBuffer()
uint8_t *ByteBuffer::getBuffer()
{
return buffer;
}
@@ -104,7 +104,7 @@ int ByteBuffer::getSize()
//The byte at the given index
//Throws:
//IndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit
byte ByteBuffer::get(int index)
uint8_t ByteBuffer::get(int index)
{
assert( index < m_limit );
assert( index >= 0 );
@@ -253,7 +253,7 @@ void ByteBuffer::getShortArray(shortArray &s)
//Throws:
//IndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit
//ReadOnlyBufferException - If this buffer is read-only
ByteBuffer *ByteBuffer::put(int index, byte b)
ByteBuffer *ByteBuffer::put(int index, uint8_t b)
{
assert( index < m_limit );
assert( index >= 0 );
@@ -277,17 +277,17 @@ ByteBuffer *ByteBuffer::putInt(int value)
if( byteOrder == BIGENDIAN )
{
buffer[m_position] = static_cast<byte>((value >> 24) & 0xFF);
buffer[m_position+1] = static_cast<byte>((value >> 16) & 0xFF);
buffer[m_position+2] = static_cast<byte>((value >> 8) & 0xFF);
buffer[m_position+3] = static_cast<byte>(value & 0xFF);
buffer[m_position] = static_cast<uint8_t>((value >> 24) & 0xFF);
buffer[m_position+1] = static_cast<uint8_t>((value >> 16) & 0xFF);
buffer[m_position+2] = static_cast<uint8_t>((value >> 8) & 0xFF);
buffer[m_position+3] = static_cast<uint8_t>(value & 0xFF);
}
else if( byteOrder == LITTLEENDIAN )
{
buffer[m_position] = static_cast<byte>(value & 0xFF);
buffer[m_position+1] = static_cast<byte>((value >> 8) & 0xFF);
buffer[m_position+2] = static_cast<byte>((value >> 16) & 0xFF);
buffer[m_position+3] = static_cast<byte>((value >> 24) & 0xFF);
buffer[m_position] = static_cast<uint8_t>(value & 0xFF);
buffer[m_position+1] = static_cast<uint8_t>((value >> 8) & 0xFF);
buffer[m_position+2] = static_cast<uint8_t>((value >> 16) & 0xFF);
buffer[m_position+3] = static_cast<uint8_t>((value >> 24) & 0xFF);
}
m_position += 4;
@@ -309,17 +309,17 @@ ByteBuffer *ByteBuffer::putInt(unsigned int index, int value)
if( byteOrder == BIGENDIAN )
{
buffer[index] = static_cast<byte>((value >> 24) & 0xFF);
buffer[index+1] = static_cast<byte>((value >> 16) & 0xFF);
buffer[index+2] = static_cast<byte>((value >> 8) & 0xFF);
buffer[index+3] = static_cast<byte>(value & 0xFF);
buffer[index] = static_cast<uint8_t>((value >> 24) & 0xFF);
buffer[index+1] = static_cast<uint8_t>((value >> 16) & 0xFF);
buffer[index+2] = static_cast<uint8_t>((value >> 8) & 0xFF);
buffer[index+3] = static_cast<uint8_t>(value & 0xFF);
}
else if( byteOrder == LITTLEENDIAN )
{
buffer[index] = static_cast<byte>(value & 0xFF);
buffer[index+1] = static_cast<byte>((value >> 8) & 0xFF);
buffer[index+2] = static_cast<byte>((value >> 16) & 0xFF);
buffer[index+3] = static_cast<byte>((value >> 24) & 0xFF);
buffer[index] = static_cast<uint8_t>(value & 0xFF);
buffer[index+1] = static_cast<uint8_t>((value >> 8) & 0xFF);
buffer[index+2] = static_cast<uint8_t>((value >> 16) & 0xFF);
buffer[index+3] = static_cast<uint8_t>((value >> 24) & 0xFF);
}
return this;
@@ -339,13 +339,13 @@ ByteBuffer *ByteBuffer::putShort(short value)
if( byteOrder == BIGENDIAN )
{
buffer[m_position] = static_cast<byte>((value >> 8) & 0xFF);
buffer[m_position+1] = static_cast<byte>(value & 0xFF);
buffer[m_position] = static_cast<uint8_t>((value >> 8) & 0xFF);
buffer[m_position+1] = static_cast<uint8_t>(value & 0xFF);
}
else if( byteOrder == LITTLEENDIAN )
{
buffer[m_position] = static_cast<byte>(value & 0xFF);
buffer[m_position+1] = static_cast<byte>((value >> 8) & 0xFF);
buffer[m_position] = static_cast<uint8_t>(value & 0xFF);
buffer[m_position+1] = static_cast<uint8_t>((value >> 8) & 0xFF);
}
m_position += 2;
@@ -379,25 +379,25 @@ ByteBuffer *ByteBuffer::putLong(__int64 value)
if( byteOrder == BIGENDIAN )
{
buffer[m_position] = static_cast<byte>((value >> 56) & 0xFF);
buffer[m_position+1] = static_cast<byte>((value >> 48) & 0xFF);
buffer[m_position+2] = static_cast<byte>((value >> 40) & 0xFF);
buffer[m_position+3] = static_cast<byte>((value >> 32) & 0xFF);
buffer[m_position+4] = static_cast<byte>((value >> 24) & 0xFF);
buffer[m_position+5] = static_cast<byte>((value >> 16) & 0xFF);
buffer[m_position+6] = static_cast<byte>((value >> 8) & 0xFF);
buffer[m_position+7] = static_cast<byte>(value & 0xFF);
buffer[m_position] = static_cast<uint8_t>((value >> 56) & 0xFF);
buffer[m_position+1] = static_cast<uint8_t>((value >> 48) & 0xFF);
buffer[m_position+2] = static_cast<uint8_t>((value >> 40) & 0xFF);
buffer[m_position+3] = static_cast<uint8_t>((value >> 32) & 0xFF);
buffer[m_position+4] = static_cast<uint8_t>((value >> 24) & 0xFF);
buffer[m_position+5] = static_cast<uint8_t>((value >> 16) & 0xFF);
buffer[m_position+6] = static_cast<uint8_t>((value >> 8) & 0xFF);
buffer[m_position+7] = static_cast<uint8_t>(value & 0xFF);
}
else if( byteOrder == LITTLEENDIAN )
{
buffer[m_position] = static_cast<byte>((value & 0xFF));
buffer[m_position+1] = static_cast<byte>((value >> 8) & 0xFF);
buffer[m_position+2] = static_cast<byte>((value >> 16) & 0xFF);
buffer[m_position+3] = static_cast<byte>((value >> 24) & 0xFF);
buffer[m_position+4] = static_cast<byte>((value >> 32) & 0xFF);
buffer[m_position+5] = static_cast<byte>((value >> 40) & 0xFF);
buffer[m_position+6] = static_cast<byte>((value >> 48) & 0xFF);
buffer[m_position+7] = static_cast<byte>((value >> 56) & 0xFF);
buffer[m_position] = static_cast<uint8_t>((value & 0xFF));
buffer[m_position+1] = static_cast<uint8_t>((value >> 8) & 0xFF);
buffer[m_position+2] = static_cast<uint8_t>((value >> 16) & 0xFF);
buffer[m_position+3] = static_cast<uint8_t>((value >> 24) & 0xFF);
buffer[m_position+4] = static_cast<uint8_t>((value >> 32) & 0xFF);
buffer[m_position+5] = static_cast<uint8_t>((value >> 40) & 0xFF);
buffer[m_position+6] = static_cast<uint8_t>((value >> 48) & 0xFF);
buffer[m_position+7] = static_cast<uint8_t>((value >> 56) & 0xFF);
}
return this;
@@ -464,9 +464,9 @@ FloatBuffer *ByteBuffer::asFloatBuffer()
#ifdef __PS3__
// we're using the RSX now to upload textures to vram, so we need th main ram textures allocated from io space
ByteBuffer_IO::ByteBuffer_IO( unsigned int capacity )
: ByteBuffer(capacity, (byte*)RenderManager.allocIOMem(capacity, 64))
: ByteBuffer(capacity, (uint8_t*)RenderManager.allocIOMem(capacity, 64))
{
memset( buffer,0,sizeof(byte)*capacity);
memset( buffer,0,sizeof(uint8_t)*capacity);
byteOrder = BIGENDIAN;
}
+5 -5
View File
@@ -9,29 +9,29 @@ class FloatBuffer;
class ByteBuffer : public Buffer
{
protected:
byte *buffer;
uint8_t *buffer;
ByteOrder byteOrder;
public:
ByteBuffer(unsigned int capacity);
static ByteBuffer *allocateDirect(int capacity);
ByteBuffer( unsigned int capacity, byte *backingArray );
ByteBuffer( unsigned int capacity, uint8_t *backingArray );
virtual ~ByteBuffer();
static ByteBuffer *wrap(byteArray &b);
static ByteBuffer *allocate(unsigned int capacity);
void order(ByteOrder a);
ByteBuffer *flip();
byte *getBuffer();
uint8_t *getBuffer();
int getSize();
int getInt();
int getInt(unsigned int index);
void get(byteArray) {} // 4J - TODO
byte get(int index);
uint8_t get(int index);
__int64 getLong();
short getShort();
void getShortArray(shortArray &s);
ByteBuffer *put(int index, byte b);
ByteBuffer *put(int index, uint8_t b);
ByteBuffer *putInt(int value);
ByteBuffer *putInt(unsigned int index, int value);
ByteBuffer *putShort(short value);
+1 -1
View File
@@ -7,7 +7,7 @@ public:
virtual int read(byteArray b) = 0;
virtual int read(byteArray b, unsigned int offset, unsigned int length) = 0;
virtual bool readBoolean() = 0;
virtual byte readByte() = 0;
virtual uint8_t readByte() = 0;
virtual unsigned char readUnsignedByte() = 0;
virtual bool readFully(byteArray a) = 0;
virtual double readDouble() = 0;
@@ -60,7 +60,7 @@ int DataInputStream::read(byteArray b)
//This method blocks until input data is available, end of file is detected, or an exception is thrown.
//
//If len is zero, then no bytes are read and 0 is returned; otherwise, there is an attempt to read at least one byte.
//If no byte is available because the stream is at end of file, the value -1 is returned; otherwise, at least one byte is read and stored into b.
//If no uint8_t is available because the stream is at end of file, the value -1 is returned; otherwise, at least one byte is read and stored into b.
//
//The first byte read is stored into element b[off], the next one into b[off+1], and so on. The number of bytes read is,
//at most, equal to len. Let k be the number of bytes actually read; these bytes will be stored in elements b[off] through b[off+k-1],
@@ -115,14 +115,14 @@ bool DataInputStream::readBoolean()
//This method is suitable for reading the byte written by the writeByte method of interface DataOutput.
//Returns:
//the 8-bit value read.
byte DataInputStream::readByte()
uint8_t DataInputStream::readByte()
{
if (stream == NULL)
{
app.DebugPrintf("DataInputStream::readByte() but underlying stream is NULL\n");
return 0;
}
return (byte) stream->read();
return (uint8_t) stream->read();
}
unsigned char DataInputStream::readUnsignedByte()
@@ -183,7 +183,7 @@ bool DataInputStream::readFully(byteArray b)
}
else
{
b[i] = static_cast<byte>(byteRead);
b[i] = static_cast<uint8_t>(byteRead);
}
}
return true;
+1 -1
View File
@@ -16,7 +16,7 @@ public:
virtual int read(byteArray b, unsigned int offset, unsigned int length);
virtual void close();
virtual bool readBoolean();
virtual byte readByte();
virtual uint8_t readByte();
virtual unsigned char readUnsignedByte();
virtual wchar_t readChar();
virtual bool readFully(byteArray b);
+1 -1
View File
@@ -6,7 +6,7 @@ public:
virtual void write(unsigned int b) = 0;
virtual void write(byteArray b) = 0;
virtual void write(byteArray b, unsigned int offset, unsigned int length) = 0;
virtual void writeByte(byte a) = 0;
virtual void writeByte(uint8_t a) = 0;
virtual void writeDouble(double a) = 0;
virtual void writeFloat(float a) = 0;
virtual void writeInt(int a) = 0;
+11 -11
View File
@@ -66,7 +66,7 @@ void DataOutputStream::close()
//Writes out a byte to the underlying output stream as a 1-byte value. If no exception is thrown, the counter written is incremented by 1.
//Parameters:
//v - a byte value to be written.
void DataOutputStream::writeByte(byte a)
void DataOutputStream::writeByte(uint8_t a)
{
stream->write( static_cast<unsigned int>(a) );
}
@@ -170,7 +170,7 @@ void DataOutputStream::writeChars(const wstring& str)
}
//Writes a boolean to the underlying output stream as a 1-byte value.
//The value true is written out as the value (byte)1; the value false is written out as the value (byte)0.
//The value true is written out as the value (uint8_t)1; the value false is written out as the value (uint8_t)0.
//If no exception is thrown, the counter written is incremented by 1.
//Parameters:
//v - a boolean value to be written.
@@ -219,15 +219,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++] = (uint8_t) ((utflen >> 8) & 0xFF);
bytearr[count++] = (uint8_t) ((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++] = (uint8_t) c;
}
for (;i < strlen; i++)
@@ -235,19 +235,19 @@ void DataOutputStream::writeUTF(const wstring& str)
c = str.at(i);
if ((c >= 0x0001) && (c <= 0x007F))
{
bytearr[count++] = (byte) c;
bytearr[count++] = (uint8_t) 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++] = (uint8_t) (0xE0 | ((c >> 12) & 0x0F));
bytearr[count++] = (uint8_t) (0x80 | ((c >> 6) & 0x3F));
bytearr[count++] = (uint8_t) (0x80 | ((c >> 0) & 0x3F));
}
else
{
bytearr[count++] = (byte) (0xC0 | ((c >> 6) & 0x1F));
bytearr[count++] = (byte) (0x80 | ((c >> 0) & 0x3F));
bytearr[count++] = (uint8_t) (0xC0 | ((c >> 6) & 0x1F));
bytearr[count++] = (uint8_t) (0x80 | ((c >> 0) & 0x3F));
}
}
write(bytearr, 0, utflen+2);
@@ -22,7 +22,7 @@ public:
virtual void write(byteArray b);
virtual void write(byteArray b, unsigned int offset, unsigned int length);
virtual void close();
virtual void writeByte(byte a);
virtual void writeByte(uint8_t a);
virtual void writeDouble(double a);
virtual void writeFloat(float a);
virtual void writeInt(int a);