libDtSvc: Resolve 28 compiler warnings.

This commit is contained in:
Peter Howkins
2015-01-14 14:10:55 +00:00
parent 49266f9019
commit 5c8f66a07d
12 changed files with 31 additions and 19 deletions

View File

@@ -1063,7 +1063,7 @@ _DtActionConverter(DtDtsDbField * fields,
if ((ThisBit = _DtActFieldBitLookup(XrmQuarkToString(fields[i].fieldName))) != 0)
{
switch ((int)(fieldVal=_DtActValidateFieldValue(ThisBit,
switch ((intptr_t)(fieldVal=_DtActValidateFieldValue(ThisBit,
fields[i].fieldValue, fields[0].fieldValue,
fileName)))
{

View File

@@ -951,13 +951,19 @@ _DtCmdCommandInvokerExecute (
* Save the current directory and then "chdir" to the directory
* to do the execution. If the chdir fails, return.
*/
(void) getcwd (tmpDir, MAXPATHLEN);
if(NULL == getcwd (tmpDir, MAXPATHLEN))
{
perror(strerror(errno));
return (_CMD_EXECUTE_FAILURE);
}
if (!_DtCmdValidDir (_cmdClientHost, contextDir, contextHost))
{
Cmd_FreeAllocatedStringVector (commandArray);
(void) sprintf (errorMessage, errorChdir, contextDir, execHost);
(void) chdir (tmpDir);
if(-1 == chdir (tmpDir)) {
perror(strerror(errno));
}
return (_CMD_EXECUTE_FAILURE);
}
@@ -981,7 +987,9 @@ _DtCmdCommandInvokerExecute (
if (commandPid < 0)
{
Cmd_FreeAllocatedStringVector (commandArray);
(void) chdir (tmpDir);
if(-1 == chdir (tmpDir)) {
perror(strerror(errno));
}
(void) sprintf(errorMessage, errorFork, execHost);
(void) _DtEnvControl (DT_ENV_RESTORE_POST_DT);
return (_CMD_EXECUTE_FAILURE);

View File

@@ -53,6 +53,7 @@
#include <stdlib.h>
#include <stdarg.h>
#include <stdint.h>
#include <X11/Intrinsic.h>
#include <Xm/AtomMgr.h>
#include <Xm/DragDrop.h>
@@ -428,7 +429,7 @@ DtDndDropUnregister(
dndDropSiteDestroy, NULL);
XDeleteContext(display, dndGetContextXID(display),
(XContext)dropReceiver);
(XContext)(intptr_t)dropReceiver);
_DtDndDestroyTransfers(dtDropInfo->transfers, dtDropInfo->numTransfers);
@@ -1020,7 +1021,7 @@ dndSaveDropInfo(
int status;
status = XSaveContext(display, dndGetContextXID(display),
(XContext)dropReceiver, (XPointer)dtDropInfo);
(XContext)(intptr_t)dropReceiver, (XPointer)dtDropInfo);
return (status == 0);
}
@@ -1039,7 +1040,7 @@ dndFindDropInfo(
DtDropInfo * dtDropInfo;
status = XFindContext(display, dndGetContextXID(display),
(XContext)dropReceiver, (XPointer *)&dtDropInfo);
(XContext)(intptr_t)dropReceiver, (XPointer *)&dtDropInfo);
if (status != 0)
dtDropInfo = (DtDropInfo *)NULL;

View File

@@ -498,7 +498,7 @@ getDragCollection(
int status;
_DtSvcProcessLock();
if (dragCollectionContext == (XContext)NULL) {
if (dragCollectionContext == (XContext)0) {
dragCollectionContext = XUniqueContext();
}
_DtSvcProcessUnlock();

View File

@@ -152,7 +152,7 @@ void ** _DtUtilGetHash(DtHashTbl t, const unsigned char * key)
if(tbl->hash_type == String_Key)
tmp = tbl->table[bucket = hash_string(key, tbl->size)];
else
tmp = tbl->table[bucket = abs((int)key) % tbl->size];
tmp = tbl->table[bucket = abs((int)(intptr_t)key) % tbl->size];
if(tbl->hash_type == String_Key)
while(tmp!=NULL)
@@ -205,7 +205,7 @@ void ** _DtUtilFindHash(DtHashTbl t, const unsigned char * key)
}
else
{
tmp = tbl->table[abs((int)key) % tbl->size];
tmp = tbl->table[abs((int)(intptr_t)key) % tbl->size];
for(;tmp!=NULL; tmp = tmp->next_entry)
if(tmp->key == key)
return((void *)&tmp->data);
@@ -224,7 +224,7 @@ void * _DtUtilDelHash(DtHashTbl t, const unsigned char * key)
if(tbl->hash_type == String_Key)
bucket = hash_string(key, tbl->size);
else
bucket = abs((int)key) % tbl->size;
bucket = abs((int)(intptr_t)key) % tbl->size;
if((tmp = tbl->table[bucket])==NULL)
return(NULL);

View File

@@ -1197,7 +1197,7 @@ type_path(const char *path, char *attr)
char *c;
int match = 0;
if(path && (int)path != -1)
if(path && (intptr_t)path != -1)
{
#ifdef USE_FNMATCH
match = !fnmatch(attr, path, 0);

View File

@@ -731,5 +731,5 @@ _DtActionCompareRecordBoson(
if (results)
return(results);
return((int)record1 - (int)record2);
return((intptr_t)record1 - (intptr_t)record2);
}

View File

@@ -41,6 +41,7 @@
****************************************************************************
************************************<+>*************************************/
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <Dt/Wsm.h>