summaryrefslogtreecommitdiff
path: root/src/plugin_common
diff options
context:
space:
mode:
authorJosh Coalson <jcoalson@users.sourceforce.net>2003-12-16 22:36:29 +0000
committerJosh Coalson <jcoalson@users.sourceforce.net>2003-12-16 22:36:29 +0000
commitddb8e82181e118f2dc458bb2ba62447b3f7b2add (patch)
tree2446bb8fa58c3057c4754a028cf1787f953abc6a /src/plugin_common
parentc65460d4f9f1ae900f5d90a40bd1bcf7ae603562 (diff)
downloadflac-ddb8e82181e118f2dc458bb2ba62447b3f7b2add.tar.gz
fix bug in the returned size
Diffstat (limited to 'src/plugin_common')
-rw-r--r--src/plugin_common/dither.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/plugin_common/dither.c b/src/plugin_common/dither.c
index eb379bed..14c46a60 100644
--- a/src/plugin_common/dither.c
+++ b/src/plugin_common/dither.c
@@ -103,7 +103,7 @@ static FLAC__INLINE FLAC__int32 linear_dither(unsigned source_bps, unsigned targ
return output >> scalebits;
}
-unsigned FLAC__plugin_common__pack_pcm_signed_big_endian(FLAC__byte *data, const FLAC__int32 * const input[], unsigned wide_samples, unsigned channels, unsigned source_bps, unsigned target_bps)
+size_t FLAC__plugin_common__pack_pcm_signed_big_endian(FLAC__byte *data, const FLAC__int32 * const input[], unsigned wide_samples, unsigned channels, unsigned source_bps, unsigned target_bps)
{
static dither_state dither[FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS];
FLAC__byte * const start = data;
@@ -111,7 +111,7 @@ unsigned FLAC__plugin_common__pack_pcm_signed_big_endian(FLAC__byte *data, const
const FLAC__int32 *input_;
unsigned samples, channel;
const unsigned bytes_per_sample = target_bps / 8;
- unsigned inc = bytes_per_sample * channels;
+ const unsigned incr = bytes_per_sample * channels;
FLAC__ASSERT(channels > 0 && channels <= FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS);
FLAC__ASSERT(source_bps < 32);
@@ -148,7 +148,7 @@ unsigned FLAC__plugin_common__pack_pcm_signed_big_endian(FLAC__byte *data, const
break;
}
- data += inc;
+ data += incr;
}
}
}
@@ -176,15 +176,15 @@ unsigned FLAC__plugin_common__pack_pcm_signed_big_endian(FLAC__byte *data, const
break;
}
- data += inc;
+ data += incr;
}
}
}
- return data - start;
+ return wide_samples * channels * (target_bps/8);
}
-unsigned FLAC__plugin_common__pack_pcm_signed_little_endian(FLAC__byte *data, const FLAC__int32 * const input[], unsigned wide_samples, unsigned channels, unsigned source_bps, unsigned target_bps)
+size_t FLAC__plugin_common__pack_pcm_signed_little_endian(FLAC__byte *data, const FLAC__int32 * const input[], unsigned wide_samples, unsigned channels, unsigned source_bps, unsigned target_bps)
{
static dither_state dither[FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS];
FLAC__byte * const start = data;
@@ -192,7 +192,7 @@ unsigned FLAC__plugin_common__pack_pcm_signed_little_endian(FLAC__byte *data, co
const FLAC__int32 *input_;
unsigned samples, channel;
const unsigned bytes_per_sample = target_bps / 8;
- unsigned inc = bytes_per_sample * channels;
+ const unsigned incr = bytes_per_sample * channels;
FLAC__ASSERT(channels > 0 && channels <= FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS);
FLAC__ASSERT(source_bps < 32);
@@ -226,7 +226,7 @@ unsigned FLAC__plugin_common__pack_pcm_signed_little_endian(FLAC__byte *data, co
data[0] = (FLAC__byte)sample;
}
- data += inc;
+ data += incr;
}
}
}
@@ -251,10 +251,10 @@ unsigned FLAC__plugin_common__pack_pcm_signed_little_endian(FLAC__byte *data, co
data[0] = (FLAC__byte)sample;
}
- data += inc;
+ data += incr;
}
}
}
- return data - start;
+ return wide_samples * channels * (target_bps/8);
}