r9391 - in packages/trunk/cookietool/debian: . patches
Peter Pentchev
roam-guest at alioth.debian.org
Sat Apr 4 13:05:08 UTC 2009
Author: roam-guest
Date: 2009-04-04 13:05:08 +0000 (Sat, 04 Apr 2009)
New Revision: 9391
Modified:
packages/trunk/cookietool/debian/patches/04-compiler-warnings.patch
packages/trunk/cookietool/debian/rules
Log:
Build cleanly with lots and lots of compiler warnings.
Modified: packages/trunk/cookietool/debian/patches/04-compiler-warnings.patch
===================================================================
--- packages/trunk/cookietool/debian/patches/04-compiler-warnings.patch 2009-04-04 12:42:19 UTC (rev 9390)
+++ packages/trunk/cookietool/debian/patches/04-compiler-warnings.patch 2009-04-04 13:05:08 UTC (rev 9391)
@@ -4,6 +4,11 @@
so it's a bit misleadingly named now, so what? :)
- now that UBYTE is "char", cast it to unsigned when using it as an array
index in strstuff.c
+- a buffer size ought to be unsigned
+- use \033 instead of the non-standard \e
+- declare some static functions as, well, static
+- add "void" to the declaration of a couple of no-argument functions
+- add "const" to a couple of char *'s
--- a/cookio.c
+++ b/cookio.c
@@ -15,6 +20,37 @@
#include <string.h>
#include "cookio.h"
+@@ -46,9 +47,10 @@
+ */
+ char *read_cookie( FILE *fp, int fmt, long *psize, long *plines, long *pmaxline )
+ {
+- long cbuflen, lines, w, width;
++ size_t cbuflen;
++ long lines, w, width;
+ int delimlen;
+- char *delim = "%%";
++ const char *delim = "%%";
+
+ switch( fmt )
+ {
+@@ -83,7 +85,7 @@
+ w = strlen( line );
+ if( (cbuflen += w) >= sizeof( cbuf ) )
+ {
+- printf( "\ncookie too big (>%ld chars) \n", (long) sizeof( cbuf ) );
++ printf( "\ncookie too big (>%lu chars) \n", (unsigned long) sizeof( cbuf ) );
+ exit( 20 );
+ }
+ strcat( cbuf, line );
+@@ -113,7 +115,7 @@
+ */
+ int write_cookie( char *cookie, FILE *fp, int fmt )
+ {
+- char *fmts = "%s\n%%%%\n";
++ const char *fmts = "%s\n%%%%\n";
+ int len;
+ static int linew = 0;
+
--- a/strstuff.h
+++ b/strstuff.h
@@ -30,7 +30,8 @@
@@ -130,3 +166,130 @@
}
+--- a/cookietool.c
++++ b/cookietool.c
+@@ -47,7 +47,7 @@
+ /*
+ * Print a help text and nag about illegal parameter <s>
+ */
+-void help( UBYTE *s )
++static void help( UBYTE *s )
+ {
+ if( s )
+ printf( "illegal option '%s'\n", s );
+@@ -177,8 +177,8 @@
+ {
+ strcpy( name2, name1 );
+ printf( "Warning! You have enabled direct writeback mode!\n" );
+- printf( "\e[2mDon't break (or crash) cookietool now, " );
+- printf( "or you will inevitably lose data!\e[0m\n" );
++ printf( "\033[2mDon't break (or crash) cookietool now, " );
++ printf( "or you will inevitably lose data!\033[0m\n" );
+ }
+ else
+ strcpy( name2, "ct_temp_crunchfile" );
+--- a/compress.c
++++ b/compress.c
+@@ -53,7 +53,7 @@
+ * Assign ascending numbers to all cookies in the list and reset each sort
+ * hook to the start of its body text.
+ */
+-void rebuild_listinfo()
++static void rebuild_listinfo(void)
+ {
+ long l;
+
+@@ -137,7 +137,7 @@
+ /*
+ * Cookie comparison, for sorting.
+ */
+-int cookie_cmp( struct cookie *a, struct cookie *b, int mode )
++static int cookie_cmp( struct cookie *a, struct cookie *b, int mode )
+ {
+ int c = 0;
+
+@@ -163,7 +163,7 @@
+ /*
+ * sift(): does the main work for my_heapsort()
+ */
+-void sift( struct cookie v[], long i, long m, int mode )
++static void sift( struct cookie v[], long i, long m, int mode )
+ {
+ long j;
+ struct cookie temp;
+@@ -189,7 +189,7 @@
+ * Note the side effect: Will print three "."s to stdout: one on entry,
+ * one when the sort is halfway through, and another one when it's all done.
+ */
+-void my_heapsort( struct cookie v[], long n, int mode )
++static void my_heapsort( struct cookie v[], long n, int mode )
+ {
+ long i;
+ struct cookie temp;
+@@ -215,7 +215,7 @@
+ /*
+ * Adjust sorthooks for the final sort, according to the desired mode.
+ */
+-void set_hooks( int mode, UBYTE *hooktarget )
++static void set_hooks( int mode, UBYTE *hooktarget )
+ {
+ long l;
+ int hot;
+--- a/cdbdiff.c
++++ b/cdbdiff.c
+@@ -46,7 +46,7 @@
+ /*
+ * Print a help text and nag about illegal parameter <s>
+ */
+-void help( UBYTE *s )
++static void help( UBYTE *s )
+ {
+ if( s )
+ printf( "illegal option '%s'\n", s );
+--- a/cdbsplit.c
++++ b/cdbsplit.c
+@@ -55,7 +55,7 @@
+ /*
+ * print a help text and nag about illegal parameter <s>
+ */
+-void help( char *s )
++static void help( char *s )
+ {
+ if( s )
+ printf( "illegal option '%s'\n", s );
+@@ -79,7 +79,7 @@
+ * Write a cookie to one of two files. Returns the number of cookies
+ * written to the hit-file (which of course is either 1 or 0).
+ */
+-int dispatch( char *cookie, int good, FILE *fp2, FILE *fp3 )
++static int dispatch( char *cookie, int good, FILE *fp2, FILE *fp3 )
+ {
+ int success = 1;
+
+@@ -100,7 +100,7 @@
+ * Scatter contents of <fp1> across <fp2> (hitfile) and <fp3> (dumpfile),
+ * return value is the number of cookies in the dumpfile
+ */
+-long filter_cookies( FILE *fp1, FILE *fp2, FILE *fp3 )
++static long filter_cookies( FILE *fp1, FILE *fp2, FILE *fp3 )
+ {
+ static char cbak[ CBUFSIZE ]; /* backup of the last cookie, to find groups */
+ char *cptr;
+@@ -157,7 +157,7 @@
+
+
+
+-void confirm_options()
++static void confirm_options(void)
+ /* tell the user what his options will do */
+ {
+ int flags, i;
+@@ -220,7 +220,7 @@
+ int main( int argc, char *argv[] )
+ {
+ char *s;
+- char *name1 = NULL, *name2 = NULL, *name3 = "cdb_temp_kickme";
++ const char *name1 = NULL, *name2 = NULL, *name3 = "cdb_temp_kickme";
+ int append = 0, move = 1;
+ int case_sense = 0, bordermode = 2;
+ long dumped;
Modified: packages/trunk/cookietool/debian/rules
===================================================================
--- packages/trunk/cookietool/debian/rules 2009-04-04 12:42:19 UTC (rev 9390)
+++ packages/trunk/cookietool/debian/rules 2009-04-04 13:05:08 UTC (rev 9391)
@@ -6,7 +6,10 @@
PACKAGE= cookietool
D= $(CURDIR)/debian/$(PACKAGE)
-CFLAGS+= -Wall
+CFLAGS+= -Wall -W -ansi -pedantic -Wbad-function-cast \
+ -Wcast-align -Wcast-qual -Wchar-subscripts -Winline \
+ -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
+ -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings
ifneq (,$(filter werror,$(DEB_BUILD_OPTIONS)))
CFLAGS+= -Werror
endif
More information about the Pkg-games-commits
mailing list