[poppler] 2 commits - configure.ac poppler/GfxFont.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Mon Jan 28 11:44:43 PST 2008


 configure.ac       |    1 +
 poppler/GfxFont.cc |    6 ++++++
 2 files changed, 7 insertions(+)

New commits:
commit 77b91c852ad3d5554afc03aee92a1d928f233401
Merge: 0babb0e... 0533696...
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Jan 28 20:44:34 2008 +0100

    Merge branch 'master' of ssh://aacid@git.freedesktop.org/git/poppler/poppler

commit 0babb0eb1afa343fb12a3fd037b98d2d1c794a1c
Author: Jonathan Kew <jonathan_kew at sil.org>
Date:   Mon Jan 28 20:42:44 2008 +0100

    Introduce a check for strndup and alternative for systems without it

diff --git a/configure.ac b/configure.ac
index 99ffbda..dd56ea4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,6 +17,7 @@ AC_PROG_CXX
 AC_PROG_INSTALL
 AC_CHECK_FUNC(gettimeofday, AC_DEFINE(HAVE_GETTIMEOFDAY, 1, [Defines if gettimeofday is available on your system]))
 AC_CHECK_FUNC(localtime_r, AC_DEFINE(HAVE_LOCALTIME_R, 1, [Defines if localtime_r is available on your system]))
+AC_CHECK_FUNC(strndup, AC_DEFINE(HAVE_STRNDUP, 1, [Defines if strndup is available on your system]))
 
 dnl Enable these unconditionally.
 AC_DEFINE([OPI_SUPPORT], [1], [Generate OPI comments in PS output.])
diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index 79d5a26..533904b 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -974,7 +974,13 @@ static int parseCharName(char *charName, Unicode *uBuf, int uLen,
       return 0;	// .notdef or similar
     } else if (var_part != NULL) {
       // parse names of the form 7.oldstyle, P.swash, s.sc, etc.
+#ifdef HAVE_STRNDUP
       char *main_part = strndup(charName, var_part - charName);
+#else
+      char *main_part = (char*)gmalloc(var_part - charName + 1);
+      main_part[var_part - charName] = '\0';
+      memcpy(main_part, charName, var_part - charName);
+#endif
       GBool namesRecurse = gTrue, variantsRecurse = gFalse;
       int n = parseCharName(main_part, uBuf, uLen, namesRecurse, ligatures,
 			    numeric, hex, variantsRecurse);


More information about the poppler mailing list