diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-10-08 12:35:23 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-10-08 12:35:23 +0000 |
commit | c7287df7c68266ba7fa8376d46e89a01c719cfce (patch) | |
tree | 378031ad062eaf0d0d96aae569337a5f6f859ec6 /Build/source | |
parent | 493998a8e5601018e974451a4aa1621d752698bb (diff) |
libs/poppler: Patch for UTF-16BE fromLuigi, backport from poppler git
git-svn-id: svn://tug.org/texlive/trunk@35332 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
5 files changed, 142 insertions, 12 deletions
diff --git a/Build/source/libs/poppler/poppler-0.26.5-PATCHES/ChangeLog b/Build/source/libs/poppler/poppler-0.26.5-PATCHES/ChangeLog index 085448de9ea..87235a32045 100644 --- a/Build/source/libs/poppler/poppler-0.26.5-PATCHES/ChangeLog +++ b/Build/source/libs/poppler/poppler-0.26.5-PATCHES/ChangeLog @@ -1,3 +1,8 @@ +2014-10-08 Peter Breitenlohner <peb@mppmu.mpg.de> + + * patch-10-UTF-16BE (new): Backport from poppler git + (submitted by Luigi Scarso <luigi.scarso@gmail.com>). + 2014-09-29 Peter Breitenlohner <peb@mppmu.mpg.de> Imported poppler-0.26.5 source tree from: diff --git a/Build/source/libs/poppler/poppler-0.26.5-PATCHES/patch-10-UTF-16BE b/Build/source/libs/poppler/poppler-0.26.5-PATCHES/patch-10-UTF-16BE new file mode 100644 index 00000000000..56a5fc497ad --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.26.5-PATCHES/patch-10-UTF-16BE @@ -0,0 +1,116 @@ +diff -ur poppler-0.26.5.orig/goo/GooString.h poppler-0.26.5/goo/GooString.h +--- poppler-0.26.5.orig/goo/GooString.h 2014-05-24 13:44:20.000000000 +0200 ++++ poppler-0.26.5/goo/GooString.h 2014-10-08 14:23:48.000000000 +0200 +@@ -17,7 +17,7 @@ + // + // Copyright (C) 2006 Kristian Høgsberg <krh@redhat.com> + // Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk@gmail.com> +-// Copyright (C) 2008-2010, 2012 Albert Astals Cid <aacid@kde.org> ++// Copyright (C) 2008-2010, 2012, 2014 Albert Astals Cid <aacid@kde.org> + // Copyright (C) 2012-2014 Fabio D'Urso <fabiodurso@hotmail.it> + // Copyright (C) 2013 Jason Crain <jason@aquaticape.us> + // +@@ -62,6 +62,10 @@ + class GooString { + public: + ++ // a special value telling that the length of the string is not given ++ // so it must be calculated from the strings ++ static const int CALC_STRING_LEN = -1; ++ + // Create an empty string. + GooString(); + +@@ -186,9 +190,6 @@ + // results in sizeof(GooString) be a multiple of 16. + // 24 makes sizeof(GooString) to be 32. + static const int STR_STATIC_SIZE = 24; +- // a special value telling that the length of the string is not given +- // so it must be calculated from the strings +- static const int CALC_STRING_LEN = -1; + + int roundedSize(int len); + +diff -ur poppler-0.26.5.orig/poppler/StructElement.cc poppler-0.26.5/poppler/StructElement.cc +--- poppler-0.26.5.orig/poppler/StructElement.cc 2014-04-26 17:37:22.000000000 +0200 ++++ poppler-0.26.5/poppler/StructElement.cc 2014-10-08 14:23:48.000000000 +0200 +@@ -5,6 +5,8 @@ + // This file is licensed under the GPLv2 or later + // + // Copyright 2013, 2014 Igalia S.L. ++// Copyright 2014 Luigi Scarso <luigi.scarso@gmail.com> ++// Copyright 2014 Albert Astals Cid <aacid@kde.org> + // + //======================================================================== + +@@ -677,11 +679,11 @@ + // Attribute + //------------------------------------------------------------------------ + +-Attribute::Attribute(const char *nameA, Object *valueA): ++Attribute::Attribute(const char *nameA, int nameLenA, Object *valueA): + type(UserProperty), + owner(UserProperties), + revision(0), +- name(nameA), ++ name(nameA, nameLenA), + value(), + hidden(gFalse), + formatted(NULL) +@@ -789,10 +791,13 @@ + { + Object obj, value; + const char *name = NULL; ++ int nameLen = GooString::CALC_STRING_LEN; + +- if (property->lookup("N", &obj)->isString()) +- name = obj.getString()->getCString(); +- else if (obj.isName()) ++ if (property->lookup("N", &obj)->isString()) { ++ GooString *s = obj.getString(); ++ name = s->getCString(); ++ nameLen = s->getLength(); ++ } else if (obj.isName()) + name = obj.getName(); + else { + error(errSyntaxError, -1, "N object is wrong type ({0:s})", obj.getTypeName()); +@@ -807,7 +812,7 @@ + return NULL; + } + +- Attribute *attribute = new Attribute(name, &value); ++ Attribute *attribute = new Attribute(name, nameLen, &value); + value.free(); + obj.free(); + +diff -ur poppler-0.26.5.orig/poppler/StructElement.h poppler-0.26.5/poppler/StructElement.h +--- poppler-0.26.5.orig/poppler/StructElement.h 2014-04-26 17:37:22.000000000 +0200 ++++ poppler-0.26.5/poppler/StructElement.h 2014-10-08 14:23:48.000000000 +0200 +@@ -5,6 +5,8 @@ + // This file is licensed under the GPLv2 or later + // + // Copyright 2013, 2014 Igalia S.L. ++// Copyright 2014 Luigi Scarso <luigi.scarso@gmail.com> ++// Copyright 2014 Albert Astals Cid <aacid@kde.org> + // + //======================================================================== + +@@ -74,7 +76,7 @@ + Attribute(Type type, Object *value); + + // Creates an UserProperty attribute, with an arbitrary name and value. +- Attribute(const char *name, Object *value); ++ Attribute(const char *name, int nameLen, Object *value); + + GBool isOk() const { return type != Unknown; } + +@@ -86,7 +88,8 @@ + Object *getValue() const { return &value; } + static Object *getDefaultValue(Type type); + +- const char *getName() const { return type == UserProperty ? name.getCString() : getTypeName(); } ++ // The caller gets the ownership of the return GooString and is responsible of deleting it ++ GooString *getName() const { return type == UserProperty ? name.copy() : new GooString(getTypeName()); } + + // The revision is optional, and defaults to zero. + Guint getRevision() const { return revision; } diff --git a/Build/source/libs/poppler/poppler-0.26.5/goo/GooString.h b/Build/source/libs/poppler/poppler-0.26.5/goo/GooString.h index b8020b62992..0176d873646 100644 --- a/Build/source/libs/poppler/poppler-0.26.5/goo/GooString.h +++ b/Build/source/libs/poppler/poppler-0.26.5/goo/GooString.h @@ -17,7 +17,7 @@ // // Copyright (C) 2006 Kristian Høgsberg <krh@redhat.com> // Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk@gmail.com> -// Copyright (C) 2008-2010, 2012 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2008-2010, 2012, 2014 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2012-2014 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2013 Jason Crain <jason@aquaticape.us> // @@ -62,6 +62,10 @@ class GooString { public: + // a special value telling that the length of the string is not given + // so it must be calculated from the strings + static const int CALC_STRING_LEN = -1; + // Create an empty string. GooString(); @@ -186,9 +190,6 @@ private: // results in sizeof(GooString) be a multiple of 16. // 24 makes sizeof(GooString) to be 32. static const int STR_STATIC_SIZE = 24; - // a special value telling that the length of the string is not given - // so it must be calculated from the strings - static const int CALC_STRING_LEN = -1; int roundedSize(int len); diff --git a/Build/source/libs/poppler/poppler-0.26.5/poppler/StructElement.cc b/Build/source/libs/poppler/poppler-0.26.5/poppler/StructElement.cc index 8e064a04fdf..b1aaca8a58b 100644 --- a/Build/source/libs/poppler/poppler-0.26.5/poppler/StructElement.cc +++ b/Build/source/libs/poppler/poppler-0.26.5/poppler/StructElement.cc @@ -5,6 +5,8 @@ // This file is licensed under the GPLv2 or later // // Copyright 2013, 2014 Igalia S.L. +// Copyright 2014 Luigi Scarso <luigi.scarso@gmail.com> +// Copyright 2014 Albert Astals Cid <aacid@kde.org> // //======================================================================== @@ -677,11 +679,11 @@ static StructElement::Type nameToType(const char *name) // Attribute //------------------------------------------------------------------------ -Attribute::Attribute(const char *nameA, Object *valueA): +Attribute::Attribute(const char *nameA, int nameLenA, Object *valueA): type(UserProperty), owner(UserProperties), revision(0), - name(nameA), + name(nameA, nameLenA), value(), hidden(gFalse), formatted(NULL) @@ -789,10 +791,13 @@ Attribute *Attribute::parseUserProperty(Dict *property) { Object obj, value; const char *name = NULL; + int nameLen = GooString::CALC_STRING_LEN; - if (property->lookup("N", &obj)->isString()) - name = obj.getString()->getCString(); - else if (obj.isName()) + if (property->lookup("N", &obj)->isString()) { + GooString *s = obj.getString(); + name = s->getCString(); + nameLen = s->getLength(); + } else if (obj.isName()) name = obj.getName(); else { error(errSyntaxError, -1, "N object is wrong type ({0:s})", obj.getTypeName()); @@ -807,7 +812,7 @@ Attribute *Attribute::parseUserProperty(Dict *property) return NULL; } - Attribute *attribute = new Attribute(name, &value); + Attribute *attribute = new Attribute(name, nameLen, &value); value.free(); obj.free(); diff --git a/Build/source/libs/poppler/poppler-0.26.5/poppler/StructElement.h b/Build/source/libs/poppler/poppler-0.26.5/poppler/StructElement.h index 51fd83da69b..cd89a970ddb 100644 --- a/Build/source/libs/poppler/poppler-0.26.5/poppler/StructElement.h +++ b/Build/source/libs/poppler/poppler-0.26.5/poppler/StructElement.h @@ -5,6 +5,8 @@ // This file is licensed under the GPLv2 or later // // Copyright 2013, 2014 Igalia S.L. +// Copyright 2014 Luigi Scarso <luigi.scarso@gmail.com> +// Copyright 2014 Albert Astals Cid <aacid@kde.org> // //======================================================================== @@ -74,7 +76,7 @@ public: Attribute(Type type, Object *value); // Creates an UserProperty attribute, with an arbitrary name and value. - Attribute(const char *name, Object *value); + Attribute(const char *name, int nameLen, Object *value); GBool isOk() const { return type != Unknown; } @@ -86,7 +88,8 @@ public: Object *getValue() const { return &value; } static Object *getDefaultValue(Type type); - const char *getName() const { return type == UserProperty ? name.getCString() : getTypeName(); } + // The caller gets the ownership of the return GooString and is responsible of deleting it + GooString *getName() const { return type == UserProperty ? name.copy() : new GooString(getTypeName()); } // The revision is optional, and defaults to zero. Guint getRevision() const { return revision; } |