rpm
4.5
|
#include "system.h"
#include <rpmio_internal.h>
#include <header_internal.h>
#include <rpmmacro.h>
#include "debug.h"
Go to the source code of this file.
Data Structures | |
struct | headerIterator_s |
Header tag iterator data structure. More... | |
struct | headerSprintfArgs_s |
Defines | |
#define | __HEADER_PROTOTYPES__ |
#define | PARSER_BEGIN 0 |
#define | PARSER_IN_ARRAY 1 |
#define | PARSER_IN_EXPR 2 |
#define | hdrchkTags(_ntags) ((_ntags) & 0xffff0000) |
Sanity check on no. | |
#define | hdrchkType(_type) ((_type) < RPM_MIN_TYPE || (_type) > RPM_MAX_TYPE) |
Sanity check on type values. | |
#define | hdrchkData(_nbytes) ((_nbytes) & 0xff000000) |
Sanity check on data size and/or offset and/or count. | |
#define | hdrchkAlign(_type, _off) ((_off) & (typeAlign[_type]-1)) |
Sanity check on alignment for data type. | |
#define | hdrchkRange(_dl, _off) ((_off) < 0 || (_off) > (_dl)) |
Sanity check on range of data offset. | |
#define | isSEP(_c) ((_c) == ':' || (_c) == '|') |
Typedefs | |
typedef struct headerSprintfArgs_s * | headerSprintfArgs |
Functions | |
static void * | headerGetStats (Header h, int opx) |
Return header stats accumulator structure. | |
static Header | headerLink (Header h) |
Reference a header instance. | |
static Header | headerUnlink (Header h) |
Dereference a header instance. | |
static Header | headerFree (Header h) |
Dereference a header instance. | |
static Header | headerNew (void) |
Create new (empty) header instance. | |
static int | indexCmp (const void *avp, const void *bvp) |
static void | headerSort (Header h) |
Sort tags in header. | |
static int | offsetCmp (const void *avp, const void *bvp) |
static void | headerUnsort (Header h) |
Restore tags in header to original ordering. | |
static unsigned int | headerSizeof (Header h, enum hMagic magicp) |
Return size of on-disk header representation in bytes. | |
static int | dataLength (rpmTagType type, rpmTagData *p, rpmTagCount count, int onDisk, rpmTagData *pend) |
Return length of entry data. | |
static int | regionSwab (indexEntry entry, int il, int dl, entryInfo pe, unsigned char *dataStart, const unsigned char *dataEnd, int regionid) |
Swap int_32 and int_16 arrays within header region. | |
static void * | doHeaderUnload (Header h, size_t *lenp) |
static void * | headerUnload (Header h) |
Convert header to on-disk representation. | |
static indexEntry | findEntry (Header h, int_32 tag, rpmTagType type) |
Find matching (tag,type) entry in header. | |
static int | headerRemoveEntry (Header h, int_32 tag) |
Delete tag in header. | |
static Header | headerLoad (void *uh) |
Convert header to in-memory representation. | |
static const char * | headerGetOrigin (Header h) |
Return header origin (e.g path or URL). | |
static int | headerSetOrigin (Header h, const char *origin) |
Store header origin (e.g path or URL). | |
const char * | headerGetBaseURL (Header h) |
Return header base URL (e.g path or URL). | |
int | headerSetBaseURL (Header h, const char *baseurl) |
Store header base URL (e.g path or URL). | |
struct stat * | headerGetStatbuf (Header h) |
Return header stat(2) buffer (of origin *.rpm file). | |
int | headerSetStatbuf (Header h, struct stat *st) |
Copy into header stat(2) buffer (of origin *.rpm file). | |
const char * | headerGetDigest (Header h) |
Return digest of origin *.rpm file. | |
int | headerSetDigest (Header h, const char *digest) |
Store digest of origin *.rpm file. | |
static uint32_t | headerGetInstance (Header h) |
static uint32_t | headerSetInstance (Header h, uint32_t instance) |
uint32_t | headerGetStartOff (Header h) |
Return header starting byte offset. | |
uint32_t | headerSetStartOff (Header h, uint32_t startoff) |
Store header starting byte offset. | |
uint32_t | headerGetEndOff (Header h) |
Return header ending byte offset. | |
uint32_t | headerSetEndOff (Header h, uint32_t endoff) |
Store header ending byte offset. | |
static Header | headerReload (Header h, int tag) |
Convert header to on-disk representation, and then reload. | |
static Header | headerCopyLoad (const void *uh) |
Make a copy and convert header to in-memory representation. | |
static Header | headerRead (void *_fd, enum hMagic magicp) |
Read (and load) header from file handle. | |
static int | headerWrite (void *_fd, Header h, enum hMagic magicp) |
Write (with unload) header to file handle. | |
static int | headerIsEntry (Header h, int_32 tag) |
Check if tag is in header. | |
static int | copyEntry (const indexEntry entry, rpmTagType *type, rpmTagData *p, rpmTagCount *c, int minMem) |
Retrieve data from header entry. | |
static int | headerMatchLocale (const char *td, const char *l, const char *le) |
Does locale match entry in header i18n table? | |
static char * | headerFindI18NString (Header h, indexEntry entry) |
Return i18n string from header that matches locale. | |
static int | intGetEntry (Header h, int_32 tag, rpmTagType *type, rpmTagData *p, rpmTagCount *c, int minMem) |
Retrieve tag data from header. | |
static void * | headerFreeTag (Header h, const void *data, rpmTagType type) |
Free data allocated when retrieved from header. | |
static int | headerGetEntry (Header h, int_32 tag, hTYP_t type, void *p, hCNT_t c) |
Retrieve tag value. | |
static int | headerGetEntryMinMemory (Header h, int_32 tag, hTYP_t type, void *p, hCNT_t c) |
Retrieve tag value using header internal array. | |
int | headerGetRawEntry (Header h, int_32 tag, rpmTagType *type, void *p, rpmTagCount *c) |
Retrieve tag value with type match. | |
static void | copyData (rpmTagType type, rpmTagData *dest, rpmTagData *src, rpmTagCount cnt, size_t len) |
static void * | grabData (rpmTagType type, rpmTagData *p, rpmTagCount c, int *lenp) |
Return (malloc'ed) copy of entry data. | |
static int | headerAddEntry (Header h, int_32 tag, int_32 type, const void *p, int_32 c) |
Add tag to header. | |
static int | headerAppendEntry (Header h, int_32 tag, int_32 type, const void *p, int_32 c) |
Append element to tag array in header. | |
static int | headerAddOrAppendEntry (Header h, int_32 tag, int_32 type, const void *p, int_32 c) |
Add or append element to tag array in header. | |
static int | headerAddI18NString (Header h, int_32 tag, const char *string, const char *lang) |
Add locale specific tag to header. | |
static int | headerModifyEntry (Header h, int_32 tag, int_32 type, const void *p, int_32 c) |
Modify tag in header. | |
static char | escapedChar (const char ch) |
static HE_t | rpmheMark (HE_t he) |
Mark a tag container with headerGetEntry() freeData. | |
static HE_t | rpmheClean (HE_t he) |
Clean a tag container, free'ing attached malloc's. | |
static sprintfToken | freeFormat (sprintfToken format, int num) |
Destroy headerSprintf format array. | |
static HeaderIterator | headerFreeIterator (HeaderIterator hi) |
Destroy header tag iterator. | |
static HeaderIterator | headerInitIterator (Header h) |
Create header tag iterator. | |
static int | headerNextIterator (HeaderIterator hi, hTAG_t tag, hTYP_t type, hPTR_t *p, hCNT_t c) |
Return next tag from header. | |
static Header | headerCopy (Header h) |
Duplicate a header. | |
static headerSprintfArgs | hsaInit (headerSprintfArgs hsa) |
Initialize an hsa iteration. | |
static sprintfToken | hsaNext (headerSprintfArgs hsa) |
Return next hsa iteration item. | |
static headerSprintfArgs | hsaFini (headerSprintfArgs hsa) |
Finish an hsa iteration. | |
static char * | hsaReserve (headerSprintfArgs hsa, size_t need) |
Reserve sufficient buffer space for next output value. | |
static const char * | myTagName (headerTagTableEntry tbl, int val, int *typep) |
Return tag name from value. | |
static int | myTagType (headerTagTableEntry tbl, int val) |
static int | myTagValue (headerTagTableEntry tbl, const char *name) |
Return tag value from name. | |
static int | findTag (headerSprintfArgs hsa, sprintfToken token, const char *name) |
Search extensions and tags for a name. | |
char * | intFormat (HE_t he, const char **av, const char *fmt) |
Convert tag data representation. | |
static char * | octFormat (HE_t he, const char **av) |
Return octal formatted data. | |
static char * | hexFormat (HE_t he, const char **av) |
Return hex formatted data. | |
static char * | decFormat (HE_t he, const char **av) |
Return decimal formatted data. | |
static char * | realDateFormat (HE_t he, const char **av, const char *strftimeFormat) |
Return strftime formatted data. | |
static char * | dateFormat (HE_t he, const char **av) |
Return date formatted data. | |
static char * | dayFormat (HE_t he, const char **av) |
Return day formatted data. | |
static char * | shescapeFormat (HE_t he, const char **av) |
Return shell escape formatted data. | |
static int | parseExpression (headerSprintfArgs hsa, sprintfToken token, char *str, char **endPtr) |
Parse a headerSprintf expression. | |
static int | parseFormat (headerSprintfArgs hsa, char *str, sprintfToken *formatPtr, int *numTokensPtr, char **endPtr, int state) |
Parse a headerSprintf term. | |
static int | getExtension (headerSprintfArgs hsa, headerTagTagFunction fn, HE_t he, HE_t ec) |
Call a header extension only once, saving results. | |
static char * | formatValue (headerSprintfArgs hsa, sprintfTag tag, int element) |
Format a single item's value. | |
static char * | singleSprintf (headerSprintfArgs hsa, sprintfToken token, int element) |
Format a single headerSprintf item. | |
static HE_t | rpmecNew (const headerSprintfExtension exts, int *necp) |
Create an extension cache. | |
static HE_t | rpmecFree (const headerSprintfExtension exts, HE_t ec) |
Destroy an extension cache. | |
static char * | headerSprintf (Header h, const char *fmt, const struct headerTagTableEntry_s *tags, const struct headerSprintfExtension_s *exts, errmsg_t *errmsg) |
Return formatted output string from header tags. | |
static void | headerCopyTags (Header headerFrom, Header headerTo, hTAG_t tagstocopy) |
Duplicate tag values from one header into another. | |
Variables | |
int | _hdr_debug = 0 |
int | _tagcache = 1 |
static unsigned char | header_magic [8] |
static int | typeAlign [16] |
Alignment needed for header data types. | |
static int | typeSizes [16] |
Size of header data types. | |
static size_t | headerMaxbytes = (32*1024*1024) |
Maximum no. | |
HV_t | hdrVec = &hdrVec1 |
Header methods for rpm headers. | |
struct headerSprintfExtension_s | headerDefaultFormats [] |
Supported default header tag output formats. | |
struct headerTagTableEntry_s * | rpmTagTable |
Automatically generated table of tag name/value pairs. | |
static struct HV_s | hdrVec1 |
Definition in file header.c.
#define hdrchkAlign | ( | _type, | |
_off | |||
) | ((_off) & (typeAlign[_type]-1)) |
Sanity check on alignment for data type.
Definition at line 117 of file header.c.
Referenced by regionSwab().
#define hdrchkData | ( | _nbytes | ) | ((_nbytes) & 0xff000000) |
Sanity check on data size and/or offset and/or count.
This check imposes a limit of 16Mb, more than enough.
Definition at line 112 of file header.c.
Referenced by doHeaderUnload(), and regionSwab().
#define hdrchkRange | ( | _dl, | |
_off | |||
) | ((_off) < 0 || (_off) > (_dl)) |
#define hdrchkTags | ( | _ntags | ) | ((_ntags) & 0xffff0000) |
Sanity check on no.
of tags. This check imposes a limit of 65K tags, more than enough.
Definition at line 101 of file header.c.
Referenced by doHeaderUnload().
#define hdrchkType | ( | _type | ) | ((_type) < RPM_MIN_TYPE || (_type) > RPM_MAX_TYPE) |
#define isSEP | ( | _c | ) | ((_c) == ':' || (_c) == '|') |
Referenced by parseFormat().
#define PARSER_IN_ARRAY 1 |
Definition at line 35 of file header.c.
Referenced by parseFormat().
#define PARSER_IN_EXPR 2 |
Definition at line 36 of file header.c.
Referenced by parseExpression(), and parseFormat().
typedef struct headerSprintfArgs_s * headerSprintfArgs |
static void copyData | ( | rpmTagType | type, |
rpmTagData * | dest, | ||
rpmTagData * | src, | ||
rpmTagCount | cnt, | ||
size_t | len | ||
) | [static] |
Definition at line 1924 of file header.c.
References RPM_I18NSTRING_TYPE, and RPM_STRING_ARRAY_TYPE.
Referenced by grabData().
static int dataLength | ( | rpmTagType | type, |
rpmTagData * | p, | ||
rpmTagCount | count, | ||
int | onDisk, | ||
rpmTagData * | pend | ||
) | [static] |
Return length of entry data.
type | entry data type |
*p | tag container data |
count | entry item count |
onDisk | data is concatenated strings (with NUL's))? |
*pend | pointer to end of tag container data (or NULL) |
Definition at line 389 of file header.c.
References RPM_I18NSTRING_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, typeSizes, and rpmDataType_u::ui8p.
Referenced by grabData(), and regionSwab().
static char* dateFormat | ( | HE_t | he, |
const char ** | av | ||
) | [static] |
Return date formatted data.
he | tag container |
av | parameter array (or NULL) |
Definition at line 2953 of file header.c.
References _, and realDateFormat().
static char* dayFormat | ( | HE_t | he, |
const char ** | av | ||
) | [static] |
Return day formatted data.
he | tag container |
av | parameter array (or NULL) |
Definition at line 2965 of file header.c.
References _, and realDateFormat().
static char* decFormat | ( | HE_t | he, |
const char ** | av | ||
) | [static] |
Return decimal formatted data.
he | tag container |
av | parameter array (or NULL) |
Definition at line 2908 of file header.c.
References intFormat().
static char escapedChar | ( | const char | ch | ) | [static] |
static indexEntry findEntry | ( | Header | h, |
int_32 | tag, | ||
rpmTagType | type | ||
) | [static] |
Find matching (tag,type) entry in header.
h | header |
tag | entry tag |
type | entry type |
Definition at line 905 of file header.c.
References headerToken_s::flags, HEADERFLAG_SORTED, headerSort(), headerToken_s::index, indexCmp(), headerToken_s::indexUsed, indexEntry_s::info, RPM_NULL_TYPE, entryInfo_s::tag, and entryInfo_s::type.
Referenced by headerFindI18NString(), headerGetRawEntry(), and intGetEntry().
static int findTag | ( | headerSprintfArgs | hsa, |
sprintfToken | token, | ||
const char * | name | ||
) | [static] |
Search extensions and tags for a name.
hsa | headerSprintf args |
token | parsed fields |
name | name to find |
Definition at line 2736 of file header.c.
References alloca(), argvCount(), sprintfTag_s::av, sprintfToken_s::cond, sprintfTag_s::ext, sprintfTag_s::extNum, headerSprintfArgs_s::exts, sprintfTag_s::fmtfuncs, headerSprintfExtension_s::fmtFunction, HEADER_EXT_FORMAT, HEADER_EXT_LAST, HEADER_EXT_MORE, HEADER_EXT_TAG, headerSprintfExtension_s::more, myTagValue(), name, headerSprintfExtension_s::name, stpcpy(), sprintfToken_s::tag, headerSprintfExtension_s::tagFunction, sprintfTag_s::tagno, headerSprintfArgs_s::tags, sprintfToken_s::type, headerSprintfExtension_s::type, sprintfToken_s::u, headerSprintfExtension_s::u, xcalloc(), and xstrcasecmp().
Referenced by parseExpression(), and parseFormat().
static char* formatValue | ( | headerSprintfArgs | hsa, |
sprintfTag | tag, | ||
int | element | ||
) | [static] |
Format a single item's value.
hsa | headerSprintf args |
tag | tag |
element | element index |
Definition at line 3515 of file header.c.
References _free(), _hdr_debug, _tagcache, alloca(), rpmDataType_u::argv, argvFree(), argvSplit(), sprintfTag_s::arrayCount, sprintfTag_s::av, _HE_s::avail, _HE_s::c, headerSprintfArgs_s::ec, sprintfTag_s::ext, sprintfTag_s::extNum, sprintfTag_s::fmtfuncs, sprintfTag_s::format, _HE_s::freeData, getExtension(), headerSprintfArgs_s::h, sprintfTag_s::he, headerGetEntry(), hsaReserve(), rpmDataType_u::i32p, rpmDataType_u::i64p, rpmDataType_u::i8p, intFormat(), _HE_s::ix, myTagType(), _HE_s::p, sprintfTag_s::pad, sprintfTag_s::params, rpmDataType_u::ptr, RPM_ARRAY_RETURN_TYPE, RPM_ASN1_TYPE, RPM_BIN_TYPE, RPM_CHAR_TYPE, RPM_I18NSTRING_TYPE, RPM_INT16_TYPE, RPM_INT32_TYPE, RPM_INT64_TYPE, RPM_INT8_TYPE, RPM_MASK_RETURN_TYPE, RPM_OPENPGP_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, rpmExpand(), rpmheClean(), rpmheMark(), snprintf(), stpcpy(), rpmDataType_u::str, _HE_s::t, _HE_s::tag, sprintfTag_s::tagno, headerSprintfArgs_s::tags, rpmDataType_u::ui16p, headerSprintfArgs_s::val, headerSprintfArgs_s::vallen, xmalloc(), and xstrdup().
Referenced by singleSprintf().
static sprintfToken freeFormat | ( | sprintfToken | format, |
int | num | ||
) | [static] |
Destroy headerSprintf format array.
format | sprintf format array |
num | number of elements |
Definition at line 2380 of file header.c.
References _free(), _tagcache, argvFree(), sprintfToken_s::array, sprintfTag_s::av, sprintfToken_s::cond, sprintfTag_s::fmtfuncs, sprintfTag_s::he, sprintfTag_s::params, rpmheClean(), sprintfToken_s::tag, and sprintfToken_s::u.
Referenced by parseExpression(), and parseFormat().
static int getExtension | ( | headerSprintfArgs | hsa, |
headerTagTagFunction | fn, | ||
HE_t | he, | ||
HE_t | ec | ||
) | [static] |
Call a header extension only once, saving results.
hsa | headerSprintf args |
fn | function |
he | tag container |
ec | extension cache |
Definition at line 3490 of file header.c.
References _HE_s::avail, _HE_s::freeData, headerSprintfArgs_s::h, and rpmheClean().
Referenced by formatValue(), and singleSprintf().
static void* grabData | ( | rpmTagType | type, |
rpmTagData * | p, | ||
rpmTagCount | c, | ||
int * | lenp | ||
) | [static] |
Return (malloc'ed) copy of entry data.
type | entry data type |
*p | tag container data |
c | entry item count |
*lenp | no. bytes in returned data |
Definition at line 1959 of file header.c.
References copyData(), dataLength(), rpmDataType_u::ptr, and xmalloc().
static char* headerFindI18NString | ( | Header | h, |
indexEntry | entry | ||
) | [static] |
Return i18n string from header that matches locale.
h | header |
entry | i18n string data |
Definition at line 1720 of file header.c.
References _, indexEntry_s::data, findEntry(), getenv(), HEADER_I18NTABLE, headerMatchLocale(), lang, and RPM_STRING_ARRAY_TYPE.
Referenced by intGetEntry().
static uint32_t headerGetInstance | ( | Header | h | ) | [static] |
Definition at line 1248 of file header.c.
References headerToken_s::instance.
static int headerMatchLocale | ( | const char * | td, |
const char * | l, | ||
const char * | le | ||
) | [static] |
Does locale match entry in header i18n table?
* The range [l,le) contains the next locale to match: * ll[_CC][.EEEEE][@dddd] * where * ll ISO language code (in lowercase). * CC (optional) ISO coutnry code (in uppercase). * EEEEE (optional) encoding (not really standardized). * dddd (optional) dialect. *
td | header i18n table data, NUL terminated |
l | start of locale to match |
le | end of locale to match |
Definition at line 1647 of file header.c.
References alloca().
Referenced by headerFindI18NString().
static uint32_t headerSetInstance | ( | Header | h, |
uint32_t | instance | ||
) | [static] |
Definition at line 1255 of file header.c.
References headerToken_s::instance.
static char* hexFormat | ( | HE_t | he, |
const char ** | av | ||
) | [static] |
Return hex formatted data.
he | tag container |
av | parameter array (or NULL) |
Definition at line 2896 of file header.c.
References intFormat().
static headerSprintfArgs hsaFini | ( | headerSprintfArgs | hsa | ) | [static] |
Finish an hsa iteration.
hsa | headerSprintf args |
Definition at line 2637 of file header.c.
References headerFreeIterator(), headerSprintfArgs_s::hi, and headerSprintfArgs_s::i.
static headerSprintfArgs hsaInit | ( | headerSprintfArgs | hsa | ) | [static] |
Initialize an hsa iteration.
hsa | headerSprintf args |
Definition at line 2573 of file header.c.
References sprintfToken_s::array, headerSprintfArgs_s::format, headerSprintfArgs_s::h, headerInitIterator(), headerSprintfArgs_s::hi, headerSprintfArgs_s::i, sprintfToken_s::tag, sprintfTag_s::tagno, sprintfToken_s::type, and sprintfToken_s::u.
static sprintfToken hsaNext | ( | headerSprintfArgs | hsa | ) | [static] |
Return next hsa iteration item.
hsa | headerSprintf args |
Definition at line 2599 of file header.c.
References sprintfToken_s::array, _HE_s::avail, _HE_s::c, headerSprintfArgs_s::format, sprintfTag_s::he, headerNextIterator(), headerSprintfArgs_s::hi, headerSprintfArgs_s::i, headerSprintfArgs_s::numTokens, _HE_s::p, rpmDataType_u::ptr, rpmheClean(), rpmheMark(), _HE_s::t, sprintfToken_s::tag, _HE_s::tag, sprintfTag_s::tagno, sprintfToken_s::type, and sprintfToken_s::u.
static char* hsaReserve | ( | headerSprintfArgs | hsa, |
size_t | need | ||
) | [static] |
Reserve sufficient buffer space for next output value.
hsa | headerSprintf args |
need | no. of bytes to reserve |
Definition at line 2656 of file header.c.
References headerSprintfArgs_s::alloced, headerSprintfArgs_s::val, headerSprintfArgs_s::vallen, and xrealloc().
Referenced by formatValue(), and singleSprintf().
static int indexCmp | ( | const void * | avp, |
const void * | bvp | ||
) | [static] |
Definition at line 258 of file header.c.
References indexEntry_s::info, and entryInfo_s::tag.
Referenced by findEntry().
char* intFormat | ( | HE_t | he, |
const char ** | av, | ||
const char * | fmt | ||
) |
Convert tag data representation.
he | tag container |
av | parameter array (or NULL) |
fmt | output radix (NULL or "" assumes d) |
Definition at line 2809 of file header.c.
References _, alloca(), rpmDataType_u::argv, _HE_s::c, rpmDataType_u::i32p, rpmDataType_u::i64p, rpmDataType_u::i8p, _HE_s::ix, _HE_s::p, RPM_ASN1_TYPE, RPM_BIN_TYPE, RPM_CHAR_TYPE, RPM_INT16_TYPE, RPM_INT32_TYPE, RPM_INT64_TYPE, RPM_INT8_TYPE, RPM_OPENPGP_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, snprintf(), rpmDataType_u::str, _HE_s::t, rpmDataType_u::ui16p, and xstrdup().
Referenced by decFormat(), formatValue(), hexFormat(), octFormat(), and rpnFormat().
static int intGetEntry | ( | Header | h, |
int_32 | tag, | ||
rpmTagType * | type, | ||
rpmTagData * | p, | ||
rpmTagCount * | c, | ||
int | minMem | ||
) | [static] |
Retrieve tag data from header.
h | header |
tag | tag to retrieve |
*type | type (or NULL) |
*p | data (or NULL) |
*c | count (or NULL) |
minMem | string pointers reference header memory? |
Definition at line 1775 of file header.c.
References copyEntry(), findEntry(), headerFindI18NString(), indexEntry_s::info, RPM_I18NSTRING_TYPE, RPM_NULL_TYPE, RPM_STRING_TYPE, and entryInfo_s::type.
static const char* myTagName | ( | headerTagTableEntry | tbl, |
int | val, | ||
int * | typep | ||
) | [static] |
Return tag name from value.
tbl | tag table |
val | tag value to find |
*typep | tag type (or NULL) |
Definition at line 2677 of file header.c.
References name, headerTagTableEntry_s::name, headerTagTableEntry_s::type, headerTagTableEntry_s::val, and xtolower().
Referenced by singleSprintf().
static int myTagType | ( | headerTagTableEntry | tbl, |
int | val | ||
) | [static] |
Definition at line 2703 of file header.c.
References headerTagTableEntry_s::name, headerTagTableEntry_s::type, and headerTagTableEntry_s::val.
Referenced by formatValue().
static int myTagValue | ( | headerTagTableEntry | tbl, |
const char * | name | ||
) | [static] |
Return tag value from name.
tbl | tag table |
name | tag name to find |
Definition at line 2719 of file header.c.
References headerTagTableEntry_s::name, headerTagTableEntry_s::val, and xstrcasecmp().
Referenced by findTag().
static char* octFormat | ( | HE_t | he, |
const char ** | av | ||
) | [static] |
Return octal formatted data.
he | tag container |
av | parameter array (or NULL) |
Definition at line 2884 of file header.c.
References intFormat().
static int offsetCmp | ( | const void * | avp, |
const void * | bvp | ||
) | [static] |
Definition at line 283 of file header.c.
References indexEntry_s::data, indexEntry_s::info, entryInfo_s::offset, and entryInfo_s::tag.
static int parseExpression | ( | headerSprintfArgs | hsa, |
sprintfToken | token, | ||
char * | str, | ||
char ** | endPtr | ||
) | [static] |
Parse a headerSprintf expression.
hsa | headerSprintf args |
token | |
str |
*endPtr |
Definition at line 3379 of file header.c.
References _, _hdr_debug, sprintfToken_s::cond, headerSprintfArgs_s::errmsg, findTag(), freeFormat(), parseFormat(), PARSER_IN_EXPR, sprintfToken_s::type, and sprintfToken_s::u.
Referenced by parseFormat().
static int parseFormat | ( | headerSprintfArgs | hsa, |
char * | str, | ||
sprintfToken * | formatPtr, | ||
int * | numTokensPtr, | ||
char ** | endPtr, | ||
int | state | ||
) | [static] |
Parse a headerSprintf term.
hsa | headerSprintf args |
str |
*formatPtr | |
*numTokensPtr | |
*endPtr |
state |
Definition at line 3070 of file header.c.
References _, _hdr_debug, argvAdd(), sprintfToken_s::array, sprintfTag_s::arrayCount, sprintfTag_s::av, headerSprintfArgs_s::errmsg, escapedChar(), findTag(), sprintfTag_s::format, freeFormat(), isSEP, sprintfTag_s::justOne, next, sprintfTag_s::pad, sprintfTag_s::params, parseExpression(), PARSER_IN_ARRAY, PARSER_IN_EXPR, sprintfToken_s::string, sprintfToken_s::tag, sprintfToken_s::type, sprintfToken_s::u, xcalloc(), and xisdigit().
Referenced by parseExpression().
static char* realDateFormat | ( | HE_t | he, |
const char ** | av, | ||
const char * | strftimeFormat | ||
) | [static] |
Return strftime formatted data.
he | tag container |
av | parameter array (or NULL) |
strftimeFormat | strftime(3) format |
Definition at line 2921 of file header.c.
References _, _HE_s::p, rpmDataType_u::ptr, RPM_INT64_TYPE, _HE_s::t, rpmDataType_u::ui64p, and xstrdup().
Referenced by dateFormat(), and dayFormat().
static HE_t rpmecFree | ( | const headerSprintfExtension | exts, |
HE_t | ec | ||
) | [static] |
Destroy an extension cache.
exts | headerSprintf extensions |
ec | extension cache |
Definition at line 3958 of file header.c.
References _free(), HEADER_EXT_LAST, HEADER_EXT_MORE, headerSprintfExtension_s::more, rpmheClean(), headerSprintfExtension_s::type, and headerSprintfExtension_s::u.
static HE_t rpmecNew | ( | const headerSprintfExtension | exts, |
int * | necp | ||
) | [static] |
Create an extension cache.
exts | headerSprintf extensions |
*necp | no. of elements (or NULL) |
Definition at line 3932 of file header.c.
References HEADER_EXT_LAST, HEADER_EXT_MORE, headerSprintfExtension_s::more, headerSprintfExtension_s::type, headerSprintfExtension_s::u, and xcalloc().
Clean a tag container, free'ing attached malloc's.
he | tag container |
Definition at line 2362 of file header.c.
References _free(), _HE_s::freeData, _HE_s::p, and rpmDataType_u::ptr.
Referenced by formatValue(), freeFormat(), getExtension(), hsaNext(), rpmecFree(), and singleSprintf().
Mark a tag container with headerGetEntry() freeData.
he | tag container |
Definition at line 2340 of file header.c.
References _HE_s::freeData, RPM_BIN_TYPE, RPM_I18NSTRING_TYPE, RPM_STRING_ARRAY_TYPE, and _HE_s::t.
Referenced by formatValue(), hsaNext(), and singleSprintf().
static char* shescapeFormat | ( | HE_t | he, |
const char ** | av | ||
) | [static] |
Return shell escape formatted data.
he | tag container |
av | parameter array (or NULL) |
Definition at line 2977 of file header.c.
References _, rpmDataType_u::i32p, rpmDataType_u::i64p, _HE_s::p, RPM_INT32_TYPE, RPM_INT64_TYPE, RPM_STRING_TYPE, snprintf(), rpmDataType_u::str, _HE_s::t, xmalloc(), and xstrdup().
static char* singleSprintf | ( | headerSprintfArgs | hsa, |
sprintfToken | token, | ||
int | element | ||
) | [static] |
Format a single headerSprintf item.
hsa | headerSprintf args |
token | item to format |
element | element index |
Definition at line 3711 of file header.c.
References _, _tagcache, sprintfToken_s::array, sprintfTag_s::arrayCount, sprintfTag_s::av, _HE_s::avail, _HE_s::c, sprintfToken_s::cond, headerSprintfArgs_s::ec, headerSprintfArgs_s::errmsg, sprintfTag_s::ext, sprintfTag_s::extNum, formatValue(), _HE_s::freeData, getExtension(), headerSprintfArgs_s::h, sprintfTag_s::he, headerGetEntry(), headerIsEntry(), hsaReserve(), sprintfTag_s::justOne, myTagName(), _HE_s::p, RPM_ARRAY_RETURN_TYPE, RPM_ASN1_TYPE, RPM_BIN_TYPE, RPM_MASK_RETURN_TYPE, RPM_OPENPGP_TYPE, RPM_SCALAR_RETURN_TYPE, RPM_STRING_TYPE, rpmheClean(), rpmheMark(), snprintf(), stpcpy(), sprintfToken_s::string, _HE_s::t, sprintfToken_s::tag, _HE_s::tag, sprintfTag_s::tagno, headerSprintfArgs_s::tags, sprintfToken_s::type, sprintfToken_s::u, headerSprintfArgs_s::val, and headerSprintfArgs_s::vallen.
int _hdr_debug = 0 |
Definition at line 22 of file header.c.
Referenced by escapedChar(), formatValue(), parseExpression(), and parseFormat().
int _tagcache = 1 |
Definition at line 25 of file header.c.
Referenced by formatValue(), freeFormat(), and singleSprintf().
struct headerTagTableEntry_s* rpmTagTable |