summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build/files.c2
-rw-r--r--build/pack.c2
-rw-r--r--build/parseChangelog.c8
-rw-r--r--build/parseScript.c2
-rw-r--r--build/spec.c2
-rw-r--r--lib/cpio.c9
-rw-r--r--lib/getdate.y2
-rw-r--r--lib/legacy.c2
-rw-r--r--lib/psm.c2
-rw-r--r--lib/rpmrc.c2
-rw-r--r--python/header-py.c5
-rw-r--r--rpmdb/header_internal.c2
-rw-r--r--rpmio/ugid.c4
-rw-r--r--rpmio/ugid.h4
-rw-r--r--tools/javadeps.c14
15 files changed, 33 insertions, 29 deletions
diff --git a/build/files.c b/build/files.c
index dc428a325..290503e17 100644
--- a/build/files.c
+++ b/build/files.c
@@ -920,7 +920,7 @@ static rpmRC parseForSimple(rpmSpec spec, Package pkg, char * buf,
} else {
/* XXX WATCHOUT: buf is an arg */
{
- static char *_docdir_fmt= 0;
+ static const char *_docdir_fmt = NULL;
static int oneshot = 0;
const char *ddir, *fmt, *errstr;
if (!oneshot) {
diff --git a/build/pack.c b/build/pack.c
index db6228302..d848057af 100644
--- a/build/pack.c
+++ b/build/pack.c
@@ -256,7 +256,7 @@ static rpmRC processScriptFiles(rpmSpec spec, Package pkg)
} else {
/* This is dumb. When the header supports NULL string */
/* this will go away. */
- char *bull = "";
+ const char *bull = "";
(void) headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTS,
RPM_STRING_ARRAY_TYPE, &bull, 1);
}
diff --git a/build/parseChangelog.c b/build/parseChangelog.c
index e62745370..0c532150f 100644
--- a/build/parseChangelog.c
+++ b/build/parseChangelog.c
@@ -41,11 +41,13 @@ void addChangelogEntry(Header h, time_t time, const char *name, const char *text
static int dateToTimet(const char * datestr, time_t * secs)
{
struct tm time;
- char * p, * pe, * q, ** idx;
+ const char ** idx;
+ char * p, * pe, * q;
+
char * date = strcpy(alloca(strlen(datestr) + 1), datestr);
-static char * days[] =
+static const char * days[] =
{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", NULL };
-static char * months[] =
+static const char * months[] =
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL };
static char lengths[] =
diff --git a/build/parseScript.c b/build/parseScript.c
index a4b3224d0..98c9fb21e 100644
--- a/build/parseScript.c
+++ b/build/parseScript.c
@@ -73,7 +73,7 @@ int parseScript(rpmSpec spec, int parsePart)
char *p;
const char **progArgv = NULL;
int progArgc;
- char *partname = NULL;
+ const char *partname = NULL;
rpm_tag_t reqtag = 0;
rpm_tag_t tag = 0;
int tagflags = 0;
diff --git a/build/spec.c b/build/spec.c
index 64d2a08bf..98a9cd4ef 100644
--- a/build/spec.c
+++ b/build/spec.c
@@ -246,7 +246,7 @@ int addSource(rpmSpec spec, Package pkg, const char *field, rpm_tag_t tag)
{
struct Source *p;
int flag = 0;
- char *name = NULL;
+ const char *name = NULL;
char *nump;
const char *fieldp = NULL;
char buf[BUFSIZ];
diff --git a/lib/cpio.c b/lib/cpio.c
index ef1aa381f..31ce96b93 100644
--- a/lib/cpio.c
+++ b/lib/cpio.c
@@ -177,17 +177,18 @@ int cpioHeaderRead(FSM_t fsm, struct stat * st)
const char * cpioStrerror(int rc)
{
static char msg[256];
- char *s;
+ const char *s;
int myerrno = errno;
size_t l;
strcpy(msg, "cpio: ");
switch (rc) {
- default:
- s = msg + strlen(msg);
- sprintf(s, _("(error 0x%x)"), (unsigned)rc);
+ default: {
+ char *t = msg + strlen(msg);
+ sprintf(t, _("(error 0x%x)"), (unsigned)rc);
s = NULL;
break;
+ }
case CPIOERR_BAD_MAGIC: s = _("Bad magic"); break;
case CPIOERR_BAD_HEADER: s = _("Bad/unreadable header");break;
diff --git a/lib/getdate.y b/lib/getdate.y
index 13dcad27e..fae70dc84 100644
--- a/lib/getdate.y
+++ b/lib/getdate.y
@@ -127,7 +127,7 @@ static int yyerror(const char * s);
** An entry in the lexical lookup table.
*/
typedef struct _TABLE {
- char *name;
+ const char *name;
int type;
time_t value;
} TABLE;
diff --git a/lib/legacy.c b/lib/legacy.c
index 709a9250d..735889dc2 100644
--- a/lib/legacy.c
+++ b/lib/legacy.c
@@ -178,7 +178,7 @@ void providePackageNVR(Header h)
*/
if (!hge(h, RPMTAG_PROVIDEVERSION, &pvt, (void **) &providesEVR, NULL)) {
for (i = 0; i < providesCount; i++) {
- char * vdummy = "";
+ const char * vdummy = "";
int32_t fdummy = RPMSENSE_ANY;
xx = headerAddOrAppendEntry(h, RPMTAG_PROVIDEVERSION, RPM_STRING_ARRAY_TYPE,
&vdummy, 1);
diff --git a/lib/psm.c b/lib/psm.c
index d54bc494d..e37459a87 100644
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -400,7 +400,7 @@ exit:
return rpmrc;
}
-static char * SCRIPT_PATH = "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin";
+static const char * SCRIPT_PATH = "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin";
/**
* Return scriptlet name from tag.
diff --git a/lib/rpmrc.c b/lib/rpmrc.c
index 9dea805bb..24f7f50b9 100644
--- a/lib/rpmrc.c
+++ b/lib/rpmrc.c
@@ -697,7 +697,7 @@ static rpmRC doReadRC( FD_t fd, const char * urlfn)
*/
static rpmRC rpmPlatform(const char * platform)
{
- char *cpu = NULL, *vendor = NULL, *os = NULL, *gnu = NULL;
+ const char *cpu = NULL, *vendor = NULL, *os = NULL, *gnu = NULL;
uint8_t * b = NULL;
ssize_t blen = 0;
int init_platform = 0;
diff --git a/python/header-py.c b/python/header-py.c
index e3f93605a..139979d6b 100644
--- a/python/header-py.c
+++ b/python/header-py.c
@@ -725,7 +725,7 @@ PyObject * rpmHeaderFromFD(PyObject * self, PyObject * args, PyObject * kwds)
FD_t fd;
int fileno;
PyObject * list;
- char * kwlist[] = {"fd", NULL};
+ const char * kwlist[] = {"fd", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", kwlist, &fileno))
return NULL;
@@ -929,7 +929,8 @@ static int compare_values(const char *str1, const char *str2)
PyObject * labelCompare (PyObject * self, PyObject * args)
{
- char *v1, *r1, *e1, *v2, *r2, *e2;
+ char *v1, *r1, *v2, *r2;
+ const char *e1, *e2;
int rc;
if (!PyArg_ParseTuple(args, "(zzz)(zzz)",
diff --git a/rpmdb/header_internal.c b/rpmdb/header_internal.c
index 15d99f26a..22a6b3002 100644
--- a/rpmdb/header_internal.c
+++ b/rpmdb/header_internal.c
@@ -36,7 +36,7 @@ void headerDump(Header h, FILE *f, int flags,
indexEntry p;
const struct headerTagTableEntry_s * tage;
const char * tag;
- char * type;
+ const char * type;
/* First write out the length of the index (count of index entries) */
fprintf(f, "Entry count: %d\n", h->indexUsed);
diff --git a/rpmio/ugid.c b/rpmio/ugid.c
index 32d7387fd..c256829ab 100644
--- a/rpmio/ugid.c
+++ b/rpmio/ugid.c
@@ -109,7 +109,7 @@ static char * lastGname = NULL;
return 0;
}
-char * uidToUname(uid_t uid)
+const char * uidToUname(uid_t uid)
{
static uid_t lastUid = (uid_t) -1;
static char * lastUname = NULL;
@@ -140,7 +140,7 @@ static char * lastUname = NULL;
}
}
-char * gidToGname(gid_t gid)
+const char * gidToGname(gid_t gid)
{
static gid_t lastGid = (gid_t) -1;
static char * lastGname = NULL;
diff --git a/rpmio/ugid.h b/rpmio/ugid.h
index 0ef555950..d3556ef14 100644
--- a/rpmio/ugid.h
+++ b/rpmio/ugid.h
@@ -19,8 +19,8 @@ int gnameToGid(const char * thisGname, gid_t * gid);
/*
* Call w/ -1 to flush the cache, returns NULL if the user can't be found.
*/
-char * uidToUname(uid_t uid);
-char * gidToGname(gid_t gid);
+const char * uidToUname(uid_t uid);
+const char * gidToGname(gid_t gid);
#ifdef __cplusplus
}
diff --git a/tools/javadeps.c b/tools/javadeps.c
index 8992ab44b..1922cedd8 100644
--- a/tools/javadeps.c
+++ b/tools/javadeps.c
@@ -84,10 +84,10 @@ typedef struct {
/*---------Global Variables, in all caps---------*/
/*name of this program*/
-char *PROGRAM_NAME=0;
+const char *PROGRAM_NAME=0;
/*name of the current class file*/
-char *FILE_NAME=0;
+const char *FILE_NAME=0;
/*the name of the last class file seen*/
char *CLASS_NAME=0;
@@ -139,10 +139,10 @@ int SIZE_PRINT_TABLE;
void usage (void);
void outofmemory(void);
-void die(char *format, ...);
+void die(const char *format, ...);
size_t my_fread(void *ptr, size_t size, size_t nitems, FILE *stream);
void check_range(short entryNum, short value, short poolSize);
-char *is_lower_equal (char *string, char *pattern);
+char *is_lower_equal (char *string, const char *pattern);
int findJavaMagic (FILE *fileHandle);
int my_strcmp (const void *a, const void *b);
void print_table_flush(void);
@@ -292,7 +292,7 @@ void outofmemory(void) {
}
-void die(char *format, ...) {
+void die(const char *format, ...) {
/* Most errors are fatal.
This function throws a fatal error and
accepts arguments like printf does*/
@@ -389,7 +389,7 @@ void check_range(short entryNum, short value, short poolSize) {
prefix of my strings. */
char
-*is_lower_equal (char *string, char *pattern)
+*is_lower_equal (char *string, const char *pattern)
{
while ( (tolower(*string) == *pattern) &&
@@ -1157,7 +1157,7 @@ void processJavaFile (FILE *fileHandle) {
CLASS_NAME=findClassName(fileHandle, &symbolTable);
if(ARG_DEPSFORMAT) {
- char *prefix_seperator = ": ";
+ const char *prefix_seperator = ": ";
format_class_name = formatClassName(CLASS_NAME, '\0', 0);