diff options
author | Pierre Ossman <ossman@cendio.se> | 2022-09-10 13:19:41 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2023-02-01 21:17:12 +0100 |
commit | 6881c895ab317bd302addac5f228b7367136017f (patch) | |
tree | 18d1119f59209147d97e873c3dbc9be36e429aaf /tests | |
parent | baca73d03217a1c219d9c4f024ffcd39f85fd322 (diff) | |
download | tigervnc-6881c895ab317bd302addac5f228b7367136017f.tar.gz tigervnc-6881c895ab317bd302addac5f228b7367136017f.zip |
Use stdint types
Avoid having our own custom stuff and instead use the modern, standard
types, for familiarity.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/perf/convperf.cxx | 18 | ||||
-rw-r--r-- | tests/perf/decperf.cxx | 10 | ||||
-rw-r--r-- | tests/perf/encperf.cxx | 12 | ||||
-rw-r--r-- | tests/perf/fbperf.cxx | 6 | ||||
-rw-r--r-- | tests/unit/conv.cxx | 26 |
5 files changed, 36 insertions, 36 deletions
diff --git a/tests/perf/convperf.cxx b/tests/perf/convperf.cxx index 7a01bae8..c1126e7d 100644 --- a/tests/perf/convperf.cxx +++ b/tests/perf/convperf.cxx @@ -32,9 +32,9 @@ static const int tile = 64; static const int fbsize = 4096; -static rdr::U8 *fb1, *fb2; +static uint8_t *fb1, *fb2; -typedef void (*testfn) (rfb::PixelFormat&, rfb::PixelFormat&, rdr::U8*, rdr::U8*); +typedef void (*testfn) (rfb::PixelFormat&, rfb::PixelFormat&, uint8_t*, uint8_t*); struct TestEntry { const char *label; @@ -43,7 +43,7 @@ struct TestEntry { static void testMemcpy(rfb::PixelFormat &dstpf, rfb::PixelFormat& /*srcpf*/, - rdr::U8 *dst, rdr::U8 *src) + uint8_t *dst, uint8_t *src) { int h; h = tile; @@ -56,21 +56,21 @@ static void testMemcpy(rfb::PixelFormat &dstpf, static void testBuffer(rfb::PixelFormat &dstpf, rfb::PixelFormat &srcpf, - rdr::U8 *dst, rdr::U8 *src) + uint8_t *dst, uint8_t *src) { dstpf.bufferFromBuffer(dst, srcpf, src, tile, tile, fbsize, fbsize); } static void testToRGB(rfb::PixelFormat& /*dstpf*/, rfb::PixelFormat &srcpf, - rdr::U8 *dst, rdr::U8 *src) + uint8_t *dst, uint8_t *src) { srcpf.rgbFromBuffer(dst, src, tile, fbsize, tile); } static void testFromRGB(rfb::PixelFormat &dstpf, rfb::PixelFormat& /*srcpf*/, - rdr::U8 *dst, rdr::U8 *src) + uint8_t *dst, uint8_t *src) { dstpf.bufferFromRGB(dst, src, tile, fbsize, tile); } @@ -81,7 +81,7 @@ static void doTest(testfn fn, rfb::PixelFormat &dstpf, rfb::PixelFormat &srcpf) for (int i = 0;i < 10000;i++) { int x, y; - rdr::U8 *dst, *src; + uint8_t *dst, *src; x = rand() % (fbsize - tile); y = rand() % (fbsize - tile); dst = fb1 + (x + y * fbsize) * dstpf.bpp/8; @@ -135,8 +135,8 @@ int main(int /*argc*/, char** /*argv*/) bufsize = fbsize * fbsize * 4; - fb1 = new rdr::U8[bufsize]; - fb2 = new rdr::U8[bufsize]; + fb1 = new uint8_t[bufsize]; + fb2 = new uint8_t[bufsize]; for (i = 0;i < bufsize;i++) { fb1[i] = rand(); diff --git a/tests/perf/decperf.cxx b/tests/perf/decperf.cxx index 0509c15d..c72ec1d7 100644 --- a/tests/perf/decperf.cxx +++ b/tests/perf/decperf.cxx @@ -59,7 +59,7 @@ private: virtual void overrun(size_t needed); int offset; - rdr::U8 buf[131072]; + uint8_t buf[131072]; }; class CConn : public rfb::CConnection { @@ -69,11 +69,11 @@ public: virtual void initDone(); virtual void setPixelFormat(const rfb::PixelFormat& pf); - virtual void setCursor(int, int, const rfb::Point&, const rdr::U8*); + virtual void setCursor(int, int, const rfb::Point&, const uint8_t*); virtual void setCursorPos(const rfb::Point&); virtual void framebufferUpdateStart(); virtual void framebufferUpdateEnd(); - virtual void setColourMapEntries(int, int, rdr::U16*); + virtual void setColourMapEntries(int, int, uint16_t*); virtual void bell(); virtual void serverCutText(const char*); @@ -145,7 +145,7 @@ void CConn::setPixelFormat(const rfb::PixelFormat& /*pf*/) CConnection::setPixelFormat(filePF); } -void CConn::setCursor(int, int, const rfb::Point&, const rdr::U8*) +void CConn::setCursor(int, int, const rfb::Point&, const uint8_t*) { } @@ -169,7 +169,7 @@ void CConn::framebufferUpdateEnd() cpuTime += getCpuCounter(); } -void CConn::setColourMapEntries(int, int, rdr::U16*) +void CConn::setColourMapEntries(int, int, uint16_t*) { } diff --git a/tests/perf/encperf.cxx b/tests/perf/encperf.cxx index 476b613a..40e3abfc 100644 --- a/tests/perf/encperf.cxx +++ b/tests/perf/encperf.cxx @@ -68,7 +68,7 @@ static rfb::BoolParameter translate("translate", static const rfb::PixelFormat fbPF(32, 24, false, true, 255, 255, 255, 0, 8, 16); // Encodings to use -static const rdr::S32 encodings[] = { +static const int32_t encodings[] = { rfb::encodingTight, rfb::encodingCopyRect, rfb::encodingRRE, rfb::encodingHextile, rfb::encodingZRLE, rfb::pseudoEncodingLastRect, rfb::pseudoEncodingQualityLevel0 + 8, @@ -85,7 +85,7 @@ private: virtual void overrun(size_t needed); int offset; - rdr::U8 buf[131072]; + uint8_t buf[131072]; }; class CConn : public rfb::CConnection { @@ -98,12 +98,12 @@ public: virtual void initDone() {}; virtual void resizeFramebuffer(); - virtual void setCursor(int, int, const rfb::Point&, const rdr::U8*); + virtual void setCursor(int, int, const rfb::Point&, const uint8_t*); virtual void setCursorPos(const rfb::Point&); virtual void framebufferUpdateStart(); virtual void framebufferUpdateEnd(); virtual bool dataRect(const rfb::Rect&, int); - virtual void setColourMapEntries(int, int, rdr::U16*); + virtual void setColourMapEntries(int, int, uint16_t*); virtual void bell(); virtual void serverCutText(const char*); @@ -217,7 +217,7 @@ void CConn::resizeFramebuffer() setFramebuffer(pb); } -void CConn::setCursor(int, int, const rfb::Point&, const rdr::U8*) +void CConn::setCursor(int, int, const rfb::Point&, const uint8_t*) { } @@ -265,7 +265,7 @@ bool CConn::dataRect(const rfb::Rect &r, int encoding) return true; } -void CConn::setColourMapEntries(int, int, rdr::U16*) +void CConn::setColourMapEntries(int, int, uint16_t*) { } diff --git a/tests/perf/fbperf.cxx b/tests/perf/fbperf.cxx index d512ef80..5d626602 100644 --- a/tests/perf/fbperf.cxx +++ b/tests/perf/fbperf.cxx @@ -93,7 +93,7 @@ TestWindow::~TestWindow() void TestWindow::start(int width, int height) { - rdr::U32 pixel; + uint32_t pixel; stop(); @@ -176,7 +176,7 @@ void TestWindow::update() void TestWindow::changefb() { - rdr::U32 pixel; + uint32_t pixel; pixel = rand(); fb->fillRect(fb->getRect(), &pixel); @@ -195,7 +195,7 @@ void TestWindow::timer(void* data) void PartialTestWindow::changefb() { rfb::Rect r; - rdr::U32 pixel; + uint32_t pixel; r = fb->getRect(); r.tl.x += w() / 4; diff --git a/tests/unit/conv.cxx b/tests/unit/conv.cxx index 5696c149..2f15cb55 100644 --- a/tests/unit/conv.cxx +++ b/tests/unit/conv.cxx @@ -26,9 +26,9 @@ #include <rfb/PixelFormat.h> -static const rdr::U8 pixelRed = 0xf1; -static const rdr::U8 pixelGreen = 0xc3; -static const rdr::U8 pixelBlue = 0x97; +static const uint8_t pixelRed = 0xf1; +static const uint8_t pixelGreen = 0xc3; +static const uint8_t pixelBlue = 0x97; static const int fbWidth = 40; static const int fbHeight = 30; @@ -48,7 +48,7 @@ struct TestEntry { namespace rfb { void makePixel(const rfb::PixelFormat &pf, - rdr::U8 *buffer) + uint8_t *buffer) { rfb::Pixel p; @@ -63,7 +63,7 @@ void makePixel(const rfb::PixelFormat &pf, bool verifyPixel(const rfb::PixelFormat &dstpf, const rfb::PixelFormat &srcpf, - const rdr::U8 *buffer) + const uint8_t *buffer) { rfb::Pixel p; int r, g, b; @@ -108,7 +108,7 @@ static bool testPixel(const rfb::PixelFormat &dstpf, const rfb::PixelFormat &srcpf) { rfb::Pixel p; - rdr::U8 buffer[4]; + uint8_t buffer[4]; makePixel(srcpf, buffer); @@ -127,7 +127,7 @@ static bool testBuffer(const rfb::PixelFormat &dstpf, const rfb::PixelFormat &srcpf) { int i, x, y, unaligned; - rdr::U8 bufIn[fbMalloc], bufOut[fbMalloc]; + uint8_t bufIn[fbMalloc], bufOut[fbMalloc]; // Once aligned, and once unaligned for (unaligned = 0;unaligned < 2;unaligned++) { @@ -160,7 +160,7 @@ static bool testBuffer(const rfb::PixelFormat &dstpf, bufOut + unaligned + (x + y*fbWidth)*dstpf.bpp/8)) return false; } else { - const rdr::U8 zero[4] = { 0, 0, 0, 0 }; + const uint8_t zero[4] = { 0, 0, 0, 0 }; if (memcmp(bufOut + unaligned + (x + y*fbWidth)*dstpf.bpp/8, zero, dstpf.bpp/8) != 0) return false; @@ -176,7 +176,7 @@ static bool testRGB(const rfb::PixelFormat &dstpf, const rfb::PixelFormat &srcpf) { int i, x, y, unaligned; - rdr::U8 bufIn[fbMalloc], bufRGB[fbMalloc], bufOut[fbMalloc]; + uint8_t bufIn[fbMalloc], bufRGB[fbMalloc], bufOut[fbMalloc]; // Once aligned, and once unaligned for (unaligned = 0;unaligned < 2;unaligned++) { @@ -215,7 +215,7 @@ static bool testRGB(const rfb::PixelFormat &dstpf, bufOut + unaligned + (x + y*fbWidth)*dstpf.bpp/8)) return false; } else { - const rdr::U8 zero[4] = { 0, 0, 0, 0 }; + const uint8_t zero[4] = { 0, 0, 0, 0 }; if (memcmp(bufOut + unaligned + (x + y*fbWidth)*dstpf.bpp/8, zero, dstpf.bpp/8) != 0) return false; @@ -231,9 +231,9 @@ static bool testPixelRGB(const rfb::PixelFormat &dstpf, const rfb::PixelFormat &srcpf) { rfb::Pixel p; - rdr::U16 r16, g16, b16; - rdr::U8 r8, g8, b8; - rdr::U8 buffer[4]; + uint16_t r16, g16, b16; + uint8_t r8, g8, b8; + uint8_t buffer[4]; makePixel(srcpf, buffer); |