mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
Rename all parameters and locals from 'index' to 'indx'.
This commit is contained in:
@@ -83,7 +83,7 @@ static FLAC__bool local__parse_timecode_(const char *s, double *value)
|
||||
return true;
|
||||
}
|
||||
|
||||
static FLAC__bool local__parse_cue_(const char *s, const char *end, unsigned *track, unsigned *index)
|
||||
static FLAC__bool local__parse_cue_(const char *s, const char *end, unsigned *track, unsigned *indx)
|
||||
{
|
||||
FLAC__bool got_track = false, got_index = false;
|
||||
unsigned t = 0, i = 0;
|
||||
@@ -110,7 +110,7 @@ static FLAC__bool local__parse_cue_(const char *s, const char *end, unsigned *tr
|
||||
return false;
|
||||
}
|
||||
*track = t;
|
||||
*index = i;
|
||||
*indx = i;
|
||||
return got_track && got_index;
|
||||
}
|
||||
|
||||
@@ -119,20 +119,20 @@ static FLAC__bool local__parse_cue_(const char *s, const char *end, unsigned *tr
|
||||
* does not require sorted cuesheets). but if it's not sorted, picking a
|
||||
* nearest cue point has no significance.
|
||||
*/
|
||||
static FLAC__uint64 local__find_closest_cue_(const FLAC__StreamMetadata_CueSheet *cuesheet, unsigned track, unsigned index, FLAC__uint64 total_samples, FLAC__bool look_forward)
|
||||
static FLAC__uint64 local__find_closest_cue_(const FLAC__StreamMetadata_CueSheet *cuesheet, unsigned track, unsigned indx, FLAC__uint64 total_samples, FLAC__bool look_forward)
|
||||
{
|
||||
int t, i;
|
||||
if(look_forward) {
|
||||
for(t = 0; t < (int)cuesheet->num_tracks; t++)
|
||||
for(i = 0; i < (int)cuesheet->tracks[t].num_indices; i++)
|
||||
if(cuesheet->tracks[t].number > track || (cuesheet->tracks[t].number == track && cuesheet->tracks[t].indices[i].number >= index))
|
||||
if(cuesheet->tracks[t].number > track || (cuesheet->tracks[t].number == track && cuesheet->tracks[t].indices[i].number >= indx))
|
||||
return cuesheet->tracks[t].offset + cuesheet->tracks[t].indices[i].offset;
|
||||
return total_samples;
|
||||
}
|
||||
else {
|
||||
for(t = (int)cuesheet->num_tracks - 1; t >= 0; t--)
|
||||
for(i = (int)cuesheet->tracks[t].num_indices - 1; i >= 0; i--)
|
||||
if(cuesheet->tracks[t].number < track || (cuesheet->tracks[t].number == track && cuesheet->tracks[t].indices[i].number <= index))
|
||||
if(cuesheet->tracks[t].number < track || (cuesheet->tracks[t].number == track && cuesheet->tracks[t].indices[i].number <= indx))
|
||||
return cuesheet->tracks[t].offset + cuesheet->tracks[t].indices[i].offset;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -437,11 +437,11 @@ namespace FLAC {
|
||||
return object_->data.seek_table.num_points;
|
||||
}
|
||||
|
||||
::FLAC__StreamMetadata_SeekPoint SeekTable::get_point(unsigned index) const
|
||||
::FLAC__StreamMetadata_SeekPoint SeekTable::get_point(unsigned indx) const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
FLAC__ASSERT(index < object_->data.seek_table.num_points);
|
||||
return object_->data.seek_table.points[index];
|
||||
FLAC__ASSERT(indx < object_->data.seek_table.num_points);
|
||||
return object_->data.seek_table.points[indx];
|
||||
}
|
||||
|
||||
bool SeekTable::resize_points(unsigned new_num_points)
|
||||
@@ -450,25 +450,25 @@ namespace FLAC {
|
||||
return (bool)::FLAC__metadata_object_seektable_resize_points(object_, new_num_points);
|
||||
}
|
||||
|
||||
void SeekTable::set_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point)
|
||||
void SeekTable::set_point(unsigned indx, const ::FLAC__StreamMetadata_SeekPoint &point)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
FLAC__ASSERT(index < object_->data.seek_table.num_points);
|
||||
::FLAC__metadata_object_seektable_set_point(object_, index, point);
|
||||
FLAC__ASSERT(indx < object_->data.seek_table.num_points);
|
||||
::FLAC__metadata_object_seektable_set_point(object_, indx, point);
|
||||
}
|
||||
|
||||
bool SeekTable::insert_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point)
|
||||
bool SeekTable::insert_point(unsigned indx, const ::FLAC__StreamMetadata_SeekPoint &point)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
FLAC__ASSERT(index <= object_->data.seek_table.num_points);
|
||||
return (bool)::FLAC__metadata_object_seektable_insert_point(object_, index, point);
|
||||
FLAC__ASSERT(indx <= object_->data.seek_table.num_points);
|
||||
return (bool)::FLAC__metadata_object_seektable_insert_point(object_, indx, point);
|
||||
}
|
||||
|
||||
bool SeekTable::delete_point(unsigned index)
|
||||
bool SeekTable::delete_point(unsigned indx)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
FLAC__ASSERT(index < object_->data.seek_table.num_points);
|
||||
return (bool)::FLAC__metadata_object_seektable_delete_point(object_, index);
|
||||
FLAC__ASSERT(indx < object_->data.seek_table.num_points);
|
||||
return (bool)::FLAC__metadata_object_seektable_delete_point(object_, indx);
|
||||
}
|
||||
|
||||
bool SeekTable::is_legal() const
|
||||
@@ -840,11 +840,11 @@ namespace FLAC {
|
||||
return object_->data.vorbis_comment.vendor_string.entry;
|
||||
}
|
||||
|
||||
VorbisComment::Entry VorbisComment::get_comment(unsigned index) const
|
||||
VorbisComment::Entry VorbisComment::get_comment(unsigned indx) const
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
FLAC__ASSERT(index < object_->data.vorbis_comment.num_comments);
|
||||
return Entry((const char *)object_->data.vorbis_comment.comments[index].entry, object_->data.vorbis_comment.comments[index].length);
|
||||
FLAC__ASSERT(indx < object_->data.vorbis_comment.num_comments);
|
||||
return Entry((const char *)object_->data.vorbis_comment.comments[indx].entry, object_->data.vorbis_comment.comments[indx].length);
|
||||
}
|
||||
|
||||
bool VorbisComment::set_vendor_string(const FLAC__byte *string)
|
||||
@@ -861,18 +861,18 @@ namespace FLAC {
|
||||
return (bool)::FLAC__metadata_object_vorbiscomment_resize_comments(object_, new_num_comments);
|
||||
}
|
||||
|
||||
bool VorbisComment::set_comment(unsigned index, const VorbisComment::Entry &entry)
|
||||
bool VorbisComment::set_comment(unsigned indx, const VorbisComment::Entry &entry)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
FLAC__ASSERT(index < object_->data.vorbis_comment.num_comments);
|
||||
return (bool)::FLAC__metadata_object_vorbiscomment_set_comment(object_, index, entry.get_entry(), /*copy=*/true);
|
||||
FLAC__ASSERT(indx < object_->data.vorbis_comment.num_comments);
|
||||
return (bool)::FLAC__metadata_object_vorbiscomment_set_comment(object_, indx, entry.get_entry(), /*copy=*/true);
|
||||
}
|
||||
|
||||
bool VorbisComment::insert_comment(unsigned index, const VorbisComment::Entry &entry)
|
||||
bool VorbisComment::insert_comment(unsigned indx, const VorbisComment::Entry &entry)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
FLAC__ASSERT(index <= object_->data.vorbis_comment.num_comments);
|
||||
return (bool)::FLAC__metadata_object_vorbiscomment_insert_comment(object_, index, entry.get_entry(), /*copy=*/true);
|
||||
FLAC__ASSERT(indx <= object_->data.vorbis_comment.num_comments);
|
||||
return (bool)::FLAC__metadata_object_vorbiscomment_insert_comment(object_, indx, entry.get_entry(), /*copy=*/true);
|
||||
}
|
||||
|
||||
bool VorbisComment::append_comment(const VorbisComment::Entry &entry)
|
||||
@@ -887,11 +887,11 @@ namespace FLAC {
|
||||
return (bool)::FLAC__metadata_object_vorbiscomment_replace_comment(object_, entry.get_entry(), all, /*copy=*/true);
|
||||
}
|
||||
|
||||
bool VorbisComment::delete_comment(unsigned index)
|
||||
bool VorbisComment::delete_comment(unsigned indx)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
FLAC__ASSERT(index < object_->data.vorbis_comment.num_comments);
|
||||
return (bool)::FLAC__metadata_object_vorbiscomment_delete_comment(object_, index);
|
||||
FLAC__ASSERT(indx < object_->data.vorbis_comment.num_comments);
|
||||
return (bool)::FLAC__metadata_object_vorbiscomment_delete_comment(object_, indx);
|
||||
}
|
||||
|
||||
int VorbisComment::find_entry_from(unsigned offset, const char *field_name)
|
||||
@@ -970,11 +970,11 @@ namespace FLAC {
|
||||
object_->type = value;
|
||||
}
|
||||
|
||||
void CueSheet::Track::set_index(unsigned i, const ::FLAC__StreamMetadata_CueSheet_Index &index)
|
||||
void CueSheet::Track::set_index(unsigned i, const ::FLAC__StreamMetadata_CueSheet_Index &indx)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
FLAC__ASSERT(i < object_->num_indices);
|
||||
object_->indices[i] = index;
|
||||
object_->indices[i] = indx;
|
||||
}
|
||||
|
||||
|
||||
@@ -1040,12 +1040,12 @@ namespace FLAC {
|
||||
object_->data.cue_sheet.is_cd = value;
|
||||
}
|
||||
|
||||
void CueSheet::set_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index)
|
||||
void CueSheet::set_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &indx)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
FLAC__ASSERT(track_num < object_->data.cue_sheet.num_tracks);
|
||||
FLAC__ASSERT(index_num < object_->data.cue_sheet.tracks[track_num].num_indices);
|
||||
object_->data.cue_sheet.tracks[track_num].indices[index_num] = index;
|
||||
object_->data.cue_sheet.tracks[track_num].indices[index_num] = indx;
|
||||
}
|
||||
|
||||
bool CueSheet::resize_indices(unsigned track_num, unsigned new_num_indices)
|
||||
@@ -1055,12 +1055,12 @@ namespace FLAC {
|
||||
return (bool)::FLAC__metadata_object_cuesheet_track_resize_indices(object_, track_num, new_num_indices);
|
||||
}
|
||||
|
||||
bool CueSheet::insert_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index)
|
||||
bool CueSheet::insert_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &indx)
|
||||
{
|
||||
FLAC__ASSERT(is_valid());
|
||||
FLAC__ASSERT(track_num < object_->data.cue_sheet.num_tracks);
|
||||
FLAC__ASSERT(index_num <= object_->data.cue_sheet.tracks[track_num].num_indices);
|
||||
return (bool)::FLAC__metadata_object_cuesheet_track_insert_index(object_, track_num, index_num, index);
|
||||
return (bool)::FLAC__metadata_object_cuesheet_track_insert_index(object_, track_num, index_num, indx);
|
||||
}
|
||||
|
||||
bool CueSheet::insert_blank_index(unsigned track_num, unsigned index_num)
|
||||
|
||||
@@ -1327,7 +1327,7 @@ FLAC__double FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scal
|
||||
|
||||
unsigned FLAC__lpc_compute_best_order(const FLAC__double lpc_error[], unsigned max_order, unsigned total_samples, unsigned overhead_bits_per_order)
|
||||
{
|
||||
unsigned order, index, best_index; /* 'index' the index into lpc_error; index==order-1 since lpc_error[0] is for order==1, lpc_error[1] is for order==2, etc */
|
||||
unsigned order, indx, best_index; /* 'index' the index into lpc_error; index==order-1 since lpc_error[0] is for order==1, lpc_error[1] is for order==2, etc */
|
||||
FLAC__double bits, best_bits, error_scale;
|
||||
|
||||
FLAC__ASSERT(max_order > 0);
|
||||
@@ -1338,15 +1338,15 @@ unsigned FLAC__lpc_compute_best_order(const FLAC__double lpc_error[], unsigned m
|
||||
best_index = 0;
|
||||
best_bits = (unsigned)(-1);
|
||||
|
||||
for(index = 0, order = 1; index < max_order; index++, order++) {
|
||||
bits = FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(lpc_error[index], error_scale) * (FLAC__double)(total_samples - order) + (FLAC__double)(order * overhead_bits_per_order);
|
||||
for(indx = 0, order = 1; indx < max_order; indx++, order++) {
|
||||
bits = FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(lpc_error[indx], error_scale) * (FLAC__double)(total_samples - order) + (FLAC__double)(order * overhead_bits_per_order);
|
||||
if(bits < best_bits) {
|
||||
best_index = index;
|
||||
best_index = indx;
|
||||
best_bits = bits;
|
||||
}
|
||||
}
|
||||
|
||||
return best_index+1; /* +1 since index of lpc_error[] is order-1 */
|
||||
return best_index+1; /* +1 since indx of lpc_error[] is order-1 */
|
||||
}
|
||||
|
||||
#endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */
|
||||
|
||||
@@ -2711,17 +2711,17 @@ FLAC__bool write_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__I
|
||||
return false;
|
||||
|
||||
for(j = 0; j < track->num_indices; j++) {
|
||||
FLAC__StreamMetadata_CueSheet_Index *index = track->indices + j;
|
||||
FLAC__StreamMetadata_CueSheet_Index *indx = track->indices + j;
|
||||
|
||||
FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN % 8 == 0);
|
||||
len = FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN / 8;
|
||||
pack_uint64_(index->offset, buffer, len);
|
||||
pack_uint64_(indx->offset, buffer, len);
|
||||
if(write_cb(buffer, 1, len, handle) != len)
|
||||
return false;
|
||||
|
||||
FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN % 8 == 0);
|
||||
len = FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN / 8;
|
||||
pack_uint32_(index->number, buffer, len);
|
||||
pack_uint32_(indx->number, buffer, len);
|
||||
if(write_cb(buffer, 1, len, handle) != len)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -1272,19 +1272,19 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_replace_comment(FLAC__St
|
||||
|
||||
i = vorbiscomment_find_entry_from_(object, 0, (const char *)entry.entry, field_name_length);
|
||||
if(i >= 0) {
|
||||
unsigned index = (unsigned)i;
|
||||
if(!FLAC__metadata_object_vorbiscomment_set_comment(object, index, entry, copy))
|
||||
unsigned indx = (unsigned)i;
|
||||
if(!FLAC__metadata_object_vorbiscomment_set_comment(object, indx, entry, copy))
|
||||
return false;
|
||||
entry = object->data.vorbis_comment.comments[index];
|
||||
index++; /* skip over replaced comment */
|
||||
if(all && index < object->data.vorbis_comment.num_comments) {
|
||||
i = vorbiscomment_find_entry_from_(object, index, (const char *)entry.entry, field_name_length);
|
||||
entry = object->data.vorbis_comment.comments[indx];
|
||||
indx++; /* skip over replaced comment */
|
||||
if(all && indx < object->data.vorbis_comment.num_comments) {
|
||||
i = vorbiscomment_find_entry_from_(object, indx, (const char *)entry.entry, field_name_length);
|
||||
while(i >= 0) {
|
||||
index = (unsigned)i;
|
||||
if(!FLAC__metadata_object_vorbiscomment_delete_comment(object, index))
|
||||
indx = (unsigned)i;
|
||||
if(!FLAC__metadata_object_vorbiscomment_delete_comment(object, indx))
|
||||
return false;
|
||||
if(index < object->data.vorbis_comment.num_comments)
|
||||
i = vorbiscomment_find_entry_from_(object, index, (const char *)entry.entry, field_name_length);
|
||||
if(indx < object->data.vorbis_comment.num_comments)
|
||||
i = vorbiscomment_find_entry_from_(object, indx, (const char *)entry.entry, field_name_length);
|
||||
else
|
||||
i = -1;
|
||||
}
|
||||
@@ -1513,7 +1513,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_resize_indices(FLAC__St
|
||||
return true;
|
||||
}
|
||||
|
||||
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num, FLAC__StreamMetadata_CueSheet_Index index)
|
||||
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num, FLAC__StreamMetadata_CueSheet_Index indx)
|
||||
{
|
||||
FLAC__StreamMetadata_CueSheet_Track *track;
|
||||
|
||||
@@ -1530,16 +1530,16 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_index(FLAC__Stre
|
||||
/* move all indices >= index_num forward one space */
|
||||
memmove(&track->indices[index_num+1], &track->indices[index_num], sizeof(FLAC__StreamMetadata_CueSheet_Index)*(track->num_indices-1-index_num));
|
||||
|
||||
track->indices[index_num] = index;
|
||||
track->indices[index_num] = indx;
|
||||
cuesheet_calculate_length_(object);
|
||||
return true;
|
||||
}
|
||||
|
||||
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_blank_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num)
|
||||
{
|
||||
FLAC__StreamMetadata_CueSheet_Index index;
|
||||
memset(&index, 0, sizeof(index));
|
||||
return FLAC__metadata_object_cuesheet_track_insert_index(object, track_num, index_num, index);
|
||||
FLAC__StreamMetadata_CueSheet_Index indx;
|
||||
memset(&indx, 0, sizeof(indx));
|
||||
return FLAC__metadata_object_cuesheet_track_insert_index(object, track_num, index_num, indx);
|
||||
}
|
||||
|
||||
FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_delete_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num)
|
||||
|
||||
@@ -1805,13 +1805,13 @@ FLAC__bool read_metadata_cuesheet_(FLAC__StreamDecoder *decoder, FLAC__StreamMet
|
||||
return false;
|
||||
}
|
||||
for(j = 0; j < track->num_indices; j++) {
|
||||
FLAC__StreamMetadata_CueSheet_Index *index = &track->indices[j];
|
||||
if(!FLAC__bitreader_read_raw_uint64(decoder->private_->input, &index->offset, FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN))
|
||||
FLAC__StreamMetadata_CueSheet_Index *indx = &track->indices[j];
|
||||
if(!FLAC__bitreader_read_raw_uint64(decoder->private_->input, &indx->offset, FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN))
|
||||
return false; /* read_callback_ sets the state for us */
|
||||
|
||||
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN))
|
||||
return false; /* read_callback_ sets the state for us */
|
||||
index->number = (FLAC__byte)x;
|
||||
indx->number = (FLAC__byte)x;
|
||||
|
||||
if(!FLAC__bitreader_skip_bits_no_crc(decoder->private_->input, FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN))
|
||||
return false; /* read_callback_ sets the state for us */
|
||||
|
||||
@@ -161,11 +161,11 @@ FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetadata *metadata, FLAC__
|
||||
if(!FLAC__bitwriter_write_raw_uint32(bw, track->num_indices, FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN))
|
||||
return false;
|
||||
for(j = 0; j < track->num_indices; j++) {
|
||||
const FLAC__StreamMetadata_CueSheet_Index *index = track->indices + j;
|
||||
const FLAC__StreamMetadata_CueSheet_Index *indx = track->indices + j;
|
||||
|
||||
if(!FLAC__bitwriter_write_raw_uint64(bw, index->offset, FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN))
|
||||
if(!FLAC__bitwriter_write_raw_uint64(bw, indx->offset, FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN))
|
||||
return false;
|
||||
if(!FLAC__bitwriter_write_raw_uint32(bw, index->number, FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN))
|
||||
if(!FLAC__bitwriter_write_raw_uint32(bw, indx->number, FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN))
|
||||
return false;
|
||||
if(!FLAC__bitwriter_write_zeroes(bw, FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN))
|
||||
return false;
|
||||
|
||||
@@ -632,10 +632,10 @@ void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned
|
||||
PPR; printf(" pre-emphasis: %s\n", track->pre_emphasis? "true":"false");
|
||||
PPR; printf(" number of index points: %u\n", track->num_indices);
|
||||
for(j = 0; j < track->num_indices; j++) {
|
||||
const FLAC__StreamMetadata_CueSheet_Index *index = track->indices+j;
|
||||
const FLAC__StreamMetadata_CueSheet_Index *indx = track->indices+j;
|
||||
PPR; printf(" index[%u]\n", j);
|
||||
PPR; printf(" offset: %" PRIu64 "\n", index->offset);
|
||||
PPR; printf(" number: %u\n", (unsigned)index->number);
|
||||
PPR; printf(" offset: %" PRIu64 "\n", indx->offset);
|
||||
PPR; printf(" number: %u\n", (unsigned)indx->number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,14 +155,14 @@ FLAC__bool import_cs_from(const char *filename, FLAC__StreamMetadata **cuesheet,
|
||||
/* add seekpoints for each index point if required */
|
||||
if(0 != seekpoint_specification) {
|
||||
char spec[128];
|
||||
unsigned track, index;
|
||||
unsigned track, indx;
|
||||
const FLAC__StreamMetadata_CueSheet *cs = &(*cuesheet)->data.cue_sheet;
|
||||
if(0 == *seekpoint_specification)
|
||||
*seekpoint_specification = local_strdup("");
|
||||
for(track = 0; track < cs->num_tracks; track++) {
|
||||
const FLAC__StreamMetadata_CueSheet_Track *tr = cs->tracks+track;
|
||||
for(index = 0; index < tr->num_indices; index++) {
|
||||
flac_snprintf(spec, sizeof (spec), "%" PRIu64 ";", (tr->offset + tr->indices[index].offset));
|
||||
for(indx = 0; indx < tr->num_indices; indx++) {
|
||||
flac_snprintf(spec, sizeof (spec), "%" PRIu64 ";", (tr->offset + tr->indices[indx].offset));
|
||||
local_strcat(seekpoint_specification, spec);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -642,17 +642,17 @@ void grabbag__cuesheet_emit(FILE *file, const FLAC__StreamMetadata *cuesheet, co
|
||||
fprintf(file, " ISRC %s\n", track->isrc);
|
||||
|
||||
for(index_num = 0; index_num < track->num_indices; index_num++) {
|
||||
const FLAC__StreamMetadata_CueSheet_Index *index = track->indices + index_num;
|
||||
const FLAC__StreamMetadata_CueSheet_Index *indx = track->indices + index_num;
|
||||
|
||||
fprintf(file, " INDEX %02u ", (unsigned)index->number);
|
||||
fprintf(file, " INDEX %02u ", (unsigned)indx->number);
|
||||
if(cs->is_cd) {
|
||||
const unsigned logical_frame = (unsigned)((track->offset + index->offset) / (44100 / 75));
|
||||
const unsigned logical_frame = (unsigned)((track->offset + indx->offset) / (44100 / 75));
|
||||
unsigned m, s, f;
|
||||
grabbag__cuesheet_frame_to_msf(logical_frame, &m, &s, &f);
|
||||
fprintf(file, "%02u:%02u:%02u\n", m, s, f);
|
||||
}
|
||||
else
|
||||
fprintf(file, "%" PRIu64 "\n", (track->offset + index->offset));
|
||||
fprintf(file, "%" PRIu64 "\n", (track->offset + indx->offset));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -209,14 +209,14 @@ void FLAC__replaygain_synthesis__init_dither_context(DitherContext *d, int bits,
|
||||
static unsigned char default_dither [] = { 92, 92, 88, 84, 81, 78, 74, 67, 0, 0 };
|
||||
static const float* F [] = { F44_0, F44_1, F44_2, F44_3 };
|
||||
|
||||
int index;
|
||||
int indx;
|
||||
|
||||
if (shapingtype < 0) shapingtype = 0;
|
||||
if (shapingtype > 3) shapingtype = 3;
|
||||
d->ShapingType = (NoiseShaping)shapingtype;
|
||||
index = bits - 11 - shapingtype;
|
||||
if (index < 0) index = 0;
|
||||
if (index > 9) index = 9;
|
||||
indx = bits - 11 - shapingtype;
|
||||
if (indx < 0) indx = 0;
|
||||
if (indx > 9) indx = 9;
|
||||
|
||||
memset ( d->ErrorHistory , 0, sizeof (d->ErrorHistory ) );
|
||||
memset ( d->DitherHistory, 0, sizeof (d->DitherHistory) );
|
||||
@@ -224,7 +224,7 @@ void FLAC__replaygain_synthesis__init_dither_context(DitherContext *d, int bits,
|
||||
d->FilterCoeff = F [shapingtype];
|
||||
d->Mask = ((FLAC__uint64)-1) << (32 - bits);
|
||||
d->Add = 0.5 * ((1L << (32 - bits)) - 1);
|
||||
d->Dither = 0.01f*default_dither[index] / (((FLAC__int64)1) << bits);
|
||||
d->Dither = 0.01f*default_dither[indx] / (((FLAC__int64)1) << bits);
|
||||
d->LastHistoryIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,12 +48,12 @@
|
||||
static unsigned char *make_utf8_string(const wchar_t *unicode)
|
||||
{
|
||||
size_t size = 0, n;
|
||||
int index = 0, out_index = 0;
|
||||
int indx = 0, out_index = 0;
|
||||
unsigned char *out;
|
||||
unsigned short c;
|
||||
|
||||
/* first calculate the size of the target string */
|
||||
c = unicode[index++];
|
||||
c = unicode[indx++];
|
||||
while(c) {
|
||||
if(c < 0x0080) {
|
||||
n = 1;
|
||||
@@ -65,15 +65,15 @@ static unsigned char *make_utf8_string(const wchar_t *unicode)
|
||||
if(size+n < size) /* overflow check */
|
||||
return NULL;
|
||||
size += n;
|
||||
c = unicode[index++];
|
||||
c = unicode[indx++];
|
||||
}
|
||||
|
||||
out = safe_malloc_add_2op_(size, /*+*/1);
|
||||
if (out == NULL)
|
||||
return NULL;
|
||||
index = 0;
|
||||
indx = 0;
|
||||
|
||||
c = unicode[index++];
|
||||
c = unicode[indx++];
|
||||
while(c)
|
||||
{
|
||||
if(c < 0x080) {
|
||||
@@ -86,7 +86,7 @@ static unsigned char *make_utf8_string(const wchar_t *unicode)
|
||||
out[out_index++] = 0x80 | ((c >> 6) & 0x3f);
|
||||
out[out_index++] = 0x80 | (c & 0x3f);
|
||||
}
|
||||
c = unicode[index++];
|
||||
c = unicode[indx++];
|
||||
}
|
||||
out[out_index] = 0x00;
|
||||
|
||||
@@ -96,24 +96,24 @@ static unsigned char *make_utf8_string(const wchar_t *unicode)
|
||||
static wchar_t *make_unicode_string(const unsigned char *utf8)
|
||||
{
|
||||
size_t size = 0;
|
||||
int index = 0, out_index = 0;
|
||||
int indx = 0, out_index = 0;
|
||||
wchar_t *out;
|
||||
unsigned char c;
|
||||
|
||||
/* first calculate the size of the target string */
|
||||
c = utf8[index++];
|
||||
c = utf8[indx++];
|
||||
while(c) {
|
||||
if((c & 0x80) == 0) {
|
||||
index += 0;
|
||||
indx += 0;
|
||||
} else if((c & 0xe0) == 0xe0) {
|
||||
index += 2;
|
||||
indx += 2;
|
||||
} else {
|
||||
index += 1;
|
||||
indx += 1;
|
||||
}
|
||||
if(size + 1 == 0) /* overflow check */
|
||||
return NULL;
|
||||
size++;
|
||||
c = utf8[index++];
|
||||
c = utf8[indx++];
|
||||
}
|
||||
|
||||
if(size + 1 == 0) /* overflow check */
|
||||
@@ -121,25 +121,25 @@ static wchar_t *make_unicode_string(const unsigned char *utf8)
|
||||
out = safe_malloc_mul_2op_(size+1, /*times*/sizeof(wchar_t));
|
||||
if (out == NULL)
|
||||
return NULL;
|
||||
index = 0;
|
||||
indx = 0;
|
||||
|
||||
c = utf8[index++];
|
||||
c = utf8[indx++];
|
||||
while(c)
|
||||
{
|
||||
if((c & 0x80) == 0) {
|
||||
out[out_index++] = c;
|
||||
} else if((c & 0xe0) == 0xe0) {
|
||||
out[out_index] = (c & 0x1F) << 12;
|
||||
c = utf8[index++];
|
||||
c = utf8[indx++];
|
||||
out[out_index] |= (c & 0x3F) << 6;
|
||||
c = utf8[index++];
|
||||
c = utf8[indx++];
|
||||
out[out_index++] |= (c & 0x3F);
|
||||
} else {
|
||||
out[out_index] = (c & 0x3F) << 6;
|
||||
c = utf8[index++];
|
||||
c = utf8[indx++];
|
||||
out[out_index++] |= (c & 0x3F);
|
||||
}
|
||||
c = utf8[index++];
|
||||
c = utf8[indx++];
|
||||
}
|
||||
out[out_index] = 0;
|
||||
|
||||
|
||||
@@ -189,9 +189,9 @@ static void delete_from_our_metadata_(unsigned position)
|
||||
}
|
||||
}
|
||||
|
||||
void add_to_padding_length_(unsigned index, int delta)
|
||||
void add_to_padding_length_(unsigned indx, int delta)
|
||||
{
|
||||
FLAC::Metadata::Padding *padding = dynamic_cast<FLAC::Metadata::Padding *>(our_metadata_.blocks[index]);
|
||||
FLAC::Metadata::Padding *padding = dynamic_cast<FLAC::Metadata::Padding *>(our_metadata_.blocks[indx]);
|
||||
FLAC__ASSERT(0 != padding);
|
||||
padding->set_length((unsigned)((int)padding->get_length() + delta));
|
||||
}
|
||||
|
||||
@@ -51,11 +51,11 @@ static char *strdup_or_die_(const char *s)
|
||||
return x;
|
||||
}
|
||||
|
||||
static bool index_is_equal_(const ::FLAC__StreamMetadata_CueSheet_Index &index, const ::FLAC__StreamMetadata_CueSheet_Index &indexcopy)
|
||||
static bool index_is_equal_(const ::FLAC__StreamMetadata_CueSheet_Index &indx, const ::FLAC__StreamMetadata_CueSheet_Index &indxcopy)
|
||||
{
|
||||
if(indexcopy.offset != index.offset)
|
||||
if(indxcopy.offset != indx.offset)
|
||||
return false;
|
||||
if(indexcopy.number != index.number)
|
||||
if(indxcopy.number != indx.number)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -260,22 +260,22 @@ static void vc_delete_(FLAC__StreamMetadata *block, unsigned pos)
|
||||
|
||||
static void vc_replace_new_(FLAC__StreamMetadata_VorbisComment_Entry *entry, FLAC__StreamMetadata *block, const char *field, FLAC__bool all)
|
||||
{
|
||||
int index;
|
||||
int indx;
|
||||
char field_name[256];
|
||||
const char *eq = strchr(field, '=');
|
||||
FLAC__ASSERT(eq>field && (unsigned)(eq-field) < sizeof(field_name));
|
||||
memcpy(field_name, field, eq-field);
|
||||
field_name[eq-field]='\0';
|
||||
|
||||
index = vc_find_from_(block, field_name, 0);
|
||||
if(index < 0)
|
||||
indx = vc_find_from_(block, field_name, 0);
|
||||
if(indx < 0)
|
||||
vc_insert_new_(entry, block, block->data.vorbis_comment.num_comments, field);
|
||||
else {
|
||||
vc_set_new_(entry, block, (unsigned)index, field);
|
||||
vc_set_new_(entry, block, (unsigned)indx, field);
|
||||
if(all) {
|
||||
for(index = index+1; index >= 0 && (unsigned)index < block->data.vorbis_comment.num_comments; )
|
||||
if((index = vc_find_from_(block, field_name, (unsigned)index)) >= 0)
|
||||
vc_delete_(block, (unsigned)index);
|
||||
for(indx = indx+1; indx >= 0 && (unsigned)indx < block->data.vorbis_comment.num_comments; )
|
||||
if((indx = vc_find_from_(block, field_name, (unsigned)indx)) >= 0)
|
||||
vc_delete_(block, (unsigned)indx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,7 +362,7 @@ static void tr_resize_(FLAC__StreamMetadata *block, unsigned track_num, unsigned
|
||||
cs_calc_len_(block);
|
||||
}
|
||||
|
||||
static void tr_set_new_(FLAC__StreamMetadata *block, unsigned track_num, unsigned pos, FLAC__StreamMetadata_CueSheet_Index index)
|
||||
static void tr_set_new_(FLAC__StreamMetadata *block, unsigned track_num, unsigned pos, FLAC__StreamMetadata_CueSheet_Index indx)
|
||||
{
|
||||
FLAC__StreamMetadata_CueSheet_Track *tr;
|
||||
|
||||
@@ -372,12 +372,12 @@ static void tr_set_new_(FLAC__StreamMetadata *block, unsigned track_num, unsigne
|
||||
|
||||
FLAC__ASSERT(pos < tr->num_indices);
|
||||
|
||||
tr->indices[pos] = index;
|
||||
tr->indices[pos] = indx;
|
||||
|
||||
cs_calc_len_(block);
|
||||
}
|
||||
|
||||
static void tr_insert_new_(FLAC__StreamMetadata *block, unsigned track_num, unsigned pos, FLAC__StreamMetadata_CueSheet_Index index)
|
||||
static void tr_insert_new_(FLAC__StreamMetadata *block, unsigned track_num, unsigned pos, FLAC__StreamMetadata_CueSheet_Index indx)
|
||||
{
|
||||
FLAC__StreamMetadata_CueSheet_Track *tr;
|
||||
|
||||
@@ -389,7 +389,7 @@ static void tr_insert_new_(FLAC__StreamMetadata *block, unsigned track_num, unsi
|
||||
|
||||
tr_resize_(block, track_num, tr->num_indices+1);
|
||||
memmove(&tr->indices[pos+1], &tr->indices[pos], sizeof(FLAC__StreamMetadata_CueSheet_Index)*(tr->num_indices-1-pos));
|
||||
tr_set_new_(block, track_num, pos, index);
|
||||
tr_set_new_(block, track_num, pos, indx);
|
||||
cs_calc_len_(block);
|
||||
}
|
||||
|
||||
@@ -504,7 +504,7 @@ FLAC__bool test_metadata_object(void)
|
||||
FLAC__StreamMetadata *block, *blockcopy, *vorbiscomment, *cuesheet, *picture;
|
||||
FLAC__StreamMetadata_SeekPoint seekpoint_array[14];
|
||||
FLAC__StreamMetadata_VorbisComment_Entry entry;
|
||||
FLAC__StreamMetadata_CueSheet_Index index;
|
||||
FLAC__StreamMetadata_CueSheet_Index indx;
|
||||
FLAC__StreamMetadata_CueSheet_Track track;
|
||||
unsigned i, expected_length, seekpoints;
|
||||
int j;
|
||||
@@ -1795,11 +1795,11 @@ FLAC__bool test_metadata_object(void)
|
||||
return false;
|
||||
printf("OK\n");
|
||||
|
||||
index.offset = 0;
|
||||
index.number = 1;
|
||||
indx.offset = 0;
|
||||
indx.number = 1;
|
||||
printf("testing FLAC__metadata_object_cuesheet_track_insert_index() on empty array...");
|
||||
tr_insert_new_(cuesheet, 0, 0, index);
|
||||
if(!FLAC__metadata_object_cuesheet_track_insert_index(block, 0, 0, index)) {
|
||||
tr_insert_new_(cuesheet, 0, 0, indx);
|
||||
if(!FLAC__metadata_object_cuesheet_track_insert_index(block, 0, 0, indx)) {
|
||||
printf("FAILED, returned false\n");
|
||||
return false;
|
||||
}
|
||||
@@ -1807,11 +1807,11 @@ FLAC__bool test_metadata_object(void)
|
||||
return false;
|
||||
printf("OK\n");
|
||||
|
||||
index.offset = 10;
|
||||
index.number = 2;
|
||||
indx.offset = 10;
|
||||
indx.number = 2;
|
||||
printf("testing FLAC__metadata_object_cuesheet_track_insert_index() on beginning of non-empty array...");
|
||||
tr_insert_new_(cuesheet, 0, 0, index);
|
||||
if(!FLAC__metadata_object_cuesheet_track_insert_index(block, 0, 0, index)) {
|
||||
tr_insert_new_(cuesheet, 0, 0, indx);
|
||||
if(!FLAC__metadata_object_cuesheet_track_insert_index(block, 0, 0, indx)) {
|
||||
printf("FAILED, returned false\n");
|
||||
return false;
|
||||
}
|
||||
@@ -1819,11 +1819,11 @@ FLAC__bool test_metadata_object(void)
|
||||
return false;
|
||||
printf("OK\n");
|
||||
|
||||
index.offset = 20;
|
||||
index.number = 3;
|
||||
indx.offset = 20;
|
||||
indx.number = 3;
|
||||
printf("testing FLAC__metadata_object_cuesheet_track_insert_index() on middle of non-empty array...");
|
||||
tr_insert_new_(cuesheet, 0, 1, index);
|
||||
if(!FLAC__metadata_object_cuesheet_track_insert_index(block, 0, 1, index)) {
|
||||
tr_insert_new_(cuesheet, 0, 1, indx);
|
||||
if(!FLAC__metadata_object_cuesheet_track_insert_index(block, 0, 1, indx)) {
|
||||
printf("FAILED, returned false\n");
|
||||
return false;
|
||||
}
|
||||
@@ -1831,11 +1831,11 @@ FLAC__bool test_metadata_object(void)
|
||||
return false;
|
||||
printf("OK\n");
|
||||
|
||||
index.offset = 30;
|
||||
index.number = 4;
|
||||
indx.offset = 30;
|
||||
indx.number = 4;
|
||||
printf("testing FLAC__metadata_object_cuesheet_track_insert_index() on end of non-empty array...");
|
||||
tr_insert_new_(cuesheet, 0, 3, index);
|
||||
if(!FLAC__metadata_object_cuesheet_track_insert_index(block, 0, 3, index)) {
|
||||
tr_insert_new_(cuesheet, 0, 3, indx);
|
||||
if(!FLAC__metadata_object_cuesheet_track_insert_index(block, 0, 3, indx)) {
|
||||
printf("FAILED, returned false\n");
|
||||
return false;
|
||||
}
|
||||
@@ -1843,10 +1843,10 @@ FLAC__bool test_metadata_object(void)
|
||||
return false;
|
||||
printf("OK\n");
|
||||
|
||||
index.offset = 0;
|
||||
index.number = 0;
|
||||
indx.offset = 0;
|
||||
indx.number = 0;
|
||||
printf("testing FLAC__metadata_object_cuesheet_track_insert_blank_index() on end of non-empty array...");
|
||||
tr_insert_new_(cuesheet, 0, 4, index);
|
||||
tr_insert_new_(cuesheet, 0, 4, indx);
|
||||
if(!FLAC__metadata_object_cuesheet_track_insert_blank_index(block, 0, 4)) {
|
||||
printf("FAILED, returned false\n");
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user