- Const strings referenced by non-const variables.
- Incorrect format specifers for printing addresses
- Unused variables
- Signed comparison to unsigned
Also fix an incorrect enumeration value in a switch statement.
}
Tt_status
-_ttds_file_server(const char *filename, char **hostname)
+_ttds_file_server(const char *filename, const char **hostname)
{
_Tt_c_file_ptr file;
_Tt_db_results dbresults;
print(FILE *f) const
{
- (void)fprintf(f,"_Tt_api_stg_stack_elm at %lx <",this);
+ (void)fprintf(f,"_Tt_api_stg_stack_elm at %p <",this);
switch (entry_type) {
case STACK_MARK:
- (void)fprintf(f,"mark %ld>\n",addr);
+ (void)fprintf(f,"mark %p>\n",addr);
break;
case STACK_STORAGE:
- (void)fprintf(f,"addr 0x%lx>\n",(long)addr);
+ (void)fprintf(f,"addr 0x%p>\n",addr);
break;
}
}
{
int mark = tt_mark();
const char *t, **vt;
- int validtypecount, i;
if (tt_ptr_error(tt_open())>TT_WRN_LAST) {
Tt_message m;
Tt_pattern p;
{
- int xid;
int chunknumber;
int maxchunk;
char *type;
struct _Tt_prop {
struct {
u_int propname_len;
- char *propname_val;
+ const char *propname_val;
} propname;
long recnum;
struct {
#include "db/tt_db_client_utils.h"
-extern int *_tt_min_auth_level_1(char**, CLIENT*, clnt_stat *status);
+extern int *_tt_min_auth_level_1(const char**, CLIENT*, clnt_stat *status);
extern _Tt_isam_results *_tt_isaddindex_1(_Tt_isaddindex_args*, CLIENT*);
extern _Tt_isam_results *_tt_isbuild_1(_Tt_isbuild_args*, CLIENT*);
extern _Tt_isam_results *_tt_isclose_1(int*, CLIENT*);
{
static _tt_get_all_sessions_results res;
- clnt_stat result = clnt_call(clnt, TT_GET_ALL_SESSIONS,
+ clnt_call(clnt, TT_GET_ALL_SESSIONS,
(xdrproc_t) xdr_tt_get_all_sessions_args,
(caddr_t) argp,
(xdrproc_t) xdr_tt_get_all_sessions_results,
{
static _tt_garbage_collect_results res;
- clnt_stat result = clnt_call(clnt, TT_GARBAGE_COLLECT,
+ clnt_call(clnt, TT_GARBAGE_COLLECT,
(xdrproc_t) xdr_void, (caddr_t) NULL,
(xdrproc_t) xdr_tt_garbage_collect_results,
(caddr_t) &res,
{
static _tt_delete_session_results res;
- clnt_stat result = clnt_call(clnt, TT_DELETE_SESSION,
+ clnt_call(clnt, TT_DELETE_SESSION,
(xdrproc_t) xdr_tt_delete_session_args,
(caddr_t) args,
(xdrproc_t) xdr_tt_delete_session_results,
_tt_get_rpc_strings(args->ptypes, message_info->ptypes);
// Get the XDR size of the new message info structure
- u_int length;
+ u_int length = 0;
if (!message_info->xdr((XDR *)xdrsz)) {
results = TT_DB_ERR_ILLEGAL_MESSAGE;
}
// If dbVersion == 1, then we are talking to an old DB server
static _tt_auth_level_results results;
- char *path = "";
+ const char *path = "";
clnt_stat rpc_status;
int *result = (int *)NULL;
result = _tt_min_auth_level_1(&path, dbServer, &rpc_status);
const _Tt_string_list_ptr &ptypes,
_Tt_message_list_ptr &messages)
{
- _Tt_db_results retval;
_tt_dequeue_msgs_args args;
args.file = (char *)file;
}
_tt_get_rpc_messages(results->messages, messages);
- retval = results->results;
if (dbVersion==1) {
_tt_free_rpc_messages(results->messages);
} else {
_Tt_string hostname;
_Tt_string partition;
- _Tt_db_results results = _tt_db_network_path(file,
+ _tt_db_network_path(file,
local_path,
hostname,
partition,
_Tt_db_key::_Tt_db_key (short version_number)
{
- static long last_time_sec = 0;
+ static unsigned int last_time_sec = 0;
static long counter = 0;
key.version = version_number;
if (rpc_messages.messages_len) {
messages = new _Tt_message_list;
- for (int i=0; i < rpc_messages.messages_len; i++) {
+ for (unsigned int i=0; i < rpc_messages.messages_len; i++) {
_Tt_message_ptr message_ptr;
_tt_get_rpc_message(rpc_messages.messages_val [i],
void _tt_free_rpc_messages (const _tt_message_list &rpc_messages)
{
if (rpc_messages.messages_val) {
- for (int i=0; i < rpc_messages.messages_len; i++) {
+ for (unsigned int i=0; i < rpc_messages.messages_len; i++) {
_tt_free_rpc_message(rpc_messages.messages_val [i]);
}
void _tt_free_rpc_strings (const _tt_string_list &rpc_strings)
{
if (rpc_strings.values_val) {
- for (int i=0; i < rpc_strings.values_len; i++) {
+ for (unsigned int i=0; i < rpc_strings.values_len; i++) {
if (rpc_strings.values_val [i].value) {
free(rpc_strings.values_val [i].value);
}
}
if (rpc_prop.values.values_val) {
- for (int i=0; i < rpc_prop.values.values_len; i++) {
+ for (unsigned int i=0; i < rpc_prop.values.values_len; i++) {
if (rpc_prop.values.values_val [i].value.value_val) {
free(rpc_prop.values.values_val [i].value.value_val);
}
void _tt_free_rpc_properties (const _tt_property_list &rpc_props)
{
if (rpc_props.properties_val) {
- for (int i=0; i < rpc_props.properties_len; i++) {
+ for (unsigned int i=0; i < rpc_props.properties_len; i++) {
_tt_free_rpc_property(rpc_props.properties_val [i]);
}
strings = new _Tt_string_list;
if (rpc_strings.values_len) {
- for (int i=0; i < rpc_strings.values_len; i++) {
+ for (unsigned int i=0; i < rpc_strings.values_len; i++) {
(void)strings->append(_Tt_string(rpc_strings.values_val [i].value));
}
}
if (rpc_prop.name) {
prop->name = rpc_prop.name;
- for (int i=0; i < rpc_prop.values.values_len; i++) {
+ for (unsigned int i=0; i < rpc_prop.values.values_len; i++) {
int prop_value_length = rpc_prop.values.values_val [i].value.value_len;
if (prop_value_length) {
_Tt_string prop_value(prop_value_length);
props = new _Tt_db_property_list;
if (rpc_props.properties_len) {
- for (int i=0; i < rpc_props.properties_len; i++) {
+ for (unsigned int i=0; i < rpc_props.properties_len; i++) {
_Tt_db_property_ptr prop;
_tt_get_rpc_property (rpc_props.properties_val [i], prop);
Tt_status _Tt_auth::
generate_auth_cookie()
{
- static char *funcname = "_Tt_auth::make_auth_cookie()";
+ static const char *funcname = "_Tt_auth::make_auth_cookie()";
_tt_AuthFileEntry *entry;
int exists;
char *filename;
_TT_ICEAUTH_DEFAULT_RETRIES,
_TT_ICEAUTH_DEFAULT_TIMEOUT,
_TT_ICEAUTH_DEFAULT_DEADTIME))) {
- char *reason = "unknown error";
+ const char *reason = "unknown error";
_tt_UnlockAuthFile(filename);
if (retval == _tt_AuthLockTimeout) {
Tt_status _Tt_auth::
read_auth_entries(FILE *fp, _tt_AuthFileEntryList **headp)
{
- static char *funcname = "_Tt_auth::read_auth_entries()";
+ static const char *funcname = "_Tt_auth::read_auth_entries()";
_tt_AuthFileEntry *entry;
_tt_AuthFileEntryList *head;
_tt_AuthFileEntryList *el_new;
Tt_status _Tt_auth::
read_auth_file(char *filename)
{
- static char *funcname = "Tt_auth::read_auth_file()";
+ static const char *funcname = "Tt_auth::read_auth_file()";
FILE *authfp;
Tt_status status = TT_OK;
Tt_status _Tt_auth::
modify_auth_entry(_tt_AuthFileEntry *entry, _tt_AuthFileEntryList **headp)
{
- static char *funcname = "Tt_auth::modify_auth_entry()";
+ static const char *funcname = "Tt_auth::modify_auth_entry()";
_tt_AuthFileEntryList *list, *prev, *el_new;
for (prev=NULL, list=*headp; list; list=list->next) {
Tt_status _Tt_auth::
write_auth_file(char *filename)
{
- static char *funcname = "Tt_auth::write_auth_file()";
- static char *suffix = "-n";
+ static const char *funcname = "Tt_auth::write_auth_file()";
+ static const char *suffix = "-n";
FILE *fp;
_tt_AuthFileEntryList *list;
char *tmpnam;
_tt_AuthFileEntry *entry = NULL;
entry = _tt_GetAuthFileEntry(_TT_ICEAUTH_PROTOCOL_NAME,
- (char*) _sessionid,
+ _sessionid,
_TT_ICEAUTH_AUTH_NAME);
if (NULL == entry)
return TT_AUTHFILE_ENTRY_MISSING;
\f
_tt_AuthFileEntry *
-_tt_GetAuthFileEntry(char *protocol_name, char *network_id, char *auth_name)
+_tt_GetAuthFileEntry(const char *protocol_name, const char *network_id, const char *auth_name)
{
FILE *auth_file;
char *filename;
);
extern _tt_AuthFileEntry *_tt_GetAuthFileEntry (
- char * /* protocol_name */,
- char * /* network_id */,
- char * /* auth_name */
+ const char * /* protocol_name */,
+ const char * /* network_id */,
+ const char * /* auth_name */
);
extern char *_tt_GenerateMagicCookie (
Tt_status _Tt_c_procid::
init()
{
- int rpc_version = TT_RPC_VERSION;
Tt_status status;
if (_default_session.is_null()) {
{
_Tt_string start_ttcmd;
int tried = 0;
- int done = 0;
Tt_status status;
if (env() == _TT_ENV_X11) {
)
{
_Tt_string abspath;
- Tt_status status = TT_OK;
int __scopes = scopes();
if ((__scopes&(1<<TT_FILE)) || (__scopes&(1<<TT_BOTH))) {
uid_t servuid, _Tt_auth &auth)
{
int optval;
- static caddr_t saved_opaque = 0;
- static int saved_len = 0;
optval = (_socket == RPC_ANYSOCK);
_auth = auth;
char *categoryName, *variable, *value;
int category, i;
struct utsname names;
+#if defined(OPT_SYSINFO)
char buf[ SYS_NMLN ];
+#endif
case TTDT_SET_LOCALE:
return _ttDtGetLocaleCB( msg, pat, (void *)_ttDtApplyLocale, 0 );
case TTDT_GET_LOCALE:
if (_items == 0) {
_max = 0;
}
- for (int i = 0; i < _max; i++) {
+ for (unsigned int i = 0; i < _max; i++) {
_items[ i ] = new _TttkItem2Free();
if (_items[ i ] == 0) {
_destruct();
void
_TttkList2Free::flush()
{
- for (int i = 0; i < _num; i++) {
+ for (unsigned int i = 0; i < _num; i++) {
_item( i ) = (caddr_t)0;
}
}
#ifdef OPT_VECNEW
delete [] _items;
#else
- for (int i = 0; i < _max; i++) {
+ for (unsigned int i = 0; i < _max; i++) {
if (_items[ i ] != 0) {
delete _items[ i ];
_items[ i ] = 0;
// loop iteration. All this in the name of coding efficiency.
//
Tt_status _Tt_audit::
-entry(char *argskey, _Tt_entry_pt func, ...)
+entry(const char *argskey, _Tt_entry_pt func, ...)
{
va_list ap;
- char c, *preview, *cp;
+ char c, *cp;
+ const char *preview;
int num_args = strlen(argskey);
Tt_message m;
_Tt_c_message_ptr msg;
class _Tt_audit: public _Tt_trace {
public:
- Tt_status entry(char *argskey, _Tt_entry_pt func, ...);
+ Tt_status entry(const char *argskey, _Tt_entry_pt func, ...);
};
#endif /* TT_AUDIT_H */
_tt_enumname(Tt_feature x) {
switch (x) {
TTC(TT_FEATURE_MULTITHREADED);
- case TT_STATE_LAST:
+ case _TT_FEATURE_LAST:
default:
return "! Tt_feature";
}
ip_address = &ip_address_buf;
*ip_address = inet_addr((char *)addr);
- if (*ip_address == -1) {
+ if (*ip_address == INADDR_NONE) {
return(0);
}
_Tt_hostname_cache_ptr sh, lh;
struct hostent *host_ret;
_Xgethostbynameparams host_buf;
- int failed = 0;
char **h_addr_list;
(*_pstream)->set_is_entered(0);
}
- const char *s;
+ const char *s = 0;
int printmsg = 1;
//
// We do not print msg if it is a (often incomplete) update
//
void
_Tt_trace::entry(
- char *argskey,
+ const char *argskey,
_Tt_entry_pt func,
va_list ap
)
(*_pstream)->set_is_entered(0);
}
- char c, *preview;
+ char c;
+ const char *preview;
int num_args = strlen(argskey);
// print the API name and open paren
// API tracing entry call
void entry(
- char *argskey,
+ const char *argskey,
_Tt_entry_pt func,
va_list ap
);
os << _tt_enumname( msg.message_class() );
os << " <" << msg.api_id() << "> ";
os << _tt_enumname( msg.state() );
- char *conjunction = " because ";
+ const char *conjunction = " because ";
switch (msg.state()) {
case TT_CREATED:
case TT_SENT:
_Tt_xdr_size_stream::
_Tt_xdr_size_stream() {
- memset ((char *)&ops, 0, sizeof ops);
+ memset (&ops, 0, sizeof ops);
#if defined(OPT_BUG_SUNOS_4) || defined(OPT_BUG_HPUX)
ops.x_putlong = (int (*)(...))tt_x_putlong;
ops.x_putbytes = (int (*)(...))tt_x_putbytes;