aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-24 19:16:10 +0100
committerMax Kellermann <max@duempel.org>2009-01-24 19:16:10 +0100
commitb53e80d7857fa079331d35637a5a3fb0b4d4ac3c (patch)
tree6c445a9b4c0670c6ef8049750496c2f3bd3f9b18 /src/decoder
parent0c71640528c5c566ec4770143c7831ace28b51d1 (diff)
downloadmpd-b53e80d7857fa079331d35637a5a3fb0b4d4ac3c.tar.gz
mpd-b53e80d7857fa079331d35637a5a3fb0b4d4ac3c.tar.xz
mpd-b53e80d7857fa079331d35637a5a3fb0b4d4ac3c.zip
modplug: use GByteArray.len, remove total_len
The local variable "total_len" is superfluous because GByteArray always knows its size.
Diffstat (limited to 'src/decoder')
-rw-r--r--src/decoder/modplug_plugin.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/decoder/modplug_plugin.c b/src/decoder/modplug_plugin.c
index 5113d8a2e..33b66aece 100644
--- a/src/decoder/modplug_plugin.c
+++ b/src/decoder/modplug_plugin.c
@@ -35,7 +35,6 @@ static GByteArray *mod_loadfile(struct decoder *decoder, struct input_stream *is
{
unsigned char *data;
GByteArray *bdatas;
- int total_len;
int ret;
if (is->size == 0) {
@@ -56,17 +55,16 @@ static GByteArray *mod_loadfile(struct decoder *decoder, struct input_stream *is
}
data = g_malloc(MODPLUG_READ_BLOCK);
- total_len = 0;
do {
ret = decoder_read(decoder, is, data, MODPLUG_READ_BLOCK);
if (ret > 0) {
g_byte_array_append(bdatas, data, ret);
- total_len += ret;
} else {
//end of file, or read error
break;
}
- if (total_len > MODPLUG_FILE_LIMIT) {
+
+ if (bdatas->len > MODPLUG_FILE_LIMIT) {
g_warning("stream too large\n");
g_free(data);
g_byte_array_free(bdatas, TRUE);