From 30027481f7f9e9191f7c8deea51850b7a76b1b1f Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 23 Feb 2013 21:46:21 -0500 Subject: Remove all old-style casts from C++ code --- libtests/buffer.cc | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'libtests/buffer.cc') diff --git a/libtests/buffer.cc b/libtests/buffer.cc index 923be197..094a3284 100644 --- a/libtests/buffer.cc +++ b/libtests/buffer.cc @@ -1,11 +1,15 @@ #include #include #include +#include #include #include #include -typedef unsigned char* uc; +static unsigned char* uc(char const* s) +{ + return QUtil::unsigned_char_pointer(s); +} int main() { @@ -14,20 +18,20 @@ int main() Pl_Discard discard; Pl_Count count("count", &discard); Pl_Buffer bp1("bp1", &count); - bp1.write((uc)"12345", 5); - bp1.write((uc)"67890", 5); + bp1.write(uc("12345"), 5); + bp1.write(uc("67890"), 5); bp1.finish(); std::cout << "count: " << count.getCount() << std::endl; - bp1.write((uc)"abcde", 5); - bp1.write((uc)"fghij", 6); + bp1.write(uc("abcde"), 5); + bp1.write(uc("fghij"), 6); bp1.finish(); std::cout << "count: " << count.getCount() << std::endl; Buffer* b = bp1.getBuffer(); std::cout << "size: " << b->getSize() << std::endl; std::cout << "data: " << b->getBuffer() << std::endl; delete b; - bp1.write((uc)"qwert", 5); - bp1.write((uc)"yuiop", 6); + bp1.write(uc("qwert"), 5); + bp1.write(uc("yuiop"), 6); bp1.finish(); std::cout << "count: " << count.getCount() << std::endl; b = bp1.getBuffer(); @@ -36,8 +40,8 @@ int main() delete b; Pl_Buffer bp2("bp2"); - bp2.write((uc)"moo", 3); - bp2.write((uc)"quack", 6); + bp2.write(uc("moo"), 3); + bp2.write(uc("quack"), 6); try { delete bp2.getBuffer(); -- cgit v1.2.3-70-g09d2