Merged with Kees Bakker's repo at https://bitbucket.org/keestux/sdl ...
authorRyan C. Gordon <icculus@icculus.org>
Tue, 18 Oct 2011 00:58:22 -0400
changeset 6014 7a8b72b88d86
parent 6013 b253cc3c4276 (current diff)
parent 6000 3c980a9f983c (diff)
child 6015 9ac7135ac3fb
Merged with Kees Bakker's repo at https://bitbucket.org/keestux/sdl ...
src/video/uikit/SDL_uikitvideo.m
src/video/uikit/SDL_uikitwindow.m
--- a/android-project/default.properties	Sun Oct 09 22:00:20 2011 +0200
+++ b/android-project/default.properties	Tue Oct 18 00:58:22 2011 -0400
@@ -8,4 +8,4 @@
 # project structure.
 
 # Project target.
-target=android-4
+target=android-5
--- a/android-project/src/org/libsdl/app/SDLActivity.java	Sun Oct 09 22:00:20 2011 +0200
+++ b/android-project/src/org/libsdl/app/SDLActivity.java	Tue Oct 18 00:58:22 2011 -0400
@@ -1,6 +1,8 @@
 package org.libsdl.app;
 
+import javax.microedition.khronos.egl.EGL10;
 import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.egl.EGLContext;
 import javax.microedition.khronos.opengles.GL10;
 import javax.microedition.khronos.egl.*;
 
@@ -93,7 +95,8 @@
     public static native void onNativeResize(int x, int y, int format);
     public static native void onNativeKeyDown(int keycode);
     public static native void onNativeKeyUp(int keycode);
-    public static native void onNativeTouch(int action, float x, 
+    public static native void onNativeTouch(int touchDevId, int pointerFingerId,
+                                            int action, float x, 
                                             float y, float p);
     public static native void onNativeAccel(float x, float y, float z);
     public static native void nativeRunAudioThread();
@@ -387,7 +390,13 @@
             }
             EGLConfig config = configs[0];
 
-            EGLContext ctx = egl.eglCreateContext(dpy, config, EGL10.EGL_NO_CONTEXT, null);
+            int EGL_CONTEXT_CLIENT_VERSION=0x3098;
+            int contextAttrs[] = new int[]
+            {
+                EGL_CONTEXT_CLIENT_VERSION, majorVersion,
+                EGL10.EGL_NONE
+            }; 
+            EGLContext ctx = egl.eglCreateContext(dpy, config, EGL10.EGL_NO_CONTEXT, contextAttrs);
             if (ctx == EGL10.EGL_NO_CONTEXT) {
                 Log.e("SDL", "Couldn't create context");
                 return false;
@@ -423,7 +432,7 @@
         try {
             EGL10 egl = (EGL10)EGLContext.getEGL();
 
-            egl.eglWaitNative(EGL10.EGL_NATIVE_RENDERABLE, null);
+            egl.eglWaitNative(EGL10.EGL_CORE_NATIVE_ENGINE, null);
 
             // drawing here
 
@@ -459,16 +468,34 @@
 
     // Touch events
     public boolean onTouch(View v, MotionEvent event) {
-    
-        int action = event.getAction();
-        float x = event.getX();
-        float y = event.getY();
-        float p = event.getPressure();
+        {
+             final int touchDevId = event.getDeviceId();
+             final int pointerCount = event.getPointerCount();
+             // touchId, pointerId, action, x, y, pressure
+             int actionPointerIndex = event.getActionIndex();
+             int pointerFingerId = event.getPointerId(actionPointerIndex);
+             int action = event.getActionMasked();
+
+             float x = event.getX(actionPointerIndex);
+             float y = event.getY(actionPointerIndex);
+             float p = event.getPressure(actionPointerIndex);
 
-        // TODO: Anything else we need to pass?        
-        SDLActivity.onNativeTouch(action, x, y, p);
-        return true;
-    }
+             if (action == MotionEvent.ACTION_MOVE && pointerCount > 1) {
+                // TODO send motion to every pointer if its position has
+                // changed since prev event.
+                for (int i = 0; i < pointerCount; i++) {
+                    pointerFingerId = event.getPointerId(i);
+                    x = event.getX(i);
+                    y = event.getY(i);
+                    p = event.getPressure(i);
+                    SDLActivity.onNativeTouch(touchDevId, pointerFingerId, action, x, y, p);
+                }
+             } else {
+                SDLActivity.onNativeTouch(touchDevId, pointerFingerId, action, x, y, p);
+             }
+        }
+      return true;
+   } 
 
     // Sensor events
     public void enableSensor(int sensortype, boolean enabled) {
--- a/configure.in	Sun Oct 09 22:00:20 2011 +0200
+++ b/configure.in	Tue Oct 18 00:58:22 2011 -0400
@@ -939,6 +939,41 @@
     fi
 }
 
+dnl See if GCC's -Wall is supported.
+CheckWarnAll()
+{
+    AC_MSG_CHECKING(for GCC -Wall option)
+    have_gcc_Wall=no
+
+    save_CFLAGS="$CFLAGS"
+    CFLAGS="$save_CFLAGS -Wall"
+    AC_TRY_COMPILE([
+    int x = 0;
+    ],[
+    ],[
+    have_gcc_Wall=yes
+    ])
+    AC_MSG_RESULT($have_gcc_Wall)
+    CFLAGS="$save_CFLAGS"
+
+    if test x$have_gcc_Wall = xyes; then
+        EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall"
+
+        dnl Haiku headers use multicharacter constants all over the place. Ignore these warnings when using -Wall.
+        AC_MSG_CHECKING(for necessary GCC -Wno-multichar option)
+        need_gcc_Wno_multichar=no
+        case "$host" in
+            *-*-beos* | *-*-haiku*)
+                need_gcc_Wno_multichar=yes
+                ;;
+        esac
+        AC_MSG_RESULT($need_gcc_Wno_multichar)
+        if test x$need_gcc_Wno_multichar = xyes; then
+            EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-multichar"
+        fi
+    fi
+}
+
 
 dnl Find the X11 include and library directories
 CheckX11()
@@ -2356,6 +2391,9 @@
         ;;
 esac
 
+dnl Do this on all platforms, after everything else.
+CheckWarnAll
+
 # Verify that we have all the platform specific files we need
 
 if test x$have_joystick != xyes; then
--- a/include/SDL_config_iphoneos.h	Sun Oct 09 22:00:20 2011 +0200
+++ b/include/SDL_config_iphoneos.h	Tue Oct 18 00:58:22 2011 -0400
@@ -140,6 +140,9 @@
 /* enable iPhone keyboard support */
 #define SDL_IPHONE_KEYBOARD 1
 
+/* enable joystick subsystem */
+#define SDL_JOYSTICK_DISABLED 0
+
 /* Set max recognized G-force from accelerometer
    See src/joystick/uikit/SDLUIAccelerationDelegate.m for notes on why this is needed
  */
--- a/include/SDL_rwops.h	Sun Oct 09 22:00:20 2011 +0200
+++ b/include/SDL_rwops.h	Tue Oct 18 00:58:22 2011 -0400
@@ -89,7 +89,6 @@
             void *fileNameRef;
             void *inputStream;
             void *inputStreamRef;
-            void *skipMethod;
             void *readableByteChannel;
             void *readableByteChannelRef;
             void *readMethod;
--- a/src/atomic/SDL_spinlock.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/atomic/SDL_spinlock.c	Tue Oct 18 00:58:22 2011 -0400
@@ -60,7 +60,8 @@
 
 #elif defined(__GNUC__) && defined(__arm__) && \
         (defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) || \
-         defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5TE__))
+         defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5TE__) || \
+         defined(__ARM_ARCH_5TEJ__))
     int result;
     __asm__ __volatile__ (
         "swp %0, %1, [%2]\n"
@@ -81,7 +82,7 @@
         : "=r" (result) : "r" (lock), "0" (1) : "cc", "memory");
 	return (result == 0);
 
-#elif defined(__MACOSX__)
+#elif defined(__MACOSX__) || defined(__IPHONEOS__)
     /* Maybe used for PowerPC, but the Intel asm or gcc atomics are favored. */
     return OSAtomicCompareAndSwap32Barrier(0, 1, lock);
 
--- a/src/audio/SDL_audiotypecvt.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/audio/SDL_audiotypecvt.c	Tue Oct 18 00:58:22 2011 -0400
@@ -7102,7 +7102,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_U8, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
@@ -7130,7 +7129,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_U8, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Uint8 *dst = (Uint8 *) cvt->buf;
     const Uint8 *src = (Uint8 *) cvt->buf;
@@ -7157,7 +7155,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_U8, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
@@ -7187,7 +7184,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_U8, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Uint8 *dst = (Uint8 *) cvt->buf;
     const Uint8 *src = (Uint8 *) cvt->buf;
@@ -7214,7 +7210,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_U8, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
@@ -7247,7 +7242,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_U8, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Uint8 *dst = (Uint8 *) cvt->buf;
     const Uint8 *src = (Uint8 *) cvt->buf;
@@ -7278,7 +7272,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_U8, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2;
@@ -7315,7 +7308,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_U8, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Uint8 *dst = (Uint8 *) cvt->buf;
     const Uint8 *src = (Uint8 *) cvt->buf;
@@ -7346,7 +7338,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_U8, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
@@ -7389,7 +7380,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_U8, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Uint8 *dst = (Uint8 *) cvt->buf;
     const Uint8 *src = (Uint8 *) cvt->buf;
@@ -7428,7 +7418,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_U8, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4;
@@ -7479,7 +7468,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_U8, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Uint8 *dst = (Uint8 *) cvt->buf;
     const Uint8 *src = (Uint8 *) cvt->buf;
@@ -7518,7 +7506,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_U8, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6;
@@ -7571,7 +7558,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_U8, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Uint8 *dst = (Uint8 *) cvt->buf;
     const Uint8 *src = (Uint8 *) cvt->buf;
@@ -7618,7 +7604,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_U8, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6;
@@ -7683,7 +7668,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_U8, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Uint8 *dst = (Uint8 *) cvt->buf;
     const Uint8 *src = (Uint8 *) cvt->buf;
@@ -7730,7 +7714,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_U8, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8;
@@ -7793,7 +7776,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_U8, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Uint8 *dst = (Uint8 *) cvt->buf;
     const Uint8 *src = (Uint8 *) cvt->buf;
@@ -7848,7 +7830,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_U8, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8;
     const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8;
@@ -7927,7 +7908,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_U8, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Uint8 *dst = (Uint8 *) cvt->buf;
     const Uint8 *src = (Uint8 *) cvt->buf;
@@ -7982,7 +7962,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S8, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
@@ -8010,7 +7989,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S8, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint8 *dst = (Sint8 *) cvt->buf;
     const Sint8 *src = (Sint8 *) cvt->buf;
@@ -8037,7 +8015,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S8, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
@@ -8067,7 +8044,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S8, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint8 *dst = (Sint8 *) cvt->buf;
     const Sint8 *src = (Sint8 *) cvt->buf;
@@ -8094,7 +8070,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S8, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2;
@@ -8127,7 +8102,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S8, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint8 *dst = (Sint8 *) cvt->buf;
     const Sint8 *src = (Sint8 *) cvt->buf;
@@ -8158,7 +8132,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S8, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2;
@@ -8195,7 +8168,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S8, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint8 *dst = (Sint8 *) cvt->buf;
     const Sint8 *src = (Sint8 *) cvt->buf;
@@ -8226,7 +8198,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S8, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4;
@@ -8269,7 +8240,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S8, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint8 *dst = (Sint8 *) cvt->buf;
     const Sint8 *src = (Sint8 *) cvt->buf;
@@ -8308,7 +8278,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S8, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4;
@@ -8359,7 +8328,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S8, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint8 *dst = (Sint8 *) cvt->buf;
     const Sint8 *src = (Sint8 *) cvt->buf;
@@ -8398,7 +8366,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S8, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6;
@@ -8451,7 +8418,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S8, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint8 *dst = (Sint8 *) cvt->buf;
     const Sint8 *src = (Sint8 *) cvt->buf;
@@ -8498,7 +8464,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S8, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6;
@@ -8563,7 +8528,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S8, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint8 *dst = (Sint8 *) cvt->buf;
     const Sint8 *src = (Sint8 *) cvt->buf;
@@ -8610,7 +8574,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S8, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8;
@@ -8673,7 +8636,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S8, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint8 *dst = (Sint8 *) cvt->buf;
     const Sint8 *src = (Sint8 *) cvt->buf;
@@ -8728,7 +8690,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S8, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8;
     const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8;
@@ -8807,7 +8768,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S8, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint8 *dst = (Sint8 *) cvt->buf;
     const Sint8 *src = (Sint8 *) cvt->buf;
@@ -8862,7 +8822,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
@@ -8890,7 +8849,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Uint16 *dst = (Uint16 *) cvt->buf;
     const Uint16 *src = (Uint16 *) cvt->buf;
@@ -8917,7 +8875,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
@@ -8947,7 +8904,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Uint16 *dst = (Uint16 *) cvt->buf;
     const Uint16 *src = (Uint16 *) cvt->buf;
@@ -8974,7 +8930,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
@@ -9007,7 +8962,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Uint16 *dst = (Uint16 *) cvt->buf;
     const Uint16 *src = (Uint16 *) cvt->buf;
@@ -9038,7 +8992,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
@@ -9075,7 +9028,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Uint16 *dst = (Uint16 *) cvt->buf;
     const Uint16 *src = (Uint16 *) cvt->buf;
@@ -9106,7 +9058,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
@@ -9149,7 +9100,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Uint16 *dst = (Uint16 *) cvt->buf;
     const Uint16 *src = (Uint16 *) cvt->buf;
@@ -9188,7 +9138,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
@@ -9239,7 +9188,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Uint16 *dst = (Uint16 *) cvt->buf;
     const Uint16 *src = (Uint16 *) cvt->buf;
@@ -9278,7 +9226,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
@@ -9331,7 +9278,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Uint16 *dst = (Uint16 *) cvt->buf;
     const Uint16 *src = (Uint16 *) cvt->buf;
@@ -9378,7 +9324,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
@@ -9443,7 +9388,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Uint16 *dst = (Uint16 *) cvt->buf;
     const Uint16 *src = (Uint16 *) cvt->buf;
@@ -9490,7 +9434,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
@@ -9553,7 +9496,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Uint16 *dst = (Uint16 *) cvt->buf;
     const Uint16 *src = (Uint16 *) cvt->buf;
@@ -9608,7 +9550,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
@@ -9687,7 +9628,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Uint16 *dst = (Uint16 *) cvt->buf;
     const Uint16 *src = (Uint16 *) cvt->buf;
@@ -9742,7 +9682,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
@@ -9770,7 +9709,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint16 *dst = (Sint16 *) cvt->buf;
     const Sint16 *src = (Sint16 *) cvt->buf;
@@ -9797,7 +9735,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
@@ -9827,7 +9764,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint16 *dst = (Sint16 *) cvt->buf;
     const Sint16 *src = (Sint16 *) cvt->buf;
@@ -9854,7 +9790,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
@@ -9887,7 +9822,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint16 *dst = (Sint16 *) cvt->buf;
     const Sint16 *src = (Sint16 *) cvt->buf;
@@ -9918,7 +9852,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
@@ -9955,7 +9888,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint16 *dst = (Sint16 *) cvt->buf;
     const Sint16 *src = (Sint16 *) cvt->buf;
@@ -9986,7 +9918,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
@@ -10029,7 +9960,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint16 *dst = (Sint16 *) cvt->buf;
     const Sint16 *src = (Sint16 *) cvt->buf;
@@ -10068,7 +9998,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
@@ -10119,7 +10048,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint16 *dst = (Sint16 *) cvt->buf;
     const Sint16 *src = (Sint16 *) cvt->buf;
@@ -10158,7 +10086,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
@@ -10211,7 +10138,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint16 *dst = (Sint16 *) cvt->buf;
     const Sint16 *src = (Sint16 *) cvt->buf;
@@ -10258,7 +10184,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
@@ -10323,7 +10248,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint16 *dst = (Sint16 *) cvt->buf;
     const Sint16 *src = (Sint16 *) cvt->buf;
@@ -10370,7 +10294,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
@@ -10433,7 +10356,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint16 *dst = (Sint16 *) cvt->buf;
     const Sint16 *src = (Sint16 *) cvt->buf;
@@ -10488,7 +10410,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
@@ -10567,7 +10488,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint16 *dst = (Sint16 *) cvt->buf;
     const Sint16 *src = (Sint16 *) cvt->buf;
@@ -10622,7 +10542,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
@@ -10650,7 +10569,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Uint16 *dst = (Uint16 *) cvt->buf;
     const Uint16 *src = (Uint16 *) cvt->buf;
@@ -10677,7 +10595,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
@@ -10707,7 +10624,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Uint16 *dst = (Uint16 *) cvt->buf;
     const Uint16 *src = (Uint16 *) cvt->buf;
@@ -10734,7 +10650,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
@@ -10767,7 +10682,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Uint16 *dst = (Uint16 *) cvt->buf;
     const Uint16 *src = (Uint16 *) cvt->buf;
@@ -10798,7 +10712,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2;
@@ -10835,7 +10748,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Uint16 *dst = (Uint16 *) cvt->buf;
     const Uint16 *src = (Uint16 *) cvt->buf;
@@ -10866,7 +10778,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
@@ -10909,7 +10820,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Uint16 *dst = (Uint16 *) cvt->buf;
     const Uint16 *src = (Uint16 *) cvt->buf;
@@ -10948,7 +10858,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4;
@@ -10999,7 +10908,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Uint16 *dst = (Uint16 *) cvt->buf;
     const Uint16 *src = (Uint16 *) cvt->buf;
@@ -11038,7 +10946,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
@@ -11091,7 +10998,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Uint16 *dst = (Uint16 *) cvt->buf;
     const Uint16 *src = (Uint16 *) cvt->buf;
@@ -11138,7 +11044,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6;
@@ -11203,7 +11108,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Uint16 *dst = (Uint16 *) cvt->buf;
     const Uint16 *src = (Uint16 *) cvt->buf;
@@ -11250,7 +11154,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
@@ -11313,7 +11216,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Uint16 *dst = (Uint16 *) cvt->buf;
     const Uint16 *src = (Uint16 *) cvt->buf;
@@ -11368,7 +11270,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8;
     const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8;
@@ -11447,7 +11348,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Uint16 *dst = (Uint16 *) cvt->buf;
     const Uint16 *src = (Uint16 *) cvt->buf;
@@ -11502,7 +11402,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
@@ -11530,7 +11429,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint16 *dst = (Sint16 *) cvt->buf;
     const Sint16 *src = (Sint16 *) cvt->buf;
@@ -11557,7 +11455,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
@@ -11587,7 +11484,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint16 *dst = (Sint16 *) cvt->buf;
     const Sint16 *src = (Sint16 *) cvt->buf;
@@ -11614,7 +11510,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
@@ -11647,7 +11542,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint16 *dst = (Sint16 *) cvt->buf;
     const Sint16 *src = (Sint16 *) cvt->buf;
@@ -11678,7 +11572,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2;
@@ -11715,7 +11608,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint16 *dst = (Sint16 *) cvt->buf;
     const Sint16 *src = (Sint16 *) cvt->buf;
@@ -11746,7 +11638,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
@@ -11789,7 +11680,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint16 *dst = (Sint16 *) cvt->buf;
     const Sint16 *src = (Sint16 *) cvt->buf;
@@ -11828,7 +11718,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4;
@@ -11879,7 +11768,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint16 *dst = (Sint16 *) cvt->buf;
     const Sint16 *src = (Sint16 *) cvt->buf;
@@ -11918,7 +11806,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
@@ -11971,7 +11858,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint16 *dst = (Sint16 *) cvt->buf;
     const Sint16 *src = (Sint16 *) cvt->buf;
@@ -12018,7 +11904,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6;
@@ -12083,7 +11968,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint16 *dst = (Sint16 *) cvt->buf;
     const Sint16 *src = (Sint16 *) cvt->buf;
@@ -12130,7 +12014,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
@@ -12193,7 +12076,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint16 *dst = (Sint16 *) cvt->buf;
     const Sint16 *src = (Sint16 *) cvt->buf;
@@ -12248,7 +12130,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8;
     const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8;
@@ -12327,7 +12208,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint16 *dst = (Sint16 *) cvt->buf;
     const Sint16 *src = (Sint16 *) cvt->buf;
@@ -12382,7 +12262,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
@@ -12410,7 +12289,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint32 *dst = (Sint32 *) cvt->buf;
     const Sint32 *src = (Sint32 *) cvt->buf;
@@ -12437,7 +12315,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
@@ -12467,7 +12344,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint32 *dst = (Sint32 *) cvt->buf;
     const Sint32 *src = (Sint32 *) cvt->buf;
@@ -12494,7 +12370,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
@@ -12527,7 +12402,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint32 *dst = (Sint32 *) cvt->buf;
     const Sint32 *src = (Sint32 *) cvt->buf;
@@ -12558,7 +12432,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
@@ -12595,7 +12468,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint32 *dst = (Sint32 *) cvt->buf;
     const Sint32 *src = (Sint32 *) cvt->buf;
@@ -12626,7 +12498,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
@@ -12669,7 +12540,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint32 *dst = (Sint32 *) cvt->buf;
     const Sint32 *src = (Sint32 *) cvt->buf;
@@ -12708,7 +12578,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
@@ -12759,7 +12628,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint32 *dst = (Sint32 *) cvt->buf;
     const Sint32 *src = (Sint32 *) cvt->buf;
@@ -12798,7 +12666,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
@@ -12851,7 +12718,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint32 *dst = (Sint32 *) cvt->buf;
     const Sint32 *src = (Sint32 *) cvt->buf;
@@ -12898,7 +12764,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
@@ -12963,7 +12828,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint32 *dst = (Sint32 *) cvt->buf;
     const Sint32 *src = (Sint32 *) cvt->buf;
@@ -13010,7 +12874,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
@@ -13073,7 +12936,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint32 *dst = (Sint32 *) cvt->buf;
     const Sint32 *src = (Sint32 *) cvt->buf;
@@ -13128,7 +12990,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
@@ -13207,7 +13068,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint32 *dst = (Sint32 *) cvt->buf;
     const Sint32 *src = (Sint32 *) cvt->buf;
@@ -13262,7 +13122,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
@@ -13290,7 +13149,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint32 *dst = (Sint32 *) cvt->buf;
     const Sint32 *src = (Sint32 *) cvt->buf;
@@ -13317,7 +13175,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1;
@@ -13347,7 +13204,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint32 *dst = (Sint32 *) cvt->buf;
     const Sint32 *src = (Sint32 *) cvt->buf;
@@ -13374,7 +13230,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
@@ -13407,7 +13262,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint32 *dst = (Sint32 *) cvt->buf;
     const Sint32 *src = (Sint32 *) cvt->buf;
@@ -13438,7 +13292,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2;
@@ -13475,7 +13328,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint32 *dst = (Sint32 *) cvt->buf;
     const Sint32 *src = (Sint32 *) cvt->buf;
@@ -13506,7 +13358,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
@@ -13549,7 +13400,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint32 *dst = (Sint32 *) cvt->buf;
     const Sint32 *src = (Sint32 *) cvt->buf;
@@ -13588,7 +13438,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4;
@@ -13639,7 +13488,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint32 *dst = (Sint32 *) cvt->buf;
     const Sint32 *src = (Sint32 *) cvt->buf;
@@ -13678,7 +13526,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
@@ -13731,7 +13578,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint32 *dst = (Sint32 *) cvt->buf;
     const Sint32 *src = (Sint32 *) cvt->buf;
@@ -13778,7 +13624,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6;
@@ -13843,7 +13688,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint32 *dst = (Sint32 *) cvt->buf;
     const Sint32 *src = (Sint32 *) cvt->buf;
@@ -13890,7 +13734,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
@@ -13953,7 +13796,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     Sint32 *dst = (Sint32 *) cvt->buf;
     const Sint32 *src = (Sint32 *) cvt->buf;
@@ -14008,7 +13850,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8;
     const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8;
@@ -14087,7 +13928,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     Sint32 *dst = (Sint32 *) cvt->buf;
     const Sint32 *src = (Sint32 *) cvt->buf;
@@ -14142,7 +13982,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     float *dst = ((float *) (cvt->buf + dstsize)) - 1;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
@@ -14170,7 +14009,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     float *dst = (float *) cvt->buf;
     const float *src = (float *) cvt->buf;
@@ -14197,7 +14035,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     float *dst = ((float *) (cvt->buf + dstsize)) - 1;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
@@ -14227,7 +14064,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     float *dst = (float *) cvt->buf;
     const float *src = (float *) cvt->buf;
@@ -14254,7 +14090,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     float *dst = ((float *) (cvt->buf + dstsize)) - 2;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
@@ -14287,7 +14122,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     float *dst = (float *) cvt->buf;
     const float *src = (float *) cvt->buf;
@@ -14318,7 +14152,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     float *dst = ((float *) (cvt->buf + dstsize)) - 2;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
@@ -14355,7 +14188,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     float *dst = (float *) cvt->buf;
     const float *src = (float *) cvt->buf;
@@ -14386,7 +14218,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     float *dst = ((float *) (cvt->buf + dstsize)) - 4;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
@@ -14429,7 +14260,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     float *dst = (float *) cvt->buf;
     const float *src = (float *) cvt->buf;
@@ -14468,7 +14298,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     float *dst = ((float *) (cvt->buf + dstsize)) - 4;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
@@ -14519,7 +14348,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     float *dst = (float *) cvt->buf;
     const float *src = (float *) cvt->buf;
@@ -14558,7 +14386,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     float *dst = ((float *) (cvt->buf + dstsize)) - 6;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
@@ -14611,7 +14438,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     float *dst = (float *) cvt->buf;
     const float *src = (float *) cvt->buf;
@@ -14658,7 +14484,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     float *dst = ((float *) (cvt->buf + dstsize)) - 6;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
@@ -14723,7 +14548,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     float *dst = (float *) cvt->buf;
     const float *src = (float *) cvt->buf;
@@ -14770,7 +14594,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     float *dst = ((float *) (cvt->buf + dstsize)) - 8;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
@@ -14833,7 +14656,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     float *dst = (float *) cvt->buf;
     const float *src = (float *) cvt->buf;
@@ -14888,7 +14710,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     float *dst = ((float *) (cvt->buf + dstsize)) - 8;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
@@ -14967,7 +14788,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     float *dst = (float *) cvt->buf;
     const float *src = (float *) cvt->buf;
@@ -15022,7 +14842,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     float *dst = ((float *) (cvt->buf + dstsize)) - 1;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
@@ -15050,7 +14869,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     float *dst = (float *) cvt->buf;
     const float *src = (float *) cvt->buf;
@@ -15077,7 +14895,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     float *dst = ((float *) (cvt->buf + dstsize)) - 1;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1;
@@ -15107,7 +14924,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 1 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     float *dst = (float *) cvt->buf;
     const float *src = (float *) cvt->buf;
@@ -15134,7 +14950,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     float *dst = ((float *) (cvt->buf + dstsize)) - 2;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
@@ -15167,7 +14982,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     float *dst = (float *) cvt->buf;
     const float *src = (float *) cvt->buf;
@@ -15198,7 +15012,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     float *dst = ((float *) (cvt->buf + dstsize)) - 2;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2;
@@ -15235,7 +15048,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 2 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     float *dst = (float *) cvt->buf;
     const float *src = (float *) cvt->buf;
@@ -15266,7 +15078,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     float *dst = ((float *) (cvt->buf + dstsize)) - 4;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
@@ -15309,7 +15120,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     float *dst = (float *) cvt->buf;
     const float *src = (float *) cvt->buf;
@@ -15348,7 +15158,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     float *dst = ((float *) (cvt->buf + dstsize)) - 4;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4;
@@ -15399,7 +15208,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 4 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     float *dst = (float *) cvt->buf;
     const float *src = (float *) cvt->buf;
@@ -15438,7 +15246,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     float *dst = ((float *) (cvt->buf + dstsize)) - 6;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
@@ -15491,7 +15298,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     float *dst = (float *) cvt->buf;
     const float *src = (float *) cvt->buf;
@@ -15538,7 +15344,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     float *dst = ((float *) (cvt->buf + dstsize)) - 6;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6;
@@ -15603,7 +15408,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 6 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     float *dst = (float *) cvt->buf;
     const float *src = (float *) cvt->buf;
@@ -15650,7 +15454,6 @@
     fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 2;
     float *dst = ((float *) (cvt->buf + dstsize)) - 8;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
@@ -15713,7 +15516,6 @@
     fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 2;
     float *dst = (float *) cvt->buf;
     const float *src = (float *) cvt->buf;
@@ -15768,7 +15570,6 @@
     fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt * 4;
     float *dst = ((float *) (cvt->buf + dstsize)) - 8;
     const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
@@ -15847,7 +15648,6 @@
     fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 8 channels.\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt / 4;
     float *dst = (float *) cvt->buf;
     const float *src = (float *) cvt->buf;
--- a/src/audio/sdlgenaudiocvt.pl	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/audio/sdlgenaudiocvt.pl	Tue Oct 18 00:58:22 2011 -0400
@@ -38,7 +38,7 @@
 /* DO NOT EDIT!  This file is generated by sdlgenaudiocvt.pl */
 /*
   Simple DirectMedia Layer
-  Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
+  Copyright (C) 1997-2011 Sam Lantinga <slouken\@libsdl.org>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -536,7 +536,6 @@
     fprintf(stderr, "$resample (x${multiple}) AUDIO_${from}, ${channels} channels.\\n");
 #endif
 
-    const int srcsize = cvt->len_cvt;
     const int dstsize = cvt->len_cvt $lencvtop $multiple;
 EOF
 
--- a/src/core/android/SDL_android.cpp	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/core/android/SDL_android.cpp	Tue Oct 18 00:58:22 2011 -0400
@@ -29,6 +29,14 @@
 #include "../../video/android/SDL_androidtouch.h"
 #include "../../video/android/SDL_androidvideo.h"
 
+#include <android/log.h>
+#define LOG_TAG "SDL_android"
+//#define LOGI(...)  __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
+//#define LOGE(...)  __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
+#define LOGI(...) do {} while (false)
+#define LOGE(...) do {} while (false)
+
+
 /* Impelemented in audio/android/SDL_androidaudio.c */
 extern void Android_RunAudioThread();
 } // C
@@ -45,6 +53,7 @@
 *******************************************************************************/
 static JNIEnv* mEnv = NULL;
 static JNIEnv* mAudioEnv = NULL;
+static JavaVM* mJavaVM;
 
 // Main activity
 static jclass mActivityClass;
@@ -68,6 +77,14 @@
 // Library init
 extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved)
 {
+    JNIEnv *env;
+    mJavaVM = vm;
+    LOGI("JNI_OnLoad called");
+    if (mJavaVM->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
+        LOGE("Failed to get the environment using GetEnv()");
+        return -1;
+    }
+
     return JNI_VERSION_1_4;
 }
 
@@ -96,6 +113,7 @@
        !midAudioWriteShortBuffer || !midAudioWriteByteBuffer || !midAudioQuit) {
         __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL: Couldn't locate Java callbacks, check that they're named and typed correctly");
     }
+    __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_Android_Init() finished!");
 }
 
 // Resize
@@ -123,9 +141,10 @@
 // Touch
 extern "C" void Java_org_libsdl_app_SDLActivity_onNativeTouch(
                                     JNIEnv* env, jclass jcls,
+                                    jint touch_device_id_in, jint pointer_finger_id_in,
                                     jint action, jfloat x, jfloat y, jfloat p)
 {
-    Android_OnTouch(action, x, y, p);
+    Android_OnTouch(touch_device_id_in, pointer_finger_id_in, action, x, y, p);
 }
 
 // Accelerometer
@@ -203,29 +222,48 @@
 {
     int audioBufferFrames;
 
+    int status;
+    JNIEnv *env;
+    static bool isAttached = false;    
+    status = mJavaVM->GetEnv((void **) &env, JNI_VERSION_1_4);
+    if(status < 0) {
+        LOGE("callback_handler: failed to get JNI environment, assuming native thread");
+        status = mJavaVM->AttachCurrentThread(&env, NULL);
+        if(status < 0) {
+            LOGE("callback_handler: failed to attach current thread");
+            return 0;
+        }
+        isAttached = true;
+    }
+
+    
     __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device");
     audioBuffer16Bit = is16Bit;
     audioBufferStereo = channelCount > 1;
 
-    audioBuffer = mEnv->CallStaticObjectMethod(mActivityClass, midAudioInit, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames);
+    audioBuffer = env->CallStaticObjectMethod(mActivityClass, midAudioInit, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames);
 
     if (audioBuffer == NULL) {
         __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: didn't get back a good audio buffer!");
         return 0;
     }
-    audioBuffer = mEnv->NewGlobalRef(audioBuffer);
+    audioBuffer = env->NewGlobalRef(audioBuffer);
 
     jboolean isCopy = JNI_FALSE;
     if (audioBuffer16Bit) {
-        audioBufferPinned = mEnv->GetShortArrayElements((jshortArray)audioBuffer, &isCopy);
-        audioBufferFrames = mEnv->GetArrayLength((jshortArray)audioBuffer);
+        audioBufferPinned = env->GetShortArrayElements((jshortArray)audioBuffer, &isCopy);
+        audioBufferFrames = env->GetArrayLength((jshortArray)audioBuffer);
     } else {
-        audioBufferPinned = mEnv->GetByteArrayElements((jbyteArray)audioBuffer, &isCopy);
-        audioBufferFrames = mEnv->GetArrayLength((jbyteArray)audioBuffer);
+        audioBufferPinned = env->GetByteArrayElements((jbyteArray)audioBuffer, &isCopy);
+        audioBufferFrames = env->GetArrayLength((jbyteArray)audioBuffer);
     }
     if (audioBufferStereo) {
         audioBufferFrames /= 2;
     }
+ 
+    if (isAttached) {
+        mJavaVM->DetachCurrentThread();
+    }
 
     return audioBufferFrames;
 }
@@ -250,13 +288,31 @@
 
 extern "C" void Android_JNI_CloseAudioDevice()
 {
-    mEnv->CallStaticVoidMethod(mActivityClass, midAudioQuit); 
+    int status;
+    JNIEnv *env;
+    static bool isAttached = false;    
+    status = mJavaVM->GetEnv((void **) &env, JNI_VERSION_1_4);
+    if(status < 0) {
+        LOGE("callback_handler: failed to get JNI environment, assuming native thread");
+        status = mJavaVM->AttachCurrentThread(&env, NULL);
+        if(status < 0) {
+            LOGE("callback_handler: failed to attach current thread");
+            return;
+        }
+        isAttached = true;
+    }
+
+    env->CallStaticVoidMethod(mActivityClass, midAudioQuit); 
 
     if (audioBuffer) {
-        mEnv->DeleteGlobalRef(audioBuffer);
+        env->DeleteGlobalRef(audioBuffer);
         audioBuffer = NULL;
         audioBufferPinned = NULL;
     }
+
+    if (isAttached) {
+        mJavaVM->DetachCurrentThread();
+    }
 }
 
 // Test for an exception and call SDL_SetError with its detail if one occurs
@@ -345,11 +401,6 @@
     ctx->hidden.androidio.inputStream = inputStream;
     ctx->hidden.androidio.inputStreamRef = mEnv->NewGlobalRef(inputStream);
 
-    // Store .skip id for seeking purposes
-    mid = mEnv->GetMethodID(mEnv->GetObjectClass(inputStream),
-            "skip", "(J)J");
-    ctx->hidden.androidio.skipMethod = mid;
-
     // Despite all the visible documentation on [Asset]InputStream claiming
     // that the .available() method is not guaranteed to return the entire file
     // size, comments in <sdk>/samples/<ver>/ApiDemos/src/com/example/ ...
@@ -517,16 +568,24 @@
 
     long movement = newPosition - ctx->hidden.androidio.position;
     jobject inputStream = (jobject)ctx->hidden.androidio.inputStream;
-    jmethodID skipMethod = (jmethodID)ctx->hidden.androidio.skipMethod;
 
     if (movement > 0) {
+        unsigned char buffer[1024];
+
         // The easy case where we're seeking forwards
         while (movement > 0) {
-            // inputStream.skip(...);
-            movement -= mEnv->CallLongMethod(inputStream, skipMethod, movement);
-            if (Android_JNI_ExceptionOccurred()) {
+            long amount = (long) sizeof (buffer);
+            if (amount > movement) {
+                amount = movement;
+            }
+            size_t result = Android_JNI_FileRead(ctx, buffer, 1, amount);
+
+            if (result <= 0) {
+                // Failed to read/skip the required amount, so fail
                 return -1;
             }
+
+            movement -= result;
         }
     } else if (movement < 0) {
         // We can't seek backwards so we have to reopen the file and seek
--- a/src/cpuinfo/SDL_cpuinfo.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/cpuinfo/SDL_cpuinfo.c	Tue Oct 18 00:58:22 2011 -0400
@@ -384,6 +384,8 @@
     return SDL_CPUType;
 }
 
+
+#ifdef TEST_MAIN  /* !!! FIXME: only used for test at the moment. */
 static const char *
 SDL_GetCPUName(void)
 {
@@ -455,6 +457,7 @@
     }
     return SDL_CPUName;
 }
+#endif
 
 int
 SDL_GetCPUCacheLineSize(void)
--- a/src/events/SDL_gesture.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/events/SDL_gesture.c	Tue Oct 18 00:58:22 2011 -0400
@@ -390,10 +390,11 @@
 float dollarRecognize(const SDL_DollarPath *path,int *bestTempl,SDL_GestureTouch* touch) {
         
         SDL_FloatPoint points[DOLLARNPOINTS];
-        int numPoints = dollarNormalize(path,points);
         int i;
         float bestDiff = 10000;
 
+        dollarNormalize(path,points);
+
         //PrintPath(points);
         *bestTempl = -1;
         for(i = 0;i < touch->numDollarTemplates;i++) {
--- a/src/events/SDL_mouse.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/events/SDL_mouse.c	Tue Oct 18 00:58:22 2011 -0400
@@ -349,7 +349,6 @@
 SDL_CreateCursor(const Uint8 * data, const Uint8 * mask,
                  int w, int h, int hot_x, int hot_y)
 {
-    SDL_Mouse *mouse = SDL_GetMouse();
     SDL_Surface *surface;
     SDL_Cursor *cursor;
     int x, y;
--- a/src/power/linux/SDL_syspower.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/power/linux/SDL_syspower.c	Tue Oct 18 00:58:22 2011 -0400
@@ -128,7 +128,6 @@
     char *val = NULL;
     SDL_bool charge = SDL_FALSE;
     SDL_bool choose = SDL_FALSE;
-    SDL_bool is_ac = SDL_FALSE;
     int maximum = -1;
     int remaining = -1;
     int secs = -1;
@@ -214,13 +213,6 @@
     char *ptr = NULL;
     char *key = NULL;
     char *val = NULL;
-    SDL_bool charge = SDL_FALSE;
-    SDL_bool choose = SDL_FALSE;
-    SDL_bool is_ac = SDL_FALSE;
-    int maximum = -1;
-    int remaining = -1;
-    int secs = -1;
-    int pct = -1;
 
     if (!load_acpi_file(base, node, "state", state, sizeof (state))) {
         return;
--- a/src/render/opengl/SDL_render_gl.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/render/opengl/SDL_render_gl.c	Tue Oct 18 00:58:22 2011 -0400
@@ -348,8 +348,6 @@
 static void
 GL_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
 {
-    GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
-
     if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
         /* Rebind the context to the window area and update matrices */
         SDL_CurrentContext = NULL;
--- a/src/render/software/SDL_blendline.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/render/software/SDL_blendline.c	Tue Oct 18 00:58:22 2011 -0400
@@ -124,7 +124,6 @@
                      SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
                      SDL_bool draw_end)
 {
-    const SDL_PixelFormat *fmt = dst->format;
     unsigned r, g, b, a, inva;
 
     if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
@@ -216,7 +215,6 @@
                      SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
                      SDL_bool draw_end)
 {
-    const SDL_PixelFormat *fmt = dst->format;
     unsigned r, g, b, a, inva;
 
     if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
@@ -492,7 +490,6 @@
                      SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
                      SDL_bool draw_end)
 {
-    const SDL_PixelFormat *fmt = dst->format;
     unsigned r, g, b, a, inva;
 
     if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
@@ -584,7 +581,6 @@
                        SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
                        SDL_bool draw_end)
 {
-    const SDL_PixelFormat *fmt = dst->format;
     unsigned r, g, b, a, inva;
 
     if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
--- a/src/render/software/SDL_draw.h	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/render/software/SDL_draw.h	Tue Oct 18 00:58:22 2011 -0400
@@ -45,13 +45,13 @@
 
 #define DRAW_SETPIXEL(setpixel) \
 do { \
-    unsigned sr = r, sg = g, sb = b, sa = a; \
+    unsigned sr = r, sg = g, sb = b, sa = a; (void) sa; \
     setpixel; \
 } while (0)
 
 #define DRAW_SETPIXEL_BLEND(getpixel, setpixel) \
 do { \
-    unsigned sr, sg, sb, sa; sa; \
+    unsigned sr, sg, sb, sa; (void) sa; \
     getpixel; \
     sr = DRAW_MUL(inva, sr) + r; \
     sg = DRAW_MUL(inva, sg) + g; \
@@ -61,7 +61,7 @@
 
 #define DRAW_SETPIXEL_ADD(getpixel, setpixel) \
 do { \
-    unsigned sr, sg, sb, sa; sa; \
+    unsigned sr, sg, sb, sa; (void) sa; \
     getpixel; \
     sr += r; if (sr > 0xff) sr = 0xff; \
     sg += g; if (sg > 0xff) sg = 0xff; \
@@ -71,7 +71,7 @@
 
 #define DRAW_SETPIXEL_MOD(getpixel, setpixel) \
 do { \
-    unsigned sr, sg, sb, sa; sa; \
+    unsigned sr, sg, sb, sa; (void) sa; \
     getpixel; \
     sr = DRAW_MUL(sr, r); \
     sg = DRAW_MUL(sg, g); \
--- a/src/thread/beos/SDL_systhread.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/thread/beos/SDL_systhread.c	Tue Oct 18 00:58:22 2011 -0400
@@ -66,8 +66,9 @@
 SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
 {
     /* The docs say the thread name can't be longer than B_OS_NAME_LENGTH. */
+    const char *threadname = thread->name ? thread->name : "SDL Thread";
     char name[B_OS_NAME_LENGTH];
-    SDL_snprintf(name, sizeof (name), "%s", thread->name);
+    SDL_snprintf(name, sizeof (name), "%s", threadname);
     name[sizeof (name) - 1] = '\0';
 
     /* Create the thread and go! */
--- a/src/thread/pthread/SDL_syssem.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/thread/pthread/SDL_syssem.c	Tue Oct 18 00:58:22 2011 -0400
@@ -23,6 +23,7 @@
 #include <errno.h>
 #include <pthread.h>
 #include <semaphore.h>
+#include <sys/time.h>
 
 #include "SDL_thread.h"
 #include "SDL_timer.h"
--- a/src/thread/pthread/SDL_systhread.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/thread/pthread/SDL_systhread.c	Tue Oct 18 00:58:22 2011 -0400
@@ -18,6 +18,7 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+
 #include "SDL_config.h"
 
 #include <pthread.h>
@@ -31,6 +32,8 @@
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <sys/syscall.h>
+#include <unistd.h>
+extern int pthread_setname_np (pthread_t __target_thread, __const char *__name) __THROW __nonnull ((2));
 #endif
 
 #include "SDL_platform.h"
@@ -79,14 +82,16 @@
     int i;
     sigset_t mask;
 
+    if (name != NULL) {
 #if ( (__MACOSX__ && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)) || \
       (__IPHONEOS__ && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 30200)) )
-    if (pthread_setname_np != NULL) { pthread_setname_np(name); }
+        if (pthread_setname_np != NULL) { pthread_setname_np(name); }
 #elif HAVE_PTHREAD_SETNAME_NP
-    pthread_setname_np(pthread_self(), name);
+        pthread_setname_np(pthread_self(), name);
 #elif HAVE_PTHREAD_SET_NAME_NP
-    pthread_set_name_np(pthread_self(), name);
+        pthread_set_name_np(pthread_self(), name);
 #endif
+    }
 
     /* Mask asynchronous signals for this thread */
     sigemptyset(&mask);
--- a/src/thread/windows/SDL_systhread.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/thread/windows/SDL_systhread.c	Tue Oct 18 00:58:22 2011 -0400
@@ -161,25 +161,27 @@
 void
 SDL_SYS_SetupThread(const char *name)
 {
-#if 0  /* !!! FIXME: __except needs C runtime, which we don't link against. */
-#ifdef _MSC_VER  /* !!! FIXME: can we do SEH on other compilers yet? */
-    /* This magic tells the debugger to name a thread if it's listening. */
-    THREADNAME_INFO inf;
-    inf.dwType = 0x1000;
-    inf.szName = name;
-    inf.dwThreadID = (DWORD) -1;
-    inf.dwFlags = 0;
+    if (name != NULL) {
+        #if 0  /* !!! FIXME: __except needs C runtime, which we don't link against. */
+        #ifdef _MSC_VER  /* !!! FIXME: can we do SEH on other compilers yet? */
+        /* This magic tells the debugger to name a thread if it's listening. */
+        THREADNAME_INFO inf;
+        inf.dwType = 0x1000;
+        inf.szName = name;
+        inf.dwThreadID = (DWORD) -1;
+        inf.dwFlags = 0;
 
-    __try
-    {
-        RaiseException(0x406D1388, 0, sizeof(inf)/sizeof(DWORD), (DWORD*)&inf);
+        __try
+        {
+            RaiseException(0x406D1388, 0, sizeof(inf)/sizeof(DWORD), (DWORD*)&inf);
+        }
+        __except(EXCEPTION_CONTINUE_EXECUTION)
+        {
+            /* The program itself should ignore this bogus exception. */
+        }
+        #endif
+        #endif
     }
-    __except(EXCEPTION_CONTINUE_EXECUTION)
-    {
-        /* The program itself should ignore this bogus exception. */
-    }
-#endif
-#endif
 }
 
 SDL_threadID
--- a/src/video/android/SDL_androidgl.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/video/android/SDL_androidgl.c	Tue Oct 18 00:58:22 2011 -0400
@@ -29,26 +29,43 @@
 
 #include <android/log.h>
 
+#include <dlfcn.h>
+
+static void* Android_GLHandle = NULL;
 
 /* GL functions */
 int
 Android_GL_LoadLibrary(_THIS, const char *path)
 {
-    __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_LoadLibrary\n");
+    if (!Android_GLHandle) {
+        Android_GLHandle = dlopen("libGLESv1_CM.so",RTLD_GLOBAL);
+        if (!Android_GLHandle) {
+            SDL_SetError("Could not initialize GL ES library\n");
+            return -1;
+        }
+    }
     return 0;
 }
 
 void *
 Android_GL_GetProcAddress(_THIS, const char *proc)
 {
-    __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_GetProcAddress\n");
-    return 0;
+    /*
+       !!! FIXME: this _should_ use eglGetProcAddress(), but it appears to be
+       !!! FIXME:  busted on Android at the moment...
+       !!! FIXME:  http://code.google.com/p/android/issues/detail?id=7681
+       !!! FIXME: ...so revisit this later.  --ryan.
+    */
+    return dlsym(Android_GLHandle, proc);
 }
 
 void
 Android_GL_UnloadLibrary(_THIS)
 {
-    __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_UnloadLibrary\n");
+    if(Android_GLHandle) {
+        dlclose(Android_GLHandle);
+        Android_GLHandle = NULL;
+    }
 }
 
 SDL_GLContext
--- a/src/video/android/SDL_androidtouch.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/video/android/SDL_androidtouch.c	Tue Oct 18 00:58:22 2011 -0400
@@ -24,6 +24,7 @@
 
 #include "SDL_events.h"
 #include "../../events/SDL_mouse_c.h"
+#include "../../events/SDL_touch_c.h"
 
 #include "SDL_androidtouch.h"
 
@@ -33,27 +34,55 @@
 #define ACTION_MOVE 2
 #define ACTION_CANCEL 3
 #define ACTION_OUTSIDE 4
+// The following two are deprecated but it seems they are still emitted (instead the corresponding ACTION_UP/DOWN) as of Android 3.2
+#define ACTION_POINTER_1_DOWN 5
+#define ACTION_POINTER_1_UP 6
 
-void Android_OnTouch(int action, float x, float y, float p)
+void Android_OnTouch(int touch_device_id_in, int pointer_finger_id_in, int action, float x, float y, float p) 
 {
+    SDL_TouchID touchDeviceId = 0;
+    SDL_FingerID fingerId = 0;
+    
     if (!Android_Window) {
         return;
     }
+    
+    touchDeviceId = (SDL_TouchID)touch_device_id_in;
+    if (!SDL_GetTouch(touchDeviceId)) {
+        SDL_Touch touch;
+        memset( &touch, 0, sizeof(touch) );
+        touch.id = touchDeviceId;
+        touch.x_min = 0.0f;
+        touch.x_max = (float)Android_ScreenWidth;
+        touch.native_xres = touch.x_max - touch.x_min;
+        touch.y_min = 0.0f;
+        touch.y_max = (float)Android_ScreenHeight;
+        touch.native_yres = touch.y_max - touch.y_min;
+        touch.pressure_min = 0.0f;
+        touch.pressure_max = 1.0f;
+        touch.native_pressureres = touch.pressure_max - touch.pressure_min;
+        if (SDL_AddTouch(&touch, "") < 0) {
+             SDL_Log("error: can't add touch %s, %d", __FILE__, __LINE__);
+        }
+    }
 
-    if ((action != ACTION_CANCEL) && (action != ACTION_OUTSIDE)) {
-        SDL_SetMouseFocus(Android_Window);
-        SDL_SendMouseMotion(Android_Window, 0, (int)x, (int)y);
-        switch(action) {
+    
+    fingerId = (SDL_FingerID)pointer_finger_id_in;
+    switch (action) {
         case ACTION_DOWN:
-            SDL_SendMouseButton(Android_Window, SDL_PRESSED, SDL_BUTTON_LEFT);
+        case ACTION_POINTER_1_DOWN:
+            SDL_SendFingerDown(touchDeviceId, fingerId, SDL_TRUE, x, y, p);
+            break;
+        case ACTION_MOVE:
+            SDL_SendTouchMotion(touchDeviceId, fingerId, SDL_FALSE, x, y, p);
             break;
         case ACTION_UP:
-            SDL_SendMouseButton(Android_Window, SDL_RELEASED, SDL_BUTTON_LEFT);
+        case ACTION_POINTER_1_UP:
+            SDL_SendFingerDown(touchDeviceId, fingerId, SDL_FALSE, x, y, p);
             break;
-        }
-    } else {
-        SDL_SetMouseFocus(NULL);
-    }
+        default:
+            break;
+    } 
 }
 
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/android/SDL_androidtouch.h	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/video/android/SDL_androidtouch.h	Tue Oct 18 00:58:22 2011 -0400
@@ -22,6 +22,6 @@
 
 #include "SDL_androidvideo.h"
 
-extern void Android_OnTouch(int action, float x, float y, float p);
+extern void Android_OnTouch( int touch_device_id_in, int pointer_finger_id_in, int action, float x, float y, float p);
 
 /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/uikit/SDL_uikitvideo.m	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/video/uikit/SDL_uikitvideo.m	Tue Oct 18 00:58:22 2011 -0400
@@ -176,7 +176,8 @@
     mode.h = h;
     mode.refresh_rate = 0;
 
-    [uimode retain];
+    [uimode retain];  // once for the desktop_mode
+    [uimode retain];  // once for the current_mode
     mode.driverdata = uimode;
 
     SDL_zero(display);
@@ -248,13 +249,14 @@
         UIScreen *uiscreen = (UIScreen *) display->driverdata;
         [uiscreen release];
         display->driverdata = NULL;
+        [((UIScreenMode *) display->desktop_mode.driverdata) release];
+        display->desktop_mode.driverdata = NULL;
+        [((UIScreenMode *) display->current_mode.driverdata) release];
+        display->current_mode.driverdata = NULL;
         for (j = 0; j < display->num_display_modes; j++) {
             SDL_DisplayMode *mode = &display->display_modes[j];
-            UIScreenMode *uimode = (UIScreenMode *) mode->driverdata;
-            if (uimode) {
-                [uimode release];
-                mode->driverdata = NULL;
-            }
+            [((UIScreenMode *) mode->driverdata) release];
+            mode->driverdata = NULL;
         }
     }
 }
--- a/src/video/uikit/SDL_uikitwindow.m	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/video/uikit/SDL_uikitwindow.m	Tue Oct 18 00:58:22 2011 -0400
@@ -151,8 +151,13 @@
             if (bestmode) {
                 UIScreenMode *uimode = (UIScreenMode *) bestmode->driverdata;
                 [uiscreen setCurrentMode:uimode];
-                display->desktop_mode = *bestmode;
+
+                // desktop_mode doesn't change here (the higher level will
+                //  use it to set all the screens back to their defaults
+                //  upon window destruction, SDL_Quit(), etc.
+                [((UIScreenMode *) display->current_mode.driverdata) release];
                 display->current_mode = *bestmode;
+                [((UIScreenMode *) display->current_mode.driverdata) retain];
             }
         }
     }
--- a/src/video/windows/SDL_windowswindow.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/video/windows/SDL_windowswindow.c	Tue Oct 18 00:58:22 2011 -0400
@@ -88,6 +88,8 @@
     data->mouse_pressed = SDL_FALSE;
     data->videodata = videodata;
 
+    window->driverdata = data;
+
     /* Associate the data with the window */
     if (!SetProp(hwnd, TEXT("SDL_WindowData"), data)) {
         ReleaseDC(hwnd, data->hdc);
@@ -183,7 +185,6 @@
     }
 
     /* All done! */
-    window->driverdata = data;
     return 0;
 }
 
--- a/src/video/x11/SDL_x11events.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/video/x11/SDL_x11events.c	Tue Oct 18 00:58:22 2011 -0400
@@ -234,7 +234,6 @@
     case KeyPress:{
             KeyCode keycode = xevent.xkey.keycode;
             KeySym keysym = NoSymbol;
-            SDL_Scancode scancode;
             char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
             Status status = 0;
 
@@ -243,7 +242,7 @@
 #endif
             SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]);
 #if 1
-            if (videodata->key_layout[keycode] == SDLK_UNKNOWN) {
+            if (videodata->key_layout[keycode] == SDL_SCANCODE_UNKNOWN) {
                 int min_keycode, max_keycode;
                 XDisplayKeycodes(display, &min_keycode, &max_keycode);
                 keysym = XKeycodeToKeysym(display, keycode, 0);
@@ -522,6 +521,11 @@
     return (0);
 }
 
+
+/* !!! FIXME: this should be exposed in a header, or something. */
+int SDL_GetNumTouch(void);
+
+
 void
 X11_PumpEvents(_THIS)
 {
@@ -545,7 +549,6 @@
 #ifdef SDL_INPUT_LINUXEV
     /* Process Touch events - TODO When X gets touch support, use that instead*/
     int i = 0,rd;
-    char name[256];
     struct input_event ev[64];
     int size = sizeof (struct input_event);
 
--- a/src/video/x11/SDL_x11framebuffer.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/video/x11/SDL_x11framebuffer.c	Tue Oct 18 00:58:22 2011 -0400
@@ -183,7 +183,10 @@
                   rect->x, rect->y, rect->w, rect->h);
         }
     }
+
     XSync(display, False);
+
+    return 0;
 }
 
 void
--- a/src/video/x11/SDL_x11mouse.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/video/x11/SDL_x11mouse.c	Tue Oct 18 00:58:22 2011 -0400
@@ -136,7 +136,7 @@
     /* Code below assumes ARGB pixel format */
     SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);
 
-    rfg = gfg = bfg = rbg = gbg = bbg = fgBits = 0;
+    rfg = gfg = bfg = rbg = gbg = bbg = fgBits = bgBits = 0;
     for (y = 0; y < surface->h; ++y) {
         ptr = (Uint32 *)((Uint8 *)surface->pixels + y * surface->pitch);
         for (x = 0; x < surface->w; ++x) {
--- a/src/video/x11/SDL_x11opengl.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/video/x11/SDL_x11opengl.c	Tue Oct 18 00:58:22 2011 -0400
@@ -19,8 +19,8 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 #include "SDL_config.h"
-
 #include "SDL_x11video.h"
+#include "SDL_assert.h"
 
 /* GLX implementation of SDL OpenGL support */
 
@@ -388,8 +388,10 @@
     XVisualInfo *vinfo;
 
     /* 64 seems nice. */
-    int attribs[64];
-    int i = X11_GL_GetAttributes(_this,display,screen,attribs,64);
+    const int max_attrs = 64;
+    int attribs[max_attrs];
+    const int i = X11_GL_GetAttributes(_this,display,screen,attribs,max_attrs);
+    SDL_assert(i <= max_attrs);
 
     vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs);
     if (!vinfo) {
--- a/src/video/x11/SDL_x11shape.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/video/x11/SDL_x11shape.c	Tue Oct 18 00:58:22 2011 -0400
@@ -26,6 +26,7 @@
 #include "SDL_x11video.h"
 #include "SDL_x11shape.h"
 #include "SDL_x11window.h"
+#include "../SDL_shape_internals.h"
 
 SDL_Window*
 X11_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) {
--- a/src/video/x11/SDL_x11sym.h	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/video/x11/SDL_x11sym.h	Tue Oct 18 00:58:22 2011 -0400
@@ -178,17 +178,17 @@
 /* XCursor support */
 #if SDL_VIDEO_DRIVER_X11_XCURSOR
 SDL_X11_MODULE(XCURSOR)
-SDL_X11_SYM(XcursorImage*,XcursorImageCreate,(int a,int b),(a,b),)
+SDL_X11_SYM(XcursorImage*,XcursorImageCreate,(int a,int b),(a,b),return)
 SDL_X11_SYM(void,XcursorImageDestroy,(XcursorImage *a),(a),)
-SDL_X11_SYM(Cursor,XcursorImageLoadCursor,(Display *a,const XcursorImage *b),(a,b),)
+SDL_X11_SYM(Cursor,XcursorImageLoadCursor,(Display *a,const XcursorImage *b),(a,b),return)
 #endif
 
 /* Xinerama support */
 #if SDL_VIDEO_DRIVER_X11_XINERAMA
 SDL_X11_MODULE(XINERAMA)
-SDL_X11_SYM(Bool,XineramaIsActive,(Display *a),(a),)
-SDL_X11_SYM(Bool,XineramaQueryExtension,(Display *a,int *b,int *c),(a,b,c),)
-SDL_X11_SYM(XineramaScreenInfo*,XineramaQueryScreens,(Display *a, int *b),(a,b),)
+SDL_X11_SYM(Bool,XineramaIsActive,(Display *a),(a),return)
+SDL_X11_SYM(Bool,XineramaQueryExtension,(Display *a,int *b,int *c),(a,b,c),return)
+SDL_X11_SYM(XineramaScreenInfo*,XineramaQueryScreens,(Display *a, int *b),(a,b),return)
 #endif
 
 /* XInput support for multiple mice, tablets, etc. */
@@ -229,12 +229,12 @@
 
 #if SDL_VIDEO_DRIVER_X11_XVIDMODE
 SDL_X11_MODULE(XVIDMODE)
-SDL_X11_SYM(Bool,XF86VidModeGetAllModeLines,(Display *a,int b,int *c,XF86VidModeModeInfo ***d),(a,b,c,d),)
-SDL_X11_SYM(Bool,XF86VidModeGetModeLine,(Display *a,int b,int *c,XF86VidModeModeLine *d),(a,b,c,d),)
-SDL_X11_SYM(Bool,XF86VidModeGetViewPort,(Display *a,int b,int *c,int *d),(a,b,c,d),)
-SDL_X11_SYM(Bool,XF86VidModeQueryExtension,(Display *a,int *b,int *c),(a,b,c),)
-SDL_X11_SYM(Bool,XF86VidModeQueryVersion,(Display *a,int *b,int *c),(a,b,c),)
-SDL_X11_SYM(Bool,XF86VidModeSwitchToMode,(Display *a,int b,XF86VidModeModeInfo *c),(a,b,c),)
+SDL_X11_SYM(Bool,XF86VidModeGetAllModeLines,(Display *a,int b,int *c,XF86VidModeModeInfo ***d),(a,b,c,d),return)
+SDL_X11_SYM(Bool,XF86VidModeGetModeLine,(Display *a,int b,int *c,XF86VidModeModeLine *d),(a,b,c,d),return)
+SDL_X11_SYM(Bool,XF86VidModeGetViewPort,(Display *a,int b,int *c,int *d),(a,b,c,d),return)
+SDL_X11_SYM(Bool,XF86VidModeQueryExtension,(Display *a,int *b,int *c),(a,b,c),return)
+SDL_X11_SYM(Bool,XF86VidModeQueryVersion,(Display *a,int *b,int *c),(a,b,c),return)
+SDL_X11_SYM(Bool,XF86VidModeSwitchToMode,(Display *a,int b,XF86VidModeModeInfo *c),(a,b,c),return)
 #endif
 
 /* *INDENT-ON* */
--- a/src/video/x11/SDL_x11touch.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/video/x11/SDL_x11touch.c	Tue Oct 18 00:58:22 2011 -0400
@@ -39,7 +39,6 @@
   FILE *fd;
   fd = fopen("/proc/bus/input/devices","r");
 
-  char c;
   int i = 0;
   int tsfd;
   char line[256];
@@ -111,7 +110,7 @@
     }
   }
 
-  close(fd);
+  fclose(fd);
 #endif
 }
 
--- a/src/video/x11/SDL_x11window.c	Sun Oct 09 22:00:20 2011 +0200
+++ b/src/video/x11/SDL_x11window.c	Tue Oct 18 00:58:22 2011 -0400
@@ -86,31 +86,6 @@
     return count;
 }
 
-static void
-X11_GetDisplaySize(_THIS, SDL_Window * window, int *w, int *h)
-{
-    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
-    SDL_DisplayData *displaydata =
-        (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
-    XWindowAttributes attr;
-
-    XGetWindowAttributes(data->display, RootWindow(data->display, displaydata->screen), &attr);
-    if (window->flags & SDL_WINDOW_FULLSCREEN) {
-        /* The bounds when this window is visible is the fullscreen mode */
-        SDL_DisplayMode fullscreen_mode;
-        if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) {
-            attr.width = fullscreen_mode.w;
-            attr.height = fullscreen_mode.h;
-        }
-    }
-    if (w) {
-        *w = attr.width;
-    }
-    if (h) {
-        *h = attr.height;
-    }
-}
-
 static int
 SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created)
 {
@@ -320,7 +295,6 @@
     xattr.border_pixel = 0;
 
     if (visual->class == DirectColor) {
-        Status status;
         XColor *colorcells;
         int i;
         int ncolors;
@@ -757,7 +731,6 @@
 {
     SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
     Display *display = data->videodata->display;
-    int x, y;
 
     XMoveWindow(display, data->xwindow, window->x, window->y);
     XFlush(display);
@@ -952,7 +925,7 @@
     int ncolors;
     int rmask, gmask, bmask;
     int rshift, gshift, bshift;
-    int i, j;
+    int i;
 
     if (visual->class != DirectColor) {
         SDL_SetError("Window doesn't have DirectColor visual");