Pointer as bool (libsdl-org#7214)

This commit is contained in:
Sylvain
2023-11-09 22:29:15 +01:00
committed by Sam Lantinga
parent 23db971681
commit d8600f717e
371 changed files with 2448 additions and 2442 deletions

View File

@@ -329,7 +329,7 @@ SDL_Sensor *SDL_OpenSensor(SDL_SensorID instance_id)
/* Create and initialize the sensor */
sensor = (SDL_Sensor *)SDL_calloc(sizeof(*sensor), 1);
if (sensor == NULL) {
if (!sensor) {
SDL_OutOfMemory();
SDL_UnlockSensors();
return NULL;

View File

@@ -138,7 +138,7 @@ static int SDL_ANDROID_SensorInit(void)
ASensorList sensors;
SDL_sensor_manager = ASensorManager_getInstance();
if (SDL_sensor_manager == NULL) {
if (!SDL_sensor_manager) {
return SDL_SetError("Couldn't create sensor manager");
}
@@ -146,7 +146,7 @@ static int SDL_ANDROID_SensorInit(void)
sensors_count = ASensorManager_getSensorList(SDL_sensor_manager, &sensors);
if (sensors_count > 0) {
SDL_sensors = (SDL_AndroidSensor *)SDL_calloc(sensors_count, sizeof(*SDL_sensors));
if (SDL_sensors == NULL) {
if (!SDL_sensors) {
return SDL_OutOfMemory();
}

View File

@@ -51,7 +51,7 @@ static int SDL_VITA_SensorInit(void)
SDL_sensors_count = 2;
SDL_sensors = (SDL_VitaSensor *)SDL_calloc(SDL_sensors_count, sizeof(*SDL_sensors));
if (SDL_sensors == NULL) {
if (!SDL_sensors) {
return SDL_OutOfMemory();
}
@@ -118,7 +118,7 @@ static int SDL_VITA_SensorOpen(SDL_Sensor *sensor, int device_index)
struct sensor_hwdata *hwdata;
hwdata = (struct sensor_hwdata *)SDL_calloc(1, sizeof(*hwdata));
if (hwdata == NULL) {
if (!hwdata) {
return SDL_OutOfMemory();
}
sensor->hwdata = hwdata;

View File

@@ -62,7 +62,7 @@ static int DisconnectSensor(ISensor *sensor);
static HRESULT STDMETHODCALLTYPE ISensorManagerEventsVtbl_QueryInterface(ISensorManagerEvents *This, REFIID riid, void **ppvObject)
{
if (ppvObject == NULL) {
if (!ppvObject) {
return E_INVALIDARG;
}
@@ -102,7 +102,7 @@ static ISensorManagerEvents sensor_manager_events = {
static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_QueryInterface(ISensorEvents *This, REFIID riid, void **ppvObject)
{
if (ppvObject == NULL) {
if (!ppvObject) {
return E_INVALIDARG;
}
@@ -295,13 +295,13 @@ static int ConnectSensor(ISensor *sensor)
if (bstr_name != NULL) {
SysFreeString(bstr_name);
}
if (name == NULL) {
if (!name) {
return SDL_OutOfMemory();
}
SDL_LockSensors();
new_sensors = (SDL_Windows_Sensor *)SDL_realloc(SDL_sensors, (SDL_num_sensors + 1) * sizeof(SDL_Windows_Sensor));
if (new_sensors == NULL) {
if (!new_sensors) {
SDL_UnlockSensors();
SDL_free(name);
return SDL_OutOfMemory();