summaryrefslogtreecommitdiff
path: root/rpmdb/header.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2003-03-12 13:31:13 +0000
committerjbj <devnull@localhost>2003-03-12 13:31:13 +0000
commit521861e7443971e712fd292c7ccfe7b1cfddf2e7 (patch)
tree7306e0ee98fe80c607d3965833da371df562b825 /rpmdb/header.c
parentc3d4c061ac667e066ec39e131b803161f0a8e919 (diff)
downloadlibrpm-tizen-521861e7443971e712fd292c7ccfe7b1cfddf2e7.tar.gz
librpm-tizen-521861e7443971e712fd292c7ccfe7b1cfddf2e7.tar.bz2
librpm-tizen-521861e7443971e712fd292c7ccfe7b1cfddf2e7.zip
Don't put newlines in base64 tag, add rpmHeader tag.
CVS patchset: 6679 CVS date: 2003/03/12 13:31:13
Diffstat (limited to 'rpmdb/header.c')
-rw-r--r--rpmdb/header.c41
1 files changed, 35 insertions, 6 deletions
diff --git a/rpmdb/header.c b/rpmdb/header.c
index 56d815164..5fe87a1b1 100644
--- a/rpmdb/header.c
+++ b/rpmdb/header.c
@@ -3327,12 +3327,12 @@ static char * singleSprintf(headerSprintfArgs hsa, sprintfToken token,
if (isxml) {
const char * tagN = tagName(spft->u.tag.tag);
- need = strlen(tagN) + sizeof("<rpmTag name=>\n") - 1;
+ need = strlen(tagN) + sizeof(" <rpmTag name=\"\">\n") - 1;
t = hsaReserve(hsa, need);
/*@-boundswrite@*/
- te = stpcpy(t, "<rpmTag name=");
+ te = stpcpy(t, " <rpmTag name=\"");
te = stpcpy(te, tagN);
- te = stpcpy(te, ">\n");
+ te = stpcpy(te, "\">\n");
/*@=boundswrite@*/
hsa->vallen += (te - t);
}
@@ -3348,10 +3348,10 @@ static char * singleSprintf(headerSprintfArgs hsa, sprintfToken token,
}
if (isxml) {
- need = sizeof("<rpmTag/>\n") - 1;
+ need = sizeof(" </rpmTag>\n") - 1;
t = hsaReserve(hsa, need);
/*@-boundswrite@*/
- te = stpcpy(t, "<rpmTag/>\n");
+ te = stpcpy(t, " </rpmTag>\n");
/*@=boundswrite@*/
hsa->vallen += (te - t);
}
@@ -3433,7 +3433,10 @@ char * headerSprintf(Header h, const char * fmt,
{
headerSprintfArgs hsa = memset(alloca(sizeof(*hsa)), 0, sizeof(*hsa));
sprintfToken nextfmt;
- char * te;
+ sprintfTag tag;
+ char * t, * te;
+ int isxml;
+ int need;
hsa->h = headerLink(h);
hsa->fmt = xstrdup(fmt);
@@ -3451,6 +3454,23 @@ char * headerSprintf(Header h, const char * fmt,
hsa->ec = rpmecNew(hsa->exts);
hsa->val = xstrdup("");
+ tag =
+ (hsa->format->type == PTOK_TAG
+ ? &hsa->format->u.tag :
+ (hsa->format->type == PTOK_ARRAY
+ ? &hsa->format->u.array.format->u.tag :
+ NULL));
+ isxml = (tag != NULL && tag->tag == -2 && !strcmp(tag->type, "xml"));
+
+ if (isxml) {
+ need = sizeof("<rpmHeader>\n") - 1;
+ t = hsaReserve(hsa, need);
+/*@-boundswrite@*/
+ te = stpcpy(t, "<rpmHeader>\n");
+/*@=boundswrite@*/
+ hsa->vallen += (te - t);
+ }
+
hsa = hsaInit(hsa);
while ((nextfmt = hsaNext(hsa)) != NULL) {
te = singleSprintf(hsa, nextfmt, 0);
@@ -3461,6 +3481,15 @@ char * headerSprintf(Header h, const char * fmt,
}
hsa = hsaFini(hsa);
+ if (isxml) {
+ need = sizeof("</rpmHeader>\n") - 1;
+ t = hsaReserve(hsa, need);
+/*@-boundswrite@*/
+ te = stpcpy(t, "</rpmHeader>\n");
+/*@=boundswrite@*/
+ hsa->vallen += (te - t);
+ }
+
if (hsa->val != NULL && hsa->vallen < hsa->alloced)
hsa->val = xrealloc(hsa->val, hsa->vallen+1);