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
-rwxr-xr-x[-rw-r--r--]libXfont/src/fontfile/fontfile.c82
-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, 84 insertions, 80 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 d5721ab68..dbfb1cc25 100644
--- a/libXfont/src/fontfile/catalogue.c
+++ b/libXfont/src/fontfile/catalogue.c
@@ -41,7 +41,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;
}
@@ -117,7 +117,7 @@ CatalogueUnrefFPEs (FontPathElementPtr fpe)
if (subfpe->refcount == 0)
{
FontFileFreeFPE (subfpe);
- free(subfpe->name);
+ free((void *) subfpe->name);
free(subfpe);
}
}
@@ -160,6 +160,7 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan)
#ifndef _MSC_VER
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)
@@ -193,15 +194,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
@@ -210,7 +212,7 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan)
if (FontFileInitFPE (subfpe) != Successful)
{
- free(subfpe->name);
+ free((void *) subfpe->name);
free(subfpe);
continue;
}
@@ -283,7 +285,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)
@@ -317,7 +319,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;
@@ -342,7 +344,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;
@@ -378,7 +380,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);
@@ -416,7 +418,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 7372d3ece..55aa98d4d 100644..100755
--- a/libXfont/src/fontfile/fontfile.c
+++ b/libXfont/src/fontfile/fontfile.c
@@ -56,7 +56,7 @@ ISOLatin1ToLower(unsigned char source)
}
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++)
@@ -68,9 +68,9 @@ 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);
@@ -152,14 +152,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;
}
@@ -174,7 +174,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)
{
@@ -286,10 +286,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;
@@ -305,7 +305,7 @@ FontFileOpenFont (pointer client, FontPathElementPtr fpe, Mask flags,
Bool noSpecificSize;
int nranges;
fsRange *ranges;
-
+
if (namelen >= MAXFONTNAMELEN)
return AllocError;
dir = (FontDirectoryPtr) fpe->private;
@@ -543,8 +543,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)
{
@@ -561,7 +561,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)
@@ -573,8 +573,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,
@@ -582,7 +582,7 @@ FontFileOpenBitmap (FontPathElementPtr fpe, FontPtr *pFont,
}
static int
-FontFileGetInfoBitmap (FontPathElementPtr fpe, FontInfoPtr pFontInfo,
+FontFileGetInfoBitmap (FontPathElementPtr fpe, FontInfoPtr pFontInfo,
FontEntryPtr entry)
{
FontBitmapEntryPtr bitmap;
@@ -603,8 +603,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)
{
@@ -720,8 +720,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;
@@ -827,15 +827,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;
@@ -865,8 +865,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);
@@ -874,8 +874,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;
@@ -891,14 +891,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';
@@ -915,7 +915,7 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe,
tmpName.length = strlen(lowerName);
entry = FontFileFindNameInDir (&dir->nonScalable, &tmpName);
}
-
+
if (entry)
{
switch (entry->type) {
@@ -947,7 +947,7 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe,
{
ret = BadFontName;
}
-
+
if (ret != BadFontName)
{
if (ranges) free(ranges);
@@ -978,7 +978,7 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe,
tmpName.ndashes = entry->name.ndashes;
}
}
-
+
if (entry)
{
noSpecificSize = FALSE; /* TRUE breaks XLFD enhancements */
@@ -1034,7 +1034,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)) {
@@ -1070,8 +1070,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)
{
@@ -1099,15 +1099,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 eb8d0bb58..bfaa7ec00 100644
--- a/libXfont/src/fontfile/fontscale.c
+++ b/libXfont/src/fontfile/fontscale.c
@@ -39,7 +39,7 @@ in this Software without prior written authorization from The Open Group.
#endif
Bool
-FontFileAddScaledInstance (FontEntryPtr entry, FontScalablePtr vals,
+FontFileAddScaledInstance (FontEntryPtr entry, FontScalablePtr vals,
FontPtr pFont, char *bitmapName)
{
FontScalableEntryPtr scalable;
@@ -79,7 +79,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++)
@@ -377,12 +377,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 e17d6a77e..7c341f6d8 100644
--- a/libXfont/src/fontfile/renderers.c
+++ b/libXfont/src/fontfile/renderers.c
@@ -41,7 +41,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
@@ -56,8 +56,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);
@@ -65,7 +65,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) {
@@ -100,7 +100,7 @@ FontFileMatchRenderer (char *fileName)
int i;
int fileLen;
FontRendererPtr r;
-
+
fileLen = strlen (fileName);
for (i = 0; i < renderers.number; i++)
{