From: guy Date: Wed, 24 Apr 2002 06:27:05 +0000 (+0000) Subject: Get rid of casts of pointers-to-const to pointers-to-nonconst. X-Git-Tag: tcpdump-3.8-bp~516 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/2fd1118636e3b33d28037eb9f19b06061da72416 Get rid of casts of pointers-to-const to pointers-to-nonconst. --- diff --git a/nfsfh.h b/nfsfh.h index db87af4e..0bca424a 100644 --- a/nfsfh.h +++ b/nfsfh.h @@ -1,4 +1,4 @@ -/* @(#) $Header: /tcpdump/master/tcpdump/nfsfh.h,v 1.12 2001-09-17 21:57:52 fenner Exp $ (LBL) */ +/* @(#) $Header: /tcpdump/master/tcpdump/nfsfh.h,v 1.13 2002-04-24 06:27:05 guy Exp $ (LBL) */ /* * Copyright (c) 1993, 1994 Jeffrey C. Mogul, Digital Equipment Corporation, @@ -65,4 +65,4 @@ typedef struct { #define fsid_eq(a,b) ((a.fsid_code == b.fsid_code) &&\ dev_eq(a.Fsid_dev, b.Fsid_dev)) -extern void Parse_fh(caddr_t *, int, my_fsid *, ino_t *, const char **, const char **, int); +extern void Parse_fh(const unsigned char *, int, my_fsid *, ino_t *, const char **, const char **, int); diff --git a/parsenfsfh.c b/parsenfsfh.c index eb1313ff..57e39681 100644 --- a/parsenfsfh.c +++ b/parsenfsfh.c @@ -42,7 +42,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.23 2001-09-17 21:57:53 fenner Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.24 2002-04-24 06:27:06 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -108,11 +108,11 @@ static const char rcsid[] = ((lsb) + ((e)<<8) + ((d)<<16) + ((c)<<24)) #endif -static int is_UCX(unsigned char *); +static int is_UCX(const unsigned char *); void Parse_fh(fh, len, fsidp, inop, osnamep, fsnamep, ourself) -register caddr_t *fh; +register const unsigned char *fh; int len; my_fsid *fsidp; ino_t *inop; @@ -120,7 +120,7 @@ const char **osnamep; /* if non-NULL, return OS name here */ const char **fsnamep; /* if non-NULL, return server fs name here (for VMS) */ int ourself; /* true if file handle was generated on this host */ { - register unsigned char *fhp = (unsigned char *)fh; + register const unsigned char *fhp = fh; u_int32_t temp; int fhtype = FHT_UNKNOWN; int i; @@ -436,7 +436,7 @@ int ourself; /* true if file handle was generated on this host */ */ static int is_UCX(fhp) -unsigned char *fhp; +const unsigned char *fhp; { register int i; int seen_null = 0; diff --git a/print-nfs.c b/print-nfs.c index b2acbc96..c295fd7a 100644 --- a/print-nfs.c +++ b/print-nfs.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.90 2002-02-18 08:56:45 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.91 2002-04-24 06:27:06 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -756,9 +756,10 @@ nfs_printfh(register const u_int32_t *dp, const u_int len) { my_fsid fsid; ino_t ino; - char *sfsname = NULL; + const char *sfsname = NULL; + char *spacep; - Parse_fh((caddr_t*)dp, len, &fsid, &ino, NULL, (const char **)&sfsname, 0); + Parse_fh((const u_char *)dp, len, &fsid, &ino, NULL, &sfsname, 0); if (sfsname) { /* file system ID is ASCII, not numeric, for this server OS */ @@ -768,9 +769,9 @@ nfs_printfh(register const u_int32_t *dp, const u_int len) strncpy(temp, sfsname, NFSX_V3FHMAX); temp[sizeof(temp) - 1] = '\0'; /* Remove trailing spaces */ - sfsname = strchr(temp, ' '); - if (sfsname) - *sfsname = 0; + spacep = strchr(temp, ' '); + if (spacep) + *spacep = '\0'; (void)printf(" fh %s/", temp); } else {