********************************************************************
function: maintain the info structure, info <-> header packets
- last mod: $Id: info.c,v 1.46 2001/10/02 00:14:31 segher Exp $
+ last mod: $Id: info.c,v 1.47 2001/10/14 06:52:07 msmith Exp $
********************************************************************/
return(ret);
}
-static void _v_writestring(oggpack_buffer *o,char *s){
- while(*s){
+static void _v_writestring(oggpack_buffer *o,char *s, int bytes){
+
+ while(bytes--){
oggpack_write(o,*s++,8);
}
}
/* preamble */
oggpack_write(opb,0x01,8);
- _v_writestring(opb,"vorbis");
+ _v_writestring(opb,"vorbis", 6);
/* basic information about the stream */
oggpack_write(opb,0x00,32);
static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
char temp[]="Xiphophorus libVorbis I 20010910";
+ int bytes = strlen(temp);
/* preamble */
oggpack_write(opb,0x03,8);
- _v_writestring(opb,"vorbis");
+ _v_writestring(opb,"vorbis", 6);
/* vendor */
- oggpack_write(opb,strlen(temp),32);
- _v_writestring(opb,temp);
+ oggpack_write(opb,bytes,32);
+ _v_writestring(opb,temp, bytes);
/* comments */
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]);
+ _v_writestring(opb,vc->user_comments[i], vc->comment_lengths[i]);
}else{
oggpack_write(opb,0,32);
}
if(!ci)return(OV_EFAULT);
oggpack_write(opb,0x05,8);
- _v_writestring(opb,"vorbis");
+ _v_writestring(opb,"vorbis", 6);
/* books */
oggpack_write(opb,ci->books-1,8);