--- tomcat-connectors-1.2.27-src/native/jni/jk_jnicb.c.orig	2008-12-03 10:28:03.000000000 -0500
+++ tomcat-connectors-1.2.27-src/native/jni/jk_jnicb.c	2008-12-03 10:33:37.000000000 -0500
@@ -35,10 +35,15 @@ JNIEXPORT jint JNICALL
     Java_org_apache_tomcat_modules_server_JNIConnectionHandler_getNumberOfHeaders
     (JNIEnv * env, jobject o, jlong s, jlong l)
 {
+#if SIZEOF_VOID_P == 8
+    jk_ws_service_t *ps = (jk_ws_service_t *)s;
+    jk_logger_t *pl = (jk_logger_t *)l;
+#else
     /* [V] Convert indirectly from jlong -> int -> pointer to shut up gcc */
     /*     I hope it's okay on other compilers and/or machines...         */
     jk_ws_service_t *ps = (jk_ws_service_t *)(int)s;
     jk_logger_t *pl = (jk_logger_t *)(int)l;
+#endif
 
     jk_log(pl, JK_LOG_DEBUG,
            "Into JNIConnectionHandler::getNumberOfHeaders\n");
@@ -66,8 +71,13 @@ JNIEXPORT jint JNICALL
     (JNIEnv * env, jobject o, jlong s, jlong l, jbyteArray buf, jint from,
      jint cnt)
 {
+#if SIZEOF_VOID_P == 8
+    jk_ws_service_t *ps = (jk_ws_service_t *)s;
+    jk_logger_t *pl = (jk_logger_t *)l;
+#else
     jk_ws_service_t *ps = (jk_ws_service_t *)(int)s;
     jk_logger_t *pl = (jk_logger_t *)(int)l;
+#endif
     jint rc = -1;
     jboolean iscommit;
     jbyte *nbuf;
@@ -114,8 +124,13 @@ JNIEXPORT jint JNICALL
     Java_org_apache_tomcat_modules_server_JNIConnectionHandler_readEnvironment
     (JNIEnv * env, jobject o, jlong s, jlong l, jobjectArray envbuf)
 {
+#if SIZEOF_VOID_P == 8
+    jk_ws_service_t *ps = (jk_ws_service_t *)s;
+    jk_logger_t *pl = (jk_logger_t *)l;
+#else
     jk_ws_service_t *ps = (jk_ws_service_t *)(int)s;
     jk_logger_t *pl = (jk_logger_t *)(int)l;
+#endif
     char port[10];
 
     jk_log(pl, JK_LOG_DEBUG,
@@ -274,8 +289,13 @@ JNIEXPORT jint JNICALL
     (JNIEnv * env, jobject o, jlong s, jlong l, jobjectArray hnames,
      jobjectArray hvalues)
 {
+#if SIZEOF_VOID_P == 8
+    jk_ws_service_t *ps = (jk_ws_service_t *)s;
+    jk_logger_t *pl = (jk_logger_t *)l;
+#else
     jk_ws_service_t *ps = (jk_ws_service_t *)(int)s;
     jk_logger_t *pl = (jk_logger_t *)(int)l;
+#endif
     unsigned i;
 
     jk_log(pl, JK_LOG_DEBUG, "Into JNIConnectionHandler::readHeaders\n");
@@ -321,8 +341,13 @@ JNIEXPORT jint JNICALL
      jint sc, jstring msg, jobjectArray hnames, jobjectArray hvalues,
      jint hcnt)
 {
+#if SIZEOF_VOID_P == 8
+    jk_ws_service_t *ps = (jk_ws_service_t *)s;
+    jk_logger_t *pl = (jk_logger_t *)l;
+#else
     jk_ws_service_t *ps = (jk_ws_service_t *)(int)s;
     jk_logger_t *pl = (jk_logger_t *)(int)l;
+#endif
     const char *nmsg = NULL;
     char **nhnames = NULL;
     char **nhvalues = NULL;
@@ -457,8 +482,13 @@ JNIEXPORT jint JNICALL
     (JNIEnv * env, jobject o, jlong s, jlong l, jbyteArray buf, jint from,
      jint cnt)
 {
+#if SIZEOF_VOID_P == 8
+    jk_ws_service_t *ps = (jk_ws_service_t *)s;
+    jk_logger_t *pl = (jk_logger_t *)l;
+#else
     jk_ws_service_t *ps = (jk_ws_service_t *)(int)s;
     jk_logger_t *pl = (jk_logger_t *)(int)l;
+#endif
     jint rc = JK_FALSE;
     jboolean iscommit;
     jbyte *nbuf;
--- tomcat-connectors-1.2.27-src/native/common/jk_jni_worker.c.orig	2008-12-03 10:33:52.000000000 -0500
+++ tomcat-connectors-1.2.27-src/native/common/jk_jni_worker.c	2008-12-03 10:35:00.000000000 -0500
@@ -302,7 +302,7 @@ static int JK_METHOD service(jk_endpoint
                                     p->worker->jk_service_method,
                                     /* [V] For some reason gcc likes this pointer -> int -> jlong conversion, */
                                     /*     but not the direct pointer -> jlong conversion. I hope it's okay.  */
-#ifdef AS400
+#if SIZEOF_VOID_P == 8
                                     s, l
 #else
                                     (jlong) (int)s, (jlong) (int)l
