diff options
-rw-r--r-- | RPM4/src/RPM4.xs | 4 | ||||
-rw-r--r-- | RPM4/t/02header.t | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/RPM4/src/RPM4.xs b/RPM4/src/RPM4.xs index 8fa3bff..064d5da 100644 --- a/RPM4/src/RPM4.xs +++ b/RPM4/src/RPM4.xs @@ -998,10 +998,10 @@ Header_string(h, no_header_magic = 0) void * ptr = NULL; int hsize = 0; PPCODE: + hsize = headerSizeof(h, no_header_magic ? HEADER_MAGIC_NO : HEADER_MAGIC_YES); string = headerUnload(h); - hsize = headerSizeof((Header) string, no_header_magic ? HEADER_MAGIC_NO : HEADER_MAGIC_YES); ptr = string + (no_header_magic ? offset : 0); - PUSHs(sv_2mortal(newSVpv((char *)ptr, hsize))); + XPUSHs(sv_2mortal(newSVpv((char *)ptr, hsize))); free(string); int diff --git a/RPM4/t/02header.t b/RPM4/t/02header.t index e8fdb28..4ec5611 100644 --- a/RPM4/t/02header.t +++ b/RPM4/t/02header.t @@ -1,7 +1,7 @@ # $Id$ use strict; -use Test::More tests => 41; +use Test::More tests => 42; use FindBin qw($Bin); use RPM4; @@ -34,6 +34,7 @@ ok($hdr->removetag(1000) == 0, "Removing a tag"); ok(! defined $hdr->tag(1000), "tag is not present"); ok($hdr->addtag(1000, 6, "new name") == 1, "Adding a tag (string type)"); ok($hdr->tag(1000) eq "new name", "Added tag return good value"); +ok($hdr->string, "can get header as string"); } { |