Skip to content

Commit

Permalink
Remove tabs and trailing spaces from source files.
Browse files Browse the repository at this point in the history
  • Loading branch information
SiegeLordEx authored and SiegeLord committed Jan 3, 2025
1 parent 3443ba2 commit 9a08304
Show file tree
Hide file tree
Showing 363 changed files with 7,966 additions and 7,992 deletions.
2 changes: 1 addition & 1 deletion addons/acodec/flac.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ static FLAC__StreamDecoderLengthStatus length_callback(
FLACFILE *ff = (FLACFILE *)dptr;
ALLEGRO_FILE *fh = ff->fh;
(void)decoder;

/* XXX check error */
*stream_length = (FLAC__uint64)al_fsize(fh);

Expand Down
16 changes: 8 additions & 8 deletions addons/acodec/ogg.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ ALLEGRO_SAMPLE *_al_load_ogg_vorbis(const char *filename)
ALLEGRO_FILE *f;
ALLEGRO_SAMPLE *spl;
ASSERT(filename);

ALLEGRO_INFO("Loading sample %s.\n", filename);
f = al_fopen(filename, "rb");
if (!f) {
Expand Down Expand Up @@ -348,7 +348,7 @@ static bool ogg_stream_set_loop(ALLEGRO_AUDIO_STREAM *stream, double start, doub

extra->loop_start = start;
extra->loop_end = end;

return true;
}

Expand All @@ -373,7 +373,7 @@ static size_t ogg_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data,
size_t buf_size)
{
AL_OV_DATA *extra = (AL_OV_DATA *) stream->extra;

#ifdef ALLEGRO_LITTLE_ENDIAN
const int endian = 0; /* 0 for Little-Endian, 1 for Big-Endian */
#else
Expand All @@ -392,7 +392,7 @@ static size_t ogg_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data,
double rate = extra->vi->rate;
double btime = ((double)buf_size / ((double)word_size * (double)extra->vi->channels)) / rate;
unsigned long read;

if (stream->spl.loop != _ALLEGRO_PLAYMODE_STREAM_ONCE && ctime + btime > extra->loop_end) {
const int frame_size = word_size * extra->vi->channels;
read_length = (extra->loop_end - ctime) * rate * (double)word_size * (double)extra->vi->channels;
Expand All @@ -413,7 +413,7 @@ static size_t ogg_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data,
read_length - pos, &extra->bitstream);
#endif
pos += read;

if (read == 0) {
/* Return the number of useful bytes written. */
return pos;
Expand Down Expand Up @@ -471,7 +471,7 @@ ALLEGRO_AUDIO_STREAM *_al_load_ogg_vorbis_audio_stream_f(ALLEGRO_FILE *file,
}

extra->file = file;

vf = al_malloc(sizeof(OggVorbis_File));
if (lib.ov_open_callbacks(extra, vf, NULL, 0, callbacks) < 0) {
ALLEGRO_ERROR("ogg: Input does not appear to be an Ogg bitstream.\n");
Expand All @@ -495,7 +495,7 @@ ALLEGRO_AUDIO_STREAM *_al_load_ogg_vorbis_audio_stream_f(ALLEGRO_FILE *file,
ALLEGRO_DEBUG("rate %ld\n", rate);
ALLEGRO_DEBUG("total_samples %ld\n", total_samples);
ALLEGRO_DEBUG("total_size %ld\n", total_size);

stream = al_create_audio_stream(buffer_count, samples, rate,
_al_word_size_to_depth_conf(word_size),
_al_count_to_channel_conf(channels));
Expand All @@ -519,7 +519,7 @@ ALLEGRO_AUDIO_STREAM *_al_load_ogg_vorbis_audio_stream_f(ALLEGRO_FILE *file,
stream->set_feeder_loop = ogg_stream_set_loop;
stream->unload_feeder = ogg_stream_close;
_al_acodec_start_feed_thread(stream);

return stream;
}

Expand Down
2 changes: 1 addition & 1 deletion addons/acodec/voc.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ ALLEGRO_SAMPLE *_al_load_voc(const char *filename)
ALLEGRO_FILE *f;
ALLEGRO_SAMPLE *spl;
ASSERT(filename);

ALLEGRO_INFO("Loading VOC sample %s.\n", filename);
f = al_fopen(filename, "rb");
if (!f) {
Expand Down
18 changes: 9 additions & 9 deletions addons/acodec/wav.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Allegro5 WAV reader
* author: Matthew Leverton
* author: Matthew Leverton
*/

#include <stdio.h>
Expand All @@ -15,7 +15,7 @@ ALLEGRO_DEBUG_CHANNEL("wav")

typedef struct WAVFILE
{
ALLEGRO_FILE *f;
ALLEGRO_FILE *f;
size_t dpos; /* the starting position of the data chunk */
int freq; /* e.g., 44100 */
short bits; /* 8 (unsigned char) or 16 (signed short) */
Expand Down Expand Up @@ -61,7 +61,7 @@ static WAVFILE *wav_open(ALLEGRO_FILE *f)
ALLEGRO_ERROR("Bad magic number.\n");
goto wav_open_error;
}

/* Read as many leading fmt chunks as exist, then read until a data chunk
* is found.
*/
Expand Down Expand Up @@ -100,9 +100,9 @@ static WAVFILE *wav_open(ALLEGRO_FILE *f)

/* sample frequency */
wavfile->freq = al_fread32le(f);

/* skip six bytes */
al_fseek(f, 6, ALLEGRO_SEEK_CUR);
al_fseek(f, 6, ALLEGRO_SEEK_CUR);

/* 8 or 16 bit data? */
wavfile->bits = al_fread16le(f);
Expand Down Expand Up @@ -263,7 +263,7 @@ static size_t wav_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data,
bytes_per_sample = (wavfile->bits / 8) * wavfile->channels;
ctime = wav_stream_get_position(stream);
btime = ((double)buf_size / (double)bytes_per_sample) / (double)(wavfile->freq);

if (stream->spl.loop != _ALLEGRO_PLAYMODE_STREAM_ONCE && ctime + btime > wavfile->loop_end) {
samples = ((wavfile->loop_end - ctime) * (double)(wavfile->freq));
}
Expand All @@ -287,7 +287,7 @@ static void wav_stream_close(ALLEGRO_AUDIO_STREAM *stream)
WAVFILE *wavfile = (WAVFILE *) stream->extra;

_al_acodec_stop_feed_thread(stream);

al_fclose(wavfile->f);
wav_close(wavfile);
stream->extra = NULL;
Expand Down Expand Up @@ -380,7 +380,7 @@ ALLEGRO_AUDIO_STREAM *_al_load_wav_audio_stream_f(ALLEGRO_FILE* f,
ALLEGRO_AUDIO_STREAM* stream;

wavfile = wav_open(f);

if (wavfile == NULL) {
ALLEGRO_ERROR("Failed to load wav file.\n");
return NULL;
Expand Down Expand Up @@ -429,7 +429,7 @@ bool _al_save_wav(const char *filename, ALLEGRO_SAMPLE *spl)
ALLEGRO_ERROR("Unable to open %s for writing.\n", filename);
}

return false;
return false;
}


Expand Down
32 changes: 16 additions & 16 deletions addons/audio/allegro5/allegro_audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,35 +388,35 @@ ALLEGRO_KCM_AUDIO_FUNC(void, al_unlock_sample_id, (ALLEGRO_SAMPLE_ID *spl_id));

/* File type handlers */
ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_sample_loader, (const char *ext,
ALLEGRO_SAMPLE *(*loader)(const char *filename)));
ALLEGRO_SAMPLE *(*loader)(const char *filename)));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_sample_saver, (const char *ext,
bool (*saver)(const char *filename, ALLEGRO_SAMPLE *spl)));
bool (*saver)(const char *filename, ALLEGRO_SAMPLE *spl)));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_audio_stream_loader, (const char *ext,
ALLEGRO_AUDIO_STREAM *(*stream_loader)(const char *filename,
size_t buffer_count, unsigned int samples)));
ALLEGRO_AUDIO_STREAM *(*stream_loader)(const char *filename,
size_t buffer_count, unsigned int samples)));

ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_sample_loader_f, (const char *ext,
ALLEGRO_SAMPLE *(*loader)(ALLEGRO_FILE *fp)));
ALLEGRO_SAMPLE *(*loader)(ALLEGRO_FILE *fp)));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_sample_saver_f, (const char *ext,
bool (*saver)(ALLEGRO_FILE *fp, ALLEGRO_SAMPLE *spl)));
bool (*saver)(ALLEGRO_FILE *fp, ALLEGRO_SAMPLE *spl)));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_audio_stream_loader_f, (const char *ext,
ALLEGRO_AUDIO_STREAM *(*stream_loader)(ALLEGRO_FILE *fp,
size_t buffer_count, unsigned int samples)));
ALLEGRO_AUDIO_STREAM *(*stream_loader)(ALLEGRO_FILE *fp,
size_t buffer_count, unsigned int samples)));

ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_sample_identifier, (const char *ext,
bool (*identifier)(ALLEGRO_FILE *fp)));
bool (*identifier)(ALLEGRO_FILE *fp)));

ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_SAMPLE *, al_load_sample, (const char *filename));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_save_sample, (const char *filename,
ALLEGRO_SAMPLE *spl));
ALLEGRO_SAMPLE *spl));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_STREAM *, al_load_audio_stream, (const char *filename,
size_t buffer_count, unsigned int samples));
size_t buffer_count, unsigned int samples));

ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_SAMPLE *, al_load_sample_f, (ALLEGRO_FILE* fp, const char *ident));
ALLEGRO_KCM_AUDIO_FUNC(bool, al_save_sample_f, (ALLEGRO_FILE* fp, const char *ident,
ALLEGRO_SAMPLE *spl));
ALLEGRO_SAMPLE *spl));
ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_STREAM *, al_load_audio_stream_f, (ALLEGRO_FILE* fp, const char *ident,
size_t buffer_count, unsigned int samples));
size_t buffer_count, unsigned int samples));

ALLEGRO_KCM_AUDIO_FUNC(char const *, al_identify_sample_f, (ALLEGRO_FILE *fp));
ALLEGRO_KCM_AUDIO_FUNC(char const *, al_identify_sample, (char const *filename));
Expand All @@ -435,7 +435,7 @@ ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_RECORDER_EVENT *, al_get_audio_recorder_eve
ALLEGRO_KCM_AUDIO_FUNC(void, al_destroy_audio_recorder, (ALLEGRO_AUDIO_RECORDER *r));

#endif

#ifdef __cplusplus
} /* End extern "C" */
#endif
Expand Down
36 changes: 18 additions & 18 deletions addons/audio/alsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ static void alsa_close(void)

if (alsa_device != default_device)
al_free(alsa_device);

alsa_device = NULL;

snd_output_close(snd_output);
snd_config_update_free_global();
}
Expand Down Expand Up @@ -757,13 +757,13 @@ static void *alsa_update_recorder(ALLEGRO_THREAD *t, void *thread_data)
ALLEGRO_EVENT user_event;
uint8_t *null_buffer;
unsigned int fragment_i = 0;

null_buffer = al_malloc(1024 * r->sample_size);
if (!null_buffer) {
ALLEGRO_ERROR("Unable to create buffer for draining ALSA.\n");
return NULL;
}

while (!al_get_thread_should_stop(t))
{
al_lock_mutex(r->mutex);
Expand All @@ -786,7 +786,7 @@ static void *alsa_update_recorder(ALLEGRO_THREAD *t, void *thread_data)
e->buffer = r->fragments[fragment_i];
e->samples = count;
al_emit_user_event(&r->source, &user_event, NULL);

if (++fragment_i == r->fragment_count) {
fragment_i = 0;
}
Expand All @@ -811,11 +811,11 @@ static int alsa_allocate_recorder(ALLEGRO_AUDIO_RECORDER *r)
device = config_device;

data = al_calloc(1, sizeof(*data));

if (!data) {
goto Error;
}

if (r->depth == ALLEGRO_AUDIO_DEPTH_INT8)
format = SND_PCM_FORMAT_S8;
else if (r->depth == ALLEGRO_AUDIO_DEPTH_UINT8)
Expand All @@ -832,31 +832,31 @@ static int alsa_allocate_recorder(ALLEGRO_AUDIO_RECORDER *r)
format = SND_PCM_FORMAT_FLOAT;
else
goto Error;

ALSA_CHECK(snd_pcm_open(&data->capture_handle, device, SND_PCM_STREAM_CAPTURE, 0));
ALSA_CHECK(snd_pcm_hw_params_malloc(&data->hw_params));
ALSA_CHECK(snd_pcm_hw_params_any(data->capture_handle, data->hw_params));
ALSA_CHECK(snd_pcm_hw_params_set_access(data->capture_handle, data->hw_params, SND_PCM_ACCESS_RW_INTERLEAVED));
ALSA_CHECK(snd_pcm_hw_params_set_format(data->capture_handle, data->hw_params, format));
ALSA_CHECK(snd_pcm_hw_params_set_rate_near(data->capture_handle, data->hw_params, &frequency, 0));

if (frequency != r->frequency) {
ALLEGRO_ERROR("Unsupported rate! Requested %u, got %iu.\n", r->frequency, frequency);
goto Error;
}

ALSA_CHECK(snd_pcm_hw_params_set_channels(data->capture_handle, data->hw_params, al_get_channel_count(r->chan_conf)));
ALSA_CHECK(snd_pcm_hw_params(data->capture_handle, data->hw_params));

ALSA_CHECK(snd_pcm_prepare(data->capture_handle));

r->extra = data;
r->thread = al_create_thread(alsa_update_recorder, r);

return 0;

Error:

if (data) {
if (data->hw_params) {
snd_pcm_hw_params_free(data->hw_params);
Expand All @@ -866,14 +866,14 @@ static int alsa_allocate_recorder(ALLEGRO_AUDIO_RECORDER *r)
}
al_free(data);
}

return 1;
}

static void alsa_deallocate_recorder(ALLEGRO_AUDIO_RECORDER *r)
{
ALSA_RECORDER_DATA *data = r->extra;

snd_pcm_hw_params_free(data->hw_params);
snd_pcm_close(data->capture_handle);
}
Expand Down Expand Up @@ -971,7 +971,7 @@ static _AL_LIST* alsa_get_output_devices(void)

char* sep_at = strchr(name, '\n');
char* actual_name = sep_at ? sep_at + 1 : name;

/* Two string lengths + space + nul terminator. */
int len = strlen(actual_name) + strlen(card_name) + 1 + 1;
int identifier_len = strlen(identifier) + 1;
Expand Down
4 changes: 2 additions & 2 deletions addons/audio/aqueue.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* /\____/
* \_/__/
*
* Apple Audio Queue driver
* Apple Audio Queue driver
*
* By Trent Gamblin.
* By Trent Gamblin.
*
* See readme.txt for copyright information.
*/
Expand Down
Loading

0 comments on commit 9a08304

Please sign in to comment.