- fix: use size_t consistently, avoid segfault on ia64.

CVS patchset: 5760
CVS date: 2002/10/09 19:07:43
This commit is contained in:
jbj 2002-10-09 19:07:43 +00:00
parent e7c99cdec3
commit d0ccee051f
17 changed files with 75 additions and 59 deletions

View File

@ -246,7 +246,7 @@ const char * b64encode_eolstr = B64ENCODE_EOLSTR;
/*@-boundswrite@*/
/*@-internalglobs -modfilesys @*/
char * b64encode (const void * data, int ns)
char * b64encode (const void * data, size_t ns)
{
static char b64enc[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@ -275,7 +275,7 @@ char * b64encode (const void * data, int ns)
lc = 0;
if (te)
while (ns) {
while (ns > 0) {
if (_debug)
fprintf(stderr, "%7u %02x %02x %02x -> %02x %02x %02x %02x\n",
@ -335,7 +335,7 @@ fprintf(stderr, "%7u %02x %02x %02x -> %02x %02x %02x %02x\n",
#define CRC24_POLY 0x1864cfbL
/*@-boundsread@*/
char * b64crc (const unsigned char * data, int ns)
char * b64crc (const unsigned char * data, size_t ns)
{
const unsigned char *s = data;
uint32 crc = CRC24_INIT;
@ -367,7 +367,7 @@ const char * b64decode_whitespace = B64DECODE_WHITESPACE;
/*@-internalglobs -modfilesys @*/
/*@-boundswrite@*/
int b64decode (const char * s, void ** datap, int *lenp)
int b64decode (const char * s, void ** datap, size_t *lenp)
{
unsigned char b64dec[256];
const unsigned char *t;

View File

@ -68,17 +68,17 @@ extern "C" {
* @return (malloc'd) base64 string
*/
BEECRYPTAPI /*@only@*/ /*@null@*/ /*@unused@*/
char * b64encode (const void * data, int ns)
char * b64encode (const void * data, size_t ns)
/*@*/;
/**
* Encode crc of binary input data into 5 bytes of base64 output.
* @param data binary data
* @param ns crc of data
* @param len no. bytes of binary data
* @return (malloc'd) base64 string
*/
BEECRYPTAPI /*@only@*/ /*@null@*/ /*@unused@*/
char * b64crc (const unsigned char * data, int ns)
char * b64crc (const unsigned char * data, size_t ns)
/*@*/;
/**
@ -89,7 +89,7 @@ char * b64crc (const unsigned char * data, int ns)
* @return 0 on success, 1: s == NULL, 2: bad length, 3: bad char
*/
BEECRYPTAPI /*@unused@*/
int b64decode (const char * s, /*@out@*/ void ** datap, /*@out@*/ int *lenp)
int b64decode (const char * s, /*@out@*/ void ** datap, /*@out@*/ size_t *lenp)
/*@modifies *datap, *lenp @*/;
/**

View File

@ -1100,6 +1100,7 @@ fi
dnl Determine the canonical arch-vendor-os for the build machine
case "${build_cpu}" in
*86) RPMCANONARCH=i386 ;;
x86_64*) RPMCANONARCH=x86_64 ;;
alpha*) RPMCANONARCH=alpha ;;
sparc*) RPMCANONARCH=sparc ;;
ia64*) RPMCANONARCH=ia64 ;;

View File

@ -145,7 +145,8 @@ static /*@only@*/ char * armorFormat(int_32 type, const void * data,
char * t;
char * val;
int atype;
int lc, ns, nt;
size_t ns, nt;
int lc;
switch (type) {
case RPM_BIN_TYPE:
@ -238,7 +239,7 @@ static /*@only@*/ char * base64Format(int_32 type, const void * data,
const char * enc;
char * t;
int lc;
int nt = ((element + 2) / 3) * 4;
size_t nt = ((element + 2) / 3) * 4;
/*@-boundswrite@*/
/*@-globs@*/

View File

@ -360,7 +360,7 @@ rpmRC headerCheck(rpmts ts, const void * uh, size_t uc, const char ** msg)
if (uc > 0 && pvlen != uc) {
(void) snprintf(buf, sizeof(buf),
_("blob size(%d): BAD, 8 + 16 * il(%d) + dl(%d)\n"),
uc, il, dl);
(int)uc, (int)il, (int)dl);
goto exit;
}
@ -652,7 +652,7 @@ rpmRC rpmReadHeader(rpmts ts, FD_t fd, Header *hdrp, const char ** msg)
memset(block, 0, sizeof(block));
if ((xx = timedRead(fd, (char *)block, sizeof(block))) != sizeof(block)) {
(void) snprintf(buf, sizeof(buf),
_("hdr size(%d): BAD, read returned %d\n"), sizeof(block), xx);
_("hdr size(%d): BAD, read returned %d\n"), (int)sizeof(block), xx);
goto exit;
}
if (memcmp(block, header_magic, sizeof(header_magic))) {

View File

@ -858,7 +858,7 @@ static int psmWaitUnregister(rpmpsm psm, pid_t child)
/*@-infloops@*/
while (psm->reaped != psm->child) {
(void) sigprocmask(SIG_SETMASK, &oldMask, NULL);
(void) pause();
sleep(1); /* XXX sleep guarantees loop traversal. */
(void) sigprocmask(SIG_BLOCK, &newMask, &oldMask);
}
/*@=infloops@*/

View File

@ -266,7 +266,7 @@ int showQueryPackage(QVA_t qva, /*@unused@*/ rpmts ts, Header h)
/*@=boundswrite@*/
if (qva->qva_flags & QUERY_FOR_DUMPFILES) {
sprintf(te, "%s %d %d %s 0%o ", fn, fsize, fmtime, fmd5, fmode);
sprintf(te, "%s %d %d %s 0%o ", fn, (int)fsize, fmtime, fmd5, fmode);
te += strlen(te);
if (fuser && fgroup) {

View File

@ -557,7 +557,7 @@ int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia,
* @param argv array of package file names (NULL terminated)
* @return 0 on success
*/
int rpmErase(rpmts ts, const struct rpmInstallArguments_s * ia,
int rpmErase(rpmts ts, struct rpmInstallArguments_s * ia,
/*@null@*/ const char ** argv)
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
/*@modifies ts, ia, rpmGlobalMacroContext,

View File

@ -723,8 +723,7 @@ exit:
}
/*@=bounds@*/
int rpmErase(rpmts ts,
const struct rpmInstallArguments_s * ia,
int rpmErase(rpmts ts, struct rpmInstallArguments_s * ia,
const char ** argv)
{
int count;

View File

@ -178,7 +178,7 @@ rpmRC rpmReadSignature(FD_t fd, Header * sighp, sigType sig_type,
memset(block, 0, sizeof(block));
if ((xx = timedRead(fd, (char *)block, sizeof(block))) != sizeof(block)) {
(void) snprintf(buf, sizeof(buf),
_("sigh size(%d): BAD, read returned %d\n"), sizeof(block), xx);
_("sigh size(%d): BAD, read returned %d\n"), (int)sizeof(block), xx);
goto exit;
}
if (memcmp(block, header_magic, sizeof(header_magic))) {
@ -215,7 +215,7 @@ rpmRC rpmReadSignature(FD_t fd, Header * sighp, sigType sig_type,
dataStart = (unsigned char *) (pe + il);
if ((xx = timedRead(fd, (char *)pe, nb)) != nb) {
(void) snprintf(buf, sizeof(buf),
_("sigh blob(%d): BAD, read returned %d\n"), nb, xx);
_("sigh blob(%d): BAD, read returned %d\n"), (int)nb, xx);
goto exit;
}
@ -985,11 +985,11 @@ verifySizeSignature(const rpmts ts, /*@out@*/ char * t)
if (size != dig->nbytes) {
res = RPMRC_FAIL;
t = stpcpy(t, rpmSigString(res));
sprintf(t, " Expected(%d) != (%d)\n", size, dig->nbytes);
sprintf(t, " Expected(%d) != (%d)\n", (int)size, (int)dig->nbytes);
} else {
res = RPMRC_OK;
t = stpcpy(t, rpmSigString(res));
sprintf(t, " (%d)", dig->nbytes);
sprintf(t, " (%d)", (int)dig->nbytes);
}
exit:

View File

@ -3,7 +3,7 @@
AUTOMAKE_OPTIONS = 1.4 foreign
EXTRA_DIST = autogen.sh CHANGES $(man_MANS) popt.spec \
testit.sh test-poptrc \
testit.sh test-poptrc test3-data/0* \
po/*.in po/*.po po/popt.pot \
popt.ps

View File

@ -54,11 +54,11 @@ librpmmodule_la_SOURCES = rpmmodule.c hash.c upgrade.c header-py.c \
rpmmodule.so$(EXEEXT): $(librpmmodule_la_OBJECTS)
$(CC) -o $@ $(librpmmodule_la_OBJECTS) $(rpmmodule_so_LDFLAGS)
_rpmdb.so$(EXEEXT): $(_rpmdb_so_OBJECTS)
$(CC) -o $@ $(_rpmdb_so_OBJECTS) $(_rpmdb_so_LDFLAGS)
_rpmdb.so$(EXEEXT): _rpmdb.lo
$(CC) -o $@ _rpmdb.lo $(_rpmdb_so_LDFLAGS)
poptmodule.so$(EXEEXT): $(poptmodule_so_OBJECTS)
$(CC) -o $@ $(poptmodule_so_OBJECTS) $(poptmodule_so_LDFLAGS)
poptmodule.so$(EXEEXT): poptmodule.lo
$(CC) -o $@ poptmodule.lo $(poptmodule_so_LDFLAGS)
# rpmmodule.c hash.c upgrade.c header-py.c \
# rpmal-py.c rpmds-py.c rpmdb-py.c rpmfd-py.c rpmfi-py.c rpmmi-py.c \

View File

@ -4,7 +4,6 @@
%define with_bzip2 @WITH_BZIP2@%{nil}
%define with_apidocs @WITH_APIDOCS@%{nil}
%define with_internal_db @WITH_INTERNAL_DB@%{nil}
%define strip_binaries 0
# XXX legacy requires './' payload prefix to be omitted from rpm packages.
%define _noPayloadPrefix 1
@ -159,11 +158,6 @@ CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{__prefix} --sysconfdir=/etc --loc
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{__prefix}
%endif
# XXX workaround ia64 gcc-3.1-0.18 miscompilation
%ifarch ia64
make CFLAGS="-g -O0 -DIA64_SUCKS_ROCKS" files.o files.lo -C build
%endif
make
%if %{with_perl_subpackage}
@ -224,12 +218,15 @@ gzip -9n apidocs/man/man*/* || :
}
%endif
%if %{strip_binaries}
# Get rid of unpackaged files
{ cd $RPM_BUILD_ROOT
%{__strip} ./bin/rpm
%{__strip} .%{__prefix}/bin/rpm2cpio
rm -rf .%{__prefix}/include/beecrypt
rm -f .%{__prefix}/lib/libbeecrypt.{a,la,so.2.2.0}
rm -rf .%{__prefix}/include/libelf
rm -f .%{__prefix}/lib/libelf.{a,la}
rm -f .%{__prefix}/lib/rpm/{Specfile.pm,cpanflute,cpanflute2,rpmdiff,rpmdiff.cgi,sql.prov,sql.req,tcl.req}
rm -rf .%{__prefix}%{__share}/man/{fr,ko}
}
%endif
%clean
rm -rf $RPM_BUILD_ROOT
@ -265,6 +262,7 @@ if [ $1 = 0 ]; then
/usr/sbin/userdel rpm
/usr/sbin/groupdel rpm
fi
exit 0
%post devel -p /sbin/ldconfig
@ -366,15 +364,17 @@ fi
%ifarch mips mipsel
%attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/mips*
%endif
%ifarch x86_64
%attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/x86_64*
%endif
%attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/noarch*
#%attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/@RPMCANONVENDOR@
%lang(cs) %{__prefix}/*/locale/cs/LC_MESSAGES/rpm.mo
%lang(da) %{__prefix}/*/locale/da/LC_MESSAGES/rpm.mo
%lang(de) %{__prefix}/*/locale/de/LC_MESSAGES/rpm.mo
%lang(fi) %{__prefix}/*/locale/fi/LC_MESSAGES/rpm.mo
%lang(fr) %{__prefix}/*/locale/fr/LC_MESSAGES/rpm.mo
%lang(gl) %{__prefix}/*/locale/gl/LC_MESSAGES/rpm.mo
%lang(is) %{__prefix}/*/locale/is/LC_MESSAGES/rpm.mo
%lang(ja) %{__prefix}/*/locale/ja/LC_MESSAGES/rpm.mo
%lang(ko) %{__prefix}/*/locale/ko/LC_MESSAGES/rpm.mo
@ -393,9 +393,7 @@ fi
%{__prefix}%{__share}/man/man1/gendiff.1*
%{__prefix}%{__share}/man/man8/rpm.8*
%{__prefix}%{__share}/man/man8/rpm2cpio.8*
#%lang(fr) %{__prefix}%{__share}/man/fr/man[18]/*.[18]*
%lang(ja) %{__prefix}%{__share}/man/ja/man[18]/*.[18]*
#%lang(ko) %{__prefix}%{__share}/man/ko/man[18]/*.[18]*
%lang(pl) %{__prefix}%{__share}/man/pl/man[18]/*.[18]*
%lang(ru) %{__prefix}%{__share}/man/ru/man[18]/*.[18]*
%lang(sk) %{__prefix}%{__share}/man/sk/man[18]/*.[18]*
@ -414,8 +412,6 @@ fi
%rpmattr %{__prefix}/lib/rpm/check-files
%rpmattr %{__prefix}/lib/rpm/check-prereqs
%rpmattr %{__prefix}/lib/rpm/config.site
#%rpmattr %{__prefix}/lib/rpm/cpanflute
#%rpmattr %{__prefix}/lib/rpm/cpanflute2
%rpmattr %{__prefix}/lib/rpm/cross-build
%rpmattr %{__prefix}/lib/rpm/find-debuginfo.sh
%rpmattr %{__prefix}/lib/rpm/find-lang.sh
@ -432,15 +428,12 @@ fi
%rpmattr %{__prefix}/lib/rpm/magic.prov
%rpmattr %{__prefix}/lib/rpm/magic.req
%rpmattr %{__prefix}/lib/rpm/perl.prov
#%rpmattr %{__prefix}/lib/rpm/Specfile.pm
# XXX remove executable bit to disable autogenerated perl requires for now.
%rpmattr %{__prefix}/lib/rpm/perl.req
#%attr(0644, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/perl.req
%rpmattr %{__prefix}/lib/rpm/rpm[bt]
#%rpmattr %{__prefix}/lib/rpm/rpmdiff
#%rpmattr %{__prefix}/lib/rpm/rpmdiff.cgi
%rpmattr %{__prefix}/lib/rpm/striptofile
%rpmattr %{__prefix}/lib/rpm/trpm
%rpmattr %{__prefix}/lib/rpm/u_pkg.sh
@ -454,7 +447,6 @@ fi
%files python
%defattr(-,root,root)
%{__prefix}/lib/python%{with_python_version}/site-packages/rpmmodule.so
#%{__prefix}/lib/python%{with_python_version}/site-packages/poptmodule.so
%{__prefix}/lib/python%{with_python_version}/site-packages/rpmdb
%endif
@ -498,20 +490,32 @@ fi
%{__prefix}%{__share}/man/man3/popt.3*
%lang(cs) %{__prefix}/*/locale/cs/LC_MESSAGES/popt.mo
%lang(da) %{__prefix}/*/locale/da/LC_MESSAGES/popt.mo
%lang(de) %{__prefix}/*/locale/de/LC_MESSAGES/popt.mo
%lang(es) %{__prefix}/*/locale/es/LC_MESSAGES/popt.mo
%lang(eu_ES) %{__prefix}/*/locale/eu_ES/LC_MESSAGES/popt.mo
%lang(fi) %{__prefix}/*/locale/fi/LC_MESSAGES/popt.mo
%lang(fr) %{__prefix}/*/locale/fr/LC_MESSAGES/popt.mo
%lang(gl) %{__prefix}/*/locale/gl/LC_MESSAGES/popt.mo
%lang(hu) %{__prefix}/*/locale/hu/LC_MESSAGES/popt.mo
%lang(id) %{__prefix}/*/locale/id/LC_MESSAGES/popt.mo
%lang(is) %{__prefix}/*/locale/is/LC_MESSAGES/popt.mo
%lang(it) %{__prefix}/*/locale/it/LC_MESSAGES/popt.mo
%lang(ja) %{__prefix}/*/locale/ja/LC_MESSAGES/popt.mo
%lang(ko) %{__prefix}/*/locale/ko/LC_MESSAGES/popt.mo
%lang(no) %{__prefix}/*/locale/no/LC_MESSAGES/popt.mo
%lang(pl) %{__prefix}/*/locale/pl/LC_MESSAGES/popt.mo
%lang(pt) %{__prefix}/*/locale/pt/LC_MESSAGES/popt.mo
%lang(pt_BR) %{__prefix}/*/locale/pt_BR/LC_MESSAGES/popt.mo
%lang(ro) %{__prefix}/*/locale/ro/LC_MESSAGES/popt.mo
%lang(ru) %{__prefix}/*/locale/ru/LC_MESSAGES/popt.mo
%lang(sk) %{__prefix}/*/locale/sk/LC_MESSAGES/popt.mo
%lang(sl) %{__prefix}/*/locale/sl/LC_MESSAGES/popt.mo
%lang(sr) %{__prefix}/*/locale/sr/LC_MESSAGES/popt.mo
%lang(sv) %{__prefix}/*/locale/sv/LC_MESSAGES/popt.mo
%lang(tr) %{__prefix}/*/locale/tr/LC_MESSAGES/popt.mo
%lang(uk) %{__prefix}/*/locale/uk/LC_MESSAGES/popt.mo
%lang(wa) %{__prefix}/*/locale/wa/LC_MESSAGES/popt.mo
%lang(zh) %{__prefix}/*/locale/zh/LC_MESSAGES/popt.mo
%lang(zh_CN) %{__prefix}/*/locale/zh_CN.GB2312/LC_MESSAGES/popt.mo
# XXX These may end up in popt-devel but it hardly seems worth the effort now.

View File

@ -1023,7 +1023,7 @@ static const char * statstr(const struct stat * st,
(unsigned)st->st_dev,
(unsigned)st->st_ino,
st->st_mode,
st->st_nlink,
(unsigned)st->st_nlink,
st->st_uid,
st->st_gid,
(unsigned)st->st_rdev,

View File

@ -1,7 +1,7 @@
#/*! \page config_rpmrc Default configuration: /usr/lib/rpm/rpmrc
# \verbatim
#
# $Id: rpmrc.in,v 2.51 2002/07/18 21:42:20 jbj Exp $
# $Id: rpmrc.in,v 2.52 2002/10/09 19:07:44 jbj Exp $
#
# This is a global RPM configuration file. All changes made here will
# be lost when the rpm package is upgraded. Any per-system configuration
@ -19,6 +19,7 @@ optflags: i586 -O2 -march=i586
optflags: i686 -O2 -march=i686
optflags: athlon -O2 -march=athlon
optflags: ia64 -O2
optflags: x86_64 -O2
# XXX Please note that -mieee has been added in rpm-3.0.5.
optflags: alpha -O2 -mieee
@ -71,6 +72,7 @@ arch_canon: i686: i686 1
arch_canon: i586: i586 1
arch_canon: i486: i486 1
arch_canon: i386: i386 1
arch_canon: x86_64: x86_64 1
arch_canon: alpha: alpha 2
arch_canon: alphaev5: alphaev5 2
@ -158,8 +160,6 @@ buildarchtranslate: osfmach3_i586: i386
buildarchtranslate: osfmach3_i486: i386
buildarchtranslate: osfmach3_i386: i386
buildarchtranslate: ia64: ia64
buildarchtranslate: athlon: i386
buildarchtranslate: i686: i386
buildarchtranslate: i586: i386
@ -195,6 +195,10 @@ buildarchtranslate: hades: m68kmint
buildarchtranslate: s390: s390
buildarchtranslate: s390x: s390x
buildarchtranslate: ia64: ia64
buildarchtranslate: x86_64: x86_64
#############################################################
# Architecture compatibility
@ -260,6 +264,8 @@ arch_compat: s390x: s390 noarch
arch_compat: ia64: i686 noarch
arch_compat: x86_64: noarch
os_compat: IRIX64: IRIX
os_compat: solaris2.7: solaris2.3 solaris2.4 solaris2.5 solaris2.6
os_compat: solaris2.6: solaris2.3 solaris2.4 solaris2.5
@ -338,11 +344,13 @@ buildarch_compat: atariclone: m68kmint noarch
buildarch_compat: milan: m68kmint noarch
buildarch_compat: hades: m68kmint noarch
buildarch_compat: ia64: noarch
buildarch_compat: s390: noarch
buildarch_compat: s390x: noarch
buildarch_compat: ia64: noarch
buildarch_compat: x86_64: noarch
macrofiles: @RPMCONFIGDIR@/macros:@RPMCONFIGDIR@/%{_target}/macros:@SYSCONFIGDIR@/macros.specspo:@SYSCONFIGDIR@/macros.prelink:@SYSCONFIGDIR@/macros.solve:@SYSCONFIGDIR@/macros.up2date:@SYSCONFIGDIR@/macros:@SYSCONFIGDIR@/%{_target}/macros:~/.rpmmacros
# \endverbatim

View File

@ -15,7 +15,8 @@ int keep_strtab = 0;
int keep_all_section_headers = 1;
int add_unstrip_info = 0;
void
#if defined(NhUNUSED)
static void
copy_to_file(Elf *elf, Elf *out_elf)
{
GElf_Ehdr ehdr;
@ -67,8 +68,9 @@ copy_to_file(Elf *elf, Elf *out_elf)
}
}
}
#endif
void
static void
strip_to_file(Elf *elf, Elf *out_elf, DebugLink *debuglink)
{
GElf_Ehdr ehdr;
@ -82,7 +84,8 @@ strip_to_file(Elf *elf, Elf *out_elf, DebugLink *debuglink)
int keep_section;
int changed_offsets;
GElf_Off last_offset;
int i, debuglink_name;
int i;
int debuglink_name = 0;
elf_flagelf (out_elf, ELF_C_SET, ELF_F_LAYOUT);
@ -220,7 +223,7 @@ strip_to_file(Elf *elf, Elf *out_elf, DebugLink *debuglink)
}
}
void
static void
copy_debuginfo_to_file(Elf *elf, Elf *out_elf)
{
GElf_Ehdr ehdr;
@ -231,7 +234,7 @@ copy_debuginfo_to_file(Elf *elf, Elf *out_elf)
unsigned char *section_strtab;
int keep_section;
UnstripInfo *info;
int unstripinfo_name;
int unstripinfo_name = 0;
info = malloc (sizeof (UnstripInfo));

View File

@ -6,7 +6,7 @@
#include "debug.h"
char *
static char *
my_stpcpy (char *dest,
const char *src)
{
@ -146,7 +146,7 @@ static const unsigned int crc32_table[256] =
0x2d02ef8d
};
unsigned int crc32 (unsigned int crc, unsigned char *buf, size_t len)
static unsigned int crc32 (unsigned int crc, unsigned char *buf, size_t len)
{
unsigned char *end;