}
state->serial = 0;
- state->prevW = state->extrapage = state->eosin = 0;
}
void
static int
_commentheader_out (vorbis_comment *vc, char *vendor, ogg_packet *op)
{
+ int i;
+
oggpack_buffer opb;
oggpack_writeinit (&opb);
/* comments */
oggpack_write (&opb, vc->comments, 32);
- if (vc->comments) {
- int i;
-
- for (i = 0; i < vc->comments; i++) {
- if (vc->user_comments[i]) {
- oggpack_write (&opb, vc->comment_lengths[i], 32);
- _v_writestring (&opb, vc->user_comments[i],
- vc->comment_lengths[i]);
- } else
- oggpack_write (&opb, 0, 32);
+ for (i = 0; i < vc->comments; i++) {
+ if (!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]);
}
}
static int
_blocksize (vcedit_state *s, ogg_packet *p)
{
- int this = vorbis_packet_blocksize (s->vi, p);
- int ret = (this + s->prevW) / 4;
+ int this, ret = 0;
- if (!s->prevW) {
- s->prevW = this;
- return 0;
- }
+ this = vorbis_packet_blocksize (s->vi, p);
+
+ if (s->prevW)
+ ret = (this + s->prevW) / 4;
s->prevW = this;
return -1;
}
- state->eosin = 0;
- state->extrapage = 0;
+ state->prevW = state->extrapage = state->eosin = 0;
header_main.bytes = state->mainlen;
header_main.packet = state->mainbuf;