RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/rpmdb/ hdrfmt.c header.c header.h rpmdb.c

From: Jeff Johnson <jbj@rpm5.org>
Date: Tue 16 Oct 2007 - 23:02:04 CEST
Message-Id: <20071016210204.0288A34845E@rpm5.org>
  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:   16-Oct-2007 23:02:03
  Branch: HEAD                             Handle: 2007101622020300

  Modified files:
    rpm/rpmdb               hdrfmt.c header.c header.h rpmdb.c

  Log:
    - jbj: start drilling hRET_t.

  Summary:
    Revision    Changes     Path
    1.13        +10 -9      rpm/rpmdb/hdrfmt.c
    1.84        +8  -8      rpm/rpmdb/header.c
    1.36        +1  -1      rpm/rpmdb/header.h
    1.186       +11 -3      rpm/rpmdb/rpmdb.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/hdrfmt.c
  ============================================================================
  $ cvs diff -u -r1.12 -r1.13 hdrfmt.c
  --- rpm/rpmdb/hdrfmt.c	16 Oct 2007 20:16:16 -0000	1.12
  +++ rpm/rpmdb/hdrfmt.c	16 Oct 2007 21:02:03 -0000	1.13
  @@ -82,7 +82,7 @@
   		/*@unused@*/ int element)
   	/*@requires maxRead(data) >= 0 @*/
   {
  -    const int_32 * item = (const int_32 *) data;	/* NOCAST */
  +    const int_32 * item = (*data).i32p;
       char * val;
   
       if (type != RPM_INT32_TYPE)
  @@ -206,14 +206,14 @@
       case RPM_OPENPGP_TYPE:
       case RPM_ASN1_TYPE:		/* XXX WRONG */
       case RPM_BIN_TYPE:
  -	s = (const unsigned char *) data;	/* NOCAST */
  +	s = (*data).ui8p;
   	/* XXX HACK ALERT: element field abused as no. bytes of binary data. */
   	ns = element;
   	atype = PGPARMOR_SIGNATURE;	/* XXX check pkt for signature */
   	break;
       case RPM_STRING_TYPE:
       case RPM_STRING_ARRAY_TYPE:
  -	enc = (const char *) data;	/* NOCAST */
  +	enc = (*data).str;
   	s = NULL;
   	ns = 0;
   /*@-moduncon@*/
  @@ -371,7 +371,7 @@
       switch (type) {
       case RPM_I18NSTRING_TYPE:
       case RPM_STRING_TYPE:
  -	s = (const char *) data;	/* NOCAST */
  +	s = (*data).str;
   	xtag = "string";
   	/* XXX Force utf8 strings. */
   	s = xstrdup(s);
  @@ -538,7 +538,7 @@
       case RPM_I18NSTRING_TYPE:
       case RPM_STRING_TYPE:
   	xx = 0;
  -	s = (const char *) data;	/* NOCAST */
  +	s = (*data).str;
   	if (strchr("[", s[0]))	/* leading [ */
   	    xx = 1;
   	if (xx == 0)
  @@ -571,7 +571,7 @@
   	}
   
   	/* XXX Force utf8 strings. */
  -	s = xstrdup((const char *)data);	/* NOCAST */
  +	s = xstrdup((*data).str);
   	s = xstrtolocale(s);
   	freeit = 1;
   	break;
  @@ -867,7 +867,8 @@
   static int triggercondsTag(Header h, HE_t he)
   	/*@modifies he @*/
   {
  -    int_32 * indices, * flags;
  +    hRET_t flags;
  +    int_32 * indices;
       char ** names, ** versions;
       int numNames, numScripts;
       const char ** conds;
  @@ -904,9 +905,9 @@
   		/*@innercontinue@*/ continue;
   
   	    item = xmalloc(strlen(names[j]) + strlen(versions[j]) + 20);
  -	    if (flags[j] & RPMSENSE_SENSEMASK) {
  +	    if (flags.i32p[j] & RPMSENSE_SENSEMASK) {
   		buf[0] = '%', buf[1] = '\0';
  -		flagsStr = depflagsFormat(RPM_INT32_TYPE, (hPTR_t) flags, buf, 0, j);	/* NOCAST */
  +		flagsStr = depflagsFormat(RPM_INT32_TYPE, &flags, buf, 0, j);
   		sprintf(item, "%s %s %s", names[j], flagsStr, versions[j]);
   		flagsStr = _free(flagsStr);
   	    } else
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/header.c
  ============================================================================
  $ cvs diff -u -r1.83 -r1.84 header.c
  --- rpm/rpmdb/header.c	16 Oct 2007 20:16:16 -0000	1.83
  +++ rpm/rpmdb/header.c	16 Oct 2007 21:02:03 -0000	1.84
  @@ -2099,7 +2099,7 @@
       entry->info.type = type;
       entry->info.count = c;
       entry->info.offset = 0;
  -    entry->data = data;
  +    entry->data = (void *) (*data).ptr;	/* NOCAST */
       entry->length = length;
   
       if (h->indexUsed > 0 && tag < h->index[h->indexUsed-1].info.tag)
  @@ -2374,7 +2374,7 @@
   
       entry->info.count = c;
       entry->info.type = type;
  -    entry->data = data;
  +    entry->data = (void *) (*data).ptr;	/* NOCAST */
       entry->length = length;
   
       if (ENTRY_IN_REGION(entry)) {
  @@ -3212,7 +3212,7 @@
       char buf[20];
       unsigned int intVal;
       uint_64 llVal;
  -    const char ** strarray;
  +    hRET_t strarray;
       rpmTagCount countBuf;
   
       memset(buf, 0, sizeof(buf));
  @@ -3270,19 +3270,19 @@
       if (he_p.ptr)
       switch (he_t) {
       case RPM_STRING_ARRAY_TYPE:
  -	strarray = he_p.argv;
  +	strarray.argv = he_p.argv;
   
   	if (tag->fmt)
  -	    val = tag->fmt(RPM_STRING_TYPE, (hPTR_t) strarray[element], buf, tag->pad, (he_c > 1 ? element : -1));	/* NOCAST */
  +	    val = tag->fmt(RPM_STRING_TYPE, (hPTR_t) strarray.argv[element], buf, tag->pad, (he_c > 1 ? element : -1));	/* NOCAST */
   
   	if (val) {
   	    need = strlen(val);
   	} else {
  -	    need = strlen(strarray[element]) + tag->pad + 20;
  +	    need = strlen(strarray.argv[element]) + tag->pad + 20;
   	    val = xmalloc(need+1);
   	    strcat(buf, "s");
   	    /*@-formatconst@*/
  -	    sprintf(val, buf, strarray[element]);
  +	    sprintf(val, buf, strarray.argv[element]);
   	    /*@=formatconst@*/
   	}
   
  @@ -3932,7 +3932,7 @@
   	sprintf(result, formatPrefix, *((int_64 *) data));
   	/*@=formatconst@*/
       } else {
  -	buf = alloca(strlen((const char *)data) + padding + 2);	/* NOCAST */
  +	buf = alloca(strlen((*data).str) + padding + 2);
   	strcat(formatPrefix, "s");
   	/*@-formatconst@*/
   	sprintf(buf, formatPrefix, data);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/header.h
  ============================================================================
  $ cvs diff -u -r1.35 -r1.36 header.h
  --- rpm/rpmdb/header.h	16 Oct 2007 20:16:16 -0000	1.35
  +++ rpm/rpmdb/header.h	16 Oct 2007 21:02:03 -0000	1.36
  @@ -136,7 +136,7 @@
   
   /** \ingroup header
    */
  -typedef const void * rpmTagData;
  +typedef const hRET_t rpmTagData;
   
   /** \ingroup header
    */
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/rpmdb.c
  ============================================================================
  $ cvs diff -u -r1.185 -r1.186 rpmdb.c
  --- rpm/rpmdb/rpmdb.c	16 Oct 2007 20:16:16 -0000	1.185
  +++ rpm/rpmdb/rpmdb.c	16 Oct 2007 21:02:03 -0000	1.186
  @@ -3135,14 +3135,22 @@
   #endif
       if (iid != 0 && iid != -1) {
   	int_32 tid = iid;
  -	if (!headerIsEntry(h, RPMTAG_INSTALLTID))
  -	   xx = hae(h, RPMTAG_INSTALLTID, RPM_INT32_TYPE, (hPTR_t)&tid, 1);	/* NOCAST */
  +	he->tag = RPMTAG_INSTALLTID;
  +	he_t = RPM_INT32_TYPE;
  +	he_p.i32p = &tid;
  +	he_c = 1;
  +	if (!headerIsEntry(h, he->tag))
  +	   xx = hae(h, he->tag, he_t, he_p, he_c);
       }
   
       /* Add the package color if not present. */
       if (!headerIsEntry(h, RPMTAG_PACKAGECOLOR)) {
   	uint32_t hcolor = hGetColor(h);
  -	xx = hae(h, RPMTAG_PACKAGECOLOR, RPM_INT32_TYPE, (hPTR_t) &hcolor, 1);	/* NOCAST */
  +	he->tag = RPMTAG_PACKAGECOLOR;
  +	he_t = RPM_INT32_TYPE;
  +	he_p.ui32p = &hcolor;
  +	he_c = 1;
  +	xx = hae(h, he->tag, he_t, he_p, he_c);
       }
   
   #if defined(SUPPORT_RPMV3_BASENAMES_HACKS)
  @@ .
Received on Tue Oct 16 23:02:04 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.