use unsigned integers and size_t in the flac plugin

git-svn-id: https://svn.musicpd.org/mpd/trunk@7324 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Max Kellermann 2008-04-12 04:19:55 +00:00 committed by Eric Wong
parent 14529af732
commit 96eb0119cc
2 changed files with 9 additions and 4 deletions

View File

@ -144,9 +144,9 @@ typedef size_t flac_read_status_size_t;
typedef struct {
unsigned char chunk[FLAC_CHUNK_SIZE];
int chunk_length;
size_t chunk_length;
float time;
int bitRate;
unsigned int bitRate;
FLAC__uint64 position;
OutputBuffer *cb;
DecoderControl *dc;

View File

@ -216,15 +216,20 @@ static FLAC__StreamDecoderWriteStatus flacWrite(const flac_decoder *dec,
FLAC__uint16 u16;
unsigned char *uc;
unsigned int c_samp, c_chan;
int i;
unsigned int i;
float timeChange;
FLAC__uint64 newPosition = 0;
assert(data->dc->audioFormat.bits > 0);
timeChange = ((float)samples) / frame->header.sample_rate;
data->time += timeChange;
flac_get_decode_position(dec, &newPosition);
if (data->position) {
assert(newPosition >= data->position);
assert(timeChange >= 0);
data->bitRate =
((newPosition - data->position) * 8.0 / timeChange)
/ 1000 + 0.5;
@ -236,7 +241,7 @@ static FLAC__StreamDecoderWriteStatus flacWrite(const flac_decoder *dec,
c_chan++) {
u16 = buf[c_chan][c_samp];
uc = (unsigned char *)&u16;
for (i = 0; i < (data->dc->audioFormat.bits / 8); i++) {
for (i = 0; i < (unsigned)(data->dc->audioFormat.bits / 8); i++) {
if (data->chunk_length >= FLAC_CHUNK_SIZE) {
if (flacSendChunk(data) < 0) {
return