SDL_GetSensors() follows the SDL_GetStringRule

This commit is contained in:
Sam Lantinga
2024-07-18 22:10:29 -07:00
parent 4f8c348402
commit 856d598d6e
6 changed files with 10 additions and 15 deletions

View File

@@ -470,7 +470,7 @@ SDL_DYNAPI_PROC(int,SDL_GetSensorNonPortableTypeForID,(SDL_SensorID a),(a),retur
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetSensorProperties,(SDL_Sensor *a),(a),return)
SDL_DYNAPI_PROC(SDL_SensorType,SDL_GetSensorType,(SDL_Sensor *a),(a),return)
SDL_DYNAPI_PROC(SDL_SensorType,SDL_GetSensorTypeForID,(SDL_SensorID a),(a),return)
SDL_DYNAPI_PROC(SDL_SensorID*,SDL_GetSensors,(int *a),(a),return)
SDL_DYNAPI_PROC(const SDL_SensorID*,SDL_GetSensors,(int *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_GetSilenceValueForFormat,(SDL_AudioFormat a),(a),return)
SDL_DYNAPI_PROC(int,SDL_GetStorageFileSize,(SDL_Storage *a, const char *b, Uint64 *c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_GetStoragePathInfo,(SDL_Storage *a, const char *b, SDL_PathInfo *c),(a,b,c),return)

View File

@@ -858,7 +858,7 @@ static SDL_bool IsROGAlly(SDL_Joystick *joystick)
SDL_bool has_ally_gyro = SDL_FALSE;
if (SDL_InitSubSystem(SDL_INIT_SENSOR) == 0) {
SDL_SensorID *sensors = SDL_GetSensors(NULL);
const SDL_SensorID *sensors = SDL_GetSensors(NULL);
if (sensors) {
int i;
for (i = 0; sensors[i]; ++i) {
@@ -877,7 +877,6 @@ static SDL_bool IsROGAlly(SDL_Joystick *joystick)
}
}
}
SDL_free(sensors);
}
SDL_QuitSubSystem(SDL_INIT_SENSOR);
}
@@ -952,7 +951,7 @@ static SDL_bool ShouldAttemptSensorFusion(SDL_Joystick *joystick, SDL_bool *inve
static void AttemptSensorFusion(SDL_Joystick *joystick, SDL_bool invert_sensors)
{
SDL_SensorID *sensors;
const SDL_SensorID *sensors;
unsigned int i, j;
SDL_AssertJoysticksLocked();
@@ -981,7 +980,6 @@ static void AttemptSensorFusion(SDL_Joystick *joystick, SDL_bool invert_sensors)
SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_GYRO, 0.0f);
}
}
SDL_free(sensors);
}
SDL_QuitSubSystem(SDL_INIT_SENSOR);

View File

@@ -170,7 +170,7 @@ SDL_bool SDL_SensorsOpened(void)
return opened;
}
SDL_SensorID *SDL_GetSensors(int *count)
const SDL_SensorID *SDL_GetSensors(int *count)
{
int i, num_sensors, device_index;
int sensor_index = 0, total_sensors = 0;
@@ -207,7 +207,7 @@ SDL_SensorID *SDL_GetSensors(int *count)
}
SDL_UnlockSensors();
return sensors;
return SDL_FreeLater(sensors);
}
/*