Mercurial > noffle
diff src/database.c @ 275:0880d6edaaa5 noffle
[svn] * src/client.c,src/database.h,src/database.c,src/over.h,src/over.c,
src/pseudo.c,src/server.c: Ensure format string specifiers and passed
data types match. As part of this, change some uses of size_t as a
general data type to an appropriate base C type. Database status changes
from int to unsigned.
author | bears |
---|---|
date | Sun, 10 Nov 2002 15:34:59 +0000 |
parents | 3477050e8d10 |
children | 16dad3488e9d |
line wrap: on
line diff
--- a/src/database.c Sun Nov 10 15:24:43 2002 +0000 +++ b/src/database.c Sun Nov 10 15:34:59 2002 +0000 @@ -1,7 +1,7 @@ /* database.c - $Id: database.c 403 2002-11-10 11:32:17Z bears $ + $Id: database.c 407 2002-11-10 15:34:59Z bears $ Uses GNU gdbm library. Using Berkeley db (included in libc6) was cumbersome. It is based on Berkeley db 1.85, which has severe bugs @@ -162,13 +162,13 @@ return FALSE; } p = Utl_getHeaderLn( t, p ); - if ( ! p || sscanf( t, "%u", &db.bytes ) != 1 ) + if ( ! p || sscanf( t, "%lu", &db.bytes ) != 1 ) { Log_err( "Entry in database '%s' is corrupt (bytes)", msgId ); return FALSE; } p = Utl_getHeaderLn( t, p ); - if ( ! p || sscanf( t, "%u", &db.lines ) != 1 ) + if ( ! p || sscanf( t, "%lu", &db.lines ) != 1 ) { Log_err( "Entry in database '%s' is corrupt (lines)", msgId ); return FALSE; @@ -197,9 +197,9 @@ DynStr_appLn( s, db.date ); DynStr_appLn( s, db.ref ); DynStr_appLn( s, db.xref ); - snprintf( t, MAXCHAR, "%u", db.bytes ); + snprintf( t, MAXCHAR, "%lu", db.bytes ); DynStr_appLn( s, t ); - snprintf( t, MAXCHAR, "%u", db.lines ); + snprintf( t, MAXCHAR, "%lu", db.lines ); DynStr_appLn( s, t ); DynStr_appDynStr( s, db.txt ); @@ -446,10 +446,10 @@ appendLongHeader( s, "Date:", db.date ); appendLongHeader( s, "References:", db.ref ); DynStr_app( s, "Bytes: " ); - snprintf( t, MAXCHAR, "%u", db.bytes ); + snprintf( t, MAXCHAR, "%lu", db.bytes ); DynStr_appLn( s, t ); DynStr_app( s, "Lines: " ); - snprintf( t, MAXCHAR, "%u", db.lines ); + snprintf( t, MAXCHAR, "%lu", db.lines ); DynStr_appLn( s, t ); appendLongHeader( s, db.xrefHost, db.xref ); p = strstr( DynStr_str( db.txt ), "\n\n" );