2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-05-30 17:00:51 +00:00
qpdf/qpdf/test_pdf_unicode.cc
Jay Berkenbilt cb769c62e5 WHITESPACE ONLY -- expand tabs in source code
This comment expands all tabs using an 8-character tab-width. You
should ignore this commit when using git blame or use git blame -w.

In the early days, I used to use tabs where possible for indentation,
since emacs did this automatically. In recent years, I have switched
to only using spaces, which means qpdf source code has been a mixture
of spaces and tabs. I have avoided cleaning this up because of not
wanting gratuitous whitespaces change to cloud the output of git
blame, but I changed my mind after discussing with users who view qpdf
source code in editors/IDEs that have other tab widths by default and
in light of the fact that I am planning to start applying automatic
code formatting soon.
2022-02-08 11:51:15 -05:00

47 lines
994 B
C++

#include <qpdf/QUtil.hh>
#include <qpdf/QPDFObjectHandle.hh>
#include <iostream>
#include <stdlib.h>
#include <string.h>
static char const* whoami = 0;
void usage()
{
std::cerr << "Usage: " << whoami << " infile" << std::endl;
exit(2);
}
int main(int argc, char* argv[])
{
if ((whoami = strrchr(argv[0], '/')) == NULL)
{
whoami = argv[0];
}
else
{
++whoami;
}
// For libtool's sake....
if (strncmp(whoami, "lt-", 3) == 0)
{
whoami += 3;
}
if (argc != 2)
{
usage();
}
char const* infilename = argv[1];
std::list<std::string> lines =
QUtil::read_lines_from_file(infilename);
for (std::list<std::string>::iterator iter = lines.begin();
iter != lines.end(); ++iter)
{
QPDFObjectHandle str = QPDFObjectHandle::newUnicodeString(*iter);
std::cout << str.getUTF8Value() << " // "
<< str.unparseBinary() << std::endl;
}
return 0;
}