From 7ad4f6956b29a166b496827331c402895b13772a Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Tue, 10 Aug 2021 18:57:42 +0200 Subject: [PATCH] mp4: Remove const qualifier from non-pointer function arguments. In contrast to the pointer case, it's generally not very interesting to know whether a function will modify the automatic variable which corresponds to a non-pointer argument. --- mp4.c | 58 ++++++++++++++++++++++++++-------------------------------- mp4.h | 10 +++++----- 2 files changed, 31 insertions(+), 37 deletions(-) diff --git a/mp4.c b/mp4.c index 0956dff1..40d8bd1b 100644 --- a/mp4.c +++ b/mp4.c @@ -113,10 +113,8 @@ static uint64_t read_int64(struct mp4ff *f) } /* comnapre 2 atom names, returns 1 for equal, 0 for unequal */ -static int32_t atom_compare(const int8_t a1, const int8_t b1, - const int8_t c1, const int8_t d1, - const int8_t a2, const int8_t b2, - const int8_t c2, const int8_t d2) +static int32_t atom_compare(int8_t a1, int8_t b1, int8_t c1, int8_t d1, + int8_t a2, int8_t b2, int8_t c2, int8_t d2) { if (a1 == a2 && b1 == b2 && c1 == c2 && d1 == d2) return 1; @@ -215,8 +213,7 @@ enum atoms { #define COPYRIGHT_SYMBOL ((int8_t)0xA9) -static uint8_t atom_name_to_type(const int8_t a, const int8_t b, - const int8_t c, const int8_t d) +static uint8_t atom_name_to_type(int8_t a, int8_t b, int8_t c, int8_t d) { if (a == 'm') { if (atom_compare(a, b, c, d, 'm', 'o', 'o', 'v')) @@ -421,7 +418,7 @@ static int need_parse_when_meta_only(uint8_t atom_type) } } -static int32_t set_position(struct mp4ff *f, const int64_t position) +static int32_t set_position(struct mp4ff *f, int64_t position) { f->stream->seek(f->stream->user_data, position); f->current_position = position; @@ -842,7 +839,7 @@ static char *read_string(struct mp4ff *f, uint32_t length) return str; } -static int32_t set_metadata_name(const uint8_t atom_type, char **name) +static int32_t set_metadata_name(uint8_t atom_type, char **name) { static char *tag_names[] = { "unknown", "title", "artist", "writer", "album", @@ -956,7 +953,7 @@ static int32_t set_metadata_name(const uint8_t atom_type, char **name) return 0; } -static uint32_t min_body_size(const uint8_t atom_type) +static uint32_t min_body_size(uint8_t atom_type) { switch(atom_type) { case ATOM_GENRE2: @@ -979,8 +976,7 @@ static uint32_t min_body_size(const uint8_t atom_type) } } -static int32_t parse_tag(struct mp4ff *f, const uint8_t parent, - const int32_t size) +static int32_t parse_tag(struct mp4ff *f, uint8_t parent, int32_t size) { uint8_t atom_type; uint8_t header_size = 0; @@ -1102,7 +1098,7 @@ static int32_t read_mdhd(struct mp4ff *f) return 1; } -static int32_t parse_metadata(struct mp4ff *f, const int32_t size) +static int32_t parse_metadata(struct mp4ff *f, int32_t size) { uint64_t subsize, sumsize = 0; uint8_t atom_type; @@ -1119,7 +1115,7 @@ static int32_t parse_metadata(struct mp4ff *f, const int32_t size) return 0; } -static int32_t read_meta(struct mp4ff *f, const uint64_t size) +static int32_t read_meta(struct mp4ff *f, uint64_t size) { uint64_t subsize, sumsize = 0; uint8_t atom_type; @@ -1143,8 +1139,7 @@ static int32_t read_meta(struct mp4ff *f, const uint64_t size) return 0; } -static int32_t atom_read(struct mp4ff *f, const int32_t size, - const uint8_t atom_type) +static int32_t atom_read(struct mp4ff *f, int32_t size, uint8_t atom_type) { uint64_t dest_position = get_position(f) + size - 8; if (atom_type == ATOM_STSZ) { @@ -1181,7 +1176,7 @@ static int32_t atom_read(struct mp4ff *f, const int32_t size, } /* parse atoms that are sub atoms of other atoms */ -static int32_t parse_sub_atoms(struct mp4ff *f, const uint64_t total_size, int meta_only) +static int32_t parse_sub_atoms(struct mp4ff *f, uint64_t total_size, int meta_only) { uint64_t size; uint8_t atom_type = 0; @@ -1248,8 +1243,8 @@ static int32_t parse_atoms(struct mp4ff *f, int meta_only) return 0; } -void mp4ff_get_decoder_config(const struct mp4ff *f, const int track, - unsigned char **ppBuf, unsigned int *pBufSize) +void mp4ff_get_decoder_config(const struct mp4ff *f, int track, + unsigned char **ppBuf, unsigned int *pBufSize) { if (track >= f->total_tracks) { *ppBuf = NULL; @@ -1324,8 +1319,8 @@ void mp4ff_close(struct mp4ff *ff) free(ff); } -static int32_t chunk_of_sample(const struct mp4ff *f, const int32_t track, - const int32_t sample, int32_t * chunk_sample, int32_t * chunk) +static int32_t chunk_of_sample(const struct mp4ff *f, int32_t track, + int32_t sample, int32_t *chunk_sample, int32_t *chunk) { int32_t total_entries = 0; int32_t chunk2entry; @@ -1370,8 +1365,8 @@ static int32_t chunk_of_sample(const struct mp4ff *f, const int32_t track, return 0; } -static int32_t chunk_to_offset(const struct mp4ff *f, const int32_t track, - const int32_t chunk) +static int32_t chunk_to_offset(const struct mp4ff *f, int32_t track, + int32_t chunk) { const struct mp4ff_track *p_track = f->track[track]; @@ -1387,8 +1382,8 @@ static int32_t chunk_to_offset(const struct mp4ff *f, const int32_t track, return 0; } -static int32_t sample_range_size(const struct mp4ff *f, const int32_t track, - const int32_t chunk_sample, const int32_t sample) +static int32_t sample_range_size(const struct mp4ff *f, int32_t track, + int32_t chunk_sample, int32_t sample) { int32_t i, total; const struct mp4ff_track *p_track = f->track[track]; @@ -1407,8 +1402,8 @@ static int32_t sample_range_size(const struct mp4ff *f, const int32_t track, return total; } -static int32_t sample_to_offset(const struct mp4ff *f, const int32_t track, - const int32_t sample) +static int32_t sample_to_offset(const struct mp4ff *f, int32_t track, + int32_t sample) { int32_t chunk, chunk_sample, chunk_offset1, chunk_offset2; @@ -1420,8 +1415,7 @@ static int32_t sample_to_offset(const struct mp4ff *f, const int32_t track, return chunk_offset2; } -void mp4ff_set_sample_position(struct mp4ff *f, const int32_t track, - const int32_t sample) +void mp4ff_set_sample_position(struct mp4ff *f, int32_t track, int32_t sample) { int32_t offset = sample_to_offset(f, track, sample); set_position(f, offset); @@ -1436,17 +1430,17 @@ int32_t mp4ff_get_sample_size(const struct mp4ff *f, int track, int sample) return t->stsz_table[sample]; } -uint32_t mp4ff_get_sample_rate(const struct mp4ff *f, const int32_t track) +uint32_t mp4ff_get_sample_rate(const struct mp4ff *f, int32_t track) { return f->track[track]->sampleRate; } -uint32_t mp4ff_get_channel_count(const struct mp4ff *f, const int32_t track) +uint32_t mp4ff_get_channel_count(const struct mp4ff *f, int32_t track) { return f->track[track]->channelCount; } -int32_t mp4ff_num_samples(const struct mp4ff *f, const int32_t track) +int32_t mp4ff_num_samples(const struct mp4ff *f, int32_t track) { int32_t i; int32_t total = 0; @@ -2086,7 +2080,7 @@ static int32_t write_data(struct mp4ff *f, void *data, uint32_t size) return result; } -static int32_t write_int32(struct mp4ff *f, const uint32_t data) +static int32_t write_int32(struct mp4ff *f, uint32_t data) { int8_t temp[4]; write_u32_be(temp, data); diff --git a/mp4.h b/mp4.h index e9b18871..8cd08ccf 100644 --- a/mp4.h +++ b/mp4.h @@ -20,16 +20,16 @@ struct mp4ff_metadata { struct mp4ff; /* opaque */ -void mp4ff_set_sample_position(struct mp4ff *f, const int32_t track, const int32_t sample); +void mp4ff_set_sample_position(struct mp4ff *f, int32_t track, int32_t sample); int32_t mp4ff_total_tracks(const struct mp4ff *f); -void mp4ff_get_decoder_config(const struct mp4ff *f, const int track, +void mp4ff_get_decoder_config(const struct mp4ff *f, int track, unsigned char** ppBuf, unsigned int* pBufSize); struct mp4ff *mp4ff_open_read(struct mp4ff_callback *f); void mp4ff_close(struct mp4ff *f); int32_t mp4ff_get_sample_size(const struct mp4ff *f, int track, int sample); -uint32_t mp4ff_get_sample_rate(const struct mp4ff *f, const int32_t track); -uint32_t mp4ff_get_channel_count(const struct mp4ff * f,const int32_t track); -int32_t mp4ff_num_samples(const struct mp4ff *f, const int track); +uint32_t mp4ff_get_sample_rate(const struct mp4ff *f, int32_t track); +uint32_t mp4ff_get_channel_count(const struct mp4ff * f, int32_t track); +int32_t mp4ff_num_samples(const struct mp4ff *f, int track); struct mp4ff *mp4ff_open_read_metaonly(struct mp4ff_callback *f); int mp4ff_meta_get_by_index(const struct mp4ff *f, unsigned int index, -- 2.39.5