mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
Fix clang -Wcast-qual
issues
Remove unnecessary `char*` casting for arguments passed to `cget*(3)`, and deconst `_PATH_PRINTCAP` before passing it to `cget*` via the `printcapdb` variable. This unblocks ^/projects/runtime-coverage-v2 from building cleanly on universe13a.freebsd.org. I suspect the issue was introduced through some changes to `bsd.*.mk` inclusion on the branch, which I will continue to investigate/isolate. MFC after: 1 week Tested with: clang 8 (arm64)
This commit is contained in:
parent
0061238fb0
commit
a6e9cd258c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=347075
|
@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$");
|
|||
/*
|
||||
* Routines and data used in processing the printcap file.
|
||||
*/
|
||||
static char *printcapdb[2] = { _PATH_PRINTCAP, 0 }; /* list for cget* */
|
||||
static char *printcapdb[] = { __DECONST(char *, _PATH_PRINTCAP), NULL };
|
||||
|
||||
static char *capdb_canonical_name(const char *_bp);
|
||||
static int capdb_getaltlog(char *_bp, const char *_shrt,
|
||||
|
@ -99,15 +99,9 @@ int
|
|||
getprintcap(const char *printer, struct printer *pp)
|
||||
{
|
||||
int status;
|
||||
char *XXX;
|
||||
char *bp;
|
||||
|
||||
/*
|
||||
* A bug in the declaration of cgetent(3) means that we have
|
||||
* to hide the constness of its third argument.
|
||||
*/
|
||||
XXX = (char *)printer;
|
||||
if ((status = cgetent(&bp, printcapdb, XXX)) < 0)
|
||||
if ((status = cgetent(&bp, printcapdb, printer)) < 0)
|
||||
return status;
|
||||
status = getprintcap_int(bp, pp);
|
||||
free(bp);
|
||||
|
@ -380,10 +374,10 @@ capdb_getaltstr(char *bp, const char *shrt, const char *lng,
|
|||
{
|
||||
int status;
|
||||
|
||||
status = cgetstr(bp, (char *)/*XXX*/lng, result);
|
||||
status = cgetstr(bp, lng, result);
|
||||
if (status >= 0 || status == PCAPERR_OSERR)
|
||||
return status;
|
||||
status = cgetstr(bp, (char *)/*XXX*/shrt, result);
|
||||
status = cgetstr(bp, shrt, result);
|
||||
if (status >= 0 || status == PCAPERR_OSERR)
|
||||
return status;
|
||||
if (dflt) {
|
||||
|
@ -404,10 +398,10 @@ capdb_getaltnum(char *bp, const char *shrt, const char *lng, long dflt,
|
|||
{
|
||||
int status;
|
||||
|
||||
status = cgetnum(bp, (char *)/*XXX*/lng, result);
|
||||
status = cgetnum(bp, lng, result);
|
||||
if (status >= 0)
|
||||
return status;
|
||||
status = cgetnum(bp, (char *)/*XXX*/shrt, result);
|
||||
status = cgetnum(bp, shrt, result);
|
||||
if (status >= 0)
|
||||
return status;
|
||||
*result = dflt;
|
||||
|
@ -421,9 +415,9 @@ capdb_getaltnum(char *bp, const char *shrt, const char *lng, long dflt,
|
|||
static int
|
||||
capdb_getaltlog(char *bp, const char *shrt, const char *lng)
|
||||
{
|
||||
if (cgetcap(bp, (char *)/*XXX*/lng, ':'))
|
||||
if (cgetcap(bp, lng, ':'))
|
||||
return 1;
|
||||
if (cgetcap(bp, (char *)/*XXX*/shrt, ':'))
|
||||
if (cgetcap(bp, shrt, ':'))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue