libDtSvc: Resolve 89 compiler warnings.

This commit is contained in:
Peter Howkins
2012-09-01 21:35:10 +01:00
parent 92743e0999
commit e9bb2bcf09
24 changed files with 84 additions and 83 deletions

View File

@@ -119,7 +119,7 @@ XeFindShortHost(XeString host_spec)
if (ptr2 && strequal(ptr, ptr2)) { /* domains same, can eliminate */
host = Xe_make_ntype(ptr-host_spec+1, XeChar);
strncpy(host, host_spec, ptr-host_spec); /* copy only up to "." */
host[ptr-host_spec] = NULL; /* NULL terminate copy */
host[ptr-host_spec] = '\0'; /* NULL terminate copy */
}
else
host = strdup(host_spec);
@@ -311,7 +311,7 @@ Xegetshorthostname(XeString buffer, unsigned int bufsize)
if (status = gethostname(buffer, bufsize))
return status; /* failed gethostname */
if (ptr = strstr(buffer, (XeString)"."))
*ptr = NULL; /* delete domain name if there is one */
*ptr = '\0'; /* delete domain name if there is one */
return 0;
}
@@ -398,7 +398,7 @@ Xegetcwd(char *buf, int size)
len = size-1;
strncpy(buf, current_dir, len);
buf[len] = NULL;
buf[len] = '\0';
/* Make sure $PWD is the same as "." before we trust it. */
/* All this is still much faster the getcwd() esp. on UX discless. */

View File

@@ -286,7 +286,7 @@ void SPC_Child_Terminated(int i)
* as done.
*/
if (SPC_pid_list != NULL) {
for (indx=0; SPC_pid_list[indx] != NULL; indx++)
for (indx=0; SPC_pid_list[indx] != 0; indx++)
if (SPC_pid_list[indx] == pid) {
SPC_pid_list[indx] = SPCD_DEAD_PROCESS;
break;
@@ -323,7 +323,7 @@ void SPC_Child_Terminated(int i)
print_protocol_request((XeString) (XeString)" <-- INTERNAL APPLICATION_DIED", prot);
}
else {
SPC_Change_State(channel, NULL, -1, 0);
SPC_Change_State(channel, 0, -1, 0);
if(channel->Terminate_Handler) {
XeSPCGetProcessStatus(channel, &type, &cause);
(* channel->Terminate_Handler)
@@ -474,7 +474,7 @@ int exec_proc_local_channel_object(SPC_Channel_Ptr channel)
* If a dead pid entry exists, reuse it; otherwise, must create
* room for the new pid.
*/
for (i = 0; SPC_pid_list[i] != NULL; i++)
for (i = 0; SPC_pid_list[i] != 0; i++)
if (SPC_pid_list[i] == SPCD_DEAD_PROCESS) {
SPC_pid_list[i] = pid;
reuse_pid = 1;
@@ -486,7 +486,7 @@ int exec_proc_local_channel_object(SPC_Channel_Ptr channel)
}
if (!reuse_pid) {
SPC_pid_list[i] = pid;
SPC_pid_list[i+1] = NULL;
SPC_pid_list[i+1] = 0;
}
_DtSvcProcessUnlock();

View File

@@ -294,7 +294,7 @@ SPC_Open_Socket(SPC_Connection_Ptr conn,
struct servent *service;
conn->sid=socket(type, SOCK_STREAM, NULL);
conn->sid=socket(type, SOCK_STREAM, 0);
if(conn->sid == ERROR) {
SPC_Error(SPC_Bad_Socket);
return(SPC_ERROR);
@@ -406,7 +406,7 @@ SPC_Connection_Ptr SPC_Standalone_Daemon(SPC_Connection_Ptr conn)
#if defined(__aix)
if (setsockopt(conn->sid, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on))==ERROR) {
#else
if (setsockopt(conn->sid, SOL_SOCKET, SO_REUSEADDR, NULL, NULL)==ERROR) {
if (setsockopt(conn->sid, SOL_SOCKET, SO_REUSEADDR, NULL, 0)==ERROR) {
#endif
SPC_Error(SPC_Bad_Reuse);
return(SPC_ERROR);

View File

@@ -71,7 +71,7 @@ object *alloc_channel_object(object_clasp c)
/*----------------------------------------------------------------------+*/
{
object *p=(object *) XeMalloc((unsigned) c->object_size);
memset(p, NULL, (int) c->object_size);
memset(p, 0, (int) c->object_size);
return(p);
}
@@ -116,7 +116,7 @@ static Wire dummy_wire={
(XeString) "/dev/null", /* Master PTY */
(XeString) "/dev/null", /* Slave PTY */
0, 0, /* Toolkit IDs */
NULL /* pointer to next wire */
0 /* pointer to next wire */
};
/*----------------------------------------------------------------------+*/
@@ -234,7 +234,7 @@ void SPC_Channel_Terminated(SPC_Channel_Ptr channel)
{
int type, cause;
SPC_Change_State(channel, NULL, -1, 0);
SPC_Change_State(channel, 0, -1, 0);
/* Set the close timeout. If we are on a PTY, we will return
after two seconds if we are waiting for EOF */
@@ -596,7 +596,7 @@ int pre_fork_channel_object(SPC_Channel_Ptr channel)
/* Move to the "Running & (possibly) data ready" state */
SPC_Change_State(channel, NULL, flag, 1);
SPC_Change_State(channel, 0, flag, 1);
return(TRUE);

View File

@@ -189,7 +189,7 @@ SPC_Connection_Ptr SPC_Alloc_Connection(void)
_DtSvcProcessLock();
conn=(SPC_Connection_Ptr) XeMalloc(sizeof(SPC_Connection));
/* Zero the connection */
memset(conn, NULL, sizeof(SPC_Connection));
memset(conn, 0, sizeof(SPC_Connection));
conn->queued_remote_data = Xe_make_queue(FALSE);
conn->termination_id = (-1);
/* Init the socket id to "-1" because "0" is a valid file descriptor. */
@@ -439,7 +439,7 @@ protocol_request_ptr SPC_Read_Protocol(SPC_Connection_Ptr connection)
if(!connection->connected)
return(SPC_ERROR);
if((prot=SPC_New_Protocol_Ptr(NULL, NULL, NULL))==SPC_ERROR) {
if((prot=SPC_New_Protocol_Ptr(NULL, 0, 0))==SPC_ERROR) {
SPC_Close_Connection(connection);
return(SPC_ERROR);
}
@@ -1159,12 +1159,12 @@ int SPC_Send_Multi_Packet(SPC_Connection_Ptr connection,
if(this_str == NULL)
this_str = NULL_STR;
if(*this_str == NULL)
if(*this_str == '\0')
this_str = EMPTY_STR;
tmp_len=strlen(this_str)+1; /* Room for NULL char */
if((bytes_left-tmp_len) < 1) {
*buf=NULL;
*buf='\0';
prot->dataptr->len=numbytes+1;
SPC_Write_Single_Prot_Request(connection, name, prot);
SPC_Free_Protocol_Ptr(prot);
@@ -1193,7 +1193,7 @@ int SPC_Send_Multi_Packet(SPC_Connection_Ptr connection,
}
if(numbytes) {
*buf=NULL;
*buf='\0';
prot->dataptr->len=numbytes+1;
SPC_Write_Single_Prot_Request(connection, (XeString)" <-- ENVIRON_RESET", prot);
SPC_Free_Protocol_Ptr(prot);
@@ -1342,7 +1342,7 @@ XeString *sscan_counted_string(XeString buf,
len=strlen(bufptr)+1; /* len is string SIZE (with room for NULL) */
*tmpidx=(XeString)XeMalloc(len);
strncpy(*tmpidx, bufptr, len);
(*tmpidx)[len-1]=NULL;
(*tmpidx)[len-1]='\0';
bufptr+= len;
}
*tmpidx=NULL;

View File

@@ -51,12 +51,12 @@ Wire *get_new_wire(void)
Wire *tmp_wire;
tmp_wire=(Wire *)XeMalloc(sizeof(Wire));
memset(tmp_wire, NULL, sizeof(Wire));
memset(tmp_wire, 0, sizeof(Wire));
tmp_wire->master_name=(XeString)XeMalloc(PTY_NAMLEN);
memset(tmp_wire->master_name, NULL, PTY_NAMLEN);
memset(tmp_wire->master_name, 0, PTY_NAMLEN);
tmp_wire->slave_name =(XeString)XeMalloc(PTY_NAMLEN);
memset(tmp_wire->slave_name, NULL, PTY_NAMLEN);
memset(tmp_wire->slave_name, 0, PTY_NAMLEN);
tmp_wire->fd[0] = tmp_wire->fd[1] = (-1);
tmp_wire->read_toolkit_id = (-1);
tmp_wire->except_toolkit_id = (-1);
@@ -114,7 +114,7 @@ spc_dup2(int from, int to)
int retval;
/* Dup file descriptors. If a null descriptor, then use /dev/null */
static int devnull = NULL;
static int devnull = 0;
if (from == to)
return(TRUE);
@@ -155,7 +155,7 @@ XeString *Alloc_Argv(int n)
av = (XeString *)XeMalloc((n + 1) * sizeof(XeString));
/* Zero the space so we don't have to worry about trailing NULL */
memset((XeString) av, NULL, (n + 1) * sizeof(XeString));
memset((XeString) av, 0, (n + 1) * sizeof(XeString));
return(av);
}
@@ -263,7 +263,7 @@ Boolean _path_search (XeString path, XeString filename, path_search_predicate p)
if(next_colon) { /* found colon */
path_component_len = next_colon-path_rest;
strncpy(buffer, path_rest, path_component_len);
buffer[path_component_len]=NULL;
buffer[path_component_len]='\0';
path_rest=next_colon+1;
if(!*path_rest)
/* We've seen a ':' at the end of the string. Make path_rest be "."
@@ -281,7 +281,7 @@ Boolean _path_search (XeString path, XeString filename, path_search_predicate p)
if(!buffer[0]) {
buffer[0] = '.';
buffer[1] = NULL;
buffer[1] = '\0';
}
/*

View File

@@ -71,7 +71,7 @@ static int SPC_AddInput(int source,
if (SPC_Fd_Mapping == NULL) {
SPC_Fd_Mapping = (SPC_Callback_Struct **)
XeMalloc (FD_SETSIZE * sizeof (SPC_Callback_Struct *));
memset(SPC_Fd_Mapping, NULL, FD_SETSIZE * sizeof(SPC_Callback_Struct *));
memset(SPC_Fd_Mapping, 0, FD_SETSIZE * sizeof(SPC_Callback_Struct *));
}
structptr=SPC_LOOKUP_FD_MAPPING(source);
@@ -112,7 +112,7 @@ static SbInputId SPC_RemoveInput(int source,
if (SPC_Fd_Mapping == NULL) {
SPC_Fd_Mapping = (SPC_Callback_Struct **)
XeMalloc (FD_SETSIZE * sizeof (SPC_Callback_Struct *));
memset(SPC_Fd_Mapping, NULL, FD_SETSIZE * sizeof(SPC_Callback_Struct *));
memset(SPC_Fd_Mapping, 0, FD_SETSIZE * sizeof(SPC_Callback_Struct *));
}
structptr=SPC_LOOKUP_FD_MAPPING(source);
_DtSvcProcessUnlock();
@@ -129,7 +129,7 @@ static SbInputId SPC_RemoveInput(int source,
}
return NULL;
return 0;
}
/*-----------------------------------------------------------------------+*/