From 5c8f66a07dab8f4ac46a78de31429f3588488b3e Mon Sep 17 00:00:00 2001 From: Peter Howkins Date: Wed, 14 Jan 2015 14:10:55 +0000 Subject: [PATCH] libDtSvc: Resolve 28 compiler warnings. --- cde/lib/DtSvc/DtEncap/local.c | 2 +- cde/lib/DtSvc/DtEncap/spc-proto.c | 5 +++-- cde/lib/DtSvc/DtEncap/usersig.c | 5 +++-- cde/lib/DtSvc/DtUtil1/ActionDb.c | 2 +- cde/lib/DtSvc/DtUtil1/CmdMain.c | 14 +++++++++++--- cde/lib/DtSvc/DtUtil1/DndDrop.c | 7 ++++--- cde/lib/DtSvc/DtUtil1/DndIcon.c | 2 +- cde/lib/DtSvc/DtUtil1/DtHash.c | 6 +++--- cde/lib/DtSvc/DtUtil1/Dts.c | 2 +- cde/lib/DtSvc/DtUtil1/MMDb.c | 2 +- cde/lib/DtSvc/DtUtil1/WmBackWin.c | 1 + cde/lib/DtSvc/include/codelibs/stringx.h | 2 +- 12 files changed, 31 insertions(+), 19 deletions(-) diff --git a/cde/lib/DtSvc/DtEncap/local.c b/cde/lib/DtSvc/DtEncap/local.c index fcf1b066..54913a45 100644 --- a/cde/lib/DtSvc/DtEncap/local.c +++ b/cde/lib/DtSvc/DtEncap/local.c @@ -206,7 +206,7 @@ void local_channel_object_input_handler(void * client_data, timeout.tv_sec = 0; timeout.tv_usec = 0; -#if defined(SVR4) || defined(__osf__) || defined(__hpux) || defined(__OpenBSD__) +#if defined(SVR4) || defined(__osf__) || defined(__hpux) || defined(__OpenBSD__) || defined(linux) select(max_fds, (fd_set*)&read_fd_vect, NULL, (fd_set*)&except_fd_vect, &timeout); #else /* UX has select defined with int*, not fd_set* parms */ diff --git a/cde/lib/DtSvc/DtEncap/spc-proto.c b/cde/lib/DtSvc/DtEncap/spc-proto.c index 4b21203c..92fa12f7 100644 --- a/cde/lib/DtSvc/DtEncap/spc-proto.c +++ b/cde/lib/DtSvc/DtEncap/spc-proto.c @@ -41,6 +41,7 @@ #include #include #include +#include #define X_INCLUDE_PWD_H #define XOS_USE_XT_LOCKING @@ -652,7 +653,7 @@ int print_protocol_request(XeString name, protocol_request_ptr proto) dptr->data[dptr->offset+dptr->len]=0; fprintf(SPC_Print_Protocol, - "%s channel: %x, request: %d, length: %d, seq: %d data: %s\n", + "%s channel: %p, request: %d, length: %d, seq: %d data: %s\n", name, proto->channel, proto->request_type, dptr->len, proto->seqno, dptr->data+dptr->offset); @@ -691,7 +692,7 @@ int SPC_Write_Protocol_Request (SPC_Connection_Ptr connection, /* We are overloading the "channel" field. We put the cid rather */ /* than the actual channel pointer in when we pass it to the other */ /* side of the connection. */ - prot_request->channel=(SPC_Channel_Ptr)(channel ? channel->cid : 0); + prot_request->channel=(SPC_Channel_Ptr) (intptr_t) (channel ? channel->cid : 0); switch (request) { diff --git a/cde/lib/DtSvc/DtEncap/usersig.c b/cde/lib/DtSvc/DtEncap/usersig.c index 6181a8d5..6460642b 100644 --- a/cde/lib/DtSvc/DtEncap/usersig.c +++ b/cde/lib/DtSvc/DtEncap/usersig.c @@ -36,6 +36,7 @@ #include /* NOTE: sbport.h must be the first include. */ #include +#include #include #include @@ -50,7 +51,7 @@ static void Xe_addsig(XeString name, int value) /*-------------------------------------------------------------------------+*/ { XeSymbol sym = Xe_intern(Xe_sig_table, name); - sym->value = (void *)value; + sym->value = (void *) (intptr_t) value; } /*-------------------------------------------------------------------------+*/ @@ -162,7 +163,7 @@ int XeNameToSignal(XeString name) sym = Xe_lookup(Xe_sig_table, name); _DtSvcProcessUnlock(); - return (sym) ? (int) sym->value : XE_SIG_NOT_IN_TABLE; + return (sym) ? (intptr_t) sym->value : XE_SIG_NOT_IN_TABLE; } /*-------------------------------------------------------------------------+*/ diff --git a/cde/lib/DtSvc/DtUtil1/ActionDb.c b/cde/lib/DtSvc/DtUtil1/ActionDb.c index ca7e6c6d..df3b0089 100644 --- a/cde/lib/DtSvc/DtUtil1/ActionDb.c +++ b/cde/lib/DtSvc/DtUtil1/ActionDb.c @@ -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))) { diff --git a/cde/lib/DtSvc/DtUtil1/CmdMain.c b/cde/lib/DtSvc/DtUtil1/CmdMain.c index 5c6fdf6f..94ed2784 100644 --- a/cde/lib/DtSvc/DtUtil1/CmdMain.c +++ b/cde/lib/DtSvc/DtUtil1/CmdMain.c @@ -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); diff --git a/cde/lib/DtSvc/DtUtil1/DndDrop.c b/cde/lib/DtSvc/DtUtil1/DndDrop.c index a3c05cff..87bd950e 100644 --- a/cde/lib/DtSvc/DtUtil1/DndDrop.c +++ b/cde/lib/DtSvc/DtUtil1/DndDrop.c @@ -53,6 +53,7 @@ #include #include +#include #include #include #include @@ -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; diff --git a/cde/lib/DtSvc/DtUtil1/DndIcon.c b/cde/lib/DtSvc/DtUtil1/DndIcon.c index 4f3eb25e..9f176a8c 100644 --- a/cde/lib/DtSvc/DtUtil1/DndIcon.c +++ b/cde/lib/DtSvc/DtUtil1/DndIcon.c @@ -498,7 +498,7 @@ getDragCollection( int status; _DtSvcProcessLock(); - if (dragCollectionContext == (XContext)NULL) { + if (dragCollectionContext == (XContext)0) { dragCollectionContext = XUniqueContext(); } _DtSvcProcessUnlock(); diff --git a/cde/lib/DtSvc/DtUtil1/DtHash.c b/cde/lib/DtSvc/DtUtil1/DtHash.c index b9620ad0..7d9c6f98 100644 --- a/cde/lib/DtSvc/DtUtil1/DtHash.c +++ b/cde/lib/DtSvc/DtUtil1/DtHash.c @@ -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); diff --git a/cde/lib/DtSvc/DtUtil1/Dts.c b/cde/lib/DtSvc/DtUtil1/Dts.c index 0b6b26c9..afa8b9e9 100644 --- a/cde/lib/DtSvc/DtUtil1/Dts.c +++ b/cde/lib/DtSvc/DtUtil1/Dts.c @@ -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); diff --git a/cde/lib/DtSvc/DtUtil1/MMDb.c b/cde/lib/DtSvc/DtUtil1/MMDb.c index 50ffc591..3a2483cd 100644 --- a/cde/lib/DtSvc/DtUtil1/MMDb.c +++ b/cde/lib/DtSvc/DtUtil1/MMDb.c @@ -731,5 +731,5 @@ _DtActionCompareRecordBoson( if (results) return(results); - return((int)record1 - (int)record2); + return((intptr_t)record1 - (intptr_t)record2); } diff --git a/cde/lib/DtSvc/DtUtil1/WmBackWin.c b/cde/lib/DtSvc/DtUtil1/WmBackWin.c index f3f04a07..4e9d7b29 100644 --- a/cde/lib/DtSvc/DtUtil1/WmBackWin.c +++ b/cde/lib/DtSvc/DtUtil1/WmBackWin.c @@ -41,6 +41,7 @@ **************************************************************************** ************************************<+>*************************************/ #include +#include #include #include #include
diff --git a/cde/lib/DtSvc/include/codelibs/stringx.h b/cde/lib/DtSvc/include/codelibs/stringx.h index 5981603d..981e2a43 100644 --- a/cde/lib/DtSvc/include/codelibs/stringx.h +++ b/cde/lib/DtSvc/include/codelibs/stringx.h @@ -140,7 +140,7 @@ inline void strfree(const char *s) #if defined(__hpux) || defined(__osf__) || defined(CSRG_BASED) { if (s != NULL) free((void *)s); } #else - { if (s != NULL) free((const void *)s); } + { if (s != NULL) free((void *)s); } #endif /* __hpux */ #endif #if defined(bsd) -- 2.25.1