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: 19-Oct-2007 21:59:25
Branch: HEAD Handle: 2007101920592400
Modified files:
rpm CHANGES
rpm/rpmdb header.c
Log:
- fix :time and :date formats, pad --info spewage.
Summary:
Revision Changes Path
1.1734 +1 -0 rpm/CHANGES
1.95 +16 -7 rpm/rpmdb/header.c
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.1733 -r1.1734 CHANGES
--- rpm/CHANGES 19 Oct 2007 19:03:11 -0000 1.1733
+++ rpm/CHANGES 19 Oct 2007 19:59:24 -0000 1.1734
@@ -1,4 +1,5 @@
4.5 -> 5.0:
+ - jbj: fix :time and :date formats, pad --info spewage.
- jbj: eliminate padding & formatPrefix, strings is strings now.
- jbj: bury hex dump in intFormat defaults, refactor common code.
- jbj: hmmm, --yaml is b0rken atm, todo++;
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/header.c
============================================================================
$ cvs diff -u -r1.94 -r1.95 header.c
--- rpm/rpmdb/header.c 19 Oct 2007 19:03:11 -0000 1.94
+++ rpm/rpmdb/header.c 19 Oct 2007 19:59:24 -0000 1.95
@@ -2908,14 +2908,14 @@
rpmTagData data = { .ptr = he->p.ptr };
char * val;
- if (he->t != RPM_INT32_TYPE) {
+ if (he->t != RPM_INT64_TYPE) {
val = xstrdup(_("(not a number)"));
} else {
struct tm * tstruct;
char buf[50];
- /* this is important if sizeof(int_32) ! sizeof(time_t) */
- { time_t dateint = data.ui32p[0];
+ /* this is important if sizeof(int_64) ! sizeof(time_t) */
+ { time_t dateint = data.ui64p[0];
tstruct = localtime(&dateint);
}
buf[0] = '\0';
@@ -3424,14 +3424,12 @@
char * val = NULL;
size_t need = 0;
char * t, * te;
- char buf[20];
rpmTagCount countBuf;
HE_t vhe = memset(alloca(sizeof(*vhe)), 0, sizeof(*vhe));
int_64 ival = 0;
- memset(buf, 0, sizeof(buf));
if (tag->ext) {
if (getExtension(hsa, tag->ext, &he->t, &he->p, &he->c, hsa->ec + tag->extNum))
{
@@ -3481,8 +3479,6 @@
he->t = RPM_INT32_TYPE;
}
- (void) stpcpy( stpcpy(buf, "%"), tag->format);
-
if (he->p.ptr)
switch (he->t) {
default:
@@ -3558,6 +3554,19 @@
/*@=modobserver =observertrans@*/
if (val && need > 0) {
+ if (tag->format && *tag->format && tag->pad) {
+ size_t nb;
+ nb = strlen(tag->format) + sizeof("%s");
+ t = alloca(nb);
+ (void) stpcpy( stpcpy( stpcpy(t, "%"), tag->format), "s");
+ nb = tag->pad + strlen(val) + 1;
+ te = xmalloc(nb);
+ (void) snprintf(te, nb, t, val);
+ te[nb-1] = '\0';
+ val = _free(val);
+ val = te;
+ need += tag->pad;
+ }
t = hsaReserve(hsa, need);
te = stpcpy(t, val);
hsa->vallen += (te - t);
@@ .
Received on Fri Oct 19 21:59:25 2007