[xiph-cvs] cvs commit: vorbis/lib info.c
Michael Smith
msmith at xiph.org
Sat Oct 13 23:52:08 PDT 2001
msmith 01/10/13 23:52:08
Modified: lib info.c
Log:
Fix _v_writestring() bug reported by Erik Kruus, to fix an 8-bit cleanness
problem in comment writing.
Revision Changes Path
1.47 +11 -9 vorbis/lib/info.c
Index: info.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/info.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- info.c 2001/10/02 00:14:31 1.46
+++ info.c 2001/10/14 06:52:07 1.47
@@ -11,7 +11,7 @@
********************************************************************
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 $
********************************************************************/
@@ -41,8 +41,9 @@
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);
}
}
@@ -388,7 +389,7 @@
/* 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);
@@ -408,14 +409,15 @@
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 */
@@ -425,7 +427,7 @@
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);
}
@@ -442,7 +444,7 @@
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);
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list