diff options
author | Carlos Garcia Campos <carlosgc@gnome.org> | 2014-06-06 19:34:25 +0200 |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2014-06-06 19:34:25 +0200 |
commit | 8fe6c0b2322ecc45844383bf5dee100f4cd310b7 (patch) | |
tree | ad4fac525f14381da2bc8844f119ad4c848d67a2 | |
parent | 892e239b54d2cb91230802bda92002e0c0161c03 (diff) |
Handle NULL strings passed as arguments of GooString::appendfv
-rw-r--r-- | ALL_DIFF | 118 |
1 files changed, 0 insertions, 118 deletions
@@ -6333,124 +6333,6 @@ diff -uNrp xpdf-3.03/goo/GMutex.h xpdf-3.04/goo/GMutex.h #include <windows.h> -diff -uNrp xpdf-3.03/goo/GString.cc xpdf-3.04/goo/GString.cc ---- xpdf-3.03/goo/GString.cc 2011-08-15 23:08:53.000000000 +0200 -+++ xpdf-3.04/goo/GString.cc 2014-05-28 20:50:50.000000000 +0200 -@@ -168,7 +178,7 @@ GString::GString(GString *str1, GString - - GString *GString::fromInt(int x) { - char buf[24]; // enough space for 64-bit ints plus a little extra -- char *p; -+ const char *p; - int len; - - formatInt(x, buf, sizeof(buf), gFalse, 0, 10, &p, &len); -@@ -256,7 +278,7 @@ GString *GString::appendfv(const char *f - char buf[65]; - int len, i; - const char *p0, *p1; -- char *str; -+ const char *str; - - argsLen = 0; - argsSize = 8; -@@ -491,13 +513,23 @@ GString *GString::appendfv(const char *f - reverseAlign = !reverseAlign; - break; - case fmtString: -- str = arg.s; -- len = (int)strlen(str); -+ if (arg.s) { -+ str = arg.s; -+ len = (int)strlen(str); -+ } else { -+ str = "(null)"; -+ len = 6; -+ } - reverseAlign = !reverseAlign; - break; - case fmtGString: -- str = arg.gs->getCString(); -- len = arg.gs->getLength(); -+ if (arg.gs) { -+ str = arg.gs->getCString(); -+ len = arg.gs->getLength(); -+ } else { -+ str = "(null)"; -+ len = 6; -+ } - reverseAlign = !reverseAlign; - break; - case fmtSpace: -@@ -542,11 +574,11 @@ GString *GString::appendfv(const char *f - #ifdef LLONG_MAX - void GString::formatInt(long long x, char *buf, int bufSize, - GBool zeroFill, int width, int base, -- char **p, int *len) { -+ const char **p, int *len) { - #else - void GString::formatInt(long x, char *buf, int bufSize, - GBool zeroFill, int width, int base, -- char **p, int *len) { -+ const char **p, int *len) { - #endif - static char vals[17] = "0123456789abcdef"; - GBool neg; -@@ -580,11 +612,11 @@ void GString::formatInt(long x, char *bu - #ifdef ULLONG_MAX - void GString::formatUInt(unsigned long long x, char *buf, int bufSize, - GBool zeroFill, int width, int base, -- char **p, int *len) { -+ const char **p, int *len) { - #else - void GString::formatUInt(Gulong x, char *buf, int bufSize, - GBool zeroFill, int width, int base, -- char **p, int *len) { -+ const char **p, int *len) { - #endif - static char vals[17] = "0123456789abcdef"; - int i, j; -@@ -608,7 +640,7 @@ void GString::formatUInt(Gulong x, char - } - - void GString::formatDouble(double x, char *buf, int bufSize, int prec, -- GBool trim, char **p, int *len) { -+ GBool trim, const char **p, int *len) { - GBool neg, started; - double x2; - int d, i, j; -diff -uNrp xpdf-3.03/goo/GString.h xpdf-3.04/goo/GString.h ---- xpdf-3.03/goo/GString.h 2011-08-15 23:08:53.000000000 +0200 -+++ xpdf-3.04/goo/GString.h 2014-05-28 20:50:50.000000000 +0200 -@@ -129,23 +129,23 @@ private: - #ifdef LLONG_MAX - static void formatInt(long long x, char *buf, int bufSize, - GBool zeroFill, int width, int base, -- char **p, int *len); -+ const char **p, int *len); - #else - static void formatInt(long x, char *buf, int bufSize, - GBool zeroFill, int width, int base, -- char **p, int *len); -+ const char **p, int *len); - #endif - #ifdef ULLONG_MAX - static void formatUInt(unsigned long long x, char *buf, int bufSize, - GBool zeroFill, int width, int base, -- char **p, int *len); -+ const char **p, int *len); - #else - static void formatUInt(Gulong x, char *buf, int bufSize, - GBool zeroFill, int width, int base, -- char **p, int *len); -+ const char **p, int *len); - #endif - static void formatDouble(double x, char *buf, int bufSize, int prec, -- GBool trim, char **p, int *len); -+ GBool trim, const char **p, int *len); - }; - - #endif diff -uNrp xpdf-3.03/goo/Makefile.in xpdf-3.04/goo/Makefile.in --- xpdf-3.03/goo/Makefile.in 2011-08-15 23:08:53.000000000 +0200 +++ xpdf-3.04/goo/Makefile.in 2014-05-28 20:50:50.000000000 +0200 |