summaryrefslogtreecommitdiff
path: root/src/fc
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-11-25 19:28:20 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-11-25 19:28:20 +0000
commitfb0cbe6e7287d635a5f368e055cc0aae6ed50125 (patch)
tree24940f60afb7e084ca0760710bf9d1ffd21c384a /src/fc
parentca219ad2fc4f392505d378dfa5a2b34d33de6d61 (diff)
XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folksxf86-4_3_99_16
Diffstat (limited to 'src/fc')
-rw-r--r--src/fc/fsconvert.c22
-rw-r--r--src/fc/fserve.c128
-rw-r--r--src/fc/fsio.c7
-rw-r--r--src/fc/fslibos.h23
4 files changed, 110 insertions, 70 deletions
diff --git a/src/fc/fsconvert.c b/src/fc/fsconvert.c
index 47239cf..6b694fd 100644
--- a/src/fc/fsconvert.c
+++ b/src/fc/fsconvert.c
@@ -22,7 +22,7 @@
*
* Author: Dave Lemke, Network Computing Devices, Inc
*/
-/* $XFree86: xc/lib/font/fc/fsconvert.c,v 1.11 2002/09/10 16:14:35 tsi Exp $ */
+/* $XFree86: xc/lib/font/fc/fsconvert.c,v 1.15 2003/09/01 20:50:43 herrb Exp $ */
/*
* FS data conversion
*/
@@ -36,6 +36,7 @@
#include "fontstruct.h"
#include "fservestr.h"
#include "fontutil.h"
+#include "fslibos.h"
extern char _fs_glyph_undefined;
extern char _fs_glyph_requested;
@@ -102,6 +103,10 @@ _fs_convert_props(fsPropInfo *pi, fsPropOffset *po, pointer pd,
nprops = pfi->nprops = pi->num_offsets;
+ if (nprops < 0
+ || nprops > SIZE_MAX/(sizeof(FontPropRec) + sizeof(char)))
+ return -1;
+
dprop = (FontPropPtr) xalloc(sizeof(FontPropRec) * nprops +
sizeof (char) * nprops);
if (!dprop)
@@ -351,11 +356,9 @@ _fs_clean_aborted_loadglyphs(FontPtr pfont, int num_expected_ranges,
fsRange *expected_ranges)
{
register FSFontPtr fsfont;
- register FSFontDataRec *fsd;
register int i;
fsfont = (FSFontPtr) pfont->fontPrivate;
- fsd = (FSFontDataRec *) pfont->fpePrivate;
if (fsfont->encoding)
{
fsRange full_range[1];
@@ -446,7 +449,6 @@ _fs_get_glyphs(FontPtr pFont, unsigned long count, unsigned char *chars,
CharInfoPtr encoding;
CharInfoPtr pDefault;
FSFontDataPtr fsd = (FSFontDataPtr) pFont->fpePrivate;
- int itemSize;
int err = Successful;
fsdata = (FSFontPtr) pFont->fontPrivate;
@@ -456,12 +458,6 @@ _fs_get_glyphs(FontPtr pFont, unsigned long count, unsigned char *chars,
numCols = pFont->info.lastCol - firstCol + 1;
glyphsBase = glyphs;
-
- if (charEncoding == Linear8Bit || charEncoding == TwoD8Bit)
- itemSize = 1;
- else
- itemSize = 2;
-
/* In this age of glyph caching, any glyphs gotten through this
procedure should already be loaded. If they are not, we are
dealing with someone (perhaps a ddx driver optimizing a font)
@@ -563,7 +559,6 @@ _fs_get_metrics(FontPtr pFont, unsigned long count, unsigned char *chars,
unsigned int r;
CharInfoPtr encoding;
CharInfoPtr pDefault;
- int itemSize;
fsdata = (FSFontPtr) pFont->fontPrivate;
encoding = fsdata->inkMetrics;
@@ -578,11 +573,6 @@ _fs_get_metrics(FontPtr pFont, unsigned long count, unsigned char *chars,
/* XXX - this should be much smarter */
/* make sure the glyphs are there */
- if (charEncoding == Linear8Bit || charEncoding == TwoD8Bit)
- itemSize = 1;
- else
- itemSize = 2;
-
switch (charEncoding) {
case Linear8Bit:
diff --git a/src/fc/fserve.c b/src/fc/fserve.c
index f21233c..c9fccc4 100644
--- a/src/fc/fserve.c
+++ b/src/fc/fserve.c
@@ -24,7 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
-/* $XFree86: xc/lib/font/fc/fserve.c,v 3.22 2002/05/31 18:45:49 dawes Exp $ */
+/* $XFree86: xc/lib/font/fc/fserve.c,v 3.25 2003/11/20 18:16:34 dawes Exp $ */
/*
* Copyright 1990 Network Computing Devices
@@ -87,13 +87,13 @@ in this Software without prior written authorization from The Open Group.
(pci)->descent || \
(pci)->characterWidth)
+extern void ErrorF(const char *f, ...);
static int fs_read_glyphs ( FontPathElementPtr fpe, FSBlockDataPtr blockrec );
static int fs_read_list ( FontPathElementPtr fpe, FSBlockDataPtr blockrec );
static int fs_read_list_info ( FontPathElementPtr fpe,
FSBlockDataPtr blockrec );
-static int fs_font_type;
extern fd_set _fs_fd_mask;
static void fs_block_handler ( pointer data, OSTimePtr wt,
@@ -952,6 +952,7 @@ fs_read_extent_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec)
CharInfoPtr ci, pCI;
char *fsci;
fsXCharInfo fscilocal;
+ FontInfoRec *fi = &bfont->pfont->info;
rep = (fsQueryXExtents16Reply *) fs_get_reply (conn, &ret);
if (!rep || rep->type == FS_Error)
@@ -997,6 +998,21 @@ fs_read_extent_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec)
{
memcpy(&fscilocal, fsci, SIZEOF(fsXCharInfo)); /* align it */
_fs_convert_char_info(&fscilocal, &ci->metrics);
+ /* Bounds check. */
+ if (ci->metrics.ascent > fi->maxbounds.ascent)
+ {
+ ErrorF("fserve: warning: %s %s ascent (%d) > maxascent (%d)\n",
+ fpe->name, fsd->name,
+ ci->metrics.ascent, fi->maxbounds.ascent);
+ ci->metrics.ascent = fi->maxbounds.ascent;
+ }
+ if (ci->metrics.descent > fi->maxbounds.descent)
+ {
+ ErrorF("fserve: warning: %s %s descent (%d) > maxdescent (%d)\n",
+ fpe->name, fsd->name,
+ ci->metrics.descent, fi->maxbounds.descent);
+ ci->metrics.descent = fi->maxbounds.descent;
+ }
fsci = fsci + SIZEOF(fsXCharInfo);
/* Initialize the bits field for later glyph-caching use */
if (NONZEROMETRICS(&ci->metrics))
@@ -1022,7 +1038,6 @@ fs_read_extent_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec)
/* build bitmap metrics, ImageRectMax style */
if (haveInk)
{
- FontInfoRec *fi = &bfont->pfont->info;
CharInfoPtr ii;
ci = fsfont->encoding;
@@ -1037,10 +1052,44 @@ fs_read_extent_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec)
ci->metrics.descent = FONT_MAX_DESCENT(fi);
ci->metrics.characterWidth = FONT_MAX_WIDTH(fi);
ci->metrics.attributes = ii->metrics.attributes;
+ /* Bounds check. */
+ if (ci->metrics.ascent > fi->maxbounds.ascent)
+ {
+ ErrorF("fserve: warning: %s %s ascent (%d) "
+ "> maxascent (%d)\n",
+ fpe->name, fsd->name,
+ ci->metrics.ascent, fi->maxbounds.ascent);
+ ci->metrics.ascent = fi->maxbounds.ascent;
+ }
+ if (ci->metrics.descent > fi->maxbounds.descent)
+ {
+ ErrorF("fserve: warning: %s %s descent (%d) "
+ "> maxdescent (%d)\n",
+ fpe->name, fsd->name,
+ ci->metrics.descent, fi->maxbounds.descent);
+ ci->metrics.descent = fi->maxbounds.descent;
+ }
}
else
{
ci->metrics = ii->metrics;
+ /* Bounds check. */
+ if (ci->metrics.ascent > fi->maxbounds.ascent)
+ {
+ ErrorF("fserve: warning: %s %s ascent (%d) "
+ "> maxascent (%d)\n",
+ fpe->name, fsd->name,
+ ci->metrics.ascent, fi->maxbounds.ascent);
+ ci->metrics.ascent = fi->maxbounds.ascent;
+ }
+ if (ci->metrics.descent > fi->maxbounds.descent)
+ {
+ ErrorF("fserve: warning: %s %s descent (%d) "
+ "> maxdescent (%d)\n",
+ fpe->name, fsd->name,
+ ci->metrics.descent, fi->maxbounds.descent);
+ ci->metrics.descent = fi->maxbounds.descent;
+ }
}
}
}
@@ -1498,7 +1547,6 @@ fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags,
FSBlockDataPtr blockrec = NULL;
FSBlockedFontPtr bfont;
FSFontDataPtr fsd;
- FSFontPtr fsfont;
fsOpenBitmapFontReq openreq;
fsQueryXInfoReq inforeq;
fsQueryXExtents16Req extreq;
@@ -1507,8 +1555,8 @@ fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags,
if (conn->blockState & FS_GIVE_UP)
return BadFontName;
-
- if (namelen > sizeof (buf) - 1)
+
+ if (namelen <= 0 || namelen > sizeof (buf) - 1)
return BadFontName;
/*
@@ -1522,7 +1570,6 @@ fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags,
font = *ppfont;
fsd = (FSFontDataPtr)font->fpePrivate;
- fsfont = (FSFontPtr)font->fontPrivate;
/* This is an attempt to reopen a font. Did the font have a
NAME property? */
if ((nameatom = MakeAtom("FONT", 4, 0)) != None)
@@ -1550,7 +1597,6 @@ fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags,
return AllocError;
fsd = (FSFontDataPtr)font->fpePrivate;
- fsfont = (FSFontPtr)font->fontPrivate;
}
/* make a new block record, and add it to the end of the list */
@@ -1793,7 +1839,7 @@ fs_read_glyphs(FontPathElementPtr fpe, FSBlockDataPtr blockrec)
err;
int nranges = 0;
int ret;
- fsRange *ranges, *nextrange = 0;
+ fsRange *nextrange = 0;
unsigned long minchar, maxchar;
rep = (fsQueryXBitmaps16Reply *) fs_get_reply (conn, &ret);
@@ -1818,7 +1864,7 @@ fs_read_glyphs(FontPathElementPtr fpe, FSBlockDataPtr blockrec)
if (blockrec->type == FS_LOAD_GLYPHS)
{
nranges = bglyph->num_expected_ranges;
- nextrange = ranges = bglyph->expected_ranges;
+ nextrange = bglyph->expected_ranges;
}
/* place the incoming glyphs */
@@ -2291,7 +2337,6 @@ fs_list_fonts(pointer client, FontPathElementPtr fpe,
{
FSFpePtr conn = (FSFpePtr) fpe->private;
FSBlockDataPtr blockrec;
- FSBlockedListPtr blockedlist;
int err;
/* see if the result is already there */
@@ -2302,7 +2347,6 @@ fs_list_fonts(pointer client, FontPathElementPtr fpe,
err = blockrec->errcode;
if (err == StillWorking)
return Suspended;
- blockedlist = (FSBlockedListPtr) blockrec->data;
_fs_remove_block_rec(conn, blockrec);
return err;
}
@@ -3143,21 +3187,21 @@ _fs_free_conn (FSFpePtr conn)
void
fs_register_fpe_functions(void)
{
- fs_font_type = RegisterFPEFunctions(fs_name_check,
- fs_init_fpe,
- fs_free_fpe,
- fs_reset_fpe,
- fs_open_font,
- fs_close_font,
- fs_list_fonts,
- fs_start_list_with_info,
- fs_next_list_with_info,
- (WakeupFpeFunc)fs_wakeup,
- fs_client_died,
- _fs_load_glyphs,
- NULL,
- NULL,
- NULL);
+ RegisterFPEFunctions(fs_name_check,
+ fs_init_fpe,
+ fs_free_fpe,
+ fs_reset_fpe,
+ fs_open_font,
+ fs_close_font,
+ fs_list_fonts,
+ fs_start_list_with_info,
+ fs_next_list_with_info,
+ fs_wakeup,
+ fs_client_died,
+ _fs_load_glyphs,
+ NULL,
+ NULL,
+ NULL);
}
static int
@@ -3210,19 +3254,19 @@ check_fs_next_list_with_info(pointer client, FontPathElementPtr fpe,
void
check_fs_register_fpe_functions(void)
{
- fs_font_type = RegisterFPEFunctions(fs_name_check,
- fs_init_fpe,
- fs_free_fpe,
- fs_reset_fpe,
- check_fs_open_font,
- fs_close_font,
- check_fs_list_fonts,
- check_fs_start_list_with_info,
- check_fs_next_list_with_info,
- (WakeupFpeFunc)fs_wakeup,
- fs_client_died,
- _fs_load_glyphs,
- NULL,
- NULL,
- NULL);
+ RegisterFPEFunctions(fs_name_check,
+ fs_init_fpe,
+ fs_free_fpe,
+ fs_reset_fpe,
+ check_fs_open_font,
+ fs_close_font,
+ check_fs_list_fonts,
+ check_fs_start_list_with_info,
+ check_fs_next_list_with_info,
+ fs_wakeup,
+ fs_client_died,
+ _fs_load_glyphs,
+ NULL,
+ NULL,
+ NULL);
}
diff --git a/src/fc/fsio.c b/src/fc/fsio.c
index b5d9de0..6f589c8 100644
--- a/src/fc/fsio.c
+++ b/src/fc/fsio.c
@@ -23,7 +23,7 @@
*
* Author: Dave Lemke, Network Computing Devices, Inc
*/
-/* $XFree86: xc/lib/font/fc/fsio.c,v 3.16 2002/05/31 18:45:49 dawes Exp $ */
+/* $XFree86: xc/lib/font/fc/fsio.c,v 3.17 2003/05/27 22:26:49 tsi Exp $ */
/*
* font server i/o routines
*/
@@ -146,7 +146,7 @@ _fs_connect(char *servername, int *err)
int
_fs_fill (FSFpePtr conn)
{
- long avail, need;
+ long avail;
long bytes_read;
Bool waited = FALSE;
@@ -156,8 +156,7 @@ _fs_fill (FSFpePtr conn)
* Don't go overboard here; stop reading when we've
* got enough to satisfy the pending request
*/
- while ((need = conn->inNeed - (conn->inBuf.insert -
- conn->inBuf.remove)) > 0)
+ while ((conn->inNeed - (conn->inBuf.insert - conn->inBuf.remove)) > 0)
{
avail = conn->inBuf.size - conn->inBuf.insert;
/*
diff --git a/src/fc/fslibos.h b/src/fc/fslibos.h
index 8ca2a8a..09f1ade 100644
--- a/src/fc/fslibos.h
+++ b/src/fc/fslibos.h
@@ -31,7 +31,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
-/* $XFree86: xc/lib/font/fc/fslibos.h,v 3.7 2002/05/31 18:45:49 dawes Exp $ */
+/* $XFree86: xc/lib/font/fc/fslibos.h,v 3.9 2003/09/01 20:50:44 herrb Exp $ */
/*
* FSlib networking & os include file
@@ -48,13 +48,20 @@ from The Open Group.
#ifndef FONT_OPEN_MAX
#ifndef X_NOT_POSIX
-#ifdef _POSIX_SOURCE
-#include <limits.h>
-#else
-#define _POSIX_SOURCE
-#include <limits.h>
-#undef _POSIX_SOURCE
-#endif
+# ifdef _POSIX_SOURCE
+# include <limits.h>
+# else
+# define _POSIX_SOURCE
+# include <limits.h>
+# undef _POSIX_SOURCE
+# endif
+#endif
+#ifndef SIZE_MAX
+# ifdef ULONG_MAX
+# define SIZE_MAX ULONG_MAX
+# else
+# define SIZE_MAX UINT_MAX
+# endif
#endif
#ifndef OPEN_MAX
#if defined(SVR4) || defined(__UNIXOS2__)