.gitignore | 8 + Makefile.am | 4 README | 29 +++++ configure.ac | 11 +- doc/FSlib.txt | 230 ++++++++++++++++++++++++++++++++++++++++++++++ include/X11/fonts/FSlib.h | 8 - src/.gitignore | 6 - src/FSClServ.c | 7 - src/FSCloseFt.c | 4 src/FSConnServ.c | 3 src/FSErrDis.c | 18 +-- src/FSErrHndlr.c | 5 - src/FSFlush.c | 3 src/FSFontInfo.c | 2 src/FSFtNames.c | 2 src/FSGetCats.c | 2 src/FSListCats.c | 2 src/FSListExt.c | 5 - src/FSMisc.c | 4 src/FSNextEv.c | 6 - src/FSOpenFont.c | 3 src/FSOpenServ.c | 87 +++++++---------- src/FSQGlyphs.c | 2 src/FSQXExt.c | 3 src/FSQXInfo.c | 2 src/FSQuExt.c | 2 src/FSServName.c | 4 src/FSSetCats.c | 5 - src/FSSync.c | 4 src/FSSynchro.c | 5 - src/FSlibInt.c | 10 -- src/FSlibint.h | 25 +---- src/FSlibos.h | 36 ------- src/Makefile.am | 2 34 files changed, 340 insertions(+), 209 deletions(-)
New commits: commit 364af12a2426358461f5ed5b142c97411cad80c5 Author: Alan Coopersmith <alan.coopersm...@sun.com> Date: Tue Jul 7 15:47:36 2009 -0700 Version 1.0.2 diff --git a/configure.ac b/configure.ac index da6feaf..9273352 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ dnl Process this file with autoconf to create configure. AC_PREREQ([2.57]) -AC_INIT(libFS, 1.0.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libFS) +AC_INIT(libFS, 1.0.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libFS) AM_INIT_AUTOMAKE([dist-bzip2]) AM_MAINTAINER_MODE commit 040bfd8f055f7e49f15e457842b8bca4f8d2020a Author: Alan Coopersmith <alan.coopersm...@sun.com> Date: Tue Jul 7 15:45:50 2009 -0700 Move CWARNFLAGS to Makefile.am for easier build-time overriding Signed-off-by: Alan Coopersmith <alan.coopersm...@sun.com> diff --git a/configure.ac b/configure.ac index a2e7438..da6feaf 100644 --- a/configure.ac +++ b/configure.ac @@ -39,7 +39,6 @@ XORG_CWARNFLAGS # Check for dependencies PKG_CHECK_MODULES(FS, xproto fontsproto) -FS_CFLAGS="$CWARNFLAGS $FS_CFLAGS" AC_SUBST(FS_CFLAGS) AC_SUBST(FS_LIBS) # diff --git a/src/Makefile.am b/src/Makefile.am index a9a347b..3333103 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -29,7 +29,7 @@ libFS_la_SOURCES = \ FSSynchro.c \ fs_transport.c -AM_CFLAGS = $(FS_CFLAGS) $(XTRANS_CFLAGS) $(MALLOC_ZERO_CFLAGS) \ +AM_CFLAGS = $(CWARNFLAGS) $(FS_CFLAGS) $(XTRANS_CFLAGS) $(MALLOC_ZERO_CFLAGS) \ -DFS_t -DTRANS_CLIENT libFS_la_LIBADD = $(FS_LIBS) $(XTRANS_LIBS) commit 233b72428a47272b599a6be0708b06f7ed674f7c Author: Alan Coopersmith <alan.coopersm...@sun.com> Date: Tue Jul 7 08:57:53 2009 -0700 Strip out-of-date RCS/CVS & SCCS version tags Signed-off-by: Alan Coopersmith <alan.coopersm...@sun.com> diff --git a/doc/FSlib.txt b/doc/FSlib.txt index 02957d5..6d1ee25 100644 --- a/doc/FSlib.txt +++ b/doc/FSlib.txt @@ -1,5 +1,3 @@ -$Xorg: FSlib.doc,v 1.3 2000/08/17 19:42:50 cpqbld Exp $ - Protocol requests These functions make protocol requests corresponding to their names. diff --git a/include/X11/fonts/FSlib.h b/include/X11/fonts/FSlib.h index 9d4ecb0..94f0552 100644 --- a/include/X11/fonts/FSlib.h +++ b/include/X11/fonts/FSlib.h @@ -1,5 +1,3 @@ -/* $Xorg: FSlib.h,v 1.5 2001/02/09 02:03:25 xorgcvs Exp $ */ - /* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation @@ -24,7 +22,6 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSlib.h,v 1.6 2001/12/14 19:53:33 dawes Exp $ */ /* diff --git a/src/FSClServ.c b/src/FSClServ.c index 7bce02e..2792f5c 100644 --- a/src/FSClServ.c +++ b/src/FSClServ.c @@ -1,6 +1,4 @@ -/* $Xorg: FSClServ.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)FSClServ.c 4.1 91/05/02 +/* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation * @@ -24,7 +22,6 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSClServ.c,v 1.4 2001/01/17 19:41:27 dawes Exp $ */ /* diff --git a/src/FSCloseFt.c b/src/FSCloseFt.c index 9b0dce8..296f63b 100644 --- a/src/FSCloseFt.c +++ b/src/FSCloseFt.c @@ -1,6 +1,4 @@ -/* $Xorg: FSCloseFt.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)FSCloseFt.c 4.1 91/05/02 +/* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation * diff --git a/src/FSConnServ.c b/src/FSConnServ.c index d4d1472..ac09401 100644 --- a/src/FSConnServ.c +++ b/src/FSConnServ.c @@ -1,5 +1,3 @@ -/* $Xorg: FSConnServ.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - /* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation @@ -50,7 +48,6 @@ 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/FS/FSConnServ.c,v 3.10 2001/10/28 03:32:27 tsi Exp $ */ #ifdef HAVE_CONFIG_H #include <config.h> diff --git a/src/FSErrDis.c b/src/FSErrDis.c index 9dfe1fd..f89e49f 100644 --- a/src/FSErrDis.c +++ b/src/FSErrDis.c @@ -1,6 +1,4 @@ -/* $Xorg: FSErrDis.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)FSErrDis.c 4.1 91/05/02 +/* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation * diff --git a/src/FSErrHndlr.c b/src/FSErrHndlr.c index 592fa48..b5cb119 100644 --- a/src/FSErrHndlr.c +++ b/src/FSErrHndlr.c @@ -1,6 +1,4 @@ -/* $Xorg: FSErrHndlr.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)FSErrHndlr.c 4.1 91/05/02 +/* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation * @@ -24,7 +22,6 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSErrHndlr.c,v 1.4 2001/01/17 19:41:28 dawes Exp $ */ /* diff --git a/src/FSFlush.c b/src/FSFlush.c index 924a0bb..4beb46d 100644 --- a/src/FSFlush.c +++ b/src/FSFlush.c @@ -1,6 +1,5 @@ -/* $Xorg: FSFlush.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ -/* @(#)FSFlush.c 4.1 91/05/02 +/* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation * diff --git a/src/FSFontInfo.c b/src/FSFontInfo.c index 0b79613..aa0c8cc 100644 --- a/src/FSFontInfo.c +++ b/src/FSFontInfo.c @@ -1,4 +1,3 @@ -/* $Xorg: FSFontInfo.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ /* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation @@ -23,7 +22,6 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSFontInfo.c,v 1.5tsi Exp $ */ /* diff --git a/src/FSFtNames.c b/src/FSFtNames.c index 733da35..b5b2af5 100644 --- a/src/FSFtNames.c +++ b/src/FSFtNames.c @@ -1,4 +1,3 @@ -/* $Xorg: FSFtNames.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ /* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation @@ -23,7 +22,6 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSFtNames.c,v 1.6tsi Exp $ */ /* diff --git a/src/FSGetCats.c b/src/FSGetCats.c index 36a134b..5cc9464 100644 --- a/src/FSGetCats.c +++ b/src/FSGetCats.c @@ -1,4 +1,3 @@ -/* $Xorg: FSGetCats.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ /* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation @@ -23,7 +22,6 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSGetCats.c,v 1.6tsi Exp $ */ /* diff --git a/src/FSListCats.c b/src/FSListCats.c index 36c5326..45f47fd 100644 --- a/src/FSListCats.c +++ b/src/FSListCats.c @@ -1,4 +1,3 @@ -/* $Xorg: FSListCats.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ /* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation @@ -23,7 +22,6 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSListCats.c,v 1.6tsi Exp $ */ /* diff --git a/src/FSListExt.c b/src/FSListExt.c index 4eab13d..d9ae87b 100644 --- a/src/FSListExt.c +++ b/src/FSListExt.c @@ -1,6 +1,4 @@ -/* $Xorg: FSListExt.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)FSListExt.c 4.1 91/05/02 +/* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation * @@ -24,7 +22,6 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSListExt.c,v 1.6tsi Exp $ */ /* diff --git a/src/FSMisc.c b/src/FSMisc.c index fd17440..bfe7f43 100644 --- a/src/FSMisc.c +++ b/src/FSMisc.c @@ -1,6 +1,4 @@ -/* $Xorg: FSMisc.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)FSMisc.c 4.1 91/05/02 +/* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation * diff --git a/src/FSNextEv.c b/src/FSNextEv.c index 8cd222c..66715da 100644 --- a/src/FSNextEv.c +++ b/src/FSNextEv.c @@ -1,6 +1,4 @@ -/* $Xorg: FSNextEv.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)FSNextEv.c 4.1 91/05/02 +/* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation * diff --git a/src/FSOpenFont.c b/src/FSOpenFont.c index b2097fa..9a97ff7 100644 --- a/src/FSOpenFont.c +++ b/src/FSOpenFont.c @@ -1,5 +1,3 @@ -/* $Xorg: FSOpenFont.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - /* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation @@ -24,7 +22,6 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSOpenFont.c,v 1.6tsi Exp $ */ /* diff --git a/src/FSQGlyphs.c b/src/FSQGlyphs.c index 0b3b5bd..4ddc19f 100644 --- a/src/FSQGlyphs.c +++ b/src/FSQGlyphs.c @@ -1,4 +1,3 @@ -/* $Xorg: FSQGlyphs.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ /* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation @@ -23,7 +22,6 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSQGlyphs.c,v 1.5tsi Exp $ */ /* diff --git a/src/FSQXExt.c b/src/FSQXExt.c index fd182d3..3ddd116 100644 --- a/src/FSQXExt.c +++ b/src/FSQXExt.c @@ -1,5 +1,3 @@ -/* $Xorg: FSQXExt.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - /* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation @@ -24,7 +22,6 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSQXExt.c,v 1.7tsi Exp $ */ /* diff --git a/src/FSQXInfo.c b/src/FSQXInfo.c index d3dabf4..8ce64e5 100644 --- a/src/FSQXInfo.c +++ b/src/FSQXInfo.c @@ -1,4 +1,3 @@ -/* $Xorg: FSQXInfo.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ /* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation @@ -23,7 +22,6 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSQXInfo.c,v 1.5tsi Exp $ */ /* diff --git a/src/FSQuExt.c b/src/FSQuExt.c index 8ba8080..a8dbf1c 100644 --- a/src/FSQuExt.c +++ b/src/FSQuExt.c @@ -1,5 +1,3 @@ -/* $Xorg: FSQuExt.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - /* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation diff --git a/src/FSServName.c b/src/FSServName.c index 7fadd9c..78eda29 100644 --- a/src/FSServName.c +++ b/src/FSServName.c @@ -1,6 +1,5 @@ -/* $Xorg: FSServName.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ -/* @(#)FSServName.c 4.1 91/05/02 +/* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation * @@ -24,7 +23,6 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSServName.c,v 1.3 2001/07/29 05:01:11 tsi Exp $ */ /* diff --git a/src/FSSetCats.c b/src/FSSetCats.c index a2c0142..fcacb98 100644 --- a/src/FSSetCats.c +++ b/src/FSSetCats.c @@ -1,6 +1,4 @@ -/* $Xorg: FSSetCats.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)FSFlush.c 4.1 91/05/02 +/* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation * @@ -24,7 +22,6 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSSetCats.c,v 1.4 2001/01/17 19:41:28 dawes Exp $ */ /* diff --git a/src/FSSync.c b/src/FSSync.c index 25ff695..1c6e3d2 100644 --- a/src/FSSync.c +++ b/src/FSSync.c @@ -1,5 +1,3 @@ -/* $Xorg: FSSync.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - /* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation diff --git a/src/FSSynchro.c b/src/FSSynchro.c index 79c0f40..a988496 100644 --- a/src/FSSynchro.c +++ b/src/FSSynchro.c @@ -1,6 +1,4 @@ -/* $Xorg: FSSynchro.c,v 1.4 2001/02/09 02:03:25 xorgcvs Exp $ */ - -/* @(#)FSSynchro.c 4.1 91/05/02 +/* * Copyright 1990 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation * @@ -24,7 +22,6 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSSynchro.c,v 1.4 2001/01/17 19:41:28 dawes Exp $ */ /* commit f85f04b1287717d00cc29aaea2dc44bd59a2d2b3 Author: Alan Coopersmith <alan.coopersm...@sun.com> Date: Tue Jul 7 08:45:41 2009 -0700 Constify FSErrorList Matches the code in libX11/src/ErrDes.c this is based on. Signed-off-by: Alan Coopersmith <alan.coopersm...@sun.com> diff --git a/include/X11/fonts/FSlib.h b/include/X11/fonts/FSlib.h index c2719f8..9d4ecb0 100644 --- a/include/X11/fonts/FSlib.h +++ b/include/X11/fonts/FSlib.h @@ -277,8 +277,9 @@ extern int FSSync ( FSServer *svr, Bool discard ); extern int FSCloseServer ( FSServer *svr ); extern int FSCloseFont ( FSServer *svr, Font fid ); -extern int FSGetErrorDatabaseText ( FSServer *svr, char *name, char *type, - char *defaultp, char *buffer, int nbytes ); +extern int FSGetErrorDatabaseText ( FSServer *svr, const char *name, + const char *type, const char *defaultp, + char *buffer, int nbytes ); extern int FSGetErrorText ( FSServer *svr, int code, char *buffer, int nbytes ); diff --git a/src/FSErrDis.c b/src/FSErrDis.c index 47521b8..9dfe1fd 100644 --- a/src/FSErrDis.c +++ b/src/FSErrDis.c @@ -58,7 +58,7 @@ in this Software without prior written authorization from The Open Group. #include "FSlibint.h" #include <X11/Xos.h> -static char *FSErrorList[] = { +static const char *FSErrorList[] = { /* FSBadRequest */ "BadRequest, invalid request code or no such operation", /* FSBadFormat */ "BadFormat, bad font format mask", /* FSBadFont */ "BadFont, invalid Font parameter", @@ -78,15 +78,15 @@ static int FSErrorListSize = sizeof(FSErrorList); /* ARGSUSED */ int FSGetErrorDatabaseText( FSServer *svr, - register char *name, - register char *type, - char *defaultp, + const char *name, + const char *type, + const char *defaultp, char *buffer, int nbytes) { if (nbytes == 0) return 0; - (void) strncpy(buffer, (char *) defaultp, nbytes); + (void) strncpy(buffer, defaultp, nbytes); if ((strlen(defaultp) + 1) > nbytes) buffer[nbytes - 1] = '\0'; return 1; @@ -99,7 +99,7 @@ int FSGetErrorText( int nbytes) { - char *defaultp = NULL; + const char *defaultp = NULL; char buf[32]; register _FSExtension *ext; commit b6c63181aded7f8e8879914b0f92767a47aa47cf Author: Alan Coopersmith <alan.coopersm...@sun.com> Date: Wed Jun 17 16:05:03 2009 -0700 Drop #ifdef USG checks for some truly ancient (pre-SVR4) SysV's Signed-off-by: Alan Coopersmith <alan.coopersm...@sun.com> diff --git a/src/FSlibInt.c b/src/FSlibInt.c index 3d0675e..d94e242 100644 --- a/src/FSlibInt.c +++ b/src/FSlibInt.c @@ -1287,9 +1287,6 @@ _FSFreeQ(void) #ifdef hpux #define NEED_UTSNAME #endif -#ifdef USG -#define NEED_UTSNAME -#endif #ifdef SVR4 #ifndef _SEQUENT_ #define NEED_UTSNAME diff --git a/src/FSlibint.h b/src/FSlibint.h index 6991d6a..5e9cf51 100644 --- a/src/FSlibint.h +++ b/src/FSlibint.h @@ -54,22 +54,7 @@ in this Software without prior written authorization from The Open Group. */ #include <X11/Xos.h> #include <stdio.h> - -/* This is all probably superfluous given Xos.h above */ -#ifdef USG -#ifndef __TYPES__ -#include <sys/types.h> /* forgot to protect it... */ -#define __TYPES__ -#endif /* __TYPES__ */ -#else -#if defined(_POSIX_SOURCE) && defined(MOTOROLA) -#undef _POSIX_SOURCE #include <sys/types.h> -#define _POSIX_SOURCE -#else -#include <sys/types.h> -#endif -#endif /* USG */ #include "FSlib.h" #include "FSlibos.h" diff --git a/src/FSlibos.h b/src/FSlibos.h index 1e41e75..041bba1 100644 --- a/src/FSlibos.h +++ b/src/FSlibos.h @@ -297,32 +297,4 @@ typedef fd_set FdSet; #define FScalloc(nelem, elsize) calloc((nelem), (elsize)) #endif -/* - * ReadvFromServer and WritevToSever use struct iovec, normally found - * in Berkeley systems in <sys/uio.h>. See the readv(2) and writev(2) - * manual pages for details. - * - * struct iovec { - * caddr_t iov_base; - * int iov_len; - * }; - */ - -#ifdef USG - -#if defined(USG) && !defined(CRAY) && !defined(umips) && !defined(MOTOROLA) -#ifndef __TIMEVAL__ -#define __TIMEVAL__ -struct timeval { /* BSD has in <sys/time.h> */ - long tv_sec; - long tv_usec; -}; - -#endif /* __TIMEVAL__ */ - -#endif /* not CRAY or umips */ - -#endif /* USG */ - - #define SearchString(string, char) index((string), (char)) commit b566d33d344876392254941d8ef73c848194c432 Author: Alan Coopersmith <alan.coopersm...@sun.com> Date: Wed Jun 17 15:36:54 2009 -0700 Fix server name handling in IOError messages during connection setup - Don't try to sprintf a NULL string for the server name - Initialize the server name pointer in the srv struct sooner, so errors during connection initialization can print it instead of a null string in the error message Had to update the error paths that freed the partially constructed structure, so combined them into a common implmentation via "goto fail". Signed-off-by: Alan Coopersmith <alan.coopersm...@sun.com> diff --git a/src/FSOpenServ.c b/src/FSOpenServ.c index 3c29ffe..42463f5 100644 --- a/src/FSOpenServ.c +++ b/src/FSOpenServ.c @@ -88,8 +88,8 @@ void OutOfMemory( FSServer *svr, char *setup) { - - _FSDisconnectServer(svr->trans_conn); + if (svr->trans_conn) + _FSDisconnectServer(svr->trans_conn); _FSFreeServerStructure(svr); FSfree(setup); errno = ENOMEM; @@ -108,12 +108,12 @@ FSOpenServer(char *server) int endian; fsConnClientPrefix client; fsConnSetup prefix; - char *setup; + char *setup = NULL; fsConnSetupAccept conn; - char *auth_data; - char *alt_data, + char *auth_data = NULL; + char *alt_data = NULL, *ad; - AlternateServer *alts; + AlternateServer *alts = NULL; int altlen; char *vendor_string; unsigned long setuplength; @@ -128,9 +128,15 @@ FSOpenServer(char *server) errno = ENOMEM; return (FSServer *) NULL; } + + if ((svr->server_name = FSmalloc((unsigned) (strlen(server) + 1))) + == NULL) { + goto fail; + } + (void) strcpy(svr->server_name, server); + if ((svr->trans_conn = _FSConnectServer(server)) == NULL) { - FSfree((char *) svr); - return (FSServer *) NULL; + goto fail; } svr->fd = _FSTransGetConnectionNumber (svr->trans_conn); @@ -154,29 +160,21 @@ FSOpenServer(char *server) if (setuplength > (SIZE_MAX>>2) || (alt_data = (char *) (setup = FSmalloc((unsigned) setuplength))) == NULL) { - errno = ENOMEM; - FSfree((char *) svr); - return (FSServer *) NULL; + goto fail; } _FSRead(svr, (char *) alt_data, setuplength); ad = alt_data; #if SIZE_MAX <= UINT_MAX if (prefix.num_alternates > SIZE_MAX / sizeof(AlternateServer)) { - errno = ENOMEM; - FSfree((char *) alt_data); - FSfree((char *) svr); - return (FSServer *) 0; + goto fail; } #endif alts = (AlternateServer *) FSmalloc(sizeof(AlternateServer) * prefix.num_alternates); if (!alts) { - errno = ENOMEM; - FSfree((char *) alt_data); - FSfree((char *) svr); - return (FSServer *) 0; + goto fail; } for (i = 0; i < prefix.num_alternates; i++) { alts[i].subset = (Bool) *ad++; @@ -186,17 +184,14 @@ FSOpenServer(char *server) while (--i) { FSfree((char *) alts[i].name); } - FSfree((char *) alts); - FSfree((char *) alt_data); - FSfree((char *) svr); - errno = ENOMEM; - return (FSServer *) 0; + goto fail; } memmove(alts[i].name, ad, altlen); alts[i].name[altlen] = '\0'; ad += altlen + ((4 - (altlen + 2)) & 3); } FSfree((char *) alt_data); + alt_data = NULL; svr->alternate_servers = alts; svr->num_alternates = prefix.num_alternates; @@ -205,31 +200,21 @@ FSOpenServer(char *server) if (setuplength > (SIZE_MAX>>2) || (auth_data = (char *) (setup = FSmalloc((unsigned) setuplength))) == NULL) { - errno = ENOMEM; - FSfree((char *) alts); - FSfree((char *) svr); - return (FSServer *) NULL; + goto fail; } _FSRead(svr, (char *) auth_data, setuplength); if (prefix.status != AuthSuccess) { fprintf(stderr, "%s: connection to \"%s\" refused by server\r\n%s: ", "FSlib", server, "FSlib"); - FSfree((char *) alts); - FSfree((char *) svr); - FSfree(setup); - return (FSServer *) NULL; + goto fail; } /* get rest */ _FSRead(svr, (char *) &conn, (long) SIZEOF(fsConnSetupAccept)); if ((vendor_string = (char *) FSmalloc((unsigned) conn.vendor_len + 1)) == NULL) { - errno = ENOMEM; - FSfree((char *) auth_data); - FSfree((char *) alts); - FSfree((char *) svr); - return (FSServer *) NULL; + goto fail; } _FSReadPad(svr, (char *) vendor_string, conn.vendor_len); @@ -257,17 +242,9 @@ FSOpenServer(char *server) svr->last_request_read = 0; svr->last_req = (char *) &_dummy_request; - if ((svr->server_name = FSmalloc((unsigned) (strlen(server) + 1))) - == NULL) { - OutOfMemory(svr, setup); - return (FSServer *) NULL; - } - (void) strcpy(svr->server_name, server); - /* setup the output buffers */ if ((svr->bufptr = svr->buffer = FSmalloc(BUFSIZE)) == NULL) { - OutOfMemory(svr, setup); - return (FSServer *) NULL; + goto fail; } svr->bufmax = svr->buffer + BUFSIZE; @@ -276,6 +253,7 @@ FSOpenServer(char *server) svr->qlen = 0; FSfree(setup); + setup = NULL; (void) FSSynchronize(svr, _FSdebug); @@ -283,4 +261,12 @@ FSOpenServer(char *server) _FSHeadOfServerList = svr; return (svr); + + fail: /* Failure: clean up and return null */ + FSfree((char *) alts); + FSfree((char *) alt_data); + FSfree((char *) auth_data); + OutOfMemory(svr, setup); + return (FSServer *) NULL; + } diff --git a/src/FSlibInt.c b/src/FSlibInt.c index f947104..3d0675e 100644 --- a/src/FSlibInt.c +++ b/src/FSlibInt.c @@ -961,7 +961,7 @@ _FSDefaultIOError(FSServer *svr) errno, _SysErrorMsg(errno), #endif - FSServerString(svr)); + FSServerString(svr) ? FSServerString(svr) : ""); (void) fprintf(stderr, " after %lu requests (%lu known processed) with %d events remaining.\r\n", FSNextRequest(svr) - 1, FSLastKnownRequestProcessed(svr), commit eab796dabe05b4db2e193ab225deae613ac46a7b Author: Alan Coopersmith <alan.coopersm...@sun.com> Date: Tue May 19 01:58:38 2009 -0700 Make FSlib.txt prototypes match those in headers. Both conversion to ANSI C89 format and fixing some long standing mistakes. Signed-off-by: Alan Coopersmith <alan.coopersm...@sun.com> diff --git a/doc/FSlib.txt b/doc/FSlib.txt index 8cf5de0..02957d5 100644 --- a/doc/FSlib.txt +++ b/doc/FSlib.txt @@ -7,25 +7,26 @@ These functions make protocol requests corresponding to their names. Connection Setup FSServer * -FSOpenServer(server) - char *server; +FSOpenServer( + char *server); Creates a connection to the font server specified in the 'server' string. -FSCloseServer(svr) - FSServer *svr; +int +FSCloseServer( + FSServer *svr); Closes the connection to the font server. Font Manipulation Font -FSOpenXBitmap(svr, hint, fmask, name, originalid) - FSServer *svr; - fsBitmapFormat hint; - fsBitmapFormatMask fmask; - char *name; - Font *originalid; +FSOpenBitmapFont( + FSServer *svr, + fsBitmapFormat hint, + fsBitmapFormatMask fmask, + char *name, + Font *originalid); Opens the font that matches the given name (which may have '*' and '?' as wildcards). The hint contains format information that will probably @@ -33,39 +34,40 @@ be used in subsequent QueryXBitmaps() requests. The fmask tells which bits in the mask are valid. If originalid is non-zero, then the server already has the font opened under that ID. -FSCloseFont(svr, fid) - FSServer *svr; - Font fid; +int +FSCloseFont( + FSServer *svr, + Font fid); Closes the font. char ** -FSListFonts(svr, pattern, maxNames, actualCount) - FSServer *svr; - char *pattern; - int maxNames; - int *actualCount; +FSListFonts( + FSServer *svr, + char *pattern, + int maxNames, + int *actualCount); Returns the full names of the fonts matching pattern. Up to maxNames names will be returned. The actual value number be placed in actualCount. The return value should be freed with FSFreeFontNames. -FSFreeFontNames(list) - char **list +int +FSFreeFontNames( + char **list); Frees the list of font names returned by FSListFonts. char ** -FSListWithXInfo(svr, pattern, maxNames, actualCount, info, pprops, offsets, - prop_data) - FSServer *svr; - char *pattern; - int maxNames; - int *actualCount; - fsFontHeader ***info; - fsPropInfo ***pprops; - fsPropOffset ***offsets; - unsigned char ***prop_data; +FSListFontsWithXInfo( + FSServer *svr, + char *pattern, + int maxNames, + int *actualCount, + fsFontHeader ***info, + fsPropInfo ***pprops, + fsPropOffset ***offsets, + unsigned char ***prop_data); Returns the full names of the fonts matching pattern. Up to maxNames names will be returned. The actual value number be placed in @@ -73,33 +75,33 @@ actualCount, and each font's header and property information will also be returned. int -FSQueryXInfo(svr, fid, info, props, offsets, prop_data) - FSServer *svr; - Font fid; - fsFontHeader *info; - fsPropInfo *props; - fsPropOffset **offsets; - unsigned char **prop_data; +FSQueryXInfo( + FSServer *svr, + Font fid, + fsFontHeader *info, + fsPropInfo *props, + fsPropOffset **offsets, + unsigned char **prop_data); Returns the font's header information. int -FSQueryXExtents8(svr, fid, range_type, str, str_len, extents) - FSServer *svr; - Font fid; - Bool range_type; - unsigned char *str; - unsigned long str_len; - fsCharInfo **extents; +FSQueryXExtents8( + FSServer *svr, + Font fid, + Bool range_type, + unsigned char *str, + unsigned long str_len, + fsCharInfo **extents); int -FSQueryXExtents16(svr, fid, range_type, str, str_len, extents) - FSServer *svr; -- To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org