2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-11-14 08:44:04 +00:00
qpdf/libtests/ascii85.cc
Jay Berkenbilt 5d4cad9c02 ABI change: fix use of off_t, size_t, and integer types
Significantly improve the code's use of off_t for file offsets, size_t
for memory sizes, and integer types in cases where there has to be
compatibility with external interfaces.  Rework sections of the code
that would have prevented qpdf from working on files larger than 2 (or
maybe 4) GB in size.
2012-06-20 15:20:26 -04:00

38 lines
575 B
C++

#include <qpdf/Pl_ASCII85Decoder.hh>
#include <qpdf/Pl_StdioFile.hh>
#include <iostream>
#include <stdlib.h>
int main()
{
Pl_StdioFile out("stdout", stdout);
Pl_ASCII85Decoder decode("decode", &out);
try
{
unsigned char buf[10000];
bool done = false;
while (! done)
{
size_t len = fread(buf, 1, sizeof(buf), stdin);
if (len <= 0)
{
done = true;
}
else
{
decode.write(buf, len);
}
}
decode.finish();
}
catch (std::exception& e)
{
std::cerr << e.what() << std::endl;
exit(2);
}
return 0;
}