From 84da37121e7814cf1e5c423cc0779d6df6b1c660 Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Sun, 17 Feb 2019 21:23:45 +0000 Subject: [PATCH 6/7] Update for new poppler --- Applications/Cxx/gdcminfo.cxx | 34 +++++++++++++++++----------------- Applications/Cxx/gdcmpdf.cxx | 12 ++++++------ 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Applications/Cxx/gdcminfo.cxx b/Applications/Cxx/gdcminfo.cxx index 2c510d7df..d9506be4e 100644 --- a/Applications/Cxx/gdcminfo.cxx +++ b/Applications/Cxx/gdcminfo.cxx @@ -105,22 +105,22 @@ static int checkdeflated(const char *name) return 1; } in = fopen(name, "r"); - if (in == NULL) + if (in == nullptr) { fprintf( stderr, "in is NULL\n" ); return 1; } buf = (unsigned char*)malloc(size); - if (buf != NULL && (size1 = (unsigned long)fread(buf, 1, size, in)) != size) { + if (buf != nullptr && (size1 = (unsigned long)fread(buf, 1, size, in)) != size) { free(buf); - buf = NULL; + buf = nullptr; fprintf( stderr, "could not fread: %lu bytes != %lu\n", size, size1 ); fprintf( stderr, "feof: %i ferror %i\n", feof(in), ferror(in) ); } fclose(in); len = size; source = buf; - if( source == NULL ) { + if( source == nullptr ) { fprintf( stderr, "source is NULL\n" ); return 1; } @@ -172,7 +172,7 @@ static int checkdeflated(const char *name) printf( "deflate stream has proper length: %lu\n", len ); } - ret = puff(NULL, &destlen, source, &sourcelen); + ret = puff(nullptr, &destlen, source, &sourcelen); if (ret) fprintf(stdout,"puff() failed with return code %d\n", ret); @@ -202,7 +202,7 @@ static std::string getInfoDate(Dict *infoDict, const char *key) #endif { const GooString* gs = obj.getString(); - s = gs->getCString(); + s = gs->c_str(); if (s[0] == 'D' && s[1] == ':') { s += 2; @@ -258,7 +258,7 @@ static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uM { Object obj; const GooString *s1; - GBool isUnicode; + bool isUnicode; Unicode u; char buf[8]; int i, n; @@ -274,12 +274,12 @@ static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uM if ((s1->getChar(0) & 0xff) == 0xfe && (s1->getChar(1) & 0xff) == 0xff) { - isUnicode = gTrue; + isUnicode = true; i = 2; } else { - isUnicode = gFalse; + isUnicode = false; i = 0; } while (i < obj.getString()->getLength()) @@ -400,7 +400,7 @@ static int ProcessOneFile( std::string const & filename, gdcm::Defs const & defs return 1; } gdcm::SplitMosaicFilter filter; - const gdcm::Image *pimage = NULL; + const gdcm::Image *pimage = nullptr; const gdcm::Image &image = reader.GetImage(); if( mosaic ) { @@ -539,10 +539,10 @@ static int ProcessOneFile( std::string const & filename, gdcm::Defs const & defs int pages = doc->getNumPages(); const char *encrypted = doc->isEncrypted() ? "yes" : "no"; // printf("yes (print:%s copy:%s change:%s addNotes:%s)\n", - // doc->okToPrint(gTrue) ? "yes" : "no", - // doc->okToCopy(gTrue) ? "yes" : "no", - // doc->okToChange(gTrue) ? "yes" : "no", - // doc->okToAddNotes(gTrue) ? "yes" : "no"); + // doc->okToPrint(true) ? "yes" : "no", + // doc->okToCopy(true) ? "yes" : "no", + // doc->okToChange(true) ? "yes" : "no", + // doc->okToAddNotes(true) ? "yes" : "no"); // print linearization info const char *optimized = doc->isLinearized() ? "yes" : "no"; @@ -608,10 +608,10 @@ int main(int argc, char *argv[]) int version = 0; int debug = 0; int error = 0; - while (1) { + while (true) { int option_index = 0; static struct option long_options[] = { - {"input", 1, 0, 0}, + {"input", 1, nullptr, 0}, {"recursive", 0, &recursive, 1}, {"check-deflated", 0, &deflated, 1}, {"resources-path", 0, &resourcespath, 1}, @@ -627,7 +627,7 @@ int main(int argc, char *argv[]) {"error", 0, &error, 1}, {"help", 0, &help, 1}, {"version", 0, &version, 1}, - {0, 0, 0, 0} // required + {nullptr, 0, nullptr, 0} // required }; static const char short_options[] = "i:rdVWDEhv"; c = getopt_long (argc, argv, short_options, diff --git a/Applications/Cxx/gdcmpdf.cxx b/Applications/Cxx/gdcmpdf.cxx index b3f22b520..15220a34b 100644 --- a/Applications/Cxx/gdcmpdf.cxx +++ b/Applications/Cxx/gdcmpdf.cxx @@ -50,7 +50,7 @@ static std::string getInfoDate(Dict *infoDict, const char *key) #endif { const GooString* gs = obj.getString(); - s = gs->getCString(); + s = gs->c_str(); if (s[0] == 'D' && s[1] == ':') { s += 2; @@ -102,11 +102,11 @@ static std::string getInfoDate(Dict *infoDict, const char *key) return out; } -static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uMap, GBool & unicode) +static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uMap, bool & unicode) { Object obj; const GooString *s1; - GBool isUnicode = gFalse; + bool isUnicode = false; Unicode u; char buf[8]; int i, n; @@ -122,12 +122,12 @@ static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uM if ((s1->getChar(0) & 0xff) == 0xfe && (s1->getChar(1) & 0xff) == 0xff) { - isUnicode = gTrue; + isUnicode = true; i = 2; } else { - isUnicode = gFalse; + isUnicode = false; i = 0; } while (i < obj.getString()->getLength()) @@ -398,7 +398,7 @@ http://msdn.microsoft.com/en-us/library/078sfkak(VS.80).aspx std::string creationdate; std::string moddate; - GBool isUnicode = gFalse; + bool isUnicode = false; if (doc->isOk()) { #ifdef LIBPOPPLER_NEW_OBJECT_API -- 2.20.1