Skip to content

Commit d7939ab

Browse files
committed
Use consistent style for pointer declarations and casts
1 parent 390fe65 commit d7939ab

File tree

105 files changed

+339
-346
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+339
-346
lines changed

src/SDL_hints.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static void SDLCALL CleanupHintProperty(void *userdata, void *value)
8787
SDL_free(hint);
8888
}
8989

90-
static const char* GetHintEnvironmentVariable(const char *name)
90+
static const char *GetHintEnvironmentVariable(const char *name)
9191
{
9292
const char *result = SDL_getenv(name);
9393
if (!result && name && *name) {

src/atomic/SDL_atomic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ bool SDL_CompareAndSwapAtomicU32(SDL_AtomicU32 *a, Uint32 oldval, Uint32 newval)
163163
#elif defined(HAVE_GCC_ATOMICS)
164164
return __sync_bool_compare_and_swap(&a->value, oldval, newval);
165165
#elif defined(SDL_PLATFORM_MACOS) // this is deprecated in 10.12 sdk; favor gcc atomics.
166-
return OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*)&a->value);
166+
return OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t *)&a->value);
167167
#elif defined(SDL_PLATFORM_SOLARIS)
168168
SDL_COMPILE_TIME_ASSERT(atomic_cas, sizeof(uint_t) == sizeof(a->value));
169169
return ((Uint32)atomic_cas_uint((volatile uint_t *)&a->value, (uint_t)oldval, (uint_t)newval) == oldval);

src/audio/SDL_audiocvt.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ void ConvertAudio(int num_frames,
280280

281281
// swizzle input to "standard" format if necessary.
282282
if (src_map) {
283-
void* buf = scratch ? scratch : dst; // use scratch if available, since it has to be big enough to hold src, unless it's NULL, then dst has to be.
283+
void *buf = scratch ? scratch : dst; // use scratch if available, since it has to be big enough to hold src, unless it's NULL, then dst has to be.
284284
SwizzleAudio(num_frames, buf, src, src_channels, src_map, src_format);
285285
src = buf;
286286
}
@@ -318,7 +318,7 @@ void ConvertAudio(int num_frames,
318318

319319
// get us to float format.
320320
if (srcconvert) {
321-
void* buf = (channelconvert || dstconvert) ? scratch : dst;
321+
void *buf = (channelconvert || dstconvert) ? scratch : dst;
322322
ConvertAudioToFloat((float *) buf, src, num_frames * src_channels, src_format);
323323
src = buf;
324324
}
@@ -368,7 +368,7 @@ void ConvertAudio(int num_frames,
368368
channel_converter = override;
369369
}
370370

371-
void* buf = dstconvert ? scratch : dst;
371+
void *buf = dstconvert ? scratch : dst;
372372
channel_converter((float *) buf, (const float *) src, num_frames);
373373
src = buf;
374374
}
@@ -399,7 +399,7 @@ static int CalculateMaxFrameSize(SDL_AudioFormat src_format, int src_channels, S
399399
return max_format_size * max_channels;
400400
}
401401

402-
static Sint64 GetAudioStreamResampleRate(SDL_AudioStream* stream, int src_freq, Sint64 resample_offset)
402+
static Sint64 GetAudioStreamResampleRate(SDL_AudioStream *stream, int src_freq, Sint64 resample_offset)
403403
{
404404
src_freq = (int)((float)src_freq * stream->freq_ratio);
405405

@@ -778,9 +778,9 @@ static bool CheckAudioStreamIsFullySetup(SDL_AudioStream *stream)
778778
}
779779

780780
// you MUST hold `stream->lock` when calling this, and validate your parameters!
781-
static bool PutAudioStreamBufferInternal(SDL_AudioStream *stream, const SDL_AudioSpec *spec, const int *chmap, const void *buf, int len, SDL_ReleaseAudioBufferCallback callback, void* userdata)
781+
static bool PutAudioStreamBufferInternal(SDL_AudioStream *stream, const SDL_AudioSpec *spec, const int *chmap, const void *buf, int len, SDL_ReleaseAudioBufferCallback callback, void *userdata)
782782
{
783-
SDL_AudioTrack* track = NULL;
783+
SDL_AudioTrack *track = NULL;
784784

785785
if (callback) {
786786
track = SDL_CreateAudioTrack(stream->queue, spec, chmap, (Uint8 *)buf, len, len, callback, userdata);
@@ -809,7 +809,7 @@ static bool PutAudioStreamBufferInternal(SDL_AudioStream *stream, const SDL_Audi
809809
return retval;
810810
}
811811

812-
static bool PutAudioStreamBuffer(SDL_AudioStream *stream, const void *buf, int len, SDL_ReleaseAudioBufferCallback callback, void* userdata)
812+
static bool PutAudioStreamBuffer(SDL_AudioStream *stream, const void *buf, int len, SDL_ReleaseAudioBufferCallback callback, void *userdata)
813813
{
814814
#if DEBUG_AUDIOSTREAM
815815
SDL_Log("AUDIOSTREAM: wants to put %d bytes", len);
@@ -836,7 +836,7 @@ static bool PutAudioStreamBuffer(SDL_AudioStream *stream, const void *buf, int l
836836

837837
static void SDLCALL FreeAllocatedAudioBuffer(void *userdata, const void *buf, int len)
838838
{
839-
SDL_free((void*) buf);
839+
SDL_free((void *)buf);
840840
}
841841

842842
bool SDL_PutAudioStreamData(SDL_AudioStream *stream, const void *buf, int len)
@@ -1081,8 +1081,8 @@ static Uint8 *EnsureAudioStreamWorkBufferSize(SDL_AudioStream *stream, size_t ne
10811081
return ptr;
10821082
}
10831083

1084-
static Sint64 NextAudioStreamIter(SDL_AudioStream* stream, void** inout_iter,
1085-
Sint64* inout_resample_offset, SDL_AudioSpec* out_spec, int **out_chmap, bool* out_flushed)
1084+
static Sint64 NextAudioStreamIter(SDL_AudioStream *stream, void **inout_iter,
1085+
Sint64 *inout_resample_offset, SDL_AudioSpec *out_spec, int **out_chmap, bool *out_flushed)
10861086
{
10871087
SDL_AudioSpec spec;
10881088
bool flushed;
@@ -1136,9 +1136,9 @@ static Sint64 NextAudioStreamIter(SDL_AudioStream* stream, void** inout_iter,
11361136
return output_frames;
11371137
}
11381138

1139-
static Sint64 GetAudioStreamAvailableFrames(SDL_AudioStream* stream, Sint64* out_resample_offset)
1139+
static Sint64 GetAudioStreamAvailableFrames(SDL_AudioStream *stream, Sint64 *out_resample_offset)
11401140
{
1141-
void* iter = SDL_BeginAudioQueueIter(stream->queue);
1141+
void *iter = SDL_BeginAudioQueueIter(stream->queue);
11421142

11431143
Sint64 resample_offset = stream->resample_offset;
11441144
Sint64 output_frames = 0;
@@ -1160,9 +1160,9 @@ static Sint64 GetAudioStreamAvailableFrames(SDL_AudioStream* stream, Sint64* out
11601160
return output_frames;
11611161
}
11621162

1163-
static Sint64 GetAudioStreamHead(SDL_AudioStream* stream, SDL_AudioSpec* out_spec, int **out_chmap, bool* out_flushed)
1163+
static Sint64 GetAudioStreamHead(SDL_AudioStream *stream, SDL_AudioSpec *out_spec, int **out_chmap, bool *out_flushed)
11641164
{
1165-
void* iter = SDL_BeginAudioQueueIter(stream->queue);
1165+
void *iter = SDL_BeginAudioQueueIter(stream->queue);
11661166

11671167
if (!iter) {
11681168
SDL_zerop(out_spec);
@@ -1178,8 +1178,8 @@ static Sint64 GetAudioStreamHead(SDL_AudioStream* stream, SDL_AudioSpec* out_spe
11781178
// Enough input data MUST be available!
11791179
static bool GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int output_frames, float gain)
11801180
{
1181-
const SDL_AudioSpec* src_spec = &stream->input_spec;
1182-
const SDL_AudioSpec* dst_spec = &stream->dst_spec;
1181+
const SDL_AudioSpec *src_spec = &stream->input_spec;
1182+
const SDL_AudioSpec *dst_spec = &stream->dst_spec;
11831183

11841184
const SDL_AudioFormat src_format = src_spec->format;
11851185
const int src_channels = src_spec->channels;
@@ -1199,7 +1199,7 @@ static bool GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int o
11991199

12001200
// Not resampling? It's an easy conversion (and maybe not even that!)
12011201
if (resample_rate == 0) {
1202-
Uint8* work_buffer = NULL;
1202+
Uint8 *work_buffer = NULL;
12031203

12041204
// Ensure we have enough scratch space for any conversions
12051205
if ((src_format != dst_format) || (src_channels != dst_channels) || (gain != 1.0f)) {
@@ -1269,7 +1269,7 @@ static bool GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int o
12691269
work_buffer_capacity += resample_bytes;
12701270
}
12711271

1272-
Uint8* work_buffer = EnsureAudioStreamWorkBufferSize(stream, work_buffer_capacity);
1272+
Uint8 *work_buffer = EnsureAudioStreamWorkBufferSize(stream, work_buffer_capacity);
12731273

12741274
if (!work_buffer) {
12751275
return false;
@@ -1281,7 +1281,7 @@ static bool GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int o
12811281
const float postresample_gain = (input_frames > output_frames) ? gain : 1.0f;
12821282

12831283
// (dst channel map is NULL because we'll do the final swizzle on ConvertAudio after resample.)
1284-
const Uint8* input_buffer = SDL_ReadFromAudioQueue(stream->queue,
1284+
const Uint8 *input_buffer = SDL_ReadFromAudioQueue(stream->queue,
12851285
NULL, resample_format, resample_channels, NULL,
12861286
padding_frames, input_frames, padding_frames, work_buffer, preresample_gain);
12871287

@@ -1292,11 +1292,11 @@ static bool GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int o
12921292
input_buffer += padding_frames * resample_frame_size;
12931293

12941294
// Decide where the resampled output goes
1295-
void* resample_buffer = (resample_buffer_offset != -1) ? (work_buffer + resample_buffer_offset) : buf;
1295+
void *resample_buffer = (resample_buffer_offset != -1) ? (work_buffer + resample_buffer_offset) : buf;
12961296

12971297
SDL_ResampleAudio(resample_channels,
1298-
(const float *) input_buffer, input_frames,
1299-
(float*) resample_buffer, output_frames,
1298+
(const float *)input_buffer, input_frames,
1299+
(float *)resample_buffer, output_frames,
13001300
resample_rate, &stream->resample_offset);
13011301

13021302
// Convert to the final format, if necessary (src channel map is NULL because SDL_ReadFromAudioQueue already handled this).

0 commit comments

Comments
 (0)