aboutsummaryrefslogtreecommitdiff
path: root/libXfont/src/fontfile
diff options
context:
space:
mode:
Diffstat (limited to 'libXfont/src/fontfile')
-rw-r--r--libXfont/src/fontfile/Makefile.in2
-rw-r--r--libXfont/src/fontfile/bitsource.c16
-rw-r--r--libXfont/src/fontfile/catalogue.c26
-rw-r--r--libXfont/src/fontfile/dirfile.c4
-rw-r--r--libXfont/src/fontfile/fontencc.c2
-rw-r--r--libXfont/src/fontfile/fontfile.c84
-rw-r--r--libXfont/src/fontfile/fontscale.c8
-rw-r--r--libXfont/src/fontfile/gunzip.c14
-rw-r--r--libXfont/src/fontfile/renderers.c10
9 files changed, 85 insertions, 81 deletions
diff --git a/libXfont/src/fontfile/Makefile.in b/libXfont/src/fontfile/Makefile.in
index 91da64e99..527859c98 100644
--- a/libXfont/src/fontfile/Makefile.in
+++ b/libXfont/src/fontfile/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.14 from Makefile.am.
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
diff --git a/libXfont/src/fontfile/bitsource.c b/libXfont/src/fontfile/bitsource.c
index 1b79c2bcb..c73f41f9c 100644
--- a/libXfont/src/fontfile/bitsource.c
+++ b/libXfont/src/fontfile/bitsource.c
@@ -101,14 +101,14 @@ FontFileEmptyBitmapSource(void)
}
int
-FontFileMatchBitmapSource (FontPathElementPtr fpe,
- FontPtr *pFont,
- int flags,
- FontEntryPtr entry,
- FontNamePtr zeroPat,
- FontScalablePtr vals,
- fsBitmapFormat format,
- fsBitmapFormatMask fmask,
+FontFileMatchBitmapSource (FontPathElementPtr fpe,
+ FontPtr *pFont,
+ int flags,
+ FontEntryPtr entry,
+ FontNamePtr zeroPat,
+ FontScalablePtr vals,
+ fsBitmapFormat format,
+ fsBitmapFormatMask fmask,
Bool noSpecificSize)
{
int source;
diff --git a/libXfont/src/fontfile/catalogue.c b/libXfont/src/fontfile/catalogue.c
index 623093011..81a1e13f1 100644
--- a/libXfont/src/fontfile/catalogue.c
+++ b/libXfont/src/fontfile/catalogue.c
@@ -40,7 +40,7 @@ static const char CataloguePrefix[] = "catalogue:";
static int CatalogueFreeFPE (FontPathElementPtr fpe);
static int
-CatalogueNameCheck (char *name)
+CatalogueNameCheck (const char *name)
{
return strncmp(name, CataloguePrefix, sizeof(CataloguePrefix) - 1) == 0;
}
@@ -116,7 +116,7 @@ CatalogueUnrefFPEs (FontPathElementPtr fpe)
if (subfpe->refcount == 0)
{
FontFileFreeFPE (subfpe);
- free(subfpe->name);
+ free((void *) subfpe->name);
free(subfpe);
}
}
@@ -158,6 +158,7 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan)
CatalogueUnrefFPEs (fpe);
while (entry = readdir(dir), entry != NULL)
{
+ char *name;
snprintf(link, sizeof link, "%s/%s", path, entry->d_name);
len = readlink(link, dest, sizeof dest - 1);
if (len < 0)
@@ -191,15 +192,16 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan)
* (which uses font->fpe->type) goes to CatalogueCloseFont. */
subfpe->type = fpe->type;
subfpe->name_length = len;
- subfpe->name = malloc (len + 1);
- if (subfpe->name == NULL)
+ name = malloc (len + 1);
+ if (name == NULL)
{
free(subfpe);
continue;
}
- memcpy(subfpe->name, dest, len);
- subfpe->name[len] = '\0';
+ memcpy(name, dest, len);
+ name[len] = '\0';
+ subfpe->name = name;
/* The X server will manipulate the subfpe ref counts
* associated with the font in OpenFont and CloseFont, so we
@@ -208,7 +210,7 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan)
if (FontFileInitFPE (subfpe) != Successful)
{
- free(subfpe->name);
+ free((void *) subfpe->name);
free(subfpe);
continue;
}
@@ -280,7 +282,7 @@ CatalogueFreeFPE (FontPathElementPtr fpe)
static int
CatalogueOpenFont (pointer client, FontPathElementPtr fpe, Mask flags,
- char *name, int namelen,
+ const char *name, int namelen,
fsBitmapFormat format, fsBitmapFormatMask fmask,
XID id, FontPtr *pFont, char **aliasName,
FontPtr non_cachable_font)
@@ -314,7 +316,7 @@ CatalogueCloseFont (FontPathElementPtr fpe, FontPtr pFont)
}
static int
-CatalogueListFonts (pointer client, FontPathElementPtr fpe, char *pat,
+CatalogueListFonts (pointer client, FontPathElementPtr fpe, const char *pat,
int len, int max, FontNamesPtr names)
{
CataloguePtr cat = fpe->private;
@@ -339,7 +341,7 @@ typedef struct _LFWIData {
static int
CatalogueStartListFonts(pointer client, FontPathElementPtr fpe,
- char *pat, int len, int max, pointer *privatep,
+ const char *pat, int len, int max, pointer *privatep,
int mark_aliases)
{
CataloguePtr cat = fpe->private;
@@ -375,7 +377,7 @@ CatalogueStartListFonts(pointer client, FontPathElementPtr fpe,
static int
CatalogueStartListFontsWithInfo(pointer client, FontPathElementPtr fpe,
- char *pat, int len, int max,
+ const char *pat, int len, int max,
pointer *privatep)
{
return CatalogueStartListFonts(client, fpe, pat, len, max, privatep, 0);
@@ -413,7 +415,7 @@ CatalogueListNextFontWithInfo(pointer client, FontPathElementPtr fpe,
static int
CatalogueStartListFontsAndAliases(pointer client, FontPathElementPtr fpe,
- char *pat, int len, int max,
+ const char *pat, int len, int max,
pointer *privatep)
{
return CatalogueStartListFonts(client, fpe, pat, len, max, privatep, 1);
diff --git a/libXfont/src/fontfile/dirfile.c b/libXfont/src/fontfile/dirfile.c
index 639310c31..38ced7573 100644
--- a/libXfont/src/fontfile/dirfile.c
+++ b/libXfont/src/fontfile/dirfile.c
@@ -50,8 +50,10 @@ static int ReadFontAlias ( char *directory, Bool isFile,
static int lexAlias ( FILE *file, char **lexToken );
static int lexc ( FILE *file );
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+
int
-FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir)
+FontFileReadDirectory (const char *directory, FontDirectoryPtr *pdir)
{
char file_name[MAXFONTFILENAMELEN];
char font_name[MAXFONTNAMELEN];
diff --git a/libXfont/src/fontfile/fontencc.c b/libXfont/src/fontfile/fontencc.c
index 79977851d..4bdb495e1 100644
--- a/libXfont/src/fontfile/fontencc.c
+++ b/libXfont/src/fontfile/fontencc.c
@@ -48,7 +48,7 @@ font_encoding_find(const char *encoding_name, const char *filename)
}
unsigned
-font_encoding_recode(unsigned code,
+font_encoding_recode(unsigned code,
FontEncPtr encoding, FontMapPtr mapping)
{
if(encoding != mapping->encoding) {
diff --git a/libXfont/src/fontfile/fontfile.c b/libXfont/src/fontfile/fontfile.c
index eb37a8705..05a961072 100644
--- a/libXfont/src/fontfile/fontfile.c
+++ b/libXfont/src/fontfile/fontfile.c
@@ -50,7 +50,7 @@ ISOLatin1ToLower(unsigned char source)
}
_X_HIDDEN void
-CopyISOLatin1Lowered(char *dest, char *source, int length)
+CopyISOLatin1Lowered(char *dest, const char *source, int length)
{
int i;
for (i = 0; i < length; i++, source++, dest++)
@@ -62,14 +62,14 @@ CopyISOLatin1Lowered(char *dest, char *source, int length)
* Map FPE functions to renderer functions
*/
-static int FontFileOpenBitmapNCF (FontPathElementPtr fpe, FontPtr *pFont,
- int flags, FontEntryPtr entry,
- fsBitmapFormat format,
+static int FontFileOpenBitmapNCF (FontPathElementPtr fpe, FontPtr *pFont,
+ int flags, FontEntryPtr entry,
+ fsBitmapFormat format,
fsBitmapFormatMask fmask,
FontPtr non_cachable_font);
int
-FontFileNameCheck (char *name)
+FontFileNameCheck (const char *name)
{
#ifndef NCD
#if defined(WIN32)
@@ -119,14 +119,14 @@ FontFileResetFPE (FontPathElementPtr fpe)
if (FontFileDirectoryChanged (dir))
{
/* can't do it, so tell the caller to close and re-open */
- return FPEResetFailed;
+ return FPEResetFailed;
}
- else
+ else
{
if (dir->nonScalable.used > 0)
if (!FontFileRegisterBitmapSource (fpe))
{
- return FPEResetFailed;
+ return FPEResetFailed;
}
return Successful;
}
@@ -141,7 +141,7 @@ FontFileFreeFPE (FontPathElementPtr fpe)
}
static int
-transfer_values_to_alias(char *entryname, int entrynamelength,
+transfer_values_to_alias(char *entryname, int entrynamelength,
char *resolvedname,
char **aliasName, FontScalablePtr vals)
{
@@ -253,10 +253,10 @@ transfer_values_to_alias(char *entryname, int entrynamelength,
/* ARGSUSED */
int
-FontFileOpenFont (pointer client, FontPathElementPtr fpe, Mask flags,
- char *name, int namelen,
+FontFileOpenFont (pointer client, FontPathElementPtr fpe, Mask flags,
+ const char *name, int namelen,
fsBitmapFormat format, fsBitmapFormatMask fmask,
- XID id, FontPtr *pFont, char **aliasName,
+ XID id, FontPtr *pFont, char **aliasName,
FontPtr non_cachable_font)
{
FontDirectoryPtr dir;
@@ -272,7 +272,7 @@ FontFileOpenFont (pointer client, FontPathElementPtr fpe, Mask flags,
Bool noSpecificSize;
int nranges;
fsRange *ranges;
-
+
if (namelen >= MAXFONTNAMELEN)
return AllocError;
dir = (FontDirectoryPtr) fpe->private;
@@ -510,8 +510,8 @@ FontFileCloseFont (FontPathElementPtr fpe, FontPtr pFont)
}
static int
-FontFileOpenBitmapNCF (FontPathElementPtr fpe, FontPtr *pFont,
- int flags, FontEntryPtr entry,
+FontFileOpenBitmapNCF (FontPathElementPtr fpe, FontPtr *pFont,
+ int flags, FontEntryPtr entry,
fsBitmapFormat format, fsBitmapFormatMask fmask,
FontPtr non_cachable_font)
{
@@ -528,7 +528,7 @@ FontFileOpenBitmapNCF (FontPathElementPtr fpe, FontPtr *pFont,
return BadFontName;
strcpy (fileName, dir->directory);
strcat (fileName, bitmap->fileName);
- ret = (*bitmap->renderer->OpenBitmap)
+ ret = (*bitmap->renderer->OpenBitmap)
(fpe, pFont, flags, entry, fileName, format, fmask,
non_cachable_font);
if (ret == Successful)
@@ -540,8 +540,8 @@ FontFileOpenBitmapNCF (FontPathElementPtr fpe, FontPtr *pFont,
}
int
-FontFileOpenBitmap (FontPathElementPtr fpe, FontPtr *pFont,
- int flags, FontEntryPtr entry,
+FontFileOpenBitmap (FontPathElementPtr fpe, FontPtr *pFont,
+ int flags, FontEntryPtr entry,
fsBitmapFormat format, fsBitmapFormatMask fmask)
{
return FontFileOpenBitmapNCF (fpe, pFont, flags, entry, format, fmask,
@@ -549,7 +549,7 @@ FontFileOpenBitmap (FontPathElementPtr fpe, FontPtr *pFont,
}
static int
-FontFileGetInfoBitmap (FontPathElementPtr fpe, FontInfoPtr pFontInfo,
+FontFileGetInfoBitmap (FontPathElementPtr fpe, FontInfoPtr pFontInfo,
FontEntryPtr entry)
{
FontBitmapEntryPtr bitmap;
@@ -570,8 +570,8 @@ FontFileGetInfoBitmap (FontPathElementPtr fpe, FontInfoPtr pFontInfo,
}
static void
-_FontFileAddScalableNames(FontNamesPtr names, FontNamesPtr scaleNames,
- FontNamePtr nameptr, char *zeroChars,
+_FontFileAddScalableNames(FontNamesPtr names, FontNamesPtr scaleNames,
+ FontNamePtr nameptr, char *zeroChars,
FontScalablePtr vals, fsRange *ranges,
int nranges, int *max)
{
@@ -687,8 +687,8 @@ _FontFileAddScalableNames(FontNamesPtr names, FontNamesPtr scaleNames,
/* ARGSUSED */
static int
-_FontFileListFonts (pointer client, FontPathElementPtr fpe,
- char *pat, int len, int max, FontNamesPtr names,
+_FontFileListFonts (pointer client, FontPathElementPtr fpe,
+ const char *pat, int len, int max, FontNamesPtr names,
int mark_aliases)
{
FontDirectoryPtr dir;
@@ -794,15 +794,15 @@ typedef struct _LFWIData {
} LFWIDataRec, *LFWIDataPtr;
int
-FontFileListFonts (pointer client, FontPathElementPtr fpe, char *pat,
+FontFileListFonts (pointer client, FontPathElementPtr fpe, const char *pat,
int len, int max, FontNamesPtr names)
{
return _FontFileListFonts (client, fpe, pat, len, max, names, 0);
}
int
-FontFileStartListFonts(pointer client, FontPathElementPtr fpe,
- char *pat, int len, int max,
+FontFileStartListFonts(pointer client, FontPathElementPtr fpe,
+ const char *pat, int len, int max,
pointer *privatep, int mark_aliases)
{
LFWIDataPtr data;
@@ -832,8 +832,8 @@ FontFileStartListFonts(pointer client, FontPathElementPtr fpe,
int
-FontFileStartListFontsWithInfo(pointer client, FontPathElementPtr fpe,
- char *pat, int len, int max,
+FontFileStartListFontsWithInfo(pointer client, FontPathElementPtr fpe,
+ const char *pat, int len, int max,
pointer *privatep)
{
return FontFileStartListFonts(client, fpe, pat, len, max, privatep, 0);
@@ -841,8 +841,8 @@ FontFileStartListFontsWithInfo(pointer client, FontPathElementPtr fpe,
/* ARGSUSED */
static int
-FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe,
- char **namep, int *namelenp,
+FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe,
+ char **namep, int *namelenp,
FontInfoPtr *pFontInfo)
{
FontDirectoryPtr dir;
@@ -858,14 +858,14 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe,
Bool noSpecificSize;
int nranges;
fsRange *ranges;
-
+
char *name = *namep;
int namelen = *namelenp;
-
+
if (namelen >= MAXFONTNAMELEN)
return AllocError;
dir = (FontDirectoryPtr) fpe->private;
-
+
/* Match non-scalable pattern */
CopyISOLatin1Lowered (lowerName, name, namelen);
lowerName[namelen] = '\0';
@@ -882,7 +882,7 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe,
tmpName.length = strlen(lowerName);
entry = FontFileFindNameInDir (&dir->nonScalable, &tmpName);
}
-
+
if (entry)
{
switch (entry->type) {
@@ -914,7 +914,7 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe,
{
ret = BadFontName;
}
-
+
if (ret != BadFontName)
{
if (ranges) free(ranges);
@@ -945,7 +945,7 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe,
tmpName.ndashes = entry->name.ndashes;
}
}
-
+
if (entry)
{
noSpecificSize = FALSE; /* TRUE breaks XLFD enhancements */
@@ -1001,7 +1001,7 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe,
vals.xlfdName = origName;
vals.ranges = ranges;
vals.nranges = nranges;
-
+
/* Make a new scaled instance */
if (strlen(dir->directory) + strlen(scalable->fileName) >=
sizeof(fileName)) {
@@ -1037,8 +1037,8 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe,
}
int
-FontFileListNextFontWithInfo(pointer client, FontPathElementPtr fpe,
- char **namep, int *namelenp,
+FontFileListNextFontWithInfo(pointer client, FontPathElementPtr fpe,
+ char **namep, int *namelenp,
FontInfoPtr *pFontInfo,
int *numFonts, pointer private)
{
@@ -1066,15 +1066,15 @@ FontFileListNextFontWithInfo(pointer client, FontPathElementPtr fpe,
}
int
-FontFileStartListFontsAndAliases(pointer client, FontPathElementPtr fpe,
- char *pat, int len, int max,
+FontFileStartListFontsAndAliases(pointer client, FontPathElementPtr fpe,
+ const char *pat, int len, int max,
pointer *privatep)
{
return FontFileStartListFonts(client, fpe, pat, len, max, privatep, 1);
}
int
-FontFileListNextFontOrAlias(pointer client, FontPathElementPtr fpe,
+FontFileListNextFontOrAlias(pointer client, FontPathElementPtr fpe,
char **namep, int *namelenp, char **resolvedp,
int *resolvedlenp, pointer private)
{
diff --git a/libXfont/src/fontfile/fontscale.c b/libXfont/src/fontfile/fontscale.c
index 55aca298a..a21802ff8 100644
--- a/libXfont/src/fontfile/fontscale.c
+++ b/libXfont/src/fontfile/fontscale.c
@@ -35,7 +35,7 @@ in this Software without prior written authorization from The Open Group.
#include <math.h>
Bool
-FontFileAddScaledInstance (FontEntryPtr entry, FontScalablePtr vals,
+FontFileAddScaledInstance (FontEntryPtr entry, FontScalablePtr vals,
FontPtr pFont, char *bitmapName)
{
FontScalableEntryPtr scalable;
@@ -75,7 +75,7 @@ FontFileSwitchStringsToBitmapPointers (FontDirectoryPtr dir)
FontEntryPtr nonScalable;
FontScaledPtr scaled;
FontScalableExtraPtr extra;
-
+
scalable = dir->scalable.entries;
nonScalable = dir->nonScalable.entries;
for (s = 0; s < dir->scalable.used; s++)
@@ -373,12 +373,12 @@ MatchScalable (FontScalablePtr a, FontScalablePtr b)
a->ranges[i].max_char_low != b->ranges[i].max_char_low ||
a->ranges[i].max_char_high != b->ranges[i].max_char_high)
return FALSE;
-
+
return TRUE;
}
FontScaledPtr
-FontFileFindScaledInstance (FontEntryPtr entry, FontScalablePtr vals,
+FontFileFindScaledInstance (FontEntryPtr entry, FontScalablePtr vals,
int noSpecificSize)
{
FontScalableEntryPtr scalable;
diff --git a/libXfont/src/fontfile/gunzip.c b/libXfont/src/fontfile/gunzip.c
index 9fa3eed00..84a4eaf45 100644
--- a/libXfont/src/fontfile/gunzip.c
+++ b/libXfont/src/fontfile/gunzip.c
@@ -66,7 +66,7 @@ BufFilePushZIP (BufFilePtr f)
BufZipFileClose);
}
-static int
+static int
BufZipFileClose(BufFilePtr f, int flag)
{
xzip_buf *x = (xzip_buf *)f->private;
@@ -76,16 +76,16 @@ BufZipFileClose(BufFilePtr f, int flag)
return 1;
}
-/* here's the real work.
+/* here's the real work.
-- we need to put stuff in f.buffer, update f.left and f.bufp,
then return the first byte (or BUFFILEEOF).
- -- to do this, we need to get stuff into avail_in, and next_in,
+ -- to do this, we need to get stuff into avail_in, and next_in,
and call inflate appropriately.
-- we may also need to add CRC maintenance - if inflate tells us
Z_STREAM_END, we then have 4bytes CRC and 4bytes length...
gzio.c:gzread shows most of the mechanism.
*/
-static int
+static int
BufZipFileFill (BufFilePtr f)
{
xzip_buf *x = (xzip_buf *)f->private;
@@ -139,7 +139,7 @@ BufZipFileFill (BufFilePtr f)
}
}
f->bufp = x->b;
- f->left = BUFFILESIZE - x->z.avail_out;
+ f->left = BUFFILESIZE - x->z.avail_out;
if (f->left >= 0) {
f->left--;
@@ -150,7 +150,7 @@ BufZipFileFill (BufFilePtr f)
}
/* there should be a BufCommonSkip... */
-static int
+static int
BufZipFileSkip (BufFilePtr f, int c)
{
/* BufFileRawSkip returns the count unchanged.
@@ -192,7 +192,7 @@ BufZipFileSkip (BufFilePtr f, int c)
#define RESERVED 0xE0 /* bits 5..7: reserved */
#define GET(f) do {c = BufFileGet(f); if (c == BUFFILEEOF) return c;} while(0)
-static int
+static int
BufCheckZipHeader(BufFilePtr f)
{
int c, flags;
diff --git a/libXfont/src/fontfile/renderers.c b/libXfont/src/fontfile/renderers.c
index a9e4bef53..bbcd46694 100644
--- a/libXfont/src/fontfile/renderers.c
+++ b/libXfont/src/fontfile/renderers.c
@@ -40,7 +40,7 @@ static FontRenderersRec renderers;
* XXX Maybe should allow unregistering renders. For now, just clear the
* list at each new generation.
*/
-extern unsigned long serverGeneration;
+extern unsigned long __GetServerGeneration(void);
static unsigned long rendererGeneration = 0;
Bool
@@ -55,8 +55,8 @@ FontFilePriorityRegisterRenderer (FontRendererPtr renderer, int priority)
int i;
struct _FontRenderersElement *new;
- if (rendererGeneration != serverGeneration) {
- rendererGeneration = serverGeneration;
+ if (rendererGeneration != __GetServerGeneration()) {
+ rendererGeneration = __GetServerGeneration();
renderers.number = 0;
if (renderers.renderers)
free(renderers.renderers);
@@ -64,7 +64,7 @@ FontFilePriorityRegisterRenderer (FontRendererPtr renderer, int priority)
}
for (i = 0; i < renderers.number; i++) {
- if (!strcasecmp (renderers.renderers[i].renderer->fileSuffix,
+ if (!strcasecmp (renderers.renderers[i].renderer->fileSuffix,
renderer->fileSuffix)) {
if(renderers.renderers[i].priority >= priority) {
if(renderers.renderers[i].priority == priority) {
@@ -99,7 +99,7 @@ FontFileMatchRenderer (char *fileName)
int i;
int fileLen;
FontRendererPtr r;
-
+
fileLen = strlen (fileName);
for (i = 0; i < renderers.number; i++)
{