ref: 3f8133f5a1b3bdd4f00b7e4fd8972f5eedfe8d65
parent: 27a13d718cfec51e97b9dcbfa844dd001075c5bf
author: robs <robs>
date: Fri Jan 19 14:43:46 EST 2007
bool -> st_bool
--- a/src/auto.c
+++ b/src/auto.c
@@ -168,7 +168,7 @@
}
free(ft->filetype);
ft->filetype = strdup(type);
- rc = st_gettype(ft, true); /* Change ft->h to the new format */
+ rc = st_gettype(ft, st_true); /* Change ft->h to the new format */
if(rc != ST_SUCCESS)
{
st_fail_errno(ft,ST_EFMT,"Do not understand format type: %s",type);
--- a/src/biquad.h
+++ b/src/biquad.h
@@ -29,7 +29,7 @@
double gain;
double fc; /* Centre/corner/cutoff frequency */
union {double q, bandwidth, slope;} width; /* Depending on filter type */
- bool dcNormalise; /* A treble filter should normalise at DC */
+ st_bool dcNormalise; /* A treble filter should normalise at DC */
double b2, b1, b0; /* Filter coefficients */
double a2, a1, a0; /* Filter coefficients */
--- a/src/flac.c
+++ b/src/flac.c
@@ -146,7 +146,7 @@
return ST_EOF;
}
- FLAC__file_decoder_set_md5_checking(decoder->flac, true);
+ FLAC__file_decoder_set_md5_checking(decoder->flac, st_true);
FLAC__file_decoder_set_filename(decoder->flac, format->filename);
FLAC__file_decoder_set_write_callback(decoder->flac, FLAC__frame_decode_callback);
FLAC__file_decoder_set_metadata_callback(decoder->flac, FLAC__decoder_metadata_callback);
@@ -191,7 +191,7 @@
if (decoder->wide_sample_number >= decoder->number_of_wide_samples)
FLAC__file_decoder_process_single(decoder->flac);
if (decoder->wide_sample_number >= decoder->number_of_wide_samples)
- decoder->eof = true;
+ decoder->eof = st_true;
else {
unsigned channel;
@@ -287,15 +287,15 @@
int max_residual_partition_order;
int min_residual_partition_order;
} const options[] = {
- {1152, false, false, false, 0, 2, 2},
- {1152, false, true, true, 0, 2, 2},
- {1152, false, true, false, 0, 3, 0},
- {4608, false, false, false, 6, 3, 3},
- {4608, false, true, true, 8, 3, 3},
- {4608, false, true, false, 8, 3, 3},
- {4608, false, true, false, 8, 4, 0},
- {4608, true, true, false, 8, 6, 0},
- {4608, true, true, false, 12, 6, 0},
+ {1152, st_false, st_false, st_false, 0, 2, 2},
+ {1152, st_false, st_true, st_true, 0, 2, 2},
+ {1152, st_false, st_true, st_false, 0, 3, 0},
+ {4608, st_false, st_false, st_false, 6, 3, 3},
+ {4608, st_false, st_true, st_true, 8, 3, 3},
+ {4608, st_false, st_true, st_false, 8, 3, 3},
+ {4608, st_false, st_true, st_false, 8, 4, 0},
+ {4608, st_true, st_true, st_false, 8, 6, 0},
+ {4608, st_true, st_true, st_false, 12, 6, 0},
};
unsigned compression_level = array_length(options) - 1; /* Default to "best" */
@@ -345,7 +345,7 @@
static const unsigned streamable_rates[] =
{8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000};
size_t i;
- bool streamable = false;
+ st_bool streamable = st_false;
for (i = 0; !streamable && i < array_length(streamable_rates); ++i)
{
streamable = (streamable_rates[i] == format->signal.rate);
@@ -353,7 +353,7 @@
if (!streamable)
{
st_report("FLAC: non-standard rate; output may not be streamable");
- FLAC__stream_encoder_set_streamable_subset(encoder->flac, false);
+ FLAC__stream_encoder_set_streamable_subset(encoder->flac, st_false);
}
}
@@ -394,7 +394,7 @@
}
entry.length = strlen((char const *) entry.entry);
- FLAC__metadata_object_vorbiscomment_append_comment(metadata[0], entry, /*copy= */ true);
+ FLAC__metadata_object_vorbiscomment_append_comment(metadata[0], entry, /*copy= */ st_true);
} while (end_of_comment != NULL);
FLAC__stream_encoder_set_metadata(encoder->flac, metadata, 1);
--- a/src/luaeff.c
+++ b/src/luaeff.c
@@ -39,7 +39,7 @@
typedef struct luaeff {
lua_State *L; /* Lua state */
char *script; /* Script filename */
- bool gotdata; /* Script has been run */
+ st_bool gotdata; /* Script has been run */
st_size_t isamp; /* Number of samples in input */
st_size_t osamp; /* Number of samples in output */
st_size_t ostart; /* Next sample to output */
@@ -122,7 +122,7 @@
st_fail("Lua script did not return an array");
return ST_EOF;
}
- lua->gotdata = true;
+ lua->gotdata = st_true;
lua->osamp = lua_objlen(lua->L, -1);
lua->ostart = 0;
}
--- a/src/luaform.c
+++ b/src/luaform.c
@@ -39,7 +39,7 @@
/*
* Get the given method, checking that it is a function
*/
-static bool get_method(lua_State *L, const char *lua_script, const char *meth, int *ref)
+static st_bool get_method(lua_State *L, const char *lua_script, const char *meth, int *ref)
{
int ty;
@@ -47,16 +47,16 @@
if ((ty = lua_type(L, -1)) == LUA_TNIL) {
st_fail("Lua script %s does not have a %s method", lua_script, meth);
lua_pop(L, 1);
- return false;
+ return st_false;
} else if (ty != LUA_TFUNCTION) {
st_fail("Lua script %s's %s method is not a function", lua_script, meth);
lua_pop(L, 1);
- return false;
+ return st_false;
}
*ref = luaL_ref(L, LUA_REGISTRYINDEX);
- return true;
+ return st_true;
}
/*
--- a/src/raw.c
+++ b/src/raw.c
@@ -55,7 +55,7 @@
/* Works nicely for starting read and write; st_rawstart{read,write}
are #defined in st_i.h */
-int st_rawstart(ft_t ft, bool default_rate, bool default_channels, st_encoding_t encoding, signed char size, st_option_t rev_bits)
+int st_rawstart(ft_t ft, st_bool default_rate, st_bool default_channels, st_encoding_t encoding, signed char size, st_option_t rev_bits)
{
if (default_rate && ft->signal.rate == 0) {
st_warn("'%s': sample rate not specified; trying 8kHz", ft->filename);
@@ -150,7 +150,7 @@
typedef st_size_t (ft_io_fun)(ft_t ft, st_sample_t *buf, st_size_t len);
-static ft_io_fun *check_format(ft_t ft, bool write)
+static ft_io_fun *check_format(ft_t ft, st_bool write)
{
switch (ft->signal.size) {
case ST_SIZE_BYTE:
@@ -224,7 +224,7 @@
/* Read a stream of some type into SoX's internal buffer format. */
st_size_t st_rawread(ft_t ft, st_sample_t *buf, st_size_t nsamp)
{
- ft_io_fun * read_buf = check_format(ft, false);
+ ft_io_fun * read_buf = check_format(ft, st_false);
if (read_buf && nsamp)
return read_buf(ft, buf, nsamp);
@@ -241,7 +241,7 @@
/* Writes SoX's internal buffer format to buffer of various data types. */
st_size_t st_rawwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp)
{
- ft_io_fun *write_buf = check_format(ft, true);
+ ft_io_fun *write_buf = check_format(ft, st_true);
if (write_buf && nsamp)
return write_buf(ft, (st_sample_t *)buf, nsamp);
@@ -256,7 +256,7 @@
}
static int raw_start(ft_t ft) {
- return st_rawstart(ft,false,false,ST_ENCODING_UNKNOWN,-1,ST_OPTION_DEFAULT);
+ return st_rawstart(ft,st_false,st_false,ST_ENCODING_UNKNOWN,-1,ST_OPTION_DEFAULT);
}
st_format_t const * st_raw_format_fn(void) {
static char const * names[] = {"raw", NULL};
@@ -271,7 +271,7 @@
#define RAW_FORMAT(id,alt1,alt2,size,rev_bits,encoding) \
static int id##_start(ft_t ft) { \
- return st_rawstart(ft,true,true,ST_ENCODING_##encoding,ST_SIZE_##size,ST_OPTION_##rev_bits); \
+ return st_rawstart(ft,st_true,st_true,ST_ENCODING_##encoding,ST_SIZE_##size,ST_OPTION_##rev_bits); \
} \
st_format_t const * st_##id##_format_fn(void) { \
static char const * names[] = {#id, alt1, alt2, NULL}; \
--- a/src/silence.c
+++ b/src/silence.c
@@ -90,7 +90,7 @@
}
/* Parse data related to trimming front side */
- silence->start = false;
+ silence->start = st_false;
if (sscanf(argv[0], "%d", &silence->start_periods) != 1)
{
st_fail(st_silence_effect.usage);
@@ -106,7 +106,7 @@
if (silence->start_periods > 0)
{
- silence->start = true;
+ silence->start = st_true;
if (n < 2)
{
st_fail(st_silence_effect.usage);
@@ -141,7 +141,7 @@
n--; n--;
}
- silence->stop = false;
+ silence->stop = st_false;
/* Parse data needed for trimming of backside */
if (n > 0)
{
@@ -162,7 +162,7 @@
}
else
silence->restart = 0;
- silence->stop = true;
+ silence->stop = st_true;
argv++;
n--;
--- a/src/sox.c
+++ b/src/sox.c
@@ -54,13 +54,13 @@
#include <io.h>
#endif
-static bool play = false, rec = false;
+static st_bool play = st_false, rec = st_false;
static enum {SOX_CONCAT, SOX_MIX, SOX_MERGE} combine_method = SOX_CONCAT;
static st_size_t mixing_clips = 0;
-static bool repeatable_random = false; /* Whether to invoke srand. */
-static bool interactive = false;
-static st_globalinfo_t globalinfo = {false, 1};
-static bool uservolume = false;
+static st_bool repeatable_random = st_false; /* Whether to invoke srand. */
+static st_bool interactive = st_false;
+static st_globalinfo_t globalinfo = {st_false, 1};
+static st_bool uservolume = st_false;
static int user_abort = 0;
static int success = 0;
@@ -86,7 +86,7 @@
} *file_info_t;
/* local forward declarations */
-static bool doopts(file_info_t fo, int, char **);
+static st_bool doopts(file_info_t fo, int, char **);
static void usage(char const *) NORET;
static void usage_effect(char *) NORET;
static void process(void);
@@ -154,17 +154,17 @@
}
}
-static bool overwrite_permitted(char const * filename)
+static st_bool overwrite_permitted(char const * filename)
{
char c;
if (!interactive) {
st_report("Overwriting '%s'", filename);
- return true;
+ return st_true;
}
st_warn("Output file '%s' already exists", filename);
if (!isatty(fileno(stdin)))
- return false;
+ return st_false;
do fprintf(stderr, "%s sox: overwrite '%s' (y/n)? ", myname, filename);
while (scanf(" %c%*[^\n]", &c) != 1 || !strchr("yYnN", c));
return c == 'y' || c == 'Y';
@@ -250,10 +250,10 @@
i = strlen(myname);
if (i >= sizeof("play") - 1 &&
strcmp(myname + i - (sizeof("play") - 1), "play") == 0) {
- play = true;
+ play = st_true;
} else if (i >= sizeof("rec") - 1 &&
strcmp(myname + i - (sizeof("rec") - 1), "rec") == 0) {
- rec = true;
+ rec = st_true;
}
/* Loop over arguments and filenames, stop when an effect name is
@@ -397,7 +397,7 @@
static char * read_comment_file(char const * const filename)
{
- bool file_error;
+ st_bool file_error;
long file_length = 0;
char * result;
FILE * file = fopen(filename, "rt");
@@ -457,9 +457,9 @@
{NULL, 0, NULL, 0}
};
-static bool doopts(file_info_t fi, int argc, char **argv)
+static st_bool doopts(file_info_t fi, int argc, char **argv)
{
- while (true) {
+ while (st_true) {
int option_index;
int i; /* Needed since scanf %u allows negative numbers :( */
char dummy; /* To check for extraneous chars in optarg. */
@@ -466,7 +466,7 @@
switch (getopt_long(argc, argv, getoptstr, long_options, &option_index)) {
case -1: /* @ one of: file-name, effect name, end of arg-list. */
- return false; /* I.e. not null file. */
+ return st_false; /* I.e. not null file. */
case 0: /* Long options with no short equivalent. */
switch (option_index) {
@@ -484,7 +484,7 @@
else if (!strcmp(optarg, "big"))
fi->signal.reverse_bytes = ST_IS_LITTLEENDIAN;
else if (!strcmp(optarg, "swap"))
- fi->signal.reverse_bytes = true;
+ fi->signal.reverse_bytes = st_true;
else {
st_fail("Endian type '%s' is not little|big|swap", optarg);
exit(1);
@@ -492,7 +492,7 @@
break;
case 3:
- interactive = true;
+ interactive = st_true;
break;
case 4:
@@ -504,7 +504,7 @@
break;
case 6:
- globalinfo.octave_plot_effect = true;
+ globalinfo.octave_plot_effect = st_true;
break;
case 7:
@@ -523,11 +523,11 @@
break;
case 'R': /* Useful for regression testing. */
- repeatable_random = true;
+ repeatable_random = st_true;
break;
case 'e': case 'n':
- return true; /* I.e. is null file. */
+ return st_true; /* I.e. is null file. */
break;
case 'h': case '?':
@@ -553,7 +553,7 @@
st_fail("Volume value '%s' is not a number", optarg);
exit(1);
}
- uservolume = true;
+ uservolume = st_true;
if (fi->volume < 0.0)
st_report("Volume adjustment is negative; "
"this will result in a phase change");
@@ -622,7 +622,7 @@
}
}
-static void display_file_info(ft_t f, double volume, double speed, bool full)
+static void display_file_info(ft_t f, double volume, double speed, st_bool full)
{
static char const * const no_yes[] = {"no", "yes"};
@@ -666,7 +666,7 @@
static void report_file_info(ft_t f, double volume)
{
if (st_output_verbosity_level > 2)
- display_file_info(f, volume, 1, true);
+ display_file_info(f, volume, 1, st_true);
}
static void show_file_progress(int f)
@@ -673,7 +673,7 @@
{
if (show_progress && (st_output_verbosity_level < 3 ||
(combine_method == SOX_CONCAT && input_count > 1)))
- display_file_info(file_desc[f], 1, globalinfo.speed, false);
+ display_file_info(file_desc[f], 1, globalinfo.speed, st_false);
}
/*
--- a/src/speed.c
+++ b/src/speed.c
@@ -29,12 +29,12 @@
static int getopts(eff_t effp, int n, char * * argv)
{
- bool is_cents = false;
+ st_bool is_cents = st_false;
double speed;
/* Be quietly compatible with the old speed effect: */
if (n != 0 && strcmp(*argv, "-c") == 0)
- is_cents = true, ++argv, --n;
+ is_cents = st_true, ++argv, --n;
if (n == 1) {
char c, dummy;
--- a/src/st.h
+++ b/src/st.h
@@ -24,7 +24,7 @@
/* C language enhancements: */
/* Boolean type, compatible with C++ */
-typedef enum {false, true} bool;
+typedef enum {st_false, st_true} st_bool;
typedef int32_t int24_t; /* But beware of the extra byte. */
typedef uint32_t uint24_t; /* ditto */
@@ -179,7 +179,7 @@
typedef struct st_globalinfo
{
- bool octave_plot_effect;/* To help user choose effect & options */
+ st_bool octave_plot_effect;/* To help user choose effect & options */
double speed; /* Gather up all speed changes here, then resample */
} st_globalinfo_t;
@@ -375,7 +375,7 @@
extern ft_t st_open_read(const char *path, const st_signalinfo_t *info,
const char *filetype);
ft_t st_open_write(
- bool (*overwrite_permitted)(const char *filename),
+ st_bool (*overwrite_permitted)(const char *filename),
const char *path,
const st_signalinfo_t *info,
const char *filetype,
@@ -391,9 +391,9 @@
int st_geteffect_opt(eff_t, int, char **);
int st_geteffect(eff_t, const char *);
-bool is_effect_name(char const * text);
+st_bool is_effect_name(char const * text);
int st_updateeffect(eff_t, const st_signalinfo_t *in, const st_signalinfo_t *out, int);
-int st_gettype(ft_t, bool);
+int st_gettype(ft_t, st_bool);
ft_t st_initformat(void);
char const * st_parsesamples(st_rate_t rate, const char *str, st_size_t *samples, char def);
--- a/src/st_i.h
+++ b/src/st_i.h
@@ -279,8 +279,8 @@
int st_effect_nothing_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp);
int st_effect_nothing_getopts(eff_t effp, int n, char **argv UNUSED);
-int st_rawstart(ft_t ft, bool default_rate, bool default_channels, st_encoding_t encoding, signed char size, st_option_t rev_bits);
-#define st_rawstartread(ft) st_rawstart(ft, false, false, ST_ENCODING_UNKNOWN, -1, ST_OPTION_DEFAULT)
+int st_rawstart(ft_t ft, st_bool default_rate, st_bool default_channels, st_encoding_t encoding, signed char size, st_option_t rev_bits);
+#define st_rawstartread(ft) st_rawstart(ft, st_false, st_false, ST_ENCODING_UNKNOWN, -1, ST_OPTION_DEFAULT)
#define st_rawstartwrite st_rawstartread
#define st_rawstopread st_format_nothing
--- a/src/stio.c
+++ b/src/stio.c
@@ -100,7 +100,7 @@
else
ft->filetype = xstrdup(filetype);
- if (st_gettype(ft, false) != ST_SUCCESS) {
+ if (st_gettype(ft, st_false) != ST_SUCCESS) {
st_warn("Unknown input file format for `%s': %s",
ft->filename,
ft->st_errstr);
@@ -175,7 +175,7 @@
#endif
ft_t st_open_write(
- bool (*overwrite_permitted)(const char *filename),
+ st_bool (*overwrite_permitted)(const char *filename),
const char *path,
const st_signalinfo_t *info,
const char *filetype,
@@ -185,7 +185,7 @@
{
ft_t ft = (ft_t)xcalloc(sizeof(struct st_soundstream), 1);
int i;
- bool no_filetype_given = filetype == NULL;
+ st_bool no_filetype_given = filetype == NULL;
ft->filename = xstrdup(path);
--- a/src/tone.c
+++ b/src/tone.c
@@ -31,7 +31,7 @@
static int getopts(eff_t effp, int n, char **argv, double fc, int dcNormalise)
{
- bool isFcSet = false;
+ st_bool isFcSet = st_false;
double opt1 = HUGE_VAL, opt2 = HUGE_VAL;
biquad_t p = (biquad_t) effp->priv;
int ret = ST_SUCCESS;
@@ -60,7 +60,7 @@
else {
if (opt1 > 1) {
p->fc = opt1;
- isFcSet = true;
+ isFcSet = st_true;
} else
p->width.slope = opt1;
if (opt2 != HUGE_VAL) {
--- a/src/util.c
+++ b/src/util.c
@@ -116,7 +116,7 @@
/*
* Check that we have a known format suffix string.
*/
-int st_gettype(ft_t formp, bool is_file_extension)
+int st_gettype(ft_t formp, st_bool is_file_extension)
{
const char * const *list;
int i;
@@ -210,7 +210,7 @@
/*
* Check if we have a known effect name.
*/
-bool is_effect_name(char const * text)
+st_bool is_effect_name(char const * text)
{
int i;
@@ -218,10 +218,10 @@
const st_effect_t *e = st_effect_fns[i]();
if (e && e->name && strcasecmp(e->name, text) == 0)
- return true;
+ return st_true;
}
- return false;
+ return st_false;
}
/*
@@ -304,7 +304,7 @@
float frac = 0;
char const * end;
char const * pos;
- bool found_colon, found_dot;
+ st_bool found_colon, found_dot;
for (end = str; *end && strchr("0123456789:.ts", *end); ++end);
if (end == str)
--- a/src/vox.c
+++ b/src/vox.c
@@ -73,7 +73,7 @@
adpcm_init(&state->encoder, 1);
ft->signal.channels = 1;
- return st_rawstart(ft, true, false, ST_ENCODING_OKI_ADPCM, ST_SIZE_16BIT, ST_OPTION_DEFAULT);
+ return st_rawstart(ft, st_true, st_false, ST_ENCODING_OKI_ADPCM, ST_SIZE_16BIT, ST_OPTION_DEFAULT);
}
@@ -92,7 +92,7 @@
adpcm_init(&state->encoder, 0);
ft->signal.channels = 1;
- return st_rawstart(ft, true, false, ST_ENCODING_IMA_ADPCM, ST_SIZE_16BIT, ST_OPTION_DEFAULT);
+ return st_rawstart(ft, st_true, st_false, ST_ENCODING_IMA_ADPCM, ST_SIZE_16BIT, ST_OPTION_DEFAULT);
}
--- a/src/wav.c
+++ b/src/wav.c
@@ -30,7 +30,7 @@
#endif
/* To allow padding to samplesPerBlock. Works, but currently never true. */
-static st_size_t pad_nsamps = false;
+static st_size_t pad_nsamps = st_false;
/* Private data for .wav file */
typedef struct wavstuff {
@@ -1277,7 +1277,7 @@
/* internal variables, intermediate values etc */
int bytespersample; /* (uncompressed) bytes per sample (per channel) */
long blocksWritten = 0;
- bool isExtensible = false; /* WAVE_FORMAT_EXTENSIBLE? */
+ st_bool isExtensible = st_false; /* WAVE_FORMAT_EXTENSIBLE? */
dwSamplesPerSecond = ft->signal.rate;
wChannels = ft->signal.channels;
@@ -1438,7 +1438,7 @@
if ((wFormatTag == WAVE_FORMAT_PCM && wBitsPerSample > 16) || wChannels > 2)
{
- isExtensible = true;
+ isExtensible = st_true;
wFmtSize += 2 + 22;
}
else if (wFormatTag != WAVE_FORMAT_PCM)