[vpnc-devel] Warning fixes
Joerg Mayer
jmvpnc at loplof.de
Tue Jun 21 15:07:55 CEST 2005
Maurice,
if I change the Make file as follows:
--- Makefile (revision 55)
+++ Makefile (working copy)
@@ -23,7 +23,7 @@
MANDIR=$(PREFIX)/share/man
CC=gcc
-CFLAGS=-W -Wall -O -g '-DVERSION="$(shell cat VERSION)"' $(shell libgcrypt-config --cflags)
+CFLAGS=-W -Wall -O3 -pedantic -g '-DVERSION="$(shell cat VERSION)"' $(shell libgcrypt-config --cflags)
LDFLAGS=-g $(shell libgcrypt-config --libs)
ifeq ($(shell uname -s), Linux)
I get quite a few warnings. I've fixed some of them:
- The trivial ones :-)
Please apply the attached patch.
Thanks
Joerg
--
Joerg Mayer <jmayer at loplof.de>
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.
-------------- next part --------------
Index: tunip.c
===================================================================
--- tunip.c (revision 55)
+++ tunip.c (working copy)
@@ -127,7 +127,7 @@
struct encap_method {
int fd; /* file descriptor for relevant socket */
- unsigned char *name;
+ char *name;
int fixed_header_size;
@@ -383,7 +383,7 @@
*/
int find_local_addr(struct sockaddr_in *dest, struct sockaddr_in *source)
{
- int addrlen;
+ socklen_t addrlen;
struct sockaddr_in dest_socket;
int fd;
Index: sysdep-svr4.c
===================================================================
--- sysdep-svr4.c (revision 55)
+++ sysdep-svr4.c (working copy)
@@ -141,7 +141,7 @@
return 0;
}
-int tun_write(int fd, char *buf, int len)
+int tun_write(int fd, unsigned char *buf, int len)
{
struct strbuf sbuf;
sbuf.len = len;
@@ -149,7 +149,7 @@
return putmsg(fd, NULL, &sbuf, 0) >= 0 ? sbuf.len : -1;
}
-int tun_read(int fd, char *buf, int len)
+int tun_read(int fd, unsigned char *buf, int len)
{
struct strbuf sbuf;
int f = 0;
Index: sysdep-linux.c
===================================================================
--- sysdep-linux.c (revision 55)
+++ sysdep-linux.c (working copy)
@@ -93,12 +93,12 @@
}
/* Read/write frames from TUN device */
-int tun_write(int fd, char *buf, int len)
+int tun_write(int fd, unsigned char *buf, int len)
{
return write(fd, buf, len);
}
-int tun_read(int fd, char *buf, int len)
+int tun_read(int fd, unsigned char *buf, int len)
{
return read(fd, buf, len);
}
Index: config.c
===================================================================
--- config.c (revision 55)
+++ config.c (working copy)
@@ -314,7 +314,7 @@
{
FILE *f;
char *line = NULL;
- ssize_t line_length = 0;
+ size_t line_length = 0;
int linenum = 0;
char *realname;
@@ -353,7 +353,7 @@
continue;
if (strncasecmp(config_names[i].name, line,
strlen(config_names[i].name)) == 0) {
- // boolean implementation, using harmles pointer targets as true
+ /* boolean implementation, using harmles pointer targets as true */
if (!config_names[i].needsArgument) {
configs[config_names[i].nm] = config_names[i].name;
break;
Index: math_group.c
===================================================================
--- math_group.c (revision 55)
+++ math_group.c (working copy)
@@ -216,8 +216,8 @@
group->bits = dscr->bits;
- gcry_mpi_scan(&grp->p, GCRYMPI_FMT_HEX, dscr->prime, 0, NULL);
- gcry_mpi_scan(&grp->gen, GCRYMPI_FMT_HEX, dscr->gen, 0, NULL);
+ gcry_mpi_scan(&grp->p, GCRYMPI_FMT_HEX, (const unsigned char*)dscr->prime, 0, NULL);
+ gcry_mpi_scan(&grp->gen, GCRYMPI_FMT_HEX, (const unsigned char *)dscr->gen, 0, NULL);
grp->a = gcry_mpi_new(group->bits);
grp->b = gcry_mpi_new(group->bits);
Index: math_group.h
===================================================================
--- math_group.h (revision 55)
+++ math_group.h (working copy)
@@ -36,7 +36,7 @@
#define __MATH_GROUP_H__
enum groups {
- MODP, /* F_p, Z modulo a prime */
+ MODP /* F_p, Z modulo a prime */
};
#define OAKLEY_GRP_1 1
Index: sysdep.h
===================================================================
--- sysdep.h (revision 55)
+++ sysdep.h (working copy)
@@ -6,8 +6,8 @@
int tun_open(char *dev);
int tun_close(int fd, char *dev);
-int tun_write(int fd, char *buf, int len);
-int tun_read(int fd, char *buf, int len);
+int tun_write(int fd, unsigned char *buf, int len);
+int tun_read(int fd, unsigned char *buf, int len);
#if defined(__linux__)
#include <error.h>
Index: sysdep-bsd.c
===================================================================
--- sysdep-bsd.c (revision 55)
+++ sysdep-bsd.c (working copy)
@@ -82,7 +82,7 @@
};
/* Read/write frames from TUN device */
-int tun_write(int fd, char *buf, int len)
+int tun_write(int fd, unsigned char *buf, int len)
{
char *data;
struct tun_data tun;
@@ -98,7 +98,7 @@
return write(fd, data, len) - (sizeof(tun) - sizeof(tun.data));
}
-int tun_read(int fd, char *buf, int len)
+int tun_read(int fd, unsigned char *buf, int len)
{
struct tun_data tun;
char *data;
Index: isakmp-pkt.h
===================================================================
--- isakmp-pkt.h (revision 55)
+++ isakmp-pkt.h (working copy)
@@ -33,7 +33,7 @@
isakmp_attr_lots,
isakmp_attr_16,
isakmp_attr_2x8,
- isakmp_attr_acl,
+ isakmp_attr_acl
} af;
union {
uint16_t attr_16;
Index: isakmp.h
===================================================================
--- isakmp.h (revision 55)
+++ isakmp.h (working copy)
@@ -43,7 +43,7 @@
ISAKMP_PAYLOAD_MODECFG_ATTR,
ISAKMP_PAYLOAD_NAT_D,
ISAKMP_PAYLOAD_NAT_OA,
- ISAKMP_PAYLOAD_NAT_D_OLD = 0x82,
+ ISAKMP_PAYLOAD_NAT_D_OLD = 0x82
};
/* Exchange types. */
@@ -180,7 +180,7 @@
IKE_GROUP_EC2N_409sect,
IKE_GROUP_EC2N_409K,
IKE_GROUP_EC2N_571sect,
- IKE_GROUP_EC2N_571K,
+ IKE_GROUP_EC2N_571K
};
/* IKE group type IDs. */
@@ -264,7 +264,7 @@
ISAKMP_IPSEC_ESP_AES_RC6,
ISAKMP_IPSEC_ESP_AES_RIJNDAEL,
ISAKMP_IPSEC_ESP_AES_SERPENT,
- ISAKMP_IPSEC_ESP_AES_TWOFISH,
+ ISAKMP_IPSEC_ESP_AES_TWOFISH
};
/* IPSEC attribute types. */
@@ -348,7 +348,7 @@
ISAKMP_XAUTH_ATTRIB_NEXT_PIN,
ISAKMP_XAUTH_ATTRIB_ANSWER, /* TYPE .. ANSWER is excluded from dump */
/* strange cisco things ... need docs! */
- ISAKMP_XAUTH_ATTRIB_CISCOEXT_VENDOR = 32136,
+ ISAKMP_XAUTH_ATTRIB_CISCOEXT_VENDOR = 32136
};
/* Support for draft-ietf-ipsec-isakmp-mode-cfg-05.txt (yuk). */
@@ -385,7 +385,7 @@
ISAKMP_MODECFG_ATTRIB_CISCO_DO_PFS = 28679,
ISAKMP_MODECFG_ATTRIB_CISCO_FW_TYPE,
ISAKMP_MODECFG_ATTRIB_CISCO_BACKUP_SERVER,
- ISAKMP_MODECFG_ATTRIB_CISCO_DDNS_HOSTNAME,
+ ISAKMP_MODECFG_ATTRIB_CISCO_DDNS_HOSTNAME
};
#endif
More information about the vpnc-devel
mailing list