[kaffe] CVS kaffe (dalibor): Fixed tons of compiler warnings

Kaffe CVS Kaffe Mailing List <kaffe@kaffe.org>
Fri Mar 26 16:41:04 2004


PatchSet 4584 
Date: 2004/03/26 22:58:38
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Fixed tons of compiler warnings

Members: 
	ChangeLog:1.2162->1.2163 
	kaffe/kaffeh/main.c:1.14->1.15 
	kaffe/kaffevm/baseClasses.c:1.48->1.49 
	kaffe/kaffevm/classMethod.h:1.63->1.64 
	kaffe/kaffevm/file.h:1.5->1.6 
	kaffe/kaffevm/stringSupport.h:1.11->1.12 
	kaffe/kaffevm/verify-debug.h:1.3->1.4 
	kaffe/kaffevm/gcj/gcj.h:1.5->1.6 
	kaffe/kaffevm/jit3/labels.h:1.8->1.9 
	kaffe/kaffevm/jit3/registers.h:1.8->1.9 
	kaffe/xprof/mangle.h:1.4->1.5 
	libraries/clib/awt/X/cbd.c:1.3->1.4 
	libraries/clib/awt/X/fnt.c:1.13->1.14 
	libraries/clib/awt/X/toolkit.h:1.27->1.28 
	libraries/clib/native/ByteToCharDefault.c:1.6->1.7 
	libraries/clib/native/CharToByteDefault.c:1.5->1.6 
	libraries/clib/native/Compiler.c:1.4->1.5 
	libraries/extensions/sound/common/common.h:1.1->1.2 
	libraries/extensions/sound/esd/common.h:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2162 kaffe/ChangeLog:1.2163
--- kaffe/ChangeLog:1.2162	Fri Mar 26 21:15:32 2004
+++ kaffe/ChangeLog	Fri Mar 26 22:58:38 2004
@@ -1,3 +1,25 @@
+2004-03-26  Adam Heath <doogie@debian.org>
+
+        * kaffe/kaffeh/main.c,
+        kaffe/kaffevm/baseClasses.c,
+        kaffe/kaffevm/classMethod.h,
+        kaffe/kaffevm/file.h,
+        kaffe/kaffevm/stringSupport.h,
+        kaffe/kaffevm/verify-debug.h,
+        kaffe/kaffevm/gcj/gcj.h,
+        kaffe/kaffevm/jit3/labels.h,
+        kaffe/kaffevm/jit3/registers.h,
+        kaffe/xprof/mangle.h,
+        libraries/clib/awt/X/cbd.c,
+        libraries/clib/awt/X/fnt.c,
+        libraries/clib/awt/X/toolkit.h,
+        libraries/clib/native/ByteToCharDefault.c,
+        libraries/clib/native/CharToByteDefault.c,
+        libraries/clib/native/Compiler.c,
+        libraries/extensions/sound/common/common.h,
+        libraries/extensions/sound/esd/common.h:
+	Fixed tons of compiler warnings.
+
 2004-03-26  Dalibor Topic <robilad@kaffe.org>
 
 	* config/i386/jit3-i386.def:
Index: kaffe/kaffe/kaffeh/main.c
diff -u kaffe/kaffe/kaffeh/main.c:1.14 kaffe/kaffe/kaffeh/main.c:1.15
--- kaffe/kaffe/kaffeh/main.c:1.14	Mon Mar  8 21:21:06 2004
+++ kaffe/kaffe/kaffeh/main.c	Fri Mar 26 22:58:40 2004
@@ -51,7 +51,7 @@
 char* directoryName = 0;
 
 static void usage(void);
-static int options(char**);
+static int options(int argc, char**);
 
 /*
  * MAIN
@@ -64,7 +64,7 @@
 	int farg;
 
 	/* Process arguments */
-	farg = options(argv);
+	farg = options(argc, argv);
 
 	if (argv[farg] == 0) {
 		usage();
@@ -198,11 +198,11 @@
  */
 static
 int
-options(char** argv)
+options(int argc, char** argv)
 {
 	int i;
 
-	for (i = 1; argv[i] != 0; i++) {
+	for (i = 1; i < argc; i++) {
 		if (argv[i][0] != '-') {
 			break;
 		}
Index: kaffe/kaffe/kaffevm/baseClasses.c
diff -u kaffe/kaffe/kaffevm/baseClasses.c:1.48 kaffe/kaffe/kaffevm/baseClasses.c:1.49
--- kaffe/kaffe/kaffevm/baseClasses.c:1.48	Thu Mar 25 17:53:03 2004
+++ kaffe/kaffe/kaffevm/baseClasses.c	Fri Mar 26 22:58:41 2004
@@ -95,9 +95,6 @@
 /* Initialisation prototypes */
 void initClasspath(void);
 void initNative(void);
-void initThreads(void);
-
-extern JavaVMInitArgs Kaffe_JavaVMArgs[];
 
 /*
  * Initialise the machine.
Index: kaffe/kaffe/kaffevm/classMethod.h
diff -u kaffe/kaffe/kaffevm/classMethod.h:1.63 kaffe/kaffe/kaffevm/classMethod.h:1.64
--- kaffe/kaffe/kaffevm/classMethod.h:1.63	Mon Mar  8 21:21:07 2004
+++ kaffe/kaffe/kaffevm/classMethod.h	Fri Mar 26 22:58:41 2004
@@ -525,8 +525,6 @@
 Hjava_lang_Class*	lookupObjectArrayClass(Hjava_lang_Class*);
 Field*			lookupClassField(Hjava_lang_Class*, Utf8Const*, bool, errorInfo *einfo);
 
-Hjava_lang_Class*	getClass(constIndex, Hjava_lang_Class*, errorInfo *einfo);
-
 void			countInsAndOuts(const char*, short*, short*, char*);
 int			sizeofSigChar(char, bool);
 int			sizeofSigItem(const char**, bool);
Index: kaffe/kaffe/kaffevm/file.h
diff -u kaffe/kaffe/kaffevm/file.h:1.5 kaffe/kaffe/kaffevm/file.h:1.6
--- kaffe/kaffe/kaffevm/file.h:1.5	Thu Jan 22 19:54:23 2004
+++ kaffe/kaffe/kaffevm/file.h	Fri Mar 26 22:58:41 2004
@@ -91,8 +91,7 @@
 		else
 			postExceptionMessage(einfo,
 					     JAVA_LANG(ClassFormatError),
-					     "Truncated class file",
-					     cfname);
+					     "Truncated class file");
 			
 		return false;
 	}
Index: kaffe/kaffe/kaffevm/stringSupport.h
diff -u kaffe/kaffe/kaffevm/stringSupport.h:1.11 kaffe/kaffe/kaffevm/stringSupport.h:1.12
--- kaffe/kaffe/kaffevm/stringSupport.h:1.11	Wed May 29 22:58:44 2002
+++ kaffe/kaffe/kaffevm/stringSupport.h	Fri Mar 26 22:58:41 2004
@@ -23,21 +23,10 @@
 #define STRING_DATA(STR)	\
 		(&(unhand_array(unhand(STR)->value)->body[unhand(STR)->offset]))
 
-/* Create a String object from the supplied C (not UTF-8!) string */
-extern Hjava_lang_String* stringC2Java(const char*);
-
 /* Return the interned String object having the char array value.
    Create and intern a new String if necessary. */
 extern Hjava_lang_String* stringCharArray2Java(const jchar*, int);
 
-/* Convert a String object into a C string (truncating the higher 8 bits).
-   Returns the string in an KMALLOC()'d buffer. Caller is responsible for
-   calling KFREE() on the buffer when finished. */
-extern char*		  stringJava2C(const Hjava_lang_String*);
-
-/* Like stringJava2C() but use a caller-supplied buffer instead of KMALLOC() */
-extern char*		  stringJava2CBuf(const Hjava_lang_String*, char*, int);
-
 /* Create a Utf8Const object from a String object after replacing all 
    occurrences of the first character with the second. 
    NB.: unlike a conversion via stringJava2C -> utf8ConstNew, this will
@@ -74,9 +63,5 @@
    of the first character with the second. */
 extern Hjava_lang_String* utf8Const2JavaReplace(const Utf8Const *,
 				jchar, jchar);
-
-/* Compare a Utf8Const and a String object */
-extern int		  utf8ConstEqualJavaString(const Utf8Const*,
-				const Hjava_lang_String*);
 
 #endif
Index: kaffe/kaffe/kaffevm/verify-debug.h
diff -u kaffe/kaffe/kaffevm/verify-debug.h:1.3 kaffe/kaffe/kaffevm/verify-debug.h:1.4
--- kaffe/kaffe/kaffevm/verify-debug.h:1.3	Fri Mar  5 13:45:31 2004
+++ kaffe/kaffe/kaffevm/verify-debug.h	Fri Mar 26 22:58:41 2004
@@ -25,7 +25,7 @@
 extern void printConstantPool(const Hjava_lang_Class* class);
 extern void printInstruction(const int opcode);
 extern void printType(const Type*);
-extern void printBlock(const Method* method, const BlockInfo* binfo, const char* indent);
+extern void printBlock(const Method* method, const BlockInfo* binfo, const char* id);
 #endif /* defined(KAFFE_VMDEBUG) */
 
 #endif /* !defined(VERIFY_DEBUG_H) */
Index: kaffe/kaffe/kaffevm/gcj/gcj.h
diff -u kaffe/kaffe/kaffevm/gcj/gcj.h:1.5 kaffe/kaffe/kaffevm/gcj/gcj.h:1.6
--- kaffe/kaffe/kaffevm/gcj/gcj.h:1.5	Mon Jan  6 17:14:20 2003
+++ kaffe/kaffe/kaffevm/gcj/gcj.h	Fri Mar 26 22:58:42 2004
@@ -146,15 +146,6 @@
 
 #define GCJ2KAFFE(gcjClass)	((struct Hjava_lang_Class*)((gcjClass)->thread))
 
-extern struct Hjava_lang_Class* intClass;
-extern struct Hjava_lang_Class* longClass;
-extern struct Hjava_lang_Class* booleanClass;
-extern struct Hjava_lang_Class* charClass;
-extern struct Hjava_lang_Class* floatClass;
-extern struct Hjava_lang_Class* doubleClass;
-extern struct Hjava_lang_Class* byteClass;
-extern struct Hjava_lang_Class* shortClass;
-extern struct Hjava_lang_Class* voidClass;
 extern void gcjInitPrimitiveClasses(void);
 
 #define FIELD_UNRESOLVED_FLAG   0x8000
Index: kaffe/kaffe/kaffevm/jit3/labels.h
diff -u kaffe/kaffe/kaffevm/jit3/labels.h:1.8 kaffe/kaffe/kaffevm/jit3/labels.h:1.9
--- kaffe/kaffe/kaffevm/jit3/labels.h:1.8	Tue Sep 16 19:23:38 2003
+++ kaffe/kaffe/kaffevm/jit3/labels.h	Fri Mar 26 22:58:42 2004
@@ -192,7 +192,7 @@
  * @return A label matching the given "pc" or NULL if there are no more
  *   internal labels found.
  */
-label *getInternalLabel(label **lptr, uintp pc);
+label *getInternalLabel(label **lptr, uintp counter);
 
 #if defined(KAFFE_VMDEBUG)
 /*
Index: kaffe/kaffe/kaffevm/jit3/registers.h
diff -u kaffe/kaffe/kaffevm/jit3/registers.h:1.8 kaffe/kaffe/kaffevm/jit3/registers.h:1.9
--- kaffe/kaffe/kaffevm/jit3/registers.h:1.8	Tue Jul  1 15:56:57 2003
+++ kaffe/kaffe/kaffevm/jit3/registers.h	Fri Mar 26 22:58:42 2004
@@ -211,10 +211,4 @@
 extern void HAVE_kill_readonce_register(SlotData *s);
 #endif
 
-extern void HAVE_move_register_int(int, int);
-extern void HAVE_move_register_ref(int, int);
-extern void HAVE_move_register_long(int, int);
-extern void HAVE_move_register_float(int, int);
-extern void HAVE_move_register_double(int, int);
-
 #endif
Index: kaffe/kaffe/xprof/mangle.h
diff -u kaffe/kaffe/xprof/mangle.h:1.4 kaffe/kaffe/xprof/mangle.h:1.5
--- kaffe/kaffe/xprof/mangle.h:1.4	Mon Mar  8 21:21:21 2004
+++ kaffe/kaffe/xprof/mangle.h	Fri Mar 26 22:58:43 2004
@@ -92,7 +92,7 @@
 /*
  * Mangle string `src' of length `len', and place the result into `dest'
  */
-int mangleString(char *dest, char *src, int slen, int unicode);
+int mangleString(char *dest, char *src, int slen, int uc);
 /*
  * Determine the mangled length of the given string.  If the string doesn't
  * require any escapes then zero is returned.  If len is -1 then `term' is
Index: kaffe/libraries/clib/awt/X/cbd.c
diff -u kaffe/libraries/clib/awt/X/cbd.c:1.3 kaffe/libraries/clib/awt/X/cbd.c:1.4
--- kaffe/libraries/clib/awt/X/cbd.c:1.3	Tue Feb 29 05:31:26 2000
+++ kaffe/libraries/clib/awt/X/cbd.c	Fri Mar 26 22:58:43 2004
@@ -8,6 +8,7 @@
  * of this file. 
  */
 
+#include "config.h"
 #include <unistd.h>
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
@@ -19,7 +20,6 @@
 jmethodID  createTransferable;
 jmethodID  getNativeData;
 
-typedef void ClipBoard;
 
 
 /*****************************************************************************************
@@ -28,7 +28,7 @@
  */
 
 jobject
-selectionClear ( JNIEnv* env, Toolkit* X )
+selectionClear ( JNIEnv* env, Toolkit* tk )
 {
   (*env)->CallStaticVoidMethod( env, NativeClipboard, lostOwnership);
 
@@ -36,7 +36,7 @@
 }
 
 jobject
-selectionRequest ( JNIEnv* env, Toolkit* X )
+selectionRequest ( JNIEnv* env, Toolkit* tk )
 {
   XEvent     e;
   char       *mime;
@@ -45,14 +45,14 @@
   jbyte      *data;
   jboolean   isCopy;
   int        len;
-  Atom       target = X->event.xselectionrequest.target;
+  Atom       target = tk->event.xselectionrequest.target;
 
   if ( target == JAVA_OBJECT )
 	mime = "application/x-java-serialized-object";
   else if ( target == XA_STRING )
 	mime = "text/plain; charset=unicode";
   else
-	mime = XGetAtomName( X->dsp, target);
+	mime = XGetAtomName( tk->dsp, target);
 
   jMimeType = (*env)->NewStringUTF( env, (const char*) mime);
   jData = (*env)->CallStaticObjectMethod( env, NativeClipboard, getNativeData, jMimeType);
@@ -61,26 +61,26 @@
 	data = (*env)->GetByteArrayElements( env, jData, &isCopy);
 	len = (*env)->GetArrayLength( env, jData);
 
-	XChangeProperty( X->dsp,
-					 X->event.xselectionrequest.requestor,
-					 X->event.xselectionrequest.property,
-					 X->event.xselectionrequest.target,
+	XChangeProperty( tk->dsp,
+					 tk->event.xselectionrequest.requestor,
+					 tk->event.xselectionrequest.property,
+					 tk->event.xselectionrequest.target,
 					 8, PropModeReplace, data, len);
 
 	(*env)->ReleaseByteArrayElements( env, jData, data, JNI_ABORT);
-	e.xselection.property  = X->event.xselectionrequest.property;
+	e.xselection.property  = tk->event.xselectionrequest.property;
   }
   else {
 	e.xselection.property  = None;  /* format not supported */
   }
 
   e.xselection.type      = SelectionNotify;
-  e.xselection.requestor = X->event.xselectionrequest.requestor;
-  e.xselection.selection = X->event.xselectionrequest.selection;
+  e.xselection.requestor = tk->event.xselectionrequest.requestor;
+  e.xselection.selection = tk->event.xselectionrequest.selection;
   e.xselection.target    = target;
-  e.xselection.time      = X->event.xselectionrequest.time;
+  e.xselection.time      = tk->event.xselectionrequest.time;
 
-  XSendEvent( X->dsp, e.xselection.requestor, False, 0, &e);
+  XSendEvent( tk->dsp, e.xselection.requestor, False, 0, &e);
 
   return 0; /* don't pass event to Java */
 }
@@ -95,24 +95,24 @@
  *    length of *pData otherwise
  */
 static int
-getRawData ( Toolkit* X, Atom target, unsigned char** pData )
+getRawData ( Toolkit* tk, Atom target, unsigned char** pData )
 {
   int              i, format;
   unsigned long    len = 8191, remain = 1;
   Atom             type;
   XEvent           e;
 
-  XConvertSelection( X->dsp, XA_PRIMARY, target, SELECTION_DATA, X->cbdOwner, CurrentTime);
+  XConvertSelection( tk->dsp, XA_PRIMARY, target, SELECTION_DATA, tk->cbdOwner, CurrentTime);
 
   for ( i=0; i<2; i++ ) {
-	XSync( X->dsp, False);
-	if ( XCheckTypedWindowEvent( X->dsp, X->cbdOwner, SelectionNotify, &e) ){
+	XSync( tk->dsp, False);
+	if ( XCheckTypedWindowEvent( tk->dsp, tk->cbdOwner, SelectionNotify, &e) ){
 	  if ( e.xselection.property == None )  /* target type not supported by owner */
 		return 0;
 
 	  while ( remain ) {
 		len += remain;
-		XGetWindowProperty( X->dsp, X->cbdOwner, SELECTION_DATA, 0, len, False,
+		XGetWindowProperty( tk->dsp, tk->cbdOwner, SELECTION_DATA, 0, len, False,
 							AnyPropertyType, &type, &format, &len, &remain, pData);
 	  }
 	  return len;
Index: kaffe/libraries/clib/awt/X/fnt.c
diff -u kaffe/libraries/clib/awt/X/fnt.c:1.13 kaffe/libraries/clib/awt/X/fnt.c:1.14
--- kaffe/libraries/clib/awt/X/fnt.c:1.13	Mon Mar 15 17:54:47 2004
+++ kaffe/libraries/clib/awt/X/fnt.c	Fri Mar 26 22:58:43 2004
@@ -65,7 +65,7 @@
  */
 
 #ifdef KAFFE_I18N
-XOC create_xoc(Toolkit *X,char *font_name)
+static XOC create_xoc(Toolkit *X,char *font_name)
 {
   XOC xoc;
   int i;
@@ -191,152 +191,124 @@
  */
 
 #ifdef KAFFE_I18N
-void *
-Java_java_awt_Toolkit_fntInitFontMetrics ( JNIEnv* env, jclass clazz, void* xoc )
+KAFFE_FONT_FUNC_DECL( void *, Java_java_awt_Toolkit_fntInitFontMetrics )
 {
   return xoc;
 }
 
-void
-Java_java_awt_Toolkit_fntFreeFontMetrics ( JNIEnv* env, jclass clazz, XOC xoc )
+KAFFE_FONT_FUNC_DECL( void, Java_java_awt_Toolkit_fntFreeFontMetrics )
 {
 }
 
-jint
-Java_java_awt_Toolkit_fntGetAscent ( JNIEnv* env, jclass clazz, XOC xoc )
+KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetAscent )
 {
   return -XExtentsOfFontSet(xoc)->max_logical_extent.y;	
 }
 
-jint
-Java_java_awt_Toolkit_fntGetDescent ( JNIEnv* env, jclass clazz, XOC xoc )
+KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetDescent )
 {
   XFontSetExtents *xfse=XExtentsOfFontSet(xoc);
   return xfse->max_logical_extent.height-(-xfse->max_logical_extent.y);
 }
 
-jint
-Java_java_awt_Toolkit_fntGetFixedWidth ( JNIEnv* env, jclass clazz, XOC xoc )
+KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetFixedWidth )
 {
   XFontSetExtents *xfse=XExtentsOfFontSet(xoc);
   return ( xfse->max_logical_extent.width == xfse->max_ink_extent.width ) ?
 	  xfse->max_logical_extent.width : 0;
 }
 
-jint
-Java_java_awt_Toolkit_fntGetHeight ( JNIEnv* env, jclass clazz, XOC xoc )
+KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetHeight )
 {
   return XExtentsOfFontSet(xoc)->max_logical_extent.height;
 }
 
-jint
-Java_java_awt_Toolkit_fntGetLeading ( JNIEnv* env, jclass clazz, XOC xoc )
+KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetLeading )
 {
   return 0;  /* no leading (interline spacing) for X fonts */
 }
 
-jint
-Java_java_awt_Toolkit_fntGetMaxAdvance ( JNIEnv* env, jclass clazz, XOC xoc )
+KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetMaxAdvance )
 {
   return XExtentsOfFontSet(xoc)->max_logical_extent.width;
 }
 
-jint
-Java_java_awt_Toolkit_fntGetMaxAscent ( JNIEnv* env, jclass clazz, XOC xoc )
+KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetMaxAscent )
 {
   XFontSetExtents *xfse=XExtentsOfFontSet(xoc);
   return -xfse->max_logical_extent.y;
 }
 
-jint
-Java_java_awt_Toolkit_fntGetMaxDescent ( JNIEnv* env, jclass clazz, XOC xoc )
+KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetMaxDescent )
 {
   XFontSetExtents *xfse=XExtentsOfFontSet(xoc);
   return xfse->max_logical_extent.height-(-xfse->max_logical_extent.y);
 }
 
-jboolean
-Java_java_awt_Toolkit_fntIsWideFont ( JNIEnv* env, jclass clazz, XOC xoc )
+KAFFE_FONT_FUNC_DECL( jboolean, Java_java_awt_Toolkit_fntIsWideFont )
 {
   return 2; /* We assume that wide font is double-wide. */
 }
 
 #else
 
-void*
-Java_java_awt_Toolkit_fntInitFontMetrics ( JNIEnv* env, jclass clazz, void* fs )
+KAFFE_FONT_FUNC_DECL( void *, Java_java_awt_Toolkit_fntInitFontMetrics )
 {
   return fs;
 }
 
-void
-Java_java_awt_Toolkit_fntFreeFontMetrics ( JNIEnv* env, jclass clazz, XFontStruct* fs )
+KAFFE_FONT_FUNC_DECL( void, Java_java_awt_Toolkit_fntFreeFontMetrics 
 {
 }
 
-
-jint
-Java_java_awt_Toolkit_fntGetAscent ( JNIEnv* env, jclass clazz, XFontStruct* fs )
+KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetAscent )
 {
   return fs->ascent;
 }
 
-jint
-Java_java_awt_Toolkit_fntGetDescent ( JNIEnv* env, jclass clazz, XFontStruct* fs )
+KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetDescent )
 {
   return fs->descent;
 }
 
-jint
-Java_java_awt_Toolkit_fntGetFixedWidth ( JNIEnv* env, jclass clazz, XFontStruct* fs )
+KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetFixedWidth 
 {
   return (fs->min_bounds.width == fs->max_bounds.width) ? fs->max_bounds.width : 0;
 }
 
-jint
-Java_java_awt_Toolkit_fntGetHeight ( JNIEnv* env, jclass clazz, XFontStruct* fs )
+KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetHeight )
 {
   return fs->ascent + fs->descent +1;
 }
 
-jint
-Java_java_awt_Toolkit_fntGetLeading ( JNIEnv* env, jclass clazz, XFontStruct* fs )
+KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetLeading )
 {
   return 0;  /* no leading (interline spacing) for X fonts */
 }
 
-jint
-Java_java_awt_Toolkit_fntGetMaxAdvance ( JNIEnv* env, jclass clazz, XFontStruct* fs )
+KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetMaxAdvance )
 {
   return fs->max_bounds.width;
 }
 
-jint
-Java_java_awt_Toolkit_fntGetMaxAscent ( JNIEnv* env, jclass clazz, XFontStruct* fs )
+KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetMaxAscent )
 {
   return fs->max_bounds.ascent;
 }
 
-jint
-Java_java_awt_Toolkit_fntGetMaxDescent ( JNIEnv* env, jclass clazz, XFontStruct* fs )
+KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetMaxDescent )
 {
   return fs->max_bounds.descent;
 }
 
-jboolean
-Java_java_awt_Toolkit_fntIsWideFont ( JNIEnv* env, jclass clazz, XFontStruct* fs )
+KAFFE_FONT_FUNC_DECL( jboolean, Java_java_awt_Toolkit_fntIsWideFont )
 {
   return (fs->min_byte1 | fs->max_byte1);
 }
 
 #endif
 
-jobject
-#ifdef KAFFE_I18N
-Java_java_awt_Toolkit_fntGetWidths ( JNIEnv* env, jclass clazz, XOC xoc )
-#else
-Java_java_awt_Toolkit_fntGetWidths ( JNIEnv* env, jclass clazz, XFontStruct* fs )
-#endif	
+KAFFE_FONT_FUNC_DECL( jobject, Java_java_awt_Toolkit_fntGetWidths )
 {
   jintArray widths;
   jint      *jw;
@@ -384,14 +356,7 @@
 }
 
 
-jint
-#ifdef KAFFE_I18N
-Java_java_awt_Toolkit_fntBytesWidth ( JNIEnv* env, jclass clazz,
-        XOC xoc, jbyteArray jBytes, jint off, jint len )
-#else
-Java_java_awt_Toolkit_fntBytesWidth ( JNIEnv* env, jclass clazz,
-	XFontStruct* fs, jbyteArray jBytes, jint off, jint len )
-#endif
+KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntBytesWidth, jbyteArray jBytes, jint off, jint len )
 {
   jboolean  isCopy;
   jbyte    *jb = (*env)->GetByteArrayElements( env, jBytes, &isCopy);
@@ -432,13 +397,7 @@
 #endif  
 }
 
-jint
-#ifdef KAFFE_I18N
-Java_java_awt_Toolkit_fntCharWidth ( JNIEnv* env, jclass clazz, 
-	XOC xoc, jchar jChar )
-#else	
-Java_java_awt_Toolkit_fntCharWidth ( JNIEnv* env, jclass clazz, XFontStruct* fs, jchar jChar )
-#endif	
+KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntCharWidth, jchar jChar )
 {
 #ifdef KAFFE_I18N
   wchar_t wch;
@@ -464,14 +423,7 @@
 #endif  
 }
 
-jint
-#ifdef KAFFE_I18N
-Java_java_awt_Toolkit_fntCharsWidth ( JNIEnv* env, jclass clazz,
-	XOC xoc, jcharArray jChars, jint off, jint len )
-#else
-Java_java_awt_Toolkit_fntCharsWidth ( JNIEnv* env, jclass clazz,		
-	XFontStruct* fs, jcharArray jChars, jint off, jint len )
-#endif
+KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntCharsWidth, jcharArray jChars, jint off, jint len )
 {
   jboolean  isCopy;
   jchar    *jc = (*env)->GetCharArrayElements( env, jChars, &isCopy);
@@ -524,13 +476,7 @@
 #endif  
 }
 
-jint
-#ifdef KAFFE_I18N
-Java_java_awt_Toolkit_fntStringWidth ( JNIEnv* env, jclass clazz, 
-	XOC xoc, jstring jStr )
-#else
-Java_java_awt_Toolkit_fntStringWidth ( JNIEnv* env, jclass clazz, XFontStruct* fs, jstring jStr )
-#endif	
+KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntStringWidth, jstring jStr )
 {
   jboolean isCopy;
   const jchar    *jc = (*env)->GetStringChars( env, jStr, &isCopy);
Index: kaffe/libraries/clib/awt/X/toolkit.h
diff -u kaffe/libraries/clib/awt/X/toolkit.h:1.27 kaffe/libraries/clib/awt/X/toolkit.h:1.28
--- kaffe/libraries/clib/awt/X/toolkit.h:1.27	Fri Mar  5 17:12:35 2004
+++ kaffe/libraries/clib/awt/X/toolkit.h	Fri Mar 26 22:58:43 2004
@@ -255,7 +255,7 @@
   return adr;
 }
 
-static inline void* _awt_calloc_wrapper ( int n, size_t size )
+static inline void* _awt_calloc_wrapper ( size_t n, size_t size )
 {
   void *adr;
   enterUnsafeRegion();
@@ -289,51 +289,51 @@
  */
 
 
-static inline char* java2CString ( JNIEnv *env, Toolkit* X, jstring jstr ) {
+static inline char* java2CString ( JNIEnv *env, Toolkit* tk, jstring jstr ) {
   jboolean isCopy;
-  register int i;
-  int      n = (*env)->GetStringLength( env, jstr);
+  register unsigned int i;
+  jsize n = (*env)->GetStringLength( env, jstr);
   const jchar    *jc = (*env)->GetStringChars( env, jstr, &isCopy);
 
-  if ( n >= X->nBuf ) {
-	if ( X->buf )
-	  AWT_FREE( X->buf);
-	X->buf = AWT_MALLOC( n+1);
-	X->nBuf = n+1;
+  if ( n >= tk->nBuf ) {
+	if ( tk->buf )
+	  AWT_FREE( tk->buf);
+	tk->buf = AWT_MALLOC( n+1);
+	tk->nBuf = n+1;
   }
 
-  for ( i=0; i<n; i++ ) X->buf[i] = (char) jc[i];
-  X->buf[i] = 0;
+  for ( i=0; i<n; i++ ) tk->buf[i] = (char) jc[i];
+  tk->buf[i] = 0;
   (*env)->ReleaseStringChars( env, jstr, jc);
 
-  return X->buf;
+  return tk->buf;
 }
 
-static inline char* jchar2CString ( Toolkit* X, jchar* jc, int len ) {
-  register int i;
-  int      n = len+1;
+static inline char* jchar2CString ( Toolkit* tk, jchar* jc, size_t len ) {
+  register size_t i;
+  size_t  n = len+1;
   
-  if ( n > X->nBuf ) {
-	if ( X->buf )
-	  AWT_FREE( X->buf);
-	X->buf  = AWT_MALLOC( n);
-	X->nBuf = n;
+  if ( n > tk->nBuf ) {
+	if ( tk->buf )
+	  AWT_FREE( tk->buf);
+	tk->buf  = AWT_MALLOC( n);
+	tk->nBuf = n;
   }
 
-  for ( i=0; i<len; i++ ) X->buf[i] = (char) jc[i];
-  X->buf[i] = 0;
+  for ( i=0; i<len; i++ ) tk->buf[i] = (char) jc[i];
+  tk->buf[i] = 0;
 
-  return X->buf;
+  return tk->buf;
 }
 
-static inline void* getBuffer ( Toolkit* X, unsigned int nBytes ) {
-  if ( nBytes > X->nBuf ) {
-	if ( X->buf )
-	  AWT_FREE( X->buf);
-	X->buf  = AWT_MALLOC( nBytes);
-	X->nBuf = nBytes;
+static inline void* getBuffer ( Toolkit* tk, unsigned int nBytes ) {
+  if ( nBytes > tk->nBuf ) {
+	if ( tk->buf )
+	  AWT_FREE( tk->buf);
+	tk->buf  = AWT_MALLOC( nBytes);
+	tk->nBuf = nBytes;
   }
-  return X->buf;
+  return tk->buf;
 }
 
 #ifdef KAFFE_I18N
@@ -371,9 +371,9 @@
 #define CM_DIRECT       4
 #define CM_GENERIC      5  /* grays, DirectColor (packed) etc. */
 
-int needsFullAlpha ( Toolkit* X, Image *img, double threshold );
+int needsFullAlpha ( Toolkit* tk, Image *img, double threshold );
 
-void initColorMapping ( JNIEnv* env, jclass clazz, Toolkit* X);
+void initColorMapping ( JNIEnv* env, jclass clazz, Toolkit* tk);
 jlong Java_java_awt_Toolkit_clrBright ( JNIEnv* env, jclass clazz, jint rgb );
 jlong Java_java_awt_Toolkit_clrDark ( JNIEnv* env, jclass clazz, jint rgb );
 
@@ -404,28 +404,28 @@
 
 
 static inline jint
-pixelValue ( Toolkit* X, jint rgb )
+pixelValue ( Toolkit* tk, jint rgb )
 {
   int      r,g,b;
   XColor   xclr;
 
-  switch ( X->colorMode ) {
+  switch ( tk->colorMode ) {
   case CM_PSEUDO_256:
-	return X->pclr->pix [JI8(JRED(rgb))] [JI8(JGREEN(rgb))] [JI8(JBLUE(rgb))];
+	return tk->pclr->pix [JI8(JRED(rgb))] [JI8(JGREEN(rgb))] [JI8(JBLUE(rgb))];
 
   case CM_TRUE:
-	SIGNED_RSHIFT( b, (rgb & X->tclr->blueMask), X->tclr->blueShift);
-	SIGNED_RSHIFT( g, (rgb & X->tclr->greenMask), X->tclr->greenShift);
-	SIGNED_RSHIFT( r, (rgb & X->tclr->redMask), X->tclr->redShift);
+	SIGNED_RSHIFT( b, (rgb & tk->tclr->blueMask), tk->tclr->blueShift);
+	SIGNED_RSHIFT( g, (rgb & tk->tclr->greenMask), tk->tclr->greenShift);
+	SIGNED_RSHIFT( r, (rgb & tk->tclr->redMask), tk->tclr->redShift);
 	return ( b | g | r );
 
   case CM_TRUE_888:
 	return (rgb & 0xffffff);
 
   case CM_DIRECT:
-	return (((jint)X->dclr->redPix[JRED(rgb)]     << X->dclr->redShift) |
-			((jint)X->dclr->greenPix[JGREEN(rgb)] << X->dclr->greenShift) |
-			((jint)X->dclr->bluePix[JBLUE(rgb)]   << X->dclr->blueShift));
+	return (((jint)tk->dclr->redPix[JRED(rgb)]     << tk->dclr->redShift) |
+			((jint)tk->dclr->greenPix[JGREEN(rgb)] << tk->dclr->greenShift) |
+			((jint)tk->dclr->bluePix[JBLUE(rgb)]   << tk->dclr->blueShift));
 
   default:
 	/*
@@ -436,36 +436,36 @@
 	xclr.green = (rgb & 0xff00);
 	xclr.blue = (rgb & 0xff) << 8;
 	xclr.flags = DoRed | DoGreen | DoBlue;
-	XAllocColor( X->dsp, DefaultColormapOfScreen( DefaultScreenOfDisplay( X->dsp)), &xclr);
+	XAllocColor( tk->dsp, DefaultColormapOfScreen( DefaultScreenOfDisplay( tk->dsp)), &xclr);
 	return xclr.pixel;
   }
 }
 
 static inline void
-rgbValues ( Toolkit* X, unsigned long pixel, int* r, int* g, int* b )
+rgbValues ( Toolkit* tk, unsigned long pixel, int* r, int* g, int* b )
 {
   Visual         *v;
   XColor         xclr;
 
-  switch ( X->colorMode ) {
+  switch ( tk->colorMode ) {
   case CM_PSEUDO_256:
-	*r = X->pclr->rgb[(unsigned char)pixel].r;
-	*g = X->pclr->rgb[(unsigned char)pixel].g;
-	*b = X->pclr->rgb[(unsigned char)pixel].b;
+	*r = tk->pclr->rgb[(unsigned char)pixel].r;
+	*g = tk->pclr->rgb[(unsigned char)pixel].g;
+	*b = tk->pclr->rgb[(unsigned char)pixel].b;
 	break;
 
   case CM_TRUE:
-	v = DefaultVisual( X->dsp, DefaultScreen( X->dsp));
-	SIGNED_LSHIFT( *r, (pixel & v->red_mask), X->tclr->redShift);
-	SIGNED_LSHIFT( *g, (pixel & v->green_mask), X->tclr->greenShift);
-	SIGNED_LSHIFT( *b, (pixel & v->blue_mask), X->tclr->blueShift);
+	v = DefaultVisual( tk->dsp, DefaultScreen( tk->dsp));
+	SIGNED_LSHIFT( *r, (pixel & v->red_mask), tk->tclr->redShift);
+	SIGNED_LSHIFT( *g, (pixel & v->green_mask), tk->tclr->greenShift);
+	SIGNED_LSHIFT( *b, (pixel & v->blue_mask), tk->tclr->blueShift);
 	*r >>= 16;
 	*g >>= 8;
 	break;
 /*
-	*r = ((pixel & v->red_mask)   << X->tclr->redShift)   >> 16;
-	*g = ((pixel & v->green_mask) << X->tclr->greenShift) >> 8;
-	*b = ((pixel & v->blue_mask)  << X->tclr->blueShift);
+	*r = ((pixel & v->red_mask)   << tk->tclr->redShift)   >> 16;
+	*g = ((pixel & v->green_mask) << tk->tclr->greenShift) >> 8;
+	*b = ((pixel & v->blue_mask)  << tk->tclr->blueShift);
 	break;
 */
   case CM_TRUE_888:
@@ -475,10 +475,10 @@
 	break;
 
   case CM_DIRECT:
-	v = DefaultVisual( X->dsp, DefaultScreen( X->dsp));
-	*r = X->dclr->red[   ((pixel & v->red_mask) >> X->dclr->redShift) ];
-	*g = X->dclr->green[ ((pixel & v->green_mask) >> X->dclr->greenShift) ];
-	*b = X->dclr->blue[  ((pixel & v->blue_mask) >> X->dclr->blueShift) ];
+	v = DefaultVisual( tk->dsp, DefaultScreen( tk->dsp));
+	*r = tk->dclr->red[   ((pixel & v->red_mask) >> tk->dclr->redShift) ];
+	*g = tk->dclr->green[ ((pixel & v->green_mask) >> tk->dclr->greenShift) ];
+	*b = tk->dclr->blue[  ((pixel & v->blue_mask) >> tk->dclr->blueShift) ];
 	break;
 
   default:
@@ -487,7 +487,7 @@
 	 * slow (esp. for images) because XAllocColor is a roundtrip
 	 */
 	xclr.pixel = pixel;
-	XQueryColor( X->dsp, DefaultColormapOfScreen( DefaultScreenOfDisplay( X->dsp)), &xclr);
+	XQueryColor( tk->dsp, DefaultColormapOfScreen( DefaultScreenOfDisplay( tk->dsp)), &xclr);
 	*r = xclr.red >> 8;
 	*g = xclr.green >> 8;
 	*b = xclr.blue >> 8;
@@ -501,12 +501,11 @@
  * image functions
  */
 
-int needsFullAlpha(Toolkit*, Image*, double);
 Image* createImage ( int width, int height);
-void createXMaskImage ( Toolkit* X, Image* img );
-void createXImage ( Toolkit* X, Image* img );
-void createAlphaImage ( Toolkit* X, Image* img );
-void initScaledImage ( Toolkit* X, Image *tgt, Image *src,
+void createXMaskImage ( Toolkit* tk, Image* img );
+void createXImage ( Toolkit* tk, Image* img );
+void createAlphaImage ( Toolkit* tk, Image* img );
+void initScaledImage ( Toolkit* tk, Image *tgt, Image *src,
 					   int dx0, int dy0, int dx1, int dy1,
 					   int sx0, int sy0, int sx1, int sy1 );
 void Java_java_awt_Toolkit_imgFreeImage( JNIEnv* env, jclass clazz, Image * img);
@@ -528,8 +527,8 @@
  * clipboard functions
  */
 
-jobject selectionClear ( JNIEnv* env, Toolkit* X );
-jobject selectionRequest ( JNIEnv* env, Toolkit* X );
+jobject selectionClear ( JNIEnv* env, Toolkit* tk );
+jobject selectionRequest ( JNIEnv* env, Toolkit* tk );
 
 
 /*****************************************************************************************
@@ -566,7 +565,7 @@
 #define WND_MAPPED     0x08
 #define WND_DESTROYED  0x10
 
-static inline int getFreeSourceIdx ( Toolkit* X, Window wnd ) {
+static inline int getFreeSourceIdx ( Toolkit* tk, Window wnd ) {
   register int i, n;
 
   /*
@@ -574,11 +573,11 @@
    * (window IDs usually already are hashed, so it does not make sense to
    * hash them again - we just could make it worse
    */
-  for ( i = (unsigned long)wnd, n=0; n < X->nWindows; i++, n++ ) {
-	i %= X->nWindows;
-	if ( (int)(X->windows[i].w) <= 0 ) {
-	  X->srcIdx = i;
-	  X->lastWindow = wnd;
+  for ( i = (unsigned long)wnd, n=0; n < tk->nWindows; i++, n++ ) {
+	i %= tk->nWindows;
+	if ( (int)(tk->windows[i].w) <= 0 ) {
+	  tk->srcIdx = i;
+	  tk->lastWindow = wnd;
 
 	  return i;
 	}
@@ -587,7 +586,7 @@
   return -1;
 }
 
-static inline int getSourceIdx ( Toolkit* X, Window w )
+static inline int getSourceIdx ( Toolkit* tk, Window w )
 {
   int      n;
   register int i;
@@ -596,14 +595,14 @@
 	return X->srcIdx;
   }
   else {
-	for ( i = (unsigned long) w, n=0; n < X->nWindows; i++, n++ ) {
-	  i %= X->nWindows;
-	  if ( X->windows[i].w == w ){
-		X->srcIdx = i;
-		X->lastWindow = w;
-		return X->srcIdx;
+	for ( i = (unsigned long) w, n=0; n < tk->nWindows; i++, n++ ) {
+	  i %= tk->nWindows;
+	  if ( tk->windows[i].w == w ){
+		tk->srcIdx = i;
+		tk->lastWindow = w;
+		return tk->srcIdx;
 	  }
-	  else if ( X->windows[i].w == 0 ){
+	  else if ( tk->windows[i].w == 0 ){
 		return -1;
 	  }
 	}
@@ -611,9 +610,9 @@
   }
 }
 
-static inline int checkSource ( Toolkit* X, int idx )
+static inline int checkSource ( Toolkit* tk, int idx )
 {
-  return ( (idx >= 0) && (idx < X->nWindows) && (X->windows[idx].w) );
+  return ( (idx >= 0) && (idx < tk->nWindows) && (tk->windows[idx].w) );
 }
 
 
@@ -625,10 +624,10 @@
 #define FWD_CLEAR  1  /* reset focus forwarding */
 #define FWD_REVERT 2  /* reset focus on owner */
 
-static inline void resetFocusForwarding ( Toolkit* X )
+static inline void resetFocusForwarding ( Toolkit* tk )
 {
-  X->fwdIdx = -1;
-  X->focusFwd = 0;
+  tk->fwdIdx = -1;
+  tk->focusFwd = 0;
 }
 
 
@@ -639,5 +638,57 @@
  */
 
 #define	USE_POLLING_AWT	1
+
+/* Clipboard */
+
+typedef void ClipBoard;
+extern jobject Java_java_awt_Toolkit_cbdInitClipboard ( JNIEnv* env, jclass clazz );
+extern void Java_java_awt_Toolkit_cbdFreeClipboard ( JNIEnv* env, jclass clazz, ClipBoard* cbd );
+extern jboolean Java_java_awt_Toolkit_cbdSetOwner ( JNIEnv* env, jclass clazz, ClipBoard* cbd );
+extern jobject Java_java_awt_Toolkit_cbdGetContents ( JNIEnv* env, jclass clazz, ClipBoard* cbd );
+
+/* Color */
+
+extern jint Java_java_awt_Toolkit_clrGetPixelValue ( JNIEnv* env, jclass clazz, jint rgb );
+extern void Java_java_awt_Toolkit_clrSetSystemColors ( JNIEnv* env, jclass clazz, jintArray sysClrs );
+extern jobject Java_java_awt_Toolkit_clrGetColorModel ( JNIEnv* env, jclass clazz );
+
+/* Event */
+
+extern jobject Java_java_awt_Toolkit_evtInit ( JNIEnv* env, jclass clazz );
+extern jobject Java_java_awt_Toolkit_evtGetNextEvent ( JNIEnv* env, jclass clazz );
+extern jobject Java_java_awt_Toolkit_evtPeekEvent ( JNIEnv* env, jclass clazz );
+extern jobject Java_java_awt_Toolkit_evtPeekEventId ( JNIEnv* env, jclass clazz, jint id );
+extern void Java_java_awt_Toolkit_evtWakeup ( JNIEnv* env, jclass clazz );
+extern void Java_java_awt_Toolkit_evtSendWMEvent ( JNIEnv* env, jclass clazz, jobject wmEvt );
+extern jint Java_java_awt_Toolkit_evtRegisterSource ( JNIEnv* env, jclass clazz, Window wnd );
+extern jint Java_java_awt_Toolkit_evtUnregisterSource ( JNIEnv* env, jclass clazz, Window wnd );
+
+/* Font */
+extern void* Java_java_awt_Toolkit_fntInitFont ( JNIEnv* env, jclass clazz, jstring jSpec, jint style, jint size );
+
+#ifdef KAFFE_I18N
+#define KAFFE_FONT_FUNC_DECL( ret, name, args... ) ret name( JNIEnv* env, jclass clazz, XOC xoc, ## args )
+#else
+#define KAFFE_FONT_FUNC_DECL( ret, name, args... ) ret name( JNIEnv* env, jclass clazz, XFontStruct* fs, ## args )
+#endif
+
+extern KAFFE_FONT_FUNC_DECL( void, Java_java_awt_Toolkit_fntFreeFont );
+extern KAFFE_FONT_FUNC_DECL( void *, Java_java_awt_Toolkit_fntInitFontMetrics );
+extern KAFFE_FONT_FUNC_DECL( void, Java_java_awt_Toolkit_fntFreeFontMetrics );
+extern KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetAscent );
+extern KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetDescent );
+extern KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetFixedWidth );
+extern KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetHeight );
+extern KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetLeading );
+extern KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetMaxAdvance );
+extern KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetMaxAscent );
+extern KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntGetMaxDescent );
+extern KAFFE_FONT_FUNC_DECL( jboolean, Java_java_awt_Toolkit_fntIsWideFont );
+extern KAFFE_FONT_FUNC_DECL( jobject, Java_java_awt_Toolkit_fntGetWidths );
+extern KAFFE_FONT_FUNC_DECL( jint, Java_java_awt_Toolkit_fntBytesWidth, jbyteArray jBytes, jint off, jint len );

*** Patch too long, truncated ***