summaryrefslogtreecommitdiff
path: root/regtest
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2009-02-22 19:58:45 +1100
committerErik de Castro Lopo <erikd@mega-nerd.com>2009-02-22 19:58:45 +1100
commit081903f5109886bafae612c6e0df6c8dbafc58d8 (patch)
treec36d79dddcfa714898127eb4d54a041d3810dca9 /regtest
parent590f2ad7880a4a3686cec5135c53a59eeebae156 (diff)
regtest/*.c : Bunch of fixes.
Diffstat (limited to 'regtest')
-rw-r--r--regtest/checksum.c2
-rw-r--r--regtest/database.c28
-rw-r--r--regtest/sndfile-regtest.c2
3 files changed, 17 insertions, 15 deletions
diff --git a/regtest/checksum.c b/regtest/checksum.c
index f4c45da..863fbed 100644
--- a/regtest/checksum.c
+++ b/regtest/checksum.c
@@ -1,5 +1,5 @@
/*
-** Copyright (C) 2005 Erik de Castro Lopo
+** Copyright (C) 2005-2009 Erik de Castro Lopo
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
diff --git a/regtest/database.c b/regtest/database.c
index 1d03b4e..f439f68 100644
--- a/regtest/database.c
+++ b/regtest/database.c
@@ -1,5 +1,5 @@
/*
-** Copyright (C) 2005 Erik de Castro Lopo
+** Copyright (C) 2005-2009 Erik de Castro Lopo
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -311,8 +311,8 @@ get_filename_pathname_by_ekey (REGTEST_DB * db, int ekey)
exit (1) ;
} ;
- strncpy (db->filename, result [2], sizeof (db->filename)) ;
- strncpy (db->pathname, result [3], sizeof (db->pathname)) ;
+ snprintf (db->filename, sizeof (db->filename), "%s", result [2]) ;
+ snprintf (db->pathname, sizeof (db->pathname), "%s", result [3]) ;
sqlite3_free_table (result) ;
@@ -411,6 +411,7 @@ check_file_by_ekey (REGTEST_DB * db, int ekey)
static void
get_filename_pathname (REGTEST_DB * db, const char *filepath)
{ const char * cptr ;
+ int slen ;
if (filepath [0] != '/')
{ memset (db->pathname, 0, sizeof (db->pathname)) ;
@@ -419,18 +420,19 @@ get_filename_pathname (REGTEST_DB * db, const char *filepath)
exit (1) ;
} ;
- db->pathname [strlen (db->pathname)] = '/' ;
- strncat (db->pathname, filepath, sizeof (db->pathname)) ;
+ slen = strlen (db->pathname) ;
+ db->pathname [slen ++] = '/' ;
+ snprintf (db->pathname + slen, sizeof (db->pathname) - slen, "%s", filepath) ;
}
else
- strncpy (db->pathname, filepath, sizeof (db->pathname)) ;
+ snprintf (db->pathname, sizeof (db->pathname), "%s", filepath) ;
if ((cptr = strrchr (db->pathname, '/')) == NULL)
{ printf ("\nError : bad pathname %s\n", filepath) ;
exit (1) ;
} ;
- strncpy (db->filename, cptr + 1, sizeof (db->filename)) ;
+ snprintf (db->filename, sizeof (db->filename), "%s", cptr + 1) ;
} /* get filename_pathname */
static void
@@ -443,9 +445,9 @@ static int
count_callback (REGTEST_DB * db, int argc, char **argv, char **colname)
{ db->count ++ ;
- argc = 0 ;
- argv = NULL ;
- colname = NULL ;
+ (void) argc ;
+ (void) argv ;
+ (void) colname ;
return 0 ;
} /* count_callback */
@@ -453,8 +455,8 @@ static int
ekey_max_callback (REGTEST_DB * db, int argc, char **argv, char **unused)
{ int ekey ;
- argc = 0 ;
- unused = NULL ;
+ (void) argc ;
+ (void) unused ;
ekey = strtol (argv [0], NULL, 10) ;
if (ekey > db->ekey_max)
@@ -467,7 +469,7 @@ static int
callback (void *unused, int argc, char **argv, char **colname)
{ int k ;
- unused = NULL ;
+ (void) unused ;
for (k = 0 ; k < argc ; k++)
printf ("%s = %s\n", colname [k], argv [k] ? argv [k] : "NULL") ;
diff --git a/regtest/sndfile-regtest.c b/regtest/sndfile-regtest.c
index 8ef9808..f7db490 100644
--- a/regtest/sndfile-regtest.c
+++ b/regtest/sndfile-regtest.c
@@ -1,5 +1,5 @@
/*
-** Copyright (C) 2005 Erik de Castro Lopo
+** Copyright (C) 2005-2009 Erik de Castro Lopo
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by