[xiph-commits] r14486 - trunk/vorbis-tools/ogg123

ivo at svn.xiph.org ivo at svn.xiph.org
Tue Feb 12 07:55:05 PST 2008


Author: ivo
Date: 2008-02-12 07:55:04 -0800 (Tue, 12 Feb 2008)
New Revision: 14486

Modified:
   trunk/vorbis-tools/ogg123/cfgfile_options.c
   trunk/vorbis-tools/ogg123/cfgfile_options.h
   trunk/vorbis-tools/ogg123/ogg123.h
Log:
Patch by rillian to avoid using long ints when unnecessary.

Modified: trunk/vorbis-tools/ogg123/cfgfile_options.c
===================================================================
--- trunk/vorbis-tools/ogg123/cfgfile_options.c	2008-02-12 09:41:02 UTC (rev 14485)
+++ trunk/vorbis-tools/ogg123/cfgfile_options.c	2008-02-12 15:55:04 UTC (rev 14486)
@@ -27,7 +27,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <limits.h> /* for LONG_MAX / LONG_MIN */
+#include <limits.h> /* for INT_MAX / INT_MIN */
 #include <errno.h>
 
 #include "cfgfile_options.h"
@@ -88,7 +88,7 @@
 
       case opt_type_bool:
       case opt_type_int:
-	*(long int *) opts->ptr = *(int *) opts->dfl;
+	*(int *) opts->ptr = *(int *) opts->dfl;
 	break;
 	
       case opt_type_float:
@@ -207,7 +207,7 @@
 	  break;
 	case opt_type_bool:
 	case opt_type_int:
-	  fprintf (f, "%ld", *(long int *) opt->dfl);
+	  fprintf (f, "%d", *(int *) opt->dfl);
 	  break;
 	case opt_type_float:
 	  fprintf (f, "%f", (double) (*(float *) opt->dfl));
@@ -295,11 +295,11 @@
 	if ( strncasecmp(value, "y", 1) == 0
 	     || strcasecmp(value, "true")
 	     || (*endptr == '\0' && tmpl) )
-	  *(long int *) opt->ptr = 1;
+	  *(int *) opt->ptr = 1;
 	else if ( strncasecmp(value, "n", 1) == 0
 		  || strcasecmp(value, "false")
 		  || (*endptr == '\0' && !tmpl) )
-	  *(long int *) opt->ptr = 0;
+	  *(int *) opt->ptr = 0;
 	else
 	  return parse_badvalue;
 	break;
@@ -321,11 +321,11 @@
 	if (!value || *value == '\0')
 	  return parse_badvalue;
 	tmpl = strtol (value, &endptr, 0);
-	if (((tmpl == LONG_MIN || tmpl == LONG_MAX) && errno == ERANGE)
+	if (((tmpl == INT_MIN || tmpl == INT_MAX) && errno == ERANGE)
 	    || (*endptr != '\0'))
 	  return parse_badvalue;
 	opt->found++;
-	*(long int *) opt->ptr = tmpl;
+	*(int *) opt->ptr = tmpl;
 	break;
 	
       case opt_type_float:

Modified: trunk/vorbis-tools/ogg123/cfgfile_options.h
===================================================================
--- trunk/vorbis-tools/ogg123/cfgfile_options.h	2008-02-12 09:41:02 UTC (rev 14485)
+++ trunk/vorbis-tools/ogg123/cfgfile_options.h	2008-02-12 15:55:04 UTC (rev 14486)
@@ -25,7 +25,7 @@
   opt_type_bool,
   opt_type_char,
   opt_type_string,
-  opt_type_int, /* long int */
+  opt_type_int,
   opt_type_float,
   opt_type_double
 } file_option_type_t;

Modified: trunk/vorbis-tools/ogg123/ogg123.h
===================================================================
--- trunk/vorbis-tools/ogg123/ogg123.h	2008-02-12 09:41:02 UTC (rev 14485)
+++ trunk/vorbis-tools/ogg123/ogg123.h	2008-02-12 15:55:04 UTC (rev 14486)
@@ -23,7 +23,7 @@
 #include "playlist.h"
 
 typedef struct ogg123_options_t {
-  long int verbosity;         /* Verbose output if > 1, quiet if 0 */
+  int verbosity;              /* Verbose output if > 1, quiet if 0 */
 
   int shuffle;                /* Should we shuffle playing? */
   int repeat;                 /* Repeat playlist indefinitely? */



More information about the commits mailing list