1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-22 07:13:07 +01:00

Replace our own integer types with standard ones

This commit is contained in:
Michael Steenbeek
2018-06-20 17:28:51 +02:00
parent ec3a1e575e
commit 1b08fb4e69
618 changed files with 33440 additions and 33449 deletions

View File

@@ -17,27 +17,27 @@ constexpr size_t BUFFER_SIZE = 0x600000;
class SawyerCodingTest : public testing::Test
{
protected:
static const uint8 randomdata[1024];
static const uint8 nonedata[1029];
static const uint8 rledata[1038];
static const uint8 rlecompresseddata[1949];
static const uint8 rotatedata[1029];
static const uint8_t randomdata[1024];
static const uint8_t nonedata[1029];
static const uint8_t rledata[1038];
static const uint8_t rlecompresseddata[1949];
static const uint8_t rotatedata[1029];
void test_encode_decode(uint8 encoding_type)
void test_encode_decode(uint8_t encoding_type)
{
// Encode
sawyercoding_chunk_header chdr_in;
chdr_in.encoding = encoding_type;
chdr_in.length = sizeof(randomdata);
uint8 * encodedDataBuffer = new uint8[BUFFER_SIZE];
size_t encodedDataSize = sawyercoding_write_chunk_buffer(encodedDataBuffer, (const uint8 *)randomdata, chdr_in);
uint8_t * encodedDataBuffer = new uint8_t[BUFFER_SIZE];
size_t encodedDataSize = sawyercoding_write_chunk_buffer(encodedDataBuffer, (const uint8_t *)randomdata, chdr_in);
ASSERT_GT(encodedDataSize, sizeof(sawyercoding_chunk_header));
// Decode
MemoryStream ms(encodedDataBuffer, encodedDataSize);
SawyerChunkReader reader(&ms);
auto chunk = reader.ReadChunk();
ASSERT_EQ((uint8)chunk->GetEncoding(), chdr_in.encoding);
ASSERT_EQ((uint8_t)chunk->GetEncoding(), chdr_in.encoding);
ASSERT_EQ(chunk->GetLength(), chdr_in.length);
auto result = memcmp(chunk->GetData(), randomdata, sizeof(randomdata));
ASSERT_EQ(result, 0);
@@ -45,7 +45,7 @@ protected:
delete[] encodedDataBuffer;
}
void test_decode(const uint8 * data, size_t size)
void test_decode(const uint8_t * data, size_t size)
{
auto expectedLength = size - sizeof(sawyercoding_chunk_header);
auto chdr_in = reinterpret_cast<const sawyercoding_chunk_header *>(data);
@@ -54,7 +54,7 @@ protected:
MemoryStream ms(data, size);
SawyerChunkReader reader(&ms);
auto chunk = reader.ReadChunk();
ASSERT_EQ((uint8)chunk->GetEncoding(), chdr_in->encoding);
ASSERT_EQ((uint8_t)chunk->GetEncoding(), chdr_in->encoding);
ASSERT_EQ(chunk->GetLength(), sizeof(randomdata));
auto result = memcmp(chunk->GetData(), randomdata, sizeof(randomdata));
ASSERT_EQ(result, 0);
@@ -108,7 +108,7 @@ TEST_F(SawyerCodingTest, decode_chunk_rotate)
// 1024 bytes of random data
// use `dd if=/dev/urandom bs=1024 count=1 | xxd -i` to get your own
const uint8 SawyerCodingTest::randomdata[] = {
const uint8_t SawyerCodingTest::randomdata[] = {
0x3a, 0x97, 0x63, 0x8b, 0xbf, 0xe5, 0x6e, 0x0e, 0xc4, 0xac, 0xdc, 0x84, 0xd7, 0x68, 0xf1, 0x4d, 0xcb, 0xaf, 0x1e, 0x5a,
0x29, 0x40, 0x87, 0x80, 0x3f, 0xf9, 0xb8, 0xad, 0x01, 0xd3, 0x79, 0x3d, 0xe9, 0x87, 0xa8, 0x95, 0x68, 0xc0, 0xc2, 0x3d,
0x15, 0x87, 0xdb, 0xa6, 0x90, 0x8c, 0x26, 0x98, 0x2a, 0x3f, 0x2e, 0x0c, 0x82, 0x43, 0x00, 0x10, 0x6d, 0x60, 0xb9, 0xd4,
@@ -165,7 +165,7 @@ const uint8 SawyerCodingTest::randomdata[] = {
// Following are compressed versions of the data above.
const uint8 SawyerCodingTest::nonedata[] = {
const uint8_t SawyerCodingTest::nonedata[] = {
0x00, 0x00, 0x04, 0x00, 0x00, 0x3a, 0x97, 0x63, 0x8b, 0xbf, 0xe5, 0x6e, 0x0e, 0xc4, 0xac, 0xdc, 0x84, 0xd7, 0x68, 0xf1,
0x4d, 0xcb, 0xaf, 0x1e, 0x5a, 0x29, 0x40, 0x87, 0x80, 0x3f, 0xf9, 0xb8, 0xad, 0x01, 0xd3, 0x79, 0x3d, 0xe9, 0x87, 0xa8,
0x95, 0x68, 0xc0, 0xc2, 0x3d, 0x15, 0x87, 0xdb, 0xa6, 0x90, 0x8c, 0x26, 0x98, 0x2a, 0x3f, 0x2e, 0x0c, 0x82, 0x43, 0x00,
@@ -220,7 +220,7 @@ const uint8 SawyerCodingTest::nonedata[] = {
0x80, 0xbe, 0x9e, 0xd7, 0x5e, 0xb5, 0x72, 0x22, 0xbc
};
const uint8 SawyerCodingTest::rledata[] = {
const uint8_t SawyerCodingTest::rledata[] = {
0x01, 0x09, 0x04, 0x00, 0x00, 0x7d, 0x3a, 0x97, 0x63, 0x8b, 0xbf, 0xe5, 0x6e, 0x0e, 0xc4, 0xac, 0xdc, 0x84, 0xd7, 0x68,
0xf1, 0x4d, 0xcb, 0xaf, 0x1e, 0x5a, 0x29, 0x40, 0x87, 0x80, 0x3f, 0xf9, 0xb8, 0xad, 0x01, 0xd3, 0x79, 0x3d, 0xe9, 0x87,
0xa8, 0x95, 0x68, 0xc0, 0xc2, 0x3d, 0x15, 0x87, 0xdb, 0xa6, 0x90, 0x8c, 0x26, 0x98, 0x2a, 0x3f, 0x2e, 0x0c, 0x82, 0x43,
@@ -275,7 +275,7 @@ const uint8 SawyerCodingTest::rledata[] = {
0x1d, 0x15, 0x29, 0x5b, 0xd0, 0x66, 0x72, 0xb8, 0x38, 0x80, 0xbe, 0x9e, 0xd7, 0x5e, 0xb5, 0x72, 0x22, 0xbc
};
const uint8 SawyerCodingTest::rlecompresseddata[] = {
const uint8_t SawyerCodingTest::rlecompresseddata[] = {
0x02, 0x98, 0x07, 0x00, 0x00, 0x7d, 0xff, 0x3a, 0xff, 0x97, 0xff, 0x63, 0xff, 0x8b, 0xff, 0xbf, 0xff, 0xe5, 0xff, 0x6e,
0xff, 0x0e, 0xff, 0xc4, 0xff, 0xac, 0xff, 0xdc, 0xff, 0x84, 0xff, 0xd7, 0xff, 0x68, 0xff, 0xf1, 0xff, 0x4d, 0xff, 0xcb,
0xff, 0xaf, 0xff, 0x1e, 0xff, 0x5a, 0xff, 0x29, 0xff, 0x40, 0xff, 0x87, 0xff, 0x80, 0xff, 0x3f, 0xff, 0xf9, 0xff, 0xb8,
@@ -376,7 +376,7 @@ const uint8 SawyerCodingTest::rlecompresseddata[] = {
0xff, 0x5e, 0xff, 0xb5, 0xb8, 0xff, 0x22, 0xff, 0xbc
};
const uint8 SawyerCodingTest::rotatedata[] = {
const uint8_t SawyerCodingTest::rotatedata[] = {
0x03, 0x00, 0x04, 0x00, 0x00, 0x74, 0xbc, 0x6c, 0xc5, 0x7f, 0x2f, 0xcd, 0x07, 0x89, 0x65, 0x9b, 0x42, 0xaf, 0x43, 0x3e,
0xa6, 0x97, 0x7d, 0xc3, 0x2d, 0x52, 0x02, 0xf0, 0x40, 0x7e, 0xcf, 0x17, 0xd6, 0x02, 0x9e, 0x2f, 0x9e, 0xd3, 0x3c, 0x15,
0xca, 0xd0, 0x06, 0x58, 0x9e, 0x2a, 0x3c, 0x7b, 0x53, 0x21, 0x64, 0xc4, 0x4c, 0x54, 0xf9, 0xc5, 0x06, 0x05, 0x1a, 0x00,