1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

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; _preserve = FALSE;
_clonedir_mode = FALSE; _clonedir_mode = FALSE;
_tt_opened = FALSE; _tt_opened = FALSE;
_to_path_is_dir = 0;
} }
copier:: copier::

View file

@ -83,6 +83,7 @@ mover( char *arg0 )
_should_mv = TRUE; _should_mv = TRUE;
_force = FALSE; _force = FALSE;
_tt_opened = FALSE; _tt_opened = FALSE;
_to_path_is_dir = FALSE;
} }
mover:: 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) { if (_tt_pointer_error(canonical_path) != TT_OK) {
results.results = TT_DB_ERR_ILLEGAL_FILE; results.results = TT_DB_ERR_ILLEGAL_FILE;
results.result_string = '\0'; results.result_string = NULL;
} else { } else {
results.results = TT_DB_OK; results.results = TT_DB_OK;
results.result_string = canonical_path; 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) { if (_tt_pointer_error(canonical_path) != TT_OK) {
results.results = TT_DB_ERR_ILLEGAL_FILE; results.results = TT_DB_ERR_ILLEGAL_FILE;
results.result_string = '\0'; results.result_string = NULL;
} else { } else {
results.results = TT_DB_OK; results.results = TT_DB_OK;
results.result_string = canonical_path; results.result_string = canonical_path;

View file

@ -56,7 +56,7 @@
class _Tt_oid_access : public _Tt_object { class _Tt_oid_access : public _Tt_object {
public: 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(const char *key, uid_t user, gid_t group, mode_t mode);
_Tt_oid_access(char *ku); _Tt_oid_access(char *ku);
~_Tt_oid_access(); ~_Tt_oid_access();
@ -126,7 +126,7 @@ declare_ptr_to(_Tt_oid_access_queue)
class _Tt_link_access : public _Tt_object { class _Tt_link_access : public _Tt_object {
public: 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(const char *key, uid_t user, gid_t group, mode_t mode);
_Tt_link_access(char *ku); _Tt_link_access(char *ku);
~_Tt_link_access(); ~_Tt_link_access();

View file

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

View file

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

View file

@ -45,7 +45,8 @@ typedef int (*FatalErrorHandlerFunction) (char *);
class _Tt_isam_file : public _Tt_object { class _Tt_isam_file : public _Tt_object {
public: public:
// Dummy constructor needed to make _tt_isam_file_utils.cc happy // 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 // Real constructors
_Tt_isam_file (const _Tt_string &file, int mode); _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_flags = 0;
keyDescriptor.k_nparts = 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 () _Tt_isam_key_descriptor::~_Tt_isam_key_descriptor ()

View file

@ -43,7 +43,7 @@
class _Tt_isam_record : public _Tt_object { class _Tt_isam_record : public _Tt_object {
public: public:
// Dummy constructor needed to make tt_isam_record_utils.cc happy // 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 // Real constructor
_Tt_isam_record (const _Tt_isam_key_descriptor_list_ptr &key_descriptor_list, _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_session = 2; // 1 -> -S option, 2 -> set by default
_has_command = 0; _has_command = 0;
_form = NO_FORM; _form = NO_FORM;
for(int i = 0; i < MAXARGS; i++) {
_cargv[i] = NULL;
}
} }
int int

View file

@ -45,7 +45,7 @@ declare_ptr_to(_Tt_api_stg_stack)
class _Tt_api_stg_stack_elm : public _Tt_object { class _Tt_api_stg_stack_elm : public _Tt_object {
public: public:
_Tt_api_stg_stack_elm() {}; _Tt_api_stg_stack_elm() { addr = NULL; };
~_Tt_api_stg_stack_elm(); ~_Tt_api_stg_stack_elm();
enum {STACK_MARK, STACK_STORAGE} entry_type; enum {STACK_MARK, STACK_STORAGE} entry_type;
caddr_t addr; caddr_t addr;

View file

@ -44,6 +44,7 @@ _Tt_typecb::
_Tt_typecb() _Tt_typecb()
{ {
clientdata = 0; clientdata = 0;
_opnum = 0;
} }
_Tt_typecb:: _Tt_typecb::

View file

@ -89,6 +89,8 @@ _Tt_client_isam_file
currentRecordLength = -1; currentRecordLength = -1;
currentRecordNumber = -1; currentRecordNumber = -1;
} }
maxRecordLength = 0;
minRecordLength = 0;
} }
void _Tt_client_isam_file::setTtISAMFileDefaults () void _Tt_client_isam_file::setTtISAMFileDefaults ()

View file

@ -44,7 +44,8 @@
class _Tt_client_isam_file : public _Tt_object { class _Tt_client_isam_file : public _Tt_object {
public: public:
// Dummy constructor needed to make _tt_client_isam_file_utils.cc happy // Dummy constructor needed to make _tt_client_isam_file_utils.cc happy
_Tt_client_isam_file () {} _Tt_client_isam_file () { currentRecordLength = 0; currentRecordNumber = 0; eraseFlag = 0; errorStatus = 0;
fileDescriptor = 0; fileMode = 0; maxRecordLength = 0; minRecordLength = 0; newFlag = 0; }
// Real constructors // Real constructors
_Tt_client_isam_file (const _Tt_string &file, _Tt_client_isam_file (const _Tt_string &file,

View file

@ -84,6 +84,13 @@ _Tt_db_client::_Tt_db_client()
setTtDBDefaults(); setTtDBDefaults();
connectToDB(db_hostname); connectToDB(db_hostname);
iserrno = 0;
isrecnum = 0;
isreclen = 0;
#if !defined(OPT_TLI)
dbSocket.sin_family = 0;
dbSocket.sin_port = 0;
#endif
} }
_Tt_db_client::_Tt_db_client (_Tt_db_results & status) _Tt_db_client::_Tt_db_client (_Tt_db_results & status)

View file

@ -63,6 +63,11 @@ _Tt_db_file::_Tt_db_file (const _Tt_string &file)
_Tt_db_access_ptr access; _Tt_db_access_ptr access;
dbResults = setTtDBFileDefaults(file, properties, access); dbResults = setTtDBFileDefaults(file, properties, access);
} }
checkedDatabase = FALSE;
directoryFlag = FALSE;
dbFileObjectsCacheLevel = -1;
dbFilePropertiesCacheLevel = -1;
} }
_Tt_db_file::_Tt_db_file (const _Tt_string &file, _Tt_db_file::_Tt_db_file (const _Tt_string &file,
@ -75,6 +80,11 @@ _Tt_db_file::_Tt_db_file (const _Tt_string &file,
else { else {
dbResults = setTtDBFileDefaults(file, properties, access); dbResults = setTtDBFileDefaults(file, properties, access);
} }
checkedDatabase = 0;
directoryFlag = 0;
dbFileObjectsCacheLevel = -1;
dbFilePropertiesCacheLevel = -1;
} }
_Tt_db_results _Tt_db_results

View file

@ -50,7 +50,9 @@
_Tt_old_db:: _Tt_old_db::
_Tt_old_db() _Tt_old_db()
{ {
} propertyTableFD = 0;
dbResults = NULL;
}
_Tt_old_db::_Tt_old_db (const _Tt_string &partition, _Tt_old_db::_Tt_old_db (const _Tt_string &partition,
const _Tt_db_client_ptr &db_conn) const _Tt_db_client_ptr &db_conn)

View file

@ -37,6 +37,9 @@
_Tt_old_db_message_info:: _Tt_old_db_message_info::
_Tt_old_db_message_info () _Tt_old_db_message_info ()
{ {
messageID = 0;
numParts = 0;
messageSize = 0;
} }
_Tt_old_db_message_info:: _Tt_old_db_message_info::

View file

@ -49,6 +49,11 @@ _Tt_qmsg_info::_Tt_qmsg_info()
categories = new _Tt_int_rec_list; categories = new _Tt_int_rec_list;
ptypes = new _Tt_string_list; ptypes = new _Tt_string_list;
version = TT_QMSG_INFO_VERSION; version = TT_QMSG_INFO_VERSION;
id = 0;
nparts = 0;
size = 0;
m_id = 0;
} }
_Tt_qmsg_info::~_Tt_qmsg_info() _Tt_qmsg_info::~_Tt_qmsg_info()

View file

@ -88,6 +88,12 @@ _Tt_rpc_client(int conn_socket)
{ {
_socket = conn_socket; _socket = conn_socket;
_client = (CLIENT *)0; _client = (CLIENT *)0;
_program = 0;
_version = 0;
_server_uid = 0;
_clnt_stat = NULL;
_server_addr.sin_family = 0;
_server_addr.sin_port = 0;
} }

View file

@ -66,6 +66,10 @@ _Tt_session()
_is_server = 0; // default server mode _is_server = 0; // default server mode
_is_dead = 0; _is_dead = 0;
_rpc_version = 0; _rpc_version = 0;
_pid = 0;
_rpc_program = 0;
_server_num = 0;
_server_uid = 0;
} }

View file

@ -83,6 +83,11 @@ char *t_strerror(int t_errno)
_Tt_stream_socket:: _Tt_stream_socket::
_Tt_stream_socket() _Tt_stream_socket()
{ {
_is_source = 0;
_msgsock = -1;
_sock = -1;
_hostaddr.sin_port = 0;
_hostaddr.sin_family = 0;
} }
_Tt_stream_socket:: _Tt_stream_socket::
@ -94,6 +99,8 @@ _Tt_stream_socket(_Tt_host_ptr &host, int portnum)
_hostaddr.sin_addr.s_addr = htonl(INADDR_ANY); _hostaddr.sin_addr.s_addr = htonl(INADDR_ANY);
_hostaddr.sin_port = htons(portnum); _hostaddr.sin_port = htons(portnum);
_hostaddr.sin_family = AF_INET; _hostaddr.sin_family = AF_INET;
_is_source = 0;
_sock = -1;
} }

View file

@ -42,6 +42,8 @@ implement_list_of(_Tt_file_system_entry)
_Tt_file_system_entry:: _Tt_file_system_entry::
_Tt_file_system_entry () _Tt_file_system_entry ()
{ {
localFlag = 0;
loopBackFlag = 0;
} }
_Tt_file_system_entry:: _Tt_file_system_entry::

View file

@ -53,6 +53,7 @@ _Tt_hostname_cache::
_Tt_hostname_cache() _Tt_hostname_cache()
{ {
hostname = (_Tt_string) 0; hostname = (_Tt_string) 0;
addr_length = 0;
} }
_Tt_hostname_cache:: _Tt_hostname_cache::

View file

@ -76,6 +76,7 @@ implement_list_of(_Tt_int_rec)
_Tt_pid_t_rec:: _Tt_pid_t_rec::
_Tt_pid_t_rec() _Tt_pid_t_rec()
{ {
val = 0;
} }

View file

@ -48,6 +48,9 @@ _Tt_observer()
_ptid = (char *)0; _ptid = (char *)0;
_reliability = TT_DISCARD; _reliability = TT_DISCARD;
_opnum = -1; _opnum = -1;
_scope = NULL;
_state = TT_STATE_LAST; // BUG This class member is not set anywhere, but a getter function exists
} }
@ -59,7 +62,7 @@ _Tt_observer(_Tt_string ptid, int opnum,
_reliability = reliability; _reliability = reliability;
_opnum = opnum; _opnum = opnum;
_scope = s; _scope = s;
_state = TT_STATE_LAST; // BUG This class member is not set anywhere, but a getter function exists _state = TT_STATE_LAST; // BUG This class member is not set anywhere, but a getter function exists
} }

View file

@ -43,7 +43,7 @@
class _Tt_rpc_server : public _Tt_object { class _Tt_rpc_server : public _Tt_object {
public: public:
_Tt_rpc_server() {}; _Tt_rpc_server() { _version = 0; _socket = 0; _program = 0; _rpc_fd = 0; _transp = NULL; };
_Tt_rpc_server(int program, int version, int Rsocket, _Tt_auth &auth); _Tt_rpc_server(int program, int version, int Rsocket, _Tt_auth &auth);
virtual ~_Tt_rpc_server(); virtual ~_Tt_rpc_server();
int init(void (*service_fn)(svc_req *, SVCXPRT *)); int init(void (*service_fn)(svc_req *, SVCXPRT *));

View file

@ -160,6 +160,7 @@ _Tt_s_message(_Tt_s_message *m, _Tt_observer_ptr &o)
_rsessions = m->_rsessions; _rsessions = m->_rsessions;
_when_last_matched = m->_when_last_matched; _when_last_matched = m->_when_last_matched;
_original = m; _original = m;
_num_recipients_yet_to_vote = 0;
} }
// //

View file

@ -94,6 +94,11 @@ _Tt_s_mp() : _Tt_mp()
when_last_observer_registered = 1; when_last_observer_registered = 1;
update_args.message = new _Tt_s_message(); update_args.message = new _Tt_s_message();
_self = (_Tt_s_procid *)new _Tt_self_procid(); _self = (_Tt_s_procid *)new _Tt_self_procid();
map_ptypes = 0;
unix_cred_chk_flag = 0;
garbage_collector_pid = 0;
_next_garbage_run = 0;
} }

View file

@ -66,7 +66,7 @@ _Tt_s_procid(const _Tt_s_procid_ptr &p)
_proc_host_ipaddr = p->_proc_host_ipaddr; _proc_host_ipaddr = p->_proc_host_ipaddr;
_pid = p->_pid; _pid = p->_pid;
_id = p->_id; _id = p->_id;
_itimeout = -1;
} }
_Tt_s_procid:: _Tt_s_procid::