[Commits] SDL: Fixed bug 4277 - warnings patch

libsdl.org revision control commits-owner at libsdl.org
Thu Sep 27 14:56:33 PDT 2018


details:   https://hg.libsdl.org/SDL/rev/df7260f149f2
changeset: 12242:df7260f149f2
user:      Sam Lantinga <slouken at libsdl.org>
date:      Thu Sep 27 14:56:29 2018 -0700
description:
Fixed bug 4277 - warnings patch

Sylvain

Patch a few warnings when using:
-Wmissing-prototypes -Wdocumentation -Wdocumentation-unknown-command

They are automatically enabled with -Wall

diffstat:

 include/SDL_sensor.h           |   2 +-
 include/SDL_vulkan.h           |   4 +-
 src/core/android/SDL_android.c |   5 ++++
 src/core/android/SDL_android.h |  11 +++++++-
 src/cpuinfo/SDL_cpuinfo.c      |   1 +
 src/hidapi/android/hid.cpp     |  28 ++++++++++++++++++++++-
 src/hidapi/hidapi/hidapi.h     |   2 +-
 src/render/SDL_render.c        |   3 +-
 src/sensor/SDL_sensor.c        |   6 ++--
 src/video/SDL_blit_N.c         |  51 ++++++++++++++++++++++++++++++++++++++++++
 src/video/SDL_surface.c        |   2 +-
 src/video/SDL_yuv.c            |   1 +
 12 files changed, 104 insertions(+), 12 deletions(-)

diffs (282 lines):

diff -r f72836cfb92b -r df7260f149f2 include/SDL_sensor.h
--- a/include/SDL_sensor.h	Thu Sep 27 11:55:02 2018 +0300
+++ b/include/SDL_sensor.h	Thu Sep 27 14:56:29 2018 -0700
@@ -41,7 +41,7 @@
 #endif
 
 /**
- *  \file SDL_sensor.h
+ *  \brief SDL_sensor.h
  *
  *  In order to use these functions, SDL_Init() must have been called
  *  with the ::SDL_INIT_SENSOR flag.  This causes SDL to scan the system
diff -r f72836cfb92b -r df7260f149f2 include/SDL_vulkan.h
--- a/include/SDL_vulkan.h	Thu Sep 27 11:55:02 2018 +0300
+++ b/include/SDL_vulkan.h	Thu Sep 27 14:56:29 2018 -0700
@@ -137,9 +137,9 @@
  *
  *  \param [in]     \c NULL or window Window for which the required Vulkan instance
  *                  extensions should be retrieved
- *  \param [in,out] count pointer to an \c unsigned related to the number of
+ *  \param [in,out] pCount pointer to an \c unsigned related to the number of
  *                  required Vulkan instance extensions
- *  \param [out]    names \c NULL or a pointer to an array to be filled with the
+ *  \param [out]    pNames \c NULL or a pointer to an array to be filled with the
  *                  required Vulkan instance extensions
  *
  *  \return \c SDL_TRUE on success, \c SDL_FALSE on error.
diff -r f72836cfb92b -r df7260f149f2 src/core/android/SDL_android.c
--- a/src/core/android/SDL_android.c	Thu Sep 27 11:55:02 2018 +0300
+++ b/src/core/android/SDL_android.c	Thu Sep 27 14:56:29 2018 -0700
@@ -144,6 +144,10 @@
         JNIEnv* env, jclass cls,
         jstring text, jint newCursorPosition);
 
+JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancodeForUnichar)(
+        JNIEnv* env, jclass cls,
+        jchar chUnicode);
+
 JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText)(
         JNIEnv* env, jclass cls,
         jstring text, jint newCursorPosition);
@@ -195,6 +199,7 @@
 /* #define DEBUG_JNI */
 
 static void Android_JNI_ThreadDestroyed(void*);
+static void checkJNIReady(void);
 
 /*******************************************************************************
  This file links the Java side of Android with libsdl
diff -r f72836cfb92b -r df7260f149f2 src/core/android/SDL_android.h
--- a/src/core/android/SDL_android.h	Thu Sep 27 11:55:02 2018 +0300
+++ b/src/core/android/SDL_android.h	Thu Sep 27 14:56:29 2018 -0700
@@ -85,8 +85,9 @@
 void Android_JNI_SuspendScreenSaver(SDL_bool suspend);
 
 /* Touch support */
+int Android_JNI_InitTouch(void);
+void Android_JNI_SetSeparateMouseAndTouch(SDL_bool new_value);
 int Android_JNI_GetTouchDeviceIds(int **ids);
-void Android_JNI_SetSeparateMouseAndTouch(SDL_bool new_value);
 
 /* Threads */
 #include <jni.h>
@@ -109,9 +110,15 @@
 SDL_bool Android_JNI_SetSystemCursor(int cursorID);
 
 /* Relative mouse support */
-SDL_bool Android_JNI_SupportsRelativeMouse();
+SDL_bool Android_JNI_SupportsRelativeMouse(void);
 SDL_bool Android_JNI_SetRelativeMouseEnabled(SDL_bool enabled);
 
+
+SDL_bool SDL_IsAndroidTablet(void);
+SDL_bool SDL_IsAndroidTV(void);
+SDL_bool SDL_IsChromebook(void);
+SDL_bool SDL_IsDeXMode(void);
+
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
 /* *INDENT-OFF* */
diff -r f72836cfb92b -r df7260f149f2 src/cpuinfo/SDL_cpuinfo.c
--- a/src/cpuinfo/SDL_cpuinfo.c	Thu Sep 27 11:55:02 2018 +0300
+++ b/src/cpuinfo/SDL_cpuinfo.c	Thu Sep 27 14:56:29 2018 -0700
@@ -22,6 +22,7 @@
 #include "SDL_config.h"
 #else
 #include "../SDL_internal.h"
+#include "SDL_simd.h"
 #endif
 
 #if defined(__WIN32__)
diff -r f72836cfb92b -r df7260f149f2 src/hidapi/android/hid.cpp
--- a/src/hidapi/android/hid.cpp	Thu Sep 27 11:55:02 2018 +0300
+++ b/src/hidapi/android/hid.cpp	Thu Sep 27 14:56:29 2018 -0700
@@ -336,7 +336,7 @@
 static jmethodID g_midHIDDeviceManagerGetFeatureReport;
 static jmethodID g_midHIDDeviceManagerClose;
 
-uint64_t get_timespec_ms( const struct timespec &ts )
+static uint64_t get_timespec_ms( const struct timespec &ts )
 {
 	return (uint64_t)ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
 }
@@ -694,6 +694,32 @@
 	}
 }
 
+
+extern "C"
+JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceRegisterCallback)(JNIEnv *env, jobject thiz, jobject callbackHandler);
+
+extern "C"
+JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceReleaseCallback)(JNIEnv *env, jobject thiz);
+
+extern "C"
+JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceConnected)(JNIEnv *env, jobject thiz, int nDeviceID, jstring sIdentifier, int nVendorId, int nProductId, jstring sSerialNumber, int nReleaseNumber, jstring sManufacturer, jstring sProduct, int nInterface );
+
+extern "C"
+JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceOpenPending)(JNIEnv *env, jobject thiz, int nDeviceID);
+
+extern "C"
+JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceOpenResult)(JNIEnv *env, jobject thiz, int nDeviceID, bool bOpened);
+
+extern "C"
+JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceDisconnected)(JNIEnv *env, jobject thiz, int nDeviceID);
+
+extern "C"
+JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceInputReport)(JNIEnv *env, jobject thiz, int nDeviceID, jbyteArray value);
+
+extern "C"
+JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceFeatureReport)(JNIEnv *env, jobject thiz, int nDeviceID, jbyteArray value);
+
+
 extern "C"
 JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceRegisterCallback)(JNIEnv *env, jobject thiz, jobject callbackHandler)
 {
diff -r f72836cfb92b -r df7260f149f2 src/hidapi/hidapi/hidapi.h
--- a/src/hidapi/hidapi/hidapi.h	Thu Sep 27 11:55:02 2018 +0300
+++ b/src/hidapi/hidapi/hidapi.h	Thu Sep 27 14:56:29 2018 -0700
@@ -225,7 +225,7 @@
 				-1 on error. If no packet was available to be read within
 				the timeout period, this function returns 0.
 		*/
-		int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds);
+		int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *device, unsigned char *data, size_t length, int milliseconds);
 
 		/** @brief Read an Input report from a HID device.
 
diff -r f72836cfb92b -r df7260f149f2 src/render/SDL_render.c
--- a/src/render/SDL_render.c	Thu Sep 27 11:55:02 2018 +0300
+++ b/src/render/SDL_render.c	Thu Sep 27 14:56:29 2018 -0700
@@ -521,7 +521,8 @@
     return renderer->info.texture_formats[0];
 }
 
-SDL_ScaleMode SDL_GetScaleMode(void)
+
+static SDL_ScaleMode SDL_GetScaleMode(void)
 {
     const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
 
diff -r f72836cfb92b -r df7260f149f2 src/sensor/SDL_sensor.c
--- a/src/sensor/SDL_sensor.c	Thu Sep 27 11:55:02 2018 +0300
+++ b/src/sensor/SDL_sensor.c	Thu Sep 27 14:56:29 2018 -0700
@@ -48,7 +48,7 @@
 static SDL_mutex *SDL_sensor_lock = NULL; /* This needs to support recursive locks */
 static SDL_atomic_t SDL_next_sensor_instance_id;
 
-void
+static void
 SDL_LockSensors(void)
 {
     if (SDL_sensor_lock) {
@@ -56,7 +56,7 @@
     }
 }
 
-void
+static void
 SDL_UnlockSensors(void)
 {
     if (SDL_sensor_lock) {
@@ -118,7 +118,7 @@
  * Get the driver and device index for an API device index
  * This should be called while the sensor lock is held, to prevent another thread from updating the list
  */
-SDL_bool
+static SDL_bool
 SDL_GetDriverAndSensorIndex(int device_index, SDL_SensorDriver **driver, int *driver_index)
 {
     int i, num_sensors, total_sensors = 0;
diff -r f72836cfb92b -r df7260f149f2 src/video/SDL_blit_N.c
--- a/src/video/SDL_blit_N.c	Thu Sep 27 11:55:02 2018 +0300
+++ b/src/video/SDL_blit_N.c	Thu Sep 27 14:56:29 2018 -0700
@@ -2333,6 +2333,30 @@
     /* Set up some basic variables */
     ckey &= rgbmask;
 
+    /* Fastpath: same source/destination format, no Amask, bpp 32, loop is vectorized. ~10x faster */
+    if (srcfmt->format == dstfmt->format &&
+        (srcfmt->format == SDL_PIXELFORMAT_RGB888 || srcfmt->format == SDL_PIXELFORMAT_BGR888)) {
+        Uint32 *src32 = (Uint32*)src;
+        Uint32 *dst32 = (Uint32*)dst;
+        srcskip /= sizeof(Uint32);
+        dstskip /= sizeof(Uint32);
+        while (height--) {
+            /* *INDENT-OFF* */
+            DUFFS_LOOP(
+            {
+                Uint32 Pixel = (*src32 == ckey) ? *dst32 : *src32;
+                *dst32 = Pixel;
+                ++src32;
+                ++dst32;
+            },
+            width);
+            /* *INDENT-ON* */
+            src32 += srcskip;
+            dst32 += dstskip;
+        }
+        return;
+    }
+
     while (height--) {
         /* *INDENT-OFF* */
         DUFFS_LOOP(
@@ -2380,6 +2404,33 @@
     dstbpp = dstfmt->BytesPerPixel;
     ckey &= rgbmask;
 
+    /* Fastpath: same source/destination format, with Amask, bpp 32, loop is vectorized. ~10x faster */
+    if (srcfmt->format == dstfmt->format &&
+        (srcfmt->format == SDL_PIXELFORMAT_ARGB8888 ||
+         srcfmt->format == SDL_PIXELFORMAT_ABGR8888 ||
+         srcfmt->format == SDL_PIXELFORMAT_BGRA8888 ||
+         srcfmt->format == SDL_PIXELFORMAT_RGBA8888)) {
+        Uint32 *src32 = (Uint32*)src;
+        Uint32 *dst32 = (Uint32*)dst;
+        srcskip /= sizeof(Uint32);
+        dstskip /= sizeof(Uint32);
+        while (height--) {
+            /* *INDENT-OFF* */
+            DUFFS_LOOP(
+            {
+                Uint32 Pixel = ((*src32 & rgbmask) == ckey) ? *dst32 : *src32;
+                *dst32 = Pixel;
+                ++src32;
+                ++dst32;
+            },
+            width);
+            /* *INDENT-ON* */
+            src32 += srcskip;
+            dst32 += dstskip;
+        }
+        return;
+    }
+
     while (height--) {
         /* *INDENT-OFF* */
         DUFFS_LOOP(
diff -r f72836cfb92b -r df7260f149f2 src/video/SDL_surface.c
--- a/src/video/SDL_surface.c	Thu Sep 27 11:55:02 2018 +0300
+++ b/src/video/SDL_surface.c	Thu Sep 27 14:56:29 2018 -0700
@@ -37,7 +37,7 @@
 /*
  * Calculate the pad-aligned scanline width of a surface
  */
-int
+static int
 SDL_CalculatePitch(Uint32 format, int width)
 {
     int pitch;
diff -r f72836cfb92b -r df7260f149f2 src/video/SDL_yuv.c
--- a/src/video/SDL_yuv.c	Thu Sep 27 11:55:02 2018 +0300
+++ b/src/video/SDL_yuv.c	Thu Sep 27 14:56:29 2018 -0700
@@ -23,6 +23,7 @@
 #include "SDL_endian.h"
 #include "SDL_video.h"
 #include "SDL_pixels_c.h"
+#include "SDL_yuv_c.h"
 
 #include "yuv2rgb/yuv_rgb.h"
 


More information about the commits mailing list