[xiph-cvs] cvs commit: vorbis-tools/vorbiscomment vcomment.c

Ralph Giles giles at xiph.org
Sat Jan 20 03:46:52 PST 2001



giles       01/01/20 03:46:52

  Modified:    vorbiscomment vcomment.c
  Log:
  code cleanup: don't call add_comment after fgets() returns EOF.

Revision  Changes    Path
1.3       +9 -9      vorbis-tools/vorbiscomment/vcomment.c

Index: vcomment.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/vorbiscomment/vcomment.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- vcomment.c	2001/01/19 11:39:23	1.2
+++ vcomment.c	2001/01/20 11:46:52	1.3
@@ -114,17 +114,17 @@
                 vorbis_comment_init(vc);
 
                 /* build the replacement structure */
-		while (!feof(param->com)) {
+		{
                         /* FIXME should use a resizeable buffer! */
-			char *buf = (char *)malloc(1024*sizeof(char));
+			char *buf = (char *)malloc(sizeof(char)*1024);
 
-			fgets(buf, 1024, param->com);
-			if (add_comment(buf, vc) < 0) {
-				fprintf(stderr,
-					"bad comment:\n\t\"%s\"\n",
-					buf);
-			}
-
+			while (fgets(buf, 1024, param->com))
+				if (add_comment(buf, vc) < 0) {
+					fprintf(stderr,
+						"bad comment: \"%s\"\n",
+						buf);
+				}
+			
                         free(buf);
                 }
 

--- >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