Update for SDL3 coding style (#6717)

I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base.

In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted.

The script I ran for the src directory is added as build-scripts/clang-format-src.sh

This fixes:
#6592
#6593
#6594

(cherry picked from commit 5750bcb174)
This commit is contained in:
Sam Lantinga
2022-11-30 12:51:59 -08:00
parent 5c4bc807f7
commit b8d85c6939
764 changed files with 50598 additions and 54407 deletions

View File

@@ -35,7 +35,7 @@
//#include "../../core/android/SDL_android.h"
#ifndef LOOPER_ID_USER
#define LOOPER_ID_USER 3
#define LOOPER_ID_USER 3
#endif
typedef struct
@@ -44,13 +44,12 @@ typedef struct
SDL_SensorID instance_id;
} SDL_AndroidSensor;
static ASensorManager* SDL_sensor_manager;
static ALooper* SDL_sensor_looper;
static ASensorManager *SDL_sensor_manager;
static ALooper *SDL_sensor_looper;
static SDL_AndroidSensor *SDL_sensors;
static int SDL_sensors_count;
static int
SDL_ANDROID_SensorInit(void)
static int SDL_ANDROID_SensorInit(void)
{
int i, sensors_count;
ASensorList sensors;
@@ -85,25 +84,21 @@ SDL_ANDROID_SensorInit(void)
return 0;
}
static int
SDL_ANDROID_SensorGetCount(void)
static int SDL_ANDROID_SensorGetCount(void)
{
return SDL_sensors_count;
}
static void
SDL_ANDROID_SensorDetect(void)
static void SDL_ANDROID_SensorDetect(void)
{
}
static const char *
SDL_ANDROID_SensorGetDeviceName(int device_index)
static const char *SDL_ANDROID_SensorGetDeviceName(int device_index)
{
return ASensor_getName(SDL_sensors[device_index].asensor);
}
static SDL_SensorType
SDL_ANDROID_SensorGetDeviceType(int device_index)
static SDL_SensorType SDL_ANDROID_SensorGetDeviceType(int device_index)
{
switch (ASensor_getType(SDL_sensors[device_index].asensor)) {
case 0x00000001:
@@ -115,20 +110,17 @@ SDL_ANDROID_SensorGetDeviceType(int device_index)
}
}
static int
SDL_ANDROID_SensorGetDeviceNonPortableType(int device_index)
static int SDL_ANDROID_SensorGetDeviceNonPortableType(int device_index)
{
return ASensor_getType(SDL_sensors[device_index].asensor);
}
static SDL_SensorID
SDL_ANDROID_SensorGetDeviceInstanceID(int device_index)
static SDL_SensorID SDL_ANDROID_SensorGetDeviceInstanceID(int device_index)
{
return SDL_sensors[device_index].instance_id;
}
static int
SDL_ANDROID_SensorOpen(SDL_Sensor *sensor, int device_index)
static int SDL_ANDROID_SensorOpen(SDL_Sensor *sensor, int device_index)
{
struct sensor_hwdata *hwdata;
int delay_us, min_delay_us;
@@ -163,15 +155,14 @@ SDL_ANDROID_SensorOpen(SDL_Sensor *sensor, int device_index)
sensor->hwdata = hwdata;
return 0;
}
static void
SDL_ANDROID_SensorUpdate(SDL_Sensor *sensor)
static void SDL_ANDROID_SensorUpdate(SDL_Sensor *sensor)
{
int events;
ASensorEvent event;
struct android_poll_source* source;
struct android_poll_source *source;
if (ALooper_pollAll(0, NULL, &events, (void**)&source) == LOOPER_ID_USER) {
if (ALooper_pollAll(0, NULL, &events, (void **)&source) == LOOPER_ID_USER) {
SDL_zero(event);
while (ASensorEventQueue_getEvents(sensor->hwdata->eventqueue, &event, 1) > 0) {
SDL_PrivateSensorUpdate(sensor, 0, event.data, SDL_arraysize(event.data));
@@ -179,8 +170,7 @@ SDL_ANDROID_SensorUpdate(SDL_Sensor *sensor)
}
}
static void
SDL_ANDROID_SensorClose(SDL_Sensor *sensor)
static void SDL_ANDROID_SensorClose(SDL_Sensor *sensor)
{
if (sensor->hwdata) {
ASensorEventQueue_disableSensor(sensor->hwdata->eventqueue, sensor->hwdata->asensor);
@@ -190,8 +180,7 @@ SDL_ANDROID_SensorClose(SDL_Sensor *sensor)
}
}
static void
SDL_ANDROID_SensorQuit(void)
static void SDL_ANDROID_SensorQuit(void)
{
if (SDL_sensors) {
SDL_free(SDL_sensors);
@@ -200,8 +189,7 @@ SDL_ANDROID_SensorQuit(void)
}
}
SDL_SensorDriver SDL_ANDROID_SensorDriver =
{
SDL_SensorDriver SDL_ANDROID_SensorDriver = {
SDL_ANDROID_SensorInit,
SDL_ANDROID_SensorGetCount,
SDL_ANDROID_SensorDetect,