RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  j...@rpm5.org
  Module: rpm lua                          Date:   28-Mar-2009 18:44:37
  Branch: rpm-5_1                          Handle: 2008062012021124302546

  Added files:              (Branch: rpm-5_1)
    rpm/rpmio               rpmiob.c rpmiotypes.h
  Modified files:           (Branch: rpm-5_1)
    lua                     Makefile.am
    rpm                     CHANGES devtool.conf
    rpm/build               files.c
    rpm/lib                 rpmds.c rpmrc.c
    rpm/misc                Makefile.am
    rpm/rpmdb               rpmns.c
    rpm/rpmio               Makefile.am librpmio.vers rpmcb.h rpmio.c rpmio.h
                            rpmlua.c rpmpgp.c rpmpgp.h
    rpm/tools               rpmdigest.c
  Removed files:            (Branch: rpm-5_1)
    rpm/lib                 rpmns.c

  Log:
    - more hack-o-rounds for LUA <-> PCRE, add --disable-static for now.
    - backport rpmiotypes.h/rpmiob.c, use rpmiobSlurp instead.

  Summary:
    Revision    Changes     Path
    1.17.2.7    +1  -1      lua/Makefile.am
    1.2288.2.254+2  -0      rpm/CHANGES
    1.320.2.4   +12 -6      rpm/build/files.c
    2.205.2.29  +2  -1      rpm/devtool.conf
    2.94.2.17   +34 -34     rpm/lib/rpmds.c
    1.23        +0  -536    rpm/lib/rpmns.c
    2.234.2.7   +11 -9      rpm/lib/rpmrc.c
    1.32.4.7    +0  -1      rpm/misc/Makefile.am
    1.10.2.5    +12 -12     rpm/rpmdb/rpmns.c
    1.162.2.20  +8  -7      rpm/rpmio/Makefile.am
    2.63.2.16   +10 -0      rpm/rpmio/librpmio.vers
    2.2.4.1     +1  -43     rpm/rpmio/rpmcb.h
    1.127.2.19  +0  -62     rpm/rpmio/rpmio.c
    1.68.2.14   +1  -103    rpm/rpmio/rpmio.h
    1.3.2.2     +158 -0     rpm/rpmio/rpmiob.c
    1.15.2.2    +327 -0     rpm/rpmio/rpmiotypes.h
    2.52.2.5    +37 -22     rpm/rpmio/rpmlua.c
    2.90.2.8    +38 -37     rpm/rpmio/rpmpgp.c
    2.72.2.9    +1  -60     rpm/rpmio/rpmpgp.h
    2.4.2.5     +18 -18     rpm/tools/rpmdigest.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: lua/Makefile.am
  ============================================================================
  $ cvs diff -u -r1.17.2.6 -r1.17.2.7 Makefile.am
  --- lua/Makefile.am   17 Jan 2009 14:31:26 -0000      1.17.2.6
  +++ lua/Makefile.am   28 Mar 2009 17:44:35 -0000      1.17.2.7
  @@ -35,6 +35,7 @@
   bin2c_LDADD =
   
   liblua_la_CFLAGS = @WITH_LUA_SUBDIR_DEF@ -DLUA_USE_POSIX
  +liblua_la_LDFLAGS = @WITH_PCRE_LDFLAGS@ @WITH_PCRE_LIBS@
   if USE_LUA_SHADOW
   liblua_la_CFLAGS += \
                -DUSE_LUA_SHADOW
  @@ -80,7 +81,6 @@
        chkconfig/leveldb.h
   endif
   liblua_la_LIBADD = @WITH_LUA_SUBDIR_LIB@ -lm
  -liblua_la_LDFLAGS = @WITH_PCRE_LDFLAGS@ @WITH_PCRE_LIBS@
   liblua_la_SOURCES = \
                local/llocal.c \
                local/llocal.h \
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2288.2.253 -r1.2288.2.254 CHANGES
  --- rpm/CHANGES       28 Mar 2009 13:45:48 -0000      1.2288.2.253
  +++ rpm/CHANGES       28 Mar 2009 17:44:33 -0000      1.2288.2.254
  @@ -1,4 +1,6 @@
   5.1.7 -> 5.1.8:
  +    - jbj: more hack-o-rounds for LUA <-> PCRE, add --disable-static for now.
  +    - jbj: backport rpmiotypes.h/rpmiob.c, use rpmiobSlurp instead.
       - jbj: fix: handle ./../foo paths correctly (#491388).
       - jbj: rpmlib: rescusitate splint annotations.
       - jbj: rpmdb: rescusitate splint annotations.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/files.c
  ============================================================================
  $ cvs diff -u -r1.320.2.3 -r1.320.2.4 files.c
  --- rpm/build/files.c 6 Mar 2009 22:49:04 -0000       1.320.2.3
  +++ rpm/build/files.c 28 Mar 2009 17:44:34 -0000      1.320.2.4
  @@ -14,6 +14,7 @@
   #include <regex.h>
   #endif
   
  +#define      _RPMIOB_INTERNAL
   #include <rpmio_internal.h>  /* XXX fdGetFp */
   #include <fts.h>
   
  @@ -303,7 +304,7 @@
    */
   /*...@-exportlocal -exportheader...@*/
   /*...@unchecked@*/
  -VFA_t verifyAttrs[] = {
  +static VFA_t verifyAttrs[] = {
       { "md5", 0,      RPMVERIFY_MD5 },
       { "size",        0,      RPMVERIFY_FILESIZE },
       { "link",        0,      RPMVERIFY_LINKTO },
  @@ -842,7 +843,7 @@
   
       /* Got match */
       s = fileName + matches[1].rm_eo - 1;
  -    x = matches[1].rm_eo - matches[1].rm_so;
  +    x = (int)matches[1].rm_eo - (int)matches[1].rm_so;
       buf[x] = '\0';
       while (x) {
        buf[--x] = *s--;
  @@ -856,7 +857,7 @@
    */
   /*...@-exportlocal -exportheader...@*/
   /*...@unchecked@*/
  -VFA_t virtualFileAttributes[] = {
  +static VFA_t virtualFileAttributes[] = {
        { "%dir",       0,      0 },    /* XXX why not RPMFILE_DIR? */
        { "%doc",       0,      RPMFILE_DOC },
        { "%ghost",     0,      RPMFILE_GHOST },
  @@ -2060,6 +2061,7 @@
       const char * buildURL = "%{_builddir}/%{?buildsubdir}/";
       const char * fn = NULL;
       const char * apkt = NULL;
  +    rpmiob iob = NULL;
       uint8_t * pkt = NULL;
       ssize_t pktlen = 0;
       int absolute = 0;
  @@ -2091,12 +2093,15 @@
        apkt = pgpArmorWrap(PGPARMOR_PUBKEY, pkt, pktlen);
        break;
       case RPMTAG_POLICIES:
  -     if ((xx = rpmioSlurp(fn, &pkt, &pktlen)) != 0) {
  +     xx = rpmiobSlurp(fn, &iob);
  +     if (!(xx == 0 && iob != NULL)) {
            rpmlog(RPMLOG_ERR, _("%s: *.te policy read failed.\n"), fn);
            goto exit;
        }
  -     apkt = (const char *) pkt;      /* XXX unsigned char */
  -     pkt = NULL;
  +     apkt = (const char *) iob->b;   /* XXX unsigned char */
  +     /* XXX steal the I/O buffer */
  +     iob->b = (uint8_t *)xcalloc(1, sizeof(*iob->b));
  +     iob->blen = 0;
        break;
       }
   
  @@ -2115,6 +2120,7 @@
   exit:
       apkt = _free(apkt);
       pkt = _free(pkt);
  +    iob = rpmiobFree(iob);
       fn = _free(fn);
       if (rc != RPMRC_OK)
        fl->processingFailed = 1;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/devtool.conf
  ============================================================================
  $ cvs diff -u -r2.205.2.28 -r2.205.2.29 devtool.conf
  --- rpm/devtool.conf  16 Mar 2009 14:02:40 -0000      2.205.2.28
  +++ rpm/devtool.conf  28 Mar 2009 17:44:34 -0000      2.205.2.29
  @@ -97,7 +97,8 @@
           --enable-build-versionscript \
           --enable-build-warnings \
           --enable-build-debug \
  -        --enable-maintainer-mode
  +        --enable-maintainer-mode \
  +     --disable-static
   
   # CC=ccache env UMASK=022 distcc cc
   # CFLAGS=-O2 -g -m32 -march=pentium-mmx -fasynchronous-unwind-tables 
-I/usr/include/python2.5 -I/usr/include/beecrypt
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmds.c
  ============================================================================
  $ cvs diff -u -r2.94.2.16 -r2.94.2.17 rpmds.c
  --- rpm/lib/rpmds.c   27 Mar 2009 21:18:19 -0000      2.94.2.16
  +++ rpm/lib/rpmds.c   28 Mar 2009 17:44:34 -0000      2.94.2.17
  @@ -78,6 +78,7 @@
   #define      DT_GNU_HASH     0x6ffffef5
   #endif
   
  +#define      _RPMIOB_INTERNAL
   #include <rpmio_internal.h>  /* XXX fdGetFILE */
   #include <rpmcb.h>           /* XXX fnpyKey */
   #include <rpmmacro.h>
  @@ -1143,6 +1144,32 @@
       return i;
   }
   
  +/**
  + * Merge a single provides, wrapping N as "NS(N)".
  + * @retval *dsp              (loaded) dependency set
  + * @param NS         dependency name space
  + * @param N          name
  + * @param EVR                epoch:version-release
  + * @param Flags              comparison/context flags
  + */
  +static void rpmdsNSAdd(/*...@out@*/ rpmds *dsp, const char * NS,
  +             const char *N, const char *EVR, evrFlags Flags)
  +     /*...@modifies *dsp @*/
  +{
  +    char *t;
  +    rpmds ds;
  +    int xx;
  +
  +    t = alloca(strlen(NS)+sizeof("()")+strlen(N));
  +    *t = '\0';
  +    (void) stpcpy( stpcpy( stpcpy( stpcpy(t, NS), "("), N), ")");
  +
  +    ds = rpmdsSingle(RPMTAG_PROVIDENAME, t, EVR, Flags);
  +    xx = rpmdsMerge(dsp, ds);
  +    (void)rpmdsFree(ds);
  +    ds = NULL;
  +}
  +
   struct cpuinfo_s {
   /*...@observer@*/ /*...@null@*/
       const char *name;
  @@ -1202,32 +1229,6 @@
       return flags;
   }
   
  -/**
  - * Merge a single provides, wrapping N as "NS(N)".
  - * @retval *dsp              (loaded) dependency set
  - * @param NS         dependency name space
  - * @param N          name
  - * @param EVR                epoch:version-release
  - * @param Flags              comparison/context flags
  - */
  -static void rpmdsNSAdd(/*...@out@*/ rpmds *dsp, const char * NS,
  -             const char *N, const char *EVR, evrFlags Flags)
  -     /*...@modifies *dsp @*/
  -{
  -    char *t;
  -    rpmds ds;
  -    int xx;
  -
  -    t = alloca(strlen(NS)+sizeof("()")+strlen(N));
  -    *t = '\0';
  -    (void) stpcpy( stpcpy( stpcpy( stpcpy(t, NS), "("), N), ")");
  -
  -    ds = rpmdsSingle(RPMTAG_PROVIDENAME, t, EVR, Flags);
  -    xx = rpmdsMerge(dsp, ds);
  -    (void)rpmdsFree(ds);
  -    ds = NULL;
  -}
  -
   #define      _PROC_CPUINFO   "/proc/cpuinfo"
   /**
    */
  @@ -1240,8 +1241,7 @@
   {
       struct cpuinfo_s * ct;
       const char * NS = "cpuinfo";
  -    uint8_t * b;
  -    ssize_t blen;
  +    rpmiob iob = NULL;
       char * f, * fe, * fend;
       char * g, * ge;
       char * t;
  @@ -1268,11 +1268,11 @@
       for (ct = ctags; ct->name != NULL; ct++)
        ct->done = 0;
   
  -    xx = rpmioSlurp(fn, &b, &blen);
  -    if (!(xx == 0 && b != NULL && blen > 0))
  +    xx = rpmiobSlurp(fn, &iob);
  +    if (!(xx == 0 && iob != NULL))
        goto exit;
   
  -    for (f = (char *)b; *f != '\0'; f = fend) {
  +    for (f = (char *)iob->b; *f != '\0'; f = fend) {
        /* find EOL */
        fe = f;
        while (*fe != '\0' && !(*fe == '\n' || *fe == '\r'))
  @@ -1355,7 +1355,7 @@
       }
   
   exit:
  -    b = _free(b);
  +    iob = rpmiobFree(iob);
       return rc;
   }
   
  @@ -1410,12 +1410,12 @@
       N_("header tag data can be of type uint64_t.") },
       { "rpmlib(PayloadIsUstar)",              "4.4.4-1",
        (RPMSENSE_RPMLIB|RPMSENSE_EQUAL),
  -#if defined(HAVE_LZMA_H)
       N_("package payload can be in ustar tar archive format.") },
  +#if defined(HAVE_LZMA_H)
       { "rpmlib(PayloadIsLzma)",               "4.4.6-1",
        (RPMSENSE_RPMLIB|RPMSENSE_EQUAL),
  -#endif
       N_("package payload can be compressed using lzma.") },
  +#endif
       { "rpmlib(FileDigestParameterized)",    "4.4.6-1",
        (RPMSENSE_RPMLIB|RPMSENSE_EQUAL),
       N_("file digests can be other than MD5.") },
  @@ .
  rm -f rpm/lib/rpmns.c <<'@@ .'
  Index: rpm/lib/rpmns.c
  ============================================================================
  [NO CHANGE SUMMARY BECAUSE FILE AS A WHOLE IS JUST REMOVED]
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmrc.c
  ============================================================================
  $ cvs diff -u -r2.234.2.6 -r2.234.2.7 rpmrc.c
  --- rpm/lib/rpmrc.c   26 Mar 2009 20:10:00 -0000      2.234.2.6
  +++ rpm/lib/rpmrc.c   28 Mar 2009 17:44:35 -0000      2.234.2.7
  @@ -8,11 +8,15 @@
   #define __power_pc() 0
   #endif
   
  +#define      _RPMIOB_INTERNAL        /* XXX for rpmiobSlurp */
  +#include <rpmio.h>
   #define _MIRE_INTERNAL
  -#include <rpmio_internal.h> /* for rpmioSlurp() */
  +#include <mire.h>
  +#include <argv.h>
   #include <rpmlua.h>
   #include <rpmluaext.h>
   #include <rpmmacro.h>
  +
   #include <rpmcli.h>
   #include <rpmds.h>
   
  @@ -25,6 +29,7 @@
   
   /*...@observer@*/ /*...@unchecked@*/
   static const char * platform = SYSCONFIGDIR "/platform";
  +
   /*...@only@*/ /*...@relnull@*/ /*...@unchecked@*/
   void * platpat = NULL;
   /*...@unchecked@*/
  @@ -403,8 +408,7 @@
                rpmGlobalMacroContext, fileSystem, internalState @*/
   {
       CVOG_t cvog = NULL;
  -    uint8_t * b = NULL;
  -    ssize_t blen = 0;
  +    rpmiob iob = NULL;
       int init_platform = 0;
       miRE mi_re = NULL;
       int mi_nre = 0;
  @@ -412,14 +416,14 @@
       rpmRC rc;
       int xx;
   
  -    rc = rpmioSlurp(platform, &b, &blen);
  +    rc = rpmiobSlurp(platform, &iob);
   
  -    if (rc || b == NULL || blen <= 0) {
  +    if (rc || iob == NULL) {
        rc = RPMRC_FAIL;
        goto exit;
       }
   
  -    p = (char *)b;
  +    p = (char *)iob->b;
       for (pe = p; p && *p; p = pe) {
        pe = strchr(p, '\n');
        if (pe)
  @@ -466,9 +470,7 @@
        cvog->str = _free(cvog->str);
        cvog = _free(cvog);
       }
  -/*...@-modobserver@*/
  -    b = _free(b);
  -/*...@=modobserver@*/
  +    iob = rpmiobFree(iob);
       if (rc == RPMRC_OK) {
        platpat = mireFreeAll(platpat, nplatpat);
        platpat = mi_re;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/misc/Makefile.am
  ============================================================================
  $ cvs diff -u -r1.32.4.6 -r1.32.4.7 Makefile.am
  --- rpm/misc/Makefile.am      24 Mar 2009 20:58:27 -0000      1.32.4.6
  +++ rpm/misc/Makefile.am      28 Mar 2009 17:44:35 -0000      1.32.4.7
  @@ -36,7 +36,6 @@
        @WITH_XZ_LDFLAGS@ \
        @WITH_LUA_LDFLAGS@ \
        @WITH_FILE_LDFLAGS@ \
  -     @WITH_PCRE_LDFLAGS@ \
        @WITH_XAR_LDFLAGS@
   librpmmisc_la_LIBADD = \
        @ALLOCA@ \
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/rpmns.c
  ============================================================================
  $ cvs diff -u -r1.10.2.4 -r1.10.2.5 rpmns.c
  --- rpm/rpmdb/rpmns.c 11 Jan 2009 18:50:30 -0000      1.10.2.4
  +++ rpm/rpmdb/rpmns.c 28 Mar 2009 17:44:35 -0000      1.10.2.5
  @@ -3,7 +3,8 @@
    */
   #include "system.h"
   
  -#include <rpmio_internal.h>  /* XXX rpmioSlurp */
  +#define      _RPMIOB_INTERNAL        /* XXX rpmiobSlurp */
  +#include <rpmio.h>
   #include <rpmmacro.h>
   #include <rpmcb.h>
   
  @@ -436,26 +437,25 @@
        static const char clrtxt[] = "-----BEGIN PGP SIGNED MESSAGE-----";
        static const char sigtxt[] = "-----BEGIN PGP SIGNATURE-----";
        const char * _fn = rpmExpand(fn, NULL);
  -     uint8_t * b = NULL;
  -     ssize_t blen = 0;
  -     int _rc = rpmioSlurp(_fn, &b, &blen);
  +     rpmiob iob = NULL;
  +     int _rc = rpmiobSlurp(_fn, &iob);
   
  -     if (!(_rc == 0 && b != NULL && blen > 0)) {
  +     if (!(_rc == 0 && iob != NULL)) {
   if (_rpmns_debug)
  -fprintf(stderr, "==> rpmioSlurp(%s) MSG ret %d\n", _fn, _rc);
  -         b = _free(b);
  +fprintf(stderr, "==> rpmiobSlurp(%s) MSG ret %d\n", _fn, _rc);
  +         iob = rpmiobFree(iob);
            _fn = _free(_fn);
            goto exit;
        }
        _fn = _free(_fn);
   
        /* XXX clearsign sig is PGPSIGTYPE_TEXT not PGPSIGTYPE_BINARY. */
  -     if (!strncmp((char *)b, clrtxt, strlen(clrtxt))) {
  -         const char * be = (char *) (b + blen);
  +     if (!strncmp((char *)iob->b, clrtxt, strlen(clrtxt))) {
  +         const char * be = (char *) (iob->b + iob->blen);
            const char * t;
   
            /* Skip to '\n\n' start-of-plaintext */
  -         t = (char *) b;
  +         t = (char *) iob->b;
            while (t && t < be && *t != '\n')
                t = strchr(t, '\n') + 1;
            if (!(t && t < be))
  @@ -478,9 +478,9 @@
                xx = rpmDigestUpdate(ctx, "\r\n", sizeof("\r\n")-1);
            }
        } else
  -         xx = rpmDigestUpdate(ctx, b, blen);
  +         xx = rpmDigestUpdate(ctx, iob->b, iob->blen);
   
  -     b = _free(b);
  +     iob = rpmiobFree(iob);
       }
   
       if (sigp->hash != NULL)
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/Makefile.am
  ============================================================================
  $ cvs diff -u -r1.162.2.19 -r1.162.2.20 Makefile.am
  --- rpm/rpmio/Makefile.am     25 Mar 2009 20:14:48 -0000      1.162.2.19
  +++ rpm/rpmio/Makefile.am     28 Mar 2009 17:44:36 -0000      1.162.2.20
  @@ -57,9 +57,9 @@
   pkgincdir = $(pkgincludedir)$(WITH_PATH_VERSIONED_SUFFIX)
   pkginc_HEADERS = \
        argv.h envvar.h fts.h mire.h rpmbc.h rpmcb.h rpmdav.h rpmgc.h \
  -     rpmhash.h rpmio.h rpmio-stub.h rpmku.h rpmlog.h rpmmacro.h rpmmg.h \
  -     rpmnss.h rpmpgp.h rpmsq.h rpmssl.h rpmsw.h rpmurl.h rpmxar.h \
  -     stringbuf.h ugid.h rpmuuid.h rpmzlog.h yarn.h
  +     rpmhash.h rpmio.h rpmiotypes.h rpmio-stub.h rpmku.h rpmlog.h \
  +     rpmmacro.h rpmmg.h rpmnss.h rpmpgp.h rpmsq.h rpmssl.h rpmsw.h \
  +     rpmurl.h rpmxar.h stringbuf.h ugid.h rpmuuid.h rpmzlog.h yarn.h
   noinst_HEADERS = \
        ar.h cpio.h crc.h fnmatch.h glob.h iosm.h \
        md2.h md4.h poptIO.h rmd128.h rmd160.h rmd256.h rmd320.h sha224.h \
  @@ -74,10 +74,11 @@
        macro.c mire.c mount.c poptIO.c \
        md2.c md4.c rmd128.c rmd160.c rmd256.c rmd320.c sha224.c \
        salsa10.c salsa20.c tiger.c \
  -     rpmbc.c rpmdav.c rpmgc.c rpmhash.c rpmhook.c rpmio.c rpmio-stub.c \
  -     rpmku.c rpmlog.c rpmlua.c rpmmalloc.c rpmmg.c rpmnss.c rpmpgp.c \
  -     rpmrpc.c rpmsq.c rpmssl.c rpmsw.c rpmuuid.c rpmxar.c rpmzlog.c \
  -     strcasecmp.c stringbuf.c strtolocale.c tar.c url.c ugid.c yarn.c
  +     rpmbc.c rpmdav.c rpmgc.c rpmhash.c rpmhook.c rpmio.c rpmiob.c \
  +     rpmio-stub.c rpmku.c rpmlog.c rpmlua.c rpmmalloc.c rpmmg.c \
  +     rpmnss.c rpmpgp.c rpmrpc.c rpmsq.c rpmssl.c rpmsw.c rpmuuid.c \
  +     rpmxar.c rpmzlog.c strcasecmp.c stringbuf.c strtolocale.c \
  +     tar.c url.c ugid.c yarn.c
   librpmio_la_LDFLAGS = -release $(LT_CURRENT).$(LT_REVISION)
   if HAVE_LD_VERSION_SCRIPT
   librpmio_la_LDFLAGS += -Wl,--version-script=$(srcdir)/librpmio.vers
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/librpmio.vers
  ============================================================================
  $ cvs diff -u -r2.63.2.15 -r2.63.2.16 librpmio.vers
  --- rpm/rpmio/librpmio.vers   21 Mar 2009 15:26:25 -0000      2.63.2.15
  +++ rpm/rpmio/librpmio.vers   28 Mar 2009 17:44:36 -0000      2.63.2.16
  @@ -285,6 +285,16 @@
       rpmhookUnregisterAny;
       rpmInitMacros;
       _rpmio_debug;
  +    _rpmiob_chunk;
  +    rpmiobAppend;
  +    rpmiobBuf;
  +    rpmiobEmpty;
  +    rpmiobFree;
  +    rpmiobLen;
  +    rpmiobNew;
  +    rpmiobRTrim;
  +    rpmiobSlurp;
  +    rpmiobStr;
       rpmioAccess;
       rpmioAllPoptTable;
       rpmioClean;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmcb.h
  ============================================================================
  $ cvs diff -u -r2.2 -r2.2.4.1 rpmcb.h
  --- rpm/rpmio/rpmcb.h 8 Dec 2007 19:21:55 -0000       2.2
  +++ rpm/rpmio/rpmcb.h 28 Mar 2009 17:44:36 -0000      2.2.4.1
  @@ -5,6 +5,7 @@
    * \file rpmio/rpmcb.h
    */
   
  +#include <rpmiotypes.h>
   #include <rpmlog.h>
   
   /**
  @@ -23,55 +24,12 @@
   #define      rpmIsDebug()            \
        (rpmlogSetMask(0) >= RPMLOG_MASK( RPMLOG_DEBUG ))
   
  -/*...@-redef@*/ /* LCL: ??? */
  -typedef /*...@abstract@*/ const void * fnpyKey;
  -/*...@=redef@*/
  -
  -/**
  - * Bit(s) to identify progress callbacks.
  - */
  -typedef enum rpmCallbackType_e {
  -    RPMCALLBACK_UNKNOWN              = 0,
  -    RPMCALLBACK_INST_PROGRESS        = (1 <<  0),
  -    RPMCALLBACK_INST_START   = (1 <<  1),
  -    RPMCALLBACK_INST_OPEN_FILE       = (1 <<  2),
  -    RPMCALLBACK_INST_CLOSE_FILE      = (1 <<  3),
  -    RPMCALLBACK_TRANS_PROGRESS       = (1 <<  4),
  -    RPMCALLBACK_TRANS_START  = (1 <<  5),
  -    RPMCALLBACK_TRANS_STOP   = (1 <<  6),
  -    RPMCALLBACK_UNINST_PROGRESS      = (1 <<  7),
  -    RPMCALLBACK_UNINST_START = (1 <<  8),
  -    RPMCALLBACK_UNINST_STOP  = (1 <<  9),
  -    RPMCALLBACK_REPACKAGE_PROGRESS = (1 << 10),
  -    RPMCALLBACK_REPACKAGE_START      = (1 << 11),
  -    RPMCALLBACK_REPACKAGE_STOP       = (1 << 12),
  -    RPMCALLBACK_UNPACK_ERROR = (1 << 13),
  -    RPMCALLBACK_CPIO_ERROR   = (1 << 14),
  -    RPMCALLBACK_SCRIPT_ERROR = (1 << 15)
  -} rpmCallbackType;
  -
  -/**
  - */
  -typedef void * rpmCallbackData;
  -
   #ifdef __cplusplus
   extern "C" {
   #endif
   
   /**
    */
  -typedef void * (*rpmCallbackFunction)
  -             (/*...@null@*/ const void * h, 
  -             const rpmCallbackType what, 
  -             const uint64_t amount, 
  -             const uint64_t total,
  -             /*...@null@*/ fnpyKey key,
  -             /*...@null@*/ rpmCallbackData data)
  -     /*...@globals internalst...@*/
  -     /*...@modifies internalst...@*/;
  -
  -/**
  - */
   /*...@unused@*/
   void urlSetCallback(rpmCallbackFunction notify, rpmCallbackData notifyData,
                int notifyCount);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmio.c
  ============================================================================
  $ cvs diff -u -r1.127.2.18 -r1.127.2.19 rpmio.c
  --- rpm/rpmio/rpmio.c 25 Mar 2009 20:27:16 -0000      1.127.2.18
  +++ rpm/rpmio/rpmio.c 28 Mar 2009 17:44:36 -0000      1.127.2.19
  @@ -3086,68 +3086,6 @@
       return rc;
   }
   
  -int rpmioSlurp(const char * fn, uint8_t ** bp, ssize_t * blenp)
  -{
  -    static ssize_t blenmax = (32 * BUFSIZ);
  -    ssize_t blen = 0;
  -    uint8_t * b = NULL;
  -    struct stat sb;
  -    FD_t fd;
  -    int rc = 0;
  -    int xx;
  -
  -    fd = Fopen(fn, "r%{?_rpmgio}");
  -    if (fd == NULL || Ferror(fd)) {
  -     rc = 2;
  -     goto exit;
  -    }
  -    sb.st_size = 0;
  -    if ((xx = Fstat(fd, &sb)) < 0)
  -     sb.st_size = blenmax;
  -#if defined(__linux__)
  -    /* XXX st->st_size = 0 for /proc files on linux, see stat(2). */
  -    /* XXX glibc mmap'd libio no workie for /proc files on linux?!? */
  -    if (sb.st_size == 0 && !strncmp(fn, "/proc/", sizeof("/proc/")-1)) {
  -     blen = blenmax;
  -     b = xmalloc(blen+1);
  -     b[0] = (uint8_t) '\0';
  -
  -     xx = read(Fileno(fd), b, blen);
  -     blen = (size_t) (xx >= 0 ? xx : 0); 
  -    } else
  -#endif
  -    {
  -     blen = sb.st_size;
  -     b = xmalloc(blen+1);
  -     b[0] = (uint8_t) '\0';
  -
  -     blen = Fread(b, sizeof(*b), blen, fd);
  -     if (Ferror(fd)) {
  -         rc = 1;
  -         goto exit;
  -     }
  -    }
  -    if (blen < sb.st_size)
  -     b = xrealloc(b, blen+1);
  -    b[blen] = (uint8_t) '\0';
  -
  -exit:
  -    if (fd) (void) Fclose(fd);
  -     
  -    if (rc) {
  -     if (b) free(b);
  -     b = NULL;
  -     blen = 0;
  -    }
  -
  -    if (bp) *bp = b;
  -    else if (b) free(b);
  -
  -    if (blenp) *blenp = blen;
  -
  -    return rc;
  -}
  -
   #if defined(WITH_NSS) && !defined(__LCLINT__)        /* XXX TODO: add 
nssDestroy */
   /*...@-exportheader@*/
   extern void NSS_Shutdown(void);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmio.h
  ============================================================================
  $ cvs diff -u -r1.68.2.13 -r1.68.2.14 rpmio.h
  --- rpm/rpmio/rpmio.h 26 Mar 2009 20:10:03 -0000      1.68.2.13
  +++ rpm/rpmio/rpmio.h 28 Mar 2009 17:44:36 -0000      1.68.2.14
  @@ -16,6 +16,7 @@
   #include <stdlib.h>
   #include <unistd.h>
   
  +#include <rpmiotypes.h>
   #include <yarn.h>
   
   /** \ingroup rpmio
  @@ -48,17 +49,6 @@
   extern "C" {
   #endif
   
  -/**
  - * RPM return codes.
  - */
  -typedef      enum rpmRC_e {
  -    RPMRC_OK         = 0,    /*!< Generic success code */
  -    RPMRC_NOTFOUND   = 1,    /*!< Generic not found code. */
  -    RPMRC_FAIL               = 2,    /*!< Generic failure code. */
  -    RPMRC_NOTTRUSTED = 3,    /*!< Signature is OK, but key is not trusted. */
  -    RPMRC_NOKEY              = 4     /*!< Public key is unavailable. */
  -} rpmRC;
  -
   /** \ingroup rpmio
    * \name RPMIO Vectors.
    */
  @@ -710,100 +700,8 @@
   /*...@=exportlocal@*/
   /*...@}*/
   
  -/*...@unused@*/ static inline int xislower(int c) /*...@*/ {
  -    return (c >= (int)'a' && c <= (int)'z');
  -}
  -/*...@unused@*/ static inline int xisupper(int c) /*...@*/ {
  -    return (c >= (int)'A' && c <= (int)'Z');
  -}
  -/*...@unused@*/ static inline int xisalpha(int c) /*...@*/ {
  -    return (xislower(c) || xisupper(c));
  -}
  -/*...@unused@*/ static inline int xisdigit(int c) /*...@*/ {
  -    return (c >= (int)'0' && c <= (int)'9');
  -}
  -/*...@unused@*/ static inline int xisalnum(int c) /*...@*/ {
  -    return (xisalpha(c) || xisdigit(c));
  -}
  -/*...@unused@*/ static inline int xisblank(int c) /*...@*/ {
  -    return (c == (int)' ' || c == (int)'\t');
  -}
  -/*...@unused@*/ static inline int xisspace(int c) /*...@*/ {
  -    return (xisblank(c) || c == (int)'\n' || c == (int)'\r' || c == 
(int)'\f' || c == (int)'\v');
  -}
  -/*...@unused@*/ static inline int xiscntrl(int c) /*...@*/ {
  -    return (c < (int)' ');
  -}
  -/*...@unused@*/ static inline int xisascii(int c) /*...@*/ {
  -    return ((c & 0x80) != 0x80);
  -}
  -/*...@unused@*/ static inline int xisprint(int c) /*...@*/ {
  -    return (c >= (int)' ' && xisascii(c));
  -}
  -/*...@unused@*/ static inline int xisgraph(int c) /*...@*/ {
  -    return (c > (int)' ' && xisascii(c));
  -}
  -/*...@unused@*/ static inline int xispunct(int c) /*...@*/ {
  -    return (xisgraph(c) && !xisalnum(c));
  -}
  -
  -/*...@unused@*/ static inline int xtolower(int c) /*...@*/ {
  -    return ((xisupper(c)) ? (c | ('a' - 'A')) : c);
  -}
  -/*...@unused@*/ static inline int xtoupper(int c) /*...@*/ {
  -    return ((xislower(c)) ? (c & ~('a' - 'A')) : c);
  -}
  -
  -/** \ingroup rpmio
  - * Locale insensitive strcasecmp(3).
  - */
  -int xstrcasecmp(const char * s1, const char * s2)            /*...@*/;
  -
  -/** \ingroup rpmio
  - * Locale insensitive strncasecmp(3).
  - */
  -int xstrncasecmp(const char *s1, const char * s2, size_t n)  /*...@*/;
  -
  -/** \ingroup rpmio
  - * Force encoding of string.
  - */
  -/*...@only@*/ /*...@null@*/
  -const char * xstrtolocale(/*...@only@*/ const char *str)
  -     /*...@modifies *str @*/;
  -
  -#if !defined(SWIG)
  -/**
  - * Wrapper to free(3), hides const compilation noise, permit NULL, return 
NULL.
  - * @param p          memory to free
  - * @return           NULL always
  - */
  -#if defined(WITH_DMALLOC)
  -#define _free(p) ((p) != NULL ? free((void *)(p)) : (void)0, NULL)
  -#else
  -/*...@unused@*/ static inline /*...@null@*/
  -void * _free(/*...@only@*/ /*...@null@*/ /*...@out@*/ const void * p)
  -     /*...@modifies p @*/
  -{
  -    if (p != NULL)   free((void *)p);
  -    return NULL;
  -}
  -#endif
  -#endif
  -
  -/**
  - */
  -typedef      struct rpmioItem_s * rpmioItem;
  -struct rpmioItem_s {
  -    void *use;
  -    void *pool;
  -};
  -
   #include <rpmzlog.h>
   
  -/**
  - */
  -typedef struct rpmioPool_s * rpmioPool;
  -
   /*...@unchecked@*/ /*...@only@*/ /*...@null@*/
   extern rpmioPool _fdPool;
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmiob.c
  ============================================================================
  $ cvs diff -u -r0 -r1.3.2.2 rpmiob.c
  --- /dev/null 2009-03-28 18:44:00 +0100
  +++ rpmiob.c  2009-03-28 18:44:36 +0100
  @@ -0,0 +1,158 @@
  +/** \ingroup rpmio
  + * \file rpmio/rpmiob.c
  + */
  +#include "system.h"
  +#define      _RPMIOB_INTERNAL
  +#include <rpmiotypes.h>
  +#include <rpmio.h>
  +#include "debug.h"
  +
  +/*...@unchecked@*/
  +size_t _rpmiob_chunk = 1024;
  +
  +rpmiob rpmiobFree(rpmiob iob)
  +{
  +    if (iob != NULL) {
  +     iob->b = _free(iob->b);
  +     iob = _free(iob);
  +    }
  +    return NULL;
  +}
  +
  +rpmiob rpmiobNew(size_t len)
  +{
  +    rpmiob iob = xcalloc(1, sizeof(*iob));
  +    if (len == 0)
  +     len = _rpmiob_chunk;
  +    iob->allocated = len;
  +    iob->blen = 0;
  +    iob->b = xcalloc(iob->allocated+1, sizeof(*iob->b));
  +    return iob;
  +}
  +
  +rpmiob rpmiobEmpty(rpmiob iob)
  +{
  +assert(iob != NULL);
  +    iob->b[0] = '\0';
  +    iob->blen = 0;
  +    return iob;
  +}
  +
  +rpmiob rpmiobRTrim(rpmiob iob)
  +{
  +    
  +assert(iob != NULL);
  +    while (iob->blen > 0 && xisspace((int)iob->b[iob->blen-1]))
  +     iob->b[--iob->blen] = (uint8_t) '\0';
  +    return iob;
  +}
  +
  +rpmiob rpmiobAppend(rpmiob iob, const char * s, size_t nl)
  +{
  +    size_t ns = strlen(s);
  +    uint8_t * tail;
  +
  +    if (nl > 0) ns++;
  +
  +assert(iob != NULL);
  +    if ((iob->blen + ns) > iob->allocated) {
  +     iob->allocated += ((ns+_rpmiob_chunk-1)/_rpmiob_chunk) * _rpmiob_chunk;
  +     iob->b = xrealloc(iob->b, iob->allocated+1);
  +    }
  +
  +    tail = iob->b + iob->blen;
  +    tail = (uint8_t *) stpcpy((char *)tail, s);
  +    if (nl > 0) {
  +     *tail++ = (uint8_t) '\n';
  +     *tail = (uint8_t) '\0';
  +    }
  +    iob->blen += ns;
  +    return iob;
  +}
  +
  +uint8_t * rpmiobBuf(rpmiob iob)
  +{
  +assert(iob != NULL);
  +/*...@-retalias -usereleased @*/
  +    return iob->b;
  +/*...@=retalias =usereleased @*/
  +}
  +
  +char * rpmiobStr(rpmiob iob)
  +{
  +assert(iob != NULL);
  +/*...@-retalias -usereleased @*/
  +    return (char *) iob->b;
  +/*...@=retalias =usereleased @*/
  +}
  +
  +size_t rpmiobLen(rpmiob iob)
  +{
  +    return (iob != NULL ? iob->blen : 0);
  +}
  +
  +int rpmiobSlurp(const char * fn, rpmiob * iobp)
  +{
  +    static size_t blenmax = (32 * BUFSIZ);
  +    uint8_t * b = NULL;
  +    size_t blen;
  +    struct stat sb;
  +    FD_t fd;
  +    int rc = 0;
  +    int xx;
  +
  +    fd = Fopen(fn, "r%{?_rpmgio}");
  +    if (fd == NULL || Ferror(fd)) {
  +     rc = 2;
  +     goto exit;
  +    }
  +    sb.st_size = 0;
  +    if ((xx = Fstat(fd, &sb)) < 0)
  +     sb.st_size = blenmax;
  +#if defined(__linux__)
  +    /* XXX st->st_size = 0 for /proc files on linux, see stat(2). */
  +    /* XXX glibc mmap'd libio no workie for /proc files on linux?!? */
  +    if (sb.st_size == 0 && !strncmp(fn, "/proc/", sizeof("/proc/")-1)) {
  +     blen = blenmax;
  +     b = xmalloc(blen+1);
  +     b[0] = (uint8_t) '\0';
  +
  +     xx = read(Fileno(fd), b, blen);
  +     blen = (size_t) (xx >= 0 ? xx : 0); 
  +    } else
  +#endif
  +    {
  +     blen = sb.st_size;
  +     b = xmalloc(blen+1);
  +     b[0] = (uint8_t) '\0';
  +
  +     blen = Fread(b, sizeof(*b), blen, fd);
  +     if (Ferror(fd)) {
  +         rc = 1;
  +         goto exit;
  +     }
  +    }
  +    if (blen < (size_t)sb.st_size)
  +     b = xrealloc(b, blen+1);
  +    b[blen] = (uint8_t) '\0';
  +
  +exit:
  +    if (fd != NULL) (void) Fclose(fd);
  +
  +    if (rc == 0) {
  +     if (iobp != NULL) {
  +         /* XXX use rpmiobNew() if/when lazy iop->b alloc is implemented. */
  +         rpmiob iob = xcalloc(1, sizeof(*iob));
  +         iob->b = b;
  +         iob->blen = blen;
  +         iob->allocated = blen;
  +         *iobp = iob;
  +     }
  +    } else {
  +     if (iobp)
  +         *iobp = NULL;
  +     b = _free(b);
  +    }
  +
  +    return rc;
  +}
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmiotypes.h
  ============================================================================
  $ cvs diff -u -r0 -r1.15.2.2 rpmiotypes.h
  --- /dev/null 2009-03-28 18:44:00 +0100
  +++ rpmiotypes.h      2009-03-28 18:44:36 +0100
  @@ -0,0 +1,327 @@
  +#ifndef _H_RPMIOTYPES_
  +#define      _H_RPMIOTYPES_
  +
  +/** \ingroup rpmio
  + * \file rpmio/rpmiotypes.h
  + */
  +
  +/** \ingroup rpmio
  + * RPM return codes.
  + */
  +typedef      enum rpmRC_e {
  +    RPMRC_OK         = 0,    /*!< Generic success code */
  +    RPMRC_NOTFOUND   = 1,    /*!< Generic not found code. */
  +    RPMRC_FAIL               = 2,    /*!< Generic failure code. */
  +    RPMRC_NOTTRUSTED = 3,    /*!< Signature is OK, but key is not trusted. */
  +    RPMRC_NOKEY              = 4     /*!< Public key is unavailable. */
  +} rpmRC;
  +
  +/**
  + */
  +typedef      /*...@refcounted@*/ struct rpmioItem_s * rpmioItem;
  +struct rpmioItem_s {
  +/*...@null@*/
  +    void *use;                       /*!< use count -- return to pool when 
zero */
  +/*...@kept@*/ /*...@null@*/
  +    void *pool;                      /*!< pool (or NULL if malloc'd) */
  +#if defined(__LCLINT__)
  +/*...@refs@*/
  +    int nrefs;                       /*!< (unused) keep splint happy */
  +#endif
  +};
  +
  +/**
  + */
  +typedef struct rpmioPool_s * rpmioPool;
  +
  +/** \ingroup rpmio
  + */
  +typedef struct rpmiob_s * rpmiob;
  +
  +/** \ingroup rpmio
  + */
  +/*...@unchecked@*/
  +extern size_t _rpmiob_chunk;
  +
  +/** \ingroup rpmpgp
  + */
  +typedef /*...@abstract@*/ struct DIGEST_CTX_s * DIGEST_CTX;
  +
  +/** \ingroup rpmpgp
  + */
  +typedef /*...@abstract@*/ struct pgpPkt_s * pgpPkt;
  +
  +/** \ingroup rpmpgp
  + */
  +typedef /*...@abstract@*/ /*...@refcounted@*/ struct pgpDig_s * pgpDig;
  +
  +/** \ingroup rpmpgp
  + */
  +typedef /*...@abstract@*/ struct pgpDigParams_s * pgpDigParams;
  +
  +/** \ingroup rpmpgp
  + * Bit(s) to control digest and signature verification.
  + */
  +typedef enum pgpVSFlags_e {
  +    RPMVSF_DEFAULT   = 0,
  +    RPMVSF_NOHDRCHK  = (1 <<  0),
  +    RPMVSF_NEEDPAYLOAD       = (1 <<  1),
  +    /* bit(s) 2-7 unused */
  +    RPMVSF_NOSHA1HEADER      = (1 <<  8),
  +    RPMVSF_NOMD5HEADER       = (1 <<  9),    /* unimplemented */
  +    RPMVSF_NODSAHEADER       = (1 << 10),
  +    RPMVSF_NORSAHEADER       = (1 << 11),
  +    /* bit(s) 12-15 unused */
  +    RPMVSF_NOSHA1    = (1 << 16),    /* unimplemented */
  +    RPMVSF_NOMD5     = (1 << 17),
  +    RPMVSF_NODSA     = (1 << 18),
  +    RPMVSF_NORSA     = (1 << 19)
  +    /* bit(s) 20-31 unused */
  +} pgpVSFlags;
  +
  +#define      _RPMVSF_NODIGESTS       \
  +  ( RPMVSF_NOSHA1HEADER |    \
  +    RPMVSF_NOMD5HEADER |     \
  +    RPMVSF_NOSHA1 |          \
  +    RPMVSF_NOMD5 )
  +
  +#define      _RPMVSF_NOSIGNATURES    \
  +  ( RPMVSF_NODSAHEADER |     \
  +    RPMVSF_NORSAHEADER |     \
  +    RPMVSF_NODSA |           \
  +    RPMVSF_NORSA )
  +
  +#define      _RPMVSF_NOHEADER        \
  +  ( RPMVSF_NOSHA1HEADER |    \
  +    RPMVSF_NOMD5HEADER |     \
  +    RPMVSF_NODSAHEADER |     \
  +    RPMVSF_NORSAHEADER )
  +
  +#define      _RPMVSF_NOPAYLOAD       \
  +  ( RPMVSF_NOSHA1 |          \
  +    RPMVSF_NOMD5 |           \
  +    RPMVSF_NODSA |           \
  +    RPMVSF_NORSA )
  +
  +/*...@-redef@*/ /* LCL: ??? */
  +typedef /*...@abstract@*/ const void * fnpyKey;
  +/*...@=redef@*/
  +
  +/**
  + * Bit(s) to identify progress callbacks.
  + */
  +typedef enum rpmCallbackType_e {
  +    RPMCALLBACK_UNKNOWN         = 0,
  +    RPMCALLBACK_INST_PROGRESS   = (1 <<  0),
  +    RPMCALLBACK_INST_START      = (1 <<  1),
  +    RPMCALLBACK_INST_OPEN_FILE  = (1 <<  2),
  +    RPMCALLBACK_INST_CLOSE_FILE = (1 <<  3),
  +    RPMCALLBACK_TRANS_PROGRESS  = (1 <<  4),
  +    RPMCALLBACK_TRANS_START     = (1 <<  5),
  +    RPMCALLBACK_TRANS_STOP      = (1 <<  6),
  +    RPMCALLBACK_UNINST_PROGRESS = (1 <<  7),
  +    RPMCALLBACK_UNINST_START    = (1 <<  8),
  +    RPMCALLBACK_UNINST_STOP     = (1 <<  9),
  +    RPMCALLBACK_REPACKAGE_PROGRESS = (1 << 10),
  +    RPMCALLBACK_REPACKAGE_START = (1 << 11),
  +    RPMCALLBACK_REPACKAGE_STOP  = (1 << 12),
  +    RPMCALLBACK_UNPACK_ERROR    = (1 << 13),
  +    RPMCALLBACK_CPIO_ERROR      = (1 << 14),
  +    RPMCALLBACK_SCRIPT_ERROR    = (1 << 15)
  +} rpmCallbackType;
  +
  +/**
  + */
  +typedef void * rpmCallbackData;
  +
  +#if defined(_RPMIOB_INTERNAL)
  +/** \ingroup rpmio
  + */
  +struct rpmiob_s{
  +    uint8_t * b;     /*!< data octects. */
  +    size_t blen;     /*!< no. of octets used. */
  +    size_t allocated;        /*!< no. of octets allocated. */
  +};
  +#endif
  +
  +#ifdef __cplusplus
  +extern "C" {
  +#endif
  +
  +/** \ingroup rpmio
  + */
  +typedef void * (*rpmCallbackFunction)
  +                (/*...@null@*/ const void * h,
  +                const rpmCallbackType what,
  +                const uint64_t amount,
  +                const uint64_t total,
  +                /*...@null@*/ fnpyKey key,
  +                /*...@null@*/ rpmCallbackData data)
  +        /*...@globals internalst...@*/
  +        /*...@modifies internalst...@*/;
  +
  +#if !defined(SWIG)
  +/** \ingroup rpmio
  + * Wrapper to free(3), hides const compilation noise, permit NULL, return 
NULL.
  + * @param p          memory to free
  + * @return           NULL always
  + */
  +#if defined(WITH_DMALLOC)
  +#define _free(p) ((p) != NULL ? free((void *)(p)) : (void)0, NULL)
  +#else
  +/*...@unused@*/ static inline /*...@null@*/
  +void * _free(/*...@only@*/ /*...@null@*/ /*...@out@*/ const void * p)
  +     /*...@modifies p @*/
  +{
  +    if (p != NULL)   free((void *)p);
  +    return NULL;
  +}
  +#endif
  +#endif
  +
  +/*...@unused@*/ static inline int xislower(int c) /*...@*/ {
  +    return (c >= (int)'a' && c <= (int)'z');
  +}
  +/*...@unused@*/ static inline int xisupper(int c) /*...@*/ {
  +    return (c >= (int)'A' && c <= (int)'Z');
  +}
  +/*...@unused@*/ static inline int xisalpha(int c) /*...@*/ {
  +    return (xislower(c) || xisupper(c));
  +}
  +/*...@unused@*/ static inline int xisdigit(int c) /*...@*/ {
  +    return (c >= (int)'0' && c <= (int)'9');
  +}
  +/*...@unused@*/ static inline int xisalnum(int c) /*...@*/ {
  +    return (xisalpha(c) || xisdigit(c));
  +}
  +/*...@unused@*/ static inline int xisblank(int c) /*...@*/ {
  +    return (c == (int)' ' || c == (int)'\t');
  +}
  +/*...@unused@*/ static inline int xisspace(int c) /*...@*/ {
  +    return (xisblank(c) || c == (int)'\n' || c == (int)'\r' || c == 
(int)'\f' || c == (int)'\v');
  +}
  +/*...@unused@*/ static inline int xiscntrl(int c) /*...@*/ {
  +    return (c < (int)' ');
  +}
  +/*...@unused@*/ static inline int xisascii(int c) /*...@*/ {
  +    return ((c & 0x80) != 0x80);
  +}
  +/*...@unused@*/ static inline int xisprint(int c) /*...@*/ {
  +    return (c >= (int)' ' && xisascii(c));
  +}
  +/*...@unused@*/ static inline int xisgraph(int c) /*...@*/ {
  +    return (c > (int)' ' && xisascii(c));
  +}
  +/*...@unused@*/ static inline int xispunct(int c) /*...@*/ {
  +    return (xisgraph(c) && !xisalnum(c));
  +}
  +
  +/*...@unused@*/ static inline int xtolower(int c) /*...@*/ {
  +    return ((xisupper(c)) ? (c | ('a' - 'A')) : c);
  +}
  +/*...@unused@*/ static inline int xtoupper(int c) /*...@*/ {
  +    return ((xislower(c)) ? (c & ~('a' - 'A')) : c);
  +}
  +
  +/** \ingroup rpmio
  + * Locale insensitive strcasecmp(3).
  + */
  +int xstrcasecmp(const char * s1, const char * s2)            /*...@*/;
  +
  +/** \ingroup rpmio
  + * Locale insensitive strncasecmp(3).
  + */
  +int xstrncasecmp(const char *s1, const char * s2, size_t n)  /*...@*/;
  +
  +/** \ingroup rpmio
  + * Force encoding of string.
  + */
  +/*...@only@*/ /*...@null@*/
  +const char * xstrtolocale(/*...@only@*/ const char *str)
  +     /*...@modifies *str @*/;
  +
  +/**
  + * Destroy an I/O buffer.
  + * @param iob                I/O buffer
  + * @return           NULL always
  + */
  +/*...@null@*/
  +rpmiob rpmiobFree(/*...@only@*/ /*...@null@*/ rpmiob iob)
  +     /*...@modifies iob @*/;
  +
  +/**
  + * Create an I/O buffer.
  + * @param len                no. of octets to allocate
  + * @return           new I/O buffer
  + */
  +/*...@only@*/
  +rpmiob rpmiobNew(size_t len)
  +     /*...@*/;
  +
  +/**
  + * Empty an I/O buffer.
  + * @param iob                I/O buffer
  + * @return           I/O buffer
  + */
  +rpmiob rpmiobEmpty(/*...@returned@*/ rpmiob iob)
  +     /*...@modifies iob @*/;
  +
  +/**
  + * Trim trailing white space.
  + * @param iob                I/O buffer
  + * @return           I/O buffer
  + */
  +rpmiob rpmiobRTrim(/*...@returned@*/ rpmiob iob)
  +     /*...@modifies iob @*/;
  +
  +/**
  + * Append string to I/O buffer.
  + * @param iob                I/O buffer
  + * @param s          string
  + * @param nl         append NL?
  + * @return           I/O buffer
  + */
  +rpmiob rpmiobAppend(/*...@returned@*/ rpmiob iob, const char * s, size_t nl)
  +     /*...@modifies iob @*/;
  +
  +/**
  + * Return I/O buffer.
  + * @param iob                I/O buffer
  + * @return           I/O buffer (as string)
  + */
  +uint8_t * rpmiobBuf(rpmiob iob)
  +     /*...@*/;
  +
  +/**
  + * Return I/O buffer (as string).
  + * @param iob                I/O buffer
  + * @return           I/O buffer (as string)
  + */
  +char * rpmiobStr(rpmiob iob)
  +     /*...@*/;
  +
  +/**
  + * Return I/O buffer len.
  + * @param iob                I/O buffer
  + * @return           I/O buffer length
  + */
  +size_t rpmiobLen(rpmiob iob)
  +     /*...@*/;
  +
  +#if defined(_RPMIOB_INTERNAL)
  +/**
  + * Read an entire file into a buffer.
  + * @param fn         file name to read
  + * @retval *iobp     I/O buffer
  + * @return           0 on success
  + */
  +int rpmiobSlurp(const char * fn, rpmiob * iobp)
  +        /*...@globals h_errno, fileSystem, internalState @*/
  +        /*...@modifies *iobp, fileSystem, internalState @*/;
  +#endif
  +
  +#ifdef __cplusplus
  +}
  +#endif
  +
  +#endif /* _H_RPMIOTYPES_ */
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmlua.c
  ============================================================================
  $ cvs diff -u -r2.52.2.4 -r2.52.2.5 rpmlua.c
  --- rpm/rpmio/rpmlua.c        17 Jan 2009 14:31:27 -0000      2.52.2.4
  +++ rpm/rpmio/rpmlua.c        28 Mar 2009 17:44:36 -0000      2.52.2.5
  @@ -1,8 +1,8 @@
  -/*...@-realcompare -sizeoftype @*/
  +/*...@-moduncon -mustmod -realcompare -sizeoftype @*/
   #include "system.h"
   
   #ifdef       WITH_LUA
  -#include <rpmio_internal.h>
  +#define      _RPMIOB_INTERNAL
   #include <rpmio.h>
   #include <rpmmacro.h>
   #include <rpmlog.h>
  @@ -10,6 +10,7 @@
   #include <rpmhook.h>
   #include <rpmcb.h>
   #include <argv.h>
  +#include <popt.h>            /* XXX poptSaneFile test */
   
   #include <lua.h>
   #include <lualib.h>
  @@ -47,7 +48,7 @@
            )
   
   /*...@only@*/ /*...@unchecked@*/ /*...@relnull@*/
  -static rpmlua globalLuaState = NULL;
  +static rpmlua globalLuaState;
   
   static int luaopen_rpm(lua_State *L)
        /*...@modifies L @*/;
  @@ -55,10 +56,10 @@
        /*...@globals fileSystem @*/
        /*...@modifies L, fileSystem @*/;
   
  -/*...@unchecked@*/
  -const char *rpmluaFiles = RPMLUAFILES;
  +/*...@unchecked@*/ /*...@observer@*/
  +const char * rpmluaFiles = RPMLUAFILES;
   
  -/*...@unchecked@*/
  +/*...@unchecked@*/ /*...@observer@*/
   const char * rpmluaPath = "%{?_rpmhome}%{!?_rpmhome:" USRLIBRPM 
"}/lua/?.lua";
   
   rpmlua rpmluaGetGlobalState(void)
  @@ -68,12 +69,12 @@
   /*...@=globstate@*/
   }
   
  -/*...@-mods@*/       /* XXX hide rpmGlobalMacroContext mods for now. */
  +/*...@-globs -m...@*/        /* XXX hide rpmGlobalMacroContext mods for now. 
*/
   rpmlua rpmluaNew()
   {
       rpmlua lua = (rpmlua) xcalloc(1, sizeof(*lua));
       lua_State *L = lua_open();
  -    /*...@-readonlytrans@*/
  +    /*...@-readonlytrans -nullassign @*/
       /*...@observer@*/ /*...@unchecked@*/
       static const luaL_reg lualibs[] = {
        /* standard LUA libraries */
  @@ -97,9 +98,9 @@
        {"rpm", luaopen_rpm},
        {NULL, NULL},
       };
  +    /*...@=readonlytrans =nullassign @*/
       /*...@observer@*/ /*...@unchecked@*/
       const luaL_reg *lib = lualibs;
  -    /*...@=readonlytrans@*/
       char *path_buf;
       char *path_next;
       char *path;
  @@ -150,7 +151,12 @@
               const char *fn = av[i];
               if (fn[0] == '@' /* attention */) {
                   fn++;
  -                if (!rpmSecuritySaneFile(fn)) {
  +#if !defined(POPT_ERROR_BADCONFIG)   /* XXX popt-1.15- retrofit */
  +             if (!rpmSecuritySaneFile(fn))
  +#else
  +             if (!poptSaneFile(fn))
  +#endif
  +             {
                       rpmlog(RPMLOG_WARNING, "existing RPM Lua script file 
\"%s\" considered INSECURE -- not loaded\n", fn);
                       /*...@innercontinue@*/ continue;
                   }
  @@ -165,7 +171,7 @@
   
       return lua;
   }
  -/*...@=mods@*/
  +/*...@=globs =m...@*/
   
   void *rpmluaFree(rpmlua lua)
        /*...@globals globalLuaState @*/
  @@ -179,7 +185,9 @@
        if (lua == globalLuaState) globalLuaState = NULL;
        lua = _free(lua);
       }
  +/*...@-globstate@*/
       return NULL;
  +/*...@=globstate@*/
   }
   
   void rpmluaSetData(rpmlua _lua, const char *key, const void *data)
  @@ -196,6 +204,7 @@
       lua_rawset(L, LUA_REGISTRYINDEX);
   }
   
  +/*...@null@*/
   static void *getdata(lua_State *L, const char *key)
        /*...@modifies L @*/
   {
  @@ -687,7 +696,9 @@
       lua_newtable(L);
   /*...@=modunconnomods@*/
   
  +/*...@-globs@*/
       ac = rpmGetMacroEntries(NULL, NULL, -1, &av);
  +/*...@=globs@*/
   
       if (av != NULL)
       for (i = 0; i < ac; i++) {
  @@ -979,7 +990,9 @@
        (void)luaL_argerror(L, 1, "filename expected");
       } else {
        const char *filename = lua_tostring(L, 1);
  +/*...@-globs@*/
        (void)rpmLoadMacroFile(NULL, filename);
  +/*...@=globs@*/
       }
       return 0;
   }
  @@ -1004,10 +1017,9 @@
        /*...@globals fileSystem, internalState @*/
        /*...@modifies L, fileSystem, internalState @*/
   {
  -    uint8_t *b;
  -    ssize_t blen;
  -    int rc;
  +    rpmiob iob = NULL;
       const char *fn;
  +    int rc;
   
       if (lua_isstring(L, 1))
           fn = lua_tostring(L, 1);
  @@ -1015,12 +1027,15 @@
           (void)luaL_argerror(L, 1, "filename");
           return 0;
       }
  -    rc = rpmioSlurp(fn, &b, &blen);
  -    if (rc || b == NULL || blen <= 0) {
  +/*...@-globs@*/
  +    rc = rpmiobSlurp(fn, &iob);
  +/*...@=globs@*/
  +    if (rc || iob == NULL) {
           (void)luaL_error(L, "failed to slurp data");
           return 0;
       }
  -    lua_pushlstring(L, (const char *)b, (size_t)blen);
  +    lua_pushlstring(L, (const char *)rpmiobStr(iob), rpmiobLen(iob));
  +    iob = rpmiobFree(iob);
       return 1;
   }
   
  @@ -1046,7 +1061,7 @@
   {
       const char *pn;
       char rp_buf[PATH_MAX];
  -    char *rp;
  +    char *rp = "";
   
       if (lua_isstring(L, 1))
           pn = lua_tostring(L, 1);
  @@ -1054,7 +1069,7 @@
           (void)luaL_argerror(L, 1, "pathname");
           return 0;
       }
  -    if ((rp = realpath(pn, rp_buf)) == NULL) {
  +    if ((rp = Realpath(pn, rp_buf)) == NULL) {
           (void)luaL_error(L, "failed to resolve path via realpath(3): %s", 
strerror(errno));
           return 0;
       }
  @@ -1062,7 +1077,7 @@
       return 1;
   }
   
  -/*...@-readonlytrans@*/
  +/*...@-readonlytrans -nullassign @*/
   /*...@observer@*/ /*...@unchecked@*/
   static const luaL_reg rpmlib[] = {
       {"macros", rpm_macros},
  @@ -1082,7 +1097,7 @@
       {"realpath", rpm_realpath},
       {NULL, NULL}
   };
  -/*...@=readonlytrans@*/
  +/*...@=readonlytrans =nullassign @*/
   
   static int luaopen_rpm(lua_State *L)
        /*...@modifies L @*/
  @@ -1093,4 +1108,4 @@
   }
   #endif       /* WITH_LUA */
   
  -/*...@=realcompare =sizeoftype @*/
  +/*...@=moduncon =mustmod =realcompare =sizeoftype @*/
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmpgp.c
  ============================================================================
  $ cvs diff -u -r2.90.2.7 -r2.90.2.8 rpmpgp.c
  --- rpm/rpmio/rpmpgp.c        25 Mar 2009 20:27:16 -0000      2.90.2.7
  +++ rpm/rpmio/rpmpgp.c        28 Mar 2009 17:44:36 -0000      2.90.2.8
  @@ -4,7 +4,9 @@
    */
   
   #include "system.h"
  -#include "rpmio_internal.h"
  +
  +#define      _RPMIOB_INTERNAL
  +#include <rpmio.h>
   
   #define      _RPMPGP_INTERNAL
   #include <rpmbc.h>   /* XXX still needs base64 goop */
  @@ -1046,39 +1048,39 @@
   {
       pgpDig dig = __dig;
   
  -     /* Lose the header tag data. */
  -     /* XXX this free should be done somewhere else. */
  -     dig->sig = _free(dig->sig);
  +    /* Lose the header tag data. */
  +    /* XXX this free should be done somewhere else. */
  +    dig->sig = _free(dig->sig);
   
  -     /* XXX there's a recursion here ... release and reacquire the lock */
  +    /* XXX there's a recursion here ... release and reacquire the lock */
   #ifndef      BUGGY
  -     yarnRelease(dig->_item.use);
  +    yarnRelease(dig->_item.use);
   #endif
  -     /* Dump the signature/pubkey data. */
  -     pgpDigClean(dig);
  +    /* Dump the signature/pubkey data. */
  +    pgpDigClean(dig);
   #ifndef      BUGGY
  -     yarnPossess(dig->_item.use);
  +    yarnPossess(dig->_item.use);
   #endif
   
  -     if (dig->hdrsha1ctx != NULL)
  -         (void) rpmDigestFinal(dig->hdrsha1ctx, NULL, NULL, 0);
  -     dig->hdrsha1ctx = NULL;
  -
  -     if (dig->sha1ctx != NULL)
  -         (void) rpmDigestFinal(dig->sha1ctx, NULL, NULL, 0);
  -     dig->sha1ctx = NULL;
  +    if (dig->hdrsha1ctx != NULL)
  +     (void) rpmDigestFinal(dig->hdrsha1ctx, NULL, NULL, 0);
  +    dig->hdrsha1ctx = NULL;
  +
  +    if (dig->sha1ctx != NULL)
  +     (void) rpmDigestFinal(dig->sha1ctx, NULL, NULL, 0);
  +    dig->sha1ctx = NULL;
   
   #ifdef       NOTYET
  -     if (dig->hdrmd5ctx != NULL)
  -         (void) rpmDigestFinal(dig->hdrmd5ctx, NULL, NULL, 0);
  -     dig->hdrmd5ctx = NULL;
  +    if (dig->hdrmd5ctx != NULL)
  +     (void) rpmDigestFinal(dig->hdrmd5ctx, NULL, NULL, 0);
  +    dig->hdrmd5ctx = NULL;
   #endif
   
  -     if (dig->md5ctx != NULL)
  -         (void) rpmDigestFinal(dig->md5ctx, NULL, NULL, 0);
  -     dig->md5ctx = NULL;
  +    if (dig->md5ctx != NULL)
  +     (void) rpmDigestFinal(dig->md5ctx, NULL, NULL, 0);
  +    dig->md5ctx = NULL;
   
  -     dig->impl = pgpImplFree(dig->impl);
  +    dig->impl = pgpImplFree(dig->impl);
   
   }
   
  @@ -1276,8 +1278,7 @@
   
   pgpArmor pgpReadPkts(const char * fn, uint8_t ** pkt, size_t * pktlen)
   {
  -    uint8_t * b = NULL;
  -    ssize_t blen;
  +    rpmiob iob = NULL;
       const char * enc = NULL;
       const char * crcenc = NULL;
       uint8_t * dec;
  @@ -1292,12 +1293,12 @@
       pgpTag tag = 0;
       int rc;
   
  -    rc = rpmioSlurp(fn, &b, &blen);
  -    if (rc || b == NULL || blen <= 0)
  +    rc = rpmiobSlurp(fn, &iob);
  +    if (rc || iob == NULL)
        goto exit;
   
       /* Read unarmored packets. */
  -    if (pgpIsPkt(b, &tag)) {
  +    if (pgpIsPkt(iob->b, &tag)) {
        switch (tag) {
        default:                ec = PGPARMOR_NONE;     break;
        case PGPTAG_PUBLIC_KEY: ec = PGPARMOR_PUBKEY;   break;
  @@ -1313,7 +1314,7 @@
        /* Truncate blen to actual no. of octets in packet. */
        if (ec != PGPARMOR_NONE) {
            pgpPkt pp = alloca(sizeof(*pp));
  -         blen = pgpPktLen(b, blen, pp);
  +         iob->blen = pgpPktLen(iob->b, iob->blen, pp);
        }
        goto exit;
       }
  @@ -1321,7 +1322,7 @@
   #define      TOKEQ(_s, _tok) (!strncmp((_s), (_tok), sizeof(_tok)-1))
   
       /* Read armored packets, converting to binary. */
  -    for (t = (char *)b; t && *t; t = te) {
  +    for (t = (char *)iob->b; t && *t; t = te) {
        if ((te = strchr(t, '\n')) == NULL)
            te = t + strlen(t);
        else
  @@ -1423,9 +1424,9 @@
                ec = PGPARMOR_ERR_CRC_CHECK;
                goto exit;
            }
  -         b = _free(b);
  -         b = dec;
  -         blen = declen;
  +         iob->b = _free(iob->b);
  +         iob->b = dec;
  +         iob->blen = declen;
            goto exit;
            /*...@notreached@*/ /*...@switchbreak@*/ break;
        }
  @@ -1434,14 +1435,14 @@
   
   exit:
       if (ec > PGPARMOR_NONE) {
  -     if (pkt)        *pkt = b;
  -     if (pktlen)     *pktlen = blen;
  -     b = NULL;       /* XXX b has been stolen */
  +     if (pkt)        *pkt = iob->b;
  +     if (pktlen)     *pktlen = iob->blen;
  +     iob = _free(iob);       /* XXX iob->b has been stolen */
       } else {
        if (pkt)        *pkt = NULL;
        if (pktlen)     *pktlen = 0;
       }
  -    b = _free(b);
  +    iob = rpmiobFree(iob);
       return ec;
   }
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmpgp.h
  ============================================================================
  $ cvs diff -u -r2.72.2.8 -r2.72.2.9 rpmpgp.h
  --- rpm/rpmio/rpmpgp.h        26 Mar 2009 20:10:03 -0000      2.72.2.8
  +++ rpm/rpmio/rpmpgp.h        28 Mar 2009 17:44:36 -0000      2.72.2.9
  @@ -12,68 +12,9 @@
   
   #include <string.h>
   #include <popt.h>
  +#include <rpmiotypes.h>
   #include <yarn.h>
   
  -/** \ingroup rpmpgp
  - */
  -typedef /*...@abstract@*/ struct DIGEST_CTX_s * DIGEST_CTX;
  -
  -/** \ingroup rpmpgp
  - */
  -typedef /*...@abstract@*/ struct pgpPkt_s * pgpPkt;
  -
  -/**
  - */
  -typedef /*...@abstract@*/ /*...@refcounted@*/ struct pgpDig_s * pgpDig;
  -
  -/**
  - */
  -typedef /*...@abstract@*/ struct pgpDigParams_s * pgpDigParams;
  -
  -/** \ingroup rpmpgp
  - * Bit(s) to control digest and signature verification.
  - */
  -typedef enum pgpVSFlags_e {
  -    RPMVSF_DEFAULT   = 0,
  -    RPMVSF_NOHDRCHK  = (1 <<  0),
  -    RPMVSF_NEEDPAYLOAD       = (1 <<  1),
  -    /* bit(s) 2-7 unused */
  -    RPMVSF_NOSHA1HEADER      = (1 <<  8),
  -    RPMVSF_NOMD5HEADER       = (1 <<  9),    /* unimplemented */
  -    RPMVSF_NODSAHEADER       = (1 << 10),
  -    RPMVSF_NORSAHEADER       = (1 << 11),
  -    /* bit(s) 12-15 unused */
  -    RPMVSF_NOSHA1    = (1 << 16),    /* unimplemented */
  -    RPMVSF_NOMD5     = (1 << 17),
  -    RPMVSF_NODSA     = (1 << 18),
  -    RPMVSF_NORSA     = (1 << 19)
  -    /* bit(s) 20-31 unused */
  -} pgpVSFlags;
  -
  -#define      _RPMVSF_NODIGESTS       \
  -  ( RPMVSF_NOSHA1HEADER |    \
  -    RPMVSF_NOMD5HEADER |     \
  -    RPMVSF_NOSHA1 |          \
  -    RPMVSF_NOMD5 )
  -
  -#define      _RPMVSF_NOSIGNATURES    \
  -  ( RPMVSF_NODSAHEADER |     \
  -    RPMVSF_NORSAHEADER |     \
  -    RPMVSF_NODSA |           \
  -    RPMVSF_NORSA )
  -
  -#define      _RPMVSF_NOHEADER        \
  -  ( RPMVSF_NOSHA1HEADER |    \
  -    RPMVSF_NOMD5HEADER |     \
  -    RPMVSF_NODSAHEADER |     \
  -    RPMVSF_NORSAHEADER )
  -
  -#define      _RPMVSF_NOPAYLOAD       \
  -  ( RPMVSF_NOSHA1 |          \
  -    RPMVSF_NOMD5 |           \
  -    RPMVSF_NODSA |           \
  -    RPMVSF_NORSA )
  -
   #if defined(_RPMPGP_INTERNAL)
   #include <rpmsw.h>
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/tools/rpmdigest.c
  ============================================================================
  $ cvs diff -u -r2.4.2.4 -r2.4.2.5 rpmdigest.c
  --- rpm/tools/rpmdigest.c     16 Jan 2009 20:48:18 -0000      2.4.2.4
  +++ rpm/tools/rpmdigest.c     28 Mar 2009 17:44:37 -0000      2.4.2.5
  @@ -2,6 +2,7 @@
   /*...@unchecked@*/
   extern const char * __progname;
   
  +#define      _RPMIOB_INTERNAL
   #include <rpmio_internal.h>  /* XXX fdGetFILE */
   #include <poptIO.h>
   #include "debug.h"
  @@ -296,27 +297,26 @@
       while ((dc->fn = *dc->manifests++) != NULL) {
        unsigned lineno;
        char * be;
  -     uint8_t * b = NULL;
  -     ssize_t blen = 0;
  -     int xx = rpmioSlurp(dc->fn, &b, &blen);
  +     rpmiob iob = NULL;
  +     int xx = rpmiobSlurp(dc->fn, &iob);
        const char * digest;
        char * f;
        char * fe;
   
  -     if (!(xx == 0 && b != NULL && blen > 0)) {
  +     if (!(xx == 0 && iob != NULL)) {
            fprintf(stderr, _("%s: Failed to open %s\n"), __progname, dc->fn);
            rc = -1;
            goto bottom;
        }
   
  -     be = (char *)(b + blen);
  -     while (be > (char *)b && (be[-1] == '\n' || be[-1] == '\r')) {
  +     be = (char *)(iob->b + iob->blen);
  +     while (be > (char *)iob->b && (be[-1] == '\n' || be[-1] == '\r')) {
          be--;
          *be = '\0';
        }
   
        /* Parse "algo=digest" from last line. */
  -     be = strrchr((char *)b, '=');
  +     be = strrchr((char *)iob->b, '=');
        if (be == NULL) {
            fprintf(stderr,
                _("%s: %s: Manifest needs \"algo=digest\" as last line\n"),
  @@ -326,9 +326,9 @@
        }
        *be = '\0';
        dc->digest = be + 1;
  -     while (be > (char *)b && !(be[-1] == '\n' || be[-1] == '\r'))
  +     while (be > (char *)iob->b && !(be[-1] == '\n' || be[-1] == '\r'))
            be--;
  -     if (be <= (char *)b) {
  +     if (be <= (char *)iob->b) {
            fprintf(stderr, _("%s: %s: Manifest is empty\n"),
                __progname, dc->fn);
            rc = 2;
  @@ -347,7 +347,7 @@
        /* Verify the manifest digest. */
        {   DIGEST_CTX ctx = rpmDigestInit(dc->dalgo, 0);
   
  -         (void) rpmDigestUpdate(ctx, (char *)b, (be - (char *)b));
  +         (void) rpmDigestUpdate(ctx, (char *)iob->b, (be - (char *)iob->b));
            digest = NULL;
            (void) rpmDigestFinal(ctx, &digest, NULL, 1);
            if (strcmp(dc->digest, digest)) {
  @@ -362,7 +362,7 @@
   
        /* Parse and save manifest items. */
        lineno = 0;
  -     for (f = (char *)b; *f; f = fe) {
  +     for (f = (char *)iob->b; *f; f = fe) {
            static const char hexdigits[] = "0123456789ABCDEFabcdef";
            const char * _dn = NULL;
            const char * path;
  @@ -432,7 +432,7 @@
        }
   
   bottom:
  -     b = _free(b);
  +     iob = rpmiobFree(iob);
        if (rc != 0)
            goto exit;
       }
  @@ -530,9 +530,9 @@
   fprintf(stderr, "\trpmdcPrintFile(%p) fd %p fn %s\n", dc, dc->fd, dc->fn);
   
   assert(dc->fd != NULL);
  -     fdFiniDigest(dc->fd, dc->dalgo, &dc->digest, &dc->digestlen, asAscii);
  +    fdFiniDigest(dc->fd, dc->dalgo, &dc->digest, &dc->digestlen, asAscii);
   assert(dc->digest != NULL);
  -     dc->ncomputed++;
  +    dc->ncomputed++;
   
       if (dc->manifests) {
        dc->nchecked++;
  @@ -592,10 +592,10 @@
         }      break;
       }
   
  -     (void) rpmswAdd(&dc->readops, fdstat_op(dc->fd, FDSTAT_READ));
  -     (void) rpmswAdd(&dc->digestops, fdstat_op(dc->fd, FDSTAT_DIGEST));
  -     Fclose(dc->fd);
  -     dc->fd = NULL;
  +    (void) rpmswAdd(&dc->readops, fdstat_op(dc->fd, FDSTAT_READ));
  +    (void) rpmswAdd(&dc->digestops, fdstat_op(dc->fd, FDSTAT_DIGEST));
  +    Fclose(dc->fd);
  +    dc->fd = NULL;
   
       return rc;
   }
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to