mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-07 11:58:12 +00:00
Add 'const' to pointer parameters
This commit is contained in:

committed by
Sam Lantinga

parent
911e53dece
commit
b5297de56f
@@ -444,7 +444,7 @@ static void SincTable(float *table, int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate Sinc(x/y), using a lookup table
|
// Calculate Sinc(x/y), using a lookup table
|
||||||
static float Sinc(float *table, int x, int y)
|
static float Sinc(const float *table, int x, int y)
|
||||||
{
|
{
|
||||||
float s = table[x % y];
|
float s = table[x % y];
|
||||||
s = ((x / y) & 1) ? -s : s;
|
s = ((x / y) & 1) ? -s : s;
|
||||||
|
@@ -566,7 +566,7 @@ static enum snd_pcm_chmap_position sdl_channel_maps[SDL_AUDIO_ALSA__SDL_CHMAPS_N
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Helper for the function right below.
|
// Helper for the function right below.
|
||||||
static bool has_pos(unsigned int *chmap, unsigned int pos)
|
static bool has_pos(const unsigned int *chmap, unsigned int pos)
|
||||||
{
|
{
|
||||||
for (unsigned int chan_idx = 0; ; chan_idx++) {
|
for (unsigned int chan_idx = 0; ; chan_idx++) {
|
||||||
if (chan_idx == 6) {
|
if (chan_idx == 6) {
|
||||||
@@ -586,7 +586,7 @@ static bool has_pos(unsigned int *chmap, unsigned int pos)
|
|||||||
#define HAVE_REAR 1
|
#define HAVE_REAR 1
|
||||||
#define HAVE_SIDE 2
|
#define HAVE_SIDE 2
|
||||||
#define HAVE_BOTH 3
|
#define HAVE_BOTH 3
|
||||||
static void sdl_6chans_set_rear_or_side_channels_from_alsa_6chans(unsigned int *sdl_6chans, unsigned int *alsa_6chans)
|
static void sdl_6chans_set_rear_or_side_channels_from_alsa_6chans(unsigned int *sdl_6chans, const unsigned int *alsa_6chans)
|
||||||
{
|
{
|
||||||
// For alsa channel maps with 6 channels and with SND_CHMAP_FL,SND_CHMAP_FR,SND_CHMAP_FC,
|
// For alsa channel maps with 6 channels and with SND_CHMAP_FL,SND_CHMAP_FR,SND_CHMAP_FC,
|
||||||
// SND_CHMAP_LFE, reduce our 6 channels maps to a uniq one.
|
// SND_CHMAP_LFE, reduce our 6 channels maps to a uniq one.
|
||||||
@@ -638,7 +638,7 @@ static void sdl_6chans_set_rear_or_side_channels_from_alsa_6chans(unsigned int *
|
|||||||
#undef HAVE_SIDE
|
#undef HAVE_SIDE
|
||||||
#undef HAVE_BOTH
|
#undef HAVE_BOTH
|
||||||
|
|
||||||
static void swizzle_map_compute_alsa_subscan(struct ALSA_pcm_cfg_ctx *ctx, int *swizzle_map, unsigned int sdl_pos_idx)
|
static void swizzle_map_compute_alsa_subscan(const struct ALSA_pcm_cfg_ctx *ctx, int *swizzle_map, unsigned int sdl_pos_idx)
|
||||||
{
|
{
|
||||||
swizzle_map[sdl_pos_idx] = -1;
|
swizzle_map[sdl_pos_idx] = -1;
|
||||||
for (unsigned int alsa_pos_idx = 0; ; alsa_pos_idx++) {
|
for (unsigned int alsa_pos_idx = 0; ; alsa_pos_idx++) {
|
||||||
@@ -652,7 +652,7 @@ static void swizzle_map_compute_alsa_subscan(struct ALSA_pcm_cfg_ctx *ctx, int *
|
|||||||
}
|
}
|
||||||
|
|
||||||
// XXX: this must stay playback/recording symetric.
|
// XXX: this must stay playback/recording symetric.
|
||||||
static void swizzle_map_compute(struct ALSA_pcm_cfg_ctx *ctx, int *swizzle_map, bool *needs_swizzle)
|
static void swizzle_map_compute(const struct ALSA_pcm_cfg_ctx *ctx, int *swizzle_map, bool *needs_swizzle)
|
||||||
{
|
{
|
||||||
*needs_swizzle = false;
|
*needs_swizzle = false;
|
||||||
for (unsigned int sdl_pos_idx = 0; sdl_pos_idx != ctx->chans_n; sdl_pos_idx++) {
|
for (unsigned int sdl_pos_idx = 0; sdl_pos_idx != ctx->chans_n; sdl_pos_idx++) {
|
||||||
@@ -668,7 +668,7 @@ static void swizzle_map_compute(struct ALSA_pcm_cfg_ctx *ctx, int *swizzle_map,
|
|||||||
#define CHMAP_NOT_FOUND 2
|
#define CHMAP_NOT_FOUND 2
|
||||||
// Should always be a queried alsa channel map unless the queried alsa channel map was of type VAR,
|
// Should always be a queried alsa channel map unless the queried alsa channel map was of type VAR,
|
||||||
// namely we can program the channel positions directly from the SDL channel map.
|
// namely we can program the channel positions directly from the SDL channel map.
|
||||||
static int alsa_chmap_install(struct ALSA_pcm_cfg_ctx *ctx, unsigned int *chmap)
|
static int alsa_chmap_install(struct ALSA_pcm_cfg_ctx *ctx, const unsigned int *chmap)
|
||||||
{
|
{
|
||||||
bool isstack;
|
bool isstack;
|
||||||
snd_pcm_chmap_t *chmap_to_install = (snd_pcm_chmap_t*)SDL_small_alloc(unsigned int, 1 + ctx->chans_n, &isstack);
|
snd_pcm_chmap_t *chmap_to_install = (snd_pcm_chmap_t*)SDL_small_alloc(unsigned int, 1 + ctx->chans_n, &isstack);
|
||||||
@@ -698,7 +698,7 @@ static int alsa_chmap_install(struct ALSA_pcm_cfg_ctx *ctx, unsigned int *chmap)
|
|||||||
|
|
||||||
// We restrict the alsa channel maps because in the unordered matches we do only simple accounting.
|
// We restrict the alsa channel maps because in the unordered matches we do only simple accounting.
|
||||||
// In the end, this will handle mostly alsa channel maps with more than one SND_CHMAP_NA position fillers.
|
// In the end, this will handle mostly alsa channel maps with more than one SND_CHMAP_NA position fillers.
|
||||||
static bool alsa_chmap_has_duplicate_position(struct ALSA_pcm_cfg_ctx *ctx, unsigned int *pos)
|
static bool alsa_chmap_has_duplicate_position(const struct ALSA_pcm_cfg_ctx *ctx, const unsigned int *pos)
|
||||||
{
|
{
|
||||||
if (ctx->chans_n < 2) {// we need at least 2 positions
|
if (ctx->chans_n < 2) {// we need at least 2 positions
|
||||||
LOGDEBUG("channel map:no duplicate");
|
LOGDEBUG("channel map:no duplicate");
|
||||||
|
@@ -1586,7 +1586,7 @@ static void VULKAN_INTERNAL_RemoveMemoryUsedRegion(
|
|||||||
|
|
||||||
static bool VULKAN_INTERNAL_CheckMemoryTypeArrayUnique(
|
static bool VULKAN_INTERNAL_CheckMemoryTypeArrayUnique(
|
||||||
Uint32 memoryTypeIndex,
|
Uint32 memoryTypeIndex,
|
||||||
Uint32 *memoryTypeIndexArray,
|
const Uint32 *memoryTypeIndexArray,
|
||||||
Uint32 count)
|
Uint32 count)
|
||||||
{
|
{
|
||||||
Uint32 i = 0;
|
Uint32 i = 0;
|
||||||
@@ -4448,7 +4448,7 @@ static bool VULKAN_INTERNAL_VerifySwapSurfaceFormat(
|
|||||||
|
|
||||||
static bool VULKAN_INTERNAL_VerifySwapPresentMode(
|
static bool VULKAN_INTERNAL_VerifySwapPresentMode(
|
||||||
VkPresentModeKHR presentMode,
|
VkPresentModeKHR presentMode,
|
||||||
VkPresentModeKHR *availablePresentModes,
|
const VkPresentModeKHR *availablePresentModes,
|
||||||
Uint32 availablePresentModesLength)
|
Uint32 availablePresentModesLength)
|
||||||
{
|
{
|
||||||
Uint32 i;
|
Uint32 i;
|
||||||
|
@@ -428,7 +428,7 @@ static bool SDLCALL SDL_GamepadEventWatcher(void *userdata, SDL_Event *event)
|
|||||||
orientation, so when it's changed orientation to be used as a
|
orientation, so when it's changed orientation to be used as a
|
||||||
gamepad, change the sensor orientation to match.
|
gamepad, change the sensor orientation to match.
|
||||||
*/
|
*/
|
||||||
static void AdjustSensorOrientation(SDL_Joystick *joystick, float *src, float *dst)
|
static void AdjustSensorOrientation(const SDL_Joystick *joystick, const float *src, float *dst)
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
|
||||||
|
@@ -272,7 +272,7 @@ void Wayland_primary_selection_source_set_callback(SDL_WaylandPrimarySelectionSo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *Wayland_clone_data_buffer(const void *buffer, size_t *len)
|
static void *Wayland_clone_data_buffer(const void *buffer, const size_t *len)
|
||||||
{
|
{
|
||||||
void *clone = NULL;
|
void *clone = NULL;
|
||||||
if (*len > 0 && buffer) {
|
if (*len > 0 && buffer) {
|
||||||
|
@@ -152,7 +152,7 @@ perspective_matrix(float fovy, float aspect, float znear, float zfar, float *r)
|
|||||||
* major. In-place multiplication is supported.
|
* major. In-place multiplication is supported.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
multiply_matrix(float *lhs, float *rhs, float *r)
|
multiply_matrix(const float *lhs, const float *rhs, float *r)
|
||||||
{
|
{
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
float tmp[16];
|
float tmp[16];
|
||||||
|
Reference in New Issue
Block a user