diff options
author | Jonathan Kew <jfkthame@googlemail.com> | 2006-12-31 14:21:41 +0000 |
---|---|---|
committer | Jonathan Kew <jfkthame@googlemail.com> | 2006-12-31 14:21:41 +0000 |
commit | c8a954cb655acb91fdca4f34f04fb9c5d4121544 (patch) | |
tree | c6512244f74994e49ef2ac491c90449911618d31 /Build | |
parent | 9fcea486ceec61c0f968278e300ee5a9c7446d6b (diff) |
avoid using asprintf in xetex
git-svn-id: svn://tug.org/texlive/trunk@3061 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeX_ext.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c index 39d0d14bfd1..57e3b3c05b5 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c +++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c @@ -181,14 +181,8 @@ void initversionstring(char **versions) int fc_version = FcGetVersion(); #endif extern FT_Library gFreeTypeLibrary; /* in XeTeXFontInst_FT2 */ - FT_Int ftMajor, ftMinor, ftPatch; - if (gFreeTypeLibrary == 0 && FT_Init_FreeType(&gFreeTypeLibrary) != 0) { - fprintf(stderr, "FreeType initialization failed!\n"); - exit(9); - } - FT_Library_Version(gFreeTypeLibrary, &ftMajor, &ftMinor, &ftPatch); - (void) asprintf(versions, + char* fmt = "Compiled with ICU version %s [with modifications for XeTeX]\n" "Compiled with zlib version %s; using %s\n" "Compiled with FreeType2 version %d.%d.%d; using %d.%d.%d\n" @@ -199,7 +193,32 @@ void initversionstring(char **versions) "Compiled with libpng version %s; using %s\n" "Compiled with xpdf version %s\n" #endif - , + ; + + int len = strlen(fmt) + + strlen(U_ICU_VERSION) + + strlen(ZLIB_VERSION) + + strlen(zlib_version) +#ifdef XETEX_OTHER + + strlen(PNG_LIBPNG_VER_STRING) + + strlen(png_libpng_ver) + + strlen(xpdfVersion) + + 6 * 3 /* for fontconfig version #s (won't really need 3 digits per field!) */ +#endif + + 6 * 3; /* for freetype version #s (ditto) */ + + *versions = xmalloc(len + 1); + /* len will be more than enough, because of the placeholder chars in fmt + that get replaced by the arguments */ + + FT_Int ftMajor, ftMinor, ftPatch; + if (gFreeTypeLibrary == 0 && FT_Init_FreeType(&gFreeTypeLibrary) != 0) { + fprintf(stderr, "FreeType initialization failed!\n"); + exit(9); + } + FT_Library_Version(gFreeTypeLibrary, &ftMajor, &ftMinor, &ftPatch); + + (void)sprintf(*versions, fmt, U_ICU_VERSION, ZLIB_VERSION, zlib_version, FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH, |