From 48f59b2b6685342bdc1a9227127639c62c83d517 Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Fri, 18 Aug 2006 15:49:38 +0200 Subject: [PATCH] Code cleanup. --- ext/vcedit.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/ext/vcedit.c b/ext/vcedit.c index 38ecb9f..7976a06 100644 --- a/ext/vcedit.c +++ b/ext/vcedit.c @@ -163,11 +163,11 @@ _v_writestring (oggpack_buffer *o, char *s, int len) } static int -_commentheader_out (vorbis_comment *vc, char *vendor, ogg_packet *op) +_commentheader_out (vcedit_state *s, ogg_packet *op) { - int i; - oggpack_buffer opb; + size_t len; + int i; oggpack_writeinit (&opb); @@ -176,19 +176,20 @@ _commentheader_out (vorbis_comment *vc, char *vendor, ogg_packet *op) _v_writestring (&opb, "vorbis", 6); /* vendor */ - oggpack_write (&opb, strlen (vendor), 32); - _v_writestring (&opb, vendor, strlen (vendor)); + len = strlen (s->vendor); + oggpack_write (&opb, len, 32); + _v_writestring (&opb, s->vendor, len); /* comments */ - oggpack_write (&opb, vc->comments, 32); + oggpack_write (&opb, s->vc.comments, 32); - for (i = 0; i < vc->comments; i++) { - if (!vc->user_comments[i]) + for (i = 0; i < s->vc.comments; i++) { + if (!s->vc.user_comments[i]) oggpack_write (&opb, 0, 32); else { - oggpack_write (&opb, vc->comment_lengths[i], 32); - _v_writestring (&opb, vc->user_comments[i], - vc->comment_lengths[i]); + oggpack_write (&opb, s->vc.comment_lengths[i], 32); + _v_writestring (&opb, s->vc.user_comments[i], + s->vc.comment_lengths[i]); } } @@ -440,7 +441,7 @@ vcedit_write (vcedit_state *s) ogg_stream_init (&streamout, s->serial); - _commentheader_out (&s->vc, s->vendor, &header_comments); + _commentheader_out (s, &header_comments); ogg_stream_packetin (&streamout, &header_main); ogg_stream_packetin (&streamout, &header_comments); -- 2.30.2