aboutsummaryrefslogtreecommitdiffstats
path: root/libtests/buffer.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2013-02-24 03:46:21 +0100
committerJay Berkenbilt <ejb@ql.org>2013-03-04 22:45:16 +0100
commit30027481f7f9e9191f7c8deea51850b7a76b1b1f (patch)
tree815af293c2f6e38994e6096a4499be0dc9a476f9 /libtests/buffer.cc
parentbabb47948a408ebad12c452ba3fdd78782360167 (diff)
downloadqpdf-30027481f7f9e9191f7c8deea51850b7a76b1b1f.tar.zst
Remove all old-style casts from C++ code
Diffstat (limited to 'libtests/buffer.cc')
-rw-r--r--libtests/buffer.cc22
1 files changed, 13 insertions, 9 deletions
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 <qpdf/Pl_Buffer.hh>
#include <qpdf/Pl_Count.hh>
#include <qpdf/Pl_Discard.hh>
+#include <qpdf/QUtil.hh>
#include <stdlib.h>
#include <stdexcept>
#include <iostream>
-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();