From: Tilman Sauerbeck Date: Sat, 19 Aug 2006 20:43:25 +0000 (+0200) Subject: Code cleanup. X-Git-Tag: ruby-vorbistagger-0.0.1~3 X-Git-Url: http://git.code-monkey.de/?p=ruby-vorbistagger.git;a=commitdiff_plain;h=9f14fcfaa2e4bb714f3aa33a5357038f8794e2e7 Code cleanup. --- diff --git a/ext/vcedit.c b/ext/vcedit.c index 32778a3..7a7797a 100644 --- a/ext/vcedit.c +++ b/ext/vcedit.c @@ -121,7 +121,7 @@ vcedit_state_new (const char *filename) if (len > PATH_MAX) return NULL; - s= malloc (sizeof (vcedit_state) + len + 1); + s = malloc (sizeof (vcedit_state) + len + 1); if (!s) return NULL; @@ -211,7 +211,7 @@ write_comments (vcedit_state *s, ogg_packet *packet) /* comments */ oggpack_write (&opb, s->vc.comments, 32); - for (i = 0; i < s->vc.comments; i++) { + for (i = 0; i < s->vc.comments; i++) if (!s->vc.user_comments[i]) oggpack_write (&opb, 0, 32); else { @@ -219,7 +219,6 @@ write_comments (vcedit_state *s, ogg_packet *packet) _v_writestring (&opb, s->vc.user_comments[i], s->vc.comment_lengths[i]); } - } oggpack_write (&opb, 1, 1); @@ -501,11 +500,10 @@ vcedit_write (vcedit_state *s) size = _blocksize (s, &packet); granpos += size; - if (need_flush) { + if (need_flush) write = ogg_stream_flush (&stream, &page_out); - } else if (need_out) { + else if (need_out) write = ogg_stream_pageout (&stream, &page_out); - } if (write && !write_page (out, &page_out)) goto cleanup; @@ -546,13 +544,9 @@ vcedit_write (vcedit_state *s) /* We copy the rest of the stream (other logical streams) * through, a page at a time. */ - while ((result = ogg_sync_pageout (&s->oy, &page_out))) { - /* Don't bother going through the rest, we can just - * write the page out now - */ + while ((result = ogg_sync_pageout (&s->oy, &page_out))) if (result == 1 && !write_page (out, &page_out)) goto cleanup; - } buffer = ogg_sync_buffer (&s->oy, CHUNKSIZE); bytes = fread (buffer, 1, CHUNKSIZE, s->in);