[xiph-commits] r12193 - trunk/vorbis-tools/vorbiscomment

conrad at svn.xiph.org conrad at svn.xiph.org
Fri Dec 8 20:08:45 PST 2006


Author: conrad
Date: 2006-12-08 20:08:43 -0800 (Fri, 08 Dec 2006)
New Revision: 12193

Modified:
   trunk/vorbis-tools/vorbiscomment/vcomment.c
Log:
clean up tab/space alignment in vcomment.c, and note that -q option is unused


Modified: trunk/vorbis-tools/vorbiscomment/vcomment.c
===================================================================
--- trunk/vorbis-tools/vorbiscomment/vcomment.c	2006-12-09 03:49:23 UTC (rev 12192)
+++ trunk/vorbis-tools/vorbiscomment/vcomment.c	2006-12-09 04:08:43 UTC (rev 12193)
@@ -31,7 +31,7 @@
 	{"tag",0,0,'t'},
 	{"write",0,0,'w'},
 	{"help",0,0,'h'},
-	{"quiet",0,0,'q'},
+	{"quiet",0,0,'q'}, /* unused */
 	{"version", 0, 0, 'V'},
 	{"commentfile",1,0,'c'},
 	{"raw", 0,0,'R'},
@@ -40,14 +40,19 @@
 
 /* local parameter storage from parsed options */
 typedef struct {
+	/* mode and flags */
 	int	mode;
+	int	raw;
+
+	/* file names and handles */
 	char	*infilename, *outfilename;
 	char	*commentfilename;
 	FILE	*in, *out, *com;
-	int commentcount;
-	char **comments;
-	int tempoutfile;
-    int raw;
+	int	tempoutfile;
+
+	/* comments */
+	int	commentcount;
+	char	**comments;
 } param_t;
 
 #define MODE_NONE  0
@@ -134,9 +139,9 @@
 		{
 			fprintf(stderr, _("Failed to open file as vorbis: %s\n"), 
 					vcedit_error(state));
-            close_files(param, 0);
-            free_param(param);
-            vcedit_clear(state);
+			close_files(param, 0);
+			free_param(param);
+			vcedit_clear(state);
 			return 1;
 		}
 
@@ -175,9 +180,9 @@
 		{
 			fprintf(stderr, _("Failed to write comments to output file: %s\n"), 
 					vcedit_error(state));
-            close_files(param, 0);
-            free_param(param);
-            vcedit_clear(state);
+			close_files(param, 0);
+			free_param(param);
+			vcedit_clear(state);
 			return 1;
 		}
 
@@ -185,7 +190,7 @@
 		vcedit_clear(state);
 		
 		close_files(param, 1);
-        free_param(param);
+		free_param(param);
 		return 0;
 	}
 
@@ -207,18 +212,16 @@
 void print_comments(FILE *out, vorbis_comment *vc, int raw)
 {
 	int i;
-    char *decoded_value;
+	char *decoded_value;
 
-	for (i = 0; i < vc->comments; i++)
-    {
-	    if (!raw && utf8_decode(vc->user_comments[i], &decoded_value) >= 0)
-        {
-    		fprintf(out, "%s\n", decoded_value);
-            free(decoded_value);
-        }
-        else
-            fprintf(out, "%s\n", vc->user_comments[i]);
-    }
+	for (i = 0; i < vc->comments; i++) {
+		if (!raw && utf8_decode(vc->user_comments[i], &decoded_value) >= 0) {
+    			fprintf(out, "%s\n", decoded_value);
+			free(decoded_value);
+		} else {
+			fprintf(out, "%s\n", vc->user_comments[i]);
+		}
+	}
 }
 
 /**********
@@ -287,7 +290,7 @@
 
 ***********/
 
-/* XXX: -q is not yet implemented ...
+/* XXX: -q is unused
   printf (_("  -q, --quiet             Don't display comments while editing\n"));
 */
 
@@ -303,7 +306,7 @@
   printf (_("Usage: \n"
             "  vorbiscomment [-Vh]\n" 
             "  vorbiscomment [-lR] file\n"
-            "  vorbiscomment [-qR] [-c file] [-t tag] <-a|-w> inputfile [outputfile]\n"));
+            "  vorbiscomment [-R] [-c file] [-t tag] <-a|-w> inputfile [outputfile]\n"));
   printf ("\n");
 
   printf (_("Listing options\n"));
@@ -366,8 +369,9 @@
 {
 	param_t *param = (param_t *)malloc(sizeof(param_t));
 
-	/* mode */
+	/* mode and flags */
 	param->mode = MODE_LIST;
+	param->raw = 0;
 
 	/* filenames */
 	param->infilename  = NULL;
@@ -377,13 +381,12 @@
 	/* file pointers */
 	param->in = param->out = NULL;
 	param->com = NULL;
+	param->tempoutfile=0;
 
+	/* comments */
 	param->commentcount=0;
 	param->comments=NULL;
-	param->tempoutfile=0;
 
-    param->raw = 0;
-
 	return param;
 }
 
@@ -413,25 +416,25 @@
 			case 'l':
 				param->mode = MODE_LIST;
 				break;
-            case 'R':
-                param->raw = 1;
-                break;
+			case 'R':
+				param->raw = 1;
+				break;
 			case 'w':
 				param->mode = MODE_WRITE;
 				break;
 			case 'a':
 				param->mode = MODE_APPEND;
 				break;
-            case 'V':
-                fprintf(stderr, "Vorbiscomment " VERSION "\n");
-                exit(0);
-                break;
+			case 'V':
+				fprintf(stderr, "Vorbiscomment " VERSION "\n");
+				exit(0);
+				break;
 			case 'h':
 				usage();
 				exit(0);
 				break;
 			case 'q':
-				/* set quiet flag */
+				/* set quiet flag: unused */
 				break;
 			case 'c':
 				param->commentfilename = strdup(optarg);



More information about the commits mailing list