From 1e3f9ad66c1fcf15edc50a1df4eafe23e4e17732 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 8 Aug 2009 16:44:00 +0200 Subject: [PATCH] Fix compiler warning in bvfs code --- bacula/src/cats/bvfs.c | 8 ++++---- bacula/src/cats/bvfs.h | 4 ++-- bacula/src/tools/bvfs_test.c | 26 +++++++++++++------------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/bacula/src/cats/bvfs.c b/bacula/src/cats/bvfs.c index 94e2e0c8a0..570e074acc 100644 --- a/bacula/src/cats/bvfs.c +++ b/bacula/src/cats/bvfs.c @@ -472,7 +472,7 @@ void Bvfs::update_cache() } /* Change the current directory, returns true if the path exists */ -bool Bvfs::ch_dir(char *path) +bool Bvfs::ch_dir(const char *path) { pm_strcpy(db->path, path); db->pnl = strlen(db->path); @@ -483,7 +483,7 @@ bool Bvfs::ch_dir(char *path) /* * Get all file versions for a specified client */ -void Bvfs::get_all_file_versions(DBId_t pathid, DBId_t fnid, char *client) +void Bvfs::get_all_file_versions(DBId_t pathid, DBId_t fnid, const char *client) { Dmsg3(dbglevel, "get_all_file_versions(%lld, %lld, %s)\n", (uint64_t)pathid, (uint64_t)fnid, client); @@ -678,8 +678,8 @@ bool Bvfs::ls_files() "SELECT File.FilenameId, listfiles.Name, File.JobId, File.LStat, listfiles.id " "FROM File, ( " "SELECT Filename.Name as Name, max(File.FileId) as id " - "FROM File, Filename " - "WHERE File.FilenameId = Filename.FilenameId " + "FROM File, Filename " + "WHERE File.FilenameId = Filename.FilenameId " "AND Filename.Name != '' " "AND File.PathId = %s " "AND File.JobId IN (%s) " diff --git a/bacula/src/cats/bvfs.h b/bacula/src/cats/bvfs.h index bc6d436567..9abe7c485e 100644 --- a/bacula/src/cats/bvfs.h +++ b/bacula/src/cats/bvfs.h @@ -106,12 +106,12 @@ public: /* * Returns true if the directory exists */ - bool ch_dir(char *path); + bool ch_dir(const char *path); bool ls_files(); /* Returns true if we have more files to read */ bool ls_dirs(); /* Returns true if we have more dir to read */ void ls_special_dirs(); /* get . and .. */ - void get_all_file_versions(DBId_t pathid, DBId_t fnid, char *client); + void get_all_file_versions(DBId_t pathid, DBId_t fnid, const char *client); void update_cache(); diff --git a/bacula/src/tools/bvfs_test.c b/bacula/src/tools/bvfs_test.c index 87555e50e4..75091d4d86 100644 --- a/bacula/src/tools/bvfs_test.c +++ b/bacula/src/tools/bvfs_test.c @@ -1,16 +1,7 @@ -/* - * - * Program to test cache path - * - * Eric Bollengier, March 2007 - * - * - * Version $Id$ - */ /* Bacula® - The Network Backup Solution - Copyright (C) 2001-2006 Free Software Foundation Europe e.V. + Copyright (C) 2009-2009 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -34,6 +25,14 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * + * Program to test cache path + * + * Eric Bollengier, August 2009 + * + * + */ #include "bacula.h" #include "cats/cats.h" @@ -42,7 +41,7 @@ /* Local variables */ static B_DB *db; -static char *file="COPYRIGHT"; +static const char *file = "COPYRIGHT"; static DBId_t fnid=0; static const char *db_name = "regress"; static const char *db_user = "regress"; @@ -75,7 +74,7 @@ static int result_handler(void *ctx, int fields, char **row) { Bvfs *vfs = (Bvfs *)ctx; ATTR *attr = vfs->get_attr(); - char *empty = "A A A A A A A A A A A A A A"; + char empty[] = "A A A A A A A A A A A A A A"; memset(&attr->statp, 0, sizeof(struct stat)); decode_stat((row[BVFS_LStat] && row[BVFS_LStat][0])?row[BVFS_LStat]:empty, @@ -112,7 +111,8 @@ static int result_handler(void *ctx, int fields, char **row) int main (int argc, char *argv[]) { int ch; - char *jobids="1", *path=NULL, *client=NULL; + char *jobids = (char *)"1"; + char *path=NULL, *client=NULL; uint64_t limit=0; bool clean=false; setlocale(LC_ALL, ""); -- 2.39.5