Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed bug 4277 - warnings patch
Sylvain

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

They are automatically enabled with -Wall
  • Loading branch information
slouken committed Sep 27, 2018
1 parent d9fb77a commit 7df0f4f
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 12 deletions.
2 changes: 1 addition & 1 deletion include/SDL_sensor.h
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions include/SDL_vulkan.h
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions src/core/android/SDL_android.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions src/core/android/SDL_android.h
Expand Up @@ -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>
Expand All @@ -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* */
Expand Down
1 change: 1 addition & 0 deletions src/cpuinfo/SDL_cpuinfo.c
Expand Up @@ -22,6 +22,7 @@
#include "SDL_config.h"
#else
#include "../SDL_internal.h"
#include "SDL_simd.h"
#endif

#if defined(__WIN32__)
Expand Down
28 changes: 27 additions & 1 deletion src/hidapi/android/hid.cpp
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/hidapi/hidapi/hidapi.h
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion src/render/SDL_render.c
Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions src/sensor/SDL_sensor.c
Expand Up @@ -48,15 +48,15 @@ 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) {
SDL_LockMutex(SDL_sensor_lock);
}
}

void
static void
SDL_UnlockSensors(void)
{
if (SDL_sensor_lock) {
Expand Down Expand Up @@ -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;
Expand Down
51 changes: 51 additions & 0 deletions src/video/SDL_blit_N.c
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/video/SDL_surface.c
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/video/SDL_yuv.c
Expand Up @@ -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"

Expand Down

0 comments on commit 7df0f4f

Please sign in to comment.