libxfont: Changes to 'debian-unstable'
ChangeLog | 191 +++++++++++++++++++++++++++
Makefile.am | 6
configure.ac | 20 +-
debian/changelog | 5
devbook.am | 46 ++----
doc/fontlib.xml | 114 +++++-----------
include/X11/fonts/bdfint.h | 16 +-
include/X11/fonts/bitmap.h | 18 +-
include/X11/fonts/fntfil.h | 94 ++++++-------
include/X11/fonts/fntfilst.h | 40 ++---
include/X11/fonts/fontmisc.h | 8 -
include/X11/fonts/fontutil.h | 10 -
include/X11/fonts/pcf.h | 4
src/FreeType/ftenc.c | 30 ++--
src/FreeType/ftfuncs.c | 278 ++++++++++++++++++++--------------------
src/FreeType/ftfuncs.h | 10 -
src/FreeType/fttools.c | 8 -
src/FreeType/xttcap.c | 40 ++---
src/FreeType/xttcap.h | 4
src/Makefile.am | 6
src/bitmap/bdfread.c | 40 +++--
src/bitmap/bdfutils.c | 21 +--
src/bitmap/bitmap.c | 8 -
src/bitmap/bitmapfunc.c | 12 -
src/bitmap/bitscale.c | 106 +++++++--------
src/bitmap/fontink.c | 2
src/bitmap/pcfread.c | 54 ++++---
src/bitmap/pcfwrite.c | 7 -
src/bitmap/snfread.c | 18 +-
src/bitmap/snfstr.h | 2
src/builtins/buildfont | 2
src/builtins/builtin.h | 4
src/builtins/dir.c | 4
src/builtins/file.c | 4
src/builtins/fonts.c | 2
src/builtins/fpe.c | 2
src/builtins/render.c | 2
src/fc/fsconvert.c | 52 +++----
src/fc/fserve.c | 296 +++++++++++++++++++++----------------------
src/fc/fservestr.h | 18 +-
src/fc/fsio.c | 26 +--
src/fc/fsio.h | 8 -
src/fc/fslibos.h | 2
src/fc/fstrans.c | 2
src/fontfile/bitsource.c | 16 +-
src/fontfile/bunzip2.c | 12 -
src/fontfile/catalogue.c | 34 ++--
src/fontfile/decompress.c | 61 +++-----
src/fontfile/dirfile.c | 8 -
src/fontfile/fontdir.c | 16 +-
src/fontfile/fontencc.c | 2
src/fontfile/fontfile.c | 80 +++++------
src/fontfile/fontscale.c | 8 -
src/fontfile/gunzip.c | 14 +-
src/fontfile/register.c | 2
src/fontfile/renderers.c | 4
src/stubs/Makefile.am | 2
src/stubs/regfpefunc.c | 30 ++--
src/stubs/rmfshdl.c | 2
src/stubs/stubs.h | 4
src/util/atom.c | 8 -
src/util/fontaccel.c | 4
src/util/fontutil.c | 28 ++--
src/util/fontxlfd.c | 18 --
src/util/format.c | 22 +--
src/util/patcache.c | 14 +-
src/util/private.c | 4
src/util/utilbitmap.c | 22 +--
68 files changed, 1101 insertions(+), 956 deletions(-)
New commits:
commit bb0a79fffebae7027c1ec0dd42d4aff6005e5fe1
Author: Cyril Brulebois <kibi@debian.org>
Date: Sun Mar 4 09:25:07 2012 +0000
Upload to unstable.
diff --git a/debian/changelog b/debian/changelog
index 888aa48..96e4ebc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-libxfont (1:1.4.5-1) UNRELEASED; urgency=low
+libxfont (1:1.4.5-1) unstable; urgency=low
[ Cyril Brulebois ]
* New upstream release.
@@ -15,7 +15,7 @@ libxfont (1:1.4.5-1) UNRELEASED; urgency=low
[ Julien Cristau ]
* Remove David Nusinow from Uploaders.
- -- Cyril Brulebois <kibi@debian.org> Mon, 02 Jan 2012 04:46:05 +0100
+ -- Cyril Brulebois <kibi@debian.org> Sun, 04 Mar 2012 09:24:59 +0000
libxfont (1:1.4.4-1) unstable; urgency=high
commit 255d16b6c4457cc538240f386dae38595d90f191
Author: Cyril Brulebois <kibi@debian.org>
Date: Sun Mar 4 10:18:25 2012 +0100
Bump changelogs.
diff --git a/ChangeLog b/ChangeLog
index 4ff7b37..5b797d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,194 @@
+commit 4b67ad5486c322c01a2ca86b0b4af0a74228f813
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Fri Mar 2 10:05:21 2012 -0800
+
+ libXfont 1.4.5
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 3f87a8b0b86de83ea8944a53de82caf254a9988a
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Fri Oct 21 20:49:50 2011 -0700
+
+ Use * precision notation instead of computing sprintf format strings
+
+ Allows gcc to check format strings instead of just warning about them
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+ Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
+
+commit 613faa245437bb948b4c86ea6c7fbb716e38f0bf
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Sun Oct 2 09:30:09 2011 -0700
+
+ Fix printf warnings about incorrect argument types
+
+ Mostly due to difference between sizeof & int on 64-bit platforms
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+ Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
+
+commit f24c559bcb42e3ea9321c3e6a9ecf0720a581e33
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Sun Oct 2 09:19:47 2011 -0700
+
+ Add _X_ATTRIBUTE_PRINTF to *Error/*Warning functions taking printf formats
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+ Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
+
+commit 3715cd752bac912a56aa1cbb9dd874624a709aab
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Sun Oct 2 09:16:05 2011 -0700
+
+ Add const attributes to fix gcc -Wwrite-strings warnings
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+ Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
+
+commit 8d130ac0fcf19e0e0dd0a404d9317fd8860baad4
+Author: Tomas Hoger <thoger@redhat.com>
+Date: Mon Oct 10 14:38:06 2011 -0700
+
+ Support compress files with maxbits < 12
+
+ The compress decompression code used by libXfont rejects valid archives
+ with maxbits less than 12 (compress allows values 9 - 16, 16 is the
+ default). This is because maxbits-12 is used as index to hsize_table[].
+
+ That looks like an incorrect port of the original compress code, where:
+ - hsize depended on BITS, the maximum maxbits value supported by particular
+ build, rather than on maxbits value from the particular input file
+ - the same hsize was used for all BITS <= 12
+
+ The quick way to verify the problem is:
+ compress -b 11 fontfile.bdf
+ bdftopcf -o /dev/null fontfile.bdf.Z
+ which fails, while 12-16 works correctly.
+
+ This fix removes hsize_table and uses 1 << maxbits (aka maxmaxcode) as
+ tab_prefix size. As decompression code does not use hashing as compression
+ code, there does not seem to be a reason to allocate any extra space.
+
+ Note: In this fix, maxbits == 9 is still rejected early. AFAICS compress
+ is able to generate such files (unknown how correct such output is), but is
+ unable to uncompress them correctly.
+
+ Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
+
+commit bb97dbf56dff50bef936c0631587ed08dd6c8fa9
+Author: Matt Dew <marcoz@osource.org>
+Date: Mon Oct 3 20:23:47 2011 -0600
+
+ 1 - fix the capitalization of the ID attriutes to match either the
+ <title> or <funcdef> string it goes with.
+ 2 - fix any <linkend>'s that were affected by 1.
+ 3 - any <function> in the docs that has an actual funcdef,
+ will become an olink.
+
+ Signed-off-by: Matt Dew <marcoz@osource.org>
+
+commit c73a0e09a2713d0dc16ca5cd9d288b8868846a19
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date: Thu Sep 22 14:00:36 2011 -0400
+
+ doc: fix typo in copyright statement
+
+ Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit d86d8f34f5c2ac5c80230aea2de49bb97eaf5f92
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date: Thu Sep 22 09:20:38 2011 -0400
+
+ doc: refactor legal text for multi licensing copyrights
+
+ Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 43d587d89bee679850bb18ff25aa77c961712728
+Author: Olli Vertanen <olli.vertanen@symbio.com>
+Date: Tue Sep 6 19:00:55 2011 +0000
+
+ libxfont: An uninitialized pointer causes a crash if pcf header is corrupted.
+
+ If pcfReadTOC() or pcfGetProperties() fail in the beginning
+ of execution of pcfReadFont(), function tries to free an
+ uninitialized pointer (isStringProp) when bailing out.
+
+ The pointer gets now initialized correctly.
+
+ Signed-off-by: Olli Vertanen <olli.vertanen@symbio.com>
+ Reviewed-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
+
+commit 73e6c94a351c891ed85446df84c9a30a4224f478
+Author: Joerg Sonnenberger <joerg@britannica.bec.de>
+Date: Sun Aug 21 19:07:51 2011 +0200
+
+ Fix empty statement in if conditional.
+
+ Assume for a moment that the intention here is to do
+ something useful.
+
+ Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr>
+
+commit bd48ad11fd11412c62c3ac8ed5d52c4f10a985aa
+Author: Joerg Sonnenberger <joerg@britannica.bec.de>
+Date: Sun Aug 21 18:51:53 2011 +0200
+
+ Do proper input validation to fix for CVE-2011-2895.
+
+ It ensures that all valid input can be decompressed, checks that the
+ overflow conditions doesn't happen and generally tightens the
+ validation of the LZW stream and doesn't pessimize the inner loop for
+ no good reason. It's derived from a change in libarchive from 2004.
+
+ Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr>
+ Reviewed-by: Tomas Hoger <thoger@redhat.com>
+
+commit 098ab294deed98371ee362fadafcf2e510e0cc50
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Fri Sep 16 22:21:21 2011 -0700
+
+ Strip trailing whitespace
+
+ Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}'
+ git diff -w & git diff -b show no diffs from this change
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 211368b8d04ed13ba520de2dd49a875cb1d663a7
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date: Mon Sep 12 11:09:50 2011 -0400
+
+ docs: use the &fullrelvers; entity to set X11 release information
+
+ Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 425ee265c61b3815a0ef1e4e0445dc91921d71ee
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date: Fri Sep 9 13:08:04 2011 -0400
+
+ devbook.am: maintenance update from docbook.am
+
+ The developer docs are generated from a subset of docbook.am
+ which is sometimes updated.
+
+ The one difference is the embedded css style in the HEAD element.
+
+ Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 1c7cfd7a2b89329f27951c0437f925dd3301e3de
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Wed Aug 10 22:19:44 2011 -0700
+
+ Remove configure comment about synchronizing version numbers
+
+ This appears to have been a mistaken copy-and-paste from something like
+ libXcursor - I can't find any Xfont.h header, nor any libXfont header
+ containing a version number.
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+ Reviewed-by: Matthieu Herrb <matthieu.herrb@laas.fr>
+
commit a7970f5c817b5c75d945389cfaf1384ff23437f3
Author: Matthieu Herrb <matthieu.herrb@laas.fr>
Date: Mon Aug 8 18:08:05 2011 +0200
diff --git a/debian/changelog b/debian/changelog
index 52009dd..888aa48 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
-libxfont (1:1.4.4-2) UNRELEASED; urgency=low
+libxfont (1:1.4.5-1) UNRELEASED; urgency=low
[ Cyril Brulebois ]
+ * New upstream release.
* Switch to dh:
- Bump debhelper build-dep and compat.
- Rewrite debian/rules, using autoreconf and quilt sequences.
commit 4b67ad5486c322c01a2ca86b0b4af0a74228f813
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Mar 2 10:05:21 2012 -0800
libXfont 1.4.5
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
diff --git a/configure.ac b/configure.ac
index 8cff1d8..b274a8f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
-AC_INIT([libXfont], [1.4.4],
+AC_INIT([libXfont], [1.4.5],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXfont])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h include/X11/fonts/fontconf.h])
commit 3f87a8b0b86de83ea8944a53de82caf254a9988a
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Oct 21 20:49:50 2011 -0700
Use * precision notation instead of computing sprintf format strings
Allows gcc to check format strings instead of just warning about them
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
diff --git a/src/util/fontxlfd.c b/src/util/fontxlfd.c
index 18046e9..974128e 100644
--- a/src/util/fontxlfd.c
+++ b/src/util/fontxlfd.c
@@ -116,7 +116,6 @@ readreal(char *ptr, double *result)
static char *
xlfd_double_to_text(double value, char *buffer, int space_required)
{
- char formatbuf[40];
register char *p1;
int ndigits, exponent;
@@ -132,14 +131,12 @@ xlfd_double_to_text(double value, char *buffer, int space_required)
minus = locale->negative_sign;
}
#endif
- /* Compute a format to use to render the number */
- sprintf(formatbuf, "%%.%dle", XLFD_NDIGITS);
if (space_required)
*buffer++ = ' ';
/* Render the number using printf's idea of formatting */
- sprintf(buffer, formatbuf, value);
+ sprintf(buffer, "%.*le", XLFD_NDIGITS, value);
/* Find and read the exponent value */
for (p1 = buffer + strlen(buffer);
@@ -156,16 +153,14 @@ xlfd_double_to_text(double value, char *buffer, int space_required)
if (exponent >= XLFD_NDIGITS || ndigits - exponent > XLFD_NDIGITS + 1)
{
/* Scientific */
- sprintf(formatbuf, "%%.%dle", ndigits - 1);
- sprintf(buffer, formatbuf, value);
+ sprintf(buffer, "%.*le", ndigits - 1, value);
}
else
{
/* Fixed */
ndigits -= exponent + 1;
if (ndigits < 0) ndigits = 0;
- sprintf(formatbuf, "%%.%dlf", ndigits);
- sprintf(buffer, formatbuf, value);
+ sprintf(buffer, "%.*lf", ndigits, value);
if (exponent < 0)
{
p1 = buffer;
@@ -265,10 +260,9 @@ xlfd_round_double(double x)
* If not IEEE 754: Let printf() do it for you.
*/
- char formatbuf[40], buffer[40];
+ char buffer[40];
- sprintf(formatbuf, "%%.%dlg", XLFD_NDIGITS);
- sprintf(buffer, formatbuf, x);
+ sprintf(buffer, "%.*lg", XLFD_NDIGITS, x);
return atof(buffer);
}
}
commit 613faa245437bb948b4c86ea6c7fbb716e38f0bf
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Oct 2 09:30:09 2011 -0700
Fix printf warnings about incorrect argument types
Mostly due to difference between sizeof & int on 64-bit platforms
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
diff --git a/src/bitmap/bdfread.c b/src/bitmap/bdfread.c
index 0fed688..e2770dc 100644
--- a/src/bitmap/bdfread.c
+++ b/src/bitmap/bdfread.c
@@ -291,13 +291,13 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
}
if (nchars > INT32_MAX / sizeof(CharInfoRec)) {
bdfError("Couldn't allocate pCI (%d*%d)\n", nchars,
- sizeof(CharInfoRec));
+ (int) sizeof(CharInfoRec));
goto BAILOUT;
}
ci = calloc(nchars, sizeof(CharInfoRec));
if (!ci) {
bdfError("Couldn't allocate pCI (%d*%d)\n", nchars,
- sizeof(CharInfoRec));
+ (int) sizeof(CharInfoRec));
goto BAILOUT;
}
bitmapFont->metrics = ci;
@@ -306,7 +306,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
bitmapExtra->glyphNames = malloc(nchars * sizeof(Atom));
if (!bitmapExtra->glyphNames) {
bdfError("Couldn't allocate glyphNames (%d*%d)\n",
- nchars, sizeof(Atom));
+ nchars, (int) sizeof(Atom));
goto BAILOUT;
}
}
@@ -314,7 +314,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
bitmapExtra->sWidths = malloc(nchars * sizeof(int));
if (!bitmapExtra->sWidths) {
bdfError("Couldn't allocate sWidth (%d *%d)\n",
- nchars, sizeof(int));
+ nchars, (int) sizeof(int));
return FALSE;
}
}
@@ -380,7 +380,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
bdfEncoding[char_row] = malloc(256 * sizeof(CharInfoPtr));
if (!bdfEncoding[char_row]) {
bdfError("Couldn't allocate row %d of encoding (%d*%d)\n",
- char_row, INDICES, sizeof(CharInfoPtr));
+ char_row, INDICES, (int) sizeof(CharInfoPtr));
goto BAILOUT;
}
for (i = 0; i < 256; i++)
@@ -490,7 +490,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
if (!bitmapFont->encoding) {
bdfError("Couldn't allocate ppCI (%d,%d)\n",
NUM_SEGMENTS(nencoding),
- sizeof(CharInfoPtr*));
+ (int) sizeof(CharInfoPtr*));
goto BAILOUT;
}
pFont->info.allExist = TRUE;
@@ -610,14 +610,14 @@ bdfReadProperties(FontFilePtr file, FontPtr pFont, bdfFileState *pState)
pFont->info.isStringProp = stringProps;
if (stringProps == NULL) {
bdfError("Couldn't allocate stringProps (%d*%d)\n",
- (nProps + BDF_GENPROPS), sizeof(Bool));
+ (nProps + BDF_GENPROPS), (int) sizeof(Bool));
goto BAILOUT;
}
pFont->info.props = props = calloc(nProps + BDF_GENPROPS,
sizeof(FontPropRec));
if (props == NULL) {
bdfError("Couldn't allocate props (%d*%d)\n", nProps + BDF_GENPROPS,
- sizeof(FontPropRec));
+ (int) sizeof(FontPropRec));
goto BAILOUT;
}
@@ -800,7 +800,8 @@ bdfReadFont(FontPtr pFont, FontFilePtr file,
bitmapFont = calloc(1, sizeof(BitmapFontRec));
if (!bitmapFont) {
- bdfError("Couldn't allocate bitmapFontRec (%d)\n", sizeof(BitmapFontRec));
+ bdfError("Couldn't allocate bitmapFontRec (%d)\n",
+ (int) sizeof(BitmapFontRec));
goto BAILOUT;
}
@@ -813,7 +814,8 @@ bdfReadFont(FontPtr pFont, FontFilePtr file,
bitmapFont->bitmapExtra = calloc(1, sizeof(BitmapExtraRec));
if (!bitmapFont->bitmapExtra) {
- bdfError("Couldn't allocate bitmapExtra (%d)\n", sizeof(BitmapExtraRec));
+ bdfError("Couldn't allocate bitmapExtra (%d)\n",
+ (int) sizeof(BitmapExtraRec));
goto BAILOUT;
}
diff --git a/src/bitmap/bdfutils.c b/src/bitmap/bdfutils.c
index 3a3ee26..288148b 100644
--- a/src/bitmap/bdfutils.c
+++ b/src/bitmap/bdfutils.c
@@ -174,8 +174,9 @@ bdfGetPropertyValue(char *s)
s++;
pp = p = malloc((unsigned) strlen(s) + 1);
if (pp == NULL) {
- bdfError("Couldn't allocate property value string (%d)\n", strlen(s) + 1);
- return None;
+ bdfError("Couldn't allocate property value string (%d)\n",
+ (int) strlen(s) + 1);
+ return None;
}
while (*s) {
if (*s == '"') {
@@ -191,7 +192,7 @@ bdfGetPropertyValue(char *s)
*p++ = *s++;
}
free (pp);
- bdfError("unterminated quoted string property: %s\n", (pointer) orig_s);
+ bdfError("unterminated quoted string property: %s\n", orig_s);
return None;
}
diff --git a/src/bitmap/pcfread.c b/src/bitmap/pcfread.c
index cf2f696..34eeeb7 100644
--- a/src/bitmap/pcfread.c
+++ b/src/bitmap/pcfread.c
@@ -138,7 +138,8 @@ pcfReadTOC(FontFilePtr file, int *countp)
}
tables = malloc(count * sizeof(PCFTableRec));
if (!tables) {
- pcfError("pcfReadTOC(): Couldn't allocate tables (%d*%d)\n", count, sizeof(PCFTableRec));
+ pcfError("pcfReadTOC(): Couldn't allocate tables (%d*%d)\n",
+ count, (int) sizeof(PCFTableRec));
return (PCFTablePtr) NULL;
}
for (i = 0; i < count; i++) {
@@ -262,12 +263,14 @@ pcfGetProperties(FontInfoPtr pFontInfo, FontFilePtr file,
if (IS_EOF(file)) goto Bail;
props = malloc(nprops * sizeof(FontPropRec));
if (!props) {
- pcfError("pcfGetProperties(): Couldn't allocate props (%d*%d)\n", nprops, sizeof(FontPropRec));
+ pcfError("pcfGetProperties(): Couldn't allocate props (%d*%d)\n",
+ nprops, (int) sizeof(FontPropRec));
goto Bail;
}
isStringProp = malloc(nprops * sizeof(char));
if (!isStringProp) {
- pcfError("pcfGetProperties(): Couldn't allocate isStringProp (%d*%d)\n", nprops, sizeof(char));
+ pcfError("pcfGetProperties(): Couldn't allocate isStringProp (%d*%d)\n",
+ nprops, (int) sizeof(char));
goto Bail;
}
for (i = 0; i < nprops; i++) {
@@ -277,7 +280,7 @@ pcfGetProperties(FontInfoPtr pFontInfo, FontFilePtr file,
if (props[i].name < 0
|| (isStringProp[i] != 0 && isStringProp[i] != 1)
|| (isStringProp[i] && props[i].value < 0)) {
- pcfError("pcfGetProperties(): invalid file format %d %d %d\n",
+ pcfError("pcfGetProperties(): invalid file format %ld %d %ld\n",
props[i].name, isStringProp[i], props[i].value);
goto Bail;
}
@@ -445,7 +448,8 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
}
metrics = malloc(nmetrics * sizeof(CharInfoRec));
if (!metrics) {
- pcfError("pcfReadFont(): Couldn't allocate metrics (%d*%d)\n", nmetrics, sizeof(CharInfoRec));
+ pcfError("pcfReadFont(): Couldn't allocate metrics (%d*%d)\n",
+ nmetrics, (int) sizeof(CharInfoRec));
goto Bail;
}
for (i = 0; i < nmetrics; i++)
@@ -471,7 +475,8 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
/* nmetrics is already ok, so nbitmap also is */
offsets = malloc(nbitmaps * sizeof(CARD32));
if (!offsets) {
- pcfError("pcfReadFont(): Couldn't allocate offsets (%d*%d)\n", nbitmaps, sizeof(CARD32));
+ pcfError("pcfReadFont(): Couldn't allocate offsets (%d*%d)\n",
+ nbitmaps, (int) sizeof(CARD32));
goto Bail;
}
for (i = 0; i < nbitmaps; i++) {
@@ -560,10 +565,11 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
goto Bail;
/* nmetrics already checked */
ink_metrics = malloc(nink_metrics * sizeof(xCharInfo));
- if (!ink_metrics) {
- pcfError("pcfReadFont(): Couldn't allocate ink_metrics (%d*%d)\n", nink_metrics, sizeof(xCharInfo));
+ if (!ink_metrics) {
+ pcfError("pcfReadFont(): Couldn't allocate ink_metrics (%d*%d)\n",
+ nink_metrics, (int) sizeof(xCharInfo));
goto Bail;
- }
+ }
for (i = 0; i < nink_metrics; i++)
if (PCF_FORMAT_MATCH(format, PCF_DEFAULT_FORMAT)) {
if (!pcfGetMetric(file, format, ink_metrics + i))
@@ -597,7 +603,8 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
encoding = calloc(NUM_SEGMENTS(nencoding), sizeof(CharInfoPtr*));
if (!encoding) {
- pcfError("pcfReadFont(): Couldn't allocate encoding (%d*%d)\n", nencoding, sizeof(CharInfoPtr));
+ pcfError("pcfReadFont(): Couldn't allocate encoding (%d*%d)\n",
+ nencoding, (int) sizeof(CharInfoPtr));
goto Bail;
}
@@ -626,7 +633,8 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
bitmapFont = malloc(sizeof *bitmapFont);
if (!bitmapFont) {
- pcfError("pcfReadFont(): Couldn't allocate bitmapFont (%d)\n", sizeof *bitmapFont);
+ pcfError("pcfReadFont(): Couldn't allocate bitmapFont (%d)\n",
+ (int) sizeof *bitmapFont);
goto Bail;
}
diff --git a/src/bitmap/pcfwrite.c b/src/bitmap/pcfwrite.c
index b4abff4..0874c4b 100644
--- a/src/bitmap/pcfwrite.c
+++ b/src/bitmap/pcfwrite.c
@@ -236,7 +236,8 @@ pcfWriteFont(FontPtr pFont, FontFilePtr file)
}
offsetProps = malloc(pFont->info.nprops * sizeof(FontPropRec));
if (!offsetProps) {
- pcfError("pcfWriteFont(): Couldn't allocate offsetProps (%d*%d)", pFont->info.nprops, sizeof(FontPropRec));
+ pcfError("pcfWriteFont(): Couldn't allocate offsetProps (%d*%d)",
+ pFont->info.nprops, (int) sizeof(FontPropRec));
return AllocError;
}
prop_string_size = 0;
diff --git a/src/bitmap/snfread.c b/src/bitmap/snfread.c
index b2b0c67..da362c8 100644
--- a/src/bitmap/snfread.c
+++ b/src/bitmap/snfread.c
@@ -454,12 +454,14 @@ snfReadFontInfo(FontInfoPtr pFontInfo, FontFilePtr file)
pFontInfo->props = malloc(fi.nProps * sizeof(FontPropRec));
if (!pFontInfo->props) {
- snfError("snfReadFontInfo(): Couldn't allocate props (%d*%d)\n", fi.nProps, sizeof(FontPropRec));
+ snfError("snfReadFontInfo(): Couldn't allocate props (%d*%d)\n",
+ fi.nProps, (int) sizeof(FontPropRec));
return AllocError;
}
pFontInfo->isStringProp = malloc(fi.nProps * sizeof(char));
if (!pFontInfo->isStringProp) {
- snfError("snfReadFontInfo(): Couldn't allocate isStringProp (%d*%d)\n", fi.nProps, sizeof(char));
+ snfError("snfReadFontInfo(): Couldn't allocate isStringProp (%d*%d)\n",
+ fi.nProps, (int) sizeof(char));
free(pFontInfo->props);
return AllocError;
}
commit f24c559bcb42e3ea9321c3e6a9ecf0720a581e33
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Oct 2 09:19:47 2011 -0700
Add _X_ATTRIBUTE_PRINTF to *Error/*Warning functions taking printf formats
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
diff --git a/include/X11/fonts/bdfint.h b/include/X11/fonts/bdfint.h
index c037b99..cc464cb 100644
--- a/include/X11/fonts/bdfint.h
+++ b/include/X11/fonts/bdfint.h
@@ -65,8 +65,8 @@ typedef struct BDFSTAT {
BOOL haveDefaultCh;
} bdfFileState;
-extern void bdfError ( const char * message, ... );
-extern void bdfWarning ( const char *message, ... );
+extern void bdfError ( const char * message, ... ) _X_ATTRIBUTE_PRINTF(1, 2);
+extern void bdfWarning ( const char *message, ... ) _X_ATTRIBUTE_PRINTF(1, 2);
extern unsigned char * bdfGetLine ( FontFilePtr file, unsigned char *buf,
int len );
extern Atom bdfForceMakeAtom ( const char *str, int *size );
diff --git a/include/X11/fonts/pcf.h b/include/X11/fonts/pcf.h
index 3d47c66..ddce0a9 100644
--- a/include/X11/fonts/pcf.h
+++ b/include/X11/fonts/pcf.h
@@ -92,6 +92,6 @@ extern int pcfReadFont ( FontPtr pFont, FontFilePtr file,
int bit, int byte, int glyph, int scan );
extern int pcfReadFontInfo ( FontInfoPtr pFontInfo, FontFilePtr file );
extern int pcfWriteFont ( FontPtr pFont, FontFilePtr file );
-extern void pcfError ( const char *, ... );
+extern void pcfError ( const char *, ... ) _X_ATTRIBUTE_PRINTF(1, 2);
#endif /* _PCF_H_ */
diff --git a/src/bitmap/snfread.c b/src/bitmap/snfread.c
index 2f51c48..b2b0c67 100644
--- a/src/bitmap/snfread.c
+++ b/src/bitmap/snfread.c
@@ -60,7 +60,7 @@ from The Open Group.
#include <stdarg.h>
-static void
+static void _X_ATTRIBUTE_PRINTF(1, 2)
snfError(const char* message, ...)
{
va_list args;
commit 3715cd752bac912a56aa1cbb9dd874624a709aab
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Oct 2 09:16:05 2011 -0700
Add const attributes to fix gcc -Wwrite-strings warnings
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
diff --git a/include/X11/fonts/bdfint.h b/include/X11/fonts/bdfint.h
index a8d8459..c037b99 100644
--- a/include/X11/fonts/bdfint.h
+++ b/include/X11/fonts/bdfint.h
@@ -65,11 +65,11 @@ typedef struct BDFSTAT {
BOOL haveDefaultCh;
} bdfFileState;
-extern void bdfError ( char * message, ... );
-extern void bdfWarning ( char *message, ... );
+extern void bdfError ( const char * message, ... );
+extern void bdfWarning ( const char *message, ... );
extern unsigned char * bdfGetLine ( FontFilePtr file, unsigned char *buf,
int len );
-extern Atom bdfForceMakeAtom ( char *str, int *size );
+extern Atom bdfForceMakeAtom ( const char *str, int *size );
extern Atom bdfGetPropertyValue ( char *s );
extern int bdfIsInteger ( char *str );
extern unsigned char bdfHexByte ( unsigned char *s );
diff --git a/include/X11/fonts/fntfil.h b/include/X11/fonts/fntfil.h
index feefdb3..a32df63 100644
--- a/include/X11/fonts/fntfil.h
+++ b/include/X11/fonts/fntfil.h
@@ -138,7 +138,7 @@ extern void FontFileFreeDir ( FontDirectoryPtr dir );
extern void FontFileFreeEntry ( FontEntryPtr entry );
extern void FontFileFreeTable ( FontTablePtr table );
extern Bool FontFileInitTable ( FontTablePtr table, int size );
-extern FontDirectoryPtr FontFileMakeDir ( char *dirName, int size );
+extern FontDirectoryPtr FontFileMakeDir ( const char *dirName, int size );
extern Bool FontFileMatchName ( char *name, int length, FontNamePtr pat );
extern char * FontFileSaveString ( char *s );
extern void FontFileSortDir ( FontDirectoryPtr dir );
diff --git a/include/X11/fonts/fntfilst.h b/include/X11/fonts/fntfilst.h
index 8926f95..6e8645e 100644
--- a/include/X11/fonts/fntfilst.h
+++ b/include/X11/fonts/fntfilst.h
@@ -124,7 +124,7 @@ typedef struct _FontDirectory {
#define CAP_CHARSUBSETTING 0x2
typedef struct _FontRenderer {
- char *fileSuffix;
+ const char *fileSuffix;
int fileSuffixLen;
int (*OpenBitmap)(FontPathElementPtr /* fpe */,
FontPtr * /* pFont */,
diff --git a/include/X11/fonts/fontmisc.h b/include/X11/fonts/fontmisc.h
index 3da1e63..73a8247 100644
--- a/include/X11/fonts/fontmisc.h
+++ b/include/X11/fonts/fontmisc.h
@@ -52,7 +52,7 @@ in this Software without prior written authorization from The Open Group.
#define FALSE 0
#endif
-extern Atom MakeAtom ( char *string, unsigned len, int makeit );
+extern Atom MakeAtom ( const char *string, unsigned len, int makeit );
extern int ValidAtom ( Atom atom );
extern char *NameForAtom (Atom atom);
diff --git a/src/FreeType/ftenc.c b/src/FreeType/ftenc.c
index 3c1d43b..9e31d75 100644
--- a/src/FreeType/ftenc.c
+++ b/src/FreeType/ftenc.c
@@ -43,9 +43,9 @@ THE SOFTWARE.
static int find_cmap(int, int, int, FT_Face, FT_CharMap *);
static int
-FTEncFontSpecific(char *encoding)
+FTEncFontSpecific(const char *encoding)
{
- char *p = encoding;
+ const char *p = encoding;
if(strcasecmp(encoding, "microsoft-symbol") == 0)
return 1;
@@ -69,7 +69,7 @@ FTPickMapping(char *xlfd, int length, char *filename, FT_Face face,
int ftrc;
int symbol = 0;
const char *enc, *reg;
- char *encoding_name = 0;
+ const char *encoding_name = 0;
char buf[20];
if(xlfd)
diff --git a/src/FreeType/ftfuncs.c b/src/FreeType/ftfuncs.c
index b8cf49a..918e3f3 100644
--- a/src/FreeType/ftfuncs.c
+++ b/src/FreeType/ftfuncs.c
@@ -94,7 +94,7 @@ static CharInfoRec noSuchChar = { /* metrics */{0,0,0,0,0,0},
/* The propery names for all the XLFD properties. */
-static char *xlfd_props[] = {
+static const char *xlfd_props[] = {
"FOUNDRY",
"FAMILY_NAME",
"WEIGHT_NAME",
diff --git a/src/bitmap/bdfutils.c b/src/bitmap/bdfutils.c
index a0106b7..3a3ee26 100644
--- a/src/bitmap/bdfutils.c
+++ b/src/bitmap/bdfutils.c
@@ -68,7 +68,7 @@ int bdfFileLineNum;
/***====================================================================***/
void
-bdfError(char* message, ...)
+bdfError(const char* message, ...)
{
va_list args;
@@ -81,7 +81,7 @@ bdfError(char* message, ...)
/***====================================================================***/
void
-bdfWarning(char *message, ...)
+bdfWarning(const char *message, ...)
{
va_list args;
@@ -127,7 +127,7 @@ bdfGetLine(FontFilePtr file, unsigned char *buf, int len)
/***====================================================================***/
Atom
-bdfForceMakeAtom(char *str, int *size)
+bdfForceMakeAtom(const char *str, int *size)
{
register int len = strlen(str);
Atom the_atom;
@@ -249,7 +249,7 @@ bdfHexByte(unsigned char *s)
* check for known special property values
*/
-static char *SpecialAtoms[] = {
+static const char *SpecialAtoms[] = {
"FONT_ASCENT",
#define BDF_FONT_ASCENT 0
"FONT_DESCENT",
@@ -279,8 +279,8 @@ Bool
bdfSpecialProperty(FontPtr pFont, FontPropPtr prop,
char isString, bdfFileState *bdfState)
{
- char **special;
- char *name;
+ const char **special;
+ const char *name;
name = NameForAtom(prop->name);
for (special = SpecialAtoms; *special; special++)
diff --git a/src/bitmap/bitscale.c b/src/bitmap/bitscale.c
index b857237..e89ba7c 100644
--- a/src/bitmap/bitscale.c
+++ b/src/bitmap/bitscale.c
@@ -78,7 +78,7 @@ enum scaleType {
};
typedef struct _fontProp {
- char *name;
+ const char *name;
Atom atom;
enum scaleType type;
} fontProp;
diff --git a/src/builtins/builtin.h b/src/builtins/builtin.h
index d97d9a5..75dff8d 100644
--- a/src/builtins/builtin.h
+++ b/src/builtins/builtin.h
@@ -36,7 +36,7 @@ typedef struct _BuiltinFile {
} BuiltinFileRec, *BuiltinFilePtr;
typedef struct _BuiltinDir {
- char *file_name;
+ const char *file_name;
char *font_name;
} BuiltinDirRec, *BuiltinDirPtr;
diff --git a/src/fc/fsio.c b/src/fc/fsio.c
index 569b3aa..03a689f 100644
--- a/src/fc/fsio.c
+++ b/src/fc/fsio.c
@@ -369,7 +369,7 @@ _fs_io_fini (FSFpePtr conn)
}
static int
-_fs_do_write(FSFpePtr conn, char *data, long len, long size)
+_fs_do_write(FSFpePtr conn, const char *data, long len, long size)
{
if (size == 0) {
#ifdef DEBUG
@@ -403,7 +403,7 @@ _fs_do_write(FSFpePtr conn, char *data, long len, long size)
* Write the indicated bytes
*/
int
-_fs_write (FSFpePtr conn, char *data, long len)
+_fs_write (FSFpePtr conn, const char *data, long len)
{
return _fs_do_write (conn, data, len, len);
}
@@ -412,7 +412,7 @@ _fs_write (FSFpePtr conn, char *data, long len)
* Write the indicated bytes adding any appropriate pad
*/
int
-_fs_write_pad(FSFpePtr conn, char *data, long len)
+_fs_write_pad(FSFpePtr conn, const char *data, long len)
{
return _fs_do_write (conn, data, len, len + padlength[len & 3]);
}
diff --git a/src/fc/fsio.h b/src/fc/fsio.h
index 1d1b3dd..2bb8e0b 100644
--- a/src/fc/fsio.h
+++ b/src/fc/fsio.h
@@ -129,8 +129,8 @@ typedef struct _fs_fpe_data {
#define FSIO_ERROR -1
extern Bool _fs_reopen_server ( FSFpePtr conn );
-extern int _fs_write ( FSFpePtr conn, char *data, long size );
-extern int _fs_write_pad ( FSFpePtr conn, char *data, long len );
+extern int _fs_write ( FSFpePtr conn, const char *data, long size );
+extern int _fs_write_pad ( FSFpePtr conn, const char *data, long len );
extern int _fs_wait_for_readable ( FSFpePtr conn, int ms );
extern long _fs_pad_length (long len);
diff --git a/src/fontfile/fontdir.c b/src/fontfile/fontdir.c
index e524696..97b2ba3 100644
--- a/src/fontfile/fontdir.c
+++ b/src/fontfile/fontdir.c
@@ -102,12 +102,12 @@ FontFileFreeTable (FontTablePtr table)
}
FontDirectoryPtr
-FontFileMakeDir(char *dirName, int size)
+FontFileMakeDir(const char *dirName, int size)
{
FontDirectoryPtr dir;
int dirlen;
int needslash = 0;
- char *attrib;
+ const char *attrib;
int attriblen;
#if !defined(WIN32)
diff --git a/src/util/atom.c b/src/util/atom.c
index 4f69363..c47cb5c 100644
--- a/src/util/atom.c
+++ b/src/util/atom.c
@@ -54,7 +54,7 @@ static int reverseMapSize;
static Atom lastAtom;
static int
-Hash(char *string, int len)
+Hash(const char *string, int len)
{
int h;
@@ -147,7 +147,7 @@ NameEqual (const char *a, const char *b, int l)
#endif
weak Atom
-MakeAtom(char *string, unsigned len, int makeit)
+MakeAtom(const char *string, unsigned len, int makeit)
{
AtomListPtr a;
int hash;
diff --git a/src/util/fontxlfd.c b/src/util/fontxlfd.c
index 8124037..18046e9 100644
--- a/src/util/fontxlfd.c
+++ b/src/util/fontxlfd.c
@@ -70,7 +70,7 @@ GetInt(char *ptr, int *val)
#ifndef NO_LOCALE
static struct lconv *locale = 0;
#endif
-static char *radix = ".", *plus = "+", *minus = "-";
+static const char *radix = ".", *plus = "+", *minus = "-";
Reply to: