Skip to content

Commit

Permalink
Merge pull request #312 from bareos/dev/pstorz/master/reduce-warnings
Browse files Browse the repository at this point in the history
dev/pstorz/master/reduce warnings
  • Loading branch information
franku committed Nov 7, 2019
2 parents 0d90b77 + 33b681a commit ce6a9e0
Show file tree
Hide file tree
Showing 144 changed files with 3,495 additions and 3,446 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -142,6 +142,7 @@ Philipp Storz
Philippe Chauvat
Preben Guldberg
Radosław Korzeniewski
Renout Gerrits
Riccardo Ghetta
Richard Mortimer
Robert Nelson
Expand Down
14 changes: 11 additions & 3 deletions core/CMakeLists.txt
Expand Up @@ -83,6 +83,14 @@ if (cxx_compiler_macro_prefix_map)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmacro-prefix-map=${CMAKE_CURRENT_SOURCE_DIR}=.")
endif()


CHECK_CXX_COMPILER_FLAG(-Wno-unknown-pragmas compiler_has_no_unknown_pragmas)
if (${compiler_has_no_unknown_pragmas})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas")
endif()



# warn on sign-conversion
#include(CheckCCompilerFlag)
#CHECK_C_COMPILER_FLAG(-Wsign-conversion c_compiler_will_warn_sign_conversion)
Expand Down Expand Up @@ -205,7 +213,7 @@ endif()


if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
include_directories(
include_directories(SYSTEM
${PROJECT_SOURCE_DIR}/src/win32/include
${PROJECT_SOURCE_DIR}/src/win32/compat/include
)
Expand Down Expand Up @@ -325,9 +333,9 @@ INCLUDE(BareosDetermineHaveLowLevelScsiInterface)

INCLUDE(acltypes)

include_directories(${PYTHON_INCLUDE_DIRS})
include_directories(SYSTEM ${PYTHON_INCLUDE_DIRS})

include_directories(${PYTHON_INCLUDE_PATH})
include_directories(SYSTEM ${PYTHON_INCLUDE_PATH})

include_directories(${PROJECT_SOURCE_DIR}/src)

Expand Down
158 changes: 79 additions & 79 deletions core/src/cats/bdb_query_enum_class.h
Expand Up @@ -2,85 +2,85 @@

class BareosDbQueryEnum {
public:
typedef enum
enum class SQL_QUERY
{
SQL_QUERY_get_restore_objects = 0,
SQL_QUERY_cleanup_created_job = 1,
SQL_QUERY_cleanup_running_job = 2,
SQL_QUERY_fill_jobhisto = 3,
SQL_QUERY_list_pool = 4,
SQL_QUERY_list_jobs = 5,
SQL_QUERY_list_jobs_long = 6,
SQL_QUERY_list_jobs_count = 7,
SQL_QUERY_list_jobs_last = 8,
SQL_QUERY_list_jobs_long_last = 9,
SQL_QUERY_sel_JobMedia = 10,
SQL_QUERY_drop_deltabs = 11,
SQL_QUERY_create_deltabs = 12,
SQL_QUERY_create_delindex = 13,
SQL_QUERY_uar_count_files = 14,
SQL_QUERY_uar_list_jobs = 15,
SQL_QUERY_uar_print_jobs = 16,
SQL_QUERY_uar_del_temp = 17,
SQL_QUERY_uar_del_temp1 = 18,
SQL_QUERY_uar_last_full = 19,
SQL_QUERY_uar_last_full_no_pool = 20,
SQL_QUERY_uar_full = 21,
SQL_QUERY_uar_dif = 22,
SQL_QUERY_uar_inc = 23,
SQL_QUERY_uar_list_jobs_by_idlist = 24,
SQL_QUERY_uar_sel_jobid_temp = 25,
SQL_QUERY_uar_sel_all_temp1 = 26,
SQL_QUERY_uar_sel_all_temp = 27,
SQL_QUERY_uar_sel_fileset = 28,
SQL_QUERY_uar_sel_filesetid = 29,
SQL_QUERY_uar_jobid_fileindex = 30,
SQL_QUERY_uar_jobids_fileindex = 31,
SQL_QUERY_uar_jobid_fileindex_from_table = 32,
SQL_QUERY_select_recent_version_with_basejob = 33,
SQL_QUERY_select_recent_version_with_basejob_and_delta = 34,
SQL_QUERY_select_recent_version = 35,
SQL_QUERY_create_temp_accurate_jobids = 36,
SQL_QUERY_create_temp_basefile = 37,
SQL_QUERY_create_temp_new_basefile = 38,
SQL_QUERY_uap_upgrade_copies_oldest_job = 39,
SQL_QUERY_uar_file = 40,
SQL_QUERY_uar_create_temp = 41,
SQL_QUERY_uar_create_temp1 = 42,
SQL_QUERY_uar_jobid_fileindex_from_dir = 43,
SQL_QUERY_sql_media_order_most_recently_written = 44,
SQL_QUERY_sql_get_max_connections = 45,
SQL_QUERY_bvfs_select = 46,
SQL_QUERY_bvfs_list_files = 47,
SQL_QUERY_batch_lock_path_query = 48,
SQL_QUERY_batch_lock_filename_query = 49,
SQL_QUERY_batch_unlock_tables_query = 50,
SQL_QUERY_batch_fill_path_query = 51,
SQL_QUERY_batch_fill_filename_query = 52,
SQL_QUERY_match_query = 53,
SQL_QUERY_match_query2 = 54,
SQL_QUERY_insert_counter_values = 55,
SQL_QUERY_select_counter_values = 56,
SQL_QUERY_update_counter_values = 57,
SQL_QUERY_get_quota_jobbytes = 58,
SQL_QUERY_get_quota_jobbytes_nofailed = 59,
SQL_QUERY_uar_sel_jobid_copies = 60,
SQL_QUERY_get_jobstatus_details = 61,
SQL_QUERY_bvfs_versions_6 = 62,
SQL_QUERY_bvfs_lsdirs_4 = 63,
SQL_QUERY_bvfs_clear_cache_0 = 64,
SQL_QUERY_bvfs_update_path_visibility_3 = 65,
SQL_QUERY_list_volumes_count_0 = 66,
SQL_QUERY_list_volumes_by_name_count_1 = 67,
SQL_QUERY_list_volumes_by_poolid_count_1 = 68,
SQL_QUERY_list_joblog_2 = 69,
SQL_QUERY_list_joblog_count_1 = 70,
SQL_QUERY_get_orphaned_paths_0 = 71,
SQL_QUERY_get_bad_paths_0 = 72,
SQL_QUERY_bvfs_ls_special_dirs_3 = 73,
SQL_QUERY_bvfs_ls_sub_dirs_5 = 74,
SQL_QUERY_list_volumes_select_0 = 75,
SQL_QUERY_list_volumes_select_long_0 = 76,
get_restore_objects = 0,
cleanup_created_job = 1,
cleanup_running_job = 2,
fill_jobhisto = 3,
list_pool = 4,
list_jobs = 5,
list_jobs_long = 6,
list_jobs_count = 7,
list_jobs_last = 8,
list_jobs_long_last = 9,
sel_JobMedia = 10,
drop_deltabs = 11,
create_deltabs = 12,
create_delindex = 13,
uar_count_files = 14,
uar_list_jobs = 15,
uar_print_jobs = 16,
uar_del_temp = 17,
uar_del_temp1 = 18,
uar_last_full = 19,
uar_last_full_no_pool = 20,
uar_full = 21,
uar_dif = 22,
uar_inc = 23,
uar_list_jobs_by_idlist = 24,
uar_sel_jobid_temp = 25,
uar_sel_all_temp1 = 26,
uar_sel_all_temp = 27,
uar_sel_fileset = 28,
uar_sel_filesetid = 29,
uar_jobid_fileindex = 30,
uar_jobids_fileindex = 31,
uar_jobid_fileindex_from_table = 32,
select_recent_version_with_basejob = 33,
select_recent_version_with_basejob_and_delta = 34,
select_recent_version = 35,
create_temp_accurate_jobids = 36,
create_temp_basefile = 37,
create_temp_new_basefile = 38,
uap_upgrade_copies_oldest_job = 39,
uar_file = 40,
uar_create_temp = 41,
uar_create_temp1 = 42,
uar_jobid_fileindex_from_dir = 43,
sql_media_order_most_recently_written = 44,
sql_get_max_connections = 45,
bvfs_select = 46,
bvfs_list_files = 47,
batch_lock_path_query = 48,
batch_lock_filename_query = 49,
batch_unlock_tables_query = 50,
batch_fill_path_query = 51,
batch_fill_filename_query = 52,
match_query = 53,
match_query2 = 54,
insert_counter_values = 55,
select_counter_values = 56,
update_counter_values = 57,
get_quota_jobbytes = 58,
get_quota_jobbytes_nofailed = 59,
uar_sel_jobid_copies = 60,
get_jobstatus_details = 61,
bvfs_versions_6 = 62,
bvfs_lsdirs_4 = 63,
bvfs_clear_cache_0 = 64,
bvfs_update_path_visibility_3 = 65,
list_volumes_count_0 = 66,
list_volumes_by_name_count_1 = 67,
list_volumes_by_poolid_count_1 = 68,
list_joblog_2 = 69,
list_joblog_count_1 = 70,
get_orphaned_paths_0 = 71,
get_bad_paths_0 = 72,
bvfs_ls_special_dirs_3 = 73,
bvfs_ls_sub_dirs_5 = 74,
list_volumes_select_0 = 75,
list_volumes_select_long_0 = 76,
SQL_QUERY_NUMBER = 77
} SQL_QUERY_ENUM;
};
};
24 changes: 12 additions & 12 deletions core/src/cats/bvfs.cc
Expand Up @@ -3,7 +3,7 @@
Copyright (C) 2009-2010 Free Software Foundation Europe e.V.
Copyright (C) 2016-2016 Planets Communications B.V.
Copyright (C) 2016-2017 Bareos GmbH & Co. KG
Copyright (C) 2016-2019 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
Expand Down Expand Up @@ -295,7 +295,7 @@ bool BareosDb::UpdatePathHierarchyCache(JobControlRecord* jcr,

StartTransaction(jcr);

FillQuery(cmd, SQL_QUERY_bvfs_update_path_visibility_3, jobid, jobid, jobid);
FillQuery(cmd, SQL_QUERY::bvfs_update_path_visibility_3, jobid, jobid, jobid);

do {
retval = QUERY_DB(jcr, cmd);
Expand Down Expand Up @@ -596,7 +596,7 @@ void Bvfs::GetAllFileVersions(DBId_t pathid,
db->EscapeString(jcr, fname_esc, (char*)fname, strlen(fname));
db->EscapeString(jcr, client_esc, (char*)client, strlen(client));

db->FillQuery(query, BareosDb::SQL_QUERY_bvfs_versions_6, fname_esc,
db->FillQuery(query, BareosDb::SQL_QUERY::bvfs_versions_6, fname_esc,
edit_uint64(pathid, ed1), client_esc, filter.c_str(), limit,
offset);
db->SqlQuery(query.c_str(), list_entries, user_data);
Expand Down Expand Up @@ -648,16 +648,16 @@ bool Bvfs::ls_dirs()
*/
*prev_dir = 0;

db->FillQuery(special_dirs_query, BareosDb::SQL_QUERY_bvfs_ls_special_dirs_3,
db->FillQuery(special_dirs_query, BareosDb::SQL_QUERY::bvfs_ls_special_dirs_3,
pathid, pathid, jobids);

if (*pattern) {
db->FillQuery(filter, BareosDb::SQL_QUERY_match_query, pattern);
db->FillQuery(filter, BareosDb::SQL_QUERY::match_query, pattern);
}
db->FillQuery(sub_dirs_query, BareosDb::SQL_QUERY_bvfs_ls_sub_dirs_5, pathid,
db->FillQuery(sub_dirs_query, BareosDb::SQL_QUERY::bvfs_ls_sub_dirs_5, pathid,
jobids, jobids, filter.c_str(), jobids);

db->FillQuery(union_query, BareosDb::SQL_QUERY_bvfs_lsdirs_4,
db->FillQuery(union_query, BareosDb::SQL_QUERY::bvfs_lsdirs_4,
special_dirs_query.c_str(), sub_dirs_query.c_str(), limit,
offset);

Expand All @@ -677,10 +677,10 @@ static void build_ls_files_query(JobControlRecord* jcr,
int64_t offset)
{
if (db->GetTypeIndex() == SQL_TYPE_POSTGRESQL) {
db->FillQuery(query, BareosDb::SQL_QUERY_bvfs_list_files, JobId, PathId,
db->FillQuery(query, BareosDb::SQL_QUERY::bvfs_list_files, JobId, PathId,
JobId, PathId, filter, limit, offset);
} else {
db->FillQuery(query, BareosDb::SQL_QUERY_bvfs_list_files, JobId, PathId,
db->FillQuery(query, BareosDb::SQL_QUERY::bvfs_list_files, JobId, PathId,
JobId, PathId, limit, offset, filter, JobId, JobId);
}
}
Expand All @@ -701,7 +701,7 @@ bool Bvfs::ls_files()

edit_uint64(pwd_id, pathid);
if (*pattern) {
db->FillQuery(filter, BareosDb::SQL_QUERY_match_query2, pattern);
db->FillQuery(filter, BareosDb::SQL_QUERY::match_query2, pattern);
}

build_ls_files_query(jcr, db, query, jobids, pathid, filter.c_str(), limit,
Expand Down Expand Up @@ -764,7 +764,7 @@ void Bvfs::clear_cache()
* as MySQL queries do only support single SQL statements,
* not multiple.
*/
// db->SqlQuery(BareosDb::SQL_QUERY_bvfs_clear_cache_0);
// db->SqlQuery(BareosDb::SQL_QUERY::bvfs_clear_cache_0);
db->StartTransaction(jcr);
db->SqlQuery("UPDATE Job SET HasCache=0");
if (db->GetTypeIndex() == SQL_TYPE_SQLITE3) {
Expand Down Expand Up @@ -928,7 +928,7 @@ bool Bvfs::compute_restore_list(char* fileid,
goto bail_out;
}

db->FillQuery(query, BareosDb::SQL_QUERY_bvfs_select, output_table,
db->FillQuery(query, BareosDb::SQL_QUERY::bvfs_select, output_table,
output_table, output_table);

/* TODO: handle jobid filter */
Expand Down
30 changes: 15 additions & 15 deletions core/src/cats/cats.h
Expand Up @@ -3,7 +3,7 @@
Copyright (C) 2000-2012 Free Software Foundation Europe e.V.
Copyright (C) 2011-2016 Planets Communications B.V.
Copyright (C) 2013-2018 Bareos GmbH & Co. KG
Copyright (C) 2013-2019 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
Expand Down Expand Up @@ -40,7 +40,7 @@

class dlist;

/* import automatically generated SQL_QUERY_ENUM */
/* import automatically generated SQL_QUERY */
#include "bdb_query_enum_class.h"

/* ==============================================================
Expand Down Expand Up @@ -402,9 +402,9 @@ struct ClientDbRecord {
*/
struct CounterDbRecord {
char Counter[MAX_NAME_LENGTH]{0};
int32_t MinValue = 0;
int32_t MaxValue = 0;
int32_t CurrentValue = 0;
int32_t MinValue{0};
int32_t MaxValue{0};
int32_t CurrentValue{0};
char WrapCounter[MAX_NAME_LENGTH]{0};
};

Expand Down Expand Up @@ -648,10 +648,10 @@ class BareosDb : public BareosDbQueryEnum {
pathid_cache& ppathid_cache,
JobId_t JobId);
void FillQueryVaList(POOLMEM*& query,
BareosDb::SQL_QUERY_ENUM predefined_query,
BareosDb::SQL_QUERY predefined_query,
va_list arg_ptr);
void FillQueryVaList(PoolMem& query,
BareosDb::SQL_QUERY_ENUM predefined_query,
BareosDb::SQL_QUERY predefined_query,
va_list arg_ptr);

public:
Expand Down Expand Up @@ -922,7 +922,7 @@ class BareosDb : public BareosDbQueryEnum {
e_list_type type,
bool verbose);
bool ListSqlQuery(JobControlRecord* jcr,
SQL_QUERY_ENUM query,
SQL_QUERY query,
OutputFormatter* sendit,
e_list_type type,
bool verbose);
Expand All @@ -933,7 +933,7 @@ class BareosDb : public BareosDbQueryEnum {
const char* description,
bool verbose = false);
bool ListSqlQuery(JobControlRecord* jcr,
SQL_QUERY_ENUM query,
SQL_QUERY query,
OutputFormatter* sendit,
e_list_type type,
const char* description,
Expand All @@ -952,14 +952,14 @@ class BareosDb : public BareosDbQueryEnum {
OutputFormatter* sendit);

/* SqlQuery.c */
const char* get_predefined_query_name(SQL_QUERY_ENUM query);
const char* get_predefined_query(SQL_QUERY_ENUM query);
const char* get_predefined_query_name(SQL_QUERY query);
const char* get_predefined_query(SQL_QUERY query);

void FillQuery(SQL_QUERY_ENUM predefined_query, ...);
void FillQuery(POOLMEM*& query, SQL_QUERY_ENUM predefined_query, ...);
void FillQuery(PoolMem& query, SQL_QUERY_ENUM predefined_query, ...);
void FillQuery(SQL_QUERY predefined_query, ...);
void FillQuery(POOLMEM*& query, SQL_QUERY predefined_query, ...);
void FillQuery(PoolMem& query, SQL_QUERY predefined_query, ...);

bool SqlQuery(SQL_QUERY_ENUM query, ...);
bool SqlQuery(SQL_QUERY query, ...);
bool SqlQuery(const char* query, int flags = 0);
bool SqlQuery(const char* query, DB_RESULT_HANDLER* ResultHandler, void* ctx);

Expand Down

0 comments on commit ce6a9e0

Please sign in to comment.