libtt: Coverity fixes related to uninitialised fields in classes.

This commit is contained in:
Peter Howkins
2018-04-18 01:28:03 +01:00
parent caef8edac0
commit 02d43dabe6
30 changed files with 90 additions and 14 deletions

View File

@@ -75,6 +75,7 @@ copier( char *arg0 )
_preserve = FALSE;
_clonedir_mode = FALSE;
_tt_opened = FALSE;
_to_path_is_dir = 0;
}
copier::

View File

@@ -83,6 +83,7 @@ mover( char *arg0 )
_should_mv = TRUE;
_force = FALSE;
_tt_opened = FALSE;
_to_path_is_dir = FALSE;
}
mover::

View File

@@ -1857,7 +1857,7 @@ printf("DEBUG: SERVER: _tt_file_netfile_1: _tt_file_netfile(%s) returned %s\n",
if (_tt_pointer_error(canonical_path) != TT_OK) {
results.results = TT_DB_ERR_ILLEGAL_FILE;
results.result_string = '\0';
results.result_string = NULL;
} else {
results.results = TT_DB_OK;
results.result_string = canonical_path;
@@ -1897,7 +1897,7 @@ printf("DEBUG: SERVER: _tt_netfile_file_1: _tt_netfile_file(%s) returned %s\n",
if (_tt_pointer_error(canonical_path) != TT_OK) {
results.results = TT_DB_ERR_ILLEGAL_FILE;
results.result_string = '\0';
results.result_string = NULL;
} else {
results.results = TT_DB_OK;
results.result_string = canonical_path;

View File

@@ -56,7 +56,7 @@
class _Tt_oid_access : public _Tt_object {
public:
_Tt_oid_access() {}
_Tt_oid_access() { _user = 0; _group = 0; _mode = 0; }
_Tt_oid_access(const char *key, uid_t user, gid_t group, mode_t mode);
_Tt_oid_access(char *ku);
~_Tt_oid_access();
@@ -126,7 +126,7 @@ declare_ptr_to(_Tt_oid_access_queue)
class _Tt_link_access : public _Tt_object {
public:
_Tt_link_access() {}
_Tt_link_access() { _user = 0; _group = 0; _mode = 0; }
_Tt_link_access(const char *key, uid_t user, gid_t group, mode_t mode);
_Tt_link_access(char *ku);
~_Tt_link_access();

View File

@@ -44,7 +44,7 @@
class _Tt_db_message_info : public _Tt_object {
public:
_Tt_db_message_info () {}
_Tt_db_message_info () { messageID = 0; numParts = 0; messageSize = 0; }
~_Tt_db_message_info () {}
int messageID;

View File

@@ -52,6 +52,9 @@ _Tt_isam_file::_Tt_isam_file (const _Tt_string &file, int mode)
else {
getStatusInfo();
}
maxRecordLength = 0;
minRecordLength = 0;
}
_Tt_isam_file
@@ -82,7 +85,7 @@ _Tt_isam_file
currentRecordLength = -1;
currentRecordNumber = -1;
}
maxRecordLength = 0;
minRecordLength = 0;
}

View File

@@ -45,7 +45,8 @@ typedef int (*FatalErrorHandlerFunction) (char *);
class _Tt_isam_file : public _Tt_object {
public:
// Dummy constructor needed to make _tt_isam_file_utils.cc happy
_Tt_isam_file () {}
_Tt_isam_file () { currentRecordLength = 0; currentRecordNumber = 0; eraseFlag = 0; errorStatus = 0;
fileDescriptor = 0; fileMode = 0; maxRecordLength = 0; minRecordLength = 0; newFlag = 0; }
// Real constructors
_Tt_isam_file (const _Tt_string &file, int mode);

View File

@@ -40,6 +40,12 @@ _Tt_isam_key_descriptor::_Tt_isam_key_descriptor ()
{
keyDescriptor.k_flags = 0;
keyDescriptor.k_nparts = 0;
for(int i = 0; i < NPARTS; i++) {
keyDescriptor.k_part[i].kp_start = -1;
keyDescriptor.k_part[i].kp_leng = -1;
keyDescriptor.k_part[i].kp_type = -1;
}
}
_Tt_isam_key_descriptor::~_Tt_isam_key_descriptor ()

View File

@@ -43,7 +43,7 @@
class _Tt_isam_record : public _Tt_object {
public:
// Dummy constructor needed to make tt_isam_record_utils.cc happy
_Tt_isam_record () {}
_Tt_isam_record () { currentLength = 0; maxLength = 0; minLength = 0; }
// Real constructor
_Tt_isam_record (const _Tt_isam_key_descriptor_list_ptr &key_descriptor_list,

View File

@@ -53,6 +53,9 @@ _Tt_trace_optobj::_Tt_trace_optobj()
_has_session = 2; // 1 -> -S option, 2 -> set by default
_has_command = 0;
_form = NO_FORM;
for(int i = 0; i < MAXARGS; i++) {
_cargv[i] = NULL;
}
}
int