A first round to fix some compile time warnings.
>From c507d00e861b5b8a5a7df97d9b115ac7742bfeea Mon Sep 17 00:00:00 2001
From: Marc Balmer <m...@msys.ch>
Date: Sun, 12 Aug 2012 11:50:45 +0200
Subject: [PATCH] Fix compile time warning, mostly missing include files, but
also
integer issues on 64 bit linux or passing NULL where an integer is expected.
---
cde/config/imake/ccimake.c | 1 +
cde/config/util/lndir.c | 1 +
cde/lib/DtSvc/DtEncap/spc-net.c | 4 ++--
cde/lib/DtSvc/DtEncap/spc-obj.c | 2 +-
cde/lib/DtSvc/DtUtil1/Dts.c | 2 +-
cde/lib/DtSvc/DtUtil1/DtsMM.c | 2 +-
cde/lib/DtSvc/DtUtil2/DtGetMessage.c | 1 +
cde/lib/tt/mini_isam/isbtree.c | 1 +
cde/lib/tt/mini_isam/isbytearray.c | 1 +
cde/lib/tt/mini_isam/iserror.c | 1 +
cde/lib/tt/mini_isam/isfab.c | 1 +
cde/lib/tt/mini_isam/isfcb.c | 1 +
cde/lib/tt/mini_isam/issort.c | 1 +
cde/programs/dthelp/parser/canon1/build/build.c | 5 ++---
cde/programs/dthelp/parser/canon1/eltdef/eltdef.c | 5 ++---
cde/programs/dthelp/parser/canon1/util/context.c | 6 ++----
cde/programs/dthelp/parser/canon1/util/triecnt.c | 2 +-
cde/programs/dthelp/parser/canon1/util/wchar.c | 1 +
cde/programs/dthelp/parser/pass1/build/build.c | 5 ++---
cde/programs/dthelp/parser/pass1/util/context.c | 6 ++----
cde/programs/dthelp/parser/pass1/util/triecnt.c | 2 +-
cde/programs/dthelp/parser/pass1/util/wchar.c | 1 +
cde/programs/dthelp/parser/pass2/build/build.c | 5 ++---
cde/programs/dthelp/parser/pass2/eltdef/eltdef.c | 5 ++---
cde/programs/dthelp/parser/pass2/util/context.c | 6 ++----
cde/programs/dthelp/parser/pass2/util/triecnt.c | 2 +-
cde/programs/dthelp/parser/pass2/util/wchar.c | 1 +
27 files changed, 36 insertions(+), 35 deletions(-)
diff --git a/cde/config/imake/ccimake.c b/cde/config/imake/ccimake.c
index 57ccf6a..5a21100 100644
--- a/cde/config/imake/ccimake.c
+++ b/cde/config/imake/ccimake.c
@@ -48,6 +48,7 @@ in this Software without prior written authorization from The
Open Group .
* compile without any special flags on all systems. Do not touch it unless
* you *really* know what you're doing. Make changes in imakemdep.h, not here.
*/
+#include <stdlib.h> /* for the exit(3) prototype */
#define CCIMAKE /* only get imake_ccflags definitions */
#include "imakemdep.h" /* things to set when porting imake */
diff --git a/cde/config/util/lndir.c b/cde/config/util/lndir.c
index 4e678ae..1c412df 100644
--- a/cde/config/util/lndir.c
+++ b/cde/config/util/lndir.c
@@ -63,6 +63,7 @@ in this Software without prior written authorization from The
Open Group.
#include <X11/Xos.h>
#include <X11/Xfuncproto.h>
#include <stdio.h>
+#include <stdlib.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <errno.h>
diff --git a/cde/lib/DtSvc/DtEncap/spc-net.c b/cde/lib/DtSvc/DtEncap/spc-net.c
index d83df3e..917864a 100644
--- a/cde/lib/DtSvc/DtEncap/spc-net.c
+++ b/cde/lib/DtSvc/DtEncap/spc-net.c
@@ -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, AF_UNSPEC);
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);
diff --git a/cde/lib/DtSvc/DtEncap/spc-obj.c b/cde/lib/DtSvc/DtEncap/spc-obj.c
index 1e2c586..43e29b3 100644
--- a/cde/lib/DtSvc/DtEncap/spc-obj.c
+++ b/cde/lib/DtSvc/DtEncap/spc-obj.c
@@ -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);
}
diff --git a/cde/lib/DtSvc/DtUtil1/Dts.c b/cde/lib/DtSvc/DtUtil1/Dts.c
index 4b5956c..eb9881b 100644
--- a/cde/lib/DtSvc/DtUtil1/Dts.c
+++ b/cde/lib/DtSvc/DtUtil1/Dts.c
@@ -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;
diff --git a/cde/lib/DtSvc/DtUtil1/DtsMM.c b/cde/lib/DtSvc/DtUtil1/DtsMM.c
index d9d745f..8e2a84b 100644
--- a/cde/lib/DtSvc/DtUtil1/DtsMM.c
+++ b/cde/lib/DtSvc/DtUtil1/DtsMM.c
@@ -609,7 +609,7 @@ _DtDtsMMapDB(const char *CacheFile)
MAP_SHARED,
#endif
mmaped_fd,
- NULL);
+ 0);
if(mmaped_db != (void *) -1)
{
success = TRUE;
diff --git a/cde/lib/DtSvc/DtUtil2/DtGetMessage.c
b/cde/lib/DtSvc/DtUtil2/DtGetMessage.c
index 527a348..b1fe32c 100644
--- a/cde/lib/DtSvc/DtUtil2/DtGetMessage.c
+++ b/cde/lib/DtSvc/DtUtil2/DtGetMessage.c
@@ -40,6 +40,7 @@
#ifndef NO_MESSAGE_CATALOG
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <nl_types.h>
#include "DtSvcLock.h"
diff --git a/cde/lib/tt/mini_isam/isbtree.c b/cde/lib/tt/mini_isam/isbtree.c
index aa1413e..65a6d4a 100644
--- a/cde/lib/tt/mini_isam/isbtree.c
+++ b/cde/lib/tt/mini_isam/isbtree.c
@@ -40,6 +40,7 @@
* B-tree operations: SEARCH
*
*/
+#include <stdlib.h>
#include "isam_impl.h"
diff --git a/cde/lib/tt/mini_isam/isbytearray.c
b/cde/lib/tt/mini_isam/isbytearray.c
index d9df360..22ceaf2 100644
--- a/cde/lib/tt/mini_isam/isbytearray.c
+++ b/cde/lib/tt/mini_isam/isbytearray.c
@@ -39,6 +39,7 @@ static char sccsid[] = "@(#)isbytearray.c 1.3 89/07/17 Copyr
1988 Sun Micro";
* Byte array handling functions.
*
*/
+#include <stdlib.h>
#include "isam_impl.h"
diff --git a/cde/lib/tt/mini_isam/iserror.c b/cde/lib/tt/mini_isam/iserror.c
index 8706aa2..c85d387 100644
--- a/cde/lib/tt/mini_isam/iserror.c
+++ b/cde/lib/tt/mini_isam/iserror.c
@@ -39,6 +39,7 @@ static char sccsid[] = "@(#)iserror.c 1.10 89/07/17 Copyr
1988 Sun Micro";
* NetISAM error handling functions.
*
*/
+#include <stdlib.h>
#include "isam_impl.h"
#include <errno.h>
diff --git a/cde/lib/tt/mini_isam/isfab.c b/cde/lib/tt/mini_isam/isfab.c
index e3e4881..2a1ede1 100644
--- a/cde/lib/tt/mini_isam/isfab.c
+++ b/cde/lib/tt/mini_isam/isfab.c
@@ -39,6 +39,7 @@ static char sccsid[] = "@(#)isfab.c 1.8 89/07/17 Copyr 1988
Sun Micro";
* The ISAM file access block functions.
*
*/
+#include <stdlib.h>
#include "isam_impl.h"
diff --git a/cde/lib/tt/mini_isam/isfcb.c b/cde/lib/tt/mini_isam/isfcb.c
index 3f0d32f..357682b 100644
--- a/cde/lib/tt/mini_isam/isfcb.c
+++ b/cde/lib/tt/mini_isam/isfcb.c
@@ -40,6 +40,7 @@ static char sccsid[] = "@(#)isfcb.c 1.9 89/07/17 Copyr 1988
Sun Micro";
*
*
*/
+#include <stdlib.h>
#include "isam_impl.h"
#include <sys/stat.h>
diff --git a/cde/lib/tt/mini_isam/issort.c b/cde/lib/tt/mini_isam/issort.c
index 4b4ea66..cc2ec5f 100644
--- a/cde/lib/tt/mini_isam/issort.c
+++ b/cde/lib/tt/mini_isam/issort.c
@@ -39,6 +39,7 @@ static char sccsid[] = "@(#)issort.c 1.3 89/07/17 Copyr 1988
Sun Micro";
* Description:
* ISAM sort package (sort in memory)
*/
+#include <stdlib.h>
#include "isam_impl.h"
diff --git a/cde/programs/dthelp/parser/canon1/build/build.c
b/cde/programs/dthelp/parser/canon1/build/build.c
index 72581b4..e96ec76 100644
--- a/cde/programs/dthelp/parser/canon1/build/build.c
+++ b/cde/programs/dthelp/parser/canon1/build/build.c
@@ -41,9 +41,7 @@ This product and information is proprietary of Tandem
Computers Incorporated.
#include "entdef.h"
/* Main procedure */
-void main(argc, argv)
-int argc ;
-char **argv ;
+int main(int argc, char *argv[])
{
int m_prevcon ;
@@ -71,4 +69,5 @@ while (TRUE)
#include "case.c"
if (m_token == ENDFILE) exit(FALSE) ;
}
+return 0;
}
diff --git a/cde/programs/dthelp/parser/canon1/eltdef/eltdef.c
b/cde/programs/dthelp/parser/canon1/eltdef/eltdef.c
index 89eaba5..4862c7a 100644
--- a/cde/programs/dthelp/parser/canon1/eltdef/eltdef.c
+++ b/cde/programs/dthelp/parser/canon1/eltdef/eltdef.c
@@ -49,9 +49,7 @@ This product and information is proprietary of Tandem
Computers Incorporated.
#include "entity.h"
/* Main program */
-void main(argc, argv)
- int argc ;
- char **argv ;
+int main(int argc, char *argv[])
{
int m_token ;
@@ -93,4 +91,5 @@ void main(argc, argv)
}
}
done() ;
+ return 0;
}
diff --git a/cde/programs/dthelp/parser/canon1/util/context.c
b/cde/programs/dthelp/parser/canon1/util/context.c
index 4fa3979..ff26931 100644
--- a/cde/programs/dthelp/parser/canon1/util/context.c
+++ b/cde/programs/dthelp/parser/canon1/util/context.c
@@ -169,9 +169,7 @@ delim.h.
#include "cont.h"
/* Main procedure */
-void main(argc, argv)
- int argc ;
- char **argv ;
+int main(int argc, char *argv[])
{
int n ;
@@ -242,5 +240,5 @@ fprintf(context, "#define MAXD %d\n", maxd) ;
dumptree((LOGICAL) (argc > 1)) ;
fprintf(stderr, "NUMCON set to %d\n", NUMCON) ;
fprintf(stderr, "NUMDELIM set to %d\n", NUMDELIM) ;
-exit(errexit) ;
+return errexit ;
}
diff --git a/cde/programs/dthelp/parser/canon1/util/triecnt.c
b/cde/programs/dthelp/parser/canon1/util/triecnt.c
index 0949cf0..94be3ba 100644
--- a/cde/programs/dthelp/parser/canon1/util/triecnt.c
+++ b/cde/programs/dthelp/parser/canon1/util/triecnt.c
@@ -110,5 +110,5 @@ void printval(file, value)
FILE *file ;
void *value ;
{
- fprintf(file, ", %d", (int) value) ;
+ fprintf(file, ", %ld", (long) value) ;
}
diff --git a/cde/programs/dthelp/parser/canon1/util/wchar.c
b/cde/programs/dthelp/parser/canon1/util/wchar.c
index d49e825..7dd23d6 100644
--- a/cde/programs/dthelp/parser/canon1/util/wchar.c
+++ b/cde/programs/dthelp/parser/canon1/util/wchar.c
@@ -24,6 +24,7 @@
/*
Copyright 1992 Hewlett-Packard Co.
*/
+#include <string.h>
#include "basic.h"
#include "trie.h"
diff --git a/cde/programs/dthelp/parser/pass1/build/build.c
b/cde/programs/dthelp/parser/pass1/build/build.c
index b42a8f9..afe9a2d 100644
--- a/cde/programs/dthelp/parser/pass1/build/build.c
+++ b/cde/programs/dthelp/parser/pass1/build/build.c
@@ -41,9 +41,7 @@ This product and information is proprietary of Tandem
Computers Incorporated.
#include "entdef.h"
/* Main procedure */
-void main(argc, argv)
-int argc ;
-char **argv ;
+int main(int argc, char *argv[])
{
int m_prevcon ;
@@ -71,4 +69,5 @@ while (TRUE)
#include "case.c"
if (m_token == ENDFILE) exit(FALSE) ;
}
+return 0;
}
diff --git a/cde/programs/dthelp/parser/pass1/util/context.c
b/cde/programs/dthelp/parser/pass1/util/context.c
index fe35848..7e1f89f 100644
--- a/cde/programs/dthelp/parser/pass1/util/context.c
+++ b/cde/programs/dthelp/parser/pass1/util/context.c
@@ -169,9 +169,7 @@ delim.h.
#include "cont.h"
/* Main procedure */
-void main(argc, argv)
- int argc ;
- char **argv ;
+int main(int argc, char *argv[])
{
int n ;
@@ -242,5 +240,5 @@ fprintf(context, "#define MAXD %d\n", maxd) ;
dumptree((LOGICAL) (argc > 1)) ;
fprintf(stderr, "NUMCON set to %d\n", NUMCON) ;
fprintf(stderr, "NUMDELIM set to %d\n", NUMDELIM) ;
-exit(errexit) ;
+return errexit;
}
diff --git a/cde/programs/dthelp/parser/pass1/util/triecnt.c
b/cde/programs/dthelp/parser/pass1/util/triecnt.c
index 493f386..a4f780c 100644
--- a/cde/programs/dthelp/parser/pass1/util/triecnt.c
+++ b/cde/programs/dthelp/parser/pass1/util/triecnt.c
@@ -110,5 +110,5 @@ void printval(file, value)
FILE *file ;
void *value ;
{
- fprintf(file, ", %d", (int) value) ;
+ fprintf(file, ", %ld", (long) value) ;
}
diff --git a/cde/programs/dthelp/parser/pass1/util/wchar.c
b/cde/programs/dthelp/parser/pass1/util/wchar.c
index 0d8b46c..b325224 100644
--- a/cde/programs/dthelp/parser/pass1/util/wchar.c
+++ b/cde/programs/dthelp/parser/pass1/util/wchar.c
@@ -24,6 +24,7 @@
/*
Copyright 1992 Hewlett-Packard Co.
*/
+#include <string.h>
#include "basic.h"
#include "trie.h"
diff --git a/cde/programs/dthelp/parser/pass2/build/build.c
b/cde/programs/dthelp/parser/pass2/build/build.c
index ea67e87..0a2a960 100644
--- a/cde/programs/dthelp/parser/pass2/build/build.c
+++ b/cde/programs/dthelp/parser/pass2/build/build.c
@@ -41,9 +41,7 @@ This product and information is proprietary of Tandem
Computers Incorporated.
#include "entdef.h"
/* Main procedure */
-void main(argc, argv)
-int argc ;
-char **argv ;
+int main(int argc, char *argv[])
{
int m_prevcon ;
@@ -71,4 +69,5 @@ while (TRUE)
#include "case.c"
if (m_token == ENDFILE) exit(FALSE) ;
}
+return 0;
}
diff --git a/cde/programs/dthelp/parser/pass2/eltdef/eltdef.c
b/cde/programs/dthelp/parser/pass2/eltdef/eltdef.c
index cfe42ab..6fa82e6 100644
--- a/cde/programs/dthelp/parser/pass2/eltdef/eltdef.c
+++ b/cde/programs/dthelp/parser/pass2/eltdef/eltdef.c
@@ -49,9 +49,7 @@ This product and information is proprietary of Tandem
Computers Incorporated.
#include "entity.h"
/* Main program */
-void main(argc, argv)
- int argc ;
- char **argv ;
+int main(int argc, char *argv[])
{
int m_token ;
@@ -93,4 +91,5 @@ void main(argc, argv)
}
}
done() ;
+ return 0;
}
diff --git a/cde/programs/dthelp/parser/pass2/util/context.c
b/cde/programs/dthelp/parser/pass2/util/context.c
index 9417aef..c65f13a 100644
--- a/cde/programs/dthelp/parser/pass2/util/context.c
+++ b/cde/programs/dthelp/parser/pass2/util/context.c
@@ -169,9 +169,7 @@ delim.h.
#include "cont.h"
/* Main procedure */
-void main(argc, argv)
- int argc ;
- char **argv ;
+int main(int argc, char *argv[])
{
int n ;
@@ -242,5 +240,5 @@ fprintf(context, "#define MAXD %d\n", maxd) ;
dumptree((LOGICAL) (argc > 1)) ;
fprintf(stderr, "NUMCON set to %d\n", NUMCON) ;
fprintf(stderr, "NUMDELIM set to %d\n", NUMDELIM) ;
-exit(errexit) ;
+return errexit ;
}
diff --git a/cde/programs/dthelp/parser/pass2/util/triecnt.c
b/cde/programs/dthelp/parser/pass2/util/triecnt.c
index 3298910..dd879f4 100644
--- a/cde/programs/dthelp/parser/pass2/util/triecnt.c
+++ b/cde/programs/dthelp/parser/pass2/util/triecnt.c
@@ -110,5 +110,5 @@ void printval(file, value)
FILE *file ;
void *value ;
{
- fprintf(file, ", %d", (int) value) ;
+ fprintf(file, ", %ld", (long) value) ;
}
diff --git a/cde/programs/dthelp/parser/pass2/util/wchar.c
b/cde/programs/dthelp/parser/pass2/util/wchar.c
index 780bbf4..e619b65 100644
--- a/cde/programs/dthelp/parser/pass2/util/wchar.c
+++ b/cde/programs/dthelp/parser/pass2/util/wchar.c
@@ -24,6 +24,7 @@
/*
Copyright 1992 Hewlett-Packard Co.
*/
+#include <string.h>
#include "basic.h"
#include "trie.h"
--
1.7.2.5
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel