From ca29790bc71d2787a53d3c4fa6f74847b7b2a591 Mon Sep 17 00:00:00 2001 From: matthieu Date: Sun, 10 May 2015 09:27:16 +0000 Subject: [PATCH] Update to libfontenc 1.1.3 --- lib/libfontenc/ChangeLog | 58 ++ lib/libfontenc/INSTALL | 119 ++- lib/libfontenc/Makefile.in | 6 +- lib/libfontenc/NEWS | 0 lib/libfontenc/aclocal.m4 | 177 +++- lib/libfontenc/compile | 347 ++++++++ lib/libfontenc/configure | 759 ++++++++-------- lib/libfontenc/configure.ac | 2 +- lib/libfontenc/include/X11/fonts/fontenc.h | 14 +- lib/libfontenc/src/Makefile.in | 2 + lib/libfontenc/src/encparse.c | 611 +++++++------ lib/libfontenc/src/fontenc.c | 964 +++++++++++---------- lib/libfontenc/src/fontencI.h | 12 +- 13 files changed, 1912 insertions(+), 1159 deletions(-) delete mode 100644 lib/libfontenc/NEWS create mode 100644 lib/libfontenc/compile diff --git a/lib/libfontenc/ChangeLog b/lib/libfontenc/ChangeLog index f0e0353f0..4429641c8 100644 --- a/lib/libfontenc/ChangeLog +++ b/lib/libfontenc/ChangeLog @@ -1,3 +1,61 @@ +commit 42f3a39c3085afd9ef904ae39102fd49bbc2e4a5 +Author: Alan Coopersmith +Date: Thu Apr 30 21:39:51 2015 -0700 + + libfontenc 1.1.3 + + Signed-off-by: Alan Coopersmith + +commit de1843aaf76015c9d99416f3122d169fe331b849 +Author: Alan Coopersmith +Date: Sat Jan 17 19:37:28 2015 -0800 + + Initialize aliases array in parseEncodingFile() + + The static analyzer insisted there were code paths that entries in this + array could be read without them being initialized. While I couldn't + see any way that would happen, this makes sure it can't and makes the + analyzer quiet. + + Signed-off-by: Alan Coopersmith + +commit c377d91157601df90936e49167ce28a548c9b740 +Author: Alan Coopersmith +Date: Sat Jan 17 19:18:41 2015 -0800 + + Reformat code to X.Org standard style + + Signed-off-by: Alan Coopersmith + +commit 8eefb5a18de41b693c00767458ee51f034201ebf +Author: Alan Coopersmith +Date: Sat Jan 17 18:46:49 2015 -0800 + + Replace strcpy+strcat calls with snprintf calls + + Signed-off-by: Alan Coopersmith + +commit a5221fc11307eb1230ae2643c6e423b0f7867fde +Author: Alan Coopersmith +Date: Sat Jan 17 18:36:07 2015 -0800 + + Replace sprintf call with snprintf + + Signed-off-by: Alan Coopersmith + +commit 0037a42107b952c9d903719615747e760e4e7247 +Author: Alan Coopersmith +Date: Thu Dec 26 09:40:00 2013 -0800 + + Initialize both value1 & value2, not value1 twice + + Flagged by cppcheck 1.62: + [src/encparse.c:303] -> [src/encparse.c:303]: (performance, inconclusive) + Variable 'value1' is reassigned a value before the old one has been used + if variable is no semaphore variable. + + Signed-off-by: Alan Coopersmith + commit 3acba630d8b57084f7e92c15732408711ed5137a Author: Alan Coopersmith Date: Thu Apr 25 20:52:11 2013 -0700 diff --git a/lib/libfontenc/INSTALL b/lib/libfontenc/INSTALL index 8b82ade08..a1e89e18a 100644 --- a/lib/libfontenc/INSTALL +++ b/lib/libfontenc/INSTALL @@ -1,11 +1,13 @@ Installation Instructions ************************* -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, -2006, 2007, 2008 Free Software Foundation, Inc. +Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, +Inc. - This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. + Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. Basic Installation ================== @@ -13,7 +15,11 @@ Basic Installation Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for -instructions specific to this package. +instructions specific to this package. Some packages provide this +`INSTALL' file but do not implement all of the features documented +below. The lack of an optional feature in a given package is not +necessarily a bug. More recommendations for GNU packages can be found +in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses @@ -42,7 +48,7 @@ may remove or edit it. you want to change it or regenerate `configure' using a newer version of `autoconf'. -The simplest way to compile this package is: + The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. @@ -53,12 +59,22 @@ The simplest way to compile this package is: 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with - the package. + the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and - documentation. + documentation. When installing into a prefix owned by root, it is + recommended that the package be configured and built as a regular + user, and only the `make install' phase executed with root + privileges. - 5. You can remove the program binaries and object files from the + 5. Optionally, type `make installcheck' to repeat any self-tests, but + this time using the binaries in their final installed location. + This target does not install anything. Running this target as a + regular user, particularly if the prior `make install' required + root privileges, verifies that the installation completed + correctly. + + 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is @@ -67,8 +83,15 @@ The simplest way to compile this package is: all sorts of other programs in order to regenerate files that came with the distribution. - 6. Often, you can also type `make uninstall' to remove the installed - files again. + 7. Often, you can also type `make uninstall' to remove the installed + files again. In practice, not all packages have tested that + uninstallation works correctly, even though it is required by the + GNU Coding Standards. + + 8. Some packages, particularly those that use Automake, provide `make + distcheck', which can by used by developers to test that all other + targets like `make install' and `make uninstall' work correctly. + This target is generally not run by end users. Compilers and Options ===================== @@ -93,7 +116,8 @@ same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. +source code in the directory that `configure' is in and in `..'. This +is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have @@ -120,7 +144,8 @@ Installation Names By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX'. +`configure' the option `--prefix=PREFIX', where PREFIX must be an +absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you @@ -131,15 +156,46 @@ Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. +you can set and what kinds of files go in them. In general, the +default for these options is expressed in terms of `${prefix}', so that +specifying just `--prefix' will affect all of the other directory +specifications that were not explicitly provided. + + The most portable way to affect installation locations is to pass the +correct locations to `configure'; however, many packages provide one or +both of the following shortcuts of passing variable assignments to the +`make install' command line to change installation locations without +having to reconfigure or recompile. + + The first method involves providing an override variable for each +affected directory. For example, `make install +prefix=/alternate/directory' will choose an alternate location for all +directory configuration variables that were expressed in terms of +`${prefix}'. Any directories that were specified during `configure', +but not in terms of `${prefix}', must each be overridden at install +time for the entire installation to be relocated. The approach of +makefile variable overrides for each directory variable is required by +the GNU Coding Standards, and ideally causes no recompilation. +However, some platforms have known limitations with the semantics of +shared libraries that end up requiring recompilation when using this +method, particularly noticeable in packages that use GNU Libtool. + + The second method involves providing the `DESTDIR' variable. For +example, `make install DESTDIR=/alternate/directory' will prepend +`/alternate/directory' before all installation names. The approach of +`DESTDIR' overrides is not required by the GNU Coding Standards, and +does not work on platforms that have drive letters. On the other hand, +it does better at avoiding recompilation issues, and works well even +when some directory options were not specified in terms of `${prefix}' +at `configure' time. + +Optional Features +================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. -Optional Features -================= - Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE @@ -152,6 +208,13 @@ find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. + Some packages offer the ability to configure how verbose the +execution of `make' will be. For these packages, running `./configure +--enable-silent-rules' sets the default to minimal output, which can be +overridden with `make V=1'; while running `./configure +--disable-silent-rules' sets the default to verbose, which can be +overridden with `make V=0'. + Particular systems ================== @@ -159,10 +222,15 @@ Particular systems CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: - ./configure CC="cc -Ae" + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. + HP-UX `make' updates targets which have the same time stamps as +their prerequisites, which makes it generally unusable when shipped +generated files such as `configure' are involved. Use GNU `make' +instead. + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended @@ -174,6 +242,16 @@ and if that doesn't work, try ./configure CC="cc -nodtk" + On Solaris, don't put `/usr/ucb' early in your `PATH'. This +directory contains several dysfunctional programs; working variants of +these programs are available in `/usr/bin'. So, if you need `/usr/ucb' +in your `PATH', put it _after_ `/usr/bin'. + + On Haiku, software installed for all users goes in `/boot/common', +not `/usr/local'. It is recommended to use the following options: + + ./configure --prefix=/boot/common + Specifying the System Type ========================== @@ -189,7 +267,8 @@ type, such as `sun4', or a canonical name which has the form: where SYSTEM can have one of these forms: - OS KERNEL-OS + OS + KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't @@ -277,7 +356,7 @@ operates. `configure' can determine that directory automatically. `--prefix=DIR' - Use DIR as the installation prefix. *Note Installation Names:: + Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. diff --git a/lib/libfontenc/Makefile.in b/lib/libfontenc/Makefile.in index 4c8c2f4ad..77229820e 100644 --- a/lib/libfontenc/Makefile.in +++ b/lib/libfontenc/Makefile.in @@ -74,8 +74,8 @@ host_triplet = @host@ subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(srcdir)/fontenc.pc.in $(top_srcdir)/configure AUTHORS \ - COPYING ChangeLog INSTALL NEWS config.guess config.sub depcomp \ + $(srcdir)/fontenc.pc.in $(top_srcdir)/configure COPYING \ + ChangeLog INSTALL compile config.guess config.sub depcomp \ install-sh ltmain.sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac @@ -273,6 +273,8 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ diff --git a/lib/libfontenc/NEWS b/lib/libfontenc/NEWS deleted file mode 100644 index e69de29bb..000000000 diff --git a/lib/libfontenc/aclocal.m4 b/lib/libfontenc/aclocal.m4 index 201584406..0549812e3 100644 --- a/lib/libfontenc/aclocal.m4 +++ b/lib/libfontenc/aclocal.m4 @@ -8607,6 +8607,7 @@ m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant . # @@ -8633,8 +8634,12 @@ m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi @@ -8647,7 +8652,6 @@ if test -n "$PKG_CONFIG"; then AC_MSG_RESULT([no]) PKG_CONFIG="" fi - fi[]dnl ])# PKG_PROG_PKG_CONFIG @@ -8656,34 +8660,32 @@ fi[]dnl # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # -# -# Similar to PKG_CHECK_MODULES, make sure that the first instance of -# this or PKG_CHECK_MODULES is called, or make sure to call -# PKG_CHECK_EXISTS manually +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then - m4_ifval([$2], [$2], [:]) + m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) - # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], -[if test -n "$PKG_CONFIG"; then - if test -n "$$1"; then - pkg_cv_[]$1="$$1" - else - PKG_CHECK_EXISTS([$3], - [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], - [pkg_failed=yes]) - fi -else - pkg_failed=untried +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried fi[]dnl ])# _PKG_CONFIG @@ -8725,16 +8727,17 @@ and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else - $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD - ifelse([$4], , [AC_MSG_ERROR(dnl + m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS @@ -8742,28 +8745,67 @@ $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. -_PKG_TEXT -])], - [AC_MSG_RESULT([no]) - $4]) +_PKG_TEXT])[]dnl + ]) elif test $pkg_failed = untried; then - ifelse([$4], , [AC_MSG_FAILURE(dnl + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT -To get pkg-config, see .])], - [$4]) +To get pkg-config, see .])[]dnl + ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) - ifelse([$3], , :, [$3]) + $3 fi[]dnl ])# PKG_CHECK_MODULES + +# PKG_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable pkgconfigdir as the location where a module +# should install pkg-config .pc files. By default the directory is +# $libdir/pkgconfig, but the default can be changed by passing +# DIRECTORY. The user can override through the --with-pkgconfigdir +# parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_INSTALLDIR + + +# PKG_NOARCH_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable noarch_pkgconfigdir as the location where a +# module should install arch-independent pkg-config .pc files. By +# default the directory is $datadir/pkgconfig, but the default can be +# changed by passing DIRECTORY. The user can override through the +# --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_NOARCH_INSTALLDIR + # Copyright (C) 2002-2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation @@ -10139,7 +10181,7 @@ AC_DEFUN([XORG_FONTDIR],[XORG_FONTSUBDIR([FONTDIR], [fontdir], [$1])]) dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure. dnl dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. -dnl +dnl dnl Permission is hereby granted, free of charge, to any person obtaining a dnl copy of this software and associated documentation files (the "Software"), dnl to deal in the Software without restriction, including without limitation @@ -10172,10 +10214,10 @@ dnl DEALINGS IN THE SOFTWARE. # [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])]) # # -# See the "minimum version" comment for each macro you use to see what +# See the "minimum version" comment for each macro you use to see what # version you require. m4_defun([XORG_MACROS_VERSION],[ -m4_define([vers_have], [1.16.2]) +m4_define([vers_have], [1.19.0]) m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.]))) m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.]))) m4_if(m4_cmp(maj_have, maj_needed), 0,, @@ -10195,7 +10237,7 @@ m4_undefine([maj_needed]) # such as man pages and config files AC_DEFUN([XORG_PROG_RAWCPP],[ AC_REQUIRE([AC_PROG_CPP]) -AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], +AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib]) # Check for flag to avoid builtin definitions - assumes unix is predefined, @@ -10225,6 +10267,7 @@ if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then AC_MSG_RESULT([no]) else if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then + TRADITIONALCPPFLAGS="-traditional" RAWCPPFLAGS="${RAWCPPFLAGS} -traditional" AC_MSG_RESULT([yes]) else @@ -10233,6 +10276,7 @@ else fi rm -f conftest.$ac_ext AC_SUBST(RAWCPPFLAGS) +AC_SUBST(TRADITIONALCPPFLAGS) ]) # XORG_PROG_RAWCPP # XORG_MANPAGE_SECTIONS() @@ -10757,9 +10801,10 @@ AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes]) ]) # XORG_WITH_ASCIIDOC # XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT]) -# -------------------------------- +# ------------------------------------------- # Minimum version: 1.5.0 # Minimum version for optional DEFAULT argument: 1.11.0 +# Minimum version for optional DOT checking: 1.18.0 # # Documentation tools are not always available on all platforms and sometimes # not at the appropriate level. This macro enables a module to test for the @@ -10779,6 +10824,7 @@ AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes]) # AC_DEFUN([XORG_WITH_DOXYGEN],[ AC_ARG_VAR([DOXYGEN], [Path to doxygen command]) +AC_ARG_VAR([DOT], [Path to the dot graphics utility]) m4_define([_defopt], m4_default([$2], [auto])) AC_ARG_WITH(doxygen, AS_HELP_STRING([--with-doxygen], @@ -10822,6 +10868,20 @@ m4_ifval([$1], AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed]) fi]) fi]) + +dnl Check for DOT if we have doxygen. The caller decides if it is mandatory +dnl HAVE_DOT is a variable that can be used in your doxygen.in config file: +dnl HAVE_DOT = @HAVE_DOT@ +HAVE_DOT=no +if test "x$have_doxygen" = "xyes"; then + AC_PATH_PROG([DOT], [dot]) + if test "x$DOT" != "x"; then + HAVE_DOT=yes + fi +fi + +AC_SUBST([HAVE_DOT]) +AM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"]) AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes]) ]) # XORG_WITH_DOXYGEN @@ -11004,6 +11064,29 @@ fi]) AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes]) ]) # XORG_WITH_FOP +# XORG_WITH_M4([MIN-VERSION]) +# --------------------------- +# Minimum version: 1.19.0 +# +# This macro attempts to locate an m4 macro processor which supports +# -I option and is only useful for modules relying on M4 in order to +# expand macros in source code files. +# +# Interface to module: +# M4: returns the path of the m4 program found +# returns the path set by the user in the environment +# +AC_DEFUN([XORG_WITH_M4], [ +AC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4], + [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4], + [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \ + ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]], + [AC_MSG_ERROR([could not find m4 that supports -I option])], + [$PATH:/usr/gnu/bin])]) + +AC_SUBST([M4], [$ac_cv_path_M4]) +]) # XORG_WITH_M4 + # XORG_WITH_PS2PDF([DEFAULT]) # ---------------- # Minimum version: 1.6.0 @@ -11458,7 +11541,8 @@ AC_ARG_ENABLE(malloc0returnsnull, AC_MSG_CHECKING([whether malloc(0) returns NULL]) if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then - AC_RUN_IFELSE([AC_LANG_PROGRAM([ +AC_CACHE_VAL([xorg_cv_malloc0_returns_null], + [AC_RUN_IFELSE([AC_LANG_PROGRAM([ #include ],[ char *m0, *r0, *c0, *p; @@ -11468,9 +11552,9 @@ if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then c0 = calloc(0,10); exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1); ])], - [MALLOC_ZERO_RETURNS_NULL=yes], - [MALLOC_ZERO_RETURNS_NULL=no], - [MALLOC_ZERO_RETURNS_NULL=yes]) + [xorg_cv_malloc0_returns_null=yes], + [xorg_cv_malloc0_returns_null=no])]) +MALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null fi AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL]) @@ -11681,18 +11765,18 @@ fi found="no" m4_foreach([flag], m4_cdr($@), [ if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument" fi PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag[" dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname - AC_MSG_CHECKING([if ]COMPILER[ supports]flag[]) + AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[]) cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[]) AC_CACHE_VAL($cacheid, [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])], @@ -11759,7 +11843,7 @@ AC_LANG_CASE( XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast]) - XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition]) + XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement]) ] ) @@ -11768,16 +11852,17 @@ AC_LANG_CASE( XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow]) -XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute]) +# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op]) # These are currently disabled because they are noisy. They will be enabled # in the future once the codebase is sufficiently modernized to silence # them. For now, I don't want them to drown out the other warnings. -# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op]) # XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses]) # XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align]) +# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual]) # Turn some warnings into errors, so we don't accidently get successful builds # when there are problems that should be fixed. @@ -11951,7 +12036,7 @@ dnl # XORG_RELEASE_VERSION # -------------------- # Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use. - + AC_DEFUN([XORG_RELEASE_VERSION],[ AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR], [`echo $PACKAGE_VERSION | cut -d . -f 1`], diff --git a/lib/libfontenc/compile b/lib/libfontenc/compile new file mode 100644 index 000000000..a85b723c7 --- /dev/null +++ b/lib/libfontenc/compile @@ -0,0 +1,347 @@ +#! /bin/sh +# Wrapper for compilers which do not understand '-c -o'. + +scriptversion=2012-10-14.11; # UTC + +# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Written by Tom Tromey . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +nl=' +' + +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent tools from complaining about whitespace usage. +IFS=" "" $nl" + +file_conv= + +# func_file_conv build_file lazy +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. If the determined conversion +# type is listed in (the comma separated) LAZY, no conversion will +# take place. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv/,$2, in + *,$file_conv,*) + ;; + mingw/*) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin/*) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine/*) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_cl_dashL linkdir +# Make cl look for libraries in LINKDIR +func_cl_dashL () +{ + func_file_conv "$1" + if test -z "$lib_path"; then + lib_path=$file + else + lib_path="$lib_path;$file" + fi + linker_opts="$linker_opts -LIBPATH:$file" +} + +# func_cl_dashl library +# Do a library search-path lookup for cl +func_cl_dashl () +{ + lib=$1 + found=no + save_IFS=$IFS + IFS=';' + for dir in $lib_path $LIB + do + IFS=$save_IFS + if $shared && test -f "$dir/$lib.dll.lib"; then + found=yes + lib=$dir/$lib.dll.lib + break + fi + if test -f "$dir/$lib.lib"; then + found=yes + lib=$dir/$lib.lib + break + fi + if test -f "$dir/lib$lib.a"; then + found=yes + lib=$dir/lib$lib.a + break + fi + done + IFS=$save_IFS + + if test "$found" != yes; then + lib=$lib.lib + fi +} + +# func_cl_wrapper cl arg... +# Adjust compile command to suit cl +func_cl_wrapper () +{ + # Assume a capable shell + lib_path= + shared=: + linker_opts= + for arg + do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + eat=1 + case $2 in + *.o | *.[oO][bB][jJ]) + func_file_conv "$2" + set x "$@" -Fo"$file" + shift + ;; + *) + func_file_conv "$2" + set x "$@" -Fe"$file" + shift + ;; + esac + ;; + -I) + eat=1 + func_file_conv "$2" mingw + set x "$@" -I"$file" + shift + ;; + -I*) + func_file_conv "${1#-I}" mingw + set x "$@" -I"$file" + shift + ;; + -l) + eat=1 + func_cl_dashl "$2" + set x "$@" "$lib" + shift + ;; + -l*) + func_cl_dashl "${1#-l}" + set x "$@" "$lib" + shift + ;; + -L) + eat=1 + func_cl_dashL "$2" + ;; + -L*) + func_cl_dashL "${1#-L}" + ;; + -static) + shared=false + ;; + -Wl,*) + arg=${1#-Wl,} + save_ifs="$IFS"; IFS=',' + for flag in $arg; do + IFS="$save_ifs" + linker_opts="$linker_opts $flag" + done + IFS="$save_ifs" + ;; + -Xlinker) + eat=1 + linker_opts="$linker_opts $2" + ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) + func_file_conv "$1" mingw + set x "$@" "$file" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift + done + if test -n "$linker_opts"; then + linker_opts="-link$linker_opts" + fi + exec "$@" $linker_opts + exit 1 +} + +eat= + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand '-c -o'. +Remove '-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file 'INSTALL'. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + func_cl_wrapper "$@" # Doesn't return... + ;; +esac + +ofile= +cfile= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + # So we strip '-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no '-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # '.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` + +# Create the lock directory. +# Note: use '[/\\:.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/lib/libfontenc/configure b/lib/libfontenc/configure index 843ae31d6..fe6316e2f 100644 --- a/lib/libfontenc/configure +++ b/lib/libfontenc/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libfontenc 1.1.2. +# Generated by GNU Autoconf 2.69 for libfontenc 1.1.3. # # Report bugs to . # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libfontenc' PACKAGE_TARNAME='libfontenc' -PACKAGE_VERSION='1.1.2' -PACKAGE_STRING='libfontenc 1.1.2' +PACKAGE_VERSION='1.1.3' +PACKAGE_STRING='libfontenc 1.1.3' PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg' PACKAGE_URL='' @@ -664,6 +664,8 @@ FILE_MAN_SUFFIX LIB_MAN_SUFFIX APP_MAN_SUFFIX INSTALL_CMD +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH PKG_CONFIG CHANGELOG_CMD STRICT_CFLAGS @@ -805,6 +807,8 @@ LIBS CPPFLAGS CPP PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR FONTENC_CFLAGS FONTENC_LIBS LINT @@ -1349,7 +1353,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libfontenc 1.1.2 to adapt to many kinds of systems. +\`configure' configures libfontenc 1.1.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1419,7 +1423,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libfontenc 1.1.2:";; + short | recursive ) echo "Configuration of libfontenc 1.1.3:";; esac cat <<\_ACEOF @@ -1468,6 +1472,10 @@ Some influential environment variables: you have headers in a nonstandard directory CPP C preprocessor PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path FONTENC_CFLAGS C compiler flags for FONTENC, overriding pkg-config FONTENC_LIBS @@ -1541,7 +1549,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libfontenc configure 1.1.2 +libfontenc configure 1.1.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1956,7 +1964,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libfontenc $as_me 1.1.2, which was +It was created by libfontenc $as_me 1.1.3, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2785,7 +2793,7 @@ fi # Define the identity of the package. PACKAGE='libfontenc' - VERSION='1.1.2' + VERSION='1.1.3' cat >>confdefs.h <<_ACEOF @@ -11609,6 +11617,11 @@ fi + + + + + if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. @@ -11721,7 +11734,6 @@ $as_echo "yes" >&6; } $as_echo "no" >&6; } PKG_CONFIG="" fi - fi @@ -11816,18 +11828,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wall" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wall" >&5 -$as_echo_n "checking if $CC supports-Wall... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wall" >&5 +$as_echo_n "checking if $CC supports -Wall... " >&6; } cacheid=xorg_cv_cc_flag__Wall if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -11934,18 +11946,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wpointer-arith" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wpointer-arith" >&5 -$as_echo_n "checking if $CC supports-Wpointer-arith... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wpointer-arith" >&5 +$as_echo_n "checking if $CC supports -Wpointer-arith... " >&6; } cacheid=xorg_cv_cc_flag__Wpointer_arith if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -12052,18 +12064,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wmissing-declarations" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wmissing-declarations" >&5 -$as_echo_n "checking if $CC supports-Wmissing-declarations... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wmissing-declarations" >&5 +$as_echo_n "checking if $CC supports -Wmissing-declarations... " >&6; } cacheid=xorg_cv_cc_flag__Wmissing_declarations if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -12170,18 +12182,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wformat=2" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wformat=2" >&5 -$as_echo_n "checking if $CC supports-Wformat=2... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wformat=2" >&5 +$as_echo_n "checking if $CC supports -Wformat=2... " >&6; } cacheid=xorg_cv_cc_flag__Wformat_2 if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -12219,18 +12231,18 @@ $as_echo "$supported" >&6; } fi if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wformat" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wformat" >&5 -$as_echo_n "checking if $CC supports-Wformat... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wformat" >&5 +$as_echo_n "checking if $CC supports -Wformat... " >&6; } cacheid=xorg_cv_cc_flag__Wformat if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -12339,18 +12351,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wstrict-prototypes" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wstrict-prototypes" >&5 -$as_echo_n "checking if $CC supports-Wstrict-prototypes... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wstrict-prototypes" >&5 +$as_echo_n "checking if $CC supports -Wstrict-prototypes... " >&6; } cacheid=xorg_cv_cc_flag__Wstrict_prototypes if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -12457,18 +12469,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wmissing-prototypes" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wmissing-prototypes" >&5 -$as_echo_n "checking if $CC supports-Wmissing-prototypes... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wmissing-prototypes" >&5 +$as_echo_n "checking if $CC supports -Wmissing-prototypes... " >&6; } cacheid=xorg_cv_cc_flag__Wmissing_prototypes if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -12575,18 +12587,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wnested-externs" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wnested-externs" >&5 -$as_echo_n "checking if $CC supports-Wnested-externs... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wnested-externs" >&5 +$as_echo_n "checking if $CC supports -Wnested-externs... " >&6; } cacheid=xorg_cv_cc_flag__Wnested_externs if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -12693,18 +12705,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wbad-function-cast" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wbad-function-cast" >&5 -$as_echo_n "checking if $CC supports-Wbad-function-cast... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wbad-function-cast" >&5 +$as_echo_n "checking if $CC supports -Wbad-function-cast... " >&6; } cacheid=xorg_cv_cc_flag__Wbad_function_cast if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -12811,18 +12823,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wold-style-definition" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wold-style-definition" >&5 -$as_echo_n "checking if $CC supports-Wold-style-definition... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wold-style-definition" >&5 +$as_echo_n "checking if $CC supports -Wold-style-definition... " >&6; } cacheid=xorg_cv_cc_flag__Wold_style_definition if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -12859,6 +12871,55 @@ $as_echo "$supported" >&6; } fi fi + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -fd" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -fd" >&5 +$as_echo_n "checking if $CC supports -fd... " >&6; } + cacheid=xorg_cv_cc_flag__fd + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -fd" + found="yes" + fi + fi + @@ -12929,18 +12990,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wdeclaration-after-statement" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wdeclaration-after-statement" >&5 -$as_echo_n "checking if $CC supports-Wdeclaration-after-statement... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wdeclaration-after-statement" >&5 +$as_echo_n "checking if $CC supports -Wdeclaration-after-statement... " >&6; } cacheid=xorg_cv_cc_flag__Wdeclaration_after_statement if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -13051,18 +13112,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wunused" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wunused" >&5 -$as_echo_n "checking if $CC supports-Wunused... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wunused" >&5 +$as_echo_n "checking if $CC supports -Wunused... " >&6; } cacheid=xorg_cv_cc_flag__Wunused if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -13169,18 +13230,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wuninitialized" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wuninitialized" >&5 -$as_echo_n "checking if $CC supports-Wuninitialized... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wuninitialized" >&5 +$as_echo_n "checking if $CC supports -Wuninitialized... " >&6; } cacheid=xorg_cv_cc_flag__Wuninitialized if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -13287,18 +13348,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wshadow" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wshadow" >&5 -$as_echo_n "checking if $CC supports-Wshadow... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wshadow" >&5 +$as_echo_n "checking if $CC supports -Wshadow... " >&6; } cacheid=xorg_cv_cc_flag__Wshadow if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -13405,136 +13466,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then - CFLAGS="$CFLAGS -Werror=unused-command-line-argument" - fi - - CFLAGS="$CFLAGS -Wcast-qual" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wcast-qual" >&5 -$as_echo_n "checking if $CC supports-Wcast-qual... " >&6; } - cacheid=xorg_cv_cc_flag__Wcast_qual - if eval \${$cacheid+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int i; -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval $cacheid=yes -else - eval $cacheid=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi - - - CFLAGS="$xorg_testset_save_CFLAGS" - - eval supported=\$$cacheid - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 -$as_echo "$supported" >&6; } - if test "$supported" = "yes" ; then - BASE_CFLAGS="$BASE_CFLAGS -Wcast-qual" - found="yes" - fi - fi - - - - - - - - - - - - - - - -xorg_testset_save_CFLAGS="$CFLAGS" - -if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then - CFLAGS="$CFLAGS -Werror=unknown-warning-option" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 -$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } -if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int i; -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - xorg_cv_cc_flag_unknown_warning_option=yes -else - xorg_cv_cc_flag_unknown_warning_option=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 -$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } - xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option - CFLAGS="$xorg_testset_save_CFLAGS" -fi - -if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then - if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then - CFLAGS="$CFLAGS -Werror=unknown-warning-option" - fi - CFLAGS="$CFLAGS -Werror=unused-command-line-argument" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 -$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } -if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int i; -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - xorg_cv_cc_flag_unused_command_line_argument=yes -else - xorg_cv_cc_flag_unused_command_line_argument=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 -$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } - xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument - CFLAGS="$xorg_testset_save_CFLAGS" -fi - -found="no" - - if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then - CFLAGS="$CFLAGS -Werror=unknown-warning-option" - fi - - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wmissing-noreturn" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wmissing-noreturn" >&5 -$as_echo_n "checking if $CC supports-Wmissing-noreturn... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wmissing-noreturn" >&5 +$as_echo_n "checking if $CC supports -Wmissing-noreturn... " >&6; } cacheid=xorg_cv_cc_flag__Wmissing_noreturn if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -13641,18 +13584,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wmissing-format-attribute" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wmissing-format-attribute" >&5 -$as_echo_n "checking if $CC supports-Wmissing-format-attribute... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wmissing-format-attribute" >&5 +$as_echo_n "checking if $CC supports -Wmissing-format-attribute... " >&6; } cacheid=xorg_cv_cc_flag__Wmissing_format_attribute if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -13690,13 +13633,132 @@ $as_echo "$supported" >&6; } fi +# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls]) + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wlogical-op" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wlogical-op" >&5 +$as_echo_n "checking if $CC supports -Wlogical-op... " >&6; } + cacheid=xorg_cv_cc_flag__Wlogical_op + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wlogical-op" + found="yes" + fi + fi + + # These are currently disabled because they are noisy. They will be enabled # in the future once the codebase is sufficiently modernized to silence # them. For now, I don't want them to drown out the other warnings. -# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op]) # XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses]) # XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align]) +# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual]) # Turn some warnings into errors, so we don't accidently get successful builds # when there are problems that should be fixed. @@ -13771,18 +13833,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Werror=implicit" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Werror=implicit" >&5 -$as_echo_n "checking if $CC supports-Werror=implicit... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=implicit" >&5 +$as_echo_n "checking if $CC supports -Werror=implicit... " >&6; } cacheid=xorg_cv_cc_flag__Werror_implicit if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -13820,18 +13882,18 @@ $as_echo "$supported" >&6; } fi if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED" >&5 -$as_echo_n "checking if $CC supports-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED" >&5 +$as_echo_n "checking if $CC supports -errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED... " >&6; } cacheid=xorg_cv_cc_flag__errwarn_E_NO_EXPLICIT_TYPE_GIVEN__errwarn_E_NO_IMPLICIT_DECL_ALLOWED if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -13938,18 +14000,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Werror=nonnull" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Werror=nonnull" >&5 -$as_echo_n "checking if $CC supports-Werror=nonnull... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=nonnull" >&5 +$as_echo_n "checking if $CC supports -Werror=nonnull... " >&6; } cacheid=xorg_cv_cc_flag__Werror_nonnull if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -14056,18 +14118,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Werror=init-self" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Werror=init-self" >&5 -$as_echo_n "checking if $CC supports-Werror=init-self... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=init-self" >&5 +$as_echo_n "checking if $CC supports -Werror=init-self... " >&6; } cacheid=xorg_cv_cc_flag__Werror_init_self if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -14174,18 +14236,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Werror=main" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Werror=main" >&5 -$as_echo_n "checking if $CC supports-Werror=main... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=main" >&5 +$as_echo_n "checking if $CC supports -Werror=main... " >&6; } cacheid=xorg_cv_cc_flag__Werror_main if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -14292,18 +14354,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Werror=missing-braces" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Werror=missing-braces" >&5 -$as_echo_n "checking if $CC supports-Werror=missing-braces... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=missing-braces" >&5 +$as_echo_n "checking if $CC supports -Werror=missing-braces... " >&6; } cacheid=xorg_cv_cc_flag__Werror_missing_braces if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -14410,18 +14472,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Werror=sequence-point" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Werror=sequence-point" >&5 -$as_echo_n "checking if $CC supports-Werror=sequence-point... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=sequence-point" >&5 +$as_echo_n "checking if $CC supports -Werror=sequence-point... " >&6; } cacheid=xorg_cv_cc_flag__Werror_sequence_point if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -14528,18 +14590,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Werror=return-type" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Werror=return-type" >&5 -$as_echo_n "checking if $CC supports-Werror=return-type... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=return-type" >&5 +$as_echo_n "checking if $CC supports -Werror=return-type... " >&6; } cacheid=xorg_cv_cc_flag__Werror_return_type if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -14577,18 +14639,18 @@ $as_echo "$supported" >&6; } fi if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -errwarn=E_FUNC_HAS_NO_RETURN_STMT" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-errwarn=E_FUNC_HAS_NO_RETURN_STMT" >&5 -$as_echo_n "checking if $CC supports-errwarn=E_FUNC_HAS_NO_RETURN_STMT... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -errwarn=E_FUNC_HAS_NO_RETURN_STMT" >&5 +$as_echo_n "checking if $CC supports -errwarn=E_FUNC_HAS_NO_RETURN_STMT... " >&6; } cacheid=xorg_cv_cc_flag__errwarn_E_FUNC_HAS_NO_RETURN_STMT if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -14695,18 +14757,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Werror=trigraphs" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Werror=trigraphs" >&5 -$as_echo_n "checking if $CC supports-Werror=trigraphs... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=trigraphs" >&5 +$as_echo_n "checking if $CC supports -Werror=trigraphs... " >&6; } cacheid=xorg_cv_cc_flag__Werror_trigraphs if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -14813,18 +14875,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Werror=array-bounds" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Werror=array-bounds" >&5 -$as_echo_n "checking if $CC supports-Werror=array-bounds... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=array-bounds" >&5 +$as_echo_n "checking if $CC supports -Werror=array-bounds... " >&6; } cacheid=xorg_cv_cc_flag__Werror_array_bounds if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -14931,18 +14993,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Werror=write-strings" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Werror=write-strings" >&5 -$as_echo_n "checking if $CC supports-Werror=write-strings... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=write-strings" >&5 +$as_echo_n "checking if $CC supports -Werror=write-strings... " >&6; } cacheid=xorg_cv_cc_flag__Werror_write_strings if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -15049,18 +15111,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Werror=address" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Werror=address" >&5 -$as_echo_n "checking if $CC supports-Werror=address... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=address" >&5 +$as_echo_n "checking if $CC supports -Werror=address... " >&6; } cacheid=xorg_cv_cc_flag__Werror_address if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -15167,18 +15229,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Werror=int-to-pointer-cast" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Werror=int-to-pointer-cast" >&5 -$as_echo_n "checking if $CC supports-Werror=int-to-pointer-cast... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=int-to-pointer-cast" >&5 +$as_echo_n "checking if $CC supports -Werror=int-to-pointer-cast... " >&6; } cacheid=xorg_cv_cc_flag__Werror_int_to_pointer_cast if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -15216,18 +15278,18 @@ $as_echo "$supported" >&6; } fi if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -errwarn=E_BAD_PTR_INT_COMBINATION" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-errwarn=E_BAD_PTR_INT_COMBINATION" >&5 -$as_echo_n "checking if $CC supports-errwarn=E_BAD_PTR_INT_COMBINATION... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -errwarn=E_BAD_PTR_INT_COMBINATION" >&5 +$as_echo_n "checking if $CC supports -errwarn=E_BAD_PTR_INT_COMBINATION... " >&6; } cacheid=xorg_cv_cc_flag__errwarn_E_BAD_PTR_INT_COMBINATION if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -15334,18 +15396,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Werror=pointer-to-int-cast" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Werror=pointer-to-int-cast" >&5 -$as_echo_n "checking if $CC supports-Werror=pointer-to-int-cast... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=pointer-to-int-cast" >&5 +$as_echo_n "checking if $CC supports -Werror=pointer-to-int-cast... " >&6; } cacheid=xorg_cv_cc_flag__Werror_pointer_to_int_cast if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -15455,18 +15517,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wimplicit" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wimplicit" >&5 -$as_echo_n "checking if $CC supports-Wimplicit... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wimplicit" >&5 +$as_echo_n "checking if $CC supports -Wimplicit... " >&6; } cacheid=xorg_cv_cc_flag__Wimplicit if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -15573,18 +15635,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wnonnull" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wnonnull" >&5 -$as_echo_n "checking if $CC supports-Wnonnull... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wnonnull" >&5 +$as_echo_n "checking if $CC supports -Wnonnull... " >&6; } cacheid=xorg_cv_cc_flag__Wnonnull if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -15691,18 +15753,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Winit-self" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Winit-self" >&5 -$as_echo_n "checking if $CC supports-Winit-self... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Winit-self" >&5 +$as_echo_n "checking if $CC supports -Winit-self... " >&6; } cacheid=xorg_cv_cc_flag__Winit_self if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -15809,18 +15871,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wmain" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wmain" >&5 -$as_echo_n "checking if $CC supports-Wmain... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wmain" >&5 +$as_echo_n "checking if $CC supports -Wmain... " >&6; } cacheid=xorg_cv_cc_flag__Wmain if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -15927,18 +15989,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wmissing-braces" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wmissing-braces" >&5 -$as_echo_n "checking if $CC supports-Wmissing-braces... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wmissing-braces" >&5 +$as_echo_n "checking if $CC supports -Wmissing-braces... " >&6; } cacheid=xorg_cv_cc_flag__Wmissing_braces if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -16045,18 +16107,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wsequence-point" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wsequence-point" >&5 -$as_echo_n "checking if $CC supports-Wsequence-point... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wsequence-point" >&5 +$as_echo_n "checking if $CC supports -Wsequence-point... " >&6; } cacheid=xorg_cv_cc_flag__Wsequence_point if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -16163,18 +16225,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wreturn-type" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wreturn-type" >&5 -$as_echo_n "checking if $CC supports-Wreturn-type... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wreturn-type" >&5 +$as_echo_n "checking if $CC supports -Wreturn-type... " >&6; } cacheid=xorg_cv_cc_flag__Wreturn_type if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -16281,18 +16343,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wtrigraphs" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wtrigraphs" >&5 -$as_echo_n "checking if $CC supports-Wtrigraphs... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wtrigraphs" >&5 +$as_echo_n "checking if $CC supports -Wtrigraphs... " >&6; } cacheid=xorg_cv_cc_flag__Wtrigraphs if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -16399,18 +16461,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Warray-bounds" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Warray-bounds" >&5 -$as_echo_n "checking if $CC supports-Warray-bounds... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Warray-bounds" >&5 +$as_echo_n "checking if $CC supports -Warray-bounds... " >&6; } cacheid=xorg_cv_cc_flag__Warray_bounds if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -16517,18 +16579,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wwrite-strings" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wwrite-strings" >&5 -$as_echo_n "checking if $CC supports-Wwrite-strings... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wwrite-strings" >&5 +$as_echo_n "checking if $CC supports -Wwrite-strings... " >&6; } cacheid=xorg_cv_cc_flag__Wwrite_strings if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -16635,18 +16697,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Waddress" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Waddress" >&5 -$as_echo_n "checking if $CC supports-Waddress... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Waddress" >&5 +$as_echo_n "checking if $CC supports -Waddress... " >&6; } cacheid=xorg_cv_cc_flag__Waddress if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -16753,18 +16815,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wint-to-pointer-cast" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wint-to-pointer-cast" >&5 -$as_echo_n "checking if $CC supports-Wint-to-pointer-cast... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wint-to-pointer-cast" >&5 +$as_echo_n "checking if $CC supports -Wint-to-pointer-cast... " >&6; } cacheid=xorg_cv_cc_flag__Wint_to_pointer_cast if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -16871,18 +16933,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Wpointer-to-int-cast" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Wpointer-to-int-cast" >&5 -$as_echo_n "checking if $CC supports-Wpointer-to-int-cast... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wpointer-to-int-cast" >&5 +$as_echo_n "checking if $CC supports -Wpointer-to-int-cast... " >&6; } cacheid=xorg_cv_cc_flag__Wpointer_to_int_cast if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -17022,18 +17084,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -pedantic" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-pedantic" >&5 -$as_echo_n "checking if $CC supports-pedantic... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -pedantic" >&5 +$as_echo_n "checking if $CC supports -pedantic... " >&6; } cacheid=xorg_cv_cc_flag__pedantic if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -17140,18 +17202,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Werror" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Werror" >&5 -$as_echo_n "checking if $CC supports-Werror... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror" >&5 +$as_echo_n "checking if $CC supports -Werror... " >&6; } cacheid=xorg_cv_cc_flag__Werror if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -17189,18 +17251,18 @@ $as_echo "$supported" >&6; } fi if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -errwarn" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-errwarn" >&5 -$as_echo_n "checking if $CC supports-errwarn... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -errwarn" >&5 +$as_echo_n "checking if $CC supports -errwarn... " >&6; } cacheid=xorg_cv_cc_flag__errwarn if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -17310,18 +17372,18 @@ fi found="no" if test $found = "no" ; then - if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unknown-warning-option" fi - if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then CFLAGS="$CFLAGS -Werror=unused-command-line-argument" fi CFLAGS="$CFLAGS -Werror=attributes" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports-Werror=attributes" >&5 -$as_echo_n "checking if $CC supports-Werror=attributes... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=attributes" >&5 +$as_echo_n "checking if $CC supports -Werror=attributes... " >&6; } cacheid=xorg_cv_cc_flag__Werror_attributes if eval \${$cacheid+:} false; then : $as_echo_n "(cached) " >&6 @@ -17662,46 +17724,46 @@ pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FONTENC" >&5 $as_echo_n "checking for FONTENC... " >&6; } -if test -n "$PKG_CONFIG"; then - if test -n "$FONTENC_CFLAGS"; then - pkg_cv_FONTENC_CFLAGS="$FONTENC_CFLAGS" - else - if test -n "$PKG_CONFIG" && \ +if test -n "$FONTENC_CFLAGS"; then + pkg_cv_FONTENC_CFLAGS="$FONTENC_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xproto\""; } >&5 ($PKG_CONFIG --exists --print-errors "xproto") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_FONTENC_CFLAGS=`$PKG_CONFIG --cflags "xproto" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi - fi -else - pkg_failed=untried + else + pkg_failed=untried fi -if test -n "$PKG_CONFIG"; then - if test -n "$FONTENC_LIBS"; then - pkg_cv_FONTENC_LIBS="$FONTENC_LIBS" - else - if test -n "$PKG_CONFIG" && \ +if test -n "$FONTENC_LIBS"; then + pkg_cv_FONTENC_LIBS="$FONTENC_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xproto\""; } >&5 ($PKG_CONFIG --exists --print-errors "xproto") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_FONTENC_LIBS=`$PKG_CONFIG --libs "xproto" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi - fi -else - pkg_failed=untried + else + pkg_failed=untried fi if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -17709,9 +17771,9 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - FONTENC_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "xproto"` + FONTENC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "xproto" 2>&1` else - FONTENC_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "xproto"` + FONTENC_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "xproto" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$FONTENC_PKG_ERRORS" >&5 @@ -17725,9 +17787,10 @@ installed software in a non-standard prefix. Alternatively, you may set the environment variables FONTENC_CFLAGS and FONTENC_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. -" "$LINENO" 5 +See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it @@ -17738,14 +17801,14 @@ Alternatively, you may set the environment variables FONTENC_CFLAGS and FONTENC_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. -To get pkg-config, see . +To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else FONTENC_CFLAGS=$pkg_cv_FONTENC_CFLAGS FONTENC_LIBS=$pkg_cv_FONTENC_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - : + fi # Allow checking code with lint, sparse, etc. @@ -18388,7 +18451,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libfontenc $as_me 1.1.2, which was +This file was extended by libfontenc $as_me 1.1.3, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18454,7 +18517,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libfontenc config.status 1.1.2 +libfontenc config.status 1.1.3 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/lib/libfontenc/configure.ac b/lib/libfontenc/configure.ac index 62a959304..c2a23b758 100644 --- a/lib/libfontenc/configure.ac +++ b/lib/libfontenc/configure.ac @@ -21,7 +21,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT([libfontenc], [1.1.2], +AC_INIT([libfontenc], [1.1.3], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libfontenc]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) diff --git a/lib/libfontenc/include/X11/fonts/fontenc.h b/lib/libfontenc/include/X11/fonts/fontenc.h index 656cfaae7..709f97fca 100644 --- a/lib/libfontenc/include/X11/fonts/fontenc.h +++ b/lib/libfontenc/include/X11/fonts/fontenc.h @@ -49,8 +49,8 @@ THE SOFTWARE. typedef struct _FontMap { int type; /* the type of the mapping */ int pid, eid; /* the identification of the mapping */ - unsigned (*recode)(unsigned, void*); /* mapping function */ - char *(*name)(unsigned, void*); /* function returning glyph names */ + unsigned (*recode) (unsigned, void *); /* mapping function */ + char *(*name) (unsigned, void *); /* function returning glyph names */ void *client_data; /* second parameter of the two above */ struct _FontMap *next; /* link to next element in list */ /* The following was added for version 0.3 of the font interface. */ @@ -76,8 +76,8 @@ typedef struct _FontEnc { } FontEncRec, *FontEncPtr; typedef struct _FontMapReverse { - unsigned int (*reverse)(unsigned, void*); - void *data; + unsigned int (*reverse) (unsigned, void *); + void *data; } FontMapReverseRec, *FontMapReversePtr; @@ -85,12 +85,12 @@ typedef struct _FontMapReverse { /* extract an encoding name from an XLFD name. Returns a pointer to a *static* buffer, or NULL */ -char *FontEncFromXLFD(const char*, int); +char *FontEncFromXLFD(const char *, int); /* find the encoding data for a given encoding name; second parameter is the filename of the font for which the encoding is needed. Returns NULL on failure. */ -FontEncPtr FontEncFind(const char*, const char*); +FontEncPtr FontEncFind(const char *, const char *); /* Find a given mapping for an encoding. This is only a convenience function, as clients are allowed to scavenge the data structures @@ -109,7 +109,7 @@ char *FontEncName(unsigned, FontMapPtr); /* Return a pointer to the name of the system encodings directory. */ /* This string is static and should not be modified. */ -char* FontEncDirectory(void); +char *FontEncDirectory(void); /* Identify an encoding file. If fileName doesn't exist, or is not an encoding file, return NULL, otherwise returns a NULL-terminated diff --git a/lib/libfontenc/src/Makefile.in b/lib/libfontenc/src/Makefile.in index 21a175457..4f45d1928 100644 --- a/lib/libfontenc/src/Makefile.in +++ b/lib/libfontenc/src/Makefile.in @@ -227,6 +227,8 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ diff --git a/lib/libfontenc/src/encparse.c b/lib/libfontenc/src/encparse.c index ee18b3f96..f47454a3e 100644 --- a/lib/libfontenc/src/encparse.c +++ b/lib/libfontenc/src/encparse.c @@ -35,6 +35,7 @@ THE SOFTWARE. #include "zlib.h" typedef gzFile FontFilePtr; + #define FontFileGetc(f) gzgetc(f) #define FontFileOpen(filename) gzopen(filename, "rb") #define FontFileClose(f) gzclose(f) @@ -70,7 +71,7 @@ typedef gzFile FontFilePtr; #define MAXKEYWORDLEN 100 static long number_value; -static char keyword_value[MAXKEYWORDLEN+1]; +static char keyword_value[MAXKEYWORDLEN + 1]; static long value1, value2, value3; @@ -80,11 +81,11 @@ static long value1, value2, value3; static void skipEndOfLine(FontFilePtr f, int c) { - if(c == 0) + if (c == 0) c = FontFileGetc(f); - for(;;) - if(c <= 0 || c == '\n') + for (;;) + if (c <= 0 || c == '\n') return; else c = FontFileGetc(f); @@ -98,47 +99,54 @@ getnum(FontFilePtr f, int c, int *cp) int base = 10; /* look for `0' or `0x' prefix */ - if(c == '0') { + if (c == '0') { c = FontFileGetc(f); base = 8; - if(c == 'x' || c == 'X') { + if (c == 'x' || c == 'X') { base = 16; c = FontFileGetc(f); } } /* accumulate digits */ - for(;;) { + for (;;) { if ('0' <= c && c <= '9') { - n *= base; n += c - '0'; - } else if('a' <= c && c <= 'f') { - n *= base; n += c - 'a' + 10; - } else if('A' <=c && c <= 'F') { - n *= base; n += c - 'A' + 10; - } else + n *= base; + n += c - '0'; + } + else if ('a' <= c && c <= 'f') { + n *= base; + n += c - 'a' + 10; + } + else if ('A' <= c && c <= 'F') { + n *= base; + n += c - 'A' + 10; + } + else break; c = FontFileGetc(f); } - *cp = c; return n; + *cp = c; + return n; } /* Skip to beginning of new line; return 1 if only whitespace was found. */ static int endOfLine(FontFilePtr f, int c) { - if(c == 0) + if (c == 0) c = FontFileGetc(f); - for(;;) { - if(c <= 0 || c == '\n') + for (;;) { + if (c <= 0 || c == '\n') return 1; - else if(c == '#') { - skipEndOfLine(f,c); + else if (c == '#') { + skipEndOfLine(f, c); return 1; } - else if(c == ' ' || c == '\t') { - skipEndOfLine(f,c); + else if (c == ' ' || c == '\t') { + skipEndOfLine(f, c); return 0; } c = FontFileGetc(f); @@ -151,39 +159,43 @@ gettoken(FontFilePtr f, int c, int *cp) { char *p; - if(c <= 0) - c = FontFileGetc(f); + if (c <= 0) + c = FontFileGetc(f); - if(c <= 0) { + if (c <= 0) { return EOF_TOKEN; } - while(c == ' ' || c == '\t') + while (c == ' ' || c == '\t') c = FontFileGetc(f); - if(c=='\n') { + if (c == '\n') { return EOL_TOKEN; - } else if(c == '#') { - skipEndOfLine(f,c); + } + else if (c == '#') { + skipEndOfLine(f, c); return EOL_TOKEN; - } else if(c >= '0' && c <= '9') { - number_value = getnum(f,c,cp); + } + else if (c >= '0' && c <= '9') { + number_value = getnum(f, c, cp); return NUMBER_TOKEN; - } else if((c >= 'A' && c <= 'Z') || - (c >= 'a' && c <= 'z') || - c == '/' || c == '_' || c == '-' || c == '.') { + } + else if ((c >= 'A' && c <= 'Z') || + (c >= 'a' && c <= 'z') || + c == '/' || c == '_' || c == '-' || c == '.') { p = keyword_value; *p++ = c; - while(p-keyword_value < MAXKEYWORDLEN) { + while (p - keyword_value < MAXKEYWORDLEN) { c = FontFileGetc(f); - if(c <= ' ' || c > '~' || c == '#') + if (c <= ' ' || c > '~' || c == '#') break; *p++ = c; } *cp = c; *p = '\0'; return KEYWORD_TOKEN; - } else { + } + else { *cp = c; return ERROR_TOKEN; } @@ -195,14 +207,15 @@ static int getnextline(FontFilePtr f) { int c, token; + c = FontFileGetc(f); - if(c <= 0) + if (c <= 0) return EOF_LINE; - again: - token=gettoken(f,c,&c); + again: + token = gettoken(f, c, &c); - switch(token) { + switch (token) { case EOF_TOKEN: return EOF_LINE; case EOL_TOKEN: @@ -211,79 +224,85 @@ getnextline(FontFilePtr f) goto again; case NUMBER_TOKEN: value1 = number_value; - token = gettoken(f,c,&c); - switch(token) { + token = gettoken(f, c, &c); + switch (token) { case NUMBER_TOKEN: value2 = number_value; - token = gettoken(f,c,&c); - switch(token) { + token = gettoken(f, c, &c); + switch (token) { case NUMBER_TOKEN: value3 = number_value; return CODE_RANGE_LINE; case EOL_TOKEN: return CODE_LINE; default: - skipEndOfLine(f,c); + skipEndOfLine(f, c); return ERROR_LINE; } case KEYWORD_TOKEN: - if(!endOfLine(f,c)) + if (!endOfLine(f, c)) return ERROR_LINE; else return NAME_LINE; default: - skipEndOfLine(f,c); + skipEndOfLine(f, c); return ERROR_LINE; } case KEYWORD_TOKEN: - if(!strcasecmp(keyword_value, "STARTENCODING")) { - token = gettoken(f,c,&c); - if(token == KEYWORD_TOKEN) { - if(endOfLine(f,c)) + if (!strcasecmp(keyword_value, "STARTENCODING")) { + token = gettoken(f, c, &c); + if (token == KEYWORD_TOKEN) { + if (endOfLine(f, c)) return STARTENCODING_LINE; else return ERROR_LINE; - } else { - skipEndOfLine(f,c); + } + else { + skipEndOfLine(f, c); return ERROR_LINE; } - } else if(!strcasecmp(keyword_value, "ALIAS")) { - token = gettoken(f,c,&c); - if(token == KEYWORD_TOKEN) { - if(endOfLine(f,c)) + } + else if (!strcasecmp(keyword_value, "ALIAS")) { + token = gettoken(f, c, &c); + if (token == KEYWORD_TOKEN) { + if (endOfLine(f, c)) return ALIAS_LINE; else return ERROR_LINE; - } else { - skipEndOfLine(f,c); + } + else { + skipEndOfLine(f, c); return ERROR_LINE; } - } else if(!strcasecmp(keyword_value, "SIZE")) { - token = gettoken(f,c,&c); - if(token == NUMBER_TOKEN) { + } + else if (!strcasecmp(keyword_value, "SIZE")) { + token = gettoken(f, c, &c); + if (token == NUMBER_TOKEN) { value1 = number_value; - token = gettoken(f,c,&c); - switch(token) { + token = gettoken(f, c, &c); + switch (token) { case NUMBER_TOKEN: value2 = number_value; return SIZE_LINE; case EOL_TOKEN: - value2=0; + value2 = 0; return SIZE_LINE; default: - skipEndOfLine(f,c); + skipEndOfLine(f, c); return ERROR_LINE; } - } else { - skipEndOfLine(f,c); + } + else { + skipEndOfLine(f, c); return ERROR_LINE; } - } else if(!strcasecmp(keyword_value, "FIRSTINDEX")) { - token = gettoken(f,c,&c); - if(token == NUMBER_TOKEN) { + } + else if (!strcasecmp(keyword_value, "FIRSTINDEX")) { + token = gettoken(f, c, &c); + if (token == NUMBER_TOKEN) { value1 = number_value; - token = gettoken(f,c,&c); - switch(token) { + token = gettoken(f, c, &c); + switch (token) { case NUMBER_TOKEN: value2 = number_value; return FIRSTINDEX_LINE; @@ -291,85 +310,99 @@ getnextline(FontFilePtr f) value2 = 0; return FIRSTINDEX_LINE; default: - skipEndOfLine(f,c); + skipEndOfLine(f, c); return ERROR_LINE; } - } else { - skipEndOfLine(f,c); + } + else { + skipEndOfLine(f, c); return ERROR_LINE; } - } else if(!strcasecmp(keyword_value, "STARTMAPPING")) { + } + else if (!strcasecmp(keyword_value, "STARTMAPPING")) { keyword_value[0] = 0; - value1 = 0; value1 = 0; + value1 = 0; + value2 = 0; /* first a keyword */ - token = gettoken(f,c,&c); - if(token != KEYWORD_TOKEN) { + token = gettoken(f, c, &c); + if (token != KEYWORD_TOKEN) { skipEndOfLine(f, c); return ERROR_LINE; } /* optional first integer */ - token = gettoken(f,c,&c); - if(token == NUMBER_TOKEN) { + token = gettoken(f, c, &c); + if (token == NUMBER_TOKEN) { value1 = number_value; - } else if(token == EOL_TOKEN) { + } + else if (token == EOL_TOKEN) { return STARTMAPPING_LINE; - } else { + } + else { skipEndOfLine(f, c); return ERROR_LINE; } /* optional second integer */ - token = gettoken(f,c,&c); - if(token == NUMBER_TOKEN) { + token = gettoken(f, c, &c); + if (token == NUMBER_TOKEN) { value2 = number_value; - } else if(token == EOL_TOKEN) { + } + else if (token == EOL_TOKEN) { return STARTMAPPING_LINE; - } else { + } + else { skipEndOfLine(f, c); return ERROR_LINE; } - if(!endOfLine(f,c)) + if (!endOfLine(f, c)) return ERROR_LINE; else { return STARTMAPPING_LINE; } - } else if(!strcasecmp(keyword_value, "UNDEFINE")) { + } + else if (!strcasecmp(keyword_value, "UNDEFINE")) { /* first integer */ - token = gettoken(f,c,&c); - if(token != NUMBER_TOKEN) { - skipEndOfLine(f,c); + token = gettoken(f, c, &c); + if (token != NUMBER_TOKEN) { + skipEndOfLine(f, c); return ERROR_LINE; } value1 = number_value; /* optional second integer */ - token = gettoken(f,c,&c); - if(token == EOL_TOKEN) { + token = gettoken(f, c, &c); + if (token == EOL_TOKEN) { value2 = value1; return CODE_UNDEFINE_LINE; - } else if(token == NUMBER_TOKEN) { + } + else if (token == NUMBER_TOKEN) { value2 = number_value; - if(endOfLine(f,c)) { + if (endOfLine(f, c)) { return CODE_UNDEFINE_LINE; - } else + } + else return ERROR_LINE; - } else { - skipEndOfLine(f,c); + } + else { + skipEndOfLine(f, c); return ERROR_LINE; } - } else if(!strcasecmp(keyword_value, "ENDENCODING")) { - if(endOfLine(f,c)) + } + else if (!strcasecmp(keyword_value, "ENDENCODING")) { + if (endOfLine(f, c)) return EOF_LINE; else return ERROR_LINE; - } else if(!strcasecmp(keyword_value, "ENDMAPPING")) { - if(endOfLine(f,c)) + } + else if (!strcasecmp(keyword_value, "ENDMAPPING")) { + if (endOfLine(f, c)) return ENDMAPPING_LINE; else return ERROR_LINE; - } else { - skipEndOfLine(f,c); + } + else { + skipEndOfLine(f, c); return ERROR_LINE; } default: @@ -382,11 +415,11 @@ install_mapping(FontEncPtr encoding, FontMapPtr mapping) { FontMapPtr m; - if(encoding->mappings == NULL) + if (encoding->mappings == NULL) encoding->mappings = mapping; else { m = encoding->mappings; - while(m->next != NULL) + while (m->next != NULL) m = m->next; m->next = mapping; } @@ -400,46 +433,49 @@ setCode(unsigned from, unsigned to, unsigned row_size, unsigned *encsize, unsigned short **enc) { unsigned index, i; + unsigned short *newenc; - if(from>0xFFFF) + if (from > 0xFFFF) return 0; /* success */ - if(row_size==0) - index=from; + if (row_size == 0) + index = from; else { - if((value1 & 0xFF) >= row_size) + if ((value1 & 0xFF) >= row_size) return 0; /* ignore out of range mappings */ - index = (from>>8) * row_size + (from&0xFF); + index = (from >> 8) * row_size + (from & 0xFF); } /* Optimize away useless identity mappings. This is only expected to be useful with linear encodings. */ - if(index == to && (index < *first || index > *last)) + if (index == to && (index < *first || index > *last)) return 0; - if(*encsize == 0) { + if (*encsize == 0) { *encsize = (index < 256) ? 256 : 0x10000; *enc = malloc((*encsize) * sizeof(unsigned short)); - if(*enc == NULL) { + if (*enc == NULL) { *encsize = 0; return 1; } - } else if(*encsize <= index) { + } + else if (*encsize <= index) { *encsize = 0x10000; - if((newenc = realloc(*enc, (*encsize) * sizeof(unsigned short)))==NULL) + if ((newenc = + realloc(*enc, (*encsize) * sizeof(unsigned short))) == NULL) return 1; *enc = newenc; } - if(*first > *last) { + if (*first > *last) { *first = *last = index; } - if(index < *first) { - for(i = index; i < *first; i++) + if (index < *first) { + for (i = index; i < *first; i++) (*enc)[i] = i; *first = index; } - if(index > *last) { - for(i = *last + 1; i <= index; i++) + if (index > *last) { + for (i = *last + 1; i <= index; i++) (*enc)[i] = i; *last = index; } @@ -462,50 +498,51 @@ parseEncodingFile(FontFilePtr f, int headerOnly) { int line; - unsigned short *enc=NULL; + unsigned short *enc = NULL; char **nam = NULL, **newnam; - unsigned i, first = 0xFFFF, last=0, encsize=0, namsize=0; + unsigned i, first = 0xFFFF, last = 0, encsize = 0, namsize = 0; FontEncPtr encoding = NULL; FontMapPtr mapping = NULL; FontEncSimpleMapPtr sm; FontEncSimpleNamePtr sn; - char *aliases[MAXALIASES]; - int numaliases=0; + char *aliases[MAXALIASES] = { NULL }; + int numaliases = 0; #if 0 /* GCC complains about unused labels. Please fix GCC rather than obfuscating my code. */ - no_encoding: + no_encoding: #endif line = getnextline(f); - switch(line) { + switch (line) { case EOF_LINE: goto error; case STARTENCODING_LINE: encoding = malloc(sizeof(FontEncRec)); - if(encoding == NULL) + if (encoding == NULL) goto error; encoding->name = strdup(keyword_value); - if(encoding->name == NULL) + if (encoding->name == NULL) goto error; encoding->size = 256; encoding->row_size = 0; encoding->mappings = NULL; encoding->next = NULL; - encoding->first = encoding->first_col=0; + encoding->first = encoding->first_col = 0; goto no_mapping; default: goto error; } - no_mapping: + no_mapping: line = getnextline(f); - switch(line) { - case EOF_LINE: goto done; + switch (line) { + case EOF_LINE: + goto done; case ALIAS_LINE: - if(numaliases < MAXALIASES) { + if (numaliases < MAXALIASES) { aliases[numaliases] = strdup(keyword_value); - if(aliases[numaliases] == NULL) + if (aliases[numaliases] == NULL) goto error; numaliases++; } @@ -519,11 +556,11 @@ parseEncodingFile(FontFilePtr f, int headerOnly) encoding->first_col = value2; goto no_mapping; case STARTMAPPING_LINE: - if(headerOnly) + if (headerOnly) goto done; - if(!strcasecmp(keyword_value, "unicode")) { + if (!strcasecmp(keyword_value, "unicode")) { mapping = malloc(sizeof(FontMapRec)); - if(mapping == NULL) + if (mapping == NULL) goto error; mapping->type = FONT_ENCODING_UNICODE; mapping->pid = 0; @@ -533,9 +570,10 @@ parseEncodingFile(FontFilePtr f, int headerOnly) mapping->client_data = NULL; mapping->next = NULL; goto mapping; - } else if(!strcasecmp(keyword_value, "cmap")) { + } + else if (!strcasecmp(keyword_value, "cmap")) { mapping = malloc(sizeof(FontMapRec)); - if(mapping == NULL) + if (mapping == NULL) goto error; mapping->type = FONT_ENCODING_TRUETYPE; mapping->pid = value1; @@ -545,9 +583,10 @@ parseEncodingFile(FontFilePtr f, int headerOnly) mapping->client_data = NULL; mapping->next = NULL; goto mapping; - } else if(!strcasecmp(keyword_value, "postscript")) { + } + else if (!strcasecmp(keyword_value, "postscript")) { mapping = malloc(sizeof(FontMapRec)); - if(mapping == NULL) + if (mapping == NULL) goto error; mapping->type = FONT_ENCODING_POSTSCRIPT; mapping->pid = 0; @@ -557,17 +596,19 @@ parseEncodingFile(FontFilePtr f, int headerOnly) mapping->client_data = NULL; mapping->next = NULL; goto string_mapping; - } else { /* unknown mapping type -- ignore */ + } + else { /* unknown mapping type -- ignore */ goto skipmapping; } /* NOTREACHED */ goto error; - default: goto no_mapping; /* ignore unknown lines */ + default: + goto no_mapping; /* ignore unknown lines */ } - skipmapping: + skipmapping: line = getnextline(f); - switch(line) { + switch (line) { case ENDMAPPING_LINE: goto no_mapping; case EOF_LINE: @@ -576,207 +617,230 @@ parseEncodingFile(FontFilePtr f, int headerOnly) goto skipmapping; } - mapping: + mapping: line = getnextline(f); - switch(line) { - case EOF_LINE: goto error; + switch (line) { + case EOF_LINE: + goto error; case ENDMAPPING_LINE: mapping->recode = FontEncSimpleRecode; mapping->name = FontEncUndefinedName; mapping->client_data = sm = malloc(sizeof(FontEncSimpleMapRec)); - if(sm == NULL) + if (sm == NULL) goto error; sm->row_size = encoding->row_size; - if(first <= last) { + if (first <= last) { unsigned short *newmap; sm->first = first; - sm->len=last-first+1; + sm->len = last - first + 1; newmap = malloc(sm->len * sizeof(unsigned short)); - if(newmap == NULL) { + if (newmap == NULL) { free(sm); mapping->client_data = sm = NULL; goto error; } - for(i=0; i < sm->len; i++) - newmap[i] = enc[first+i]; - sm->map = newmap; - } else { + for (i = 0; i < sm->len; i++) + newmap[i] = enc[first + i]; + sm->map = newmap; + } + else { sm->first = 0; sm->len = 0; sm->map = NULL; } install_mapping(encoding, mapping); mapping = NULL; - first = 0xFFFF; last=0; + first = 0xFFFF; + last = 0; goto no_mapping; case CODE_LINE: - if(setCode(value1, value2, encoding->row_size, - &first, &last, &encsize, &enc)) + if (setCode(value1, value2, encoding->row_size, + &first, &last, &encsize, &enc)) goto error; goto mapping; case CODE_RANGE_LINE: - if(value1 > 0x10000) + if (value1 > 0x10000) value1 = 0x10000; - if(value2 > 0x10000) + if (value2 > 0x10000) value2 = 0x10000; - if(value2 < value1) + if (value2 < value1) goto mapping; /* Do the last value first to avoid having to realloc() */ - if(setCode(value2, value3+(value2-value1), encoding->row_size, - &first, &last, &encsize, &enc)) + if (setCode(value2, value3 + (value2 - value1), encoding->row_size, + &first, &last, &encsize, &enc)) goto error; - for(i=value1; irow_size, - &first, &last, &encsize, &enc)) + for (i = value1; i < value2; i++) { + if (setCode(i, value3 + (i - value1), encoding->row_size, + &first, &last, &encsize, &enc)) goto error; } goto mapping; case CODE_UNDEFINE_LINE: - if(value1 > 0x10000) + if (value1 > 0x10000) value1 = 0x10000; - if(value2 > 0x10000) + if (value2 > 0x10000) value2 = 0x10000; - if(value2 < value1) + if (value2 < value1) goto mapping; /* Do the last value first to avoid having to realloc() */ - if(setCode(value2, 0, encoding->row_size, - &first, &last, &encsize, &enc)) + if (setCode(value2, 0, encoding->row_size, + &first, &last, &encsize, &enc)) goto error; - for(i = value1; i < value2; i++) { - if(setCode(i, 0, encoding->row_size, - &first, &last, &encsize, &enc)) + for (i = value1; i < value2; i++) { + if (setCode(i, 0, encoding->row_size, + &first, &last, &encsize, &enc)) goto error; } goto mapping; - default: goto mapping; /* ignore unknown lines */ + default: + goto mapping; /* ignore unknown lines */ } - string_mapping: + string_mapping: line = getnextline(f); - switch(line) { - case EOF_LINE: goto error; + switch (line) { + case EOF_LINE: + goto error; case ENDMAPPING_LINE: mapping->recode = FontEncUndefinedRecode; mapping->name = FontEncSimpleName; mapping->client_data = sn = malloc(sizeof(FontEncSimpleNameRec)); - if(sn == NULL) + if (sn == NULL) goto error; - if(first > last) { + if (first > last) { free(sn); mapping->client_data = sn = NULL; goto error; } sn->first = first; sn->len = last - first + 1; - sn->map = malloc(sn->len*sizeof(char*)); - if(sn->map == NULL) { + sn->map = malloc(sn->len * sizeof(char *)); + if (sn->map == NULL) { free(sn); mapping->client_data = sn = NULL; goto error; } - for(i = 0; i < sn->len; i++) - sn->map[i] = nam[first+i]; - install_mapping(encoding,mapping); + for (i = 0; i < sn->len; i++) + sn->map[i] = nam[first + i]; + install_mapping(encoding, mapping); mapping = NULL; - first = 0xFFFF; last=0; + first = 0xFFFF; + last = 0; goto no_mapping; case NAME_LINE: - if(value1 >= 0x10000) goto string_mapping; - if(namsize == 0) { + if (value1 >= 0x10000) + goto string_mapping; + if (namsize == 0) { namsize = (value1) < 256 ? 256 : 0x10000; - nam = malloc(namsize * sizeof(char*)); - if(nam == NULL) { - namsize=0; + nam = malloc(namsize * sizeof(char *)); + if (nam == NULL) { + namsize = 0; goto error; } - } else if(namsize <= value1) { + } + else if (namsize <= value1) { namsize = 0x10000; - if((newnam = (char**)realloc(nam, namsize)) == NULL) + if ((newnam = (char **) realloc(nam, namsize)) == NULL) goto error; nam = newnam; } - if(first > last) { + if (first > last) { first = last = value1; } - if(value1 < first) { - for(i = value1; i < first; i++) + if (value1 < first) { + for (i = value1; i < first; i++) nam[i] = NULL; first = value1; } - if(value1 > last) { - for(i=last+1; i <= value1; i++) - nam[i]=NULL; + if (value1 > last) { + for (i = last + 1; i <= value1; i++) + nam[i] = NULL; last = value1; } nam[value1] = strdup(keyword_value); - if(nam[value1] == NULL) { + if (nam[value1] == NULL) { goto error; } goto string_mapping; - default: goto string_mapping; /* ignore unknown lines */ + default: + goto string_mapping; /* ignore unknown lines */ } - done: - if(encsize) free(enc); encsize=0; enc = NULL; - if(namsize) free(nam); namsize=0; nam = NULL; /* don't free entries! */ + done: + if (encsize) { + free(enc); + encsize = 0; + enc = NULL; + } + if (namsize) { + free(nam); /* don't free entries! */ + namsize = 0; + nam = NULL; + } - encoding->aliases=NULL; - if(numaliases) { - encoding->aliases = malloc((numaliases+1)*sizeof(char*)); - if(encoding->aliases == NULL) + encoding->aliases = NULL; + if (numaliases) { + encoding->aliases = malloc((numaliases + 1) * sizeof(char *)); + if (encoding->aliases == NULL) goto error; - for(i=0; ialiases[i] = aliases[i]; - encoding->aliases[numaliases]=NULL; + encoding->aliases[numaliases] = NULL; } return encoding; -error: - if(encsize) free(enc); encsize=0; - if(namsize) { - for(i = first; i <= last; i++) + error: + if (encsize) { + free(enc); + encsize = 0; + } + if (namsize) { + for (i = first; i <= last; i++) free(nam[i]); free(nam); } - if(mapping) { + if (mapping) { free(mapping->client_data); free(mapping); } - if(encoding) { - FontMapPtr nextmap; - free(encoding->name); - for (mapping = encoding->mappings; mapping; mapping = nextmap) { - free(mapping->client_data); - nextmap = mapping->next; - free(mapping); - } - free(encoding); + if (encoding) { + FontMapPtr nextmap; + + free(encoding->name); + for (mapping = encoding->mappings; mapping; mapping = nextmap) { + free(mapping->client_data); + nextmap = mapping->next; + free(mapping); + } + free(encoding); } - for(i = 0; i < numaliases; i++) + for (i = 0; i < numaliases; i++) free(aliases[i]); - /* We don't need to free sn and sm as they handled locally in the body.*/ + /* We don't need to free sn and sm as they handled locally in the body. */ return NULL; } -char* +char * FontEncDirectory(void) { - static char* dir = NULL; + static char *dir = NULL; - if(dir == NULL) { + if (dir == NULL) { char *c = getenv("FONT_ENCODINGS_DIRECTORY"); - if(c) { + + if (c) { dir = strdup(c); - if(!dir) + if (!dir) return NULL; - } else { + } + else { dir = FONT_ENCODINGS_DIRECTORY; } } @@ -789,20 +853,19 @@ parseFontFileName(const char *fontFileName, char *buf, char *dir) const char *p; char *q, *lastslash; - for(p = fontFileName, q = dir, lastslash = NULL; *p; p++, q++) { + for (p = fontFileName, q = dir, lastslash = NULL; *p; p++, q++) { *q = *p; - if(*p == '/') - lastslash = q+1; + if (*p == '/') + lastslash = q + 1; } - if(!lastslash) + if (!lastslash) lastslash = dir; *lastslash = '\0'; - if(buf && strlen(dir) + 14 < MAXFONTFILENAMELEN) { - strcpy(buf, dir); - strcat(buf, "encodings.dir"); + if (buf && strlen(dir) + 14 < MAXFONTFILENAMELEN) { + snprintf(buf, MAXFONTFILENAMELEN, "%s%s", dir, "encodings.dir"); } } @@ -821,44 +884,44 @@ FontEncReallyReallyLoad(const char *charset, /* As we don't really expect to open encodings that often, we don't take the trouble of caching encodings directories. */ - if((file = fopen(dirname, "r")) == NULL) { + if ((file = fopen(dirname, "r")) == NULL) { return NULL; } count = fscanf(file, "%d\n", &n); - if(count == EOF || count != 1) { + if (count == EOF || count != 1) { fclose(file); return NULL; } encoding = NULL; if (!format[0]) { - sprintf(format, "%%%ds %%%d[^\n]\n", (int)sizeof(encoding_name) - 1, - (int)sizeof(file_name) - 1); + snprintf(format, sizeof(format), "%%%ds %%%d[^\n]\n", + (int) sizeof(encoding_name) - 1, (int) sizeof(file_name) - 1); } - for(;;) { + for (;;) { count = fscanf(file, format, encoding_name, file_name); - if(count == EOF) + if (count == EOF) break; - if(count != 2) + if (count != 2) break; - if(!strcasecmp(encoding_name, charset)) { + if (!strcasecmp(encoding_name, charset)) { /* Found it */ - if(file_name[0] != '/') { - if(strlen(dir) + strlen(file_name) >= MAXFONTFILENAMELEN) { - fclose(file); + if (file_name[0] != '/') { + if (strlen(dir) + strlen(file_name) >= MAXFONTFILENAMELEN) { + fclose(file); return NULL; - } - strcpy(buf, dir); - strcat(buf, file_name); - } else { - strcpy(buf , file_name); + } + snprintf(buf, MAXFONTFILENAMELEN, "%s%s", dir, file_name); + } + else { + snprintf(buf, MAXFONTFILENAMELEN, "%s", file_name); } f = FontFileOpen(buf); - if(f == NULL) { - fclose(file); + if (f == NULL) { + fclose(file); return NULL; } encoding = parseEncodingFile(f, 0); @@ -880,15 +943,15 @@ FontEncReallyLoad(const char *charset, const char *fontFileName) char dir[MAXFONTFILENAMELEN], dirname[MAXFONTFILENAMELEN]; char *d; - if(fontFileName) { + if (fontFileName) { parseFontFileName(fontFileName, dirname, dir); encoding = FontEncReallyReallyLoad(charset, dirname, dir); - if(encoding) - return(encoding); + if (encoding) + return (encoding); } d = FontEncDirectory(); - if(d) { + if (d) { parseFontFileName(d, NULL, dir); encoding = FontEncReallyReallyLoad(charset, d, dir); return encoding; @@ -909,22 +972,22 @@ FontEncIdentify(const char *fileName) char **names, **name, **alias; int numaliases; - if((f = FontFileOpen(fileName))==NULL) { + if ((f = FontFileOpen(fileName)) == NULL) { return NULL; } encoding = parseEncodingFile(f, 1); FontFileClose(f); - if(!encoding) + if (!encoding) return NULL; numaliases = 0; - if(encoding->aliases) - for(alias = encoding->aliases; *alias; alias++) + if (encoding->aliases) + for (alias = encoding->aliases; *alias; alias++) numaliases++; - names = malloc((numaliases+2)*sizeof(char*)); - if(names == NULL) { + names = malloc((numaliases + 2) * sizeof(char *)); + if (names == NULL) { free(encoding->aliases); free(encoding); return NULL; @@ -932,9 +995,9 @@ FontEncIdentify(const char *fileName) name = names; *(name++) = encoding->name; - if(numaliases > 0) - for(alias = encoding->aliases; *alias; alias++, name++) - *name = *alias; + if (numaliases > 0) + for (alias = encoding->aliases; *alias; alias++, name++) + *name = *alias; *name = NULL; free(encoding->aliases); diff --git a/lib/libfontenc/src/fontenc.c b/lib/libfontenc/src/fontenc.c index 4cfa1e59b..0fafd2f71 100644 --- a/lib/libfontenc/src/fontenc.c +++ b/lib/libfontenc/src/fontenc.c @@ -36,7 +36,7 @@ THE SOFTWARE. /* Functions local to this file */ -static FontEncPtr FontEncLoad(const char*, const char*); +static FontEncPtr FontEncLoad(const char *, const char *); /* Early versions of this code only knew about hardwired encodings, hence the following data. Now that the code knows how to load an @@ -44,10 +44,9 @@ static FontEncPtr FontEncLoad(const char*, const char*); /* At any rate, no new hardcoded encodings will be added. */ -static FontMapRec iso10646[]= -{ - {FONT_ENCODING_UNICODE,0,0,NULL,NULL,NULL,NULL,NULL}, - {0,0,0,NULL,NULL,NULL,NULL,NULL} +static FontMapRec iso10646[] = { + {FONT_ENCODING_UNICODE, 0, 0, NULL, NULL, NULL, NULL, NULL}, + {0, 0, 0, NULL, NULL, NULL, NULL, NULL} }; /* Notice that the Apple encodings do not have all the characters in @@ -56,189 +55,191 @@ static FontMapRec iso10646[]= unless we are willing to combine cmaps (which we are not). */ static const unsigned short -iso8859_1_apple_roman[]= -{ 0xCA, 0xC1, 0xA2, 0xA3, 0xDB, 0xB4, 0x00, 0xA4, - 0xAC, 0xA9, 0xBB, 0xC7, 0xC2, 0x00, 0xA8, 0xF8, - 0xA1, 0xB1, 0x00, 0x00, 0xAB, 0xB5, 0xA6, 0xE1, - 0xFC, 0x00, 0xBC, 0xC8, 0x00, 0x00, 0x00, 0xC0, - 0xCB, 0xE7, 0xE5, 0xCC, 0x80, 0x81, 0xAE, 0x82, - 0xE9, 0x83, 0xE6, 0xE8, 0xED, 0xEA, 0xEB, 0xEC, - 0x00, 0x84, 0xF1, 0xEE, 0xEF, 0xCD, 0x85, 0x00, - 0xAF, 0xF4, 0xF2, 0xF3, 0x86, 0x00, 0x00, 0xA7, - 0x88, 0x87, 0x89, 0x8B, 0x8A, 0x8C, 0xBE, 0x8D, - 0x8F, 0x8E, 0x90, 0x91, 0x93, 0x92, 0x94, 0x95, - 0x00, 0x96, 0x98, 0x97, 0x99, 0x9B, 0x9A, 0xD6, - 0xBF, 0x9D, 0x9C, 0x9E, 0x9F, 0x00, 0x00, 0xD8 }; + iso8859_1_apple_roman[] = { + 0xCA, 0xC1, 0xA2, 0xA3, 0xDB, 0xB4, 0x00, 0xA4, + 0xAC, 0xA9, 0xBB, 0xC7, 0xC2, 0x00, 0xA8, 0xF8, + 0xA1, 0xB1, 0x00, 0x00, 0xAB, 0xB5, 0xA6, 0xE1, + 0xFC, 0x00, 0xBC, 0xC8, 0x00, 0x00, 0x00, 0xC0, + 0xCB, 0xE7, 0xE5, 0xCC, 0x80, 0x81, 0xAE, 0x82, + 0xE9, 0x83, 0xE6, 0xE8, 0xED, 0xEA, 0xEB, 0xEC, + 0x00, 0x84, 0xF1, 0xEE, 0xEF, 0xCD, 0x85, 0x00, + 0xAF, 0xF4, 0xF2, 0xF3, 0x86, 0x00, 0x00, 0xA7, + 0x88, 0x87, 0x89, 0x8B, 0x8A, 0x8C, 0xBE, 0x8D, + 0x8F, 0x8E, 0x90, 0x91, 0x93, 0x92, 0x94, 0x95, + 0x00, 0x96, 0x98, 0x97, 0x99, 0x9B, 0x9A, 0xD6, + 0xBF, 0x9D, 0x9C, 0x9E, 0x9F, 0x00, 0x00, 0xD8 +}; /* Cannot use simple_recode because need to eliminate 0x80<=code<0xA0 */ static unsigned iso8859_1_to_apple_roman(unsigned isocode, void *client_data) { - if(isocode<=0x80) + if (isocode <= 0x80) return isocode; - else if(isocode>=0xA0) - return iso8859_1_apple_roman[isocode-0xA0]; + else if (isocode >= 0xA0) + return iso8859_1_apple_roman[isocode - 0xA0]; else return 0; } -static FontMapRec iso8859_1[]= -{ - {FONT_ENCODING_TRUETYPE,2,2,NULL,NULL,NULL,NULL,NULL}, /* ISO 8859-1 */ - {FONT_ENCODING_UNICODE,0,0,NULL,NULL,NULL,NULL,NULL}, /* ISO 8859-1 coincides with Unicode*/ - {FONT_ENCODING_TRUETYPE,1,0,iso8859_1_to_apple_roman,NULL,NULL,NULL,NULL}, - {0,0,0,NULL,NULL,NULL,NULL,NULL} +static FontMapRec iso8859_1[] = { + {FONT_ENCODING_TRUETYPE, 2, 2, NULL, NULL, NULL, NULL, NULL}, /* ISO 8859-1 */ + {FONT_ENCODING_UNICODE, 0, 0, NULL, NULL, NULL, NULL, NULL}, /* ISO 8859-1 coincides with Unicode */ + {FONT_ENCODING_TRUETYPE, 1, 0, iso8859_1_to_apple_roman, NULL, NULL, NULL, + NULL}, + {0, 0, 0, NULL, NULL, NULL, NULL, NULL} }; -static const unsigned short iso8859_2_tophalf[]= -{ 0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, - 0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B, - 0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7, - 0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C, - 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, - 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, - 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, - 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, - 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, - 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, - 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, - 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9 }; +static const unsigned short iso8859_2_tophalf[] = { + 0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, + 0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B, + 0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7, + 0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C, + 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, + 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, + 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, + 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, + 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, + 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, + 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, + 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9 +}; -static FontEncSimpleMapRec iso8859_2_to_unicode_map= -{0x60, 0, 0xA0, iso8859_2_tophalf }; +static FontEncSimpleMapRec iso8859_2_to_unicode_map = + { 0x60, 0, 0xA0, iso8859_2_tophalf }; -static const unsigned short iso8859_2_apple_centeuro[]= -{ 0xCA, 0x84, 0x00, 0xFC, 0x00, 0xBB, 0xE5, 0xA4, - 0xAC, 0xE1, 0x00, 0xE8, 0x8F, 0x00, 0xEB, 0xFB, - 0xA1, 0x88, 0x00, 0xB8, 0x00, 0xBC, 0xE6, 0xFF, - 0x00, 0xE4, 0x00, 0xE9, 0x90, 0x00, 0xEC, 0xFD, - 0xD9, 0xE7, 0x00, 0x00, 0x80, 0xBD, 0x8C, 0x00, - 0x89, 0x83, 0xA2, 0x00, 0x9D, 0xEA, 0x00, 0x91, - 0x00, 0xC1, 0xC5, 0xEE, 0xEF, 0xCC, 0x85, 0x00, - 0xDB, 0xF1, 0xF2, 0xF4, 0x86, 0xF8, 0x00, 0xA7, - 0xDA, 0x87, 0x00, 0x00, 0x8A, 0xBE, 0x8D, 0x00, - 0x8B, 0x8E, 0xAB, 0x00, 0x9E, 0x92, 0x00, 0x93, - 0x00, 0xC4, 0xCB, 0x97, 0x99, 0xCE, 0x9A, 0xD6, - 0xDE, 0xF3, 0x9C, 0xF5, 0x9F, 0xF9, 0x00, 0x00 }; +static const unsigned short iso8859_2_apple_centeuro[] = { + 0xCA, 0x84, 0x00, 0xFC, 0x00, 0xBB, 0xE5, 0xA4, + 0xAC, 0xE1, 0x00, 0xE8, 0x8F, 0x00, 0xEB, 0xFB, + 0xA1, 0x88, 0x00, 0xB8, 0x00, 0xBC, 0xE6, 0xFF, + 0x00, 0xE4, 0x00, 0xE9, 0x90, 0x00, 0xEC, 0xFD, + 0xD9, 0xE7, 0x00, 0x00, 0x80, 0xBD, 0x8C, 0x00, + 0x89, 0x83, 0xA2, 0x00, 0x9D, 0xEA, 0x00, 0x91, + 0x00, 0xC1, 0xC5, 0xEE, 0xEF, 0xCC, 0x85, 0x00, + 0xDB, 0xF1, 0xF2, 0xF4, 0x86, 0xF8, 0x00, 0xA7, + 0xDA, 0x87, 0x00, 0x00, 0x8A, 0xBE, 0x8D, 0x00, + 0x8B, 0x8E, 0xAB, 0x00, 0x9E, 0x92, 0x00, 0x93, + 0x00, 0xC4, 0xCB, 0x97, 0x99, 0xCE, 0x9A, 0xD6, + 0xDE, 0xF3, 0x9C, 0xF5, 0x9F, 0xF9, 0x00, 0x00 +}; static unsigned iso8859_2_to_apple_centeuro(unsigned isocode, void *client_data) { - if(isocode<=0x80) + if (isocode <= 0x80) return isocode; - else if(isocode>=0xA0) - return iso8859_2_apple_centeuro[isocode-0xA0]; + else if (isocode >= 0xA0) + return iso8859_2_apple_centeuro[isocode - 0xA0]; else return 0; } - -static FontMapRec iso8859_2[]= -{ - {FONT_ENCODING_UNICODE,0,0, - FontEncSimpleRecode,NULL,&iso8859_2_to_unicode_map,NULL,NULL}, - {FONT_ENCODING_TRUETYPE,1,29,iso8859_2_to_apple_centeuro,NULL,NULL,NULL,NULL}, - {0,0,0,NULL,NULL,NULL,NULL,NULL} +static FontMapRec iso8859_2[] = { + {FONT_ENCODING_UNICODE, 0, 0, + FontEncSimpleRecode, NULL, &iso8859_2_to_unicode_map, NULL, NULL}, + {FONT_ENCODING_TRUETYPE, 1, 29, iso8859_2_to_apple_centeuro, NULL, NULL, + NULL, NULL}, + {0, 0, 0, NULL, NULL, NULL, NULL, NULL} }; -static const unsigned short iso8859_3_tophalf[]= -{ 0x00A0, 0x0126, 0x02D8, 0x00A3, 0x00A4, 0x0000, 0x0124, 0x00A7, - 0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, 0x0000, 0x017B, - 0x00B0, 0x0127, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0125, 0x00B7, - 0x00B8, 0x0131, 0x015F, 0x011F, 0x0135, 0x00BD, 0x0000, 0x017C, - 0x00C0, 0x00C1, 0x00C2, 0x0000, 0x00C4, 0x010A, 0x0108, 0x00C7, - 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, - 0x0000, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x0120, 0x00D6, 0x00D7, - 0x011C, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x016C, 0x015C, 0x00DF, - 0x00E0, 0x00E1, 0x00E2, 0x0000, 0x00E4, 0x010B, 0x0109, 0x00E7, - 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, - 0x0000, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0121, 0x00F6, 0x00F7, - 0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9}; - -static FontEncSimpleMapRec iso8859_3_to_unicode_map= -{ 0x60, 0, 0xA0, iso8859_3_tophalf }; - -static FontMapRec iso8859_3[]= -{ - {FONT_ENCODING_UNICODE,0,0, - FontEncSimpleRecode,NULL,&iso8859_3_to_unicode_map,NULL,NULL}, - {0,0,0,NULL,NULL,NULL,NULL,NULL} +static const unsigned short iso8859_3_tophalf[] = { + 0x00A0, 0x0126, 0x02D8, 0x00A3, 0x00A4, 0x0000, 0x0124, 0x00A7, + 0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, 0x0000, 0x017B, + 0x00B0, 0x0127, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0125, 0x00B7, + 0x00B8, 0x0131, 0x015F, 0x011F, 0x0135, 0x00BD, 0x0000, 0x017C, + 0x00C0, 0x00C1, 0x00C2, 0x0000, 0x00C4, 0x010A, 0x0108, 0x00C7, + 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, + 0x0000, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x0120, 0x00D6, 0x00D7, + 0x011C, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x016C, 0x015C, 0x00DF, + 0x00E0, 0x00E1, 0x00E2, 0x0000, 0x00E4, 0x010B, 0x0109, 0x00E7, + 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, + 0x0000, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0121, 0x00F6, 0x00F7, + 0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9 }; +static FontEncSimpleMapRec iso8859_3_to_unicode_map = + { 0x60, 0, 0xA0, iso8859_3_tophalf }; -static const unsigned short iso8859_4_tophalf[]= -{ 0x00A0, 0x0104, 0x0138, 0x0156, 0x00A4, 0x0128, 0x013B, 0x00A7, - 0x00A8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00AD, 0x017D, 0x00AF, - 0x00B0, 0x0105, 0x02DB, 0x0157, 0x00B4, 0x0129, 0x013C, 0x02C7, - 0x00B8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014A, 0x017E, 0x014B, - 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E, - 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x012A, - 0x0110, 0x0145, 0x014C, 0x0136, 0x00D4, 0x00D5, 0x00D6, 0x00D7, - 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x0168, 0x016A, 0x00DF, - 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F, - 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x012B, - 0x0111, 0x0146, 0x014D, 0x0137, 0x00F4, 0x00F5, 0x00F6, 0x00F7, - 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x0169, 0x016B, 0x02D9, +static FontMapRec iso8859_3[] = { + {FONT_ENCODING_UNICODE, 0, 0, + FontEncSimpleRecode, NULL, &iso8859_3_to_unicode_map, NULL, NULL}, + {0, 0, 0, NULL, NULL, NULL, NULL, NULL} }; -static FontEncSimpleMapRec iso8859_4_to_unicode_map= -{ 0x60, 0, 0xA0, iso8859_4_tophalf }; - -static FontMapRec iso8859_4[]= -{ - {FONT_ENCODING_UNICODE,0,0,FontEncSimpleRecode,NULL, - &iso8859_4_to_unicode_map,NULL,NULL}, - {0,0,0,NULL,NULL,NULL,NULL,NULL} +static const unsigned short iso8859_4_tophalf[] = { + 0x00A0, 0x0104, 0x0138, 0x0156, 0x00A4, 0x0128, 0x013B, 0x00A7, + 0x00A8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00AD, 0x017D, 0x00AF, + 0x00B0, 0x0105, 0x02DB, 0x0157, 0x00B4, 0x0129, 0x013C, 0x02C7, + 0x00B8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014A, 0x017E, 0x014B, + 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E, + 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x012A, + 0x0110, 0x0145, 0x014C, 0x0136, 0x00D4, 0x00D5, 0x00D6, 0x00D7, + 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x0168, 0x016A, 0x00DF, + 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F, + 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x012B, + 0x0111, 0x0146, 0x014D, 0x0137, 0x00F4, 0x00F5, 0x00F6, 0x00F7, + 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x0169, 0x016B, 0x02D9, }; -static const unsigned short iso8859_5_tophalf[]= -{ 0x00A0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, - 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00AD, 0x040E, 0x040F, - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, - 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, - 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, - 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, - 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, - 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, - 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00A7, 0x045E, 0x045F}; +static FontEncSimpleMapRec iso8859_4_to_unicode_map = + { 0x60, 0, 0xA0, iso8859_4_tophalf }; -static FontEncSimpleMapRec iso8859_5_to_unicode_map= -{ 0x60, 0, 0xA0, iso8859_5_tophalf }; +static FontMapRec iso8859_4[] = { + {FONT_ENCODING_UNICODE, 0, 0, FontEncSimpleRecode, NULL, + &iso8859_4_to_unicode_map, NULL, NULL}, + {0, 0, 0, NULL, NULL, NULL, NULL, NULL} +}; -static const unsigned short -iso8859_5_apple_cyrillic[]= -{ 0xCA, 0xDD, 0xAB, 0xAE, 0xB8, 0xC1, 0xA7, 0xBA, - 0xB7, 0xBC, 0xBE, 0xCB, 0xCD, 0x00, 0xD8, 0xDA, - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, - 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, - 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, - 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, - 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, - 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, - 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xDF, - 0xDC, 0xDE, 0xAC, 0xAF, 0xB9, 0xCF, 0xB4, 0xBB, - 0xC0, 0xBD, 0xBF, 0xCC, 0xCE, 0xA4, 0xD9, 0xDB }; +static const unsigned short iso8859_5_tophalf[] = { + 0x00A0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, + 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00AD, 0x040E, 0x040F, + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, + 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, + 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, + 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, + 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, + 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, + 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00A7, 0x045E, 0x045F +}; + +static FontEncSimpleMapRec iso8859_5_to_unicode_map = + { 0x60, 0, 0xA0, iso8859_5_tophalf }; + +static const unsigned short iso8859_5_apple_cyrillic[] = { + 0xCA, 0xDD, 0xAB, 0xAE, 0xB8, 0xC1, 0xA7, 0xBA, + 0xB7, 0xBC, 0xBE, 0xCB, 0xCD, 0x00, 0xD8, 0xDA, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, + 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, + 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xDF, + 0xDC, 0xDE, 0xAC, 0xAF, 0xB9, 0xCF, 0xB4, 0xBB, + 0xC0, 0xBD, 0xBF, 0xCC, 0xCE, 0xA4, 0xD9, 0xDB +}; static unsigned iso8859_5_to_apple_cyrillic(unsigned isocode, void *client_data) { - if(isocode<=0x80) + if (isocode <= 0x80) return isocode; - else if(isocode>=0xA0) - return iso8859_5_apple_cyrillic[isocode-0x80]; - else return 0; + else if (isocode >= 0xA0) + return iso8859_5_apple_cyrillic[isocode - 0x80]; + else + return 0; } -static FontMapRec iso8859_5[]= -{ - {FONT_ENCODING_UNICODE,0,0,FontEncSimpleRecode,NULL, - &iso8859_5_to_unicode_map,NULL,NULL}, - {FONT_ENCODING_TRUETYPE,1,7,iso8859_5_to_apple_cyrillic,NULL,NULL,NULL,NULL}, - {0,0,0,NULL,NULL,NULL,NULL,NULL} +static FontMapRec iso8859_5[] = { + {FONT_ENCODING_UNICODE, 0, 0, FontEncSimpleRecode, NULL, + &iso8859_5_to_unicode_map, NULL, NULL}, + {FONT_ENCODING_TRUETYPE, 1, 7, iso8859_5_to_apple_cyrillic, NULL, NULL, + NULL, NULL}, + {0, 0, 0, NULL, NULL, NULL, NULL, NULL} }; /* ISO 8859-6 seems useless for serving fonts (not enough presentation @@ -247,253 +248,283 @@ static FontMapRec iso8859_5[]= static unsigned iso8859_6_to_unicode(unsigned isocode, void *client_data) { - if(isocode<=0xA0 || isocode==0xA4 || isocode==0xAD) + if (isocode <= 0xA0 || isocode == 0xA4 || isocode == 0xAD) return isocode; - else if(isocode==0xAC || isocode==0xBB || - isocode==0xBF || - (isocode>=0xC1 && isocode<=0xDA) || - (isocode>=0xE0 && isocode<=0xEF) || - (isocode>=0xF0 && isocode<=0xF2)) - return isocode-0xA0+0x0600; + else if (isocode == 0xAC || isocode == 0xBB || + isocode == 0xBF || + (isocode >= 0xC1 && isocode <= 0xDA) || + (isocode >= 0xE0 && isocode <= 0xEF) || + (isocode >= 0xF0 && isocode <= 0xF2)) + return isocode - 0xA0 + 0x0600; else return 0; } -static FontMapRec iso8859_6[]= -{ - {FONT_ENCODING_UNICODE,0,0,iso8859_6_to_unicode,NULL,NULL,NULL,NULL}, - {0,0,0,NULL,NULL,NULL,NULL,NULL} +static FontMapRec iso8859_6[] = { + {FONT_ENCODING_UNICODE, 0, 0, iso8859_6_to_unicode, NULL, NULL, NULL, NULL}, + {0, 0, 0, NULL, NULL, NULL, NULL, NULL} }; static unsigned iso8859_7_to_unicode(unsigned isocode, void *client_data) { - if(isocode<=0xA0 || - (isocode>=0xA3 && isocode<=0xAD) || - (isocode>=0xB0 && isocode<=0xB3) || - isocode==0xB7 || isocode==0xBB || isocode==0xBD) + if (isocode <= 0xA0 || + (isocode >= 0xA3 && isocode <= 0xAD) || + (isocode >= 0xB0 && isocode <= 0xB3) || + isocode == 0xB7 || isocode == 0xBB || isocode == 0xBD) return isocode; - else if(isocode==0xA1) + else if (isocode == 0xA1) return 0x02BD; - else if(isocode==0xA2) + else if (isocode == 0xA2) return 0x02BC; - else if(isocode==0xAF) + else if (isocode == 0xAF) return 0x2015; - else if(isocode==0xD2) /* unassigned */ + else if (isocode == 0xD2) /* unassigned */ return 0; - else if(isocode>=0xB4) - return isocode-0xA0+0x0370; + else if (isocode >= 0xB4) + return isocode - 0xA0 + 0x0370; else return 0; } -static FontMapRec iso8859_7[]= -{ - {FONT_ENCODING_UNICODE,0,0,iso8859_7_to_unicode,NULL,NULL,NULL,NULL}, - {0,0,0,NULL,NULL,NULL,NULL,NULL} +static FontMapRec iso8859_7[] = { + {FONT_ENCODING_UNICODE, 0, 0, iso8859_7_to_unicode, NULL, NULL, NULL, NULL}, + {0, 0, 0, NULL, NULL, NULL, NULL, NULL} }; static unsigned iso8859_8_to_unicode(unsigned isocode, void *client_data) { - if(isocode==0xA1) + if (isocode == 0xA1) return 0; - else if(isocode<0xBF) + else if (isocode < 0xBF) return isocode; - else if(isocode==0xDF) + else if (isocode == 0xDF) return 0x2017; - else if(isocode>=0xE0 && isocode<=0xFA) - return isocode+0x04F0; + else if (isocode >= 0xE0 && isocode <= 0xFA) + return isocode + 0x04F0; else return 0; } -static FontMapRec iso8859_8[]= -{ - {FONT_ENCODING_UNICODE,0,0,iso8859_8_to_unicode,NULL,NULL,NULL,NULL}, - {0,0,0,NULL,NULL,NULL,NULL,NULL} +static FontMapRec iso8859_8[] = { + {FONT_ENCODING_UNICODE, 0, 0, iso8859_8_to_unicode, NULL, NULL, NULL, NULL}, + {0, 0, 0, NULL, NULL, NULL, NULL, NULL} }; static unsigned iso8859_9_to_unicode(unsigned isocode, void *client_data) { - switch(isocode) { - case 0xD0: return 0x011E; - case 0xDD: return 0x0130; - case 0xDE: return 0x015E; - case 0xF0: return 0x011F; - case 0xFD: return 0x0131; - case 0xFE: return 0x015F; - default: return isocode; + switch (isocode) { + case 0xD0: + return 0x011E; + case 0xDD: + return 0x0130; + case 0xDE: + return 0x015E; + case 0xF0: + return 0x011F; + case 0xFD: + return 0x0131; + case 0xFE: + return 0x015F; + default: + return isocode; } } -static FontMapRec iso8859_9[]= -{ - {FONT_ENCODING_UNICODE,0,0,iso8859_9_to_unicode,NULL,NULL,NULL,NULL}, - {0,0,0,NULL,NULL,NULL,NULL,NULL} +static FontMapRec iso8859_9[] = { + {FONT_ENCODING_UNICODE, 0, 0, iso8859_9_to_unicode, NULL, NULL, NULL, NULL}, + {0, 0, 0, NULL, NULL, NULL, NULL, NULL} }; -static const unsigned short iso8859_10_tophalf[]= -{ 0x00A0, 0x0104, 0x0112, 0x0122, 0x012A, 0x0128, 0x0136, 0x00A7, - 0x013B, 0x0110, 0x0160, 0x0166, 0x017D, 0x00AD, 0x016A, 0x014A, - 0x00B0, 0x0105, 0x0113, 0x0123, 0x012B, 0x0129, 0x0137, 0x00B7, - 0x013C, 0x0111, 0x0161, 0x0167, 0x017E, 0x2014, 0x016B, 0x014B, - 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E, - 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x00CF, - 0x00D0, 0x0145, 0x014C, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x0168, - 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, - 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F, - 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x00EF, - 0x00F0, 0x0146, 0x014D, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x0169, - 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x0138}; +static const unsigned short iso8859_10_tophalf[] = { + 0x00A0, 0x0104, 0x0112, 0x0122, 0x012A, 0x0128, 0x0136, 0x00A7, + 0x013B, 0x0110, 0x0160, 0x0166, 0x017D, 0x00AD, 0x016A, 0x014A, + 0x00B0, 0x0105, 0x0113, 0x0123, 0x012B, 0x0129, 0x0137, 0x00B7, + 0x013C, 0x0111, 0x0161, 0x0167, 0x017E, 0x2014, 0x016B, 0x014B, + 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E, + 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x00CF, + 0x00D0, 0x0145, 0x014C, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x0168, + 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, + 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F, + 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x00EF, + 0x00F0, 0x0146, 0x014D, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x0169, + 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x0138 +}; -static FontEncSimpleMapRec iso8859_10_to_unicode_map= -{ 0x60, 0, 0xA0, iso8859_10_tophalf }; +static FontEncSimpleMapRec iso8859_10_to_unicode_map = + { 0x60, 0, 0xA0, iso8859_10_tophalf }; -static FontMapRec iso8859_10[]= -{ - {FONT_ENCODING_UNICODE,0,0,FontEncSimpleRecode,NULL, - &iso8859_10_to_unicode_map,NULL,NULL}, - {0,0,0,NULL,NULL,NULL,NULL,NULL} +static FontMapRec iso8859_10[] = { + {FONT_ENCODING_UNICODE, 0, 0, FontEncSimpleRecode, NULL, + &iso8859_10_to_unicode_map, NULL, NULL}, + {0, 0, 0, NULL, NULL, NULL, NULL, NULL} }; static unsigned iso8859_15_to_unicode(unsigned isocode, void *client_data) { - switch(isocode) { - case 0xA4: return 0x20AC; - case 0xA6: return 0x0160; - case 0xA8: return 0x0161; - case 0xB4: return 0x017D; - case 0xB8: return 0x017E; - case 0xBC: return 0x0152; - case 0xBD: return 0x0153; - case 0xBE: return 0x0178; - default: return isocode; + switch (isocode) { + case 0xA4: + return 0x20AC; + case 0xA6: + return 0x0160; + case 0xA8: + return 0x0161; + case 0xB4: + return 0x017D; + case 0xB8: + return 0x017E; + case 0xBC: + return 0x0152; + case 0xBD: + return 0x0153; + case 0xBE: + return 0x0178; + default: + return isocode; } } -static FontMapRec iso8859_15[]= -{ - {FONT_ENCODING_UNICODE,0,0,iso8859_15_to_unicode,NULL,NULL,NULL,NULL}, - {0,0,0,NULL,NULL,NULL,NULL,NULL} +static FontMapRec iso8859_15[] = { + {FONT_ENCODING_UNICODE, 0, 0, iso8859_15_to_unicode, NULL, NULL, NULL, + NULL}, + {0, 0, 0, NULL, NULL, NULL, NULL, NULL} }; -static const unsigned short koi8_r_tophalf[]= -{ 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, - 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, - 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2022, 0x221A, 0x2248, - 0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7, - 0x2550, 0x2551, 0x2552, 0x0451, 0x2553, 0x2554, 0x2555, 0x2556, - 0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x255C, 0x255D, 0x255E, - 0x255F, 0x2560, 0x2561, 0x0401, 0x2562, 0x2563, 0x2564, 0x2565, - 0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x256B, 0x256C, 0x00A9, - 0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, - 0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, - 0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, - 0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A, - 0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, - 0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, - 0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, - 0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A}; +static const unsigned short koi8_r_tophalf[] = { + 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, + 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, + 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2022, 0x221A, 0x2248, + 0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7, + 0x2550, 0x2551, 0x2552, 0x0451, 0x2553, 0x2554, 0x2555, 0x2556, + 0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x255C, 0x255D, 0x255E, + 0x255F, 0x2560, 0x2561, 0x0401, 0x2562, 0x2563, 0x2564, 0x2565, + 0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x256B, 0x256C, 0x00A9, + 0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, + 0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, + 0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, + 0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A, + 0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, + 0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, + 0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, + 0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A +}; -static FontEncSimpleMapRec koi8_r_to_unicode_map= -{ 0x80, 0, 0x80, koi8_r_tophalf }; +static FontEncSimpleMapRec koi8_r_to_unicode_map = + { 0x80, 0, 0x80, koi8_r_tophalf }; - -static FontMapRec koi8_r[]= -{ - {FONT_ENCODING_UNICODE,0,0,FontEncSimpleRecode,NULL, - &koi8_r_to_unicode_map,NULL,NULL}, - {0,0,0,NULL,NULL,NULL,NULL,NULL} +static FontMapRec koi8_r[] = { + {FONT_ENCODING_UNICODE, 0, 0, FontEncSimpleRecode, NULL, + &koi8_r_to_unicode_map, NULL, NULL}, + {0, 0, 0, NULL, NULL, NULL, NULL, NULL} }; static unsigned koi8_ru_to_unicode(unsigned koicode, void *client_data) { - switch(koicode) { - case 0x93: return 0x201C; - case 0x96: return 0x201D; - case 0x97: return 0x2014; - case 0x98: return 0x2116; - case 0x99: return 0x2122; - case 0x9B: return 0x00BB; - case 0x9C: return 0x00AE; - case 0x9D: return 0x00AB; - case 0x9F: return 0x00A4; - case 0xA4: return 0x0454; - case 0xA6: return 0x0456; - case 0xA7: return 0x0457; - case 0xAD: return 0x0491; - case 0xAE: return 0x045E; - case 0xB4: return 0x0404; - case 0xB6: return 0x0406; - case 0xB7: return 0x0407; - case 0xBD: return 0x0490; - case 0xBE: return 0x040E; - default: return FontEncSimpleRecode(koicode, &koi8_r_to_unicode_map); - } + switch (koicode) { + case 0x93: + return 0x201C; + case 0x96: + return 0x201D; + case 0x97: + return 0x2014; + case 0x98: + return 0x2116; + case 0x99: + return 0x2122; + case 0x9B: + return 0x00BB; + case 0x9C: + return 0x00AE; + case 0x9D: + return 0x00AB; + case 0x9F: + return 0x00A4; + case 0xA4: + return 0x0454; + case 0xA6: + return 0x0456; + case 0xA7: + return 0x0457; + case 0xAD: + return 0x0491; + case 0xAE: + return 0x045E; + case 0xB4: + return 0x0404; + case 0xB6: + return 0x0406; + case 0xB7: + return 0x0407; + case 0xBD: + return 0x0490; + case 0xBE: + return 0x040E; + default: + return FontEncSimpleRecode(koicode, &koi8_r_to_unicode_map); + } } -static FontMapRec koi8_ru[]= -{ - {FONT_ENCODING_UNICODE,0,0,koi8_ru_to_unicode,NULL,NULL,NULL,NULL}, - {0,0,0,NULL,NULL,NULL,NULL,NULL} +static FontMapRec koi8_ru[] = { + {FONT_ENCODING_UNICODE, 0, 0, koi8_ru_to_unicode, NULL, NULL, NULL, NULL}, + {0, 0, 0, NULL, NULL, NULL, NULL, NULL} }; /* koi8-e, ISO-IR-111 or ECMA-Cyrillic */ -static const unsigned short koi8_e_A0_BF[]= -{ 0x00A0, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, - 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00AD, 0x045E, 0x045F, - 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, - 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00A4, 0x040E, 0x040F }; +static const unsigned short koi8_e_A0_BF[] = { + 0x00A0, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, + 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00AD, 0x045E, 0x045F, + 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, + 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00A4, 0x040E, 0x040F +}; static unsigned koi8_e_to_unicode(unsigned koicode, void *client_data) { - if(koicode<0xA0) + if (koicode < 0xA0) return koicode; - else if(koicode<0xC0) - return koi8_e_A0_BF[koicode-0xA0]; + else if (koicode < 0xC0) + return koi8_e_A0_BF[koicode - 0xA0]; else return FontEncSimpleRecode(koicode, &koi8_r_to_unicode_map); } -static FontMapRec koi8_e[]= -{ - {FONT_ENCODING_UNICODE,0,0,koi8_e_to_unicode,NULL,NULL,NULL,NULL}, - {0,0,0,NULL,NULL,NULL,NULL,NULL} +static FontMapRec koi8_e[] = { + {FONT_ENCODING_UNICODE, 0, 0, koi8_e_to_unicode, NULL, NULL, NULL, NULL}, + {0, 0, 0, NULL, NULL, NULL, NULL, NULL} }; /* Koi8 unified */ -static const unsigned short koi8_uni_80_BF[]= -{ 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, - 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, - 0x2591, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0x00A9, 0x2122, 0x00A0, 0x00BB, 0x00AE, 0x00AB, 0x00B7, 0x00A4, - 0x00A0, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, - 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x0491, 0x045E, 0x045F, - 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, - 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x0490, 0x040E, 0x040F }; +static const unsigned short koi8_uni_80_BF[] = { + 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, + 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, + 0x2591, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0x00A9, 0x2122, 0x00A0, 0x00BB, 0x00AE, 0x00AB, 0x00B7, 0x00A4, + 0x00A0, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, + 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x0491, 0x045E, 0x045F, + 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, + 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x0490, 0x040E, 0x040F +}; static unsigned koi8_uni_to_unicode(unsigned koicode, void *client_data) { - if(koicode<0x80) + if (koicode < 0x80) return koicode; - else if(koicode<0xC0) - return koi8_uni_80_BF[koicode-0x80]; + else if (koicode < 0xC0) + return koi8_uni_80_BF[koicode - 0x80]; else return FontEncSimpleRecode(koicode, &koi8_r_to_unicode_map); } -static FontMapRec koi8_uni[]= -{ - {FONT_ENCODING_UNICODE,0,0,koi8_uni_to_unicode,NULL,NULL,NULL,NULL}, - {0,0,0,NULL,NULL,NULL,NULL,NULL} +static FontMapRec koi8_uni[] = { + {FONT_ENCODING_UNICODE, 0, 0, koi8_uni_to_unicode, NULL, NULL, NULL, NULL}, + {0, 0, 0, NULL, NULL, NULL, NULL, NULL} }; /* Ukrainian variant of Koi8-R; see RFC 2319 */ @@ -501,69 +532,78 @@ static FontMapRec koi8_uni[]= static unsigned koi8_u_to_unicode(unsigned koicode, void *client_data) { - switch(koicode) { - case 0xA4: return 0x0454; - case 0xA6: return 0x0456; - case 0xA7: return 0x0457; - case 0xAD: return 0x0491; - case 0xB4: return 0x0404; - case 0xB6: return 0x0406; - case 0xB7: return 0x0407; - case 0xBD: return 0x0490; - default: return FontEncSimpleRecode(koicode, &koi8_r_to_unicode_map); + switch (koicode) { + case 0xA4: + return 0x0454; + case 0xA6: + return 0x0456; + case 0xA7: + return 0x0457; + case 0xAD: + return 0x0491; + case 0xB4: + return 0x0404; + case 0xB6: + return 0x0406; + case 0xB7: + return 0x0407; + case 0xBD: + return 0x0490; + default: + return FontEncSimpleRecode(koicode, &koi8_r_to_unicode_map); } } -static FontMapRec koi8_u[]= -{ - {FONT_ENCODING_UNICODE,0,0,koi8_u_to_unicode,NULL,NULL,NULL}, - {0,0,0,NULL,NULL,NULL,NULL,NULL} +static FontMapRec koi8_u[] = { + {FONT_ENCODING_UNICODE, 0, 0, koi8_u_to_unicode, NULL, NULL, NULL}, + {0, 0, 0, NULL, NULL, NULL, NULL, NULL} }; /* Microsoft Symbol, which is only meaningful for TrueType fonts, is treated specially in ftenc.c, where we add usFirstCharIndex-0x20 to the glyph index before applying the cmap. Lovely design. */ -static FontMapRec microsoft_symbol[]= -{{FONT_ENCODING_TRUETYPE,3,0,NULL,NULL,NULL,NULL,NULL}, - /* You never know */ - {FONT_ENCODING_TRUETYPE,3,1,NULL,NULL,NULL,NULL,NULL}, - {0,0,0,NULL,NULL,NULL,NULL,NULL}}; +static FontMapRec microsoft_symbol[] = { + {FONT_ENCODING_TRUETYPE, 3, 0, NULL, NULL, NULL, NULL, NULL}, + /* You never know */ + {FONT_ENCODING_TRUETYPE, 3, 1, NULL, NULL, NULL, NULL, NULL}, + {0, 0, 0, NULL, NULL, NULL, NULL, NULL} +}; -static FontMapRec apple_roman[]= -{{FONT_ENCODING_TRUETYPE,1,0,NULL,NULL,NULL,NULL,NULL}, - {0,0,0,NULL,NULL,NULL,NULL,NULL}}; +static FontMapRec apple_roman[] = { + {FONT_ENCODING_TRUETYPE, 1, 0, NULL, NULL, NULL, NULL, NULL}, + {0, 0, 0, NULL, NULL, NULL, NULL, NULL} +}; /* The data for recodings */ /* For compatibility with X11R6.4. Losers. */ -static char *iso8859_15_aliases[2]={"fcd8859-15",NULL}; +static char *iso8859_15_aliases[2] = { "fcd8859-15", NULL }; -static FontEncRec initial_encodings[]= -{ - {"iso10646-1",NULL,256*256,0,iso10646,NULL,0,0}, /* Unicode */ - {"iso8859-1",NULL,256,0,iso8859_1,NULL,0,0}, /* Latin 1 (West European) */ - {"iso8859-2",NULL,256,0,iso8859_2,NULL,0,0}, /* Latin 2 (East European) */ - {"iso8859-3",NULL,256,0,iso8859_3,NULL,0,0}, /* Latin 3 (South European) */ - {"iso8859-4",NULL,256,0,iso8859_4,NULL,0,0}, /* Latin 4 (North European) */ - {"iso8859-5",NULL,256,0,iso8859_5,NULL,0,0}, /* Cyrillic */ - {"iso8859-6",NULL,256,0,iso8859_6,NULL,0,0}, /* Arabic */ - {"iso8859-7",NULL,256,0,iso8859_7,NULL,0,0}, /* Greek */ - {"iso8859-8",NULL,256,0,iso8859_8,NULL,0,0}, /* Hebrew */ - {"iso8859-9",NULL,256,0,iso8859_9,NULL,0,0}, /* Latin 5 (Turkish) */ - {"iso8859-10",NULL,256,0,iso8859_10,NULL,0,0}, /* Latin 6 (Nordic) */ - {"iso8859-15",iso8859_15_aliases,256,0,iso8859_15,NULL,0,0}, /* Latin 9 */ - {"koi8-r",NULL,256,0,koi8_r,NULL,0,0}, /* Russian */ - {"koi8-ru",NULL,256,0,koi8_ru,NULL,0,0}, /* Ukrainian */ - {"koi8-uni",NULL,256,0,koi8_uni,NULL,0,0}, /* Russian/Ukrainian/Bielorussian */ - {"koi8-e",NULL,256,0,koi8_e,NULL,0,0}, /* ``European'' */ - {"koi8-u",NULL,256,0,koi8_u,NULL,0,0}, /* Ukrainian too */ - {"microsoft-symbol",NULL,256,0,microsoft_symbol,NULL,0,0}, - {"apple-roman",NULL,256,0,apple_roman,NULL,0,0}, - {NULL,NULL,0,0,NULL,NULL,0,0} +static FontEncRec initial_encodings[] = { + {"iso10646-1", NULL, 256 * 256, 0, iso10646, NULL, 0, 0}, /* Unicode */ + {"iso8859-1", NULL, 256, 0, iso8859_1, NULL, 0, 0}, /* Latin 1 (West European) */ + {"iso8859-2", NULL, 256, 0, iso8859_2, NULL, 0, 0}, /* Latin 2 (East European) */ + {"iso8859-3", NULL, 256, 0, iso8859_3, NULL, 0, 0}, /* Latin 3 (South European) */ + {"iso8859-4", NULL, 256, 0, iso8859_4, NULL, 0, 0}, /* Latin 4 (North European) */ + {"iso8859-5", NULL, 256, 0, iso8859_5, NULL, 0, 0}, /* Cyrillic */ + {"iso8859-6", NULL, 256, 0, iso8859_6, NULL, 0, 0}, /* Arabic */ + {"iso8859-7", NULL, 256, 0, iso8859_7, NULL, 0, 0}, /* Greek */ + {"iso8859-8", NULL, 256, 0, iso8859_8, NULL, 0, 0}, /* Hebrew */ + {"iso8859-9", NULL, 256, 0, iso8859_9, NULL, 0, 0}, /* Latin 5 (Turkish) */ + {"iso8859-10", NULL, 256, 0, iso8859_10, NULL, 0, 0}, /* Latin 6 (Nordic) */ + {"iso8859-15", iso8859_15_aliases, 256, 0, iso8859_15, NULL, 0, 0}, /* Latin 9 */ + {"koi8-r", NULL, 256, 0, koi8_r, NULL, 0, 0}, /* Russian */ + {"koi8-ru", NULL, 256, 0, koi8_ru, NULL, 0, 0}, /* Ukrainian */ + {"koi8-uni", NULL, 256, 0, koi8_uni, NULL, 0, 0}, /* Russian/Ukrainian/Bielorussian */ + {"koi8-e", NULL, 256, 0, koi8_e, NULL, 0, 0}, /* ``European'' */ + {"koi8-u", NULL, 256, 0, koi8_u, NULL, 0, 0}, /* Ukrainian too */ + {"microsoft-symbol", NULL, 256, 0, microsoft_symbol, NULL, 0, 0}, + {"apple-roman", NULL, 256, 0, apple_roman, NULL, 0, 0}, + {NULL, NULL, 0, 0, NULL, NULL, 0, 0} }; -static FontEncPtr font_encodings=NULL; +static FontEncPtr font_encodings = NULL; static void define_initial_encoding_info(void) @@ -572,25 +612,24 @@ define_initial_encoding_info(void) FontMapPtr mapping; font_encodings = initial_encodings; - for(encoding = font_encodings; ; encoding++) { + for (encoding = font_encodings; ; encoding++) { encoding->next = encoding + 1; - for(mapping = encoding->mappings; ; mapping++) { - mapping->next = mapping+1; + for (mapping = encoding->mappings; ; mapping++) { + mapping->next = mapping + 1; mapping->encoding = encoding; - if(mapping->next->type == 0) { + if (mapping->next->type == 0) { mapping->next = NULL; break; } } - if(!encoding->next->name) { + if (!encoding->next->name) { encoding->next = NULL; break; } } } - -char* +char * FontEncFromXLFD(const char *name, int length) { const char *p; @@ -598,71 +637,77 @@ FontEncFromXLFD(const char *name, int length) static char charset[MAXFONTNAMELEN]; int len; - if(length > MAXFONTNAMELEN - 1) + if (length > MAXFONTNAMELEN - 1) return NULL; - if(name == NULL) + if (name == NULL) p = NULL; else { p = name + length - 1; - while(p > name && *p != '-') + while (p > name && *p != '-') p--; p--; - while(p >= name && *p != '-') + while (p >= name && *p != '-') p--; - if(p <= name) + if (p <= name) p = NULL; } /* now p either is null or points at the '-' before the charset registry */ - if(p == NULL) + if (p == NULL) return NULL; len = length - (p - name) - 1; - memcpy(charset, p+1, len); + memcpy(charset, p + 1, len); charset[len] = 0; /* check for a subset specification */ - if((q = strchr(charset, (int)'['))) + if ((q = strchr(charset, (int) '['))) *q = 0; return charset; } unsigned -FontEncRecode(unsigned code, FontMapPtr mapping) +FontEncRecode(unsigned code, FontMapPtr mapping) { FontEncPtr encoding = mapping->encoding; - if(encoding && mapping->recode) { - if(encoding->row_size == 0) { + + if (encoding && mapping->recode) { + if (encoding->row_size == 0) { /* linear encoding */ - if(code < encoding->first || code>=encoding->size) - return 0; - } else { - /* matrix encoding */ - int row = code/0x100, col = code&0xFF; - if(row < encoding->first || row >= encoding->size || - col < encoding->first_col || col >= encoding->row_size) + if (code < encoding->first || code >= encoding->size) return 0; } - return (*mapping->recode)(code, mapping->client_data); - } else + else { + /* matrix encoding */ + int row = code / 0x100, col = code & 0xFF; + + if (row < encoding->first || row >= encoding->size || + col < encoding->first_col || col >= encoding->row_size) + return 0; + } + return (*mapping->recode) (code, mapping->client_data); + } + else return code; } -char* +char * FontEncName(unsigned code, FontMapPtr mapping) { FontEncPtr encoding = mapping->encoding; - if(encoding && mapping->name) { - if((encoding->row_size == 0 && code >= encoding->size) || - (encoding->row_size != 0 && - (code/0x100 >= encoding->size || - (code&0xFF) >= encoding->row_size))) + + if (encoding && mapping->name) { + if ((encoding->row_size == 0 && code >= encoding->size) || + (encoding->row_size != 0 && + (code / 0x100 >= encoding->size || + (code & 0xFF) >= encoding->row_size))) return NULL; - return (*mapping->name)(code, mapping->client_data); - } else + return (*mapping->name) (code, mapping->client_data); + } + else return NULL; } @@ -672,18 +717,19 @@ FontEncFind(const char *encoding_name, const char *filename) FontEncPtr encoding; char **alias; - if(font_encodings == NULL) define_initial_encoding_info(); + if (font_encodings == NULL) + define_initial_encoding_info(); - for(encoding = font_encodings; encoding; encoding = encoding->next) { - if(!strcasecmp(encoding->name, encoding_name)) + for (encoding = font_encodings; encoding; encoding = encoding->next) { + if (!strcasecmp(encoding->name, encoding_name)) return encoding; - if(encoding->aliases) - for(alias=encoding->aliases; *alias; alias++) - if(!strcasecmp(*alias, encoding_name)) + if (encoding->aliases) + for (alias = encoding->aliases; *alias; alias++) + if (!strcasecmp(*alias, encoding_name)) return encoding; - } + } - /* Unknown charset, try to load a definition file */ + /* Unknown charset, try to load a definition file */ return FontEncLoad(encoding_name, filename); } @@ -691,15 +737,16 @@ FontMapPtr FontMapFind(FontEncPtr encoding, int type, int pid, int eid) { FontMapPtr mapping; - if(encoding == NULL) + + if (encoding == NULL) return NULL; - for(mapping = encoding->mappings; mapping; mapping = mapping->next) { - if(mapping->type != type) + for (mapping = encoding->mappings; mapping; mapping = mapping->next) { + if (mapping->type != type) continue; - if(pid > 0 && mapping->pid != pid) + if (pid > 0 && mapping->pid != pid) continue; - if(eid > 0 && mapping->eid != eid) + if (eid > 0 && mapping->eid != eid) continue; return mapping; } @@ -714,7 +761,7 @@ FontEncMapFind(const char *encoding_name, int type, int pid, int eid, FontMapPtr mapping; encoding = FontEncFind(encoding_name, filename); - if(encoding == NULL) + if (encoding == NULL) return NULL; mapping = FontMapFind(encoding, type, pid, eid); return mapping; @@ -728,24 +775,26 @@ FontEncLoad(const char *encoding_name, const char *filename) encoding = FontEncReallyLoad(encoding_name, filename); if (encoding == NULL) { return NULL; - } else { + } + else { char **alias; int found = 0; /* Check whether the name is already known for this encoding */ - if(strcasecmp(encoding->name, encoding_name) == 0) { + if (strcasecmp(encoding->name, encoding_name) == 0) { found = 1; - } else { - if(encoding->aliases) { - for(alias=encoding->aliases; *alias; alias++) - if(!strcasecmp(*alias, encoding_name)) { + } + else { + if (encoding->aliases) { + for (alias = encoding->aliases; *alias; alias++) + if (!strcasecmp(*alias, encoding_name)) { found = 1; break; } } } - if(!found) { + if (!found) { /* Add a new alias. This works because we know that this particular encoding has been allocated dynamically */ char **new_aliases; @@ -753,29 +802,30 @@ FontEncLoad(const char *encoding_name, const char *filename) int numaliases = 0; new_name = strdup(encoding_name); - if(new_name == NULL) + if (new_name == NULL) return NULL; - if(encoding->aliases) { - for(alias = encoding->aliases; *alias; alias++) + if (encoding->aliases) { + for (alias = encoding->aliases; *alias; alias++) numaliases++; } - new_aliases = malloc((numaliases+2)*sizeof(char*)); - if(new_aliases == NULL) { + new_aliases = malloc((numaliases + 2) * sizeof(char *)); + if (new_aliases == NULL) { free(new_name); return NULL; } - if(encoding->aliases) { - memcpy(new_aliases, encoding->aliases, numaliases*sizeof(char*)); + if (encoding->aliases) { + memcpy(new_aliases, encoding->aliases, + numaliases * sizeof(char *)); free(encoding->aliases); } new_aliases[numaliases] = new_name; - new_aliases[numaliases+1] = NULL; + new_aliases[numaliases + 1] = NULL; encoding->aliases = new_aliases; } /* register the new encoding */ - encoding->next=font_encodings; - font_encodings=encoding; + encoding->next = font_encodings; + font_encodings = encoding; return encoding; } @@ -789,18 +839,18 @@ FontEncSimpleRecode(unsigned code, void *client_data) map = client_data; - if(code > 0xFFFF || (map->row_size && (code&0xFF) >= map->row_size)) + if (code > 0xFFFF || (map->row_size && (code & 0xFF) >= map->row_size)) return 0; - if(map->row_size) - index = (code&0xFF)+(code>>8)*map->row_size; + if (map->row_size) + index = (code & 0xFF) + (code >> 8) * map->row_size; else index = code; - if(map->map && index>=map->first && indexfirst+map->len) - return map->map[index-map->first]; - else - return code; + if (map->map && index >= map->first && index < map->first + map->len) + return map->map[index - map->first]; + else + return code; } char * @@ -809,8 +859,8 @@ FontEncSimpleName(unsigned code, void *client_data) FontEncSimpleNamePtr map; map = client_data; - if(map && code >= map->first && codefirst+map->len) - return map->map[code-map->first]; + if (map && code >= map->first && code < map->first + map->len) + return map->map[code - map->first]; else return NULL; } @@ -832,21 +882,21 @@ FontEncUndefinedName(unsigned code, void *client_data) #define FONTENC_INVERSE_CODES (FONTENC_SEGMENT_SIZE * FONTENC_SEGMENTS) static unsigned int -reverse_reverse(unsigned i, void* data) +reverse_reverse(unsigned i, void *data) { int s, j; - unsigned **map = (unsigned**)data; + unsigned **map = (unsigned **) data; - if(i >= FONTENC_INVERSE_CODES) + if (i >= FONTENC_INVERSE_CODES) return 0; - if(map == NULL) + if (map == NULL) return 0; s = i / FONTENC_SEGMENT_SIZE; j = i % FONTENC_SEGMENT_SIZE; - if(map[s] == NULL) + if (map[s] == NULL) return 0; else return map[s][j]; @@ -857,17 +907,17 @@ tree_set(unsigned int **map, unsigned int i, unsigned int j) { int s, c; - if(i >= FONTENC_INVERSE_CODES) + if (i >= FONTENC_INVERSE_CODES) return FALSE; s = i / FONTENC_SEGMENT_SIZE; c = i % FONTENC_SEGMENT_SIZE; - if(map[s] == NULL) { + if (map[s] == NULL) { map[s] = calloc(FONTENC_SEGMENT_SIZE, sizeof(int)); - if(map[s] == NULL) + if (map[s] == NULL) return FALSE; - } + } map[s][c] = j; return TRUE; @@ -881,37 +931,41 @@ FontMapReverse(FontMapPtr mapping) unsigned int **map = NULL; int i, j, k; - if(encoding == NULL) goto bail; + if (encoding == NULL) + goto bail; - map = calloc(FONTENC_SEGMENTS, sizeof(int*)); - if(map == NULL) goto bail; + map = calloc(FONTENC_SEGMENTS, sizeof(int *)); + if (map == NULL) + goto bail; - if(encoding->row_size == 0) { - for(i = encoding->first; i < encoding->size; i++) { + if (encoding->row_size == 0) { + for (i = encoding->first; i < encoding->size; i++) { k = FontEncRecode(i, mapping); - if(k != 0) - if(!tree_set(map, k, i)) + if (k != 0) + if (!tree_set(map, k, i)) goto bail; } - } else { - for(i = encoding->first; i < encoding->size; i++) { - for(j = encoding->first_col; j < encoding->row_size; j++) { - k = FontEncRecode(i*256 + j, mapping); - if(k != 0) - if(!tree_set(map, k, i*256+j)) + } + else { + for (i = encoding->first; i < encoding->size; i++) { + for (j = encoding->first_col; j < encoding->row_size; j++) { + k = FontEncRecode(i * 256 + j, mapping); + if (k != 0) + if (!tree_set(map, k, i * 256 + j)) goto bail; } } } reverse = malloc(sizeof(FontMapReverseRec)); - if(!reverse) goto bail; + if (!reverse) + goto bail; reverse->reverse = reverse_reverse; reverse->data = map; return reverse; - bail: + bail: free(map); free(reverse); return NULL; @@ -920,14 +974,14 @@ FontMapReverse(FontMapPtr mapping) void FontMapReverseFree(FontMapReversePtr delendum) { - unsigned int **map = (unsigned int**)delendum; + unsigned int **map = (unsigned int **) delendum; int i; - if(map == NULL) + if (map == NULL) return; - for(i = 0; i < FONTENC_SEGMENTS; i++) - free(map[i]); + for (i = 0; i < FONTENC_SEGMENTS; i++) + free(map[i]); free(map); return; diff --git a/lib/libfontenc/src/fontencI.h b/lib/libfontenc/src/fontencI.h index 9bba85ee1..a9c269839 100644 --- a/lib/libfontenc/src/fontencI.h +++ b/lib/libfontenc/src/fontencI.h @@ -24,7 +24,7 @@ THE SOFTWARE. /* Used by the files `fontenc.h' and `encparse.h' */ typedef struct _FontEncSimpleMap { - unsigned len; /* might be 0x10000 */ + unsigned len; /* might be 0x10000 */ unsigned short row_size; unsigned short first; const unsigned short *map; @@ -36,9 +36,9 @@ typedef struct _FontEncSimpleName { char **map; } FontEncSimpleNameRec, *FontEncSimpleNamePtr; -unsigned FontEncSimpleRecode(unsigned, void*); -unsigned FontEncUndefinedRecode(unsigned, void*); -char *FontEncSimpleName(unsigned, void*); -char *FontEncUndefinedName(unsigned, void*); +unsigned FontEncSimpleRecode(unsigned, void *); +unsigned FontEncUndefinedRecode(unsigned, void *); +char *FontEncSimpleName(unsigned, void *); +char *FontEncUndefinedName(unsigned, void *); -FontEncPtr FontEncReallyLoad(const char*, const char*); +FontEncPtr FontEncReallyLoad(const char *, const char *);