Attached is a patch to fix the compilation errors in fsvs.  I built
using gcc 4.6, since that's what I have by default.

There are a couple problems that I want to point out.  The size of an
integer constant expression (which is what must be used as array sizes),
shall have, according to N1124,

  integer type and shall only have operands that are integer constants,
  enumeration constants, character constants, sizeof expressions whose
  results are integer constants, and floating constants that are the
  immediate operands of casts. Cast operators in an integer constant
  expression shall only convert arithmetic types to integer types,
  except as part of an operand to the sizeof operator.

You are not allowed to call functions or use floating point math, ever.
So instead of "*3.32," I used "*332/100".

Also, you can't initialize variable-length arrays, so I used a
workaround for those two cases involving preprocessor constants.  You
may choose to adopt a different solution.

Linking requires -laprutil-1, but that isn't provided at the moment, so
the package will still FTBFS with my patch.  Also, you'll need some
version of libdb-dev because otherwise db.h isn't provided and the
package fails very early.  I used libdb4.8-dev since that's what APR
uses.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
diff -ur fsvs.old/src/helper.c fsvs-1.1.17/src/helper.c
--- fsvs.old/src/helper.c	2011-04-24 21:03:55.000000000 +0000
+++ fsvs-1.1.17/src/helper.c	2011-04-24 21:04:34.000000000 +0000
@@ -1674,7 +1674,7 @@
 {
 	static int last=0;
 	/* Sadly GCC doesn't statically solve sizeof(rev)*log(10)/log(2) ... */
-	static char buffers[2][(int)(sizeof(rev)*3.32)+3];
+	static char buffers[2][(int)(sizeof(rev)*332/100)+3];
 
 	last++;
 	if (last>= sizeof(buffers)/sizeof(buffers[0])) last=0;
diff -ur fsvs.old/src/options.c fsvs-1.1.17/src/options.c
--- fsvs.old/src/options.c	2011-04-24 21:03:55.000000000 +0000
+++ fsvs-1.1.17/src/options.c	2011-04-24 21:16:51.000000000 +0000
@@ -20,6 +20,7 @@
  * Functions dealing with user settings. */
 
 #define ENV_PREFIX "FSVS_"
+#define ENV_PREFIX_LENGTH 5
 
 /** A structure to associate a string with an integer. */
 struct opt___val_str_t 
@@ -632,7 +633,7 @@
  * loop via \c getenv() over all options? */
 char *opt__variable_from_option(enum opt__settings_e which)
 {
-	static char buffer[ strlen(ENV_PREFIX) + 
+	static char buffer[ ENV_PREFIX_LENGTH + 
 		sizeof(opt__list[0].name) + 1] = ENV_PREFIX;
 	char * const target=buffer+strlen(ENV_PREFIX);
 	int i;
diff -ur fsvs.old/src/status.c fsvs-1.1.17/src/status.c
--- fsvs.old/src/status.c	2011-04-24 21:03:55.000000000 +0000
+++ fsvs-1.1.17/src/status.c	2011-04-24 21:18:43.000000000 +0000
@@ -400,8 +400,9 @@
 	int status;
 	time_t now;
 	int print;
-	const int bar_chart_width=20;
-	static const char bar_chart[bar_chart_width+1]="###################>";
+#define BAR_CHART_WIDTH 20
+	const int bar_chart_width=BAR_CHART_WIDTH;
+	static const char bar_chart[BAR_CHART_WIDTH+1]="###################>";
 	float pct;
 
 

Attachment: signature.asc
Description: Digital signature

Reply via email to