mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-16 08:34:10 +02:00
lib-src changes to fix compiler warnings in Mac build...
... all of them harmless and inconsequential at runtime, but see commit comments about the error checks in libnyquist that were revealed by the compiler warnings as never doing anything useful.
This commit is contained in:
commit
8f4da13a7f
@ -280,7 +280,7 @@ struct id3_frame *id3_frame_parse(id3_byte_t const **ptr, id3_length_t length,
|
||||
if (length < 6)
|
||||
goto fail;
|
||||
|
||||
compat = id3_compat_lookup(id, 3);
|
||||
compat = id3_compat_lookup((char const *)id, 3);
|
||||
|
||||
*ptr += 3;
|
||||
size = id3_parse_uint(ptr, 3);
|
||||
@ -296,7 +296,7 @@ struct id3_frame *id3_frame_parse(id3_byte_t const **ptr, id3_length_t length,
|
||||
if (length < 10)
|
||||
goto fail;
|
||||
|
||||
compat = id3_compat_lookup(id, 4);
|
||||
compat = id3_compat_lookup((char const *)id, 4);
|
||||
|
||||
*ptr += 4;
|
||||
size = id3_parse_uint(ptr, 4);
|
||||
@ -308,7 +308,7 @@ struct id3_frame *id3_frame_parse(id3_byte_t const **ptr, id3_length_t length,
|
||||
end = *ptr + size;
|
||||
|
||||
if (flags & (ID3_FRAME_FLAG_FORMATFLAGS & ~0x00e0)) {
|
||||
frame = unparseable(id, ptr, end - *ptr, 0, 0, 0, 0);
|
||||
frame = unparseable((char const *)id, ptr, end - *ptr, 0, 0, 0, 0);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -348,14 +348,14 @@ struct id3_frame *id3_frame_parse(id3_byte_t const **ptr, id3_length_t length,
|
||||
/* canonicalize frame ID for ID3v2.4 */
|
||||
|
||||
if (compat && compat->equiv)
|
||||
id = compat->equiv;
|
||||
id = (id3_byte_t const *)compat->equiv;
|
||||
else if (ID3_TAG_VERSION_MAJOR(version) == 2) {
|
||||
xid[0] = 'Y';
|
||||
xid[1] = id[0];
|
||||
xid[2] = id[1];
|
||||
xid[3] = id[2];
|
||||
|
||||
id = xid;
|
||||
id = (id3_byte_t const *)xid;
|
||||
|
||||
flags |=
|
||||
ID3_FRAME_FLAG_TAGALTERPRESERVATION |
|
||||
@ -376,7 +376,7 @@ struct id3_frame *id3_frame_parse(id3_byte_t const **ptr, id3_length_t length,
|
||||
end = *ptr + size;
|
||||
|
||||
if (flags & (ID3_FRAME_FLAG_FORMATFLAGS & ~ID3_FRAME_FLAG_KNOWNFLAGS)) {
|
||||
frame = unparseable(id, ptr, end - *ptr, flags, 0, 0, 0);
|
||||
frame = unparseable((char const *)id, ptr, end - *ptr, flags, 0, 0, 0);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -423,7 +423,7 @@ struct id3_frame *id3_frame_parse(id3_byte_t const **ptr, id3_length_t length,
|
||||
}
|
||||
|
||||
if (flags & ID3_FRAME_FLAG_ENCRYPTION) {
|
||||
frame = unparseable(id, &data, end - data, flags,
|
||||
frame = unparseable((char const *)id, &data, end - data, flags,
|
||||
group_id, encryption_method, decoded_length);
|
||||
goto done;
|
||||
}
|
||||
@ -445,13 +445,13 @@ struct id3_frame *id3_frame_parse(id3_byte_t const **ptr, id3_length_t length,
|
||||
/* check for obsolescence */
|
||||
|
||||
if (compat && !compat->equiv) {
|
||||
frame = obsolete(id, data, end - data);
|
||||
frame = obsolete((char const *)id, data, end - data);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* generate the internal frame structure */
|
||||
|
||||
frame = id3_frame_new(id);
|
||||
frame = id3_frame_new((char const *)id);
|
||||
if (frame) {
|
||||
frame->flags = flags;
|
||||
frame->group_id = group_id;
|
||||
|
@ -116,7 +116,7 @@ id3_length_t id3_render_latin1(id3_byte_t **ptr,
|
||||
id3_length_t size;
|
||||
|
||||
if (latin1 == 0)
|
||||
latin1 = "";
|
||||
latin1 = (id3_latin1_t const *)"";
|
||||
|
||||
size = id3_latin1_size(latin1);
|
||||
if (!terminate)
|
||||
|
@ -351,7 +351,7 @@ int v1_attachstr(struct id3_tag *tag, char const *id,
|
||||
goto fail;
|
||||
|
||||
if (text)
|
||||
id3_latin1_decode(text, ucs4);
|
||||
id3_latin1_decode((id3_latin1_t const *)text, ucs4);
|
||||
else
|
||||
id3_ucs4_putnumber(ucs4, number);
|
||||
|
||||
|
@ -144,7 +144,7 @@ int decode_header(struct mad_header *header, struct mad_stream *stream)
|
||||
/* layer */
|
||||
header->layer = 4 - mad_bit_read(&stream->ptr, 2);
|
||||
|
||||
if (header->layer == 4) {
|
||||
if ((int)header->layer == 4) {
|
||||
stream->error = MAD_ERROR_BADLAYER;
|
||||
return -1;
|
||||
}
|
||||
|
@ -72,12 +72,15 @@ void Delay :: setMaximumDelay(unsigned long delay)
|
||||
{
|
||||
if ( delay < inputs_.size() ) return;
|
||||
|
||||
/*
|
||||
if ( delay < 0 ) {
|
||||
errorString_ << "Delay::setMaximumDelay: argument (" << delay << ") less than zero!\n";
|
||||
handleError( StkError::WARNING );
|
||||
return;
|
||||
}
|
||||
else if (delay < delay_ ) {
|
||||
else
|
||||
*/
|
||||
if (delay < delay_ ) {
|
||||
errorString_ << "Delay::setMaximumDelay: argument (" << delay << ") less than current delay setting (" << delay_ << ")!\n";
|
||||
handleError( StkError::WARNING );
|
||||
return;
|
||||
@ -97,6 +100,7 @@ void Delay :: setDelay(unsigned long delay)
|
||||
if ( outPoint_ == inputs_.size() ) outPoint_ = 0;
|
||||
delay_ = inputs_.size() - 1;
|
||||
}
|
||||
/*
|
||||
else if ( delay < 0 ) {
|
||||
errorString_ << "Delay::setDelay: argument (" << delay << ") less than zero ... setting to zero!\n";
|
||||
handleError( StkError::WARNING );
|
||||
@ -104,6 +108,7 @@ void Delay :: setDelay(unsigned long delay)
|
||||
outPoint_ = inPoint_;
|
||||
delay_ = 0;
|
||||
}
|
||||
*/
|
||||
else { // read chases write
|
||||
if ( inPoint_ >= delay ) outPoint_ = inPoint_ - delay;
|
||||
else outPoint_ = inputs_.size() + inPoint_ - delay;
|
||||
@ -119,19 +124,19 @@ unsigned long Delay :: getDelay(void) const
|
||||
StkFloat Delay :: energy(void) const
|
||||
{
|
||||
unsigned long i;
|
||||
register StkFloat e = 0;
|
||||
StkFloat e = 0;
|
||||
if (inPoint_ >= outPoint_) {
|
||||
for (i=outPoint_; i<inPoint_; i++) {
|
||||
register StkFloat t = inputs_[i];
|
||||
StkFloat t = inputs_[i];
|
||||
e += t*t;
|
||||
}
|
||||
} else {
|
||||
for (i=outPoint_; i<inputs_.size(); i++) {
|
||||
register StkFloat t = inputs_[i];
|
||||
StkFloat t = inputs_[i];
|
||||
e += t*t;
|
||||
}
|
||||
for (i=0; i<inPoint_; i++) {
|
||||
register StkFloat t = inputs_[i];
|
||||
StkFloat t = inputs_[i];
|
||||
e += t*t;
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ void Stk :: setRawwavePath( std::string path )
|
||||
|
||||
void Stk :: swap16(unsigned char *ptr)
|
||||
{
|
||||
register unsigned char val;
|
||||
unsigned char val;
|
||||
|
||||
// Swap 1st and 2nd bytes
|
||||
val = *(ptr);
|
||||
@ -58,7 +58,7 @@ void Stk :: swap16(unsigned char *ptr)
|
||||
|
||||
void Stk :: swap32(unsigned char *ptr)
|
||||
{
|
||||
register unsigned char val;
|
||||
unsigned char val;
|
||||
|
||||
// Swap 1st and 4th bytes
|
||||
val = *(ptr);
|
||||
@ -74,7 +74,7 @@ void Stk :: swap32(unsigned char *ptr)
|
||||
|
||||
void Stk :: swap64(unsigned char *ptr)
|
||||
{
|
||||
register unsigned char val;
|
||||
unsigned char val;
|
||||
|
||||
// Swap 1st and 8th bytes
|
||||
val = *(ptr);
|
||||
|
@ -209,7 +209,7 @@ void errprint(LVAL expr)
|
||||
}
|
||||
|
||||
/* errputstr - print a string to *error-output* */
|
||||
void errputstr(const const char *str)
|
||||
void errputstr(const char *str)
|
||||
{
|
||||
xlputstr(getvalue(s_stderr),str);
|
||||
}
|
||||
|
@ -90,7 +90,6 @@ void Audio_reader::calculate_parameters(Scorealign &sa, bool verbose)
|
||||
|
||||
// this is stored back in a field in sa as well as here in the reader
|
||||
frame_count= (int) ceil(((float) pcm_frames / hop_samples + 1));
|
||||
this->frame_count = frame_count;
|
||||
temp_data = ALLOC(float, samples_per_frame);
|
||||
memset(temp_data, 0, samples_per_frame * sizeof(temp_data[0]));
|
||||
assert(temp_data);
|
||||
|
@ -47,7 +47,7 @@ static void Decoding_of_the_coded_Log_Area_Ratios (
|
||||
#undef STEP
|
||||
#define STEP( B, MIC, INVA ) \
|
||||
temp1 = GSM_ADD( *LARc++, MIC ) << 10; \
|
||||
temp1 = GSM_SUB( temp1, B << 1 ); \
|
||||
temp1 = GSM_SUB( temp1, B * 2 ); \
|
||||
temp1 = GSM_MULT_R( INVA, temp1 ); \
|
||||
*LARpp++ = GSM_ADD( temp1, temp1 );
|
||||
|
||||
|
@ -181,7 +181,7 @@ gen_coding_history (char * added_history, int added_history_max, const SF_INFO *
|
||||
|
||||
count = snprintf (added_history, added_history_max,
|
||||
"A=PCM,F=%u,W=%hu,M=%s,T=%s-%s\r\n",
|
||||
psfinfo->samplerate, width, chnstr, PACKAGE, VERSION) ;
|
||||
psfinfo->samplerate, (unsigned short)width, chnstr, PACKAGE, VERSION) ;
|
||||
|
||||
if (count >= added_history_max)
|
||||
return 0 ;
|
||||
|
@ -63,7 +63,7 @@ ima_oki_adpcm_init (IMA_OKI_ADPCM * state, IMA_OKI_ADPCM_TYPE type)
|
||||
else
|
||||
{ state->max_step_index = ARRAY_LEN (oki_steps) - 1 ;
|
||||
state->steps = oki_steps ;
|
||||
state->mask = (~0) << 4 ;
|
||||
state->mask = (~0u) << 4 ;
|
||||
} ;
|
||||
|
||||
} /* ima_oki_adpcm_init */
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "sys/time.h"
|
||||
#include "pthread.h"
|
||||
|
||||
#undef NSEC_PER_MSEC
|
||||
#define NSEC_PER_MSEC 1000000
|
||||
#define THREAD_IMPORTANCE 30
|
||||
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
long parse_int(string &field);
|
||||
int find_real_in(string &field, int n);
|
||||
double parse_real(string &field);
|
||||
void parse_error(string &field, long offset, char *message);
|
||||
void parse_error(string &field, long offset, const char *message);
|
||||
double parse_dur(string &field, double base);
|
||||
double parse_after_dur(double dur, string &field, int n, double base);
|
||||
double parse_loud(string &field);
|
||||
@ -116,19 +116,19 @@ Alg_parameters_ptr Alg_reader::process_attributes(
|
||||
if (attributes) {
|
||||
Alg_parameters_ptr a;
|
||||
bool in_seconds = seq->get_units_are_seconds();
|
||||
if (a = Alg_parameters::remove_key(&attributes, "tempor")) {
|
||||
if ((a = Alg_parameters::remove_key(&attributes, "tempor"))) {
|
||||
double tempo = a->parm.r;
|
||||
seq->insert_tempo(tempo, seq->get_time_map()->time_to_beat(time));
|
||||
}
|
||||
if (a = Alg_parameters::remove_key(&attributes, "beatr")) {
|
||||
if ((a = Alg_parameters::remove_key(&attributes, "beatr"))) {
|
||||
double beat = a->parm.r;
|
||||
seq->insert_beat(time, beat);
|
||||
}
|
||||
if (a = Alg_parameters::remove_key(&attributes, "timesig_numr")) {
|
||||
if ((a = Alg_parameters::remove_key(&attributes, "timesig_numr"))) {
|
||||
tsnum = a->parm.r;
|
||||
ts_flag = true;
|
||||
}
|
||||
if (a = Alg_parameters::remove_key(&attributes, "timesig_denr")) {
|
||||
if ((a = Alg_parameters::remove_key(&attributes, "timesig_denr"))) {
|
||||
tsden = a->parm.r;
|
||||
ts_flag = true;
|
||||
}
|
||||
@ -422,11 +422,11 @@ bool Alg_reader::parse()
|
||||
long Alg_reader::parse_chan(string &field)
|
||||
{
|
||||
const char *int_string = field.c_str() + 1;
|
||||
char *msg = "Integer or - expected";
|
||||
const char *msg = "Integer or - expected";
|
||||
const char *p = int_string;
|
||||
char c;
|
||||
// check that all chars in int_string are digits or '-':
|
||||
while (c = *p++) {
|
||||
while ((c = *p++)) {
|
||||
if (!isdigit(c) && c != '-') {
|
||||
parse_error(field, p - field.c_str() - 1, msg);
|
||||
return 0;
|
||||
@ -449,11 +449,11 @@ long Alg_reader::parse_chan(string &field)
|
||||
long Alg_reader::parse_int(string &field)
|
||||
{
|
||||
const char *int_string = field.c_str() + 1;
|
||||
char *msg = "Integer expected";
|
||||
const char *msg = "Integer expected";
|
||||
const char *p = int_string;
|
||||
char c;
|
||||
// check that all chars in int_string are digits:
|
||||
while (c = *p++) {
|
||||
while ((c = *p++)) {
|
||||
if (!isdigit(c)) {
|
||||
parse_error(field, p - field.c_str() - 1, msg);
|
||||
return 0;
|
||||
@ -491,7 +491,7 @@ int Alg_reader::find_real_in(string &field, int n)
|
||||
|
||||
double Alg_reader::parse_real(string &field)
|
||||
{
|
||||
char *msg = "Real expected";
|
||||
const char *msg = "Real expected";
|
||||
int last = find_real_in(field, 1);
|
||||
string real_string = field.substr(1, last - 1);
|
||||
if (last <= 1 || last < (int) field.length()) {
|
||||
@ -502,7 +502,7 @@ double Alg_reader::parse_real(string &field)
|
||||
}
|
||||
|
||||
|
||||
void Alg_reader::parse_error(string &field, long offset, char *message)
|
||||
void Alg_reader::parse_error(string &field, long offset, const char *message)
|
||||
{
|
||||
int position = line_parser.pos - field.length() + offset;
|
||||
error_flag = true;
|
||||
@ -520,9 +520,9 @@ double duration_lookup[] = { 0.25, 0.5, 1.0, 2.0, 4.0 };
|
||||
|
||||
double Alg_reader::parse_dur(string &field, double base)
|
||||
{
|
||||
char *msg = "Duration expected";
|
||||
char *durs = "SIQHW";
|
||||
char *p;
|
||||
const char *msg = "Duration expected";
|
||||
const char *durs = "SIQHW";
|
||||
const char *p;
|
||||
int last;
|
||||
double dur;
|
||||
if (field.length() < 2) {
|
||||
@ -535,7 +535,7 @@ double Alg_reader::parse_dur(string &field, double base)
|
||||
// convert dur from seconds to beats
|
||||
dur = seq->get_time_map()->time_to_beat(base + dur) -
|
||||
seq->get_time_map()->time_to_beat(base);
|
||||
} else if (p = strchr(durs, toupper(field[1]))) {
|
||||
} else if ((p = strchr(durs, toupper(field[1])))) {
|
||||
dur = duration_lookup[p - durs];
|
||||
last = 2;
|
||||
} else {
|
||||
@ -578,7 +578,7 @@ double Alg_reader::parse_after_dur(double dur, string &field,
|
||||
}
|
||||
|
||||
struct loud_lookup_struct {
|
||||
char *str;
|
||||
const char *str;
|
||||
int val;
|
||||
} loud_lookup[] = { {"FFF", 127}, {"FF", 120}, {"F", 110}, {"MF", 100},
|
||||
{"MP", 90}, {"P", 80}, {"PP", 70}, {"PPP", 60},
|
||||
@ -587,7 +587,7 @@ struct loud_lookup_struct {
|
||||
|
||||
double Alg_reader::parse_loud(string &field)
|
||||
{
|
||||
char *msg = "Loudness expected";
|
||||
const char *msg = "Loudness expected";
|
||||
if (isdigit(field[1])) {
|
||||
return parse_int(field);
|
||||
} else {
|
||||
@ -613,14 +613,14 @@ int key_lookup[] = {21, 23, 12, 14, 16, 17, 19};
|
||||
//
|
||||
long Alg_reader::parse_key(string &field)
|
||||
{
|
||||
char *msg = "Pitch expected";
|
||||
char *pitches = "ABCDEFG";
|
||||
char *p;
|
||||
const char *msg = "Pitch expected";
|
||||
const char *pitches = "ABCDEFG";
|
||||
const char *p;
|
||||
if (isdigit(field[1])) {
|
||||
// This routine would not have been called if field = "P<number>"
|
||||
// so it must be "K<number>" so <number> must be an integer.
|
||||
return parse_int(field);
|
||||
} else if (p = strchr(pitches, toupper(field[1]))) {
|
||||
} else if ((p = strchr(pitches, toupper(field[1])))) {
|
||||
long key = key_lookup[p - pitches];
|
||||
key = parse_after_key(key, field, 2);
|
||||
return key;
|
||||
|
@ -74,7 +74,7 @@ protected:
|
||||
void Mf_chanprefix(int chan);
|
||||
void Mf_portprefix(int port);
|
||||
void Mf_eot();
|
||||
void Mf_error(char *);
|
||||
void Mf_error(const char *);
|
||||
void Mf_header(int,int,int);
|
||||
void Mf_on(int,int,int);
|
||||
void Mf_off(int,int,int);
|
||||
@ -169,7 +169,7 @@ void Alg_midifile_reader::Mf_eot()
|
||||
}
|
||||
|
||||
|
||||
void Alg_midifile_reader::Mf_error(char *msg)
|
||||
void Alg_midifile_reader::Mf_error(const char *msg)
|
||||
{
|
||||
fprintf(stdout, "Midifile reader error: %s\n", msg);
|
||||
}
|
||||
@ -353,7 +353,7 @@ void Alg_midifile_reader::Mf_seqnum(int n)
|
||||
}
|
||||
|
||||
|
||||
static char *fpsstr[4] = {"24", "25", "29.97", "30"};
|
||||
static const char *fpsstr[4] = {"24", "25", "29.97", "30"};
|
||||
|
||||
void Alg_midifile_reader::Mf_smpte(int hours, int mins, int secs,
|
||||
int frames, int subframes)
|
||||
|
@ -35,7 +35,7 @@ void Midifile_reader::midifile()
|
||||
while (ntrks-- > 0 && !midifile_error) readtrack();
|
||||
}
|
||||
|
||||
int Midifile_reader::readmt(char *s, int skip)
|
||||
int Midifile_reader::readmt(const char *s, int skip)
|
||||
/* read through the "MThd" or "MTrk" header string */
|
||||
/* if skip == 1, we attempt to skip initial garbage. */
|
||||
{
|
||||
@ -44,7 +44,7 @@ int Midifile_reader::readmt(char *s, int skip)
|
||||
char b[4];
|
||||
char buff[32];
|
||||
int c;
|
||||
char *errmsg = "expecting ";
|
||||
const char *errmsg = "expecting ";
|
||||
|
||||
retry:
|
||||
while ( nread<4 ) {
|
||||
@ -414,7 +414,7 @@ int Midifile_reader::read16bit()
|
||||
return to16bit(c1,c2);
|
||||
}
|
||||
|
||||
void Midifile_reader::mferror(char *s)
|
||||
void Midifile_reader::mferror(const char *s)
|
||||
{
|
||||
Mf_error(s);
|
||||
midifile_error = 1;
|
||||
|
@ -46,7 +46,7 @@ protected:
|
||||
virtual void Mf_chanprefix(int) = 0;
|
||||
virtual void Mf_portprefix(int) = 0;
|
||||
virtual void Mf_eot() = 0;
|
||||
virtual void Mf_error(char *) = 0;
|
||||
virtual void Mf_error(const char *) = 0;
|
||||
virtual void Mf_header(int,int,int) = 0;
|
||||
virtual void Mf_on(int,int,int) = 0;
|
||||
virtual void Mf_off(int,int,int) = 0;
|
||||
@ -81,10 +81,10 @@ private:
|
||||
int egetc();
|
||||
int msgleng();
|
||||
|
||||
int readmt(char*,int);
|
||||
int readmt(const char*,int);
|
||||
long to32bit(int,int,int,int);
|
||||
int to16bit(int,int);
|
||||
void mferror(char *);
|
||||
void mferror(const char *);
|
||||
void badbyte(int);
|
||||
void metaevent(int);
|
||||
void msgadd(int);
|
||||
|
@ -192,10 +192,10 @@ int twolame_init_params(twolame_options * glopts)
|
||||
glopts->samplerate_out = glopts->samplerate_in;
|
||||
}
|
||||
// If the MPEG version has not been set, then choose automatically
|
||||
if (glopts->version == -1) {
|
||||
if ((int)glopts->version == -1) {
|
||||
// Get the MPEG version for the chosen samplerate
|
||||
glopts->version = twolame_get_version_for_samplerate(glopts->samplerate_out);
|
||||
if (glopts->version < 0) {
|
||||
if ((int)glopts->version < 0) {
|
||||
fprintf(stderr, "twolame_init_params(): invalid samplerate: %i\n",
|
||||
glopts->samplerate_out);
|
||||
return -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user