From b53e80d7857fa079331d35637a5a3fb0b4d4ac3c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 24 Jan 2009 19:16:10 +0100 Subject: modplug: use GByteArray.len, remove total_len The local variable "total_len" is superfluous because GByteArray always knows its size. --- src/decoder/modplug_plugin.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/decoder') 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); -- cgit v1.2.3