RPM Package Manager, CVS Repository
http://rpm5.org/cvs/
____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson
Root: /v/rpm/cvs Email: jbj@rpm5.org
Module: rpm Date: 15-Nov-2007 17:29:03
Branch: HEAD Handle: 2007111516290101
Modified files:
rpm CHANGES
rpm/rpmio .splintrc LzmaDecode.c argv.c lookup3.c macro.c
rpmdav.c rpmhash.c rpmio.c rpmpgp.c rpmrpc.c
strcasecmp.c
Log:
- rpmio: casts for character <-> integral conversions.
Summary:
Revision Changes Path
1.1827 +1 -0 rpm/CHANGES
1.16 +0 -1 rpm/rpmio/.splintrc
1.4 +8 -8 rpm/rpmio/LzmaDecode.c
1.6 +3 -3 rpm/rpmio/argv.c
1.3 +2 -2 rpm/rpmio/lookup3.c
2.151 +54 -53 rpm/rpmio/macro.c
2.51 +5 -5 rpm/rpmio/rpmdav.c
1.6 +3 -3 rpm/rpmio/rpmhash.c
1.101 +6 -6 rpm/rpmio/rpmio.c
2.69 +3 -3 rpm/rpmio/rpmpgp.c
2.60 +17 -17 rpm/rpmio/rpmrpc.c
2.6 +6 -6 rpm/rpmio/strcasecmp.c
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.1826 -r1.1827 CHANGES
--- rpm/CHANGES 15 Nov 2007 14:30:25 -0000 1.1826
+++ rpm/CHANGES 15 Nov 2007 16:29:01 -0000 1.1827
@@ -1,4 +1,5 @@
5.0a1 -> 5.0a2:
+ - jbj: rpmio: casts for character <-> integral conversions.
- jbj: first pass through header.c converting to uint32_t everywhere.
- jbj: get rid of splint spew before chasing header.c integers.
- jbj: use splint to check integral types, eliminate the easy stuff.
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/.splintrc
============================================================================
$ cvs diff -u -r1.15 -r1.16 .splintrc
--- rpm/rpmio/.splintrc 6 Oct 2007 21:33:50 -0000 1.15
+++ rpm/rpmio/.splintrc 15 Nov 2007 16:29:01 -0000 1.16
@@ -71,6 +71,5 @@
# --- not-yet at standard level
-boolops # 117
+boolint # 11
-+charint # 146
+ignorequals # 112
+matchanyintegral # 39
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/LzmaDecode.c
============================================================================
$ cvs diff -u -r1.3 -r1.4 LzmaDecode.c
--- rpm/rpmio/LzmaDecode.c 10 Jul 2007 12:07:43 -0000 1.3
+++ rpm/rpmio/LzmaDecode.c 15 Nov 2007 16:29:01 -0000 1.4
@@ -129,14 +129,14 @@
if (size < LZMA_PROPERTIES_SIZE)
return LZMA_RESULT_DATA_ERROR;
prop0 = propsData[0];
- if (prop0 >= (9 * 5 * 5))
+ if (prop0 >= (unsigned char)(9 * 5 * 5))
return LZMA_RESULT_DATA_ERROR;
{
- for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5))
+ for (propsRes->pb = 0; prop0 >= (unsigned char)(9 * 5); propsRes->pb++, prop0 -= (unsigned char)(9 * 5))
{};
- for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9)
+ for (propsRes->lp = 0; prop0 >= (unsigned char)9; propsRes->lp++, prop0 -= (unsigned char)9)
{};
- propsRes->lc = prop0;
+ propsRes->lc = (int) prop0;
/*
unsigned char remainder = (unsigned char)(prop0 / 9);
propsRes->lc = prop0 % 9;
@@ -170,7 +170,7 @@
{
CProb *p = vs->Probs;
SizeT nowPos = 0;
- Byte previousByte = 0;
+ Byte previousByte = '\0';
UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1;
UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1;
int lc = vs->Properties.lc;
@@ -224,7 +224,7 @@
globalPos = 0;
distanceLimit = 0;
dictionaryPos = 0;
- dictionary[dictionarySize - 1] = 0;
+ dictionary[dictionarySize - 1] = (Byte)0;
#ifdef _LZMA_IN_CB
RC_INIT;
#else
@@ -302,7 +302,7 @@
+ globalPos
#endif
)
- & literalPosMask) << lc) + (previousByte >> (8 - lc))));
+ & literalPosMask) << lc) + (UInt32)(previousByte >> (8 - lc))));
if (state >= kNumLitStates)
{
@@ -311,7 +311,7 @@
UInt32 pos = dictionaryPos - rep0;
if (pos >= dictionarySize)
pos += dictionarySize;
- matchByte = dictionary[pos];
+ matchByte = (int) dictionary[pos];
#else
matchByte = outStream[nowPos - rep0];
#endif
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/argv.c
============================================================================
$ cvs diff -u -r1.5 -r1.6 argv.c
--- rpm/rpmio/argv.c 6 Oct 2007 19:40:23 -0000 1.5
+++ rpm/rpmio/argv.c 15 Nov 2007 16:29:01 -0000 1.6
@@ -170,12 +170,12 @@
if (seps == NULL)
seps = whitespace;
- for (argc = 1, s = str, t = dest; (c = *s); s++, t++) {
+ for (argc = 1, s = str, t = dest; (c = (int) *s); s++, t++) {
if (strchr(seps, c)) {
argc++;
- c = '\0';
+ c = (int) '\0';
}
- *t = c;
+ *t = (char) c;
}
*t = '\0';
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/lookup3.c
============================================================================
$ cvs diff -u -r1.2 -r1.3 lookup3.c
--- rpm/rpmio/lookup3.c 25 May 2007 18:34:14 -0000 1.2
+++ rpm/rpmio/lookup3.c 15 Nov 2007 16:29:01 -0000 1.3
@@ -50,8 +50,8 @@
const uint32_t ui;
const unsigned char uc[4];
} endian = { .ui = 0x11223344 };
-# define HASH_LITTLE_ENDIAN (endian.uc[0] == 0x44)
-# define HASH_BIG_ENDIAN (endian.uc[0] == 0x11)
+# define HASH_LITTLE_ENDIAN (endian.uc[0] == (unsigned char) 0x44)
+# define HASH_BIG_ENDIAN (endian.uc[0] == (unsigned char) 0x11)
/*@=redef@*/
#ifndef ROTL32
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/macro.c
============================================================================
$ cvs diff -u -r2.150 -r2.151 macro.c
--- rpm/rpmio/macro.c 15 Nov 2007 14:56:21 -0000 2.150
+++ rpm/rpmio/macro.c 15 Nov 2007 16:29:01 -0000 2.151
@@ -6,9 +6,9 @@
#include <stdarg.h>
#if !defined(isblank)
-#define isblank(_c) ((_c) == ' ' || (_c) == '\t')
+#define isblank(_c) ((char)(_c) == ' ' || (char)(_c) == '\t')
#endif
-#define iseol(_c) ((_c) == '\n' || (_c) == '\r')
+#define iseol(_c) ((char)(_c) == '\n' || (char)(_c) == '\r')
#define STREQ(_t, _f, _fn) ((_fn) == (sizeof(_t)-1) && !strncmp((_t), (_f), (_fn)))
@@ -112,7 +112,7 @@
MacroContext mc;
} * MacroBuf;
-#define SAVECHAR(_mb, _c) { *(_mb)->t = (_c), (_mb)->t++, (_mb)->nb--; }
+#define SAVECHAR(_mb, _c) { *(_mb)->t = (char) (_c), (_mb)->t++, (_mb)->nb--; }
/*@-exportlocal -exportheadervar@*/
@@ -527,25 +527,25 @@
#define SKIPBLANK(_s, _c) \
/*@-globs@*/ /* FIX: __ctype_b */ \
- while (((_c) = *(_s)) && isblank(_c)) \
+ while (((_c) = (int) *(_s)) && isblank(_c)) \
(_s)++; \
/*@=globs@*/
#define SKIPNONBLANK(_s, _c) \
/*@-globs@*/ /* FIX: __ctype_b */ \
- while (((_c) = *(_s)) && !(isblank(_c) || iseol(_c))) \
+ while (((_c) = (int) *(_s)) && !(isblank(_c) || iseol(_c))) \
(_s)++; \
/*@=globs@*/
#define COPYNAME(_ne, _s, _c) \
{ SKIPBLANK(_s,_c); \
- while(((_c) = *(_s)) && (xisalnum(_c) || (_c) == '_')) \
+ while(((_c) = (int) *(_s)) && (xisalnum(_c) || (_c) == (int) '_')) \
*(_ne)++ = *(_s)++; \
*(_ne) = '\0'; \
}
#define COPYOPTS(_oe, _s, _c) \
- { while(((_c) = *(_s)) && (_c) != ')') \
+ { while(((_c) = (int) *(_s)) && (_c) != (int) ')') \
*(_oe)++ = *(_s)++; \
*(_oe) = '\0'; \
}
@@ -698,13 +698,13 @@
char *o = NULL, *oe;
char *b, *be;
int c;
- int oc = ')';
+ int oc = (int) ')';
SKIPBLANK(s, c);
- if (c == '.') /* XXX readonly macros */
- *n++ = c = *s++;
- if (c == '.') /* XXX readonly macros */
- *n++ = c = *s++;
+ if (c == (int) '.') /* XXX readonly macros */
+/*@i@*/ *n++ = c = *s++;
+ if (c == (int) '.') /* XXX readonly macros */
+/*@i@*/ *n++ = c = *s++;
ne = n;
/* Copy name */
@@ -722,8 +722,8 @@
/* Copy body, skipping over escaped newlines */
b = be = oe + 1;
SKIPBLANK(s, c);
- if (c == '{') { /* XXX permit silent {...} grouping */
- if ((se = matchchar(s, c, '}')) == NULL) {
+ if (c == (int) '{') { /* XXX permit silent {...} grouping */
+ if ((se = matchchar(s, (char) c, '}')) == NULL) {
rpmlog(RPMLOG_ERR,
_("Macro %%%s has unterminated body\n"), n);
se = s; /* XXX W2DO? */
@@ -770,7 +770,7 @@
/* Trim trailing blanks/newlines */
/*@-globs@*/
- while (--be >= b && (c = *be) && (isblank(c) || iseol(c)))
+ while (--be >= b && (c = (int) *be) && (isblank(c) || iseol(c)))
{};
/*@=globs@*/
*(++be) = '\0'; /* one too far */
@@ -782,14 +782,14 @@
se = s;
/* Names must start with alphabetic or _ and be at least 3 chars */
- if (!((c = *n) && (xisalpha(c) || c == '_') && (ne - n) > 2)) {
+ if (!((c = (int) *n) && (xisalpha(c) || c == (int) '_') && (ne - n) > 2)) {
rpmlog(RPMLOG_ERR,
_("Macro %%%s has illegal name (%%define)\n"), n);
return se;
}
/* Options must be terminated with ')' */
- if (o && oc != ')') {
+ if (o && oc != (int) ')') {
rpmlog(RPMLOG_ERR, _("Macro %%%s has unterminated opts\n"), n);
return se;
}
@@ -839,7 +839,7 @@
se = s;
/* Names must start with alphabetic or _ and be at least 3 chars */
- if (!((c = *n) && (xisalpha(c) || c == '_') && (ne - n) > 2)) {
+ if (!((c = (int) *n) && (xisalpha(c) || c == (int) '_') && (ne - n) > 2)) {
rpmlog(RPMLOG_ERR,
_("Macro %%%s has illegal name (%%undefine)\n"), n);
return se;
@@ -1005,10 +1005,10 @@
/* Copy args into buf until lastc */
*be++ = ' ';
- while ((c = *se++) != '\0' && (se-1) != lastc) {
+ while ((c = (int) *se++) != (int) '\0' && (se-1) != lastc) {
/*@-globs@*/
if (!isblank(c)) {
- *be++ = c;
+ *be++ = (char) c;
continue;
}
/*@=globs@*/
@@ -1019,7 +1019,7 @@
*be++ = ' ';
argc++;
}
- if (c == '\0') se--; /* one too far */
+ if (c == (int) '\0') se--; /* one too far */
if (be[-1] != ' ')
argc++, be++; /* last word has not trailing ' ' */
be[-1] = '\0';
@@ -1084,22 +1084,22 @@
while((c = getopt(argc, (char **)argv, opts)) != -1)
/*@=nullstate@*/
{
- if (c == '?' || (o = strchr(opts, c)) == NULL) {
+ if (c == (int) '?' || (o = strchr(opts, c)) == NULL) {
rpmlog(RPMLOG_ERR, _("Unknown option %c in %s(%s)\n"),
(char)c, me->name, opts);
return se;
}
*be++ = '-';
- *be++ = c;
+ *be++ = (char) c;
if (o[1] == ':') {
*be++ = ' ';
be = stpcpy(be, optarg);
}
*be++ = '\0';
- aname[0] = '-'; aname[1] = c; aname[2] = '\0';
+ aname[0] = '-'; aname[1] = (char)c; aname[2] = '\0';
addMacro(mb->mc, aname, NULL, b, mb->depth);
if (o[1] == ':') {
- aname[0] = '-'; aname[1] = c; aname[2] = '*'; aname[3] = '\0';
+ aname[0] = '-'; aname[1] = (char)c; aname[2] = '*'; aname[3] = '\0';
addMacro(mb->mc, aname, NULL, optarg, mb->depth);
}
be = b; /* reuse the space */
@@ -1214,10 +1214,10 @@
} else if (STREQ("uncompress", f, fn)) {
rpmCompressedMagic compressed = COMPRESSED_OTHER;
/*@-globs@*/
- for (b = buf; (c = *b) && isblank(c);)
+ for (b = buf; (c = (int)*b) && isblank(c);)
b++;
/* XXX FIXME: file paths with embedded white space needs rework. */
- for (be = b; (c = *be) && !isblank(c);)
+ for (be = b; (c = (int)*be) && !isblank(c);)
be++;
/*@=globs@*/
*be++ = '\0';
@@ -1246,10 +1246,10 @@
b = be;
} else if (STREQ("mkstemp", f, fn)) {
/*@-globs@*/
- for (b = buf; (c = *b) && isblank(c);)
+ for (b = buf; (c = (int)*b) && isblank(c);)
b++;
/* XXX FIXME: file paths with embedded white space needs rework. */
- for (be = b; (c = *be) && !isblank(c);)
+ for (be = b; (c = (int)*be) && !isblank(c);)
be++;
/*@=globs@*/
#if defined(HAVE_MKSTEMP)
@@ -1258,7 +1258,7 @@
(void) mktemp(b);
#endif
} else if (STREQ("S", f, fn)) {
- for (b = buf; (c = *b) && xisdigit(c);)
+ for (b = buf; (c = (int)*b) && xisdigit(c);)
b++;
if (!c) { /* digit index */
b++;
@@ -1266,7 +1266,7 @@
} else
b = buf;
} else if (STREQ("P", f, fn)) {
- for (b = buf; (c = *b) && xisdigit(c);)
+ for (b = buf; (c = (int) *b) && xisdigit(c);)
b++;
if (!c) { /* digit index */
b++;
@@ -1320,12 +1320,12 @@
return 1;
}
- while (rc == 0 && mb->nb > 0 && (c = *s) != '\0') {
+ while (rc == 0 && mb->nb > 0 && (c = (int)*s) != (int)'\0') {
s++;
/* Copy text until next macro */
switch(c) {
case '%':
- if (*s) { /* Ensure not end-of-string. */
+ if (*s != '\0') { /* Ensure not end-of-string. */
if (*s != '%')
/*@switchbreak@*/ break;
s++; /* skip first % in %% */
@@ -1345,7 +1345,7 @@
negate = 0;
lastc = NULL;
chkexist = 0;
- switch ((c = *s)) {
+ switch ((c = (int) *s)) {
default: /* %name substitution */
while (*s != '\0' && strchr("!?", *s) != NULL) {
switch(*s++) {
@@ -1360,7 +1360,7 @@
f = se = s;
if (*se == '-')
se++;
- while((c = *se) && (xisalnum(c) || c == '_'))
+ while((c = (int) *se) && (xisalnum(c) || c == (int) '_'))
se++;
/* Recognize non-alnum macros too */
switch (*se) {
@@ -1377,13 +1377,13 @@
fe = se;
/* For "%name " macros ... */
/*@-globs@*/
- if ((c = *fe) && isblank(c))
+ if ((c = (int) *fe) && isblank(c))
if ((lastc = strchr(fe,'\n')) == NULL)
lastc = strchr(fe, '\0');
/*@=globs@*/
/*@switchbreak@*/ break;
case '(': /* %(...) shell escape */
- if ((se = matchchar(s, c, ')')) == NULL) {
+ if ((se = matchchar(s, (char)c, ')')) == NULL) {
rpmlog(RPMLOG_ERR,
_("Unterminated %c: %s\n"), (char)c, s);
rc = 1;
@@ -1400,7 +1400,7 @@
continue;
/*@notreached@*/ /*@switchbreak@*/ break;
case '{': /* %{...}/%{...:...} substitution */
- if ((se = matchchar(s, c, '}')) == NULL) {
+ if ((se = matchchar(s, (char)c, '}')) == NULL) {
rpmlog(RPMLOG_ERR,
_("Unterminated %c: %s\n"), (char)c, s);
rc = 1;
@@ -1419,7 +1419,7 @@
}
}
/* Find end-of-expansion, handle %{foo:bar} expansions. */
- for (fe = f; (c = *fe) && !strchr(" :}", c);)
+ for (fe = f; (c = (int) *fe) && !strchr(" :}", c);)
fe++;
switch (c) {
case ':':
@@ -1440,7 +1440,7 @@
gn = (ge - g);
if ((fe - f) <= 0) {
/* XXX Process % in unknown context */
- c = '%'; /* XXX only need to save % */
+ c = (int) '%'; /* XXX only need to save % */
SAVECHAR(mb, c);
#if 0
rpmlog(RPMLOG_ERR,
@@ -1620,7 +1620,7 @@
}
#endif
/* XXX hack to permit non-overloaded %foo to be passed */
- c = '%'; /* XXX only need to save % */
+ c = (int) '%'; /* XXX only need to save % */
SAVECHAR(mb, c);
#else
if (!strncmp(f, "if", fn) ||
@@ -2074,12 +2074,13 @@
buf[0] = '\0';
while(rdcl(buf, bufn, fd) != NULL) {
- char c, *n;
+ char *n;
+ int c;
n = buf;
SKIPBLANK(n, c);
- if (c != '%')
+ if (c != (int) '%')
continue;
n++; /* skip % */
rc = rpmDefineMacro(mc, n, RMIL_MACROFILES);
@@ -2221,24 +2222,24 @@
if (magic[0] == 'B' && magic[1] == 'Z')
*compressed = COMPRESSED_BZIP2;
else
- if (magic[0] == 0120 && magic[1] == 0113
- && magic[2] == 0003 && magic[3] == 0004) /* pkzip */
+ if (magic[0] == (unsigned char) 0120 && magic[1] == (unsigned char) 0113
+ && magic[2] == (unsigned char) 0003 && magic[3] == (unsigned char) 0004) /* pkzip */
*compressed = COMPRESSED_ZIP;
else
- if (magic[0] == 0x89 && magic[1] == 'L'
+ if (magic[0] == (unsigned char) 0x89 && magic[1] == 'L'
&& magic[2] == 'Z' && magic[3] == 'O') /* lzop */
*compressed = COMPRESSED_LZOP;
else
/* XXX Ick, LZMA has no magic. See http://lkml.org/lkml/2005/6/13/285 */
- if (magic[ 9] == 0x00 && magic[10] == 0x00 &&
- magic[11] == 0x00 && magic[12] == 0x00) /* lzmash */
+ if (magic[ 9] == (unsigned char) 0x00 && magic[10] == (unsigned char) 0x00 &&
+ magic[11] == (unsigned char) 0x00 && magic[12] == (unsigned char) 0x00) /* lzmash */
*compressed = COMPRESSED_LZMA;
else
- if ((magic[0] == 0037 && magic[1] == 0213) /* gzip */
- || (magic[0] == 0037 && magic[1] == 0236) /* old gzip */
- || (magic[0] == 0037 && magic[1] == 0036) /* pack */
- || (magic[0] == 0037 && magic[1] == 0240) /* SCO lzh */
- || (magic[0] == 0037 && magic[1] == 0235)) /* compress */
+ if ((magic[0] == (unsigned char) 0037 && magic[1] == (unsigned char) 0213) /* gzip */
+ || (magic[0] == (unsigned char) 0037 && magic[1] == (unsigned char) 0236) /* old gzip */
+ || (magic[0] == (unsigned char) 0037 && magic[1] == (unsigned char) 0036) /* pack */
+ || (magic[0] == (unsigned char) 0037 && magic[1] == (unsigned char) 0240) /* SCO lzh */
+ || (magic[0] == (unsigned char) 0037 && magic[1] == (unsigned char) 0235)) /* compress */
*compressed = COMPRESSED_OTHER;
return rc;
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmdav.c
============================================================================
$ cvs diff -u -r2.50 -r2.51 rpmdav.c
--- rpm/rpmio/rpmdav.c 15 Nov 2007 14:56:21 -0000 2.50
+++ rpm/rpmio/rpmdav.c 15 Nov 2007 16:29:01 -0000 2.51
@@ -1728,8 +1728,8 @@
ac = 0;
/*@-dependenttrans -unrecog@*/
- dt[ac] = DT_DIR; av[ac++] = t; t = stpcpy(t, "."); t++;
- dt[ac] = DT_DIR; av[ac++] = t; t = stpcpy(t, ".."); t++;
+ dt[ac] = (unsigned char)DT_DIR; av[ac++] = t; t = stpcpy(t, "."); t++;
+ dt[ac] = (unsigned char)DT_DIR; av[ac++] = t; t = stpcpy(t, ".."); t++;
/*@=dependenttrans =unrecog@*/
av[ac] = NULL;
@@ -1878,8 +1878,8 @@
nac = 0;
/*@-dependenttrans -unrecog@*/
- dt[nac] = DT_DIR; nav[nac++] = t; t = stpcpy(t, "."); t++;
- dt[nac] = DT_DIR; nav[nac++] = t; t = stpcpy(t, ".."); t++;
+ dt[nac] = (unsigned char)DT_DIR; nav[nac++] = t; t = stpcpy(t, "."); t++;
+ dt[nac] = (unsigned char)DT_DIR; nav[nac++] = t; t = stpcpy(t, ".."); t++;
/*@=dependenttrans =unrecog@*/
/* Copy DAV items into DIR elments. */
@@ -1887,7 +1887,7 @@
if (av != NULL)
while (av[ac] != NULL) {
nav[nac] = t;
- dt[nac] = (S_ISDIR(ctx->modes[ac]) ? DT_DIR : DT_REG);
+ dt[nac] = (unsigned char) (S_ISDIR(ctx->modes[ac]) ? DT_DIR : DT_REG);
t = stpcpy(t, av[ac]);
ac++;
t++;
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmhash.c
============================================================================
$ cvs diff -u -r1.5 -r1.6 rpmhash.c
--- rpm/rpmio/rpmhash.c 4 Nov 2007 01:14:29 -0000 1.5
+++ rpm/rpmio/rpmhash.c 15 Nov 2007 16:29:01 -0000 1.6
@@ -78,8 +78,8 @@
/*@*/
{
const char * chp = data;
- unsigned char sum = 0;
- unsigned char xor = 0;
+ unsigned char sum = (unsigned char)0;
+ unsigned char xor = (unsigned char)0;
int i;
if (size == 0)
@@ -89,7 +89,7 @@
sum += *chp;
}
- h += ((size << 16) + (sum << 8) + xor);
+ h += ((uint32_t)(size << 16) + (uint32_t)(sum << 8) + (uint32_t)xor);
return h;
}
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmio.c
============================================================================
$ cvs diff -u -r1.100 -r1.101 rpmio.c
--- rpm/rpmio/rpmio.c 11 Nov 2007 02:23:45 -0000 1.100
+++ rpm/rpmio/rpmio.c 15 Nov 2007 16:29:01 -0000 1.101
@@ -996,7 +996,7 @@
ctrl->contentLength = -1;
if ((e = strchr(s, '.')) != NULL) {
e++;
- u->httpVersion = *e - '0';
+ u->httpVersion = (int)(*e - '0');
if (u->httpVersion < 1 || u->httpVersion > 2)
ctrl->persist = u->httpVersion = 0;
else
@@ -1632,13 +1632,13 @@
/* XXX these aren't worth the pain of including correctly */
#if !defined(IAC)
-#define IAC 255 /* interpret as command: */
+#define IAC ((unsigned char)255) /* interpret as command: */
#endif
#if !defined(IP)
-#define IP 244 /* interrupt process--permanently */
+#define IP ((unsigned char)244) /* interrupt process--permanently */
#endif
#if !defined(DM)
-#define DM 242 /* data mark--for connect. cleaning */
+#define DM ((unsigned char)242) /* data mark--for connect. cleaning */
#endif
#if !defined(SHUT_RDWR)
#define SHUT_RDWR 1+1
@@ -3816,7 +3816,7 @@
if (blen) {
int nb;
b = xmalloc(blen+1);
- b[0] = '\0';
+ b[0] = (byte) '\0';
nb = Fread(b, sizeof(*b), blen, fd);
if (Ferror(fd) || (size > 0 && nb != blen)) {
rc = 1;
@@ -3826,7 +3826,7 @@
blen = nb;
b = xrealloc(b, blen+1);
}
- b[blen] = '\0';
+ b[blen] = (byte) '\0';
}
exit:
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmpgp.c
============================================================================
$ cvs diff -u -r2.68 -r2.69 rpmpgp.c
--- rpm/rpmio/rpmpgp.c 15 Nov 2007 15:13:07 -0000 2.68
+++ rpm/rpmio/rpmpgp.c 15 Nov 2007 16:29:02 -0000 2.69
@@ -848,11 +848,11 @@
fprintf(stderr, " ");
while (i > 0) {
int j;
- if (*h >= ' ' && *h <= 'z') {
+ if (*h >= (byte)' ' && *h <= (byte)'z') {
j = 0;
- while (j < i && h[j] != '\0')
+ while (j < i && h[j] != (byte)'\0')
j++;
- while (j < i && h[j] == '\0')
+ while (j < i && h[j] == (byte)'\0')
j++;
if (_print && j)
fprintf(stderr, "%.*s", (int)strlen((const char *)h), (const char *)h);
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmrpc.c
============================================================================
$ cvs diff -u -r2.59 -r2.60 rpmrpc.c
--- rpm/rpmio/rpmrpc.c 11 Oct 2007 22:35:36 -0000 2.59
+++ rpm/rpmio/rpmrpc.c 15 Nov 2007 16:29:02 -0000 2.60
@@ -416,7 +416,7 @@
for (numcols = 0; *p && numcols < MAXCOLS; numcols++){
while (*p == ' ' || *p == '\r' || *p == '\n'){
- *p = 0;
+ *p = '\0';
p++;
}
columns [numcols] = p;
@@ -872,9 +872,9 @@
t = g_strdup (p_copy + column_ptr [idx2+1]);
tlen = strlen (t);
if (t [tlen-1] == '\r' || t [tlen-1] == '\n')
- t [tlen-1] = 0;
+ t [tlen-1] = '\0';
if (t [tlen-2] == '\r' || t [tlen-2] == '\n')
- t [tlen-2] = 0;
+ t [tlen-2] = '\0';
*linkname = t;
}
@@ -893,9 +893,9 @@
tlen = strlen (t);
/* g_strchomp(); */
if (t [tlen-1] == '\r' || t [tlen-1] == '\n')
- t [tlen-1] = 0;
+ t [tlen-1] = '\0';
if (t [tlen-2] == '\r' || t [tlen-2] == '\n')
- t [tlen-2] = 0;
+ t [tlen-2] = '\0';
*filename = t;
}
@@ -1227,7 +1227,7 @@
ac = 2;
sb = NULL;
s = se = ftpBuf;
- while ((c = *se) != '\0') {
+ while ((c = (int) *se) != (int) '\0') {
se++;
switch (c) {
case '/':
@@ -1276,12 +1276,12 @@
ac = 0;
/*@-dependenttrans -unrecog@*/
- dt[ac] = DT_DIR; av[ac++] = t; t = stpcpy(t, "."); t++;
- dt[ac] = DT_DIR; av[ac++] = t; t = stpcpy(t, ".."); t++;
+ dt[ac] = (unsigned char)DT_DIR; av[ac++] = t; t = stpcpy(t, "."); t++;
+ dt[ac] = (unsigned char)DT_DIR; av[ac++] = t; t = stpcpy(t, ".."); t++;
/*@=dependenttrans =unrecog@*/
sb = NULL;
s = se = ftpBuf;
- while ((c = *se) != '\0') {
+ while ((c = (int) *se) != (int) '\0') {
se++;
switch (c) {
case '/':
@@ -1295,28 +1295,28 @@
/*@-unrecog@*/
switch(*s) {
case 'p':
- dt[ac] = DT_FIFO;
+ dt[ac] = (unsigned char) DT_FIFO;
/*@innerbreak@*/ break;
case 'c':
- dt[ac] = DT_CHR;
+ dt[ac] = (unsigned char) DT_CHR;
/*@innerbreak@*/ break;
case 'd':
- dt[ac] = DT_DIR;
+ dt[ac] = (unsigned char) DT_DIR;
/*@innerbreak@*/ break;
case 'b':
- dt[ac] = DT_BLK;
+ dt[ac] = (unsigned char) DT_BLK;
/*@innerbreak@*/ break;
case '-':
- dt[ac] = DT_REG;
+ dt[ac] = (unsigned char) DT_REG;
/*@innerbreak@*/ break;
case 'l':
- dt[ac] = DT_LNK;
+ dt[ac] = (unsigned char) DT_LNK;
/*@innerbreak@*/ break;
case 's':
- dt[ac] = DT_SOCK;
+ dt[ac] = (unsigned char) DT_SOCK;
/*@innerbreak@*/ break;
default:
- dt[ac] = DT_UNKNOWN;
+ dt[ac] = (unsigned char) DT_UNKNOWN;
/*@innerbreak@*/ break;
}
/*@=unrecog@*/
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/strcasecmp.c
============================================================================
$ cvs diff -u -r2.5 -r2.6 strcasecmp.c
--- rpm/rpmio/strcasecmp.c 6 Oct 2007 19:40:23 -0000 2.5
+++ rpm/rpmio/strcasecmp.c 15 Nov 2007 16:29:02 -0000 2.6
@@ -17,14 +17,14 @@
do
{
- c1 = xtolower (*p1++);
- c2 = xtolower (*p2++);
+ c1 = (char) xtolower ((int)*p1++);
+ c2 = (char) xtolower ((int)*p2++);
if (c1 == '\0')
break;
}
while (c1 == c2);
- return (int)(c1 - c2);
+ return ((int)c1 - (int)c2);
}
int xstrncasecmp(const char *s1, const char *s2, size_t n)
@@ -38,11 +38,11 @@
do
{
- c1 = xtolower (*p1++);
- c2 = xtolower (*p2++);
+ c1 = (char) xtolower ((int)*p1++);
+ c2 = (char) xtolower ((int)*p2++);
if (c1 == '\0' || c1 != c2)
break;
} while (--n > 0);
- return (int)(c1 - c2);
+ return ((int)c1 - (int)c2);
}
@@ .
Received on Thu Nov 15 17:29:03 2007