#include "system.h"
#include <header_internal.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. | |
Typedefs | |
typedef headerSprintfArgs_s * | headerSprintfArgs |
Functions | |
const char *const | tagName (int tag) |
Return name of tag from value. | |
void * | _free (const void *p) |
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL. | |
int | indexCmp (const void *avp, const void *bvp) |
int | offsetCmp (const void *avp, const void *bvp) |
int | dataLength (int_32 type, hPTR_t p, int_32 count, int onDisk, hPTR_t pend) |
Return length of entry data. | |
int | regionSwab (indexEntry entry, int il, int dl, entryInfo pe, unsigned char *dataStart, const unsigned char *dataEnd, int regionid) |
void * | doHeaderUnload (Header h, int *lengthPtr) |
indexEntry | findEntry (Header h, int_32 tag, int_32 type) |
Find matching (tag,type) entry in header. | |
int | copyEntry (const indexEntry entry, hTYP_t type, hPTR_t *p, hCNT_t c, int minMem) |
int | headerMatchLocale (const char *td, const char *l, const char *le) |
Does locale match entry in header i18n table? | |
char * | headerFindI18NString (Header h, indexEntry entry) |
Return i18n string from header that matches locale. | |
int | intGetEntry (Header h, int_32 tag, hTAG_t type, hPTR_t *p, hCNT_t c, int minMem) |
Retrieve tag data from header. | |
int | headerGetRawEntry (Header h, int_32 tag, int_32 *type, hPTR_t *p, int_32 *c) |
void | copyData (int_32 type, void *dstPtr, const void *srcPtr, int_32 cnt, int dataLength) |
void * | grabData (int_32 type, hPTR_t p, int_32 c, int *lengthPtr) |
Return (malloc'ed) copy of entry data. | |
char | escapedChar (const char ch) |
sprintfToken | freeFormat (sprintfToken format, int num) |
Destroy headerSprintf format array. | |
headerSprintfArgs | hsaInit (headerSprintfArgs hsa) |
Initialize an hsa iteration. | |
sprintfToken | hsaNext (headerSprintfArgs hsa) |
Return next hsa iteration item. | |
headerSprintfArgs | hsaFini (headerSprintfArgs hsa) |
Finish an hsa iteration. | |
char * | hsaReserve (headerSprintfArgs hsa, size_t need) |
Reserve sufficient buffer space for next output value. | |
int | findTag (headerSprintfArgs hsa, sprintfToken token, const char *name) |
int | parseExpression (headerSprintfArgs hsa, sprintfToken token, char *str, char **endPtr) |
int | parseFormat (headerSprintfArgs hsa, char *str, sprintfToken *formatPtr, int *numTokensPtr, char **endPtr, int state) |
int | getExtension (headerSprintfArgs hsa, headerTagTagFunction fn, hTYP_t typeptr, hPTR_t *data, hCNT_t countptr, rpmec ec) |
Call a header extension only once, saving results. | |
char * | formatValue (headerSprintfArgs hsa, sprintfTag tag, int element) |
char * | singleSprintf (headerSprintfArgs hsa, sprintfToken token, int element) |
rpmec | rpmecNew (const headerSprintfExtension exts) |
Create an extension cache. | |
rpmec | rpmecFree (const headerSprintfExtension exts, rpmec ec) |
Destroy an extension cache. | |
char * | octalFormat (int_32 type, hPTR_t data, char *formatPrefix, int padding, int element) |
char * | hexFormat (int_32 type, hPTR_t data, char *formatPrefix, int padding, int element) |
char * | realDateFormat (int_32 type, hPTR_t data, char *formatPrefix, int padding, int element, const char *strftimeFormat) |
char * | dateFormat (int_32 type, hPTR_t data, char *formatPrefix, int padding, int element) |
char * | dayFormat (int_32 type, hPTR_t data, char *formatPrefix, int padding, int element) |
char * | shescapeFormat (int_32 type, hPTR_t data, char *formatPrefix, int padding, int element) |
Variables | |
int | _hdr_debug = 0 |
unsigned char | header_magic [8] |
int | typeAlign [16] |
int | typeSizes [16] |
size_t | headerMaxbytes = (32*1024*1024) |
HV_t | hdrVec = &hdrVec1 |
const struct headerSprintfExtension_s | headerDefaultFormats [] |
HV_s | hdrVec1 |
Definition in file header.c.
|
|
|
Sanity check on alignment for data type.
|
|
Sanity check on data size and/or offset and/or count. This check imposes a limit of 16Mb, more than enough. |
|
Sanity check on range of data offset.
|
|
Sanity check on no. of tags. This check imposes a limit of 65K tags, more than enough. |
|
Sanity check on type values.
|
|
|
|
Definition at line 35 of file header.c. Referenced by parseFormat(). |
|
Definition at line 36 of file header.c. Referenced by parseExpression(). |
|
Referenced by findTag(), formatValue(), getExtension(), hsaFini(), hsaInit(), hsaNext(), hsaReserve(), parseExpression(), parseFormat(), and singleSprintf(). |
|
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
|
|
Definition at line 1812 of file header.c. References dataLength(), RPM_I18NSTRING_TYPE, and RPM_STRING_ARRAY_TYPE. Referenced by grabData(). |
|
Return length of entry data.
Definition at line 394 of file header.c. References RPM_I18NSTRING_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, and typeSizes. Referenced by copyData(), grabData(), and regionSwab(). |
|
Definition at line 3601 of file header.c. References _, and realDateFormat(). |
|
Definition at line 3617 of file header.c. References _, and realDateFormat(). |
|
Definition at line 2219 of file header.c. Referenced by parseFormat(). |
|
Find matching (tag,type) entry in header.
Definition at line 906 of file header.c. References headerToken_s::flags, Header, headerSort(), headerToken_s::index, indexCmp(), indexEntry, headerToken_s::indexUsed, indexEntry_s::info, entryInfo_s::tag, and entryInfo_s::type. |
|
Definition at line 2523 of file header.c. References alloca(), sprintfToken_s::cond, sprintfTag_s::ext, sprintfTag_s::extNum, headerSprintfArgs_s::exts, sprintfTag_s::fmt, headerSprintfExtension_s::formatFunction, HEADER_EXT_MORE, headerSprintfArgs, headerSprintfExtension, headerTagTableEntry, headerSprintfExtension_s::more, headerTagTableEntry_s::name, headerSprintfExtension_s::name, sprintfTag, sprintfToken, stpcpy(), sprintfTag_s::tag, sprintfToken_s::tag, headerSprintfExtension_s::tagFunction, headerSprintfArgs_s::tags, sprintfTag_s::type, sprintfToken_s::type, headerSprintfExtension_s::u, sprintfToken_s::u, headerTagTableEntry_s::val, and xstrcasecmp(). Referenced by parseExpression(), and parseFormat(). |
|
Definition at line 3002 of file header.c. References _, _free(), sprintfTag_s::arrayCount, headerSprintfArgs_s::ec, headerSprintfArgs_s::errmsg, sprintfTag_s::ext, sprintfTag_s::extNum, sprintfTag_s::fmt, sprintfTag_s::format, getExtension(), headerSprintfArgs_s::h, headerFreeData(), headerGetEntry(), headerSprintfArgs, hPTR_t, hsaReserve(), int_32, int_8, sprintfTag_s::pad, RPM_BIN_TYPE, RPM_CHAR_TYPE, RPM_INT16_TYPE, RPM_INT32_TYPE, RPM_INT8_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, sprintfTag, stpcpy(), sprintfTag_s::tag, uint_16, headerSprintfArgs_s::val, headerSprintfArgs_s::vallen, xmalloc(), and xstrdup(). Referenced by singleSprintf(). |
|
Destroy headerSprintf format array.
Definition at line 2240 of file header.c. References _free(), sprintfToken_s::array, sprintfToken_s::cond, sprintfToken_s::elseFormat, sprintfToken_s::format, sprintfToken_s::ifFormat, sprintfToken_s::numElseTokens, sprintfToken_s::numIfTokens, sprintfToken_s::numTokens, sprintfToken, sprintfToken_s::type, and sprintfToken_s::u. Referenced by parseExpression(), and parseFormat(). |
|
Call a header extension only once, saving results.
Definition at line 2973 of file header.c. References rpmec_s::avail, rpmec_s::count, rpmec_s::data, rpmec_s::freeit, headerSprintfArgs_s::h, headerSprintfArgs, rpmec, and rpmec_s::type. Referenced by formatValue(), and singleSprintf(). |
|
Return (malloc'ed) copy of entry data.
Definition at line 1852 of file header.c. References copyData(), dataLength(), and xmalloc(). |
|
Return i18n string from header that matches locale.
Definition at line 1620 of file header.c. References entryInfo_s::count, indexEntry_s::data, findEntry(), getenv(), Header, HEADER_I18NTABLE, headerMatchLocale(), indexEntry, indexEntry_s::info, and RPM_STRING_ARRAY_TYPE. Referenced by intGetEntry(). |
|
Definition at line 1786 of file header.c. References copyEntry(), findEntry(), Header, headerIsEntry(), indexEntry, and RPM_NULL_TYPE. |
|
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. *
Definition at line 1547 of file header.c. References alloca(). Referenced by headerFindI18NString(). |
|
|
|
Finish an hsa iteration.
Definition at line 2486 of file header.c. References headerFreeIterator(), headerSprintfArgs, headerSprintfArgs_s::hi, and headerSprintfArgs_s::i. |
|
Initialize an hsa iteration.
Definition at line 2422 of file header.c. References sprintfToken_s::array, sprintfToken_s::format, headerSprintfArgs_s::format, headerSprintfArgs_s::h, headerInitIterator(), headerSprintfArgs, headerSprintfArgs_s::hi, headerSprintfArgs_s::i, sprintfTag, sprintfTag_s::tag, sprintfToken_s::tag, sprintfToken_s::type, and sprintfToken_s::u. |
|
Return next hsa iteration item.
Definition at line 2448 of file header.c. References sprintfToken_s::array, sprintfToken_s::format, headerSprintfArgs_s::format, headerNextIterator(), headerSprintfArgs, headerSprintfArgs_s::hi, headerSprintfArgs_s::i, int_32, headerSprintfArgs_s::numTokens, sprintfTag, sprintfToken, sprintfTag_s::tag, sprintfToken_s::tag, sprintfToken_s::type, and sprintfToken_s::u. |
|
Reserve sufficient buffer space for next output value.
Definition at line 2505 of file header.c. References headerSprintfArgs_s::alloced, headerSprintfArgs, headerSprintfArgs_s::val, headerSprintfArgs_s::vallen, and xrealloc(). Referenced by formatValue(), and singleSprintf(). |
|
Definition at line 257 of file header.c. References indexEntry, indexEntry_s::info, and entryInfo_s::tag. Referenced by findEntry(). |
|
Retrieve tag data from header.
Definition at line 1676 of file header.c. References copyEntry(), findEntry(), Header, headerFindI18NString(), indexEntry, indexEntry_s::info, RPM_I18NSTRING_TYPE, RPM_NULL_TYPE, and entryInfo_s::type. |
|
|
|
Definition at line 284 of file header.c. References indexEntry_s::data, indexEntry, indexEntry_s::info, entryInfo_s::offset, and entryInfo_s::tag. |
|
Definition at line 2864 of file header.c. References _, sprintfToken_s::cond, sprintfToken_s::elseFormat, headerSprintfArgs_s::errmsg, findTag(), freeFormat(), headerSprintfArgs, sprintfToken_s::ifFormat, sprintfToken_s::numElseTokens, sprintfToken_s::numIfTokens, parseFormat(), PARSER_IN_EXPR, sprintfToken, sprintfToken_s::type, and sprintfToken_s::u. Referenced by parseFormat(). |
|
Definition at line 2612 of file header.c. References _, sprintfToken_s::array, sprintfTag_s::arrayCount, headerSprintfArgs_s::errmsg, escapedChar(), findTag(), sprintfToken_s::format, sprintfTag_s::format, freeFormat(), headerSprintfArgs, sprintfTag_s::justOne, sprintfToken_s::len, sprintfToken_s::numTokens, sprintfTag_s::pad, parseExpression(), PARSER_IN_ARRAY, sprintfToken, sprintfToken_s::string, sprintfToken_s::tag, sprintfTag_s::type, sprintfToken_s::type, sprintfToken_s::u, xcalloc(), and xisdigit(). Referenced by parseExpression(). |
|
Definition at line 3560 of file header.c. References _, int_32, xmalloc(), and xstrdup(). Referenced by dateFormat(), and dayFormat(). |
|
Destroy an extension cache.
Definition at line 3387 of file header.c. References _free(), rpmec_s::data, rpmec_s::freeit, HEADER_EXT_MORE, headerSprintfExtension, headerSprintfExtension_s::more, rpmec, and headerSprintfExtension_s::u. |
|
Create an extension cache.
Definition at line 3363 of file header.c. References HEADER_EXT_MORE, headerSprintfExtension, headerSprintfExtension_s::more, rpmec, headerSprintfExtension_s::u, and xcalloc(). |
|
|
|
Definition at line 3204 of file header.c. References _, sprintfToken_s::array, sprintfTag_s::arrayCount, sprintfToken_s::cond, headerSprintfArgs_s::ec, sprintfToken_s::elseFormat, headerSprintfArgs_s::errmsg, sprintfTag_s::ext, sprintfTag_s::extNum, sprintfToken_s::format, formatValue(), getExtension(), headerSprintfArgs_s::h, headerGetEntry(), headerIsEntry(), headerSprintfArgs, hsaReserve(), sprintfToken_s::ifFormat, int_32, sprintfTag_s::justOne, sprintfToken_s::len, sprintfToken_s::numElseTokens, sprintfToken_s::numIfTokens, sprintfToken_s::numTokens, RPM_BIN_TYPE, RPM_STRING_TYPE, sprintfToken, stpcpy(), sprintfToken_s::string, sprintfTag_s::tag, sprintfToken_s::tag, tagName(), sprintfTag_s::type, sprintfToken_s::type, sprintfToken_s::u, headerSprintfArgs_s::val, and headerSprintfArgs_s::vallen. |
|
Return name of tag from value.
Definition at line 10 of file tagname.c. References headerTagTableEntry_s::name, RPMDBI_ADDED, RPMDBI_AVAILABLE, RPMDBI_DEPENDS, RPMDBI_PACKAGES, RPMDBI_REMOVED, rpmTagTable, headerTagTableEntry_s::val, and xtolower(). Referenced by checkForDuplicates(), checkForRequired(), db3close(), db3New(), db3open(), dbiOpen(), i18nTag(), printNewSpecfile(), rpmdbAdd(), rpmdbMoveDatabase(), rpmdbRemove(), rpmdbRemoveDatabase(), rpmHeaderGetEntry(), singleSprintf(), and stashSt(). |
|
|
|
|