From 44c90ce3f0c5f4686338b4b746b9bece8510d757 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Wed, 19 Dec 2007 14:13:34 +0200 Subject: Const-pedantry here and there... --- lib/rpmrc.c | 4 ++-- lib/transaction.c | 7 ++++--- rpmdb/header.c | 8 ++++---- rpmdb/tagname.c | 8 ++++---- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/rpmrc.c b/lib/rpmrc.c index a1533aba8..37d21e740 100644 --- a/lib/rpmrc.c +++ b/lib/rpmrc.c @@ -162,8 +162,8 @@ static void rpmRebuildTargetVars(const char **target, const char ** canontarget) static int optionCompare(const void * a, const void * b) { - return xstrcasecmp(((struct rpmOption *) a)->name, - ((struct rpmOption *) b)->name); + return xstrcasecmp(((const struct rpmOption *) a)->name, + ((const struct rpmOption *) b)->name); } static machCacheEntry diff --git a/lib/transaction.c b/lib/transaction.c index 9f400c530..1182a8522 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -653,7 +653,7 @@ static void skipFiles(const rpmts ts, rpmfi fi) int noConfigs = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOCONFIGS); int noDocs = (rpmtsFlags(ts) & RPMTRANS_FLAG_NODOCS); char ** netsharedPaths = NULL; - const char ** languages; + char ** languages; const char * dn, * bn; size_t dnlen, bnlen; char * s; @@ -675,7 +675,7 @@ static void skipFiles(const rpmts ts, rpmfi fi) if (!(s && *s != '%')) s = _free(s); if (s) { - languages = (const char **) splitString(s, strlen(s), ':'); + languages = splitString(s, strlen(s), ':'); s = _free(s); } else languages = NULL; @@ -761,7 +761,8 @@ static void skipFiles(const rpmts ts, rpmfi fi) * Skip i18n language specific files. */ if (languages != NULL && fi->flangs != NULL && *fi->flangs[i]) { - const char **lang, *l, *le; + const char *l, *le; + char **lang; for (lang = languages; *lang != NULL; lang++) { if (!strcmp(*lang, "all")) break; diff --git a/rpmdb/header.c b/rpmdb/header.c index 09f7c032a..24db54558 100644 --- a/rpmdb/header.c +++ b/rpmdb/header.c @@ -3126,7 +3126,7 @@ static char * octalFormat(rpm_tagtype_t type, hPTR_t data, } else { val = xmalloc(20 + padding); strcat(formatPrefix, "o"); - sprintf(val, formatPrefix, *((int32_t *) data)); + sprintf(val, formatPrefix, *((const int32_t *) data)); } return val; @@ -3151,7 +3151,7 @@ static char * hexFormat(rpm_tagtype_t type, hPTR_t data, } else { val = xmalloc(20 + padding); strcat(formatPrefix, "x"); - sprintf(val, formatPrefix, *((int32_t *) data)); + sprintf(val, formatPrefix, *((const int32_t *) data)); } return val; @@ -3175,7 +3175,7 @@ static char * realDateFormat(rpm_tagtype_t type, hPTR_t data, strcat(formatPrefix, "s"); /* this is important if sizeof(int32_t) ! sizeof(time_t) */ - { time_t dateint = *((int32_t *) data); + { time_t dateint = *((const int32_t *) data); tstruct = localtime(&dateint); } buf[0] = '\0'; @@ -3236,7 +3236,7 @@ static char * shescapeFormat(rpm_tagtype_t type, hPTR_t data, if (type == RPM_INT32_TYPE) { result = xmalloc(padding + 20); strcat(formatPrefix, "d"); - sprintf(result, formatPrefix, *((int32_t *) data)); + sprintf(result, formatPrefix, *((const int32_t *) data)); } else { buf = alloca(strlen(data) + padding + 2); strcat(formatPrefix, "s"); diff --git a/rpmdb/tagname.c b/rpmdb/tagname.c index de7f1b549..2e6e20b7b 100644 --- a/rpmdb/tagname.c +++ b/rpmdb/tagname.c @@ -31,8 +31,8 @@ struct headerTagIndices_s { */ static int tagCmpName(const void * avp, const void * bvp) { - headerTagTableEntry a = *(headerTagTableEntry *) avp; - headerTagTableEntry b = *(headerTagTableEntry *) bvp; + headerTagTableEntry a = *(const headerTagTableEntry *) avp; + headerTagTableEntry b = *(const headerTagTableEntry *) bvp; return strcmp(a->name, b->name); } @@ -44,8 +44,8 @@ static int tagCmpName(const void * avp, const void * bvp) */ static int tagCmpValue(const void * avp, const void * bvp) { - headerTagTableEntry a = *(headerTagTableEntry *) avp; - headerTagTableEntry b = *(headerTagTableEntry *) bvp; + headerTagTableEntry a = *(const headerTagTableEntry *) avp; + headerTagTableEntry b = *(const headerTagTableEntry *) bvp; int ret = (a->val - b->val); /* Make sure that sort is stable, longest name first. */ if (ret == 0) -- cgit v1.2.3