--- Imakefile.orig 2002-04-30 13:07:31 UTC +++ Imakefile @@ -11,6 +11,7 @@ World: @echo Built $(SUBDIRS). @echo 'To build Xvnc, do "cd Xvnc", followed by "./configure" then "make"' @echo "" + ( cd Xvnc && ./configure && make ) libs: @echo 'No libraries included.' --- Xvnc/config/cf/Imake.cf.orig 2006-12-23 12:07:55 UTC +++ Xvnc/config/cf/Imake.cf @@ -206,6 +206,12 @@ XCOMM $XFree86: xc/config/cf/Imake.cf,v 3.66 2001/04/1 # define i386Architecture # undef i386 # endif +# ifdef __x86_64__ +# ifndef x86_64Architecture +# define x86_64Architecture +# endif +# undef __x86_64__ +# endif # ifdef __alpha__ # define AlphaBsdArchitecture # define AlphaArchitecture --- Xvnc/config/imake/imake.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/config/imake/imake.c @@ -348,25 +348,27 @@ char *ImakefileC = "Imakefile.c"; boolean haveImakefileC = FALSE; char *cleanedImakefile = NULL; char *program; -char *FindImakefile(); -char *ReadLine(); -char *CleanCppInput(); -char *Strdup(); -char *Emalloc(); -void LogFatalI(), LogFatal(), LogMsg(); +char *FindImakefile(char *Imakefile); +char *ReadLine(FILE *tmpfd, char *tmpfname); +char *CleanCppInput(char *imakefile); +char *Strdup(register char *cp); +char *Emalloc(int size); +void LogFatalI(char *s, int i); +void LogFatal(char *x0, char *x1); +void LogMsg(char *x0, char *x1); -void showit(); -void wrapup(); -void init(); -void AddMakeArg(); -void AddCppArg(); -void SetOpts(); -void CheckImakefileC(); -void cppit(); -void makeit(); -void CleanCppOutput(); -boolean isempty(); -void writetmpfile(); +void showit(FILE *fd); +void wrapup(void); +void init(void); +void AddMakeArg(char *arg); +void AddCppArg(char *arg); +void SetOpts(int argc, char **argv); +void CheckImakefileC(char *masterc); +void cppit(char *imakefile, char *template, char *masterc, FILE *outfd, char *outfname); +void makeit(void); +void CleanCppOutput(FILE *tmpfd, char *tmpfname); +boolean isempty(register char *line); +void writetmpfile(FILE *fd, char *buf, int cnt, char *fname); boolean verbose = FALSE; boolean show = TRUE; @@ -429,7 +431,7 @@ showit(fd) } void -wrapup() +wrapup(void) { if (tmpMakefile != Makefile) unlink(tmpMakefile); @@ -455,7 +457,7 @@ catch(sig) * Initialize some variables. */ void -init() +init(void) { register char *p; @@ -471,7 +473,7 @@ init() * the default. Or if cpp is not the default. Or if the make * found by the PATH variable is not the default. */ - if (p = getenv("IMAKEINCLUDE")) { + if ((p = getenv("IMAKEINCLUDE"))) { if (*p != '-' || *(p+1) != 'I') LogFatal("Environment var IMAKEINCLUDE %s", "must begin with -I"); @@ -482,9 +484,9 @@ init() AddCppArg(p); } } - if (p = getenv("IMAKECPP")) + if ((p = getenv("IMAKECPP"))) cpp = p; - if (p = getenv("IMAKEMAKE")) + if ((p = getenv("IMAKEMAKE"))) make_argv[0] = p; if (signal(SIGINT, SIG_IGN) != SIG_IGN) @@ -1112,7 +1114,7 @@ cppit(imakefile, template, masterc, outfd, outfname) } void -makeit() +makeit(void) { doit(NULL, make_argv[0], make_argv); } @@ -1209,7 +1211,7 @@ CleanCppOutput(tmpfd, tmpfname) char *input; int blankline = 0; - while(input = ReadLine(tmpfd, tmpfname)) { + while ((input = ReadLine(tmpfd, tmpfname))) { if (isempty(input)) { if (blankline++) continue; --- Xvnc/config/imake/imakemdep.h.orig 2003-02-19 16:39:54 UTC +++ Xvnc/config/imake/imakemdep.h @@ -225,6 +225,9 @@ in this Software without prior written authorization f #ifdef hpux #define USE_CC_E #endif +#if defined(__FreeBSD__) +#define USE_CC_E +#endif #ifdef WIN32 #define USE_CC_E #define DEFAULT_CC "cl" @@ -253,7 +256,7 @@ in this Software without prior written authorization f #ifdef _CRAY #define DEFAULT_CPP "/lib/pcpp" #endif -#if defined(__386BSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) +#if defined(__386BSD__) || defined(__NetBSD__) || defined(__OpenBSD__) #define DEFAULT_CPP "/usr/libexec/cpp" #endif #if defined(__sgi) && defined(__ANSI_CPP__) --- Xvnc/config/makedepend/def.h.orig 2003-01-29 12:35:13 UTC +++ Xvnc/config/makedepend/def.h @@ -135,15 +135,21 @@ char *malloc(); char *realloc(); #endif -char *copy(); -char *base_name(); -char *x_getline(); -struct symtab **slookup(); -struct symtab **isdefined(); -struct symtab **fdefined(); -struct filepointer *getfile(); -struct inclist *newinclude(); -struct inclist *inc_path(); +/* main.c */ +char *copy(register char *str); +char *base_name(register char *file); +char *x_getline(register struct filepointer *filep); +struct filepointer *getfile(char *file); + +/* parse.c */ +struct symtab **slookup(register char *symbol, register struct inclist *file); +struct symtab **isdefined(register char *symbol, struct inclist *file, struct inclist **srcfile); +struct symtab **fdefined(register char *symbol, struct inclist *file, struct inclist **srcfile); + +/* include.c */ +struct inclist *newinclude(register char *newfile, register char *incstring); +struct inclist *inc_path(register char *file, register char *include, boolean dot); +void inc_clean(void); #if NeedVarargsPrototypes extern void fatalerr(char *, ...); --- Xvnc/config/makedepend/ifparser.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/config/makedepend/ifparser.c @@ -62,6 +62,8 @@ #include "ifparser.h" #include +#include +#include /**************************************************************************** Internal Macros and Utilities for Parser --- Xvnc/config/makedepend/ifparser.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/config/makedepend/ifparser.h @@ -68,10 +68,10 @@ typedef int Bool; typedef struct _if_parser { struct { /* functions */ - char *(*handle_error) (/* struct _if_parser *, const char *, - const char * */); - long (*eval_variable) (/* struct _if_parser *, const char *, int */); - int (*eval_defined) (/* struct _if_parser *, const char *, int */); + char *(*handle_error) (struct _if_parser *, const char *, + const char *); + long (*eval_variable) (struct _if_parser *, const char *, int); + int (*eval_defined) (struct _if_parser *, const char *, int); } funcs; char *data; } IfParser; --- Xvnc/config/makedepend/include.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/config/makedepend/include.c @@ -228,7 +228,7 @@ included_by(ip, newfile) } void -inc_clean () +inc_clean(void) { register struct inclist *ip; --- Xvnc/config/makedepend/main.c.orig 2003-01-29 12:35:13 UTC +++ Xvnc/config/makedepend/main.c @@ -101,8 +101,9 @@ boolean verbose = FALSE; boolean show_where_not = FALSE; boolean warn_multiple = FALSE; /* Warn on multiple includes of same file */ -void freefile(); -void redirect(); +void freefile(struct filepointer *fp); +void redirect(char *line, char *makefile); + #if !NeedVarargsPrototypes void fatalerr(); void warning(); --- Xvnc/config/makedepend/parse.c.orig 2003-01-29 12:35:13 UTC +++ Xvnc/config/makedepend/parse.c @@ -40,7 +40,7 @@ gobble(filep, file, file_red) register char *line; register int type; - while (line = x_getline(filep)) { + while ((line = x_getline(filep))) { switch(type = deftype(line, filep, file_red, file, FALSE)) { case IF: case IFFALSE: @@ -245,7 +245,7 @@ struct symtab **fdefined(symbol, file, srcfile) if (file->i_flags & DEFCHECKED) return(NULL); file->i_flags |= DEFCHECKED; - if (val = slookup(symbol, file)) + if ((val = slookup(symbol, file))) debug(1,("%s defined in %s as %s\n", symbol, file->i_file, (*val)->s_value)); if (val == NULL && file->i_list) @@ -274,12 +274,12 @@ struct symtab **isdefined(symbol, file, srcfile) { register struct symtab **val; - if (val = slookup(symbol, &maininclist)) { + if ((val = slookup(symbol, &maininclist))) { debug(1,("%s defined on command line\n", symbol)); if (srcfile != NULL) *srcfile = &maininclist; return(val); } - if (val = fdefined(symbol, file, srcfile)) + if ((val = fdefined(symbol, file, srcfile))) return(val); debug(1,("%s not defined in %s\n", symbol, file->i_file)); return(NULL); @@ -529,7 +529,7 @@ find_includes(filep, file, file_red, recursion, failOK register int type; boolean recfailOK; - while (line = x_getline(filep)) { + while ((line = x_getline(filep))) { switch(type = deftype(line, filep, file_red, file, TRUE)) { case IF: doif: --- Xvnc/config/util/lndir.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/config/util/lndir.c @@ -52,6 +52,7 @@ in this Software without prior written authorization f #include #endif #include +#include #ifndef X_NOT_POSIX #include @@ -208,7 +209,7 @@ int rel; /* if true, prepend "../" to fn before usin p = buf + strlen (buf); *p++ = '/'; n_dirs = fs->st_nlink; - while (dp = readdir (df)) { + while ((dp = readdir (df))) { if (dp->d_name[strlen(dp->d_name) - 1] == '~') continue; strcpy (p, dp->d_name); --- Xvnc/config/util/makestrs.c.orig 2002-04-30 13:07:31 UTC +++ Xvnc/config/util/makestrs.c @@ -246,7 +246,7 @@ static void WriteHeader (tagline, phile, abi) char* tmp; Table* t; TableEnt* te; - static void (*headerproc[])() = { + static void (*headerproc[])(FILE* f, File* phile) = { DefaultWriteHeader, ArrayperWriteHeader, IntelABIWriteHeader, IntelABIWriteHeader, SPARCABIWriteHeader, FunctionWriteHeader }; @@ -415,7 +415,7 @@ static void WriteSource(tagline, abi) char* tagline; int abi; { - static void (*sourceproc[])() = { + static void (*sourceproc[])(int) = { DefaultWriteSource, ArrayperWriteSource, IntelABIWriteSource, IntelABIBCWriteSource, DefaultWriteSource, FunctionWriteSource }; @@ -579,7 +579,7 @@ static void DoLine(buf) int rlen; int len; - if (right = index(buf, ' ')) + if ((right = index(buf, ' '))) *right++ = 0; else right = buf + 1; --- Xvnc/include/Xmd.h.orig 2006-12-23 12:07:55 UTC +++ Xvnc/include/Xmd.h @@ -59,7 +59,7 @@ SOFTWARE. #ifdef CRAY #define WORD64 /* 64-bit architecture */ #endif -#if defined(__alpha) || defined(__alpha__) || defined(__x86_64__) +#if defined(__alpha) || defined(__alpha__) || defined(__x86_64__) || defined(__powerpc64__) || defined(__aarch64__) #define LONG64 /* 32/64-bit architecture */ #endif #ifdef __sgi --- Xvnc/include/Xos.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/include/Xos.h @@ -151,7 +151,6 @@ extern int sys_nerr; #endif /* X_NOT_POSIX else */ #ifdef CSRG_BASED -#include #include #endif /* CSRG_BASED */ --- Xvnc/include/fonts/font.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/include/fonts/font.h @@ -99,14 +99,16 @@ typedef int DrawDirection; #define DEFAULT_GLYPH_CACHING_MODE CACHING_OFF extern int glyphCachingMode; +#if 0 extern int StartListFontsWithInfo( #if NeedFunctionPrototypes ClientPtr /*client*/, int /*length*/, - unsigned char */*pattern*/, + unsigned char * /*pattern*/, int /*max_names*/ #endif ); +#endif extern FontNamesPtr MakeFontNamesRecord( #if NeedFunctionPrototypes --- Xvnc/lib/Xau/AuDispose.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/Xau/AuDispose.c @@ -28,6 +28,7 @@ in this Software without prior written authorization f */ #include +#include void XauDisposeAuth (auth) --- Xvnc/lib/Xau/AuFileName.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/Xau/AuFileName.c @@ -38,7 +38,7 @@ char *malloc (), *getenv (); #endif char * -XauFileName () +XauFileName(void) { char *slashDotXauthority = "/.Xauthority"; char *name; @@ -49,7 +49,7 @@ XauFileName () #endif int size; - if (name = getenv ("XAUTHORITY")) + if ((name = getenv ("XAUTHORITY"))) return name; name = getenv ("HOME"); if (!name) { --- Xvnc/lib/Xau/Xauth.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/Xau/Xauth.h @@ -58,7 +58,7 @@ typedef struct xauth { _XFUNCPROTOBEGIN -char *XauFileName(); +char *XauFileName(void); Xauth *XauReadAuth( #if NeedFunctionPrototypes --- Xvnc/lib/Xdmcp/Alloc.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/Xdmcp/Alloc.c @@ -31,9 +31,9 @@ in this Software without prior written authorization f /* stubs for use when Xalloc, Xrealloc and Xfree are not defined */ -extern char *malloc (), *realloc (); +#include -unsigned long * +void * Xalloc (amount) unsigned amount; { @@ -42,22 +42,22 @@ Xalloc (amount) return (unsigned long *) malloc (amount); } -unsigned long * +void * Xrealloc (old, amount) - unsigned long *old; + void *old; unsigned amount; { if (amount == 0) amount = 1; if (!old) - return (unsigned long *) malloc (amount); - return (unsigned long *) realloc ((char *) old, amount); + return malloc (amount); + return realloc (old, amount); } void Xfree (old) - unsigned long *old; + void *old; { if (old) - free ((char *) old); + free (old); } --- Xvnc/lib/Xdmcp/GenKey.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/Xdmcp/GenKey.c @@ -57,11 +57,7 @@ extern Time_t time (); #define random lrand48 #endif -#ifdef linux #include -#else -long random(); -#endif void XdmcpGenerateKey (key) --- Xvnc/lib/Xdmcp/Wrap.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/Xdmcp/Wrap.h @@ -7,4 +7,4 @@ typedef unsigned char auth_cblock[8]; /* block size */ typedef struct auth_ks_struct { auth_cblock _; } auth_wrapper_schedule[16]; -extern void _XdmcpWrapperToOddParity(); +extern void _XdmcpWrapperToOddParity(unsigned char *in, unsigned char *out); --- Xvnc/lib/Xdmcp/Xdmcp.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/Xdmcp/Xdmcp.h @@ -98,34 +98,43 @@ typedef struct _XdmAuthKey { typedef char *XdmcpNetaddr; +extern int XdmcpWriteCARD8(XdmcpBufferPtr buffer, CARD8 value); +extern int XdmcpWriteCARD16(XdmcpBufferPtr buffer, CARD16 value); +extern int XdmcpWriteCARD32(XdmcpBufferPtr buffer, CARD32 value); +extern int XdmcpWriteARRAY8(XdmcpBufferPtr buffer, ARRAY8Ptr array); +extern int XdmcpWriteARRAY16(XdmcpBufferPtr buffer, ARRAY16Ptr array); +extern int XdmcpWriteARRAY32(XdmcpBufferPtr buffer, ARRAY32Ptr array); +extern int XdmcpWriteARRAYofARRAY8(XdmcpBufferPtr buffer, ARRAYofARRAY8Ptr array); +extern int XdmcpWriteHeader(XdmcpBufferPtr buffer, XdmcpHeaderPtr header); +extern int XdmcpFlush(int fd, XdmcpBufferPtr buffer, XdmcpNetaddr to, int len); -extern int XdmcpWriteCARD8(), XdmcpWriteCARD16(); -extern int XdmcpWriteCARD32(); -extern int XdmcpWriteARRAY8(), XdmcpWriteARRAY16(); -extern int XdmcpWriteARRAY32(), XdmcpWriteARRAYofARRAY8(); -extern int XdmcpWriteHeader(), XdmcpFlush(); +extern int XdmcpReadCARD8(XdmcpBufferPtr buffer, CARD8Ptr valuep); +extern int XdmcpReadCARD16(XdmcpBufferPtr buffer, CARD16Ptr valuep); +extern int XdmcpReadCARD32(XdmcpBufferPtr buffer, CARD32Ptr valuep); +extern int XdmcpReadARRAY8(XdmcpBufferPtr buffer, ARRAY8Ptr array); +extern int XdmcpReadARRAY16(XdmcpBufferPtr buffer, ARRAY16Ptr array); +extern int XdmcpReadARRAY32(XdmcpBufferPtr buffer, ARRAY32Ptr array); +extern int XdmcpReadARRAYofARRAY8(XdmcpBufferPtr buffer, ARRAYofARRAY8Ptr array); +extern int XdmcpReadHeader(XdmcpBufferPtr buffer, XdmcpHeaderPtr header); +extern int XdmcpFill(int fd, XdmcpBufferPtr buffer, XdmcpNetaddr from, int *fromlen); -extern int XdmcpReadCARD8(), XdmcpReadCARD16(); -extern int XdmcpReadCARD32(); -extern int XdmcpReadARRAY8(), XdmcpReadARRAY16(); -extern int XdmcpReadARRAY32(), XdmcpReadARRAYofARRAY8(); -extern int XdmcpReadHeader(), XdmcpFill(); +extern int XdmcpReadRemaining(XdmcpBufferPtr buffer); -extern int XdmcpReadRemaining(); +extern void XdmcpDisposeARRAY8(ARRAY8Ptr array); +extern void XdmcpDisposeARRAY16(ARRAY16Ptr array); +extern void XdmcpDisposeARRAY32(ARRAY32Ptr array); +extern void XdmcpDisposeARRAYofARRAY8(ARRAYofARRAY8Ptr array); -extern void XdmcpDisposeARRAY8(), XdmcpDisposeARRAY16(); -extern void XdmcpDisposeARRAY32(), XdmcpDisposeARRAYofARRAY8(); +extern int XdmcpCopyARRAY8(ARRAY8Ptr src, ARRAY8Ptr dst); -extern int XdmcpCopyARRAY8(); +extern int XdmcpARRAY8Equal(ARRAY8Ptr array1, ARRAY8Ptr array2); -extern int XdmcpARRAY8Equal(); - #ifdef HASXDMAUTH -extern void XdmcpGenerateKey(); -extern void XdmcpIncrementKey(); -extern void XdmcpDecrementKey(); -extern void XdmcpWrap(); -extern void XdmcpUnwrap(); +extern void XdmcpGenerateKey(XdmAuthKeyPtr key); +extern void XdmcpIncrementKey(XdmAuthKeyPtr key); +extern void XdmcpDecrementKey(XdmAuthKeyPtr key); +extern void XdmcpWrap(unsigned char *input, unsigned char *wrapper, unsigned char *output, int bytes); +extern void XdmcpUnwrap(unsigned char *input, unsigned char *wrapper, unsigned char *output, int bytes); #endif #ifndef TRUE @@ -134,8 +143,9 @@ extern void XdmcpUnwrap(); #endif #if !defined(Xalloc) && !defined(xalloc) && !defined(Xrealloc) -extern long *Xalloc (), *Xrealloc (); -extern void Xfree(); +extern long *Xalloc(unsigned long amount); +extern long *Xrealloc(register void *ptr, unsigned long amount); +extern void Xfree(register void *ptr); #endif #endif /* _XDMCP_H_ */ --- Xvnc/lib/font/Speedo/do_char.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Speedo/do_char.c @@ -747,7 +747,7 @@ if (fn_begin_char(sp_globals.Psw, Pmin, Pmax)) /* Sign do { pointer = pointer_sav; /* Point to next DOCH or END instruction */ - while (format = NEXT_BYTE(pointer)) /* DOCH instruction? */ + while ((format = NEXT_BYTE(pointer))) /* DOCH instruction? */ { init_tcb(); /* Initialize transformation control block */ x_posn = sp_get_posn_arg(&pointer, format); --- Xvnc/lib/font/Speedo/out_bl2d.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Speedo/out_bl2d.c @@ -289,7 +289,7 @@ if (how_many_y < 0) #endif #if INCL_2D -FUNCTION boolean end_char_2d() +FUNCTION boolean sp_end_char_2d(void) GDECL /* Called when all character data has been output * Return TRUE if output process is complete @@ -608,7 +608,7 @@ if (++sp_globals.next_offset >= MAX_INTERCEPTS) /* Int #endif #if INCL_2D -FUNCTION static void sp_proc_intercepts_2d() +FUNCTION static void sp_proc_intercepts_2d(void) GDECL /* Called by sp_make_char to output accumulated intercept lists * Clips output to xmin, xmax, sp_globals.ymin, ymax boundaries --- Xvnc/lib/font/Speedo/out_blk.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Speedo/out_blk.c @@ -282,7 +282,7 @@ if (how_many_y < 0) } #endif #if INCL_BLACK -FUNCTION boolean end_char_black() +FUNCTION boolean sp_end_char_black(void) GDECL /* Called when all character data has been output * Return TRUE if output process is complete @@ -586,7 +586,7 @@ if (++sp_globals.next_offset >= MAX_INTERCEPTS) /* Int #endif #if INCL_BLACK -FUNCTION LOCAL void sp_proc_intercepts_black() +FUNCTION LOCAL void sp_proc_intercepts_black(void) GDECL /* Called by sp_make_char to output accumulated intercept lists --- Xvnc/lib/font/Speedo/out_scrn.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Speedo/out_scrn.c @@ -427,7 +427,7 @@ if (how_many_y < 0) #endif #if INCL_SCREEN -FUNCTION void end_contour_screen() +FUNCTION void sp_end_contour_screen(void) GDECL /* Called after the last vector in each contour */ @@ -442,7 +442,7 @@ sp_intercepts.inttype[sp_globals.next_offset-1] |= END #if INCL_SCREEN -FUNCTION boolean end_char_screen() +FUNCTION boolean sp_end_char_screen(void) GDECL /* Called when all character data has been output * Return TRUE if output process is complete @@ -752,7 +752,7 @@ if (++sp_globals.next_offset >= MAX_INTERCEPTS) /* Int #endif #if INCL_SCREEN -FUNCTION LOCAL void sp_proc_intercepts_screen() +FUNCTION LOCAL void sp_proc_intercepts_screen(void) GDECL /* Called by sp_make_char to output accumulated intercept lists --- Xvnc/lib/font/Speedo/out_util.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Speedo/out_util.c @@ -106,7 +106,7 @@ printf("CURVE_OUT(%3.1f, %3.1f, %3.1f, %3.1f, %3.1f, % -FUNCTION void end_contour_out() +FUNCTION void sp_end_contour_out(void) GDECL /* Called after the last vector in each contour */ @@ -117,7 +117,7 @@ printf("END_CONTOUR_OUT()\n"); } -FUNCTION void end_sub_char_out() +FUNCTION void sp_end_sub_char_out(void) GDECL /* Called after the last contour in each sub-character in a compound character */ @@ -128,7 +128,7 @@ printf("END_SUB_CHAR_OUT()\n"); } -FUNCTION void init_intercepts_out() +FUNCTION void sp_init_intercepts_out(void) GDECL /* Called to initialize intercept storage data structure */ @@ -199,7 +199,7 @@ sp_intercepts.inttype[sp_globals.no_y_lists-1] = END_I } -FUNCTION void restart_intercepts_out() +FUNCTION void sp_restart_intercepts_out(void) GDECL /* Called by sp_make_char when a new sub character is started @@ -306,7 +306,7 @@ sp_globals.x_band.band_max = sp_globals.xmax /* - 1 + -FUNCTION void reduce_band_size_out() +FUNCTION void sp_reduce_band_size_out(void) GDECL { sp_globals.y_band.band_min = sp_globals.y_band.band_max - ((sp_globals.y_band.band_max - sp_globals.y_band.band_min) >> 1); @@ -316,7 +316,7 @@ sp_globals.y_band.band_array_offset = sp_globals.y_ban } -FUNCTION boolean next_band_out() +FUNCTION boolean sp_next_band_out(void) GDECL { fix15 tmpfix15; --- Xvnc/lib/font/Speedo/reset.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Speedo/reset.c @@ -55,7 +55,7 @@ WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTL /***** STATIC FUNCTIONS *****/ -FUNCTION void reset() +FUNCTION void sp_reset(void) GDECL /* * Called by the host software to intialize the Speedo mechanism --- Xvnc/lib/font/Speedo/set_trns.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Speedo/set_trns.c @@ -76,7 +76,7 @@ static ufix8 FONTFAR *sp_setup_int_table(); /* Read #endif -FUNCTION void init_tcb() +FUNCTION void sp_init_tcb(void) GDECL /* * Called by sp_make_char() and make_comp_char() to initialize the current @@ -133,8 +133,8 @@ intsize[6] = 2; intsize[7] = 0; intsize[8] = 0; -n = ((format & BIT6)? (fix15)NEXT_BYTE(pointer): 0) + - ((format & BIT7)? (fix15)NEXT_BYTE(pointer): 0); +n = ((format & BIT6)? (fix15)(NEXT_BYTE(pointer)): 0); +n += ((format & BIT7)? (fix15)(NEXT_BYTE(pointer)): 0); for (i = 0; i < n; i++) /* For each entry in int table ... */ { format = NEXT_BYTE(pointer); /* Read format byte */ @@ -272,7 +272,7 @@ return pointer; #endif #if INCL_RULES -FUNCTION static void sp_constr_update() +FUNCTION static void sp_constr_update(void) GDECL /* * Called by plaid_tcb() to update the constraint table for the current @@ -348,7 +348,7 @@ for (j = 0; ; j++) for (l = 2; l > 0; l--) /* Skip 2 arguments */ { format1 >>= 2; - if (size = format1 & 0x03) + if ((size = format1 & 0x03)) pointer += size - 1; } } @@ -378,7 +378,7 @@ for (j = 0; ; j++) format1 = format; for (l = 3; l > 0; l--) /* Skip over 3 arguments */ { - if (size = format1 & 0x03) + if ((size = format1 & 0x03)) pointer += size - 1; format1 >>= 2; } --- Xvnc/lib/font/Speedo/speedo.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Speedo/speedo.h @@ -95,7 +95,7 @@ WITH THE SPEEDO SOFTWARE OR THE BITSTREAM CHARTER OUTL #endif #ifndef PROTOS_AVAIL /* 1 to use function prototyping */ -#define PROTOS_AVAIL 0 /* 0 to suppress it */ +#define PROTOS_AVAIL 1 /* 0 to suppress it */ #endif #ifndef FONTFAR /* if Intel mixed memory model implementation */ --- Xvnc/lib/font/Speedo/spfont.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Speedo/spfont.c @@ -81,10 +81,10 @@ from the X Consortium. #endif -extern void SpeedoCloseFont(); -static int sp_get_glyphs(); -static int sp_get_metrics(); -static int sp_load_font(); +extern void SpeedoCloseFont(FontPtr pfont); +static int sp_get_glyphs(FontPtr pFont, unsigned long count, register unsigned char *chars, FontEncoding charEncoding, unsigned long *glyphCount, CharInfoPtr *glyphs); +static int sp_get_metrics(FontPtr pFont, unsigned long count, register unsigned char *chars, FontEncoding charEncoding, unsigned long *glyphCount, xCharInfo **glyphs); +static int sp_load_font(char *fontname, char *filename, FontEntryPtr entry, FontScalablePtr vals, fsBitmapFormat format, fsBitmapFormatMask fmask, FontPtr pfont, Mask flags); static CharInfoRec junkDefault; --- Xvnc/lib/font/Speedo/spfuncs.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Speedo/spfuncs.c @@ -147,12 +147,12 @@ SpeedoGetInfoScaleable(fpe, pFontInfo, entry, fontName } static FontRendererRec renderer = { - ".spd", 4, (int (*)()) 0, SpeedoOpenScalable, - (int (*)()) 0, SpeedoGetInfoScaleable, 0 + ".spd", 4, (int (*)(FontPathElementPtr, FontPtr *, int, FontEntryPtr, char *, fsBitmapFormat, fsBitmapFormatMask, FontPtr)) 0, SpeedoOpenScalable, + (int (*)(FontPathElementPtr, FontInfoPtr, FontEntryPtr, char *)) 0, SpeedoGetInfoScaleable, 0 , CAP_MATRIX | CAP_CHARSUBSETTING }; -SpeedoRegisterFontFileFunctions() +SpeedoRegisterFontFileFunctions(void) { sp_make_standard_props(); sp_reset(); --- Xvnc/lib/font/Speedo/spglyph.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Speedo/spglyph.c @@ -286,7 +286,7 @@ sp_open_bitmap(x_set_width, y_set_width, xorg, yorg, x } void -sp_close_bitmap() +sp_close_bitmap(void) { CharInfoPtr ci = &sp_fp_cur->encoding[cfv->char_id - sp_fp_cur->master->first_char_id]; int bpr = cfv->bpr; --- Xvnc/lib/font/Speedo/spinfo.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Speedo/spinfo.c @@ -55,6 +55,7 @@ from the X Consortium. #include "fntfilst.h" #include "spint.h" #include +#include /* percentage of pointsize used to specify ascent & descent */ #define STRETCH_FACTOR 120 @@ -116,7 +117,7 @@ static fontProp extraProps[] = { #define NPROPS (NNAMEPROPS + NEXTRAPROPS) void -sp_make_standard_props() +sp_make_standard_props(void) { int i; fontProp *t; --- Xvnc/lib/font/Speedo/spint.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Speedo/spint.h @@ -143,24 +143,24 @@ typedef struct _sp_font { extern SpeedoFontPtr sp_fp_cur; -extern int sp_open_font(); -extern int sp_open_master(); -extern void sp_close_font(); -extern void sp_close_master_font(); -extern void sp_close_master_file(); -extern void sp_reset_master(); +extern int sp_open_font(char *fontname, char *filename, FontEntryPtr entry, FontScalablePtr vals, fsBitmapFormat format, fsBitmapFormatMask fmask, Mask flags, SpeedoFontPtr *spfont); +extern int sp_open_master(char *filename, SpeedoMasterFontPtr *master); +extern void sp_close_font(SpeedoFontPtr spf); +extern void sp_close_master_font(SpeedoMasterFontPtr spmf); +extern void sp_close_master_file(SpeedoMasterFontPtr spmf); +extern void sp_reset_master(SpeedoMasterFontPtr spmf); #if NeedVarargsPrototypes extern void SpeedoErr(char *fmt, ...); #else extern void SpeedoErr(); #endif -extern void sp_make_standard_props(); -extern void sp_make_header(); -extern void sp_compute_bounds(); -extern void sp_compute_props(); -extern int sp_build_all_bitmaps(); -extern unsigned long sp_compute_data_size(); +extern void sp_make_standard_props(void); +extern void sp_make_header(SpeedoFontPtr spf, FontInfoPtr pinfo); +extern void sp_compute_bounds(SpeedoFontPtr spf, FontInfoPtr pinfo, unsigned long flags, long *sWidth); +extern void sp_compute_props(SpeedoFontPtr spf, char *fontname, FontInfoPtr pinfo, long sWidth); +extern int sp_build_all_bitmaps(FontPtr pfont, fsBitmapFormat format, fsBitmapFormatMask fmask); +extern unsigned long sp_compute_data_size(FontPtr pfont, int mappad, int scanlinepad, unsigned long start, unsigned long end); extern int sp_bics_map[]; extern int sp_bics_map_size; --- Xvnc/lib/font/Type1/arith.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/arith.h @@ -30,12 +30,6 @@ #include /* LONG64 */ -void DLmult(),DLdiv(),DLadd(),DLsub(); - -fractpel FPmult(); -fractpel FPdiv(); -fractpel FPstarslash(); - /*END SHARED*/ /*SHARED*/ @@ -55,6 +49,15 @@ typedef struct { } doublelong; #endif /* LONG64 else */ +void DLmult(register doublelong *product, register unsigned long u, register unsigned long v); +void DLdiv(doublelong *quotient, unsigned long divisor); +void DLadd(doublelong *u, doublelong *v); +void DLsub(doublelong *u, doublelong *v); + +fractpel FPmult(register fractpel u, register fractpel v); +fractpel FPdiv(register fractpel u, register fractpel v); +fractpel FPstarslash(register fractpel a, register fractpel b, register fractpel c); + /*END SHARED*/ /*SHARED*/ --- Xvnc/lib/font/Type1/blues.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/blues.h @@ -29,7 +29,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -extern psobj *GetType1CharString(); +extern psobj *GetType1CharString(psfont *fontP, unsigned char code); #define TOPLEFT 1 #define BOTTOMRIGHT 2 --- Xvnc/lib/font/Type1/curves.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/curves.h @@ -34,7 +34,7 @@ #define FlattenConic(xM,yM,xC,yC,r) t1_StepConic(NULL,(fractpel)0,(fractpel)0,xM,yM,xC,yC,r) #define FlattenBezier(xB,yB,xC,yC,xD,yD) t1_StepBezier(NULL,(fractpel)0,(fractpel)0,xB,yB,xC,yC,xD,yD) -struct segment *t1_StepConic(); -struct segment *t1_StepBezier(); +struct segment *t1_StepConic(struct region *R, fractpel xA, fractpel yA, fractpel xB, fractpel yB, fractpel xC, fractpel yC, int r); +struct segment *t1_StepBezier(struct region *R, fractpel xA, fractpel yA, fractpel xB, fractpel yB, fractpel xC, fractpel yC, fractpel xD, fractpel yD); /*END SHARED*/ --- Xvnc/lib/font/Type1/fontfcn.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/fontfcn.c @@ -31,12 +31,16 @@ #include #include -#include "t1imager.h" #include "util.h" #include "fontfcn.h" #include "fontmisc.h" +#include "objects.h" +#include "spaces.h" +#include "paths.h" +#include "regions.h" +#include "t1imager.h" +#include "blues.h" -extern xobject Type1Char(); /***================================================================***/ /* GLOBALS */ /***================================================================***/ @@ -137,8 +141,6 @@ unsigned char *code; int *lenP; int *mode; { - path updateWidth(); - psobj *charnameP; /* points to psobj that is name of character*/ int N; unsigned char *s; /* used to search the name for '|' */ --- Xvnc/lib/font/Type1/fontfcn.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/fontfcn.h @@ -41,9 +41,9 @@ struct blues_struct *BluesP; /* Routines in scan_font */ /***================================================================***/ -extern boolean Init_StdEnc(); -extern int scan_font(); -extern int GetFontInfo(); + +extern int scan_font(psfont *FontP); + /***================================================================***/ /* Return codes from scan_font */ /***================================================================***/ --- Xvnc/lib/font/Type1/hints.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/hints.c @@ -81,7 +81,7 @@ static struct { #define FPFLOOR(fp) TOFRACTPEL((fp) >> FRACTBITS) #define FPROUND(fp) FPFLOOR((fp) + FPHALF) -void InitHints() +void t1_InitHints(void) { int i; @@ -626,7 +626,8 @@ get all the way to the outside without resolving ambig A debug tool. */ -static struct edgelist *before(); /* subroutine of DumpSubPaths */ +/* subroutine of DumpSubPaths */ +static struct edgelist *before(struct edgelist *e); static void DumpSubPaths(anchor) struct edgelist *anchor; --- Xvnc/lib/font/Type1/hints.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/hints.h @@ -29,14 +29,18 @@ /*SHARED*/ #define InitHints() t1_InitHints() -void t1_InitHints(); /* Initialize hint data structure */ - +/* Initialize hint data structure */ +void t1_InitHints(void); + #define CloseHints(hintP) t1_CloseHints(hintP) -void t1_CloseHints(); /* Reverse hints that are still open */ +/* Reverse hints that are still open */ +void t1_CloseHints(struct fractpoint *hintP); #define ProcessHint(hP, currX, currY, hintP) t1_ProcessHint(hP, currX, currY, hintP) -void t1_ProcessHint(); /* Process a rasterization hint */ +/* Process a rasterization hint */ +void t1_ProcessHint(struct hintsegment *hP, fractpel currX, fractpel currY, struct fractpoint *hintP); #define ApplyContinuity(R) t1_ApplyContinuity(R) -void t1_ApplyContinuity(); /* fix false connection breaks in a region */ +/* fix false connection breaks in a region */ +void t1_ApplyContinuity(struct region *R); /*END SHARED*/ --- Xvnc/lib/font/Type1/lines.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/lines.c @@ -40,6 +40,7 @@ The included files are: #include "objects.h" #include "spaces.h" +#include "paths.h" #include "regions.h" #include "lines.h" --- Xvnc/lib/font/Type1/lines.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/lines.h @@ -31,7 +31,9 @@ #define StepLine(R,x1,y1,x2,y2) t1_StepLine(R,x1,y1,x2,y2) #define Bresenham(e,x1,y1,x2,y2) t1_Bresenham(e,x1,y1,x2,y2) -void t1_StepLine(); /* check for special conditions, call Bresenham */ -void t1_Bresenham(); /* produce run ends for lines */ +/* check for special conditions, call Bresenham */ +void t1_StepLine(register struct region *R, register fractpel x1, register fractpel y1, register fractpel x2, register fractpel y2); +/* produce run ends for lines */ +void t1_Bresenham(register pel *edgeP, register fractpel x1, register fractpel y1, register fractpel x2, register fractpel y2); /*END SHARED*/ --- Xvnc/lib/font/Type1/objects.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/objects.c @@ -55,6 +55,8 @@ you do do not need to include these header files. #include #include +#include +#include /* override incorrect system functions; for example you might define @@ -72,9 +74,12 @@ a macro for "strcpy" that diverts it to "my_strcpy". #include "pictures.h" #include "strokes.h" #include "cluts.h" -static char *TypeFmt(); -static ObjectPostMortem(); +extern char *xiMalloc(register unsigned size); + +static char *TypeFmt(int type); +static ObjectPostMortem(register struct xobject *obj); + /* :h3.The "pointer" Macro - Define a Generic Pointer @@ -286,8 +291,6 @@ struct xobject *t1_Allocate(size, template, extra) /* register struct xobject *template; /* example structure to allocate */ register int extra; /* any extra uninitialized bytes needed contiguously */ { - extern char *xiMalloc(); /* standard C routine */ - register struct xobject *r; /* @@ -531,15 +534,15 @@ struct xobject *t1_Copy(obj) return(NULL); if (ISPATHTYPE(obj->type)) - obj = (struct xobject *) CopyPath(obj); + obj = (struct xobject *) t1_CopyPath((struct segment *)obj); else switch (obj->type) { case SPACETYPE: - obj = (struct xobject *) CopySpace(obj); break; + obj = (struct xobject *) CopySpace((struct XYspace *)obj); break; case FONTTYPE: obj = (struct xobject *) CopyFont(obj); break; case REGIONTYPE: - obj = (struct xobject *) CopyRegion(obj); break; + obj = (struct xobject *) CopyRegion((struct region *)obj); break; case PICTURETYPE: obj = (struct xobject *) CopyPicture(obj); break; case LINESTYLETYPE: @@ -573,11 +576,11 @@ struct xobject *Destroy(obj) /* non-ANSI avoids overly return(NULL); } if (ISPATHTYPE(obj->type)) - KillPath(obj); + KillPath((struct segment *)obj); else { switch (obj->type) { case REGIONTYPE: - KillRegion(obj); + KillRegion((struct region *)obj); break; case SPACETYPE: KillSpace(obj); @@ -893,6 +896,7 @@ if it is already known that the object is temporary, i just kill it rather than consume it, for example, KillSpace(). */ +#if 0 void Consume(n, obj1, obj2, obj3) /* non-ANSI avoids overly strict type checking */ int n; struct xobject *obj1,*obj2,*obj3; @@ -927,6 +931,23 @@ void Consume(n, obj1, obj2, obj3) /* non-ANSI avoids o abort("Consume: too many objects"); } } +#else +void t1_Consume(int n, ...) +{ + va_list ap; + struct xobject *obj; + int i; + + va_start(ap, n); + for ( i=0; i < n; i++ ) + { + obj = va_arg(ap, struct xobject *); + if (obj != NULL && !ISPERMANENT(obj->flag)) + Destroy(obj); + } + va_end(ap); +} +#endif /* :h3.TypeErr() - Handles "Invalid Object Type" Errors */ @@ -1062,7 +1083,7 @@ Defined in objects.h to be FatalError(), the server's :h4.ErrorMsg() - Return the User an Error Message */ -char *ErrorMsg() +char *t1_ErrorMsg(void) { register char *r; @@ -1081,7 +1102,7 @@ anyway.) Note that TYPE1IMAGER makes no assumptions a :i1/portability assumptions/ */ -void InitImager() +void t1_InitImager(void) { /* Check to see if we have been using our own malloc. If so,*/ @@ -1106,14 +1127,14 @@ In some environments, constants and/or exception handl This only makes sense in a server environment; true TYPE1IMAGER needs do nothing. */ -void TermImager() +void t1_TermImager(void) { return; } /* :h4.reportusage() - A Stub to Get a Clean Link with Portable PMP */ -void reportusage() +void reportusage(void) { return; } --- Xvnc/lib/font/Type1/objects.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/objects.h @@ -40,36 +40,29 @@ #define Pragmatics(f,v) t1_Pragmatics(f,v) #define ErrorMsg() t1_ErrorMsg() -struct xobject *t1_Permanent(); /* make an object permanent */ -struct xobject *t1_Temporary(); /* make an object temporary */ -struct xobject *t1_Destroy(); /* destroy an object */ -struct xobject *t1_Dup(); /* duplicate an object */ -void t1_InitImager(); /* initialize TYPE1IMAGER */ -void t1_TermImager(); /* terminate TYPE1IMAGER */ -void t1_Pragmatics(); /* set debug flags, etc. */ -char *t1_ErrorMsg(); /* return last TYPE1IMAGER error message */ +/* make an object permanent */ +struct xobject *t1_Permanent(register struct xobject *obj); +/* make an object temporary */ +struct xobject *t1_Temporary(register struct xobject *obj); +/* destroy an object */ +struct xobject *t1_Destroy(register struct xobject *obj); +/* duplicate an object */ +struct xobject *t1_Dup(register struct xobject *obj); +/* initialize TYPE1IMAGER */ +void t1_InitImager(void); +/* terminate TYPE1IMAGER */ +void t1_TermImager(void); +/* set debug flags, etc. */ +void t1_Pragmatics(char *username, int value); +/* return last TYPE1IMAGER error message */ +char *t1_ErrorMsg(void); /*END SHARED*/ /*SHARED*/ #define abort(line) FatalError(line) -#define Allocate(n,t,s) t1_Allocate(n,t,s) -#define Free(obj) t1_Free(obj) #define NonObjectFree(a) xiFree(a) -#define Consume t1_Consume -#define ArgErr(s,o,r) t1_ArgErr(s,o,r) -#define TypeErr(n,o,e,r) t1_TypeErr(n,o,e,r) -#define Copy(obj) t1_Copy(obj) -#define Unique(obj) t1_Unique(obj) -struct xobject *t1_Allocate(); /* allocate memory */ -void t1_Free(); /* free memory */ -struct xobject *t1_Unique(); /* make a unique temporary copy of an object */ -struct xobject *t1_ArgErr(); /* handle argument errors */ -struct xobject *t1_TypeErr(); /* handle 'bad type' argument errors */ -void t1_Consume(); /* consume a variable number of arguments */ -struct xobject *t1_Copy(); /* make a new copy, not reference bump PNM */ - /*END SHARED*/ /*SHARED*/ @@ -224,9 +217,6 @@ struct xobject { #define IfTrace6(condition,model,arg0,arg1,arg2,arg3,arg4,arg5) -void Trace0(); -char *Trace1(),*Trace2(),*Trace3(),*Trace4(),*Trace5(),*Trace6(); - #ifdef GLOBALS #define extern @@ -274,18 +264,10 @@ extern char Continuity INITIALIZED(2); /* We define other routines formatting parameters */ -#define DumpArea(area) t1_DumpArea(area) -#define DumpText(text) t1_DumpText(text) -#define DumpPath(path) t1_DumpPath(path) -#define DumpSpace(space) t1_DumpSpace(space) -#define DumpEdges(e) t1_DumpEdges(e) +#define DumpText(text) t1_DumpText() #define FormatFP(s,p) t1_FormatFP(s,p) -void t1_DumpArea(); /* dump a region structure */ -void t1_DumpText(); /* dump a textpath structure */ -void t1_DumpPath(); /* dump a path list */ -void t1_DumpSpace(); /* dump a coordinate space structure */ -void t1_DumpEdges(); /* dump a region's edge list */ -void t1_FormatFP(); /* dump a format a "fractpel" coordinate */ +void t1_DumpText(void); /* dump a textpath structure */ +void t1_FormatFP(register char *string, register long fpel); /* dump a format a "fractpel" coordinate */ /*END SHARED*/ --- Xvnc/lib/font/Type1/paths.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/paths.c @@ -50,7 +50,7 @@ The included files are: #include "pictures.h" /* understands about handles */ #include "strokes.h" /* understands how to coerce stroke paths */ #include "trig.h" -static UnClose(); +static UnClose(register struct segment *p0); /* :h3.Routines Available to the TYPE1IMAGER User @@ -690,9 +690,12 @@ etc. We need three subroutines: */ -static struct segment *SplitPath(); /* break a path at any point */ -static struct segment *DropSubPath(); /* breaks a path after first sub-path */ -static struct segment *ReverseSubPath(); /* reverses a single sub-path */ +/* break a path at any point */ +static struct segment *SplitPath(register struct segment *anchor, register struct segment *before); +/* breaks a path after first sub-path */ +static struct segment *DropSubPath(register struct segment *p0); +/* reverses a single sub-path */ +static struct segment *ReverseSubPath(register struct segment *p); /* :h3.Reverse() - User Operator to Reverse a Path @@ -1424,8 +1427,8 @@ struct segment *HeadSegment(path) :h3.DumpPath() - Display a Path on the Trace File */ -void DumpPath(p) - register struct segment *p; +void t1_DumpPath(register struct segment *p); +void t1_DumpPath(register struct segment *p) { register fractpel x,y; register fractpel lastx,lasty; --- Xvnc/lib/font/Type1/paths.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/paths.h @@ -28,6 +28,40 @@ */ /*SHARED*/ +struct segment { + XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ + unsigned char size; /* size of the structure */ + unsigned char context; /* index to device context */ + struct segment *link; /* pointer to next structure in linked list */ + struct segment *last; /* pointer to last structure in list */ + struct fractpoint dest; /* relative ending location of path segment */ +} ; + +#define ISCLOSED(flag) ((flag)&0x80) /* subpath is closed */ +#define LASTCLOSED(flag) ((flag)&0x40) /* last segment in closed subpath */ + +/* +NOTE: The ISCLOSED flag is set on the MOVETYPE segment before the +subpath proper; the LASTCLOSED flag is set on the last segment (LINETYPE) +in the subpath + +We define the ISPATHANCHOR predicate to test that a path handle +passed by the user is valid: +*/ + +#define ISPATHANCHOR(p) (ISPATHTYPE(p->type)&&p->last!=NULL) + +/* +For performance reasons, a user's "location" object is identical to +a path whose only segment is a move segment. We define a predicate +to test for this case. See also :hdref refid=location.. +*/ + +#define ISLOCATION(p) ((p)->type == MOVETYPE && (p)->link == NULL) + +/*END SHARED*/ +/*SHARED*/ + #define Loc(S,x,y) t1_Loc(S,(double)x,(double)y) #define ILoc(S,x,y) t1_ILoc(S,x,y) #define Line(P) t1_Line(P) @@ -51,25 +85,44 @@ #define QueryBounds(p,S,x1,y1,x2,y2) t1_QueryBounds(p,S,x1,y1,x2,y2) -struct segment *t1_Loc(); /* create a location object (or "move" segment) */ -struct segment *t1_ILoc(); /* integer argument version of same */ -struct segment *t1_Line(); /* straight line path segment */ -struct segment *t1_Join(); /* join two paths or regions together */ -struct segment *t1_ClosePath(); /* close a path or path set */ -struct conicsegment *t1_Conic(); /* conic curve path segment */ -struct conicsegment *t1_RoundConic(); /* ditto, specified another way */ -struct conicsegment *t1_ArcP3(); /* circular path segment with three points */ -struct conicsegment *t1_ArcCA(); /* ditto, with center point and angle */ -struct beziersegment *t1_Bezier(); /* Bezier third order curve path segment */ -struct hintsegment *t1_Hint(); /* produce a font 'hint' path segment */ -struct segment *t1_Reverse(); /* reverse the complete order of paths */ -struct segment *t1_ReverseSubPaths(); /* reverse only sub-paths; moves unchanged */ -struct segment *t1_SubLoc(); /* subtract two location objects */ -struct segment *t1_DropSegment(); /* Drop the first segment in a path */ -struct segment *t1_HeadSegment(); /* return the first segment in a path */ -void t1_QueryLoc(); /* Query location; return its (x,y) */ -void t1_QueryPath(); /* Query segment at head of a path */ -void t1_QueryBounds(); /* Query the bounding box of a path */ +/* create a location object (or "move" segment) */ +struct segment *t1_Loc(register struct XYspace *S, double x, double y); +/* integer argument version of same */ +struct segment *t1_ILoc(register struct XYspace *S, register int x, register int y); +/* straight line path segment */ +struct segment *t1_Line(register struct segment *P); +/* join two paths or regions together */ +struct segment *t1_Join(register struct segment *p1, register struct segment *p2); +/* close a path or path set */ +struct segment *t1_ClosePath(register struct segment *p0, register int lastonly); +/* conic curve path segment */ +/* struct conicsegment *t1_Conic(int B, int C, double s); */ +/* ditto, specified another way */ +/* struct conicsegment *t1_RoundConic(int M, int C, double r); */ +/* circular path segment with three points */ +/* struct conicsegment *t1_ArcP3(int S, int P2, int P3); */ +/* ditto, with center point and angle */ +/* struct conicsegment *t1_ArcCA(int S, int C, double d); */ +/* Bezier third order curve path segment */ +/* struct beziersegment *t1_Bezier(int B, int C, int D); */ +/* produce a font 'hint' path segment */ +/* struct hintsegment *t1_Hint(int S, int r, int w, int o, int h, int a, int d, int l); */ +/* reverse the complete order of paths */ +struct segment *t1_Reverse(register struct segment *p); +/* reverse only sub-paths; moves unchanged */ +struct segment *t1_ReverseSubPaths(register struct segment *p); +/* subtract two location objects */ +struct segment *t1_SubLoc(register struct segment *p1, register struct segment *p2); +/* Drop the first segment in a path */ +struct segment *t1_DropSegment(register struct segment *path); +/* return the first segment in a path */ +struct segment *t1_HeadSegment(register struct segment *path); +/* Query location; return its (x,y) */ +void t1_QueryLoc(register struct segment *P, register struct XYspace *S, register double *xP, register double *yP); +/* Query segment at head of a path */ +void t1_QueryPath(register struct segment *path, register int *typeP, register struct segment **Bp, register struct segment **Cp, register struct segment **Dp, register double *fP); +/* Query the bounding box of a path */ +void t1_QueryBounds(register struct segment *p0, struct XYspace *S, double *xminP, double *yminP, double *xmaxP, double *ymaxP); /*END SHARED*/ /*SHARED*/ @@ -84,14 +137,22 @@ void t1_QueryBounds(); /* Query the bounding bo #define Hypoteneuse(dx,dy) t1_Hypoteneuse(dx,dy) #define BoxPath(S,h,w) t1_BoxPath(S,h,w) -struct segment *t1_CopyPath(); /* duplicate a path */ -void t1_KillPath(); /* destroy a path */ -struct segment *t1_PathXform(); /* transform a path arbitrarily */ -void t1_PathDelta(); /* calculate the ending point of a path */ -struct segment *t1_PathSegment(); /* produce a MOVE or LINE segment */ -struct segment *t1_JoinSegment(); /* join a MOVE or LINE segment to a path */ -double t1_Hypoteneuse(); /* returns the length of a line */ -struct segment *t1_BoxPath(); /* returns a rectangular path */ +/* duplicate a path */ +struct segment *t1_CopyPath(register struct segment *p0); +/* destroy a path */ +void t1_KillPath(register struct segment *p); +/* transform a path arbitrarily */ +struct segment *t1_PathXform(register struct segment *p0, register struct XYspace *S); +/* calculate the ending point of a path */ +void t1_PathDelta(register struct segment *p, register struct fractpoint *pt); +/* produce a MOVE or LINE segment */ +struct segment *t1_PathSegment(int type, fractpel x, fractpel y); +/* join a MOVE or LINE segment to a path */ +struct segment *t1_JoinSegment(register struct segment *before, int type, fractpel x, fractpel y, register struct segment *after); +/* returns the length of a line */ +/* double t1_Hypoteneuse(int dx, int dy); */ +/* returns a rectangular path */ +/* struct segment *t1_BoxPath(struct XYspace *S, int h, int w); */ /*END SHARED*/ /*SHARED*/ @@ -102,40 +163,6 @@ struct segment *t1_BoxPath(); /* returns a rectangul /*END SHARED*/ /*SHARED*/ -struct segment { - XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ - unsigned char size; /* size of the structure */ - unsigned char context; /* index to device context */ - struct segment *link; /* pointer to next structure in linked list */ - struct segment *last; /* pointer to last structure in list */ - struct fractpoint dest; /* relative ending location of path segment */ -} ; - -#define ISCLOSED(flag) ((flag)&0x80) /* subpath is closed */ -#define LASTCLOSED(flag) ((flag)&0x40) /* last segment in closed subpath */ - -/* -NOTE: The ISCLOSED flag is set on the MOVETYPE segment before the -subpath proper; the LASTCLOSED flag is set on the last segment (LINETYPE) -in the subpath - -We define the ISPATHANCHOR predicate to test that a path handle -passed by the user is valid: -*/ - -#define ISPATHANCHOR(p) (ISPATHTYPE(p->type)&&p->last!=NULL) - -/* -For performance reasons, a user's "location" object is identical to -a path whose only segment is a move segment. We define a predicate -to test for this case. See also :hdref refid=location.. -*/ - -#define ISLOCATION(p) ((p)->type == MOVETYPE && (p)->link == NULL) - -/*END SHARED*/ -/*SHARED*/ - struct conicsegment { XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ /* type = CONICTYPE */ @@ -194,4 +221,10 @@ is also used by the STROKES module.) p1->last = p2->last; /* last of new is last of p2 */ \ p2->last = NULL; } /* only first segment has non-NULL "last" */ +/*END SHARED*/ +/*SHARED*/ + +#define DumpPath(path) t1_DumpPath(path) +void t1_DumpPath(register struct segment *p); /* dump a path list */ + /*END SHARED*/ --- Xvnc/lib/font/Type1/pictures.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/pictures.h @@ -44,5 +44,5 @@ struct picture { #define Phantom(o) t1_Phantom(o) #define Snap(o) t1_Snap(o) -struct segment *t1_Phantom(); -struct segment *t1_Snap(); +struct segment *t1_Phantom(register struct xobject *obj); +struct segment *t1_Snap(register struct segment *p); --- Xvnc/lib/font/Type1/regions.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/regions.c @@ -43,26 +43,26 @@ The included files are: #include "objects.h" #include "spaces.h" -#include "regions.h" #include "paths.h" +#include "regions.h" #include "curves.h" #include "lines.h" #include "pictures.h" #include "fonts.h" #include "hints.h" #include "strokes.h" /* to pick up 'DoStroke' */ -static Unwind(); -static void newfilledge(); -static struct edgelist *splitedge(); -static void vertjoin(); -static int touches(); -static int crosses(); -static void edgemin(); -static void edgemax(); -static discard(); -static edgecheck(); -static struct edgelist *NewEdge(); -static struct edgelist *swathxsort(); /* 'SortSwath' function */ +static Unwind(register struct edgelist *area); +static void newfilledge(register struct region *R, fractpel xmin, fractpel xmax, fractpel ymin, fractpel ymax, int isdown); +static struct edgelist *splitedge(struct edgelist *list, register pel y); +static void vertjoin(register struct edgelist *top, register struct edgelist *bottom); +static int touches(register int h, register pel *left, register pel *right); +static int crosses(register int h, register pel *left, register pel *right); +static void edgemin(register int h, register pel *e1, register pel *e2); +static void edgemax(register int h, register pel *e1, register pel *e2); +static discard(register struct edgelist *left, register struct edgelist *right); +static edgecheck(struct edgelist *edge, int oldmin, int oldmax); +static struct edgelist *NewEdge(pel xmin, pel xmax, pel ymin, pel ymax, pel *xvalues, int isdown); +static struct edgelist *swathxsort(register struct edgelist *before0, register struct edgelist *edge); /* :h3.Functions Provided to the TYPE1IMAGER User @@ -682,7 +682,7 @@ void ChangeDirection(type, R, x, y, dy) (*R->newedgefcn)(R, R->edgexmin, R->edgexmax, ymin, ymax, - R->lastdy > 0, x_at_ymin, x_at_ymax); + R->lastdy > 0); } @@ -793,7 +793,8 @@ exactly where the bottom part belongs. struct edgelist *SortSwath(anchor, edge, swathfcn) struct edgelist *anchor; /* list being built */ register struct edgelist *edge; /* incoming edge or pair of edges */ - struct edgelist *(*swathfcn)(); /* horizontal sorter */ + /* horizontal sorter */ + struct edgelist *(*swathfcn)(struct edgelist *, struct edgelist *); { register struct edgelist *before,*after; struct edgelist base; --- Xvnc/lib/font/Type1/regions.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/regions.h @@ -28,18 +28,116 @@ */ /*SHARED*/ +struct edgelist { + XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ + /* type = EDGETYPE */ + struct edgelist *link; /* pointer to next in linked list */ + struct edgelist *subpath; /* informational link for "same subpath" */ + pel xmin,xmax; /* range of edge in X */ + pel ymin,ymax; /* range of edge in Y */ + pel *xvalues; /* pointer to ymax-ymin X values */ +} ; +/* +The end of the list is marked by either "link" being NULL, or by +ymin == ymax. See :hdref refid=discard.. We define the VALIDEDGE +predicate to test for the opposite of these conditions: +*/ + +#define VALIDEDGE(p) ((p)!=NULL&&(p)->ymin<(p)->ymax) + +/*END SHARED*/ +/*SHARED*/ + +struct region { + XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ + /* type = REGIONTYPE */ + struct fractpoint origin; /* beginning handle: X,Y origin of region */ + struct fractpoint ending; /* ending handle: X,Y change after painting region */ + pel xmin,ymin; /* minimum X,Y of region */ + pel xmax,ymax; /* mat1_mum X,Y of region */ + struct edgelist *anchor; /* list of edges that bound the region */ + struct picture *thresholded; /* region defined by thresholded picture*/ +/* +Note that the ending handle and the bounding box values are stored +relative to 'origin'. + +The above elements describe a region. The following elements are +scratchpad areas used while the region is being built: +*/ + fractpel lastdy; /* direction of last segment */ + fractpel firstx,firsty; /* starting point of current edge */ + fractpel edgexmin,edgexmax; /* x extent of current edge */ + struct edgelist *lastedge,*firstedge; /* last and first edges in subpath */ + pel *edge; /* pointer to array of X values for edge */ + fractpel edgeYstop; /* Y value where 'edges' array ends */ + /* function to use when building a new edge */ + void (*newedgefcn)(register struct region *R, fractpel xmin, fractpel xmax, fractpel ymin, fractpel ymax, int isdown); + struct strokeinfo *strokeinfo; /* scratchpad info during stroking only */ +} ; +/* +The ISCOMPLEMENT flag indicates the region is reversed--it is the +"outside" of the nominal region. +*/ +#define ISCOMPLEMENT(flag) ((flag)&0x80) +/* +The ISJUMBLED flag indicates the region is not sorted top-to-bottom. +*/ +#define ISJUMBLED(flag) ((flag)&0x40) +/* +The ISINFINITE flag allows a quick check for an INFINITE region, which +is frequently intersected. +*/ +#define ISINFINITE(flag) ((flag)&0x20) + +/*END SHARED*/ +/*SHARED*/ + +#define ISRECTANGULAR(flag) ((flag)&0x08) + +/*END SHARED*/ +/*SHARED*/ + +#define EmptyRegion t1_EmptyRegion + +/*END SHARED*/ +/*SHARED*/ + +#define ISDOWN(f) ((f)&0x80) + +#define ISAMBIGUOUS(f) ((f)&0x40) + +/*END SHARED*/ +/*SHARED*/ + +/* +Interior() rule enumerations: +*/ +#define WINDINGRULE -2 +#define EVENODDRULE -3 + +#define CONTINUITY 0x80 /* can be added to above rules; e.g. WINDINGRULE+CONTINUITY */ + +/*END SHARED*/ +/*SHARED*/ + #define Interior(p,rule) t1_Interior(p,rule) #define Union(a1,a2) t1_Union(a1,a2) #define Intersect(a1,a2) t1_Intersect(a1,a2) #define Complement(area) t1_Complement(area) #define Overlap(a1,a2) t1_OverLap(a1,a2) -struct region *t1_Interior(); /* returns the interior of a closed path */ -struct region *t1_Union(); /* set union of paths or regions */ -struct region *t1_Intersect(); /* set intersection of regions */ -struct region *t1_Complement(); /* complement of a region */ -int t1_Overlap(); /* returns a Boolean; TRUE if regions overlap */ +/* returns the interior of a closed path */ +struct region *t1_Interior(register struct segment *p, register int fillrule); +/* set union of paths or regions */ +/* struct region *t1_Union(int a1, int a2); */ +/* set intersection of regions */ +/* struct region *t1_Intersect(int a1, int a2); */ +/* complement of a region */ +/* struct region *t1_Complement(int area); */ +/* returns a Boolean; TRUE if regions overlap */ +int t1_Overlap(void); +#undef INFINITY #define INFINITY t1_Infinity /*END SHARED*/ @@ -47,7 +145,8 @@ int t1_Overlap(); /* returns a Boolean; TR #define ChangeDirection(type,R,x,y,dy) t1_ChangeDirection(type,R,x,y,dy) -void t1_ChangeDirection(); /* called when we change direction in Y */ +/* called when we change direction in Y */ +void t1_ChangeDirection(int type, register struct region *R, fractpel x, fractpel y, fractpel dy); #define CD_FIRST -1 /* enumeration of ChangeDirection type */ #define CD_CONTINUE 0 /* enumeration of ChangeDirection type */ #define CD_LAST 1 /* enumeration of ChangeDirection type */ @@ -63,16 +162,28 @@ void t1_ChangeDirection(); /* called when we change #define MoveEdges(R,dx,dy) t1_MoveEdges(R,dx,dy) #define UnJumble(R) t1_UnJumble(R) -void t1_MoreWorkArea(); /* get longer edge list for stepping */ -struct region *t1_CopyRegion(); /* duplicate a region */ -void t1_KillRegion(); /* destroy a region */ -struct region *t1_BoxClip(); /* clip a region to a rectangle */ -struct edgelist *t1_SortSwath(); /* sort edges onto growing edge list */ -struct edgelist *t1_SwathUnion(); /* 'union' two edges into a swath */ -struct segment *t1_RegionBounds(); /* returns bounding box of a region */ -struct region *t1_CoerceRegion(); /* force text to become a true region */ -void t1_MoveEdges(); /* moves the edge values in a region */ -void t1_UnJumble(); /* sort the edges and reset the jumbled flag */ +/* get longer edge list for stepping */ +void t1_MoreWorkArea(struct region *R, fractpel x1, fractpel y1, fractpel x2, fractpel y2); +/* duplicate a region */ +struct region *t1_CopyRegion(register struct region *area); +/* destroy a region */ +void t1_KillRegion(register struct region *area); +/* clip a region to a rectangle */ +struct region *t1_BoxClip(register struct region *R, register pel xmin, register pel ymin, register pel xmax, register pel ymax); +/* sort edges onto growing edge list */ +struct edgelist *t1_SortSwath(struct edgelist *anchor, register struct edgelist *edge, struct edgelist *(*swathfcn)(struct edgelist *, struct edgelist *)); + /* 'union' two edges into a swath */ +struct edgelist *t1_SwathUnion(register struct edgelist *before0, register struct edgelist *edge); +/* returns bounding box of a region */ +struct segment *t1_RegionBounds(register struct region *R); +#if 0 +/* force text to become a true region */ +struct region *t1_CoerceRegion(register struct textpath *tp); +#endif +/* moves the edge values in a region */ +void t1_MoveEdges(register struct region *R, register fractpel dx, register fractpel dy); +/* sort the edges and reset the jumbled flag */ +void t1_UnJumble(struct region *region); /*END SHARED*/ /*SHARED*/ @@ -121,93 +232,11 @@ to be made unique for that reason (i.e., references > /*END SHARED*/ /*SHARED*/ - -struct region { - XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ - /* type = REGIONTYPE */ - struct fractpoint origin; /* beginning handle: X,Y origin of region */ - struct fractpoint ending; /* ending handle: X,Y change after painting region */ - pel xmin,ymin; /* minimum X,Y of region */ - pel xmax,ymax; /* mat1_mum X,Y of region */ - struct edgelist *anchor; /* list of edges that bound the region */ - struct picture *thresholded; /* region defined by thresholded picture*/ -/* -Note that the ending handle and the bounding box values are stored -relative to 'origin'. - -The above elements describe a region. The following elements are -scratchpad areas used while the region is being built: -*/ - fractpel lastdy; /* direction of last segment */ - fractpel firstx,firsty; /* starting point of current edge */ - fractpel edgexmin,edgexmax; /* x extent of current edge */ - struct edgelist *lastedge,*firstedge; /* last and first edges in subpath */ - pel *edge; /* pointer to array of X values for edge */ - fractpel edgeYstop; /* Y value where 'edges' array ends */ - void (*newedgefcn)(); /* function to use when building a new edge */ - struct strokeinfo *strokeinfo; /* scratchpad info during stroking only */ -} ; -/* -The ISCOMPLEMENT flag indicates the region is reversed--it is the -"outside" of the nominal region. -*/ -#define ISCOMPLEMENT(flag) ((flag)&0x80) -/* -The ISJUMBLED flag indicates the region is not sorted top-to-bottom. -*/ -#define ISJUMBLED(flag) ((flag)&0x40) -/* -The ISINFINITE flag allows a quick check for an INFINITE region, which -is frequently intersected. -*/ -#define ISINFINITE(flag) ((flag)&0x20) - -/*END SHARED*/ -/*SHARED*/ - -#define ISRECTANGULAR(flag) ((flag)&0x08) - -/*END SHARED*/ -/*SHARED*/ - -#define EmptyRegion t1_EmptyRegion - -/*END SHARED*/ -/*SHARED*/ - -struct edgelist { - XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ - /* type = EDGETYPE */ - struct edgelist *link; /* pointer to next in linked list */ - struct edgelist *subpath; /* informational link for "same subpath" */ - pel xmin,xmax; /* range of edge in X */ - pel ymin,ymax; /* range of edge in Y */ - pel *xvalues; /* pointer to ymax-ymin X values */ -} ; -/* -The end of the list is marked by either "link" being NULL, or by -ymin == ymax. See :hdref refid=discard.. We define the VALIDEDGE -predicate to test for the opposite of these conditions: -*/ - -#define VALIDEDGE(p) ((p)!=NULL&&(p)->ymin<(p)->ymax) - -/*END SHARED*/ -/*SHARED*/ - -#define ISDOWN(f) ((f)&0x80) - -#define ISAMBIGUOUS(f) ((f)&0x40) - -/*END SHARED*/ -/*SHARED*/ - -/* -Interior() rule enumerations: -*/ -#define WINDINGRULE -2 -#define EVENODDRULE -3 - -#define CONTINUITY 0x80 /* can be added to above rules; e.g. WINDINGRULE+CONTINUITY */ + +#define DumpArea(area) t1_DumpArea(area) +void t1_DumpArea(register struct region *area); /* dump a region structure */ + +#define DumpEdges(e) t1_DumpEdges(e) +void t1_DumpEdges(register struct edgelist *edges); /* dump a region's edge list */ /*END SHARED*/ --- Xvnc/lib/font/Type1/scanfont.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/scanfont.c @@ -433,7 +433,7 @@ static psobj *MakeEncodingArrayP(encodingTable) return(encodingArrayP); } -boolean Init_BuiltInEncoding() +boolean Init_BuiltInEncoding(void) { StdEncArrayP = MakeEncodingArrayP(StdEnc); ISOLatin1EncArrayP = MakeEncodingArrayP(ISO8859Enc); @@ -455,7 +455,7 @@ static int getNextValue(valueType) /***================================================================***/ /* This routine will set the global rc if there is an error */ /***================================================================***/ -static int getInt() +static int getInt(void) { scan_token(inputP); if (tokenType != TOKEN_INTEGER) { @@ -1398,7 +1398,7 @@ int scan_font(FontP) filterFile.data.fileP = NULL; inputP = &inputFile; - if (fileP = fopen(filename,filetype)) { + if ((fileP = fopen(filename,filetype))) { /* get the first byte of file */ V = getc(fileP); /* if file starts with x'80' then skip next 5 bytes */ --- Xvnc/lib/font/Type1/spaces.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/spaces.c @@ -44,9 +44,12 @@ This module is responsible for handling the TYPE1IMAGE #include "fonts.h" #include "arith.h" #include "trig.h" +#include +#include -static void FindFfcn(); -static void FindIfcn(); +static void FindFfcn(register double cx, register double cy, register fractpel (**fcnP)(register double cx, register double cy, register double x, register double y)); +static void FindIfcn(register double cx, register double cy, register fractpel *icxP, register fractpel *icyP, register fractpel (**fcnP)(register double cx, register double cy, register long x, register long y)); + /* :h3.Entry Points Provided to the TYPE1IMAGER User */ @@ -124,7 +127,7 @@ static unsigned int SpaceID = 1; struct XYspace *CopySpace(S) register struct XYspace *S; { - S = (struct XYspace *)Allocate(sizeof(struct XYspace), S, 0); + S = (struct XYspace *)Allocate(sizeof(struct XYspace), (struct xobject *)S, 0); S->ID = NEXTID; return(S); } @@ -544,7 +547,8 @@ being zero: static void FindFfcn(cx, cy, fcnP) register double cx,cy; /* x and y coefficients */ - register fractpel (**fcnP)(); /* pointer to function to set */ + /* pointer to function to set */ + register fractpel (**fcnP)(register double cx, register double cy, register double x, register double y); { if (cx == 0.0) *fcnP = FYonly; @@ -568,7 +572,8 @@ floating point. static void FindIfcn(cx, cy, icxP, icyP, fcnP) register double cx,cy; /* x and y coefficients */ register fractpel *icxP,*icyP; /* fixed point coefficients to set */ - register fractpel (**fcnP)(); /* pointer to function to set */ + /* pointer to function to set */ + register fractpel (**fcnP)(register double cx, register double cy, register long x, register long y); { register fractpel imax; /* maximum of cx and cy */ @@ -903,8 +908,8 @@ maps 72nds of an inch to pels on the default device. */ struct XYspace *USER = &identity; - -void InitSpaces() + +void t1_InitSpaces(void) { extern char *DEFAULTDEVICE; @@ -976,10 +981,10 @@ void FormatFP(string, fpel) else sign = ""; - sprintf(temp, "000%x", fpel & FRACTMASK); + sprintf(temp, "000%lx", fpel & FRACTMASK); s = temp + strlen(temp) - (FRACTBITS/4); - sprintf(string, "%s%d.%sx", sign, fpel >> FRACTBITS, s); + sprintf(string, "%s%ld.%sx", sign, fpel >> FRACTBITS, s); } /* --- Xvnc/lib/font/Type1/spaces.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/spaces.h @@ -28,6 +28,63 @@ */ /*SHARED*/ +typedef short pel; /* integer pel locations */ +typedef long fractpel; /* fractional pel locations */ + +#define FRACTBITS 16 /* number of fractional bits in 'fractpel' */ +/* +We define the following macros to convert from 'fractpel' to 'pel' and +vice versa: +*/ +#define TOFRACTPEL(p) (((fractpel)p)<>FRACTBITS) +#define FRACTFLOAT (double)(1L<>FRACTBITS) -#define FRACTFLOAT (double)(1L< +#include #ifdef _XOPEN_SOURCE #include #else @@ -101,29 +102,27 @@ from the X Consortium. #include "objects.h" #include "spaces.h" +#include "paths.h" #include "regions.h" #include "t1stdio.h" #include "util.h" #include "fontfcn.h" -int Type1OpenScalable (); -static int Type1GetGlyphs(); -void Type1CloseFont(); -extern int Type1GetInfoScalable (); +static int Type1GetGlyphs(FontPtr pFont, unsigned long count, register unsigned char *chars, FontEncoding charEncoding, unsigned long *glyphCount, CharInfoPtr *glyphs); +static int Type1GetMetrics(FontPtr pFont, unsigned long count, register unsigned char *chars, FontEncoding charEncoding, unsigned long *glyphCount, xCharInfo **glyphs); +void Type1CloseFont(FontPtr pFont); +extern int Type1GetInfoScalable(FontPathElementPtr fpe, FontInfoPtr pInfo, FontEntryPtr entry, FontNamePtr fontName, char *fileName, FontScalablePtr Vals); -static int Type1GetMetrics (); - #define minchar(p) ((p).min_char_low + ((p).min_char_high << 8)) #define maxchar(p) ((p).max_char_low + ((p).max_char_high << 8)) -static void fillrun(); +static void fillrun(register char *p, pel x0, pel x1, int bit); extern psfont *FontP; extern psobj *ISOLatin1EncArrayP; -extern unsigned long *Xalloc(); -static void fill(); +static void fill(register char *dest, int h, int w, register struct region *area, int byte, int bit, int wordsize); /*ARGSUSED*/ int Type1OpenScalable (fpe, ppFont, flags, entry, fileName, vals, format, @@ -139,8 +138,6 @@ int Type1OpenScalable (fpe, ppFont, flags, entry, file FontPtr non_cachable_font; /* We don't do licensing */ { extern struct XYspace *IDENTITY; - extern Bool fontfcnA(); - extern struct region *fontfcnB(); FontPtr pFont; @@ -655,14 +652,14 @@ static void fillrun(p, x0, x1, bit) #define CAPABILITIES (CAP_MATRIX | CAP_CHARSUBSETTING) static FontRendererRec renderers[] = { - { ".pfa", 4, (int (*)()) 0, Type1OpenScalable, - (int (*)()) 0, Type1GetInfoScalable, 0, CAPABILITIES }, - { ".pfb", 4, (int (*)()) 0, Type1OpenScalable, - (int (*)()) 0, Type1GetInfoScalable, 0, CAPABILITIES } + { ".pfa", 4, (int (*)(FontPathElementPtr, FontPtr *, int, FontEntryPtr, char *, fsBitmapFormat, fsBitmapFormatMask, FontPtr)) 0, Type1OpenScalable, + (int (*)(FontPathElementPtr, FontInfoPtr, FontEntryPtr, char *)) 0, Type1GetInfoScalable, 0, CAPABILITIES }, + { ".pfb", 4, (int (*)(FontPathElementPtr, FontPtr *, int, FontEntryPtr, char *, fsBitmapFormat, fsBitmapFormatMask, FontPtr)) 0, Type1OpenScalable, + (int (*)(FontPathElementPtr, FontInfoPtr, FontEntryPtr, char *)) 0, Type1GetInfoScalable, 0, CAPABILITIES } }; -Type1RegisterFontFileFunctions() +Type1RegisterFontFileFunctions(void) { int i; @@ -691,7 +688,7 @@ int Type1ReturnCodeToXReturnCode(rc) /* fall through */ default: /* this should not happen */ - ErrorF("Type1 return code not convertable to X return code: %d\n", rc); + ErrorF("Type1 return code not convertible to X return code: %d\n", rc); return rc; } } --- Xvnc/lib/font/Type1/t1imager.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/t1imager.h @@ -40,23 +40,8 @@ typedef pointer XYspace; /* The following are the user entry locations to TYPE1IMAGER */ -extern path t1_Bezier(); -extern path t1_ClosePath(); -extern xobject t1_Destroy(); -extern xobject t1_Dup(); -extern char *t1_ErrorMsg(); -extern void t1_InitImager(); -extern region t1_Interior(); -extern location t1_ILoc(); -extern xobject t1_Join(); -extern path t1_Line(); -extern xobject t1_Permanent(); -extern path t1_Phantom(); -extern location t1_Loc(); -extern xobject t1_Scale(); -extern xobject t1_Snap(); -extern location t1_SubLoc(); -extern xobject t1_Temporary(); +extern path t1_Phantom(register struct xobject *obj); +extern xobject t1_Snap(register struct segment *p); #endif @@ -76,35 +61,12 @@ extern xobject t1_Temporary(); Here are some TYPE1IMAGER functions that are defined in terms of others: */ -#define t1_AddLoc(p1,p2) t1_Join(p1,p2) - #ifndef NONAMES /* Define the simple form of all the subroutine names: */ -#define AddLoc(p1,p2) t1_AddLoc(p1,p2) -#define Bezier(B,C,D) t1_Bezier(B,C,D) -#define ClosePath(p) t1_ClosePath(p,0) -#define Complement(area) t1_Complement(area) -#define Destroy(o) t1_Destroy(o) -#define Dup(o) t1_Dup(o) -#define ErrorMsg() t1_ErrorMsg() -#define HeadSegment(p) t1_HeadSegment(p) -#define InitImager() t1_InitImager() -#define Interior(p,rule) t1_Interior(p,rule) -#define ILoc(S,x,y) t1_ILoc(S,x,y) -#define Join(p1,p2) t1_Join(p1,p2) -#define Line(P) t1_Line(P) -#define Permanent(o) t1_Permanent(o) #define Phantom(o) t1_Phantom(o) -#define Loc(S,x,y) t1_Loc(S,(double)x,(double)y) -#define Scale(o,sx,sy) t1_Scale(o,(double)sx,(double)sy) #define Snap(o) t1_Snap(o) -#define SubLoc(a,b) t1_SubLoc(a,b) -#define Temporary(o) t1_Temporary(o) -#define TermImager() t1_TermImager() -#define Transform(o,cxx,cyx,cxy,cyy) t1_Transform(o,(double)cxx,(double)cyx,\ - (double)cxy,(double)cyy) #endif @@ -145,4 +107,4 @@ extern region *INFINITY; #define FF_PARSE_ERROR 5 #define FF_PATH 1 -extern pointer xiStub(); +extern pointer xiStub(void); --- Xvnc/lib/font/Type1/t1info.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/t1info.c @@ -476,7 +476,7 @@ T1FillFontInfo(pFont, Vals, Filename, Fontname, sWidth /* Called once, at renderer registration time */ void -T1InitStdProps() +T1InitStdProps(void) { int i; fontProp *t; --- Xvnc/lib/font/Type1/t1io.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/t1io.c @@ -56,11 +56,8 @@ STATIC F_FILE TheFile; STATIC unsigned char TheBuffer[F_BUFSIZ]; /* Our routines */ -F_FILE *T1Open(), *T1Eexec(); -int T1Close(); -int T1Read(), T1Getc(), T1Ungetc(); -STATIC int T1Decrypt(), T1Fill(); - +STATIC int T1Fill(F_FILE *f); + /* -------------------------------------------------------------- */ /*ARGSUSED*/ F_FILE *T1Open(fn, mode) @@ -225,7 +222,7 @@ F_FILE *T1eexec(f) /* Initialization */ } /* end eexec */ /* -------------------------------------------------------------- */ -STATIC int T1Decrypt(p, len) +int T1Decrypt(p, len) unsigned char *p; int len; { --- Xvnc/lib/font/Type1/t1malloc.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/t1malloc.c @@ -37,12 +37,12 @@ routines (malloc/free). */ +#include #include "objects.h" /* get #define for abort() */ -static combine(); -static freeuncombinable(); -static unhook(); -static dumpchain(); +static combine(void); +static freeuncombinable(register long *addr, register long size); +static dumpchain(void); /* :h3.Define NULL @@ -165,6 +165,8 @@ asked for. long AvailableWords = 0; /* number of words available in memory */ char mallocdebug = 0; /* a flag that enables some chatty printf's */ +static unhook(register struct freeblock *p); + /* :h3.whocalledme() - Debug for Memory Leaks @@ -240,13 +242,13 @@ If we have too many uncombined blocks, call combine() if (++uncombined > MAXUNCOMBINED) { combine(); if (mallocdebug) { - printf("xiFree(%08x) with combine, ", addr); + printf("xiFree(%p) with combine, ", addr); dumpchain(); } } else { if (mallocdebug) { - printf("xiFree(%08x), ", addr); + printf("xiFree(%p), ", addr); dumpchain(); } } @@ -262,7 +264,7 @@ In any event, that block will be moved to the end of t 'firstcombined'). */ -static combine() +static combine(void) { register struct freeblock *p; /* block we will try to combine */ register long *addr; /* identical to 'p' for 'long' access */ @@ -450,7 +452,7 @@ only to be "unhook"ed: unhook(p); uncombined--; if (mallocdebug) { - printf("fast xiMalloc(%d) = %08x, ", size, p); + printf("fast xiMalloc(%ld) = %p, ", size, p); dumpchain(); } AvailableWords += size; /* decreases AvailableWords */ @@ -507,7 +509,7 @@ flag that this block is allocated: area[size - 1] = area[0] = - size; if (mallocdebug) { - printf("slow xiMalloc(%d) @ %08x, ", size, area); + printf("slow xiMalloc(%ld) @ %p, ", size, area); dumpchain(); } whocalledme(area, &Size); @@ -591,7 +593,7 @@ free list: /* :h3.delmemory() - Delete Memory Pool */ -void delmemory() +void delmemory(void) { register int i; @@ -610,7 +612,7 @@ void delmemory() :h3.dumpchain() - Print the Chain of Free Blocks */ -static dumpchain() +static dumpchain(void) { register struct freeblock *p; /* current free block */ register long size; /* size of block */ @@ -624,7 +626,7 @@ static dumpchain() if (--i < 0) abort("too many uncombined areas"); size = p->size; - printf(". . . area @ %08x, size = %ld\n", p, -size); + printf(". . . area @ %p, size = %ld\n", p, -size); if (size >= 0 || size != ((int *) p)[-1 - size]) abort("dumpchain: bad size"); if (p->back != back) @@ -634,7 +636,7 @@ static dumpchain() printf("DUMPING COMBINED FREE LIST:\n"); for (; p != &lastfree; p = p->fore) { size = p->size; - printf(". . . area @ %08x, size = %d\n", p, size); + printf(". . . area @ %p, size = %ld\n", p, size); if (size <= 0 || size != ((int *) p)[size - 1]) abort("dumpchain: bad size"); if (p->back != back) @@ -667,7 +669,7 @@ static reportarea(area) register int i,j; size = -size; - printf("Allocated %5d bytes at %08x, first words=%08x %08x\n", + printf("Allocated %5ld bytes at %p, first words=%08lx %08lx\n", size * sizeof(long), area + 1, area[1], area[2]); #if DEBUGWORDS printf(" ...Last operator: %s\n", @@ -676,13 +678,13 @@ static reportarea(area) for (i = size - DEBUGWORDS; i < size - 2; i += 8) { printf(" ..."); for (j=0; j<8; j++) - printf(" %08x", area[i+j]); + printf(" %08lx", area[i+j]); printf("\n"); } } else { - printf("Free %d bytes at %x\n", size * sizeof(long), + printf("Free %ld bytes at %p\n", size * sizeof(long), area); if (size == 0) abort("zero sized memory block"); @@ -708,7 +710,8 @@ static reportarea(area) :h3.MemReport() - Display All of Memory */ -MemReport() +void +MemReport(void) { register int i; @@ -722,8 +725,9 @@ MemReport() :h3.MemBytesAvail - Display Number of Bytes Now Available */ -MemBytesAvail() +void +MemBytesAvail(void) { - printf("There are now %d bytes available\n", AvailableWords * + printf("There are now %ld bytes available\n", AvailableWords * sizeof(long) ); } --- Xvnc/lib/font/Type1/t1stdio.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/t1stdio.h @@ -61,8 +61,11 @@ typedef struct F_FILE { T1Getc(f) \ ) -extern FILE *T1Open(), *T1eexec(); -extern int T1Close(), T1ungetc(), T1Read(); +extern FILE *T1Open(char *fn, char *mode); +extern FILE *T1eexec(F_FILE *f); +extern int T1Close(F_FILE *f); +extern int T1ungetc(int c, F_FILE *f); +extern int T1Read(char *buffP, int size, int n, F_FILE *f); #define fclose(f) T1Close(f) #define fopen(name,mode) T1Open(name,mode) --- Xvnc/lib/font/Type1/t1stub.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/t1stub.c @@ -28,15 +28,17 @@ * SOFTWARE. */ +#include #include "objects.h" /* get #define for abort() */ -xiStub() +void +xiStub(void) { printf("xiStub called\n"); abort("xiStub called"); } -void t1_DumpText() +void t1_DumpText(void) { xiStub(); } --- Xvnc/lib/font/Type1/token.c.orig 2002-04-30 13:07:31 UTC +++ Xvnc/lib/font/Type1/token.c @@ -1164,7 +1164,7 @@ void scan_token(inputP) int ch; unsigned char *stateP = s0; unsigned char entry; - int (*actionP)(); + int (*actionP)(int); /* Define input source */ inputFileP = inputP->data.fileP; --- Xvnc/lib/font/Type1/token.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/token.h @@ -56,7 +56,7 @@ #define TOKEN_IMMED_NAME (16) /* Token routines */ -extern void scan_token(); +extern void scan_token(psobj *inputP); /* * ------------------------------------------------------------------------- --- Xvnc/lib/font/Type1/tokst.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/tokst.h @@ -291,41 +291,41 @@ static unsigned char si11[258] = { 0x53,0x54, * state. There are several entries for each state. * */ -static int AAH_NAME(); -static int BREAK_SIGNAL(); -static int HEX_STRING(); -static int IMMED_NAME(); -static int INTEGER(); -static int LEFT_BRACE(); -static int LEFT_BRACKET(); -static int LITERAL_NAME(); -static int NAME(); -static int NO_TOKEN(); -static int OOPS_NAME(); -static int RADIX_NUMBER(); -static int REAL(); -static int RIGHT_ANGLE(); -static int RIGHT_BRACE(); -static int RIGHT_BRACKET(); -static int RIGHT_PAREN(); -static int STRING(); -static int add_1st_decpt(); -static int add_1st_digits(); -static int add_char(); -static int add_decpt(); -static int add_digits(); -static int add_e_sign(); -static int add_exponent(); -static int add_fraction(); -static int add_r_digits(); -static int add_radix(); -static int add_sign(); -static int next_char(); -static int skip_comment(); -static int skip_space(); +static int AAH_NAME(int ch); +static int BREAK_SIGNAL(int ch); +static int HEX_STRING(int ch); +static int IMMED_NAME(int ch); +static int INTEGER(int ch); +static int LEFT_BRACE(int ch); +static int LEFT_BRACKET(int ch); +static int LITERAL_NAME(int ch); +static int NAME(int ch); +static int NO_TOKEN(int ch); +static int OOPS_NAME(int ch); +static int RADIX_NUMBER(int ch); +static int REAL(int ch); +static int RIGHT_ANGLE(int ch); +static int RIGHT_BRACE(int ch); +static int RIGHT_BRACKET(int ch); +static int RIGHT_PAREN(int ch); +static int STRING(int ch); +static int add_1st_decpt(int ch); +static int add_1st_digits(int ch); +static int add_char(int ch); +static int add_decpt(int ch); +static int add_digits(int ch); +static int add_e_sign(int ch); +static int add_exponent(int ch); +static int add_fraction(int ch); +static int add_r_digits(int ch); +static int add_radix(int ch); +static int add_sign(int ch); +static int next_char(int ch); +static int skip_comment(int ch); +static int skip_space(int ch); static struct cat { - int (*actionRoutineP)(); + int (*actionRoutineP)(int ch); unsigned char *nextStateP; } classActionTable[] = { --- Xvnc/lib/font/Type1/type1.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/type1.c @@ -56,6 +56,7 @@ typedef struct xobject xobject; #include "util.h" /* PostScript objects */ +#include "fontfcn.h" #include "blues.h" /* Blues structure for font-level hints */ /**********************************/ @@ -158,24 +159,24 @@ static int *ModeP; /************************/ /* Forward declarations */ /************************/ -static double Div(); -static double PSFakePop(); -static DoCommand(); -static Escape(); -static HStem(); -static VStem(); -static RLineTo(); -static RRCurveTo(); -static DoClosePath(); -static CallSubr(); -static Return(); -static EndChar(); -static RMoveTo(); -static DotSection(); -static Seac(); -static Sbw(); -static CallOtherSubr(); -static SetCurrentPoint(); +static double Div(double num1, double num2); +static double PSFakePop(void); +static DoCommand(int Code); +static Escape(int Code); +static HStem(double y, double dy); +static VStem(double x, double dx); +static RLineTo(double dx, double dy); +static RRCurveTo(double dx1, double dy1, double dx2, double dy2, double dx3, double dy3); +static DoClosePath(void); +static CallSubr(int subrno); +static Return(void); +static EndChar(void); +static RMoveTo(double dx, double dy); +static DotSection(void); +static Seac(double asb, double adx, double ady, unsigned char bchar, unsigned char achar); +static Sbw(double sbx, double sby, double wx, double wy); +static CallOtherSubr(int othersubrno); +static SetCurrentPoint(double x, double y); /*****************************************/ /* statics for Flex procedures (FlxProc) */ @@ -196,7 +197,7 @@ static int numalignmentzones; /* total number of al /******************************************/ /* Fill in the alignment zone structures. */ /******************************************/ -static ComputeAlignmentZones() +static ComputeAlignmentZones(void) { int i; double dummy, bluezonepixels, familyzonepixels; @@ -274,14 +275,14 @@ static int oldhorhalf, oldverthalf; /* Remember which static double wsoffsetX, wsoffsetY; /* White space offset - for VSTEM3,HSTEM3 */ static int wsset; /* Flag for whether we've set wsoffsetX,Y */ -static InitStems() /* Initialize the STEM hint data structures */ +static InitStems(void) /* Initialize the STEM hint data structures */ { InDotSection = FALSE; currstartstem = numstems = 0; oldvert = oldhor = -1; } -static FinitStems() /* Terminate the STEM hint data structures */ +static FinitStems(void) /* Terminate the STEM hint data structures */ { int i; @@ -446,12 +447,13 @@ int stemno; if (unitpixels < blues->BlueScale) suppressovershoot = TRUE; else - if (alignmentzones[i].topzone) + if (alignmentzones[i].topzone) { if (stemtop >= alignmentzones[i].bottomy + blues->BlueShift) enforceovershoot = TRUE; - else + } else { if (stembottom <= alignmentzones[i].topy - blues->BlueShift) enforceovershoot = TRUE; + } /*************************************************/ /* ALIGN THE FLAT POSITION OF THE ALIGNMENT ZONE */ @@ -487,21 +489,24 @@ int stemno; /* ENFORCE overshoot by shifting the entire stem (if necessary) so that it falls at least one pixel beyond the flat position. */ - if (enforceovershoot) - if (overshoot < onepixel) + if (enforceovershoot) { + if (overshoot < onepixel) { if (alignmentzones[i].topzone) stemshift += onepixel - overshoot; else stemshift -= onepixel - overshoot; + } + } /* SUPPRESS overshoot by aligning the stem to the alignment zone's flat position. */ - if (suppressovershoot) + if (suppressovershoot) { if (alignmentzones[i].topzone) stemshift -= overshoot; else stemshift += overshoot; + } } /************************************************************/ @@ -749,7 +754,7 @@ static PSFakePush(Num) } /* PSFakePop: Removes a number from the top of the fake PostScript stack */ -static double PSFakePop () +static double PSFakePop (void) { if (PSFakeTop >= 0) return(PSFakeStack[PSFakeTop--]); else Error0Ret("PSFakePop : Stack empty\n", 0.0); @@ -1201,7 +1206,7 @@ static RRCurveTo(dx1, dy1, dx2, dy2, dx3, dy3) /* - CLOSEPATH |- */ /* Closes a subpath WITHOUT repositioning the */ /* current point */ -static DoClosePath() +static DoClosePath(void) { struct segment *CurrentPoint; @@ -1228,7 +1233,7 @@ static CallSubr(subrno) /* - RETURN - */ /* Returns from a Subrs array CharString */ /* subroutine called with CALLSUBR */ -static Return() +static Return(void) { IfTrace0((FontDebug), "Return\n"); PopCall(&CharStringP, &strindex, &r); @@ -1242,7 +1247,7 @@ static Return() /* HSBW or SBW. It then calls a special version of FILL */ /* or STROKE depending on the value of PaintType in the */ /* font dictionary */ -static EndChar() +static EndChar(void) { IfTrace0((FontDebug), "EndChar\n"); @@ -1281,7 +1286,7 @@ static RMoveTo(dx,dy) /* - DOTSECTION |- */ /* Brackets an outline section for the dots in */ /* letters such as "i", "j", and "!". */ -static DotSection() +static DotSection(void) { IfTrace0((FontDebug), "DotSection\n"); InDotSection = !InDotSection; @@ -1624,7 +1629,7 @@ static void FlxProc(c1x2, c1y2, c3x0, c3y0, c3x1, c3y1 /* FlxProc1() = OtherSubrs[1]; Part of Flex */ /* Calling sequence: '0 1 callothersubr' */ /* Saves and clears path, then restores currentpoint */ -static void FlxProc1() +static void FlxProc1(void) { struct segment *CurrentPoint; @@ -1637,7 +1642,7 @@ static void FlxProc1() /* FlxProc2() = OtherSubrs[2]; Part of Flex */ /* Calling sequence: '0 2 callothersubr' */ /* Returns currentpoint on stack */ -static void FlxProc2() +static void FlxProc2(void) { struct segment *CurrentPoint; double CurrentX, CurrentY; @@ -1654,7 +1659,7 @@ static void FlxProc2() /* HintReplace() = OtherSubrs[3]; Hint Replacement */ /* Calling sequence: 'subr# 1 3 callothersubr pop callsubr' */ /* Reinitializes stem hint structure */ -static void HintReplace() +static void HintReplace(void) { /* Effectively retire the current stems, but keep them around for */ /* revhint use in case we are in a stem when we replace hints. */ --- Xvnc/lib/font/Type1/util.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/Type1/util.h @@ -71,11 +71,11 @@ typedef int boolean; /***================================================================***/ /* Routines for managing virtual memory */ /***================================================================***/ -extern boolean vm_init(); +extern boolean vm_init(int cnt); extern long vm_free; extern long vm_size; extern char *vm_next; -extern char *vm_alloc(); +extern char *vm_alloc(int bytes); /***================================================================***/ /* Macros for managing virtual memory */ /***================================================================***/ @@ -177,6 +177,6 @@ typedef struct ps_dict { /***================================================================***/ /* Entry point for Type1Char to get entry from CharStrings */ /***================================================================***/ -extern psobj *GetType1CharString(); +/* extern psobj *GetType1CharString(psfont *fontP, unsigned char code);*/ #endif --- Xvnc/lib/font/bitmap/bdfint.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/bitmap/bdfint.h @@ -69,12 +69,12 @@ typedef struct BDFSTAT { BOOL haveDefaultCh; } bdfFileState; -extern unsigned char *bdfGetLine(); +extern unsigned char *bdfGetLine(FontFilePtr file, unsigned char *buf, int len); -extern void bdfError(); -extern void bdfWarning(); -extern Atom bdfForceMakeAtom(); -extern Atom bdfGetPropertyValue(); -extern unsigned char bdfHexByte(); +extern void bdfError(char *message, ...); +extern void bdfWarning(char *message, ...); +extern Atom bdfForceMakeAtom(register char *str, register int *size); +extern Atom bdfGetPropertyValue(char *s); +extern unsigned char bdfHexByte(char *s); #endif /* BDFINT_H */ --- Xvnc/lib/font/bitmap/bdfread.c.orig 2006-12-23 12:07:55 UTC +++ Xvnc/lib/font/bitmap/bdfread.c @@ -63,10 +63,8 @@ from the X Consortium. #define MAXENCODING 0xFFFF #define BDFLINELEN 1024 -extern int bitmapGetGlyphs(), bitmapGetMetrics(); -extern int bitmapGetBitmaps(), bitmapGetExtents(); -void bdfUnloadFont(); -static Bool bdfPadToTerminal(); +void bdfUnloadFont(FontPtr pFont); +static Bool bdfPadToTerminal(FontPtr pFont); extern int bdfFileLineNum; /***====================================================================***/ @@ -410,7 +408,7 @@ bdfReadCharacters(file, pFont, pState, bit, byte, glyp (*p == ' ') || (*p == '\t'); p++) /* empty for loop */ ; - ci->metrics.attributes = bdfHexByte(p) << 8 + bdfHexByte(p + 2); + ci->metrics.attributes = (bdfHexByte(p) << 8) + bdfHexByte(p + 2); line = bdfGetLine(file, lineBuf, BDFLINELEN); } else ci->metrics.attributes = 0; @@ -571,7 +569,7 @@ bdfReadProperties(file, pFont, pState) line = bdfGetLine(file, lineBuf, BDFLINELEN); if (!line || !bdfIsPrefix(line, "STARTPROPERTIES")) { - bdfError(file, "missing 'STARTPROPERTIES'\n"); + bdfError("missing 'STARTPROPERTIES'\n"); return (FALSE); } if (sscanf((char *) line, "STARTPROPERTIES %d", &nProps) != 1) { --- Xvnc/lib/font/bitmap/bdfutils.c.orig 2002-04-30 13:07:31 UTC +++ Xvnc/lib/font/bitmap/bdfutils.c @@ -55,6 +55,7 @@ from the X Consortium. #include #include +#include #include "fntfilst.h" #include "fontstruct.h" /* use bitmap structure */ @@ -67,34 +68,28 @@ int bdfFileLineNum; /*VARARGS1*/ void -bdfError(message, a0, a1, a2, a3, a4, a5) - char *message; - pointer a0, - a1, - a2, - a3, - a4, - a5; +bdfError(char *message, ...) { + va_list args; + fprintf(stderr, "BDF Error on line %d: ", bdfFileLineNum); - fprintf(stderr, message, a0, a1, a2, a3, a4, a5); + va_start(args, message); + vfprintf(stderr, message, args); + va_end(args); } /***====================================================================***/ /*VARARGS1*/ void -bdfWarning(message, a0, a1, a2, a3, a4, a5) - char *message; - pointer a0, - a1, - a2, - a3, - a4, - a5; +bdfWarning(char *message, ...) { + va_list args; + fprintf(stderr, "BDF Warning on line %d: ", bdfFileLineNum); - fprintf(stderr, message, a0, a1, a2, a3, a4, a5); + va_start(args, message); + vfprintf(stderr, message, args); + va_end(args); } /* @@ -141,7 +136,6 @@ bdfForceMakeAtom(str, size) register int *size; { register int len = strlen(str); - extern Atom MakeAtom(); if (size != NULL) *size += len + 1; @@ -215,7 +209,7 @@ bdfIsInteger(str) if (!(isdigit(c) || c == '-' || c == '+')) return (FALSE); - while (c = *str++) + while ((c = *str++)) if (!isdigit(c)) return (FALSE); --- Xvnc/lib/font/bitmap/bitmap.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/bitmap/bitmap.c @@ -34,10 +34,6 @@ in this Software without prior written authorization f #include "fntfilst.h" #include "bitmap.h" -int bitmapGetGlyphs(), bitmapGetMetrics(); -int bitmapGetBitmaps(), bitmapGetExtents(); -void bitmapComputeFontBounds (); -void bitmapComputeFontInkBounds (); int bitmapGetGlyphs(pFont, count, chars, charEncoding, glyphCount, glyphs) --- Xvnc/lib/font/bitmap/bitmapfunc.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/bitmap/bitmapfunc.c @@ -36,19 +36,22 @@ in this Software without prior written authorization f #include "bitmap.h" typedef struct _BitmapFileFunctions { - int (*ReadFont) ( /* pFont, file, bit, byte, glyph, scan */ ); - int (*ReadInfo) ( /* pFontInfo, file */ ); + int (*ReadFont) (FontPtr, FontFilePtr, int, int, int, int); + int (*ReadInfo) (FontInfoPtr, FontFilePtr); } BitmapFileFunctionsRec, *BitmapFileFunctionsPtr; -extern int pcfReadFont(), pcfReadFontInfo(); -extern int snfReadFont(), snfReadFontInfo(); -extern int bdfReadFont(), bdfReadFontInfo(); -extern int pmfReadFont(); -int BitmapOpenBitmap (); -extern int BitmapOpenScalable (); -int BitmapGetInfoBitmap (); -extern int BitmapGetInfoScalable (); -int BitmapGetRenderIndex (); +extern int pcfReadFont(FontPtr pFont, FontFilePtr file, int bit, int byte, int glyph, int scan); +extern int pcfReadFontInfo(FontInfoPtr pFontInfo, FontFilePtr file); +extern int snfReadFont(FontPtr pFont, FontFilePtr file, int bit, int byte, int glyph, int scan); +extern int snfReadFontInfo(FontInfoPtr pFontInfo, FontFilePtr file); +extern int bdfReadFont(FontPtr pFont, FontFilePtr file, int bit, int byte, int glyph, int scan); +extern int bdfReadFontInfo(FontInfoPtr pFontInfo, FontFilePtr file); +extern int pmfReadFont(FontPtr pFont, FontFilePtr file, int bit, int byte, int glyph, int scan); +int BitmapOpenBitmap(FontPathElementPtr fpe, FontPtr *ppFont, int flags, FontEntryPtr entry, char *fileName, fsBitmapFormat format, fsBitmapFormatMask fmask, FontPtr non_cachable_font); +extern int BitmapOpenScalable(FontPathElementPtr fpe, FontPtr *pFont, int flags, FontEntryPtr entry, char *fileName, FontScalablePtr vals, fsBitmapFormat format, fsBitmapFormatMask fmask, FontPtr non_cachable_font); +int BitmapGetInfoBitmap(FontPathElementPtr fpe, FontInfoPtr pFontInfo, FontEntryPtr entry, char *fileName); +extern int BitmapGetInfoScalable(FontPathElementPtr fpe, FontInfoPtr pFontInfo, FontEntryPtr entry, FontNamePtr fontName, char *fileName, FontScalablePtr vals); +int BitmapGetRenderIndex(FontRendererPtr renderer); /* * these two arrays must be in the same order @@ -208,7 +211,7 @@ BitmapGetInfoBitmap (fpe, pFontInfo, entry, fileName) #define numRenderers (sizeof renderers / sizeof renderers[0]) -BitmapRegisterFontFileFunctions () +BitmapRegisterFontFileFunctions (void) { int i; --- Xvnc/lib/font/bitmap/bitscale.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/bitmap/bitscale.c @@ -44,15 +44,15 @@ from the X Consortium. #include #undef _XOPEN_SOURCE #endif +#include #ifndef MAX #define MAX(a,b) (((a)>(b)) ? a : b) #endif -extern Atom MakeAtom(); +void bitmapUnloadScalable(FontPtr pFont); +static void initFontPropTable(void); -void bitmapUnloadScalable(); - enum scaleType { atom, truncate_atom, pixel_size, point_size, resolution_x, resolution_y, average_width, scaledX, scaledY, unscaled, fontname, @@ -66,10 +66,10 @@ typedef struct _fontProp { enum scaleType type; } fontProp; -static FontPtr BitmapScaleBitmaps(); -static FontPtr PrinterScaleBitmaps(); +static FontPtr BitmapScaleBitmaps(FontPtr pf, FontPtr opf, double widthMult, double heightMult, FontScalablePtr vals); +static FontPtr PrinterScaleBitmaps(FontPtr pf, FontPtr opf, double widthMult, double heightMult, FontScalablePtr vals); -typedef FontPtr (*ScaleFunc) (); +typedef FontPtr (*ScaleFunc) (FontPtr, FontPtr, double, double, FontScalablePtr); /* These next two arrays must be kept in step with the renderer array */ ScaleFunc scale[] = { @@ -82,10 +82,10 @@ ScaleFunc scale[] = PrinterScaleBitmaps, }; -static FontEntryPtr FindBestToScale(); -static FontEntryPtr FindPmfToScale(); +static FontEntryPtr FindBestToScale(FontPathElementPtr fpe, FontEntryPtr entry, FontScalablePtr vals, FontScalablePtr best, double *dxp, double *dyp, double *sdxp, double *sdyp, FontPathElementPtr *fpep); +static FontEntryPtr FindPmfToScale(FontPathElementPtr fpe, FontEntryPtr entry, FontScalablePtr vals, FontScalablePtr best, double *dxp, double *dyp, double *sdxp, double *sdyp, FontPathElementPtr *fpep); -typedef FontEntryPtr (*FindToScale) (); +typedef FontEntryPtr (*FindToScale) (FontPathElementPtr, FontEntryPtr, FontScalablePtr, FontScalablePtr, double *, double *, double *, double *, FontPathElementPtr *); FindToScale find_scale[] = { FindBestToScale, @@ -194,7 +194,7 @@ static fontProp rawFontPropTable[] = { }; static void -initFontPropTable() +initFontPropTable(void) { int i; fontProp *t; @@ -769,7 +769,7 @@ ComputeScaledProperties(sourceFontInfo, name, vals, dx return n; } -static void ScaleBitmap(); +static void ScaleBitmap(FontPtr pFont, CharInfoPtr opci, CharInfoPtr pci, double *inv_xform, double widthMult, double heightMult); static int compute_xform_matrix(vals, dx, dy, xform, inv_xform, xmult, ymult) @@ -869,11 +869,6 @@ ScaleFont(opf, widthMult, heightMult, sWidthMult, sHei (i)%(lastCol - firstCol + 1) + \ firstCol - opf->info.firstCol) - extern int bitmapGetBitmaps(); - extern int bitmapGetExtents(); - extern int bitmapGetGlyphs(); - extern int bitmapGetMetrics(); - *sWidth = 0; opfi = &opf->info; @@ -1011,7 +1006,7 @@ ScaleFont(opf, widthMult, heightMult, sWidthMult, sHei pci = bitmapFont->metrics; for (i = 0; i < nchars; i++) { - if (opci = obitmapFont->encoding[inkindex2 = OLDINDEX(i)]) + if ((opci = obitmapFont->encoding[inkindex2 = OLDINDEX(i)])) { double newlsb, newrsb, newdesc, newasc, point[2]; @@ -1604,7 +1599,7 @@ BitmapScaleBitmaps(pf, opf, widthMult, heightMult, val glyph = pf->glyph; for (i = 0; i < nchars; i++) { - if (pci = bitmapFont->encoding[i]) + if (pci == bitmapFont->encoding[i]) bytestoalloc += BYTES_FOR_GLYPH(pci, glyph); } @@ -1620,8 +1615,8 @@ BitmapScaleBitmaps(pf, opf, widthMult, heightMult, val glyphBytes = bitmapFont->bitmaps; for (i = 0; i < nchars; i++) { - if ((pci = bitmapFont->encoding[i]) && - (opci = obitmapFont->encoding[OLDINDEX(i)])) + if ((pci == bitmapFont->encoding[i]) && + (opci == obitmapFont->encoding[OLDINDEX(i)])) { pci->bits = glyphBytes; ScaleBitmap (pf, opci, pci, inv_xform, @@ -1683,7 +1678,7 @@ PrinterScaleBitmaps(pf, opf, widthMult, heightMult, va glyph = pf->glyph; for (i = 0; i < nchars; i++) { - if (pci = bitmapFont->encoding[i]) + if (pci == bitmapFont->encoding[i]) bytestoalloc = MAX(bytestoalloc,BYTES_FOR_GLYPH(pci, glyph)); } @@ -1699,8 +1694,8 @@ PrinterScaleBitmaps(pf, opf, widthMult, heightMult, va glyphBytes = bitmapFont->bitmaps; for (i = 0; i < nchars; i++) { - if ((pci = bitmapFont->encoding[i]) && - (opci = obitmapFont->encoding[OLDINDEX(i)])) + if ((pci == bitmapFont->encoding[i]) && + (opci == obitmapFont->encoding[OLDINDEX(i)])) { pci->bits = glyphBytes; } --- Xvnc/lib/font/bitmap/pcfread.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/bitmap/pcfread.c @@ -43,7 +43,7 @@ from the X Consortium. /* Read PCF font files */ -void pcfUnloadFont(); +void pcfUnloadFont(FontPtr pFont); static int position; static int --- Xvnc/lib/font/bitmap/snfread.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/bitmap/snfread.c @@ -57,7 +57,7 @@ from the X Consortium. #include "bitmap.h" #include "snfstr.h" -static void snfUnloadFont(); +static void snfUnloadFont(FontPtr pFont); static int snfReadCharInfo(file, charInfo, base) --- Xvnc/lib/font/fc/fsconvert.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/fc/fsconvert.c @@ -27,6 +27,8 @@ */ #include +#include +#include "X11/Xpoll.h" #include "FS.h" #include "FSproto.h" #include "fontmisc.h" @@ -37,7 +39,7 @@ extern char _fs_glyph_undefined; extern char _fs_glyph_requested; extern char _fs_glyph_zero_length; -extern int _fs_load_glyphs(); +extern int _fs_load_glyphs(pointer client, FontPtr pfont, Bool range_flag, unsigned int nchars, int item_size, unsigned char *data); /* * converts data from font server form to X server form @@ -70,7 +72,7 @@ _fs_init_fontinfo(conn, pfi) pfi->lastCol = pfi->lastRow; pfi->lastRow = n; pfi->defaultCh = (pfi->defaultCh >> 8) & 0xff - + (pfi->defaultCh & 0xff) << 8; + + ((pfi->defaultCh & 0xff) << 8); } if (FontCouldBeTerminal (pfi)) @@ -699,5 +701,5 @@ _fs_init_font(pfont) pfont->get_glyphs = _fs_get_glyphs; pfont->get_metrics = _fs_get_metrics; pfont->unload_font = _fs_unload_font; - pfont->unload_glyphs = (void (*)())0; + pfont->unload_glyphs = (void (*)(FontPtr))0; } --- Xvnc/lib/font/fc/fserve.c.orig 2003-01-13 22:25:11 UTC +++ Xvnc/lib/font/fc/fserve.c @@ -58,6 +58,7 @@ in this Software without prior written authorization f #endif #include #include +#include #include "X11/Xpoll.h" #include "FS.h" #include "FSproto.h" @@ -93,32 +94,30 @@ extern Time_t time (); (pci)->characterWidth) -extern FontPtr find_old_font(); +extern FontPtr find_old_font(XID id); -extern int _fs_build_range(); +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_read_glyphs(); -static int fs_read_list(); -static int fs_read_list_info(); - static int fs_font_type; extern fd_set _fs_fd_mask; -static void fs_block_handler(); -static int fs_wakeup(); +static void fs_block_handler(pointer data, struct timeval **wt, fd_set *LastSelectMask); +static int fs_wakeup(FontPathElementPtr fpe, fd_set *LastSelectMask); static FSFpePtr awaiting_reconnect; -void _fs_connection_died(); -static int _fs_restart_connection(); -static void _fs_try_reconnect(); -static int fs_send_query_info(); -static int fs_send_query_extents(); -static int fs_send_query_bitmaps(); -static int fs_send_close_font(); -static void fs_client_died(); -static void _fs_client_access(); -static void _fs_client_resolution(); +void _fs_connection_died(FSFpePtr conn); +static int _fs_restart_connection(FSFpePtr conn); +static void _fs_try_reconnect(void); +static int fs_send_query_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec); +static int fs_send_query_extents(FontPathElementPtr fpe, FSBlockDataPtr blockrec); +static int fs_send_query_bitmaps(FontPathElementPtr fpe, FSBlockDataPtr blockrec); +static int fs_send_close_font(FontPathElementPtr fpe, Font id); +static void fs_client_died(pointer client, FontPathElementPtr fpe); +static void _fs_client_access(FSFpePtr conn, pointer client, Bool sync); +static void _fs_client_resolution(FSFpePtr conn); char _fs_glyph_undefined; char _fs_glyph_requested; @@ -1161,7 +1160,7 @@ fs_do_open_font(fpe, blockrec, readheader) } if (err != StillWorking) { bfont->state = FS_DONE_REPLY; /* for _fs_load_glyphs() */ - while (blockrec = blockrec->depending) { + while ((blockrec = blockrec->depending)) { bfont = (FSBlockedFontPtr) blockrec->data; bfont->errcode = err; bfont->state = FS_DONE_REPLY; /* for _fs_load_glyphs() */ @@ -1183,10 +1182,10 @@ fs_block_handler(data, wt, LastSelectMask) FSFpePtr recon; XFD_ORSET(LastSelectMask, LastSelectMask, &_fs_fd_mask); - if (recon = awaiting_reconnect) { + if ((recon = awaiting_reconnect)) { now = time((Time_t *) 0); soonest = recon->time_to_try; - while (recon = recon->next_reconnect) { + while ((recon = recon->next_reconnect)) { if (recon->time_to_try < soonest) soonest = recon->time_to_try; } @@ -1341,7 +1340,7 @@ _fs_restart_connection(conn) FD_SET(conn->fs_fd, &_fs_fd_mask); if (!fs_send_init_packets(conn)) return FALSE; - while (block = (FSBlockDataPtr) conn->blocked_requests) { + while ((block = (FSBlockDataPtr) conn->blocked_requests)) { ClientSignal(block->client); fs_abort_blockrec(conn, block); } @@ -1349,7 +1348,7 @@ _fs_restart_connection(conn) } static void -_fs_try_reconnect() +_fs_try_reconnect(void) { FSFpePtr conn, *prev; @@ -1357,7 +1356,7 @@ _fs_try_reconnect() prev = &awaiting_reconnect; now = time((Time_t *) 0); - while (conn = *prev) { + while ((conn = *prev)) { if (now - conn->time_to_try > 0) { if (_fs_reopen_server(conn) && _fs_restart_connection(conn)) { conn->attemptReconnect = TRUE; @@ -2580,7 +2579,7 @@ fs_client_died(client, fpe) FSClientPtr *prev, cur; fsFreeACReq freeac; - for (prev = &conn->clients; cur = *prev; prev = &cur->next) + for (prev = &conn->clients; (cur = *prev); prev = &cur->next) { if (cur->client == client) { freeac.reqType = FS_FreeAC; @@ -2622,7 +2621,7 @@ fs_client_died(client, fpe) } } /* replace the client pointers in this block rec with the chained one */ - if (depending = blockrec->depending) { + if ((depending = blockrec->depending)) { blockrec->client = depending->client; blockrec->depending = depending->depending; blockrec = depending; @@ -2644,7 +2643,7 @@ _fs_client_access (conn, client, sync) int authlen; Bool new_cur = FALSE; - for (prev = &conn->clients; cur = *prev; prev = &cur->next) + for (prev = &conn->clients; (cur = *prev); prev = &cur->next) { if (cur->client == client) { @@ -2717,7 +2716,7 @@ _fs_client_access (conn, client, sync) */ void -fs_register_fpe_functions() +fs_register_fpe_functions(void) { fs_font_type = RegisterFPEFunctions(fs_name_check, fs_init_fpe, @@ -2805,7 +2804,7 @@ check_fs_next_list_with_info(client, fpe, namep, namel } void -check_fs_register_fpe_functions() +check_fs_register_fpe_functions(void) { fs_font_type = RegisterFPEFunctions(fs_name_check, fs_init_fpe, --- Xvnc/lib/font/fc/fserve.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/fc/fserve.h @@ -63,6 +63,6 @@ typedef struct _fs_font_table *FSFontTablePtr; typedef struct _fs_blocked_bitmaps *FSBlockedBitmapPtr; typedef struct _fs_blocked_extents *FSBlockedExtentPtr; -extern void fs_convert_char_info(); +extern void fs_convert_char_info(fsXCharInfo *src, xCharInfo *dst); #endif /* _FSERVE_H_ */ --- Xvnc/lib/font/fc/fsio.c.orig 2002-04-30 13:07:31 UTC +++ Xvnc/lib/font/fc/fsio.c @@ -100,7 +100,7 @@ extern int errno; static int padlength[4] = {0, 3, 2, 1}; fd_set _fs_fd_mask; -int _fs_wait_for_readable(); +int _fs_wait_for_readable(FSFpePtr conn); #ifdef SIGNALRETURNSINT #define SIGNAL_T int @@ -126,7 +126,7 @@ _fs_connect(servername, timeout) #ifdef SIGALRM unsigned oldTime; - SIGNAL_T(*oldAlarm) (); + SIGNAL_T(*oldAlarm) (int); #endif /* @@ -224,7 +224,7 @@ _fs_setup_connection(conn, servername, timeout, copy_n alts = 0; /* parse alternate list */ - if (nalts = rep.num_alternates) { + if ((nalts = rep.num_alternates)) { setuplength = rep.alternate_len << 2; alts = (FSFpeAltPtr) xalloc(nalts * sizeof(FSFpeAltRec) + setuplength); --- Xvnc/lib/font/fc/fsio.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/fc/fsio.h @@ -76,7 +76,7 @@ typedef struct _fs_fpe_data { struct _XtransConnInfo *trans_conn; /* transport connection object */ } FSFpeRec, *FSFpePtr; -FSFpePtr _fs_open_server(); -void _fs_bit_clear(); +FSFpePtr _fs_open_server(char *servername); +void _fs_bit_clear(fd_set *mask, int fd); #endif /* _FSIO_H_ */ --- Xvnc/lib/font/fontfile/bitsource.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/fontfile/bitsource.c @@ -91,7 +91,7 @@ FontFileUnregisterBitmapSource (fpe) * The bitmap sources in the new path will be registered by the init_func. */ void -FontFileEmptyBitmapSource() +FontFileEmptyBitmapSource(void) { if (FontFileBitmapSources.count == 0) return; --- Xvnc/lib/font/fontfile/bufio.c.orig 2002-04-30 13:07:31 UTC +++ Xvnc/lib/font/fontfile/bufio.c @@ -45,11 +45,12 @@ extern int errno; #endif BufFilePtr -BufFileCreate (private, io, skip, close) +BufFileCreate (private, io_get, io_put, skip, close) char *private; - int (*io)(); - int (*skip)(); - int (*close)(); + int (*io_get)(struct _buffile *f); + int (*io_put)(int, struct _buffile *f); + int (*skip)(struct _buffile *f, int); + int (*close)(struct _buffile *f, int); { BufFilePtr f; @@ -59,7 +60,8 @@ BufFileCreate (private, io, skip, close) f->private = private; f->bufp = f->buffer; f->left = 0; - f->io = io; + f->io_get = io_get; + f->io_put = io_put; f->skip = skip; f->close = close; return f; @@ -134,7 +136,7 @@ BufFileOpenRead (fd) /* hv: I'd bet WIN32 has the same effect here */ setmode(fd,O_BINARY); #endif - return BufFileCreate ((char *) fd, BufFileRawFill, BufFileRawSkip, BufFileRawClose); + return BufFileCreate ((char *) fd, BufFileRawFill, NULL, BufFileRawSkip, BufFileRawClose); } static @@ -164,7 +166,7 @@ BufFileOpenWrite (fd) /* hv: I'd bet WIN32 has the same effect here */ setmode(fd,O_BINARY); #endif - f = BufFileCreate ((char *) fd, BufFileRawFlush, 0, BufFileFlush); + f = BufFileCreate ((char *) fd, NULL, BufFileRawFlush, 0, BufFileFlush); f->bufp = f->buffer; f->left = BUFFILESIZE; return f; @@ -201,11 +203,11 @@ BufFileWrite (f, b, n) } int -BufFileFlush (f) +BufFileFlush (f, doClose) BufFilePtr f; { if (f->bufp != f->buffer) - (*f->io) (BUFFILEEOF, f); + (*f->io_put) (BUFFILEEOF, f); return 0; } --- Xvnc/lib/font/fontfile/decompress.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/fontfile/decompress.c @@ -89,8 +89,6 @@ static char_type magic_header[] = { "\037\235" }; /* 1 # define MAXCODE(n_bits) ((1 << (n_bits)) - 1) #endif /* COMPATIBLE */ -static code_int getcode(); - /* * the next two codes should not be changed lightly, as they must not * lie within the contiguous general code space. @@ -124,6 +122,7 @@ typedef struct _compressedFILE { unsigned short *tab_prefix; } CompressedFile; +static code_int getcode(CompressedFile *file); static int hsize_table[] = { 5003, /* 12 bits - 80% occupancy */ @@ -133,7 +132,9 @@ static int hsize_table[] = { 69001 /* 16 bits - 95% occupancy */ }; -static int BufCompressedFill(), BufCompressedSkip(), BufCompressedClose(); +static int BufCompressedFill(BufFilePtr f); +static int BufCompressedSkip(BufFilePtr f, int bytes); +static int BufCompressedClose(BufFilePtr f, int doClose); BufFilePtr BufFilePushCompressed (f) @@ -184,6 +185,7 @@ BufFilePushCompressed (f) *file->stackp++ = file->finchar; return BufFileCreate ((char *) file, BufCompressedFill, + NULL, BufCompressedSkip, BufCompressedClose); } --- Xvnc/lib/font/fontfile/dirfile.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/fontfile/dirfile.c @@ -50,7 +50,7 @@ in this Software without prior written authorization f extern int errno; #endif -static int ReadFontAlias(); +static int ReadFontAlias(char *directory, Bool isFile, FontDirectoryPtr *pdir); int FontFileReadDirectory (directory, pdir) @@ -75,10 +75,10 @@ FontFileReadDirectory (directory, pdir) #ifdef FONTDIRATTRIB /* Check for font directory attributes */ #ifndef __EMX__ - if (ptr = strchr(directory, ':')) { + if ((ptr = strchr(directory, ':'))) { #else /* OS/2 path might start with a drive letter, don't clip this */ - if (ptr = strchr(directory+2, ':')) { + if ((ptr = strchr(directory+2, ':'))) { #endif strncpy(dir_path, directory, ptr - directory); dir_path[ptr - directory] = '\0'; @@ -247,7 +247,8 @@ AddFileNameAliases(dir) * token types */ -static int lexAlias(), lexc(); +static int lexAlias(FILE *file, char **lexToken); +static int lexc(FILE *file); #define NAME 0 #define NEWLINE 1 --- Xvnc/lib/font/fontfile/ffcheck.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/fontfile/ffcheck.c @@ -38,11 +38,11 @@ in this Software without prior written authorization f * Map FPE functions to renderer functions */ -extern int FontFileNameCheck(); -extern int FontFileInitFPE(); -extern int FontFileResetFPE(); -extern int FontFileFreeFPE(); -extern void FontFileCloseFont(); +extern int FontFileNameCheck(char *name); +extern int FontFileInitFPE(FontPathElementPtr fpe); +extern int FontFileResetFPE(FontPathElementPtr fpe); +extern int FontFileFreeFPE(FontPathElementPtr fpe); +extern void FontFileCloseFont(FontPathElementPtr fpe, FontPtr pFont); /* Here we must check the client to see if it has a context attached to @@ -144,11 +144,11 @@ FontFileCheckListNextFontOrAlias(client, fpe, namep, n return BadFontName; } -extern void FontFileEmptyBitmapSource(); -typedef int (*IntFunc) (); +extern void FontFileEmptyBitmapSource(void); +typedef int (*IntFunc) (void); static int font_file_check_type; -FontFileCheckRegisterFpeFunctions () +FontFileCheckRegisterFpeFunctions (void) { BitmapRegisterFontFileFunctions (); #ifndef CRAY --- Xvnc/lib/font/fontfile/fontdir.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/fontfile/fontdir.c @@ -278,7 +278,7 @@ SetupWildMatch(table, pat, leftp, rightp, privatep) nDashes = pat->ndashes; firstWild = 0; t = name; - while (c = *t++) { + while ((c = *t++)) { if (isWild(c)) { if (!firstWild) firstWild = t - 1; --- Xvnc/lib/font/fontfile/fontfile.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/fontfile/fontfile.c @@ -171,7 +171,6 @@ transfer_values_to_alias(entryname, entrynamelength, r gotchas */ if (FontFileCompleteXLFD(&tmpVals2, &tmpVals2)) { - double hypot(); tempmatrix[0] = matrix[0] * tmpVals2.point_matrix[0] + matrix[1] * tmpVals2.point_matrix[2]; @@ -481,7 +480,7 @@ FontFileCloseFont (fpe, pFont) { FontEntryPtr entry; - if (entry = (FontEntryPtr) pFont->fpePrivate) { + if ((entry = (FontEntryPtr) pFont->fpePrivate)) { switch (entry->type) { case FONT_ENTRY_SCALABLE: FontFileRemoveScaledInstance (entry, pFont); @@ -561,7 +560,7 @@ _FontFileAddScalableNames(names, scaleNames, nameptr, nranges, max) FontNamesPtr names; FontNamesPtr scaleNames; - FontNamePtr *nameptr; + FontNamePtr nameptr; char *zeroChars; FontScalablePtr vals; fsRange *ranges; @@ -946,7 +945,7 @@ FontFileListOneFontWithInfo (client, fpe, namep, namel tmpName.length = namelen; } /* Match non XLFD pattern */ - if (entry = FontFileFindNameInDir (&dir->nonScalable, &tmpName)) + if ((entry = FontFileFindNameInDir (&dir->nonScalable, &tmpName))) { switch (entry->type) { case FONT_ENTRY_BITMAP: @@ -1105,11 +1104,11 @@ FontFileListNextFontOrAlias(client, fpe, namep, namele } -extern void FontFileEmptyBitmapSource(); -typedef int (*IntFunc) (); +extern void FontFileEmptyBitmapSource(void); +typedef int (*IntFunc) (void); static int font_file_type; -FontFileRegisterLocalFpeFunctions () +FontFileRegisterLocalFpeFunctions (void) { font_file_type = RegisterFPEFunctions(FontFileNameCheck, FontFileInitFPE, --- Xvnc/lib/font/fontfile/gunzip.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/fontfile/gunzip.c @@ -15,10 +15,10 @@ typedef struct _xzip_buf { BufFilePtr f; } xzip_buf; -static int BufZipFileSkip(); /* f, count */ -static int BufZipFileFill(); /* read: f; write: char, f */ -static int BufZipFileClose(); /* f, flag */ -static int BufCheckZipHeader(); /* f */ +static int BufZipFileSkip(BufFilePtr f, int c); +static int BufZipFileFill(BufFilePtr f); +static int BufZipFileClose(BufFilePtr f, int flag); +static int BufCheckZipHeader(BufFilePtr f); BufFilePtr BufFilePushZIP (f) @@ -60,6 +60,7 @@ BufFilePushZIP (f) return BufFileCreate(x, BufZipFileFill, + NULL, BufZipFileSkip, BufZipFileClose); } --- Xvnc/lib/font/fontfile/printerfont.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/fontfile/printerfont.c @@ -38,10 +38,9 @@ in this Software without prior written authorization f * Map FPE functions to renderer functions */ -extern int FontFileInitFPE(); -extern int FontFileResetFPE(); -extern int FontFileFreeFPE(); -extern void FontFileCloseFont(); +extern int FontFileResetFPE(FontPathElementPtr fpe); +extern int FontFileFreeFPE(FontPathElementPtr fpe); +extern void FontFileCloseFont(FontPathElementPtr fpe, FontPtr pFont); #define PRINTERPATHPREFIX "PRINTER:" /* STUB @@ -187,11 +186,11 @@ PrinterFontListNextFontOrAlias(client, fpe, namep, nam return BadFontName; } -extern void FontFileEmptyBitmapSource(); -typedef int (*IntFunc) (); +extern void FontFileEmptyBitmapSource(void); +typedef int (*IntFunc) (void); static int printer_font_type; -PrinterFontRegisterFpeFunctions () +PrinterFontRegisterFpeFunctions (void) { /* what is the use of printer font type? */ printer_font_type = RegisterFPEFunctions(PrinterFontNameCheck, --- Xvnc/lib/font/fontfile/register.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/fontfile/register.c @@ -33,7 +33,7 @@ in this Software without prior written authorization f * end up dragging in code from all the renderers, which is not small. */ -FontFileRegisterFpeFunctions() +FontFileRegisterFpeFunctions(void) { BitmapRegisterFontFileFunctions (); #ifndef CRAY --- Xvnc/lib/font/include/bitmap.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/include/bitmap.h @@ -63,12 +63,10 @@ typedef struct _BitmapFont { BitmapExtraPtr bitmapExtra; /* stuff not used by X server */ } BitmapFontRec, *BitmapFontPtr; -extern int bitmapReadFont(), bitmapReadFontInfo(); -extern int bitmapGetGlyphs(), bitmapGetMetrics(); -extern int bitmapGetBitmaps(), bitmapGetExtents(); -extern void bitmapUnloadFont(); +extern int bitmapGetGlyphs(FontPtr pFont, unsigned long count, register unsigned char *chars, FontEncoding charEncoding, unsigned long *glyphCount, CharInfoPtr *glyphs); +extern int bitmapGetMetrics(FontPtr pFont, unsigned long count, register unsigned char *chars, FontEncoding charEncoding, unsigned long *glyphCount, xCharInfo **glyphs); -extern void bitmapComputeFontBounds(); -extern void bitmapComputeFontInkBounds(); +extern void bitmapComputeFontBounds(FontPtr pFont); +extern void bitmapComputeFontInkBounds(FontPtr pFont); #endif /* _BITMAP_H_ */ --- Xvnc/lib/font/include/bufio.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/include/bufio.h @@ -46,22 +46,24 @@ typedef struct _buffile { BufChar *bufp; int left; BufChar buffer[BUFFILESIZE]; - int (*io)(/* BufFilePtr f */); - int (*skip)(/* BufFilePtr f, int count */); - int (*close)(/* BufFilePtr f */); + int (*io_get)(struct _buffile *f); + int (*io_put)(int, struct _buffile *f); + int (*skip)(struct _buffile *f, int count); + int (*close)(struct _buffile *f, int doClose); char *private; } BufFileRec, *BufFilePtr; -extern BufFilePtr BufFileCreate (); -extern BufFilePtr BufFileOpenRead (), BufFileOpenWrite (); -extern BufFilePtr BufFilePushCompressed (); +extern BufFilePtr BufFileCreate(char *private, int (*io_get)(BufFilePtr f), int (*io_put)(int, BufFilePtr f), int (*skip)(BufFilePtr f, int count), int (*close)(BufFilePtr f, int)); +extern BufFilePtr BufFileOpenRead(int fd); +extern BufFilePtr BufFileOpenWrite(int fd); +extern BufFilePtr BufFilePushCompressed(BufFilePtr f); #ifdef X_GZIP_FONT_COMPRESSION -extern BufFilePtr BufFilePushZIP (); +extern BufFilePtr BufFilePushZIP(BufFilePtr f); #endif -extern int BufFileClose (); -extern int BufFileFlush (); -#define BufFileGet(f) ((f)->left-- ? *(f)->bufp++ : (*(f)->io) (f)) -#define BufFilePut(c,f) (--(f)->left ? *(f)->bufp++ = (c) : (*(f)->io) (c,f)) +extern int BufFileClose(BufFilePtr f, int doClose); +extern int BufFileFlush(BufFilePtr f, int doClose); +#define BufFileGet(f) ((f)->left-- ? *(f)->bufp++ : (*(f)->io_get) (f)) +#define BufFilePut(c,f) (--(f)->left ? *(f)->bufp++ = (c) : (*(f)->io_put) (c,f)) #define BufFileSkip(f,c) ((*(f)->skip) (f, c)) #ifndef TRUE --- Xvnc/lib/font/include/fntfil.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/include/fntfil.h @@ -72,10 +72,10 @@ typedef struct _FontRenderer *FontRendererPtr; #define FontAliasFile "fonts.alias" #define FontScalableFile "fonts.scale" -extern FontEntryPtr FontFileFindNameInDir (); -extern FontEntryPtr FontFileFindNameInScalableDir (); -extern FontDirectoryPtr FontFileMakeDir (); -extern FontRendererPtr FontFileMatchRenderer (); -extern char *FontFileSaveString (); -extern FontScaledPtr FontFileFindScaledInstance (); +extern FontEntryPtr FontFileFindNameInDir(FontTablePtr table, FontNamePtr pat); +extern FontEntryPtr FontFileFindNameInScalableDir(FontTablePtr table, FontNamePtr pat, FontScalablePtr vals); +extern FontDirectoryPtr FontFileMakeDir(char *dirName, int size); +extern FontRendererPtr FontFileMatchRenderer(char *fileName); +extern char *FontFileSaveString(char *s); +extern FontScaledPtr FontFileFindScaledInstance(FontEntryPtr entry, FontScalablePtr vals, int noSpecificSize); #endif /* _FONTFILE_H_ */ --- Xvnc/lib/font/include/fntfilio.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/include/fntfilio.h @@ -44,8 +44,8 @@ typedef BufFilePtr FontFilePtr; #define FontFileEOF BUFFILEEOF -extern FontFilePtr FontFileOpen (); -extern FontFilePtr FontFileOpenWrite (); -extern FontFilePtr FontFileOpenFd (); -extern FontFilePtr FontFileOpenWriteFd (); -extern int FontFileClose (); +extern FontFilePtr FontFileOpen(char *name); +extern FontFilePtr FontFileOpenWrite(char *name); +extern FontFilePtr FontFileOpenFd(int fd); +extern FontFilePtr FontFileOpenWriteFd(int fd); +extern int FontFileClose(FontFilePtr f); --- Xvnc/lib/font/include/fntfilst.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/include/fntfilst.h @@ -36,10 +36,11 @@ in this Software without prior written authorization f #define _FONTFILEST_H_ #include +#include #include "fontmisc.h" #include "fontstruct.h" -#include "fntfil.h" #include "fontxlfd.h" +#include "fntfil.h" typedef struct _FontName { char *name; @@ -128,10 +129,10 @@ typedef struct _FontDirectory { typedef struct _FontRenderer { char *fileSuffix; int fileSuffixLen; - int (*OpenBitmap)(/* fpe, pFont, flags, entry, fileName, format, fmask */); - int (*OpenScalable)(/* fpe, pFont, flags, entry, fileName, vals, format, fmask */); - int (*GetInfoBitmap)(/* fpe, pFontInfo, entry, fileName */); - int (*GetInfoScalable)(/* fpe, pFontInfo, entry, fileName, vals */); + int (*OpenBitmap)(FontPathElementPtr, FontPtr *, int, FontEntryPtr, char *, fsBitmapFormat, fsBitmapFormatMask, FontPtr); + int (*OpenScalable)(FontPathElementPtr, FontPtr *, int, FontEntryPtr, char *, FontScalablePtr, fsBitmapFormat, fsBitmapFormatMask, FontPtr); + int (*GetInfoBitmap)(FontPathElementPtr, FontInfoPtr, FontEntryPtr, char *); + int (*GetInfoScalable)(FontPathElementPtr, FontInfoPtr, FontEntryPtr, FontNamePtr, char *, FontScalablePtr); int number; int capabilities; /* Bitmap components defined above */ } FontRendererRec; --- Xvnc/lib/font/include/fontmisc.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/include/fontmisc.h @@ -65,10 +65,10 @@ typedef CARD32 Atom; #define FALSE 0 #endif -extern char *NameForAtom (); +extern char *NameForAtom (Atom atom); -extern unsigned long *Xalloc(); -extern unsigned long *Xrealloc(); +extern unsigned long *Xalloc(unsigned long amount); +extern unsigned long *Xrealloc(register void *ptr, unsigned long amount); #define xalloc(n) Xalloc ((unsigned) n) #define xfree(p) Xfree ((pointer) p) --- Xvnc/lib/font/include/fontxlfd.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/include/fontxlfd.h @@ -65,7 +65,7 @@ from the X Consortium. #define XLFD_NDIGITS 3 /* Round numbers in pixel and point arrays to this many digits for repeatability */ -double xlfd_round_double(); +double xlfd_round_double(double x); typedef struct _FontScalable { int values_supplied; /* Bitmap identifying what advanced @@ -89,8 +89,8 @@ typedef struct _FontScalable { fsRange *ranges; } FontScalableRec, *FontScalablePtr; -extern Bool FontParseXLFDName(); -extern fsRange *FontParseRanges(); +extern Bool FontParseXLFDName(char *fname, FontScalablePtr vals, int subst); +extern fsRange *FontParseRanges(char *name, int *nranges); #define FONT_XLFD_REPLACE_NONE 0 #define FONT_XLFD_REPLACE_STAR 1 --- Xvnc/lib/font/util/atom.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/util/atom.c @@ -67,7 +67,7 @@ Hash(string, len) } static -ResizeHashTable () +ResizeHashTable (void) { int newHashSize; int newHashMask; @@ -113,7 +113,7 @@ ResizeHashTable () } static -ResizeReverseMap () +ResizeReverseMap (void) { if (reverseMapSize == 0) reverseMapSize = 1000; --- Xvnc/lib/font/util/fontaccel.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/util/fontaccel.c @@ -34,6 +34,7 @@ from the X Consortium. * Author: Keith Packard, MIT X Consortium */ +#include #include "fontmisc.h" #include "fontstruct.h" --- Xvnc/lib/font/util/fontnames.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/util/fontnames.c @@ -36,6 +36,7 @@ from the X Consortium. * @(#)fontnames.c 3.1 91/04/10 */ +#include #include "fontmisc.h" #include "fontstruct.h" --- Xvnc/lib/font/util/fontutil.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/util/fontutil.c @@ -35,6 +35,7 @@ from the X Consortium. * Author: Keith Packard, MIT X Consortium */ +#include #include "fontmisc.h" #include "fontstruct.h" #include "FSproto.h" @@ -204,7 +205,7 @@ ParseGlyphCachingMode(str) } void -InitGlyphCaching() +InitGlyphCaching(void) { /* Set glyphCachingMode to the mode the server hopes to support. DDX drivers that do not support the requested level --- Xvnc/lib/font/util/fontxlfd.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/util/fontxlfd.c @@ -35,6 +35,7 @@ from the X Consortium. * Author: Keith Packard, MIT X Consortium */ +#include #include "fontmisc.h" #include "fontstruct.h" #include "fontxlfd.h" @@ -341,7 +342,7 @@ int which; else { int value; - if (ptr = GetInt(ptr, &value)) + if ((ptr = GetInt(ptr, &value))) { vals->values_supplied &= ~which; if (value > 0) --- Xvnc/lib/font/util/format.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/util/format.c @@ -53,6 +53,7 @@ from the X Consortium. */ +#include #include "FSproto.h" #include "font.h" --- Xvnc/lib/font/util/miscutil.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/util/miscutil.c @@ -90,6 +90,6 @@ CopyISOLatin1Lowered (dst, src, len) *dest = '\0'; } -register_fpe_functions () +register_fpe_functions (void) { } --- Xvnc/lib/font/util/patcache.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/util/patcache.c @@ -32,6 +32,7 @@ in this Software without prior written authorization f * Author: Keith Packard, MIT X Consortium */ +#include #include #include @@ -64,7 +65,7 @@ typedef struct _FontPatternCache { /* Create and initialize cache */ FontPatternCachePtr -MakeFontPatternCache () +MakeFontPatternCache (void) { FontPatternCachePtr cache; int i; --- Xvnc/lib/font/util/private.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/font/util/private.c @@ -31,19 +31,20 @@ in this Software without prior written authorization f * Author: Keith Packard, MIT X Consortium */ +#include #include "fontmisc.h" #include "fontstruct.h" int _FontPrivateAllocateIndex; int -AllocateFontPrivateIndex () +AllocateFontPrivateIndex (void) { return _FontPrivateAllocateIndex++; } void -ResetFontPrivateIndex () +ResetFontPrivateIndex (void) { _FontPrivateAllocateIndex = 0; } --- Xvnc/lib/xtrans/Xtrans.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/xtrans/Xtrans.c @@ -145,7 +145,7 @@ TRANS(FreeConnInfo) (ciptr) XtransConnInfo ciptr; { - PRMSG (3,"FreeConnInfo(%x)\n", ciptr, 0, 0); + PRMSG (3,"FreeConnInfo(%p)\n", ciptr, 0, 0); if (ciptr->addr) xfree (ciptr->addr); @@ -464,8 +464,10 @@ char *address; if (ciptr == NULL) { if (!(thistrans->flags & TRANS_DISABLED)) + { PRMSG (1,"Open: transport open failed for %s/%s:%s\n", protocol, host, port); + } xfree (protocol); xfree (host); xfree (port); @@ -1056,7 +1058,7 @@ XtransConnInfo ciptr; */ static int -complete_network_count () +complete_network_count (void) { int count = 0; @@ -1098,7 +1100,7 @@ XtransConnInfo **ciptrs_ret; XtransConnInfo ciptr, temp_ciptrs[NUMTRANS]; int status, i, j; - PRMSG (2,"MakeAllCOTSServerListeners(%s,%x)\n", + PRMSG (2,"MakeAllCOTSServerListeners(%s,%p)\n", port ? port : "NULL", ciptrs_ret, 0); *count_ret = 0; @@ -1204,7 +1206,7 @@ XtransConnInfo **ciptrs_ret; XtransConnInfo ciptr, temp_ciptrs[NUMTRANS]; int status, i, j; - PRMSG (2,"MakeAllCLTSServerListeners(%s,%x)\n", + PRMSG (2,"MakeAllCLTSServerListeners(%s,%p)\n", port ? port : "NULL", ciptrs_ret, 0); *count_ret = 0; --- Xvnc/lib/xtrans/Xtransint.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/lib/xtrans/Xtransint.h @@ -466,21 +466,21 @@ static int is_numeric ( #if defined(XSERV_t) && defined(TRANS_SERVER) /* Use ErrorF() for the X server */ #define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \ - int hack= 0, saveerrno=errno; \ + int saveerrno=errno; \ struct timeval tp;\ gettimeofday(&tp,0); \ - ErrorF(__xtransname); \ - ErrorF(x+hack,a,b,c); \ + ErrorF("%s",__xtransname); \ + ErrorF(x,a,b,c); \ ErrorF("timestamp (ms): %d\n",tp.tv_sec*1000+tp.tv_usec/1000); \ errno=saveerrno; \ } else ((void)0) #else #define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \ - int hack= 0, saveerrno=errno; \ + int saveerrno=errno; \ struct timeval tp;\ gettimeofday(&tp,0); \ - fprintf(stderr, __xtransname); fflush(stderr); \ - fprintf(stderr, x+hack,a,b,c); fflush(stderr); \ + fprintf(stderr, "%s",__xtransname); fflush(stderr); \ + fprintf(stderr, x,a,b,c); fflush(stderr); \ fprintf(stderr, "timestamp (ms): %d\n",tp.tv_sec*1000+tp.tv_usec/1000); \ fflush(stderr); \ errno=saveerrno; \ @@ -490,16 +490,16 @@ static int is_numeric ( #if defined(XSERV_t) && defined(TRANS_SERVER) /* Use ErrorF() for the X server */ #define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \ - int hack= 0, saveerrno=errno; \ - ErrorF(__xtransname); \ - ErrorF(x+hack,a,b,c); \ + int saveerrno=errno; \ + ErrorF("%s",__xtransname); \ + ErrorF(x,a,b,c); \ errno=saveerrno; \ } else ((void)0) #else #define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \ int hack= 0, saveerrno=errno; \ - fprintf(stderr, __xtransname); fflush(stderr); \ - fprintf(stderr, x+hack,a,b,c); fflush(stderr); \ + fprintf(stderr, "%s",__xtransname); fflush(stderr); \ + fprintf(stderr, x,a,b,c); fflush(stderr); \ errno=saveerrno; \ } else ((void)0) #endif /* XSERV_t && TRANS_SERVER */ --- Xvnc/lib/xtrans/Xtranssock.c.orig 2003-01-29 12:34:22 UTC +++ Xvnc/lib/xtrans/Xtranssock.c @@ -301,7 +301,7 @@ XtransConnInfo ciptr; int namelen = sizeof sockname; #endif - PRMSG (3,"SocketINETGetAddr(%x)\n", ciptr, 0, 0); + PRMSG (3,"SocketINETGetAddr(%p)\n", ciptr, 0, 0); if (getsockname (ciptr->fd,(struct sockaddr *) &sockname, &namelen) < 0) { @@ -348,7 +348,7 @@ XtransConnInfo ciptr; int namelen = sizeof sockname; #endif - PRMSG (3,"SocketINETGetPeerAddr(%x)\n", ciptr, 0, 0); + PRMSG (3,"SocketINETGetPeerAddr(%p)\n", ciptr, 0, 0); if (getpeername (ciptr->fd, (struct sockaddr *) &sockname, &namelen) < 0) { @@ -768,7 +768,7 @@ int socknamelen; int fd = ciptr->fd; int retry; - PRMSG (3, "SocketCreateListener(%x,%d)\n", ciptr, fd, 0); + PRMSG (3, "SocketCreateListener(%p,%d)\n", ciptr, fd, 0); if (Sockettrans2devtab[ciptr->index].family == AF_INET) retry = 20; @@ -1014,9 +1014,9 @@ XtransConnInfo ciptr; struct sockaddr_un *unsock = (struct sockaddr_un *) ciptr->addr; struct stat statb; int status = TRANS_RESET_NOOP; - void TRANS(FreeConnInfo) (); + void TRANS(FreeConnInfo) (XtransConnInfo ciptr); - PRMSG (3, "SocketUNIXResetListener(%x,%d)\n", ciptr, ciptr->fd, 0); + PRMSG (3, "SocketUNIXResetListener(%p,%d)\n", ciptr, ciptr->fd, 0); if (stat (unsock->sun_path, &statb) == -1 || ((statb.st_mode & S_IFMT) != @@ -1080,7 +1080,7 @@ int *status; struct sockaddr_in sockname; int namelen = sizeof(sockname); - PRMSG (2, "SocketINETAccept(%x,%d)\n", ciptr, ciptr->fd, 0); + PRMSG (2, "SocketINETAccept(%p,%d)\n", ciptr, ciptr->fd, 0); if ((newciptr = (XtransConnInfo) xcalloc ( 1, sizeof(struct _XtransConnInfo))) == NULL) @@ -1163,7 +1163,7 @@ int *status; int namelen = sizeof sockname; #endif - PRMSG (2, "SocketUNIXAccept(%x,%d)\n", ciptr, ciptr->fd, 0); + PRMSG (2, "SocketUNIXAccept(%p,%d)\n", ciptr, ciptr->fd, 0); if ((newciptr = (XtransConnInfo) xcalloc ( 1, sizeof(struct _XtransConnInfo))) == NULL) @@ -1309,7 +1309,7 @@ char *port; tmpaddr = -1; } - PRMSG (4,"SocketINETConnect: inet_addr(%s) = %x\n", + PRMSG (4,"SocketINETConnect: inet_addr(%s) = %lx\n", host, tmpaddr, 0); if (tmpaddr == -1) @@ -1677,7 +1677,7 @@ TRANS(SocketBytesReadable) (ciptr, pend) XtransConnInfo ciptr; BytesReadable_t *pend; { - PRMSG (2,"SocketBytesReadable(%x,%d,%x)\n", + PRMSG (2,"SocketBytesReadable(%p,%d,%p)\n", ciptr, ciptr->fd, pend); #ifdef WIN32 @@ -1704,7 +1704,7 @@ char *buf; int size; { - PRMSG (2,"SocketRead(%d,%x,%d)\n", ciptr->fd, buf, size); + PRMSG (2,"SocketRead(%d,%p,%d)\n", ciptr->fd, buf, size); #if defined(WIN32) || defined(__EMX__) return recv ((SOCKET)ciptr->fd, buf, size, 0); @@ -1722,7 +1722,7 @@ char *buf; int size; { - PRMSG (2,"SocketWrite(%d,%x,%d)\n", ciptr->fd, buf, size); + PRMSG (2,"SocketWrite(%d,%p,%d)\n", ciptr->fd, buf, size); #if defined(WIN32) || defined(__EMX__) return send ((SOCKET)ciptr->fd, buf, size, 0); @@ -1740,7 +1740,7 @@ struct iovec *buf; int size; { - PRMSG (2,"SocketReadv(%d,%x,%d)\n", ciptr->fd, buf, size); + PRMSG (2,"SocketReadv(%d,%p,%d)\n", ciptr->fd, buf, size); return READV (ciptr, buf, size); } @@ -1754,7 +1754,7 @@ struct iovec *buf; int size; { - PRMSG (2,"SocketWritev(%d,%x,%d)\n", ciptr->fd, buf, size); + PRMSG (2,"SocketWritev(%d,%p,%d)\n", ciptr->fd, buf, size); return WRITEV (ciptr, buf, size); } @@ -1766,7 +1766,7 @@ TRANS(SocketDisconnect) (ciptr) XtransConnInfo ciptr; { - PRMSG (2,"SocketDisconnect(%x,%d)\n", ciptr, ciptr->fd, 0); + PRMSG (2,"SocketDisconnect(%p,%d)\n", ciptr, ciptr->fd, 0); return shutdown (ciptr->fd, 2); /* disallow further sends and receives */ } @@ -1779,7 +1779,7 @@ TRANS(SocketINETClose) (ciptr) XtransConnInfo ciptr; { - PRMSG (2,"SocketINETClose(%x,%d)\n", ciptr, ciptr->fd, 0); + PRMSG (2,"SocketINETClose(%p,%d)\n", ciptr, ciptr->fd, 0); return close (ciptr->fd); } @@ -1803,7 +1803,7 @@ XtransConnInfo ciptr; char path[200]; /* > sizeof sun_path +1 */ int ret; - PRMSG (2,"SocketUNIXClose(%x,%d)\n", ciptr, ciptr->fd, 0); + PRMSG (2,"SocketUNIXClose(%p,%d)\n", ciptr, ciptr->fd, 0); ret = close(ciptr->fd); @@ -1832,7 +1832,7 @@ XtransConnInfo ciptr; int ret; - PRMSG (2,"SocketUNIXCloseForCloning(%x,%d)\n", + PRMSG (2,"SocketUNIXCloseForCloning(%p,%d)\n", ciptr, ciptr->fd, 0); ret = close(ciptr->fd); --- Xvnc/programs/Xserver/Xvnc.man.orig 2006-08-15 06:10:26 UTC +++ Xvnc/programs/Xserver/Xvnc.man @@ -64,7 +64,7 @@ the viewer display. UDP port for keyboard/pointer data. .TP \fB\-rfbport\fR \fIport\fR -TCP port for RFB protocol. The RFB protocol is used for commnunication +TCP port for RFB protocol. The RFB protocol is used for communication between VNC server and clients. .TP \fB\-rfbwait\fR \fItime\fR @@ -137,7 +137,7 @@ version of Xvnc by AT&T labs (TightVNC-specific). .SH BUGS There are many security problems in current Xvnc implementation. It's recommended to restrict network access to Xvnc servers from untrusted -network adresses. Probably, the best way to secure Xvnc server is to +network addresses. Probably, the best way to secure Xvnc server is to allow only loopback connections from the server machine (the \fI\-localhost\fR option) and to use SSH tunneling for remote access to the Xvnc server. For details on SSH tunneling, see --- Xvnc/programs/Xserver/cfb/cfballpriv.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/cfb/cfballpriv.c @@ -42,8 +42,8 @@ in this Software without prior written authorization f #include "cfbmskbits.h" #include "mibstore.h" -int cfbWindowPrivateIndex; -int cfbGCPrivateIndex; +int cfbWindowPrivateIndex __attribute__((common)); +int cfbGCPrivateIndex __attribute__((common)); #ifdef CFB_NEED_SCREEN_PRIVATE int cfbScreenPrivateIndex; #endif --- Xvnc/programs/Xserver/cfb/cfbbitblt.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/cfb/cfbbitblt.c @@ -666,7 +666,7 @@ cfbCopyPlane1to8 (pSrcDrawable, pDstDrawable, rop, prg #endif /* shared among all different cfb depths through linker magic */ -RegionPtr (*cfbPuntCopyPlane)(); +RegionPtr (*cfbPuntCopyPlane)() __attribute__((common)); RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, bitPlane) --- Xvnc/programs/Xserver/cfb/cfbply1rct.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/cfb/cfbply1rct.c @@ -184,7 +184,7 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mo vertex2p = (int *) ptsIn; #define Setup(c,x,vertex,dx,dy,e,sign,step) {\ x = intToX(vertex); \ - if (dy = intToY(c) - y) { \ + if ((dy = intToY(c) - y)) { \ dx = intToX(c) - x; \ step = 0; \ if (dx >= 0) \ @@ -334,7 +334,7 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mo RROP_SOLID(addr); addr++; } #if PPW > 1 - if (mask = ~SCRRIGHT(bits, r & PIM)) + if ((mask = ~SCRRIGHT(bits, r & PIM))) RROP_SOLID_MASK(addr,mask); } #endif --- Xvnc/programs/Xserver/cfb/cfbrrop.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/cfb/cfbrrop.h @@ -270,6 +270,9 @@ in this Software without prior written authorization f #define RROP_UNROLL_CASE4(p,i) RROP_UNROLL_CASE2(p,(i)+2) RROP_UNROLL_CASE2(p,i) #define RROP_UNROLL_CASE8(p,i) RROP_UNROLL_CASE4(p,(i)+4) RROP_UNROLL_CASE4(p,i) #define RROP_UNROLL_CASE16(p,i) RROP_UNROLL_CASE8(p,(i)+8) RROP_UNROLL_CASE8(p,i) +#ifdef LONG64 +#define RROP_UNROLL_CASE32(p,i) RROP_UNROLL_CASE16(p,(i)+16) RROP_UNROLL_CASE16(p,i) +#endif /* LONG64 */ #define RROP_UNROLL_CASE3(p) RROP_UNROLL_CASE2(p,2) RROP_UNROLL_CASE1(p,1) #define RROP_UNROLL_CASE7(p) RROP_UNROLL_CASE4(p,4) RROP_UNROLL_CASE3(p) #define RROP_UNROLL_CASE15(p) RROP_UNROLL_CASE8(p,8) RROP_UNROLL_CASE7(p) --- Xvnc/programs/Xserver/dix/Imakefile.orig 2009-03-05 06:38:33 UTC +++ Xvnc/programs/Xserver/dix/Imakefile @@ -43,15 +43,11 @@ OBJS = atom.o colormap.o cursor.o devices.o dispatch.o * changed. */ -#ifdef DefaultFontPath -DEFAULTFONTPATH = DefaultFontPath +DEFAULTFONTPATH = ${LOCALBASE}/share/fonts/misc SITE_FONT_PATH = -DCOMPILEDDEFAULTFONTPATH=\"$(DEFAULTFONTPATH)\" -#endif -#ifdef DefaultRGBDatabase -DEFAULTRGBDATABASE = DefaultRGBDatabase +DEFAULTRGBDATABASE = ${LOCALBASE}/lib/X11/rgb SITE_RGB_DB = -DRGB_DB=\"$(DEFAULTRGBDATABASE)\" -#endif #ifdef DefaultDisplayClass DEFAULTDISPLAYCLASS = DefaultDisplayClass --- Xvnc/programs/Xserver/dix/atom.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/dix/atom.c @@ -167,7 +167,7 @@ NameForAtom(atom) } void -AtomError() +AtomError(void) { FatalError("initializing atoms"); } @@ -186,7 +186,7 @@ FreeAtom(patom) } void -FreeAllAtoms() +FreeAllAtoms(void) { if(atomRoot == (NodePtr)NULL) return; @@ -198,7 +198,7 @@ FreeAllAtoms() } void -InitAtoms() +InitAtoms(void) { FreeAllAtoms(); tableLength = InitialTableSize; --- Xvnc/programs/Xserver/dix/devices.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/dix/devices.c @@ -163,7 +163,7 @@ DisableDevice(dev) } int -InitAndStartDevices() +InitAndStartDevices(void) { register DeviceIntPtr dev, next; @@ -280,7 +280,7 @@ CloseDevice(dev) } void -CloseDownDevices() +CloseDownDevices(void) { register DeviceIntPtr dev, next; @@ -344,7 +344,7 @@ RemoveDevice(dev) } int -NumMotionEvents() +NumMotionEvents(void) { return inputInfo.pointer->valuator->numMotionEvents; } @@ -404,13 +404,13 @@ _RegisterKeyboardDevice(device) } DevicePtr -LookupKeyboardDevice() +LookupKeyboardDevice(void) { return inputInfo.keyboard ? &inputInfo.keyboard->public : NULL; } DevicePtr -LookupPointerDevice() +LookupPointerDevice(void) { return inputInfo.pointer ? &inputInfo.pointer->public : NULL; } @@ -762,7 +762,7 @@ InitStringFeedbackClassDeviceStruct (dev, controlProc, for (i=0; ictrl.symbols_supported+i) = *symbols++; for (i=0; ictrl.symbols_displayed+i) = (KeySym) NULL; + *(feedc->ctrl.symbols_displayed+i) = (KeySym) 0; feedc->ctrl.id = 0; if ( (feedc->next = dev->stringfeed) ) feedc->ctrl.id = dev->stringfeed->ctrl.id + 1; --- Xvnc/programs/Xserver/dix/dispatch.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/dix/dispatch.c @@ -149,7 +149,7 @@ SetInputCheck(c0, c1) } void -UpdateCurrentTime() +UpdateCurrentTime(void) { TimeStamp systime; @@ -168,7 +168,7 @@ UpdateCurrentTime() /* Like UpdateCurrentTime, but can't call ProcessInputEvents */ void -UpdateCurrentTimeIf() +UpdateCurrentTimeIf(void) { TimeStamp systime; @@ -181,7 +181,7 @@ UpdateCurrentTimeIf() } void -InitSelections() +InitSelections(void) { if (CurrentSelections) xfree(CurrentSelections); @@ -221,7 +221,7 @@ FlushClientCaches(id) #define MAJOROP ((xReq *)client->requestBuffer)->reqType void -Dispatch() +Dispatch(void) { register int *clientReady; /* array of request ready clients */ register int result; @@ -3430,7 +3430,7 @@ int ProcNoOperation(client) } void -InitProcVectors() +InitProcVectors(void) { int i; for (i = 0; i<256; i++) @@ -3555,7 +3555,7 @@ CloseDownClient(client) } static void -KillAllClients() +KillAllClients(void) { int i; for (i=1; i #include "X.h" #include "Xmd.h" #include "Xproto.h" @@ -1759,10 +1760,10 @@ SetFontPathElements(npaths, paths, bad) if (err != Successful) { xfree(fpe->name); xfree(fpe); - err = BadValue; - goto bail; + err = Successful; + } else { + fplist[valid_paths++] = fpe; } - fplist[valid_paths++] = fpe; } else { err = BadValue; goto bail; @@ -1915,7 +1916,7 @@ DeleteClientFontStuff(client) } void -InitFonts () +InitFonts (void) { patternCache = MakeFontPatternCache(); @@ -1930,7 +1931,7 @@ InitFonts () } int -GetDefaultPointSize () +GetDefaultPointSize (void) { return 120; } @@ -2126,7 +2127,7 @@ RegisterFPEFunctions(name_func, init_func, free_func, } void -FreeFonts() +FreeFonts(void) { if (patternCache) { FreeFontPatternCache(patternCache); @@ -2151,7 +2152,7 @@ find_old_font(id) } Font -GetNewFontClientID() +GetNewFontClientID(void) { return FakeClientID(0); } --- Xvnc/programs/Xserver/dix/dixutils.c.orig 2006-12-23 12:07:55 UTC +++ Xvnc/programs/Xserver/dix/dixutils.c @@ -404,7 +404,6 @@ DeleteWindowFromAnySaveSet(pWin) */ void NoopDDA( -#undef NeedVarargsPrototypes #if NeedVarargsPrototypes void* f, ... #endif @@ -546,7 +545,7 @@ RemoveBlockAndWakeupHandlers (blockHandler, wakeupHand } void -InitBlockAndWakeupHandlers () +InitBlockAndWakeupHandlers (void) { xfree (handlers); handlers = (BlockHandlerPtr) 0; @@ -563,7 +562,7 @@ WorkQueuePtr workQueue; static WorkQueuePtr *workQueueLast = &workQueue; void -ProcessWorkQueue() +ProcessWorkQueue(void) { WorkQueuePtr q, *p; @@ -574,7 +573,7 @@ ProcessWorkQueue() * they will be called again. This must be reentrant with * QueueWorkProc. */ - while (q = *p) + while ((q = *p)) { if ((*q->function) (q->client, q->closure)) { @@ -591,12 +590,12 @@ ProcessWorkQueue() } void -ProcessWorkQueueZombies() +ProcessWorkQueueZombies(void) { WorkQueuePtr q, *p; p = &workQueue; - while (q = *p) + while ((q = *p)) { if (q->client && q->client->clientGone) { @@ -997,7 +996,7 @@ DeleteCallbackList(pcbl) } void -InitCallbackManager() +InitCallbackManager(void) { int i; --- Xvnc/programs/Xserver/dix/events.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/dix/events.c @@ -235,7 +235,7 @@ static CARD8 criticalEvents[32] = }; Mask -GetNextEventMask() +GetNextEventMask(void) { lastEventMask <<= 1; return lastEventMask; @@ -455,7 +455,7 @@ ConfineCursorToWindow(pWin, generateEvents, confineToS } Bool -PointerConfinedToScreen() +PointerConfinedToScreen(void) { return sprite.confined; } @@ -525,19 +525,19 @@ PostNewCursor() } WindowPtr -GetCurrentRootWindow() +GetCurrentRootWindow(void) { return ROOT; } WindowPtr -GetSpriteWindow() +GetSpriteWindow(void) { return sprite.win; } CursorPtr -GetSpriteCursor() +GetSpriteCursor(void) { return sprite.current; } @@ -705,7 +705,7 @@ FreezeThaw(dev, frozen) } void -ComputeFreezes() +ComputeFreezes(void) { register DeviceIntPtr replayDev = syncEvents.replayDev; register int i; @@ -730,12 +730,13 @@ ComputeFreezes() for (i = 0; i < spriteTraceGood; i++) if (syncEvents.replayWin == spriteTrace[i]) { - if (!CheckDeviceGrabs(replayDev, xE, i+1, count)) + if (!CheckDeviceGrabs(replayDev, xE, i+1, count)) { if (replayDev->focus) DeliverFocusedEvent(replayDev, xE, w, count); else DeliverDeviceEvents(w, xE, NullGrab, NullWindow, replayDev, count); + } goto playmore; } /* must not still be in the same stack */ @@ -1590,7 +1591,7 @@ CheckMotion(xE) } void -WindowsRestructured() +WindowsRestructured(void) { (void) CheckMotion((xEvent *)NULL); } @@ -3291,7 +3292,7 @@ ProcQueryPointer(client) } void -InitEvents() +InitEvents(void) { int i; --- Xvnc/programs/Xserver/dix/extension.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/dix/extension.c @@ -81,10 +81,10 @@ ExtensionEntry *AddExtension(name, NumEvents, NumError char *name; int NumEvents; int NumErrors; - int (* MainProc)(); - int (* SwappedMainProc)(); - void (* CloseDownProc)(); - unsigned short (* MinorOpcodeProc)(); + int (* MainProc)(register ClientPtr client); + int (* SwappedMainProc)(register ClientPtr client); + void (* CloseDownProc)(ExtensionEntry *extEntry); + unsigned short (* MinorOpcodeProc)(ClientPtr); { int i; register ExtensionEntry *ext, **newexts; @@ -256,7 +256,7 @@ MinorOpcodeOfRequest(client) } void -CloseDownExtensions() +CloseDownExtensions(void) { register int i,j; --- Xvnc/programs/Xserver/dix/gc.c.orig 2002-04-30 13:07:31 UTC +++ Xvnc/programs/Xserver/dix/gc.c @@ -100,14 +100,14 @@ ValidateGC(pDraw, pGC) * or pUnion, but not both; one of them must be NULL. If you don't need * to pass any pointers, you can use either one: * - * /* example calling dixChangeGC using pC32 parameter + * * example calling dixChangeGC using pC32 parameter * CARD32 v[2]; * v[0] = foreground; * v[1] = background; * dixChangeGC(client, pGC, GCForeground|GCBackground, v, NULL); * - * /* example calling dixChangeGC using pUnion parameter; - * /* same effect as above + * * example calling dixChangeGC using pUnion parameter; + * * same effect as above * ChangeGCVal v[2]; * v[0].val = foreground; * v[1].val = background; @@ -116,10 +116,10 @@ ValidateGC(pDraw, pGC) * However, if you need to pass a pointer to a pixmap or font, you MUST * use the pUnion parameter. * - * /* example calling dixChangeGC passing pointers in the value list + * * example calling dixChangeGC passing pointers in the value list * ChangeGCVal v[2]; * v[0].val = FillTiled; - * v[1].ptr = pPixmap; /* pointer to a pixmap + * v[1].ptr = pPixmap; * pointer to a pixmap * dixChangeGC(client, pGC, GCFillStyle|GCTile, NULL, v); * * Note: we could have gotten by with just the pUnion parameter, but on --- Xvnc/programs/Xserver/dix/initatoms.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/dix/initatoms.c @@ -7,7 +7,7 @@ #include "Xatom.h" #include "misc.h" #include "dix.h" -void MakePredeclaredAtoms() +void MakePredeclaredAtoms(void) { if (MakeAtom("PRIMARY", 7, 1) != XA_PRIMARY) AtomError(); if (MakeAtom("SECONDARY", 9, 1) != XA_SECONDARY) AtomError(); --- Xvnc/programs/Xserver/dix/main.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/dix/main.c @@ -80,7 +80,7 @@ extern int defaultScreenSaverAllowExposures; #include "dpms.h" #endif -void ddxGiveUp(); +void ddxGiveUp(void); extern int InitClientPrivates( #if NeedFunctionPrototypes @@ -433,7 +433,7 @@ main(argc, argv) static int padlength[4] = {0, 3, 2, 1}; static Bool -CreateConnectionBlock() +CreateConnectionBlock(void) { xConnSetup setup; xWindowRoot root; --- Xvnc/programs/Xserver/dix/privates.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/dix/privates.c @@ -58,7 +58,7 @@ unsigned *clientPrivateSizes; unsigned totalClientSize; void -ResetClientPrivates() +ResetClientPrivates(void) { clientPrivateCount = 0; clientPrivateLen = 0; @@ -69,7 +69,7 @@ ResetClientPrivates() } int -AllocateClientPrivateIndex() +AllocateClientPrivateIndex(void) { return clientPrivateCount++; } @@ -111,7 +111,7 @@ AllocateClientPrivate(index2, amount) int screenPrivateCount; void -ResetScreenPrivates() +ResetScreenPrivates(void) { screenPrivateCount = 0; } @@ -120,7 +120,7 @@ ResetScreenPrivates() * so we have to worry about resizing existing devPrivates */ int -AllocateScreenPrivateIndex() +AllocateScreenPrivateIndex(void) { int index2; int i; @@ -151,13 +151,13 @@ AllocateScreenPrivateIndex() static int windowPrivateCount; void -ResetWindowPrivates() +ResetWindowPrivates(void) { windowPrivateCount = 0; } int -AllocateWindowPrivateIndex() +AllocateWindowPrivateIndex(void) { return windowPrivateCount++; } @@ -201,13 +201,13 @@ AllocateWindowPrivate(pScreen, index2, amount) static int gcPrivateCount; void -ResetGCPrivates() +ResetGCPrivates(void) { gcPrivateCount = 0; } int -AllocateGCPrivateIndex() +AllocateGCPrivateIndex(void) { return gcPrivateCount++; } @@ -251,13 +251,13 @@ AllocateGCPrivate(pScreen, index2, amount) static int pixmapPrivateCount; void -ResetPixmapPrivates() +ResetPixmapPrivates(void) { pixmapPrivateCount = 0; } int -AllocatePixmapPrivateIndex() +AllocatePixmapPrivateIndex(void) { return pixmapPrivateCount++; } @@ -303,7 +303,7 @@ AllocatePixmapPrivate(pScreen, index2, amount) int colormapPrivateCount; void -ResetColormapPrivates() +ResetColormapPrivates(void) { colormapPrivateCount = 0; } --- Xvnc/programs/Xserver/dix/property.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/dix/property.c @@ -62,6 +62,8 @@ SOFTWARE. #include "extensions/security.h" #endif +extern void rfbRootPropertyChange(PropertyPtr pProp); + #if defined(LBX) || defined(LBX_COMPAT) int fWriteToClient(client, len, buf) ClientPtr client; @@ -393,7 +395,6 @@ ChangeWindowProperty(pWin, property, type, format, mod /* Addition for RFB X server */ if (pWin->parent == NullWindow) { - extern void rfbRootPropertyChange(); rfbRootPropertyChange(pProp); } --- Xvnc/programs/Xserver/dix/resource.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/dix/resource.c @@ -146,7 +146,7 @@ CreateNewResourceType(deleteFunc) } RESTYPE -CreateNewResourceClass() +CreateNewResourceClass(void) { RESTYPE next = lastResourceClass >> 1; @@ -701,7 +701,7 @@ FreeClientResources(client) } void -FreeAllResources() +FreeAllResources(void) { int i; --- Xvnc/programs/Xserver/dix/swapreq.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/dix/swapreq.c @@ -58,7 +58,7 @@ SOFTWARE. #include "extnsionst.h" /* for SendEvent */ #include "swapreq.h" -extern int (* ProcVector[256]) (); +extern int (* ProcVector[256]) (ClientPtr client); /* Thanks to Jack Palevich for testing and subsequently rewriting all this */ --- Xvnc/programs/Xserver/dix/window.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/dix/window.c @@ -101,8 +101,6 @@ ScreenSaverStuffRec savedScreenInfo[MAXSCREENS]; extern WindowPtr *WindowTable; -extern int rand(); - static Bool TileScreenSaver( #if NeedFunctionPrototypes int /*i*/, --- Xvnc/programs/Xserver/hw/vnc/corre.c.orig 2001-01-16 22:26:22 UTC +++ Xvnc/programs/Xserver/hw/vnc/corre.c @@ -25,6 +25,7 @@ */ #include +#include #include "rfb.h" /* --- Xvnc/programs/Xserver/hw/vnc/httpd.c.orig 2009-03-05 06:38:33 UTC +++ Xvnc/programs/Xserver/hw/vnc/httpd.c @@ -35,6 +35,7 @@ #include #include #include +#include #ifndef USE_LIBWRAP #define USE_LIBWRAP 0 @@ -52,7 +53,7 @@ #define OK_STR "HTTP/1.0 200 OK\r\n\r\n" -static void httpProcessInput(); +static void httpProcessInput(void); static Bool compareAndSkip(char **ptr, const char *str); static Bool parseParams(const char *request, char *result, int max_bytes); static Bool validateString(char *str); @@ -74,7 +75,7 @@ static size_t buf_filled = 0; */ void -httpInitSockets() +httpInitSockets(void) { static Bool done = FALSE; @@ -109,7 +110,7 @@ httpInitSockets() */ void -httpCheckFds() +httpCheckFds(void) { int nfds, n; fd_set fds; @@ -178,7 +179,7 @@ httpCheckFds() static void -httpCloseSock() +httpCloseSock(void) { close(httpSock); RemoveEnabledDevice(httpSock); @@ -192,7 +193,7 @@ httpCloseSock() */ static void -httpProcessInput() +httpProcessInput(void) { struct sockaddr_in addr; socklen_t addrlen = sizeof(addr); @@ -343,7 +344,7 @@ httpProcessInput() char *dollar; buf[n] = 0; /* make sure it's null-terminated */ - while (dollar = strchr(ptr, '$')) { + while ((dollar = strchr(ptr, '$'))) { WriteExact(httpSock, ptr, (dollar - ptr)); ptr = dollar; --- Xvnc/programs/Xserver/hw/vnc/init.c.orig 2009-02-05 09:48:09 UTC +++ Xvnc/programs/Xserver/hw/vnc/init.c @@ -117,7 +117,8 @@ static int rfbKeybdProc(DeviceIntPtr pDevice, int onof static int rfbMouseProc(DeviceIntPtr pDevice, int onoff); static Bool CheckDisplayNumber(int n); -static Bool rfbAlwaysTrue(); +static Bool rfbSaveAlwaysTrue(ScreenPtr _pScreen, int _on); +static Bool rfbCursorAlwaysTrue(ScreenPtr _pScreen, CursorPtr _pCursor); static char *rfbAllocateFramebufferMemory(rfbScreenInfoPtr prfb); static Bool rfbCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y); static void rfbCrossScreen(ScreenPtr pScreen, Bool entering); @@ -539,12 +540,12 @@ rfbScreenInit(index, pScreen, argc, argv) pScreen->ListInstalledColormaps = rfbListInstalledColormaps; pScreen->StoreColors = rfbStoreColors; - pScreen->SaveScreen = rfbAlwaysTrue; + pScreen->SaveScreen = rfbSaveAlwaysTrue; rfbDCInitialize(pScreen, &rfbPointerCursorFuncs); if (noCursor) { - pScreen->DisplayCursor = rfbAlwaysTrue; + pScreen->DisplayCursor = rfbCursorAlwaysTrue; prfb->cursorIsDrawn = TRUE; } @@ -683,7 +684,7 @@ rfbMouseProc(pDevice, onoff) map[4] = 4; map[5] = 5; InitPointerDeviceStruct(pDev, map, 5, miPointerGetMotionEvents, - PtrDeviceControl, + (PtrCtrlProcPtr)PtrDeviceControl, miPointerGetMotionBufferSize()); break; @@ -716,7 +717,7 @@ LegalModifier(key, pDev) void -ProcessInputEvents() +ProcessInputEvents(void) { rfbCheckFds(); httpCheckFds(); @@ -808,12 +809,19 @@ rfbBitsPerPixel(depth) static Bool -rfbAlwaysTrue() +rfbSaveAlwaysTrue(ScreenPtr _pScreen, int _on) { return TRUE; } +static Bool +rfbCursorAlwaysTrue(ScreenPtr _pScreen, CursorPtr _pCursor) +{ + return TRUE; +} + + static char * rfbAllocateFramebufferMemory(prfb) rfbScreenInfoPtr prfb; @@ -853,7 +861,7 @@ rfbClientStateChange(cbl, myData, clt) } void -ddxGiveUp() +ddxGiveUp(void) { Xfree(rfbScreen.pfbMemory); if (initOutputCalled) { @@ -867,24 +875,24 @@ ddxGiveUp() } void -AbortDDX() +AbortDDX(void) { ddxGiveUp(); } void -OsVendorInit() +OsVendorInit(void) { } void -OsVendorFatalError() +OsVendorFatalError(void) { } #ifdef DDXTIME /* from ServerOSDefines */ CARD32 -GetTimeInMillis() +GetTimeInMillis(void) { struct timeval tp; @@ -894,7 +902,7 @@ GetTimeInMillis() #endif void -ddxUseMsg() +ddxUseMsg(void) { ErrorF("-geometry WxH set framebuffer width & height\n"); ErrorF("-depth D set framebuffer depth\n"); @@ -943,7 +951,7 @@ void rfbLog(char *format, ...) time(&clock); strftime(buf, 255, "%d/%m/%y %T ", localtime(&clock)); - fprintf(stderr, buf); + fprintf(stderr, "%s", buf); vfprintf(stderr, format, args); fflush(stderr); --- Xvnc/programs/Xserver/hw/vnc/rfb.h.orig 2006-12-23 12:07:55 UTC +++ Xvnc/programs/Xserver/hw/vnc/rfb.h @@ -384,10 +384,10 @@ extern Bool udpSockConnected; extern int rfbPort; extern int rfbListenSock; -extern void rfbInitSockets(); -extern void rfbDisconnectUDPSock(); -extern void rfbCloseSock(); -extern void rfbCheckFds(); +extern void rfbInitSockets(void); +extern void rfbDisconnectUDPSock(void); +extern void rfbCloseSock(int sock); +extern void rfbCheckFds(void); extern void rfbWaitForClient(int sock); extern int rfbConnect(char *host, int port); @@ -433,17 +433,17 @@ extern void rfbGotXCutText(char *str, int len); extern Bool compatibleKbd; extern unsigned char ptrAcceleration; -extern void PtrDeviceInit(); -extern void PtrDeviceOn(); -extern void PtrDeviceOff(); -extern void PtrDeviceControl(); +extern void PtrDeviceInit(void); +extern void PtrDeviceOn(DeviceIntPtr pDev); +extern void PtrDeviceOff(void); +extern void PtrDeviceControl(DevicePtr dev, PtrCtrl *ctrl); extern void PtrAddEvent(int buttonMask, int x, int y, rfbClientPtr cl); -extern void KbdDeviceInit(); -extern void KbdDeviceOn(); -extern void KbdDeviceOff(); +extern void KbdDeviceInit(DeviceIntPtr pDevice, KeySymsPtr pKeySyms, CARD8 *pModMap); +extern void KbdDeviceOn(void); +extern void KbdDeviceOff(void); extern void KbdAddEvent(Bool down, KeySym keySym, rfbClientPtr cl); -extern void KbdReleaseAllKeys(); +extern void KbdReleaseAllKeys(void); /* rfbserver.c */ @@ -477,7 +477,7 @@ extern Bool rfbSendRectEncodingRaw(rfbClientPtr cl, in extern Bool rfbSendUpdateBuf(rfbClientPtr cl); extern Bool rfbSendSetColourMapEntries(rfbClientPtr cl, int firstColour, int nColours); -extern void rfbSendBell(); +extern void rfbSendBell(void); extern void rfbSendServerCutText(char *str, int len); @@ -502,8 +502,8 @@ extern Bool rfbSetClientColourMap(rfbClientPtr cl, int extern int httpPort; extern char *httpDir; -extern void httpInitSockets(); -extern void httpCheckFds(); +extern void httpInitSockets(void); +extern void httpCheckFds(void); --- Xvnc/programs/Xserver/hw/vnc/rfbserver.c.orig 2006-11-28 12:22:07 UTC +++ Xvnc/programs/Xserver/hw/vnc/rfbserver.c @@ -43,6 +43,9 @@ #include #endif +/* PRIu32 */ +#include + char updateBuf[UPDATE_BUF_SIZE]; int ublen; @@ -889,8 +892,37 @@ rfbProcessClientNormalMessage(cl) msg.cct.length = Swap32IfLE(msg.cct.length); - str = (char *)xalloc(msg.cct.length); + /* CVE-2014-6053 +Check malloc() return value on client->server ClientCutText + message. Client can send up to 2**32-1 bytes of text, and such a large + allocation is likely to fail in case of high memory pressure. This would in a + server crash (write at address 0). + */ + if (str == NULL) { + rfbLogPerror("rfbProcessClientNormalMessage: not enough memory"); + rfbCloseSock(cl->sock); + return; + } + /* CVE-2018-7225 */ + /* uint32_t input is passed to malloc()'s size_t argument, + * to rfbReadExact()'s int argument, to rfbStatRecordMessageRcvd()'s int + * argument increased of sz_rfbClientCutTextMsg, and to setXCutText()'s int + * argument. Here we impose a limit of 1 MB so that the value fits + * into all of the types to prevent from misinterpretation and thus + * from accessing uninitialized memory (CVE-2018-7225) and also to + * prevent from a denial-of-service by allocating to much memory in + * the server. */ + if (msg.cct.length > 1<<20) { + rfbLog("rfbClientCutText: too big cut text length requested: %" PRIu32 "\n", + msg.cct.length); + rfbCloseSock(cl->sock); + return; + } + + /* Allow zero-length client cut text. */ + str = (char *)calloc(msg.cct.length ? msg.cct.length : 1, 1); + if ((n = ReadExact(cl->sock, str, msg.cct.length)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); @@ -1480,6 +1512,9 @@ rfbSendServerCutText(char *str, int len) { rfbClientPtr cl, nextCl; rfbServerCutTextMsg sct; + + /* CVE-2019-15681 don't leak stack memory to the remote */ + memset((char *)&sct, 0, sizeof(sct)); if (rfbViewOnly) return; --- Xvnc/programs/Xserver/hw/vnc/rre.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/hw/vnc/rre.c @@ -25,6 +25,7 @@ */ #include +#include #include "rfb.h" /* --- Xvnc/programs/Xserver/hw/vnc/sockets.c.orig 2006-12-23 12:07:55 UTC +++ Xvnc/programs/Xserver/hw/vnc/sockets.c @@ -38,6 +38,7 @@ */ #include +#include #include #include #include --- Xvnc/programs/Xserver/hw/vnc/translate.c.orig 2000-10-25 21:24:07 UTC +++ Xvnc/programs/Xserver/hw/vnc/translate.c @@ -22,6 +22,7 @@ */ #include +#include #include "rfb.h" static void PrintPixelFormat(rfbPixelFormat *pf); --- Xvnc/programs/Xserver/hw/xfree86/common/compiler.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/hw/xfree86/common/compiler.h @@ -265,7 +265,7 @@ static __inline__ void stw_u(unsigned long r5, unsigne #else /* defined(linux) && defined(__alpha__) */ #if defined(__mips__) -unsigned int IOPortBase; /* Memory mapped I/O port area */ +unsigned int IOPortBase __attribute__((common)); /* Memory mapped I/O port area */ static __inline__ void outb(port, val) @@ -371,7 +371,7 @@ static __inline__ unsigned long ldw_u(unsigned short * #define mem_barrier() /* NOP */ #define write_mem_barrier() /* NOP */ -#if !defined(FAKEIT) && !defined(__mc68000__) +#if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__powerpc__) && !defined(__riscv) #ifdef GCCUSESGAS /* --- Xvnc/programs/Xserver/include/dix.h.orig 2006-12-23 12:07:55 UTC +++ Xvnc/programs/Xserver/include/dix.h @@ -479,7 +479,6 @@ extern ClientPtr LookupClient( ); extern void NoopDDA( -#undef NeedVarargsPrototypes #if NeedVarargsPrototypes void *, ... --- Xvnc/programs/Xserver/include/dixstruct.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/include/dixstruct.h @@ -226,7 +226,7 @@ extern int (*k5_Vector[256])() = ); #endif -extern void (* ReplySwapVector[256]) (); +extern void (* ReplySwapVector[256]) (ClientPtr, int, void *); extern int ProcBadRequest( #if NeedFunctionPrototypes --- Xvnc/programs/Xserver/include/misc.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/include/misc.h @@ -158,16 +158,10 @@ typedef struct _xReq *xReqPtr; #define min(a, b) (((a) < (b)) ? (a) : (b)) #define max(a, b) (((a) > (b)) ? (a) : (b)) -#if !defined(AMOEBA) && !defined(__EMX__) -#ifndef abs -#define abs(a) ((a) > 0 ? (a) : -(a)) -#endif -#else /* AMOEBA || __EMX__ */ /* abs() is a function, not a macro; include the file declaring * it in case we haven't done that yet. */ #include -#endif /* AMOEBA */ #ifndef Fabs #define Fabs(a) ((a) > 0.0 ? (a) : -(a)) /* floating absolute value */ #endif --- Xvnc/programs/Xserver/include/servermd.h.orig 2006-12-23 12:07:55 UTC +++ Xvnc/programs/Xserver/include/servermd.h @@ -405,10 +405,52 @@ SOFTWARE. #endif /* linux/m68k */ +#if defined (linux) && defined(__aarch64__) +# define BITMAP_SCANLINE_UNIT 64 +# define BITMAP_SCANLINE_PAD 64 +# define LOG2_BITMAP_PAD 6 +# define LOG2_BYTES_PER_SCANLINE_PAD 3 + +/* Add for handling protocol XPutImage and XGetImage; see comment in + * Alpha section. + */ +#define INTERNAL_VS_EXTERNAL_PADDING +#define BITMAP_SCANLINE_UNIT_PROTO 32 + +#define BITMAP_SCANLINE_PAD_PROTO 32 +#define LOG2_BITMAP_PAD_PROTO 5 +#define LOG2_BYTES_PER_SCANLINE_PAD_PROTO 2 +#define GLYPHPADBYTES 4 +#define GETLEFTBITS_ALIGNMENT 1 + +#endif /* linux/aarch64 */ + #if defined (linux) && defined(__powerpc__) +#ifdef __powerpc64__ +# define BITMAP_SCANLINE_UNIT 64 +# define BITMAP_SCANLINE_PAD 64 +# define LOG2_BITMAP_PAD 6 +# define LOG2_BYTES_PER_SCANLINE_PAD 3 + +/* Add for handling protocol XPutImage and XGetImage; see comment in + * Alpha section. + */ +#define INTERNAL_VS_EXTERNAL_PADDING +#define BITMAP_SCANLINE_UNIT_PROTO 32 + +#define BITMAP_SCANLINE_PAD_PROTO 32 +#define LOG2_BITMAP_PAD_PROTO 5 +#define LOG2_BYTES_PER_SCANLINE_PAD_PROTO 2 +#endif /* linux/ppc64 */ +#if defined(__LITTLE_ENDIAN__) +#define IMAGE_BYTE_ORDER LSBFirst +#define BITMAP_BIT_ORDER LSBFirst +#else #define IMAGE_BYTE_ORDER MSBFirst #define BITMAP_BIT_ORDER MSBFirst +#endif + #define GLYPHPADBYTES 4 #define GETLEFTBITS_ALIGNMENT 1 @@ -421,6 +463,20 @@ SOFTWARE. #endif /* Linux/PPC */ +#if defined (linux) && defined(__sparc__) + +#define IMAGE_BYTE_ORDER MSBFirst +#define BITMAP_BIT_ORDER MSBFirst +#define GLYPHPADBYTES 4 +#define GETLEFTBITS_ALIGNMENT 1 + +#define AVOID_MEMORY_READ +#define LARGE_INSTRUCTION_CACHE +#define FAST_CONSTANT_OFFSET_MODE +#define SHARED_IDCACHE + +#endif /* Linux/sparc */ + #if defined(__MACH__) && defined(__POWERPC__) #define IMAGE_BYTE_ORDER MSBFirst @@ -500,6 +556,14 @@ SOFTWARE. #define LOG2_BITMAP_PAD 5 #define LOG2_BYTES_PER_SCANLINE_PAD 2 #endif + +/* + * Make sure GLYPHPADBYTES and GETLEFTBITS_ALIGNMENT are always defined + */ +#undef GLYPHPADBYTES +#define GLYPHPADBYTES 4 +#undef GETLEFTBITS_ALIGNMENT +#define GETLEFTBITS_ALIGNMENT 1 /* * This returns the number of padding units, for depth d and width w. --- Xvnc/programs/Xserver/mi/miarc.c.orig 2003-02-19 16:39:54 UTC +++ Xvnc/programs/Xserver/mi/miarc.c @@ -70,7 +70,10 @@ SOFTWARE. #include "mifillarc.h" #include "Xfuncproto.h" -static double miDsin(), miDcos(), miDasin(), miDatan2(); +static double miDsin(double a); +static double miDcos(double a); +static double miDasin(double v); +static double miDatan2(double dy, double dx); double cbrt( #if NeedFunctionPrototypes double @@ -245,12 +248,16 @@ typedef struct _miPolyArc { GCLineWidth | GCCapStyle | GCJoinStyle) static CARD32 gcvals[6]; -static void fillSpans(), newFinalSpan(); -static void drawArc(), drawQuadrant(), drawZeroArc(); -static void miArcJoin(), miArcCap(), miRoundCap(), miFreeArcs(); -static int computeAngleFromPath(); -static miPolyArcPtr miComputeArcs (); -static int miGetArcPts(); +static void fillSpans(DrawablePtr pDrawable, GCPtr pGC); +static void newFinalSpan(int y, register int xmin, register int xmax); +static void drawArc(xArc *tarc, int l, int a0, int a1, miArcFacePtr right, miArcFacePtr left); +static void drawZeroArc(DrawablePtr pDraw, GCPtr pGC, xArc *tarc, int lw, miArcFacePtr right, miArcFacePtr left); +static void miArcJoin(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pLeft, miArcFacePtr pRight, int xOrgLeft, int yOrgLeft, double xFtransLeft, double yFtransLeft, int xOrgRight, int yOrgRight, double xFtransRight, double yFtransRight); +static void miArcCap(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pFace, int end, int xOrg, int yOrg, double xFtrans, double yFtrans); +static void miRoundCap(DrawablePtr pDraw, GCPtr pGC, SppPointRec pCenter, SppPointRec pEnd, SppPointRec pCorner, SppPointRec pOtherCorner, int fLineEnd, int xOrg, int yOrg, double xFtrans, double yFtrans); +static void miFreeArcs(miPolyArcPtr arcs, GCPtr pGC); +static miPolyArcPtr miComputeArcs(xArc *parcs, int narcs, GCPtr pGC); +static int miGetArcPts(SppArcPtr parc, int cpt, SppPointPtr *ppPts); # define CUBED_ROOT_2 1.2599210498948732038115849718451499938964 # define CUBED_ROOT_4 1.5874010519681993173435330390930175781250 @@ -398,6 +405,8 @@ typedef struct { miArcSpanData *spdata; } arcCacheRec; +static void drawQuadrant(struct arc_def *def, struct accelerators *acc, int a0, int a1, int mask, miArcFacePtr right, miArcFacePtr left, miArcSpanData *spdata); + #define CACHESIZE 25 static arcCacheRec arcCache[CACHESIZE]; @@ -1493,7 +1502,6 @@ miRoundCap(pDraw, pGC, pCenter, pEnd, pCorner, pOtherC { int cpt; double width; - double miDatan2 (); SppArcRec arc; SppPointPtr pArcPts; @@ -1840,6 +1848,8 @@ typedef struct { double map[DASH_MAP_SIZE]; } dashMap; +static int computeAngleFromPath(int startAngle, int endAngle, dashMap *map, int *lenp, int backwards); + static void computeDashMap (arcp, map) xArc *arcp; @@ -3099,7 +3109,7 @@ struct finalSpanChunk { static struct finalSpanChunk *chunks; struct finalSpan * -realAllocSpan () +realAllocSpan (void) { register struct finalSpanChunk *newChunk; register struct finalSpan *span; @@ -3122,7 +3132,7 @@ realAllocSpan () } static void -disposeFinalSpans () +disposeFinalSpans (void) { struct finalSpanChunk *chunk, *next; --- Xvnc/programs/Xserver/mi/mibstore.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/mi/mibstore.c @@ -137,12 +137,13 @@ implied warranty. (pGC)->funcs = oldFuncs; \ } -static void miCreateBSPixmap(); -static void miDestroyBSPixmap(); -static void miTileVirtualBS(); -static void miBSAllocate(), miBSFree(); -static Bool miBSCreateGCPrivate (); -static void miBSClearBackingRegion (); +static void miCreateBSPixmap(WindowPtr pWin, BoxPtr pExtents); +static void miDestroyBSPixmap(WindowPtr pWin); +static void miTileVirtualBS(WindowPtr pWin); +static void miBSAllocate(WindowPtr pWin); +static void miBSFree(WindowPtr pWin); +static Bool miBSCreateGCPrivate(GCPtr pGC); +static void miBSClearBackingRegion(WindowPtr pWin, RegionPtr pRgn); #define MoreCopy0 ; #define MoreCopy2 *dstCopy++ = *srcCopy++; *dstCopy++ = *srcCopy++; @@ -182,22 +183,23 @@ else \ static int miBSScreenIndex; static unsigned long miBSGeneration = 0; -static Bool miBSCloseScreen(); -static void miBSGetImage(); -static void miBSGetSpans(); -static Bool miBSChangeWindowAttributes(); -static Bool miBSCreateGC(); -static Bool miBSDestroyWindow(); +static Bool miBSCloseScreen(int i, ScreenPtr pScreen); +static void miBSGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, unsigned int format, unsigned long planemask, char *pdstLine); +static void miBSGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart); +static Bool miBSChangeWindowAttributes(WindowPtr pWin, unsigned long mask); +static Bool miBSCreateGC(GCPtr pGC); +static Bool miBSDestroyWindow(WindowPtr pWin); /* * backing store screen functions */ -static void miBSSaveDoomedAreas(); -static RegionPtr miBSRestoreAreas(); -static void miBSExposeCopy(); -static RegionPtr miBSTranslateBackingStore(), miBSClearBackingStore(); -static void miBSDrawGuarantee(); +static void miBSSaveDoomedAreas(register WindowPtr pWin, RegionPtr pObscured, int dx, int dy); +static RegionPtr miBSRestoreAreas(register WindowPtr pWin, RegionPtr prgnExposed); +static void miBSExposeCopy(WindowPtr pSrc, DrawablePtr pDst, GCPtr pGC, RegionPtr prgnExposed, int srcx, int srcy, int dstx, int dsty, unsigned long plane); +static RegionPtr miBSTranslateBackingStore(WindowPtr pWin, int windx, int windy, RegionPtr oldClip, int oldx, int oldy); +static RegionPtr miBSClearBackingStore(WindowPtr pWin, int x, int y, int w, int h, Bool generateExposures); +static void miBSDrawGuarantee(WindowPtr pWin, GCPtr pGC, int guarantee); /* * wrapper vectors for GC funcs and ops @@ -205,9 +207,13 @@ static void miBSDrawGuarantee(); static int miBSGCIndex; -static void miBSValidateGC (), miBSCopyGC (), miBSDestroyGC(); -static void miBSChangeGC(); -static void miBSChangeClip(), miBSDestroyClip(), miBSCopyClip(); +static void miBSValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable); +static void miBSCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); +static void miBSDestroyGC(GCPtr pGC); +static void miBSChangeGC(GCPtr pGC, unsigned long mask); +static void miBSChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects); +static void miBSDestroyClip(GCPtr pGC); +static void miBSCopyClip(GCPtr pgcDst, GCPtr pgcSrc); static GCFuncs miBSGCFuncs = { miBSValidateGC, @@ -219,17 +225,28 @@ static GCFuncs miBSGCFuncs = { miBSCopyClip, }; -static void miBSFillSpans(), miBSSetSpans(), miBSPutImage(); -static RegionPtr miBSCopyArea(), miBSCopyPlane(); -static void miBSPolyPoint(), miBSPolylines(), miBSPolySegment(); -static void miBSPolyRectangle(),miBSPolyArc(), miBSFillPolygon(); -static void miBSPolyFillRect(), miBSPolyFillArc(); -static int miBSPolyText8(), miBSPolyText16(); -static void miBSImageText8(), miBSImageText16(); -static void miBSImageGlyphBlt(),miBSPolyGlyphBlt(); -static void miBSPushPixels(); +static void miBSFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted); +static void miBSSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *psrc, register DDXPointPtr ppt, int *pwidth, int nspans, int fSorted); +static void miBSPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pBits); +static RegionPtr miBSCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty); +static RegionPtr miBSCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, register GC *pGC, int srcx, int srcy, int w, int h, int dstx, int dsty, unsigned long plane); +static void miBSPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, xPoint *pptInit); +static void miBSPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit); +static void miBSPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs); +static void miBSPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, xRectangle *pRects); +static void miBSPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs); +static void miBSFillPolygon(DrawablePtr pDrawable, register GCPtr pGC, int shape, int mode, register int count, DDXPointPtr pPts); +static void miBSPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *prectInit); +static void miBSPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs); +static int miBSPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars); +static int miBSPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars); +static void miBSImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars); +static void miBSImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars); +static void miBSImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase); +static void miBSPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase); +static void miBSPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, int w, int h, int x, int y); #ifdef NEED_LINEHELPER -static void miBSLineHelper(); +static void miBSLineHelper(void); #endif static GCOps miBSGCOps = { @@ -260,10 +277,13 @@ static GCOps miBSGCOps = { * store enabled */ -static void miBSCheapValidateGC(), miBSCheapCopyGC(), miBSCheapDestroyGC(); -static void miBSCheapChangeGC (); -static void miBSCheapChangeClip(), miBSCheapDestroyClip(); -static void miBSCheapCopyClip(); +static void miBSCheapValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable); +static void miBSCheapCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); +static void miBSCheapDestroyGC(GCPtr pGC); +static void miBSCheapChangeGC(GCPtr pGC, unsigned long mask); +static void miBSCheapChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects); +static void miBSCheapDestroyClip(GCPtr pGC); +static void miBSCheapCopyClip(GCPtr pgcDst, GCPtr pgcSrc); static GCFuncs miBSCheapGCFuncs = { miBSCheapValidateGC, @@ -369,7 +389,7 @@ miBSCloseScreen (i, pScreen) return (*pScreen->CloseScreen) (i, pScreen); } -static void miBSFillVirtualBits(); +static void miBSFillVirtualBits(DrawablePtr pDrawable, GCPtr pGC, RegionPtr pRgn, int x, int y, int state, PixUnion pixunion, unsigned long planeMask); static void miBSGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine) @@ -2170,7 +2190,7 @@ miBSPushPixels(pGC, pBitMap, pDst, w, h, x, y) *----------------------------------------------------------------------- */ static void -miBSLineHelper() +miBSLineHelper(void) { FatalError("miBSLineHelper called\n"); } --- Xvnc/programs/Xserver/mi/midash.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/mi/midash.c @@ -50,7 +50,7 @@ SOFTWARE. #include "mistruct.h" #include "mifpoly.h" -static miDashPtr CheckDashStorage(); +static miDashPtr CheckDashStorage(miDashPtr *ppseg, int nseg, int *pnsegMax); /* return a list of DashRec. there will be an extra entry at the end holding the last point of the polyline. --- Xvnc/programs/Xserver/mi/mieq.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/mi/mieq.c @@ -140,7 +140,8 @@ mieqSwitchScreen (pScreen, fromDIX) * Call this from ProcessInputEvents() */ -mieqProcessInputEvents () +int +mieqProcessInputEvents(void) { EventRec *e; int x, y; @@ -189,4 +190,5 @@ mieqProcessInputEvents () } } } + return 0; } --- Xvnc/programs/Xserver/mi/mifpolycon.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/mi/mifpolycon.c @@ -53,7 +53,7 @@ SOFTWARE. #include "pixmapstr.h" #include "mifpoly.h" -static int GetFPolyYBounds(); +static int GetFPolyYBounds(register SppPointPtr pts, int n, double yFtrans, int *by, int *ty); #ifdef ICEILTEMPDECL ICEILTEMPDECL --- Xvnc/programs/Xserver/mi/mipolycon.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/mi/mipolycon.c @@ -50,7 +50,7 @@ SOFTWARE. #include "pixmap.h" #include "miscanfill.h" -static int getPolyYBounds(); +static int getPolyYBounds(DDXPointPtr pts, int n, int *by, int *ty); /* * convexpoly.c --- Xvnc/programs/Xserver/mi/miregion.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/mi/miregion.c @@ -579,7 +579,7 @@ miAppendNonO (pReg, r, rEnd, y1, y2) #define AppendRegions(newReg, r, rEnd) \ { \ int newRects; \ - if (newRects = rEnd - r) { \ + if ((newRects = rEnd - r)) { \ RECTALLOC(newReg, newRects); \ memmove((char *)REGION_TOP(newReg),(char *)r, \ newRects * sizeof(BoxRec)); \ @@ -620,8 +620,8 @@ miRegionOp(newReg, reg1, reg2, overlapFunc, appendNon1 RegionPtr newReg; /* Place to store result */ RegionPtr reg1; /* First region in operation */ RegionPtr reg2; /* 2d region in operation */ - Bool (*overlapFunc)(); /* Function to call for over- - * lapping bands */ + /* Function to call for overlapping bands */ + Bool (*overlapFunc)(register RegionPtr, register BoxPtr, BoxPtr, register BoxPtr, BoxPtr, short, short, Bool *); Bool appendNon1; /* Append non-overlapping bands */ /* in region 1 ? */ Bool appendNon2; /* Append non-overlapping bands */ @@ -903,15 +903,15 @@ miSetExtents (pReg) */ /*ARGSUSED*/ static Bool -miIntersectO (pReg, r1, r1End, r2, r2End, y1, y2, pOverlap) - register RegionPtr pReg; - register BoxPtr r1; - BoxPtr r1End; - register BoxPtr r2; - BoxPtr r2End; - short y1; - short y2; - Bool *pOverlap; +miIntersectO( + register RegionPtr pReg, + register BoxPtr r1, + BoxPtr r1End, + register BoxPtr r2, + BoxPtr r2End, + short y1, + short y2, + Bool *pOverlap) { register int x1; register int x2; @@ -1040,15 +1040,15 @@ miIntersect(newReg, reg1, reg2) *----------------------------------------------------------------------- */ static Bool -miUnionO (pReg, r1, r1End, r2, r2End, y1, y2, pOverlap) - register RegionPtr pReg; - register BoxPtr r1; - BoxPtr r1End; - register BoxPtr r2; - BoxPtr r2End; - short y1; - short y2; - Bool *pOverlap; +miUnionO( + register RegionPtr pReg, + register BoxPtr r1, + BoxPtr r1End, + register BoxPtr r2, + BoxPtr r2End, + short y1, + short y2, + Bool *pOverlap) { register BoxPtr pNextRect; register int x1; /* left and right side of current union */ @@ -1654,15 +1654,15 @@ miRectsToRegion(nrects, prect, ctype) */ /*ARGSUSED*/ static Bool -miSubtractO (pReg, r1, r1End, r2, r2End, y1, y2, pOverlap) - register RegionPtr pReg; - register BoxPtr r1; - BoxPtr r1End; - register BoxPtr r2; - BoxPtr r2End; - register int y1; - int y2; - Bool *pOverlap; +miSubtractO( + register RegionPtr pReg, + register BoxPtr r1, + BoxPtr r1End, + register BoxPtr r2, + BoxPtr r2End, + short y1, + short y2, + Bool *pOverlap) { register BoxPtr pNextRect; register int x1; @@ -2326,7 +2326,7 @@ miClipSpans(prgnDst, ppt, pwidth, nspans, pptNew, pwid } /* end for */ } - else if (numRects = prgnDst->data->numRects) + else if ((numRects = prgnDst->data->numRects)) { /* Have to clip against many boxes */ BoxPtr pboxBandStart, pboxBandEnd; --- Xvnc/programs/Xserver/mi/miwideline.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/mi/miwideline.c @@ -56,7 +56,7 @@ from the X Consortium. ICEILTEMPDECL #endif -static void miLineArc(); +static void miLineArc(DrawablePtr pDraw, register GCPtr pGC, unsigned long pixel, SpanDataPtr spanData, register LineFacePtr leftFace, register LineFacePtr rightFace, double xorg, double yorg, Bool isInt); /* * spans-based polygon filler @@ -2196,11 +2196,11 @@ miWideDash (pDrawable, pGC, mode, npt, pPts) /* these are stubs to allow old ddx ValidateGCs to work without change */ void -miMiter() +miMiter(void) { } void -miNotMiter() +miNotMiter(void) { } --- Xvnc/programs/Xserver/mi/miwindow.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/mi/miwindow.c @@ -363,7 +363,7 @@ miMarkOverlappedWindows(pWin, pFirst, ppLayerWin) register BoxPtr box; register WindowPtr pChild, pLast; Bool anyMarked = FALSE; - void (* MarkWindow)() = pWin->drawable.pScreen->MarkWindow; + void (* MarkWindow)(register WindowPtr) = pWin->drawable.pScreen->MarkWindow; ScreenPtr pScreen = pWin->drawable.pScreen; /* single layered systems are easy */ @@ -438,7 +438,7 @@ miHandleValidateExposures(pWin) register WindowPtr pChild; register ValidatePtr val; ScreenPtr pScreen = pWin->drawable.pScreen; - void (* WindowExposures)(); + void (* WindowExposures)(WindowPtr, RegionPtr, RegionPtr); pChild = pWin; WindowExposures = pChild->drawable.pScreen->WindowExposures; --- Xvnc/programs/Xserver/os/Imakefile.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/os/Imakefile @@ -135,7 +135,7 @@ SpecialCObjectRule(xalloc,$(ICONFIGFILES),NullParamete #if defined(SparcArchitecture) && HasGcc && !HasGcc2 oscolor.o: oscolor.c $(ICONFIGFILES) $(RM) $@ - cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c + $(CC) -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c #else SpecialCObjectRule(oscolor,$(ICONFIGFILES),$(DBM_DEFINES)) #endif --- Xvnc/programs/Xserver/os/WaitFor.c.orig 2009-03-05 06:38:33 UTC +++ Xvnc/programs/Xserver/os/WaitFor.c @@ -119,7 +119,7 @@ struct _OsTimerRec { pointer arg; }; -static void DoTimer(); +static void DoTimer(register OsTimerPtr timer, CARD32 now, OsTimerPtr *prev); static OsTimerPtr timers; /***************** @@ -348,6 +348,7 @@ WaitForSomething(pClientsReady) return 0; FD_ZERO(&clientsWritable); if (i < 0) + { if (selecterr == EBADF) /* Some client disconnected */ { CheckConnections (); @@ -364,6 +365,7 @@ WaitForSomething(pClientsReady) ErrorF("WaitForSomething(): select: errno=%d\n", selecterr); } + } if (timers) { now = GetTimeInMillis(); @@ -767,7 +769,7 @@ TimerFree(timer) } void -TimerCheck() +TimerCheck(void) { register CARD32 now = GetTimeInMillis(); @@ -776,11 +778,11 @@ TimerCheck() } void -TimerInit() +TimerInit(void) { OsTimerPtr timer; - while (timer = timers) + while ((timer = timers)) { timers = timer->next; xfree(timer); --- Xvnc/programs/Xserver/os/access.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/os/access.c @@ -245,7 +245,7 @@ static int UsingXdmcp = FALSE; */ void -EnableLocalHost () +EnableLocalHost (void) { if (!UsingXdmcp) { @@ -258,7 +258,7 @@ EnableLocalHost () * called when authorization is enabled to keep us secure */ void -DisableLocalHost () +DisableLocalHost (void) { HOST *self; @@ -273,7 +273,7 @@ DisableLocalHost () */ void -AccessUsingXdmcp () +AccessUsingXdmcp (void) { UsingXdmcp = TRUE; LocalHostEnabled = FALSE; @@ -634,7 +634,7 @@ DefineSelf (fd) #endif ifc.ifc_len = sizeof (buf); ifc.ifc_buf = buf; - if (ifioctl (fd, (int) SIOCGIFCONF, (pointer) &ifc) < 0) + if (ifioctl (fd, SIOCGIFCONF, (pointer) &ifc) < 0) Error ("Getting interface configuration (4)"); #ifdef ISC @@ -783,7 +783,7 @@ AugmentSelf(from, len) #endif void -AddLocalHosts () +AddLocalHosts (void) { HOST *self; @@ -830,7 +830,7 @@ ResetHosts (display) AccessEnabled = defeatAccessControl ? FALSE : DEFAULT_ACCESS_CONTROL; LocalHostEnabled = FALSE; - while (host = validhosts) + while ((host = validhosts)) { validhosts = host->next; FreeHost (host); @@ -851,13 +851,13 @@ ResetHosts (display) strcpy(fname, (char*)__XOS2RedirRoot(fname)); #endif /* __EMX__ */ - if (fd = fopen (fname, "r")) + if ((fd = fopen (fname, "r"))) { while (fgets (ohostname, sizeof (ohostname), fd)) { if (*ohostname == '#') continue; - if (ptr = strchr(ohostname, '\n')) + if ((ptr = strchr(ohostname, '\n'))) *ptr = 0; #ifdef __EMX__ if (ptr = strchr(ohostname, '\r')) @@ -1391,7 +1391,7 @@ ChangeAccessControl(client, fEnabled) /* returns FALSE if xhost + in effect, else TRUE */ int -GetAccessControl() +GetAccessControl(void) { return AccessEnabled; } --- Xvnc/programs/Xserver/os/auth.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/os/auth.c @@ -54,30 +54,38 @@ from the X Consortium. struct protocol { unsigned short name_length; char *name; - int (*Add)(); /* new authorization data */ - XID (*Check)(); /* verify client authorization data */ - int (*Reset)(); /* delete all authorization data entries */ - XID (*ToID)(); /* convert cookie to ID */ - int (*FromID)(); /* convert ID to cookie */ - int (*Remove)(); /* remove a specific cookie */ + /* new authorization data */ + int (*Add)(unsigned short, char *, XID); + /* verify client authorization data */ + XID (*Check)(unsigned short, char *, ClientPtr, char **); + /* delete all authorization data entries */ + int (*Reset)(void); + /* convert cookie to ID */ + XID (*ToID)(unsigned short, char *); + /* convert ID to cookie */ + int (*FromID)(XID, unsigned short *, char **); + /* remove a specific cookie */ + int (*Remove)(unsigned short, char *); #ifdef XCSECURITY - XID (*Generate)(); + XID (*Generate)(unsigned int, char *, XID, *data_length_return, char **data_return); #endif }; -extern int MitAddCookie (); -extern XID MitCheckCookie (); -extern int MitResetCookie (); -extern XID MitToID (); -extern int MitFromID (), MitRemoveCookie (); -extern XID MitGenerateCookie(); +extern int MitAddCookie(unsigned short data_length, char *data, XID id); +extern XID MitCheckCookie(unsigned short data_length, char *data, ClientPtr client, char **reason); +extern int MitResetCookie(void); +extern XID MitToID(unsigned short data_length, char *data); +extern int MitFromID(XID id, unsigned short *data_lenp, char **datap); +extern int MitRemoveCookie(unsigned short data_length, char *data); +extern XID MitGenerateCookie(unsigned int data_length, char *data, XID id, unsigned int *data_length_return, char **data_return); #ifdef HASXDMAUTH -extern int XdmAddCookie (); -extern XID XdmCheckCookie (); -extern int XdmResetCookie (); -extern XID XdmToID (); -extern int XdmFromID (), XdmRemoveCookie (); +extern int XdmAddCookie(unsigned short data_length, char *data, XID id); +extern XID XdmCheckCookie(unsigned short data_length, char *data, ClientPtr client, char **reason); +extern int XdmResetCookie(void); +extern XID XdmToID(unsigned short data_length, char *data); +extern int XdmFromID(XID id, unsigned short *data_lenp, char **datap); +extern int XdmRemoveCookie(unsigned short data_length, char *data); #endif #ifdef SECURE_RPC @@ -85,7 +93,8 @@ extern int SecureRPCAdd(); extern XID SecureRPCCheck(); extern int SecureRPCReset(); extern XID SecureRPCToID(); -extern int SecureRPCFromID(), SecureRPCRemove(); +extern int SecureRPCFromID(), +extern int SecureRPCRemove(); #endif #ifdef K5AUTH @@ -96,7 +105,7 @@ extern XID K5ToID(); extern int K5FromID(), K5Remove(); #endif -extern XID AuthSecurityCheck(); +extern XID AuthSecurityCheck(unsigned short data_length, char *data, ClientPtr client, char **reason); static struct protocol protocols[] = { { (unsigned short) 18, "MIT-MAGIC-COOKIE-1", @@ -163,7 +172,7 @@ char *file_name; } int -LoadAuthorization () +LoadAuthorization (void) { FILE *f; Xauth *auth; @@ -176,7 +185,7 @@ LoadAuthorization () f = fopen (authorization_file, "r"); if (!f) return 0; - while (auth = XauReadAuth (f)) { + while ((auth = XauReadAuth (f))) { for (i = 0; i < NUM_AUTHORIZATION; i++) { if (protocols[i].name_length == auth->name_length && memcmp (protocols[i].name, auth->name, (int) auth->name_length) == 0 && @@ -199,7 +208,7 @@ LoadAuthorization () * schemes supported by the display */ void -RegisterAuthorizations () +RegisterAuthorizations (void) { int i; @@ -251,7 +260,7 @@ CheckAuthorization (name_length, name, data_length, da } void -ResetAuthorization () +ResetAuthorization (void) { int i; @@ -375,7 +384,7 @@ char **data_return; static unsigned long int next = 1; static int -xdm_rand() +xdm_rand(void) { next = next * 1103515245 + 12345; return (unsigned int)(next/65536) % 32768; --- Xvnc/programs/Xserver/os/connection.c.orig 2009-03-05 06:38:33 UTC +++ Xvnc/programs/Xserver/os/connection.c @@ -67,6 +67,7 @@ SOFTWARE. #ifdef WIN32 #include #endif +#include #include "X.h" #include "Xproto.h" #include @@ -262,9 +263,6 @@ lookup_trans_conn (fd) return (NULL); } -#ifdef XDMCP -void XdmcpOpenDisplay(), XdmcpInit(), XdmcpReset(), XdmcpCloseDisplay(); -#endif /***************** * CreateWellKnownSockets @@ -272,7 +270,7 @@ void XdmcpOpenDisplay(), XdmcpInit(), XdmcpReset(), Xd *****************/ void -CreateWellKnownSockets() +CreateWellKnownSockets(void) { int request, i; int partial; @@ -390,7 +388,7 @@ CreateWellKnownSockets() } void -ResetWellKnownSockets () +ResetWellKnownSockets (void) { int i; @@ -612,10 +610,12 @@ ClientAuthorized(client, proto_n, auth_proto, string_n } if (auth_id == (XID) ~0L) + { if (reason) return reason; else return "Client is not authorized to connect to Server"; + } } else if (auditTrailLevel > 1) { @@ -795,7 +795,7 @@ EstablishNewConnections(clientUnused, closure) /* kill off stragglers */ for (i=1; iosPrivate); if (oc && (oc->conn_time != 0) && @@ -963,7 +963,7 @@ CloseDownFileDescriptor(oc) *****************/ void -CheckConnections() +CheckConnections(void) { #ifndef WIN32 fd_mask mask; @@ -1100,7 +1100,7 @@ OnlyListenToOneClient(client) * Undoes OnlyListentToOneClient() ****************/ -ListenToAllClients() +ListenToAllClients(void) { if (GrabInProgress) { @@ -1262,7 +1262,7 @@ static BOOL reallyGrabbed; ******************/ void -DontListenToAnybody() +DontListenToAnybody(void) { if (!GrabInProgress) { @@ -1284,7 +1284,7 @@ DontListenToAnybody() } void -PayAttentionToClientsAgain() +PayAttentionToClientsAgain(void) { if (reallyGrabbed) { --- Xvnc/programs/Xserver/os/decompress.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/os/decompress.c @@ -87,8 +87,6 @@ static char_type magic_header[] = { "\037\235" }; /* 1 # define MAXCODE(n_bits) ((1 << (n_bits)) - 1) #endif /* COMPATIBLE */ -static code_int getcode(); - /* * the next two codes should not be changed lightly, as they must not * lie within the contiguous general code space. @@ -121,6 +119,8 @@ typedef struct _compressedFILE { char_type *tab_suffix; unsigned short *tab_prefix; } CompressedFile; + +static code_int getcode(CompressedFile *file); static int hsize_table[] = { 5003, /* 12 bits - 80% occupancy */ --- Xvnc/programs/Xserver/os/io.c.orig 2009-03-05 06:38:33 UTC +++ Xvnc/programs/Xserver/os/io.c @@ -248,7 +248,7 @@ ReadRequestFromClient(client) if (!oci) { - if (oci = FreeInputs) + if ((oci = FreeInputs)) { FreeInputs = oci->next; } @@ -525,7 +525,7 @@ InsertFakeRequest(client, data, count) } if (!oci) { - if (oci = FreeInputs) + if ((oci = FreeInputs)) FreeInputs = oci->next; else if (!(oci = AllocateInputBuffer())) return FALSE; @@ -965,7 +965,7 @@ FlushClient(who, oc, extraBuf, extraCount) **********************/ void -FlushAllOutput() +FlushAllOutput(void) { register int index, base; fd_mask mask; @@ -1046,14 +1046,14 @@ FlushAllOutput() } void -FlushIfCriticalOutputPending() +FlushIfCriticalOutputPending(void) { if (CriticalOutputPending) FlushAllOutput(); } void -SetCriticalOutputPending() +SetCriticalOutputPending(void) { CriticalOutputPending = TRUE; } @@ -1084,7 +1084,7 @@ WriteToClient (who, count, buf) if (!oco) { - if (oco = FreeOutputs) + if ((oco = FreeOutputs)) { FreeOutputs = oco->next; } @@ -1150,7 +1150,7 @@ WriteToClient (who, count, buf) } ConnectionInputPtr -AllocateInputBuffer() +AllocateInputBuffer(void) { register ConnectionInputPtr oci; @@ -1171,7 +1171,7 @@ AllocateInputBuffer() } ConnectionOutputPtr -AllocateOutputBuffer() +AllocateOutputBuffer(void) { register ConnectionOutputPtr oco; @@ -1201,7 +1201,7 @@ FreeOsBuffers(oc) if (AvailableInput == oc) AvailableInput = (OsCommPtr)NULL; - if (oci = oc->input) + if ((oci = oc->input)) { if (FreeInputs) { @@ -1217,7 +1217,7 @@ FreeOsBuffers(oc) oci->lenLastReq = 0; } } - if (oco = oc->output) + if ((oco = oc->output)) { if (FreeOutputs) { @@ -1240,18 +1240,18 @@ FreeOsBuffers(oc) } void -ResetOsBuffers() +ResetOsBuffers(void) { register ConnectionInputPtr oci; register ConnectionOutputPtr oco; - while (oci = FreeInputs) + while ((oci = FreeInputs)) { FreeInputs = oci->next; xfree(oci->buffer); xfree(oci); } - while (oco = FreeOutputs) + while ((oco = FreeOutputs)) { FreeOutputs = oco->next; xfree(oco->buf); --- Xvnc/programs/Xserver/os/mitauth.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/os/mitauth.c @@ -88,7 +88,7 @@ MitCheckCookie (data_length, data, client, reason) } int -MitResetCookie () +MitResetCookie (void) { struct auth *auth, *next; --- Xvnc/programs/Xserver/os/oscolor.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/os/oscolor.c @@ -62,6 +62,7 @@ SOFTWARE. #include "rgb.h" #include "os.h" #include "opaque.h" +#include "dix.h" /* Note that we are assuming there is only one database for all the screens. */ @@ -71,10 +72,8 @@ DBM *rgb_dbm = (DBM *)NULL; int rgb_dbm = 0; #endif -extern void CopyISOLatin1Lowered(); - int -OsInitColors() +OsInitColors(void) { if (!rgb_dbm) { @@ -152,6 +151,7 @@ OsLookupColor(screen, name, len, pred, pgreen, pblue) #include #include "os.h" #include "opaque.h" +#include "dix.h" #define HASHSIZE 511 @@ -165,8 +165,6 @@ typedef struct _dbEntry { } dbEntry; -extern void CopyISOLatin1Lowered(); - static dbEntryPtr hashTab[HASHSIZE]; @@ -191,7 +189,7 @@ lookup(name, len, create) } h %= HASHSIZE; - if ( entry = hashTab[h] ) + if (( entry = hashTab[h] )) { for( ; entry; prev = (dbEntryPtr*)entry, entry = entry->link ) if (! strcmp(name, entry->name) ) break; @@ -213,7 +211,7 @@ lookup(name, len, create) Bool -OsInitColors() +OsInitColors(void) { FILE *rgb; char *path; @@ -256,7 +254,7 @@ OsInitColors() green >= 0 && green <= 0xff && blue >= 0 && blue <= 0xff) { - if (entry = lookup(name, strlen(name), TRUE)) + if ((entry = lookup(name, strlen(name), TRUE))) { entry->red = (red * 65535) / 255; entry->green = (green * 65535) / 255; @@ -291,7 +289,7 @@ OsLookupColor(screen, name, len, pred, pgreen, pblue) { dbEntryPtr entry; - if (entry = lookup(name, len, FALSE)) + if ((entry = lookup(name, len, FALSE))) { *pred = entry->red; *pgreen = entry->green; --- Xvnc/programs/Xserver/os/osdep.h.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/os/osdep.h @@ -100,7 +100,7 @@ SOFTWARE. #if defined(NOFILE) && !defined(NOFILES_MAX) #define OPEN_MAX NOFILE #else -#ifndef __EMX__ +#if !defined(__EMX__) && defined(NOFILES_MAX) #define OPEN_MAX NOFILES_MAX #else #define OPEN_MAX 256 --- Xvnc/programs/Xserver/os/osinit.c.orig 2002-06-28 05:53:19 UTC +++ Xvnc/programs/Xserver/os/osinit.c @@ -88,7 +88,7 @@ int limitNoFile = -1; Bool OsDelayInitColors = FALSE; void -OsInit() +OsInit(void) { #ifndef AMOEBA static Bool been_here = FALSE; @@ -201,7 +201,7 @@ OsInit() } void -OsCleanup() +OsCleanup(void) { #ifdef SERVER_LOCK UnlockServer(); --- Xvnc/programs/Xserver/os/utils.c.orig 2002-09-06 11:16:30 UTC +++ Xvnc/programs/Xserver/os/utils.c @@ -143,7 +143,7 @@ Bool noTestExtensions; int auditTrailLevel = 1; -void ddxUseMsg(); +void ddxUseMsg(void); #if NeedVarargsPrototypes void VErrorF(char*, va_list); #endif @@ -191,7 +191,6 @@ OsSignal(sig, handler) } #include -extern int errno; #ifdef SERVER_LOCK /* @@ -244,7 +243,7 @@ static char LockFile[PATH_MAX]; * the lock file containing the PID. */ void -LockServer() +LockServer(void) { #ifndef AMOEBA char tmp[PATH_MAX], pid_str[12]; @@ -383,7 +382,7 @@ LockServer() * Remove the server lock file. */ void -UnlockServer() +UnlockServer(void) { #ifndef AMOEBA if (nolock) return; @@ -440,13 +439,13 @@ GiveUp(sig) } #if __GNUC__ -static void AbortServer() __attribute__((noreturn)); +static void AbortServer(void) __attribute__((noreturn)); #endif static void -AbortServer() +AbortServer(void) { - extern void AbortDDX(); + extern void AbortDDX(void); OsCleanup(); AbortDDX(); @@ -474,7 +473,7 @@ Error(str) #ifndef DDXTIME CARD32 -GetTimeInMillis() +GetTimeInMillis(void) { #ifndef AMOEBA struct timeval tp; @@ -512,7 +511,7 @@ AdjustWaitForDelay (waitTime, newdelay) } } -void UseMsg() +void UseMsg(void) { #if !defined(AIXrt) && !defined(AIX386) #ifndef AMOEBA @@ -624,7 +623,7 @@ char *argv[]; for ( i = 1; i < argc; i++ ) { /* call ddx first, so it can peek/override if it wants */ - if(skip = ddxProcessArgument(argc, argv, i)) + if ((skip = ddxProcessArgument(argc, argv, i))) { i += (skip - 1); } @@ -1264,7 +1263,7 @@ Xfree(ptr) } void -OsInitAllocator () +OsInitAllocator (void) { #ifdef MEMBUG static int been_here; @@ -1292,9 +1291,9 @@ AuditPrefix(f) { time(&tm); autime = ctime(&tm); - if (s = strchr(autime, '\n')) + if ((s = strchr(autime, '\n'))) *s = '\0'; - if (s = strrchr(argvGlobal[0], '/')) + if ((s = strrchr(argvGlobal[0], '/'))) s++; else s = argvGlobal[0]; @@ -1408,7 +1407,7 @@ System(command) char *command; { int pid, p; - void (*csig)(); + void (*csig)(int); int status; if (!command) @@ -1456,7 +1455,7 @@ Popen(command, type) struct pid *cur; FILE *iop; int pdes[2], pid; - void (*csig)(); + void (*csig)(int); if (command == NULL || type == NULL) return NULL; @@ -1537,7 +1536,7 @@ Pclose(iop) fclose(iop); for (last = NULL, cur = pidlist; cur; last = cur, cur = cur->next) - if (cur->fp = iop) + if (cur->fp == iop) break; if (cur == NULL) return -1; --- Xvnc/programs/Xserver/os/xalloc.c.orig 2003-01-29 13:52:37 UTC +++ Xvnc/programs/Xserver/os/xalloc.c @@ -675,7 +675,7 @@ Xfree(ptr) } void -OsInitAllocator () +OsInitAllocator (void) { static Bool beenhere = FALSE; --- Xvnc/programs/Xserver/os/xdmauth.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/os/xdmauth.c @@ -403,7 +403,7 @@ XdmCheckCookie (cookie_length, cookie, xclient, reason return (XID) -1; for (auth = xdmAuth; auth; auth=auth->next) { XdmcpUnwrap (cookie, &auth->key, plain, cookie_length); - if (client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, xclient, reason)) + if ((client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, xclient, reason))) { client->next = xdmClients; xdmClients = client; @@ -416,7 +416,7 @@ XdmCheckCookie (cookie_length, cookie, xclient, reason } int -XdmResetCookie () +XdmResetCookie (void) { XdmAuthorizationPtr auth, next_auth; XdmClientAuthPtr client, next_client; @@ -450,7 +450,7 @@ char *cookie; return (XID) -1; for (auth = xdmAuth; auth; auth=auth->next) { XdmcpUnwrap (cookie, &auth->key, plain, cookie_length); - if (client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, NULL, NULL)) + if ((client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, NULL, NULL))) { xfree (client); xfree (cookie); --- Xvnc/programs/Xserver/os/xdmcp.c.orig 2000-06-11 12:00:51 UTC +++ Xvnc/programs/Xserver/os/xdmcp.c @@ -50,6 +50,7 @@ #endif #endif #include +#include #include "X.h" #include "Xmd.h" #include "misc.h" @@ -248,7 +249,7 @@ static void read_cb( static short xdm_udp_port = XDM_UDP_PORT; static Bool OneSession = FALSE; -XdmcpUseMsg () +XdmcpUseMsg (void) { ErrorF("-query host-name contact named host for XDMCP\n"); ErrorF("-broadcast broadcast for XDMCP\n"); @@ -355,9 +356,9 @@ XdmcpRegisterBroadcastAddress (addr) static ARRAYofARRAY8 AuthenticationNames, AuthenticationDatas; typedef struct _AuthenticationFuncs { - Bool (*Validator)(); - Bool (*Generator)(); - Bool (*AddAuth)(); + Bool (*Validator)(ARRAY8Ptr, ARRAY8Ptr, xdmOpCode); + Bool (*Generator)(ARRAY8Ptr, ARRAY8Ptr, xdmOpCode); + Bool (*AddAuth)(unsigned int, char *, unsigned int, char *); } AuthenticationFuncsRec, *AuthenticationFuncsPtr; static AuthenticationFuncsPtr AuthenticationFuncsList; @@ -368,9 +369,9 @@ XdmcpRegisterAuthentication (name, namelen, data, data int namelen; char *data; int datalen; - Bool (*Validator)(); - Bool (*Generator)(); - Bool (*AddAuth)(); + Bool (*Validator)(ARRAY8Ptr, ARRAY8Ptr, xdmOpCode); + Bool (*Generator)(ARRAY8Ptr, ARRAY8Ptr, xdmOpCode); + Bool (*AddAuth)(unsigned int, char *, unsigned int, char *); { int i; ARRAY8 AuthenticationName, AuthenticationData; @@ -488,7 +489,7 @@ XdmcpRegisterConnection (type, address, addrlen) static ARRAYofARRAY8 AuthorizationNames; void -XdmcpRegisterAuthorizations () +XdmcpRegisterAuthorizations (void) { XdmcpDisposeARRAYofARRAY8 (&AuthorizationNames); RegisterAuthorizations (); @@ -562,7 +563,7 @@ XdmcpRegisterManufacturerDisplayID (name, length) */ void -XdmcpInit() +XdmcpInit(void) { state = XDM_INIT_STATE; #ifdef HASXDMAUTH @@ -584,7 +585,7 @@ XdmcpInit() } void -XdmcpReset () +XdmcpReset (void) { state = XDM_INIT_STATE; if (state != XDM_OFF) @@ -759,7 +760,7 @@ XdmcpAddHost(from, fromlen, AuthenticationName, hostna ARRAY8 UnwillingMessage = { (CARD8) 14, (CARD8 *) "Host unwilling" }; static void -receive_packet() +receive_packet(void) { struct sockaddr_in from; int fromlen = sizeof(struct sockaddr_in); @@ -808,7 +809,7 @@ receive_packet() */ static -send_packet() +send_packet(void) { int rtx; switch (state) { @@ -855,7 +856,7 @@ XdmcpDeadSession (reason) */ static void -timeout() +timeout(void) { timeOutRtx++; if (state == XDM_AWAIT_ALIVE_RESPONSE && timeOutRtx >= XDM_KA_RTX_LIMIT ) @@ -896,7 +897,7 @@ timeout() } static -restart() +restart(void) { state = XDM_INIT_STATE; timeOutRtx = 0; @@ -915,7 +916,7 @@ XdmcpCheckAuthentication (Name, Data, packet_type) XdmcpAddAuthorization (name, data) ARRAY8Ptr name, data; { - Bool (*AddAuth)(), AddAuthorization(); + Bool (*AddAuth)(unsigned int, char *, unsigned int, char *); if (AuthenticationFuncs && AuthenticationFuncs->AddAuth) AddAuth = AuthenticationFuncs->AddAuth; @@ -933,7 +934,7 @@ XdmcpAddAuthorization (name, data) */ static void -get_xdmcp_sock() +get_xdmcp_sock(void) { #ifdef STREAMSCONN struct netconfig *nconf; @@ -1027,7 +1028,7 @@ get_xdmcp_sock() } static void -send_query_msg() +send_query_msg(void) { XdmcpHeader header; Bool broadcast = FALSE; @@ -1108,7 +1109,7 @@ recv_willing_msg(from, fromlen, length) } static void -send_request_msg() +send_request_msg(void) { XdmcpHeader header; int length; @@ -1236,7 +1237,7 @@ recv_decline_msg(length) } static void -send_manage_msg() +send_manage_msg(void) { XdmcpHeader header; @@ -1296,7 +1297,7 @@ recv_failed_msg(length) } static void -send_keepalive_msg() +send_keepalive_msg(void) { XdmcpHeader header; --- include/vncauth.h.orig 2000-06-11 12:00:51 UTC +++ include/vncauth.h @@ -25,6 +25,8 @@ #define CHALLENGESIZE 16 extern int vncEncryptAndStorePasswd(char *passwd, char *fname); +extern int vncEncryptAndStorePasswd2(char *passwd, char *passwdViewOnly, char *fname); extern char *vncDecryptPasswdFromFile(char *fname); +extern int vncDecryptPasswdFromFile2(char *fname, char *passwdFullControl, char *passwdViewOnly); extern void vncRandomBytes(unsigned char *bytes); extern void vncEncryptBytes(unsigned char *bytes, char *passwd); --- vncconnect/vncconnect.c.orig 2000-11-10 10:20:07 UTC +++ vncconnect/vncconnect.c @@ -3,6 +3,8 @@ */ #include +#include +#include #include #include --- vncpasswd/vncpasswd.c.orig 2003-03-01 16:59:05 UTC +++ vncpasswd/vncpasswd.c @@ -145,7 +145,7 @@ static void usage(char *argv[]) fprintf(stderr, "Usage: %s [FILE]\n" " %s -t\n", - argv[0], argv[0], argv[0]); + argv[0], argv[0]); exit(1); } --- vncpasswd/vncpasswd.man.orig 2006-08-15 06:10:26 UTC +++ vncpasswd/vncpasswd.man @@ -29,8 +29,8 @@ passwords for the TightVNC server authentication. \fBX passwords when started with the \fB\-rfbauth\fR command-line option (or when started from the \fBvncserver\fR script). -\fBvncpasswd\fR allows to enter either one or two passwords. The first -password is the primary one, the second password can be used for +\fBvncpasswd\fR allows one to enter either one or two passwords. The +first password is the primary one, the second password can be used for view-only authentication. \fBXvnc\fR will restrict mouse and keyboard input from clients who authenticated with the view-only password. The \fBvncpasswd\fR utility asks interactively if it should set the second --- vncserver.orig 2009-02-12 04:27:18 UTC +++ vncserver @@ -32,10 +32,13 @@ $geometry = "1024x768"; $depth = 24; $desktopName = "X"; -$vncClasses = "/usr/local/vnc/classes"; +$vncClasses = "/usr/local/share/tightvnc/classes"; $vncUserDir = "$ENV{HOME}/.vnc"; -$fontPath = "unix/:7100"; -$authType = "-rfbauth $vncUserDir/passwd"; +$quotedVncUserDir = "edString($vncUserDir); +$passwdFile = "$vncUserDir/passwd"; +$quotedPasswdFile = "edString($passwdFile); +#$fontPath = "unix/:7100"; +$authType = "-rfbauth $quotedPasswdFile"; # Read configuration from the system-wide and user files if present. @@ -48,16 +51,18 @@ ReadConfiguration(); $defaultXStartup = ("#!/bin/sh\n\n". - "xrdb \$HOME/.Xresources\n". + "xrdb \"\$HOME/.Xresources\"\n". "xsetroot -solid grey\n". "xterm -geometry 80x24+10+10 -ls -title \"\$VNCDESKTOP Desktop\" &\n". "twm &\n"); $xauthorityFile = "$ENV{XAUTHORITY}"; +$quotedxauthorityFile = "edString($xauthorityFile); $vncUserDirUnderTmp = ($vncUserDir =~ m|^/tmp/.+|) ? 1 : 0; $xstartup = ($vncUserDirUnderTmp) ? "$ENV{HOME}/.vncstartup" : "$vncUserDir/xstartup"; +$quotedXstartup = "edString($xstartup); unless ($xauthorityFile) { if ($vncUserDirUnderTmp) { $xauthorityFile = "$vncUserDir/.Xauthority"; @@ -65,6 +70,7 @@ unless ($xauthorityFile) { $xauthorityFile = "$ENV{HOME}/.Xauthority"; } } +$quotedXauthorityFile = "edString($xauthorityFile); chop($host = `uname -n`); @@ -113,13 +119,13 @@ if (!-d _ || !-o _ || ($vncUserDirUnderTmp && ($mode & # Make sure the user has a password. -($z,$z,$mode) = lstat("$vncUserDir/passwd"); +($z,$z,$mode) = lstat("$passwdFile"); if (-e _ && (!-f _ || !-o _)) { - die "$prog: Wrong type or ownership on $vncUserDir/passwd.\n"; + die "$prog: Wrong type or ownership on $passwdFile.\n"; } if (!-e _ || ($mode & 077) != 0) { warn "\nYou will require a password to access your desktops.\n\n"; - system("vncpasswd $vncUserDir/passwd"); + system("vncpasswd $quotedPasswdFile"); if (($? & 0xFF00) != 0) { exit 1; } @@ -142,27 +148,28 @@ if ((@ARGV > 0) && ($ARGV[0] =~ /^:(\d+)$/)) { $vncPort = 5900 + $displayNumber; $desktopLog = "$vncUserDir/$host:$displayNumber.log"; +$quotedDesktopLog = "edString($desktopLog); unlink($desktopLog); # Make an X server cookie - use as the seed the sum of the current time, our # PID and part of the encrypted form of the password. Ideally we'd use # /dev/urandom, but that's only available on Linux. -srand(time+$$+unpack("L",`cat $vncUserDir/passwd`)); +srand(time+$$+unpack("L",`cat $quotedPasswdFile`)); $cookie = ""; for (1..16) { $cookie .= sprintf("%02x", int(rand(256))); } -system("xauth -f $xauthorityFile add $host:$displayNumber . $cookie"); -system("xauth -f $xauthorityFile add $host/unix:$displayNumber . $cookie"); +system("xauth -f $quotedXauthorityFile add $host:$displayNumber . $cookie"); +system("xauth -f $quotedXauthorityFile add $host/unix:$displayNumber . $cookie"); # Now start the X VNC Server $cmd = "Xvnc :$displayNumber"; $cmd .= " -desktop " . "edString($desktopName); $cmd .= " -httpd $vncClasses"; -$cmd .= " -auth $xauthorityFile"; +$cmd .= " -auth $quotedXauthorityFile"; $cmd .= " -geometry $geometry" if ($geometry); $cmd .= " -depth $depth" if ($depth); $cmd .= " -pixelformat $pixelformat" if ($pixelformat); @@ -180,21 +187,22 @@ $cmd .= " >> " . "edString($desktopLog) . " 2>&1"; # Run $cmd and record the process ID. $pidFile = "$vncUserDir/$host:$displayNumber.pid"; -system("$cmd & echo \$! >$pidFile"); +$quotedPidFile = "edString($pidFile); +system("$cmd & echo \$! >$quotedPidFile"); # Give Xvnc a chance to start up sleep(1); -unless (kill 0, `cat $pidFile`) { +unless (kill 0, `cat $quotedPidFile`) { warn "Couldn't start Xvnc; trying default font path.\n"; warn "Please set correct fontPath in the $prog script.\n"; $cmd =~ s@-fp [^ ]+@@; - system("$cmd & echo \$! >$pidFile"); + system("$cmd & echo \$! >$quotedPidFile"); sleep(1); } -unless (kill 0, `cat $pidFile`) { +unless (kill 0, `cat $quotedPidFile`) { warn "Couldn't start Xvnc process.\n\n"; - open(LOG, "<$desktopLog"); + open(LOG, "<", $desktopLog); while () { print; } close(LOG); die "\n"; @@ -206,7 +214,7 @@ warn "\nNew '$desktopName' desktop is $host:$displayNu unless (-e "$xstartup") { warn "Creating default startup script $xstartup\n"; - open(XSTARTUP, ">$xstartup"); + open(XSTARTUP, ">", $xstartup); print XSTARTUP $defaultXStartup; close(XSTARTUP); chmod 0755, "$xstartup"; @@ -227,7 +235,7 @@ if (-e "/tmp/.X11-unix/X$displayNumber") { } $ENV{VNCDESKTOP}= $desktopName; -system("$xstartup >> " . "edString($desktopLog) . " 2>&1 &"); +system("$quotedXstartup >> " . "edString($desktopLog) . " 2>&1 &"); exit; @@ -460,6 +468,9 @@ sub Usage sub Kill { + my $pidFile; + my $quotedPidFile; + $opt{'-kill'} =~ s/(:\d+)\.\d+$/$1/; # e.g. turn :1.0 into :1 if ($opt{'-kill'} =~ /^:\d+$/) { @@ -471,6 +482,7 @@ sub Kill } $pidFile = "$vncUserDir/$opt{'-kill'}.pid"; } + $quotedPidFile = "edString($pidFile); unless (-r $pidFile) { die "\nCan't find file $pidFile\n". @@ -478,7 +490,7 @@ sub Kill } $SIG{'HUP'} = 'IGNORE'; - chop($pid = `cat $pidFile`); + chop($pid = `cat $quotedPidFile`); warn "Killing Xvnc process ID $pid\n"; system("kill $pid"); unlink $pidFile; @@ -615,7 +627,7 @@ sub ReadConfiguration colorPath ); - if (open CONF, "<$configFile") { + if (open CONF, "<", $configFile) { while () { if (/^\s*\$(\w+)\s*=\s*(.*)$/) { for my $var (@configurableVariables) { --- vncviewer/corre.c.orig 2000-06-11 12:00:51 UTC +++ vncviewer/corre.c @@ -56,6 +56,14 @@ HandleCoRREBPP (int rx, int ry, int rw, int rh) XChangeGC(dpy, gc, GCForeground, &gcv); XFillRectangle(dpy, desktopWin, gc, rx, ry, rw, rh); + /* CVE-2019-8287 + (same as CVE-2018-20020/libvncserver) + heap out-of-bound write vulnerability inside structure in VNC client code that + can result remote code execution + */ + if (hdr.nSubrects > BUFFER_SIZE / (4 + (BPP / 8))) + return False; + if (!ReadFromRFBServer(buffer, hdr.nSubrects * (4 + (BPP / 8)))) return False; --- vncviewer/desktop.c.orig 2004-05-28 17:29:29 UTC +++ vncviewer/desktop.c @@ -179,7 +179,7 @@ HandleBasicDesktopEvent(Widget w, XtPointer ptr, XEven case LeaveNotify: for (i = 0; i < 256; i++) { if (modifierPressed[i]) { - SendKeyEvent(XKeycodeToKeysym(dpy, i, 0), False); + SendKeyEvent(XkbKeycodeToKeysym(dpy, i, 0, 0), False); modifierPressed[i] = False; } } @@ -312,7 +312,7 @@ SendRFBEvent(Widget w, XEvent *ev, String *params, Car XLookupString(&ev->xkey, keyname, 256, &ks, NULL); if (IsModifierKey(ks)) { - ks = XKeycodeToKeysym(dpy, ev->xkey.keycode, 0); + ks = XkbKeycodeToKeysym(dpy, ev->xkey.keycode, 0, 0); modifierPressed[ev->xkey.keycode] = (ev->type == KeyPress); } --- vncviewer/misc.c.orig 2003-01-15 07:58:32 UTC +++ vncviewer/misc.c @@ -24,11 +24,13 @@ #include #include #include +#include +#include static void CleanupSignalHandler(int sig); static int CleanupXErrorHandler(Display *dpy, XErrorEvent *error); static int CleanupXIOErrorHandler(Display *dpy); -static void CleanupXtErrorHandler(String message); +static void CleanupXtErrorHandler(String message) __attribute__((noreturn)); static Bool IconifyNamedWindow(Window w, char *name, Bool undo); Dimension dpyWidth, dpyHeight; @@ -311,6 +313,7 @@ CleanupXtErrorHandler(String message) fprintf(stderr,"CleanupXtErrorHandler called\n"); Cleanup(); (*defaultXtErrorHandler)(message); + exit(1); } static void --- vncviewer/rfbproto.c.orig 2006-12-08 07:20:03 UTC +++ vncviewer/rfbproto.c @@ -31,6 +31,8 @@ #include #include +extern Bool HandleCursorPos(int x, int y); + static void InitCapabilities(void); static Bool SetupTunneling(void); static int ReadSecurityType(void); @@ -303,7 +305,11 @@ InitialiseRFBConnection(void) si.format.blueMax = Swap16IfLE(si.format.blueMax); si.nameLength = Swap32IfLE(si.nameLength); - /* FIXME: Check arguments to malloc() calls. */ + /* CVE-2019-15679 fail on server-sent desktop name lengths longer than 1MB */ + if (si.nameLength > 1<<20) { + fprintf(stderr, "Too big desktop name length sent by server: %u B > 1 MB\n", (unsigned int)si.nameLength); + return FALSE; + } desktopName = malloc(si.nameLength + 1); if (!desktopName) { fprintf(stderr, "Error allocating memory for desktop name, %lu bytes\n", @@ -569,7 +575,7 @@ AuthenticateVNC(void) passwd = getpass("Password: "); } - if (!passwd || strlen(passwd) == 0) { + if (!passwd) { fprintf(stderr, "Reading password failed\n"); return False; } @@ -886,6 +892,13 @@ SendKeyEvent(CARD32 key, Bool down) { rfbKeyEventMsg ke; + /* CVE-2018-20022 + multiple weaknesses CWE-665: Improper Initialization vulnerability in VNC + client code that allows attacker to read stack memory and can be abused for + information disclosure. Combined with another vulnerability, it can be used + to leak stack memory layout and in bypassing ASLR + */ + memset(&ke, 0, sizeof(ke)); ke.type = rfbKeyEvent; ke.down = down ? 1 : 0; ke.key = Swap32IfLE(key); @@ -906,6 +919,13 @@ SendClientCutText(char *str, int len) free(serverCutText); serverCutText = NULL; + /* CVE-2018-20022 + multiple weaknesses CWE-665: Improper Initialization vulnerability in VNC + client code that allows attacker to read stack memory and can be abused for + information disclosure. Combined with another vulnerability, it can be used + to leak stack memory layout and in bypassing ASLR + */ + memset(&cct, 0, sizeof(cct)); cct.type = rfbClientCutText; cct.length = Swap32IfLE(len); return (WriteExact(rfbsock, (char *)&cct, sz_rfbClientCutTextMsg) && @@ -1021,7 +1041,11 @@ HandleRFBServerMessage() bytesPerLine = rect.r.w * myFormat.bitsPerPixel / 8; linesToRead = BUFFER_SIZE / bytesPerLine; - while (rect.r.h > 0) { + /* CVE-2018-20021 + CWE-835: Infinite loop vulnerability in VNC client code. Vulnerability allows + attacker to consume excessive amount of resources like CPU and RAM + */ + while (linesToRead && rect.r.h > 0) { if (linesToRead > rect.r.h) linesToRead = rect.r.h; @@ -1212,6 +1236,12 @@ HandleRFBServerMessage() sz_rfbServerCutTextMsg - 1)) return False; + /* CVE-2019-15678 ignore server-sent cut text longer than 1MB */ + if (msg.sct.length > 1<<30) { + fprintf(stderr, "Ignoring too big cut text length sent by server: %u B > 1 GB\n", (unsigned int)msg.sct.length); + return False; + } + msg.sct.length = Swap32IfLE(msg.sct.length); if (serverCutText) @@ -1287,7 +1317,12 @@ ReadConnFailedReason(void) char *reason = NULL; if (ReadFromRFBServer((char *)&reasonLen, sizeof(reasonLen))) { + /* CVE-2019-15678 ignore server-sent reason strings longer than 1MB */ reasonLen = Swap32IfLE(reasonLen); + if (reasonLen > 1<<20) { + fprintf(stderr, "VNC connection failed, but sent reason length of %u exceeds limit of 1MB",(unsigned int)reasonLen); + return; + } if ((reason = malloc(reasonLen)) != NULL && ReadFromRFBServer(reason, reasonLen)) { fprintf(stderr,"%.*s\n", (int)reasonLen, reason); --- vncviewer/sockets.c.orig 2001-01-15 03:54:18 UTC +++ vncviewer/sockets.c @@ -102,7 +102,7 @@ ReadFromRFBServer(char *out, unsigned int n) ProcessXtEvents(); i = 0; } else { - fprintf(stderr,programName); + fprintf(stderr,"%s",programName); perror(": read"); return False; } @@ -131,7 +131,7 @@ ReadFromRFBServer(char *out, unsigned int n) ProcessXtEvents(); i = 0; } else { - fprintf(stderr,programName); + fprintf(stderr,"%s",programName); perror(": read"); return False; } @@ -171,13 +171,13 @@ WriteExact(int sock, char *buf, int n) FD_SET(rfbsock,&fds); if (select(rfbsock+1, NULL, &fds, NULL, NULL) <= 0) { - fprintf(stderr,programName); + fprintf(stderr,"%s",programName); perror(": select"); return False; } j = 0; } else { - fprintf(stderr,programName); + fprintf(stderr,"%s",programName); perror(": write"); return False; } @@ -209,13 +209,13 @@ ConnectToTcpAddr(unsigned int host, int port) sock = socket(AF_INET, SOCK_STREAM, 0); if (sock < 0) { - fprintf(stderr,programName); + fprintf(stderr,"%s",programName); perror(": ConnectToTcpAddr: socket"); return -1; } if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) { - fprintf(stderr,programName); + fprintf(stderr,"%s",programName); perror(": ConnectToTcpAddr: connect"); close(sock); return -1; @@ -223,7 +223,7 @@ ConnectToTcpAddr(unsigned int host, int port) if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *)&one, sizeof(one)) < 0) { - fprintf(stderr,programName); + fprintf(stderr,"%s",programName); perror(": ConnectToTcpAddr: setsockopt"); close(sock); return -1; @@ -250,7 +250,7 @@ FindFreeTcpPort(void) sock = socket(AF_INET, SOCK_STREAM, 0); if (sock < 0) { - fprintf(stderr,programName); + fprintf(stderr,"%s",programName); perror(": FindFreeTcpPort: socket"); return 0; } @@ -285,28 +285,28 @@ ListenAtTcpPort(int port) sock = socket(AF_INET, SOCK_STREAM, 0); if (sock < 0) { - fprintf(stderr,programName); + fprintf(stderr,"%s",programName); perror(": ListenAtTcpPort: socket"); return -1; } if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char *)&one, sizeof(one)) < 0) { - fprintf(stderr,programName); + fprintf(stderr,"%s",programName); perror(": ListenAtTcpPort: setsockopt"); close(sock); return -1; } if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) { - fprintf(stderr,programName); + fprintf(stderr,"%s",programName); perror(": ListenAtTcpPort: bind"); close(sock); return -1; } if (listen(sock, 5) < 0) { - fprintf(stderr,programName); + fprintf(stderr,"%s",programName); perror(": ListenAtTcpPort: listen"); close(sock); return -1; @@ -330,14 +330,14 @@ AcceptTcpConnection(int listenSock) sock = accept(listenSock, (struct sockaddr *) &addr, &addrlen); if (sock < 0) { - fprintf(stderr,programName); + fprintf(stderr,"%s",programName); perror(": AcceptTcpConnection: accept"); return -1; } if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *)&one, sizeof(one)) < 0) { - fprintf(stderr,programName); + fprintf(stderr,"%s",programName); perror(": AcceptTcpConnection: setsockopt"); close(sock); return -1; @@ -355,7 +355,7 @@ Bool SetNonBlocking(int sock) { if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) { - fprintf(stderr,programName); + fprintf(stderr,"%s",programName); perror(": AcceptTcpConnection: fcntl"); return False; } --- vncviewer/vncviewer.h.orig 2006-12-05 11:12:42 UTC +++ vncviewer/vncviewer.h @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include "rfbproto.h" --- vncviewer/vncviewer.man.orig 2006-08-15 06:10:26 UTC +++ vncviewer/vncviewer.man @@ -88,11 +88,6 @@ By default, the viewer shows and raises its window on (bell) event. This option disables such behaviour (TightVNC\-specific). .TP -\fB\-user\fR \fIusername\fR -User name for Unix login authentication. Default is to use current -Unix user name. If this option was given, the viewer will prefer Unix -login authentication over the standard VNC authentication. -.TP \fB\-passwd\fR \fIpasswd\-file\fR File from which to get the password (as generated by the \fBvncpasswd\fR(1) program). This option affects only the standard VNC @@ -262,9 +257,6 @@ true. .B passwordFile Equivalent of \fB\-passwd\fR option. .TP -.B userLogin -Equivalent of \fB\-user\fR option. -.TP .B passwordDialog Whether to use a dialog box to get the password (true) or get it from the tty (false). Irrelevant if \fBpasswordFile\fR is set. Default @@ -342,7 +334,7 @@ When started with the \fB\-via\fR option, vncviewer re \fBVNC_VIA_CMD\fR environment variable, expands patterns beginning with the "%" character, and executes result as a command assuming that it would create TCP tunnel that should be used for VNC connection. If -not set, this environment variable defaults to "/usr/bin/ssh -f -L +not set, this environment variable defaults to "/usr/bin/ssh \-f \-L %L:%H:%R %G sleep 20". The following patterns are recognized in the \fBVNC_VIA_CMD\fR (note --- vncviewer/zlib.c.orig 2001-01-16 08:16:39 UTC +++ vncviewer/zlib.c @@ -55,6 +55,10 @@ HandleZlibBPP (int rx, int ry, int rw, int rh) raw_buffer_size = (( rw * rh ) * ( BPP / 8 )); raw_buffer = (char*) malloc( raw_buffer_size ); + /* CVE-2019-15680 */ + if (raw_buffer == NULL) { + return False; + } } if (!ReadFromRFBServer((char *)&hdr, sz_rfbZlibHeader))