From 8e22f7f5b048cf7a46a3132cfbc9f2e38ccec076 Mon Sep 17 00:00:00 2001 From: Bertrik Sikken Date: Mon, 29 Dec 2008 19:49:48 +0000 Subject: Make local functions static in codecs, where possible. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19612 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/a52.c | 2 +- apps/codecs/ape.c | 16 ++++++++-------- apps/codecs/demac/libdemac/crc.c | 4 ++-- apps/codecs/flac.c | 6 +++--- apps/codecs/libfaad/pns.c | 2 +- apps/codecs/libm4a/demux.c | 2 +- apps/codecs/libwavpack/words.c | 2 +- apps/codecs/mod.c | 12 ++++++------ apps/codecs/mp3_enc.c | 26 +++++++++++++------------- apps/codecs/mpa.c | 4 ++-- apps/codecs/mpc.c | 10 +++++----- apps/codecs/nsf.c | 2 +- 12 files changed, 44 insertions(+), 44 deletions(-) diff --git a/apps/codecs/a52.c b/apps/codecs/a52.c index f8eaef26fd..360a5862d7 100644 --- a/apps/codecs/a52.c +++ b/apps/codecs/a52.c @@ -43,7 +43,7 @@ static inline void output_audio(sample_t *samples) ci->pcmbuf_insert(&samples[0], &samples[256], 256); } -void a52_decode_data(uint8_t *start, uint8_t *end) +static void a52_decode_data(uint8_t *start, uint8_t *end) { static uint8_t *bufptr = buf; static uint8_t *bufpos = buf + 7; diff --git a/apps/codecs/ape.c b/apps/codecs/ape.c index 0419a6f6bd..dbe6e0fc9e 100644 --- a/apps/codecs/ape.c +++ b/apps/codecs/ape.c @@ -57,11 +57,11 @@ static int32_t decoded1[BLOCKS_PER_LOOP] IBSS_ATTR; skip in that frame. */ -bool ape_calc_seekpos(struct ape_ctx_t* ape_ctx, - uint32_t new_sample, - uint32_t* newframe, - uint32_t* filepos, - uint32_t* samplestoskip) +static bool ape_calc_seekpos(struct ape_ctx_t* ape_ctx, + uint32_t new_sample, + uint32_t* newframe, + uint32_t* filepos, + uint32_t* samplestoskip) { uint32_t n; @@ -82,9 +82,9 @@ bool ape_calc_seekpos(struct ape_ctx_t* ape_ctx, /* The resume offset is a value in bytes - we need to turn it into a frame number and samplestoskip value */ -void ape_resume(struct ape_ctx_t* ape_ctx, size_t resume_offset, - uint32_t* currentframe, uint32_t* samplesdone, - uint32_t* samplestoskip, int* firstbyte) +static void ape_resume(struct ape_ctx_t* ape_ctx, size_t resume_offset, + uint32_t* currentframe, uint32_t* samplesdone, + uint32_t* samplestoskip, int* firstbyte) { off_t newfilepos; int64_t framesize; diff --git a/apps/codecs/demac/libdemac/crc.c b/apps/codecs/demac/libdemac/crc.c index c23de7d043..816c6594f7 100644 --- a/apps/codecs/demac/libdemac/crc.c +++ b/apps/codecs/demac/libdemac/crc.c @@ -2,7 +2,7 @@ libdemac - A Monkey's Audio decoder -$Id:$ +$Id$ Copyright (C) Dave Chapman 2007 @@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA #include -static uint32_t crctab32[] = +static const uint32_t crctab32[] = { 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, diff --git a/apps/codecs/flac.c b/apps/codecs/flac.c index cf3bbca65c..3a23d0b951 100644 --- a/apps/codecs/flac.c +++ b/apps/codecs/flac.c @@ -180,7 +180,7 @@ static bool flac_init(FLACContext* fc, int first_frame_offset) } /* Synchronize to next frame in stream - adapted from libFLAC 1.1.3b2 */ -bool frame_sync(FLACContext* fc) { +static bool frame_sync(FLACContext* fc) { unsigned int x = 0; bool cached = false; @@ -232,7 +232,7 @@ bool frame_sync(FLACContext* fc) { } /* Seek to sample - adapted from libFLAC 1.1.3b2+ */ -bool flac_seek(FLACContext* fc, uint32_t target_sample) { +static bool flac_seek(FLACContext* fc, uint32_t target_sample) { off_t orig_pos = ci->curpos; off_t pos = -1; unsigned long lower_bound, upper_bound; @@ -385,7 +385,7 @@ bool flac_seek(FLACContext* fc, uint32_t target_sample) { } /* Seek to file offset */ -bool flac_seek_offset(FLACContext* fc, uint32_t offset) { +static bool flac_seek_offset(FLACContext* fc, uint32_t offset) { unsigned unparseable_count; bool got_a_frame = false; diff --git a/apps/codecs/libfaad/pns.c b/apps/codecs/libfaad/pns.c index 7727b22160..85de391101 100644 --- a/apps/codecs/libfaad/pns.c +++ b/apps/codecs/libfaad/pns.c @@ -51,7 +51,7 @@ static void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size, /* fixed point square root approximation */ /* !!!! ONLY WORKS FOR EVEN %REAL_BITS% !!!! */ -real_t fp_sqrt(real_t value) +static real_t fp_sqrt(real_t value) { real_t root = 0; diff --git a/apps/codecs/libm4a/demux.c b/apps/codecs/libm4a/demux.c index e9b5c2c482..f0c6922ca6 100644 --- a/apps/codecs/libm4a/demux.c +++ b/apps/codecs/libm4a/demux.c @@ -83,7 +83,7 @@ static void read_chunk_ftyp(qtmovie_t *qtmovie, size_t chunk_len) } } -uint32_t mp4ff_read_mp4_descr_length(stream_t* stream) +static uint32_t mp4ff_read_mp4_descr_length(stream_t* stream) { uint8_t b; uint8_t numBytes = 0; diff --git a/apps/codecs/libwavpack/words.c b/apps/codecs/libwavpack/words.c index c7a8047d03..6da716119c 100644 --- a/apps/codecs/libwavpack/words.c +++ b/apps/codecs/libwavpack/words.c @@ -253,7 +253,7 @@ int read_hybrid_profile (WavpackStream *wps, WavpackMetadata *wpmd) // currently implemented) this is calculated from the slow_level values and the // bitrate accumulators. Note that the bitrate accumulators can be changing. -void update_error_limit (struct words_data *w, uint32_t flags) +static void update_error_limit (struct words_data *w, uint32_t flags) { int bitrate_0 = (w->bitrate_acc [0] += w->bitrate_delta [0]) >> 16; diff --git a/apps/codecs/mod.c b/apps/codecs/mod.c index c8ada66f18..91b5955b40 100644 --- a/apps/codecs/mod.c +++ b/apps/codecs/mod.c @@ -264,27 +264,27 @@ void mixer_playsample(int channel, int instrument) modplayer.modchannel[channel].instrument = instrument; } -inline void mixer_stopsample(int channel) +static inline void mixer_stopsample(int channel) { mixer.channel[channel].channelactive = false; } -inline void mixer_continuesample(int channel) +static inline void mixer_continuesample(int channel) { mixer.channel[channel].channelactive = true; } -inline void mixer_setvolume(int channel, int volume) +static inline void mixer_setvolume(int channel, int volume) { mixer.channel[channel].volume = volume; } -inline void mixer_setpanning(int channel, int panning) +static inline void mixer_setpanning(int channel, int panning) { mixer.channel[channel].panning = panning; } -inline void mixer_setamigaperiod(int channel, int amigaperiod) +static inline void mixer_setamigaperiod(int channel, int amigaperiod) { /* Just to make sure we don't devide by zero * amigaperiod shouldn't 0 anyway - if it is the case @@ -1090,7 +1090,7 @@ void playeffect(int currenttick) } } -inline int clip(int i) +static inline int clip(int i) { if (i > 32767) return(32767); else if (i < -32768) return(-32768); diff --git a/apps/codecs/mp3_enc.c b/apps/codecs/mp3_enc.c index 18aa1bfe1a..94d4c2a5f3 100644 --- a/apps/codecs/mp3_enc.c +++ b/apps/codecs/mp3_enc.c @@ -1156,7 +1156,7 @@ void putbits(uint32_t val, uint32_t nbit) /* of the Huffman tables as defined in the IS (Table B.7), and will not */ /* work with any arbitrary tables. */ /***************************************************************************/ -int choose_table( short *ix, uint32_t begin, uint32_t end, int *bits ) +static int choose_table( short *ix, uint32_t begin, uint32_t end, int *bits ) { uint32_t i; int max, table0, table1; @@ -1301,7 +1301,7 @@ int count_bigv(short *ix, uint32_t start, uint32_t end, int table0, /* Function: Calculation of rzero, count1, address3 */ /* (Partitions ix into big values, quadruples and zeros). */ /*************************************************************************/ -int calc_runlen( short *ix, side_info_t *si ) +static int calc_runlen( short *ix, side_info_t *si ) { int p, i, sum = 0; @@ -1347,7 +1347,7 @@ int calc_runlen( short *ix, side_info_t *si ) /*************************************************************************/ /* Function: Quantization of the vector xr ( -> ix) */ /*************************************************************************/ -int quantize_int(int *xr, short *ix, side_info_t *si) +static int quantize_int(int *xr, short *ix, side_info_t *si) { unsigned int i, idx, s, frac_pow[] = { 0x10000, 0xd745, 0xb505, 0x9838 }; @@ -1379,7 +1379,7 @@ int quantize_int(int *xr, short *ix, side_info_t *si) /*************************************************************************/ /* subdivides the bigvalue region which will use separate Huffman tables */ /*************************************************************************/ -void subdivide(side_info_t *si) +static void subdivide(side_info_t *si) { int scfb, count0, count1; @@ -1407,7 +1407,7 @@ void subdivide(side_info_t *si) /*******************************************************************/ /* Count the number of bits necessary to code the bigvalues region */ /*******************************************************************/ -int bigv_bitcount(short *ix, side_info_t *gi) +static int bigv_bitcount(short *ix, side_info_t *gi) { int b1=0, b2=0, b3=0; @@ -1428,7 +1428,7 @@ int bigv_bitcount(short *ix, side_info_t *gi) return b1+b2+b3; } -int quantize_and_count_bits(int *xr, short *ix, side_info_t *si) +static int quantize_and_count_bits(int *xr, short *ix, side_info_t *si) { int bits = 10000; @@ -1445,7 +1445,7 @@ int quantize_and_count_bits(int *xr, short *ix, side_info_t *si) /************************************************************************/ /* The code selects the best quantStep for a particular set of scalefacs*/ /************************************************************************/ -int inner_loop(int *xr, int max_bits, side_info_t *si) +static int inner_loop(int *xr, int max_bits, side_info_t *si) { int bits; @@ -1469,7 +1469,7 @@ int inner_loop(int *xr, int max_bits, side_info_t *si) return bits; } -void iteration_loop(int *xr, side_info_t *si, int gr_cnt) +static void iteration_loop(int *xr, side_info_t *si, int gr_cnt) { int remain, tar_bits, max_bits = cfg.mean_bits; @@ -1971,10 +1971,10 @@ static int find_samplerate_index(long freq, int *mp3_type) return i; } -bool init_mp3_encoder_engine(int sample_rate, - int num_channels, - int rec_mono_mode, - struct encoder_config *enc_cfg) +static bool init_mp3_encoder_engine(int sample_rate, + int num_channels, + int rec_mono_mode, + struct encoder_config *enc_cfg) { const bool stereo = num_channels > 1; uint32_t avg_byte_per_frame; @@ -2157,7 +2157,7 @@ static inline void byte_swap_frame32(uint32_t *dst, uint32_t *src, } /* byte_swap_frame32 */ #endif /* ROCKBOX_LITTLE_ENDIAN */ -void set_scale_facs(int *mdct_freq) +static void set_scale_facs(int *mdct_freq) { unsigned int i, is, ie, k, s; int max_freq_val, avrg_freq_val; diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c index 37a1afadfa..1a0b03c272 100644 --- a/apps/codecs/mpa.c +++ b/apps/codecs/mpa.c @@ -56,7 +56,7 @@ unsigned char mad_main_data[MAD_BUFFER_MDLEN] IBSS_ATTR; int mpeg_latency[3] = { 0, 481, 529 }; int mpeg_framesize[3] = {384, 1152, 1152}; -void init_mad(void) +static void init_mad(void) { ci->memset(&stream, 0, sizeof(struct mad_stream)); ci->memset(&frame, 0, sizeof(struct mad_frame)); @@ -85,7 +85,7 @@ void init_mad(void) } -int get_file_pos(int newtime) +static int get_file_pos(int newtime) { int pos = -1; struct mp3entry *id3 = ci->id3; diff --git a/apps/codecs/mpc.c b/apps/codecs/mpc.c index 36a7469088..a227fb81cf 100644 --- a/apps/codecs/mpc.c +++ b/apps/codecs/mpc.c @@ -27,14 +27,14 @@ CODEC_HEADER mpc_decoder decoder IBSS_ATTR; /* Our implementations of the mpc_reader callback functions. */ -mpc_int32_t read_impl(void *data, void *ptr, mpc_int32_t size) +static mpc_int32_t read_impl(void *data, void *ptr, mpc_int32_t size) { struct codec_api *ci = (struct codec_api *)data; return ((mpc_int32_t)(ci->read_filebuf(ptr, size))); } -mpc_bool_t seek_impl(void *data, mpc_int32_t offset) +static mpc_bool_t seek_impl(void *data, mpc_int32_t offset) { struct codec_api *ci = (struct codec_api *)data; @@ -43,21 +43,21 @@ mpc_bool_t seek_impl(void *data, mpc_int32_t offset) return ci->seek_buffer(offset); } -mpc_int32_t tell_impl(void *data) +static mpc_int32_t tell_impl(void *data) { struct codec_api *ci = (struct codec_api *)data; return ci->curpos; } -mpc_int32_t get_size_impl(void *data) +static mpc_int32_t get_size_impl(void *data) { struct codec_api *ci = (struct codec_api *)data; return ci->filesize; } -mpc_bool_t canseek_impl(void *data) +static mpc_bool_t canseek_impl(void *data) { (void)data; diff --git a/apps/codecs/nsf.c b/apps/codecs/nsf.c index c7239837eb..6beb8fe3e6 100644 --- a/apps/codecs/nsf.c +++ b/apps/codecs/nsf.c @@ -4294,7 +4294,7 @@ jammed: /****************** rockbox interface ******************/ -void set_codec_track(int t, int d) { +static void set_codec_track(int t, int d) { int track,fade,def=0; SetTrack(t); -- cgit v1.2.3