Procházet zdrojové kódy

Fixed bug 4277 - warnings patch

Sylvain

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

They are automatically enabled with -Wall
Sam Lantinga před 6 roky
rodič
revize
7df0f4fdac

+ 1 - 1
include/SDL_sensor.h

@@ -41,7 +41,7 @@ extern "C" {
 #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

+ 2 - 2
include/SDL_vulkan.h

@@ -137,9 +137,9 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
  *
  *  \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.

+ 5 - 0
src/core/android/SDL_android.c

@@ -144,6 +144,10 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText)(
         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 @@ JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveHaptic)(
 /* #define DEBUG_JNI */
 
 static void Android_JNI_ThreadDestroyed(void*);
+static void checkJNIReady(void);
 
 /*******************************************************************************
  This file links the Java side of Android with libsdl

+ 9 - 2
src/core/android/SDL_android.h

@@ -85,8 +85,9 @@ void Android_JNI_HapticStop(int device_id);
 void Android_JNI_SuspendScreenSaver(SDL_bool suspend);
 
 /* Touch support */
-int Android_JNI_GetTouchDeviceIds(int **ids);
+int Android_JNI_InitTouch(void);
 void Android_JNI_SetSeparateMouseAndTouch(SDL_bool new_value);
+int Android_JNI_GetTouchDeviceIds(int **ids);
 
 /* Threads */
 #include <jni.h>
@@ -109,9 +110,15 @@ SDL_bool Android_JNI_SetCustomCursor(int cursorID);
 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* */

+ 1 - 0
src/cpuinfo/SDL_cpuinfo.c

@@ -22,6 +22,7 @@
 #include "SDL_config.h"
 #else
 #include "../SDL_internal.h"
+#include "SDL_simd.h"
 #endif
 
 #if defined(__WIN32__)

+ 27 - 1
src/hidapi/android/hid.cpp

@@ -336,7 +336,7 @@ static jmethodID g_midHIDDeviceManagerSendFeatureReport;
 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 @@ static void ThreadDestroyed(void* value)
 	}
 }
 
+
+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)
 {

+ 1 - 1
src/hidapi/hidapi/hidapi.h

@@ -225,7 +225,7 @@ namespace NAMESPACE {
 				-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.
 

+ 2 - 1
src/render/SDL_render.c

@@ -521,7 +521,8 @@ GetClosestSupportedFormat(SDL_Renderer * renderer, Uint32 format)
     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);
 

+ 3 - 3
src/sensor/SDL_sensor.c

@@ -48,7 +48,7 @@ static SDL_bool SDL_updating_sensor = SDL_FALSE;
 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 @@ SDL_LockSensors(void)
     }
 }
 
-void
+static void
 SDL_UnlockSensors(void)
 {
     if (SDL_sensor_lock) {
@@ -118,7 +118,7 @@ SDL_SensorID SDL_GetNextSensorInstanceID()
  * 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;

+ 51 - 0
src/video/SDL_blit_N.c

@@ -2333,6 +2333,30 @@ BlitNtoNKey(SDL_BlitInfo * info)
     /* 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 @@ BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info)
     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(

+ 1 - 1
src/video/SDL_surface.c

@@ -37,7 +37,7 @@ SDL_COMPILE_TIME_ASSERT(surface_size_assumptions,
 /*
  * Calculate the pad-aligned scanline width of a surface
  */
-int
+static int
 SDL_CalculatePitch(Uint32 format, int width)
 {
     int pitch;

+ 1 - 0
src/video/SDL_yuv.c

@@ -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"