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

@@ -1472,11 +1472,11 @@ CreateInvocationRecord(
*/
return NULL;
}
myassert(invp->id != NULL );
myassert(invp->id != 0);
SET_INV_PENDING(invp->state);
invp->w = w;
invp->numChildren = NULL;
invp->numChildren = 0;
invp->childRec = NULL;
/*
@@ -4802,7 +4802,7 @@ InitiateCommandInvokerRequest(
CallbackData *data=(CallbackData *)XtMalloc((Cardinal)sizeof(CallbackData));
ActionPtr action = request->clonedAction;
tmpFileBuf[0]=NULL; /* seed the buffer with a null string */
tmpFileBuf[0]='\0'; /* seed the buffer with a null string */
/*
* Generate the procId option string for dtexec
@@ -4833,9 +4833,9 @@ InitiateCommandInvokerRequest(
/*
* The string generated for procId should never exceed the procId buf size.
*/
sprintf(procIdBuf,"%s_%d_%d",
sprintf(procIdBuf,"%s_%d_%lu",
_DtActNULL_GUARD(procId),
request->invocId,
(int) request->invocId,
request->childId );
myassert( strlen(procIdBuf) < sizeof(procIdBuf) );
@@ -5309,7 +5309,7 @@ _DtActMapFileName(
* Create the full path name relative to curHost
*/
buf[0]=NULL; /* empty string to start with */
buf[0]='\0'; /* empty string to start with */
if ( dir )
strcpy(buf,dir);
@@ -5326,7 +5326,7 @@ _DtActMapFileName(
}
/* We should have constructed a file name string now */
myassert(buf[0] != NULL);
myassert(buf[0] != '\0');
if (newHost)
{

View File

@@ -210,7 +210,7 @@ Meaningless for actions -- ignore these for now
_DtACTION_DT_NGROUP, _ActDb_DT_NGROUP_SET,
_DtPFX _DtACTION_DTN_VALUE, _ActDb_DT_ARGN_VAL_SET,
#endif /* _DT_ALLOW_DT_MSGS */
NULL, NULL
NULL, 0
};
#define NUM_FIELD_NAMES sizeof(_DtActNamesAndBits)/sizeof(_DtActNameAndBit) - 1
@@ -235,7 +235,7 @@ _DtActFieldBitLookup(char *name)
#endif /* _DT_ALLOW_DT_MSGS */
if ( !np )
return NULL;
return 0;
/*
* Check for [DT]T_ARGn_ fields
* The following code assumes that a unique suffix identifying each
@@ -267,7 +267,7 @@ _DtActFieldBitLookup(char *name)
#endif /* _DT_ALLOW_DT_MSGS */
if ( !np )
return NULL;
return 0;
for ( j = 0; j < NUM_FIELD_NAMES; j++ )
if ( !strcmp(_DtActNamesAndBits[j].name,np) )
@@ -397,7 +397,7 @@ _DtActValidateFieldValue( long bit, char *value, char *actName, char *filename)
/*
* temporarily truncate string for testing
*/
*p = NULL;
*p = '\0';
if ( strcmp(_DtACT_ANY,start) &&
strcmp(_DtACTION_FILE,start) &&
strcmp(_DtACTION_BUFFER,start) )
@@ -540,7 +540,7 @@ _DtActValidateFieldValue( long bit, char *value, char *actName, char *filename)
return (char *) -1;
}
}
if (*p == NULL)
if (*p == '\0')
{
/* looks like an error */
buf = malloc(_DtAct_MAX_BUF_SIZE);
@@ -1028,7 +1028,7 @@ _DtActionConverter(DtDtsDbField * fields,
_DtSvcProcessUnlock();
return(True);
}
else if ( fields[1].fieldName == NULL)
else if ( fields[1].fieldName == 0)
{
/* The record contains no fields */
buf = XtMalloc(_DtAct_MAX_BUF_SIZE);
@@ -1060,7 +1060,7 @@ _DtActionConverter(DtDtsDbField * fields,
/* find the corresponding field entry and bitmask */
if ((ThisBit = _DtActFieldBitLookup(XrmQuarkToString(fields[i].fieldName))) != NULL)
if ((ThisBit = _DtActFieldBitLookup(XrmQuarkToString(fields[i].fieldName))) != 0)
{
switch ((int)(fieldVal=_DtActValidateFieldValue(ThisBit,
fields[i].fieldValue, fields[0].fieldValue,

View File

@@ -1130,8 +1130,8 @@ _DtActionGetRecordWeight(
static unsigned long
_DtActMMParseArgTypesList(char *tlist, DtShmBoson **quarkAddr, int *countp)
{
static DtShmBoson quark_for_wild_char = NULL;
unsigned long mask = NULL;
static DtShmBoson quark_for_wild_char = 0;
unsigned long mask = 0;
int tcount;
DtShmBoson *qp;
char **typeVec, **tvp;
@@ -1182,7 +1182,7 @@ _DtActMMParseClassList(char *clist)
char buf[_DtAct_MAX_BUF_SIZE];
char *bp;
char **classVec, **cvp;
unsigned long mask = NULL;
unsigned long mask = 0;
if ( !DtStrchr(clist, _DtACT_LIST_SEPARATOR_CHAR ) )
{
@@ -1236,7 +1236,7 @@ _DtActMMParseClassList(char *clist)
static unsigned long
_DtActMMParseArgCountString( char *countStr, int *countp)
{
unsigned long mask = NULL;
unsigned long mask = 0;
if ( !strcmp(countStr,_DtACT_ANY) )
return SET_ARG_COUNT_WILD(mask);
@@ -1258,7 +1258,7 @@ _DtActMMParseArgCountString( char *countStr, int *countp)
static unsigned long
_DtActMMParseActionType(char *actionTypeStr)
{
unsigned long mask = NULL;
unsigned long mask = 0;
if ( !strcmp(actionTypeStr,_DtACTION_COMMAND) )
return SET_CMD_ACTION(mask);

View File

@@ -111,7 +111,7 @@ _DtBasename( const char *s )
return NULL;
/* Work on a local copy of the original string */
*p = NULL;
*p = '\0';
(void)strcpy(p,s);
#ifdef _Dt_HOST_COLON_PATH_SUPPORT
@@ -140,7 +140,7 @@ _DtBasename( const char *s )
myassert( *basep == '/');
if ( basep == p )
return XtNewString(basep);
*basep = NULL; /* replace trailing slash */
*basep = '\0'; /* replace trailing slash */
if ( (basep = DtStrrchr(p,'/')) == NULL )
return XtNewString(p);
}
@@ -202,7 +202,7 @@ _DtDirname( const char *s)
/* Work on a local copy of the original string */
*p = NULL;
*p = '\0';
(void)strcpy(p,s);
#ifdef _Dt_HOST_COLON_PATH_SUPPORT
@@ -231,7 +231,7 @@ _DtDirname( const char *s)
* -- then try again else break
*/
if ( slashp == DtPrevChar(p,p + strlen(p)) )
*slashp = NULL;
*slashp = '\0';
else
break;
}
@@ -244,7 +244,7 @@ _DtDirname( const char *s)
* directory name.
*/
dirp = XtNewString(p);
*(dirp + (slashp - p)) = NULL;
*(dirp + (slashp - p)) = '\0';
return dirp;
}
@@ -283,14 +283,14 @@ _DtHostString( const char *s)
* Make a local copy of the string to avoid problems modifying
* "const" strings.
*/
*p = NULL;
*p = '\0';
(void) strcpy(p,s);
/* if ( (slashp > s) && (*(slashp -1) == ':' )) */
if ( (slashp > s) && (*DtPrevChar(s,slashp) == ':' ))
{
/* *(p + (slashp - s - 1)) = NULL; */
*(p + (DtPrevChar(s,slashp) - s)) = NULL;
*(p + (DtPrevChar(s,slashp) - s)) = '\0';
host = XtNewString(p);
return host;
}
@@ -344,7 +344,7 @@ _DtGetDisplayHostName( Display *dp)
}
tmpName = XtMalloc(MAXHOSTNAMELEN + 5);
tmpName[0] = NULL;
tmpName[0] = '\0';
if ( dp )
{
@@ -356,7 +356,7 @@ _DtGetDisplayHostName( Display *dp)
strcpy(tmpName,DisplayString(dp));
if ( tmp = DtStrrchr(tmpName,':') )
{
*tmp = NULL;
*tmp = '\0';
displayHostName = XtNewString(tmpName);
}
}
@@ -370,7 +370,7 @@ _DtGetDisplayHostName( Display *dp)
strcpy(tmpName,getenv("DISPLAY"));
if ( tmp = DtStrrchr(tmpName,':') )
{
*tmp = NULL;
*tmp = '\0';
displayHostName = XtNewString(tmpName);
}
}
@@ -424,7 +424,7 @@ _DtGetLocalHostName( void )
return NULL; /* failed gethostname */
}
if (ptr = DtStrchr(hostNameBuf, '.'))
*ptr = NULL; /* delete domain name if there is one */
*ptr = '\0'; /* delete domain name if there is one */
localHostName = hostNameBuf;
_DtSvcProcessUnlock();
@@ -481,9 +481,9 @@ _DtIsSameHost(const char *host1, const char *host2)
* to their short form before doing the compare.
*/
if ( (tp = DtStrchr(hostName1,'.')) != NULL )
*tp = NULL;
*tp = '\0';
if ( (tp = DtStrchr(hostName2,'.')) != NULL )
*tp = NULL;
*tp = '\0';
/*
* Try to avoid querying the name server (or /etc/hosts).
@@ -502,7 +502,7 @@ _DtIsSameHost(const char *host1, const char *host2)
*/
strcpy(hostName1, host_ret->h_name);
if ( (tp = DtStrchr(hostName1,'.')) != NULL )
*tp = NULL;
*tp = '\0';
/*
* Try comparing again -- avoiding another gethostbyname
@@ -838,7 +838,7 @@ _DtActGenerateTmpFile(char *dir,char *format,mode_t mode,int *fd)
* of the tmp file name (i.e. no %s in format) then
* there is no sense trying more than once.
*/
if ( countTrys > 0 && (strcmp(f,nameBuf) == NULL))
if ( countTrys > 0 && (strcmp(f,nameBuf) == 0))
return NULL;
base = XtNewString(nameBuf);
@@ -892,7 +892,7 @@ _DtRemoveTrailingBlanksInPlace(char **s)
for ( p = DtPrevChar(*s,*s + strlen(*s));
DtIsspace(p) && (p > *s);
p=DtPrevChar(*s,p))
*p = NULL;
*p = '\0';
}
@@ -1245,7 +1245,7 @@ int _DtActDeleteInvRec( DtActionInvocationID id )
if (IS_BUFFER_OBJ(infop->mask) && IS_FILE_OBJ(infop->mask))
{
myassert((infop->name!=NULL) && (*infop->name!=NULL));
myassert((infop->name != NULL) && (*infop->name != '\0'));
if ( !infop->name )
continue;
/*
@@ -1317,7 +1317,7 @@ _DtActChildRecT *_DtActAllocChildRec( _DtActInvRecT *invRec )
tchildRec = invRec->childRec[invRec->numChildren - 1]; /* shorthand */
memset(tchildRec, NULL, sizeof(_DtActChildRecT));
memset(tchildRec, 0, sizeof(_DtActChildRecT));
tchildRec->childId = invRec->numChildren; /* serial # of sorts */
/* tchildRec->u.* = initialized elsewhere */
@@ -1837,7 +1837,7 @@ _DtActReadTmpFileToBuffer( char *fname, int *sizep )
buf = (char *) XtMalloc(MAX_BUF_SIZE);
for (size=0, space=MAX_BUF_SIZE;
(bytes=read(fd,buf+size,space)) != NULL;
(bytes=read(fd,buf+size,space)) != 0;
size += bytes )
{
if ( bytes < 0 )

View File

@@ -578,7 +578,7 @@ ExecuteQueuedRequest (
strlen (pNode->exec_host) +
cmdlen + 4);
cmdp = (char *) XtMalloc(cmdlen + 1);
*cmdp = NULL;
*cmdp = '\0';
for (i = 0; pNode->argv[i]; i++) {
strcat(cmdp,pNode->argv[i]);
strcat(cmdp, " ");
@@ -1177,7 +1177,7 @@ DtCmdGetWindowType(
switch ( windowTypeMask )
{
case _DtAct_NO_STDIO_BIT:
winTypeNum = NULL;
winTypeNum = 0;
break;
case _DtAct_TERMINAL_BIT:
winTypeNum = TERMINAL;

View File

@@ -1712,7 +1712,7 @@ SplitField(
*NumberFieldsAllocated += NUMBER_FIELDS_INCREMENT;
}
(*fields)[*slotToUse].fieldName = NULL;
(*fields)[*slotToUse].fieldName = 0;
(*fields)[*slotToUse].fieldValue = NULL;
/* A NULL ptr is how we force a NULL entry to terminate the array */

View File

@@ -998,7 +998,7 @@ dndGetContextXID(
static XID contextXID;
_DtSvcProcessLock();
if (contextXID == NULL) {
if (contextXID == 0) {
contextXID = XCreatePixmap(display,
DefaultRootWindow(display), 1, 1, 1);
}

View File

@@ -712,7 +712,7 @@ get_buff(type_info_t *info)
if((info->buffer = mmap(NULL,
buf->st_size,
PROT_READ, MAP_PRIVATE,
info->file_fd, NULL)) == (char *)-1)
info->file_fd, 0)) == (char *)-1)
{
info->mmap_size_to_free = -1;
info->size_to_free = buf->st_size+1;

View File

@@ -609,7 +609,7 @@ _DtDtsMMapDB(const char *CacheFile)
MAP_SHARED,
#endif
mmaped_fd,
NULL);
0);
if(mmaped_db != (void *) -1)
{
success = TRUE;

View File

@@ -115,7 +115,7 @@ _GetMwmWindow(
Window wroot, wparent, *pchildren;
unsigned int nchildren;
*pMwmWindow = NULL;
*pMwmWindow = 0;
if ((rcode=XGetWindowProperty(display,root,
property,0L, PROP_MWM_INFO_ELEMENTS,
False,property,

View File

@@ -38,6 +38,7 @@
************************************<+>*************************************/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/*********************************************************************
* _DtQualifyWithFirst

View File

@@ -843,7 +843,7 @@ _GetSmWindow(
Window wroot, wparent, *pchildren;
unsigned int nchildren;
*pSmWindow = NULL;
*pSmWindow = 0;
if ((rcode=XGetWindowProperty(display,root,
property,0L, PROP_DT_SM_WINDOW_INFO_ELEMENTS,
False,property,
@@ -938,8 +938,8 @@ static struct {
char *string;
Atom atom;
} smAtomList[] = {
{_XA_DT_SM_STATE_INFO, NULL},
{_XA_DT_SM_SAVER_INFO, NULL},
{_XA_DT_SM_STATE_INFO, 0},
{_XA_DT_SM_SAVER_INFO, 0},
};
static Atom

View File

@@ -170,7 +170,7 @@ _DtShmProtoAddStrtab(DtShmProtoStrtab strlist, const char * string, int * isnew)
int ret = *bucket;
if(*bucket == NULL) /* new */ {
if(*bucket == 0) /* new */ {
unsigned char ** sptr;
*isnew = 1;
*bucket = ret = ptr->sl_charcount;