#include "system.h"
#include <header_internal.h>
#include "debug.h"
Go to the source code of this file.
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 | hdrchkData(_nbytes) ((_nbytes) & 0xff000000) |
Sanity check on data size and/or offset. | |
Functions | |
const char *const | tagName (int tag) |
static void * | _free (const void *p) |
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL. | |
static int | indexCmp (const void *avp, const void *bvp) |
static int | offsetCmp (const void *avp, const void *bvp) |
static int | dataLength (int_32 type, hPTR_t p, int_32 count, int onDisk) |
Return length of entry data. | |
static int | regionSwab (indexEntry entry, int il, int dl, entryInfo pe, char *dataStart, int regionid) |
static void * | doHeaderUnload (Header h, int *lengthPtr) |
static indexEntry | findEntry (Header h, int_32 tag, int_32 type) |
Find matching (tag,type) entry in header. | |
static int | copyEntry (const indexEntry entry, hTYP_t type, hPTR_t *p, hCNT_t c, int minMem) |
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, 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) |
static void | copyData (int_32 type, void *dstPtr, const void *srcPtr, int_32 c, int dataLength) |
static void * | grabData (int_32 type, hPTR_t p, int_32 c, int *lengthPtr) |
Return (malloc'ed) copy of entry data. | |
static char | escapedChar (const char ch) |
static sprintfToken | freeFormat (sprintfToken format, int num) |
Destroy headerSprintf format array. | |
static void | findTag (char *name, const headerTagTableEntry tags, const headerSprintfExtension extensions, headerTagTableEntry *tagMatch, headerSprintfExtension *extMatch) |
static int | parseExpression (sprintfToken token, char *str, const headerTagTableEntry tags, const headerSprintfExtension extensions, char **endPtr, errmsg_t *errmsg) |
static int | parseFormat (char *str, const headerTagTableEntry tags, const headerSprintfExtension extensions, sprintfToken *formatPtr, int *numTokensPtr, char **endPtr, int state, errmsg_t *errmsg) |
static int | getExtension (Header h, headerTagTagFunction fn, hTYP_t typeptr, hPTR_t *data, hCNT_t countptr, extensionCache ext) |
static char * | formatValue (sprintfTag tag, Header h, const headerSprintfExtension extensions, extensionCache extCache, int element) |
static const char * | singleSprintf (Header h, sprintfToken token, const headerSprintfExtension extensions, extensionCache extCache, int element) |
static extensionCache | allocateExtensionCache (const headerSprintfExtension extensions) |
static extensionCache | freeExtensionCache (const headerSprintfExtension extensions, extensionCache cache) |
static char * | octalFormat (int_32 type, hPTR_t data, char *formatPrefix, int padding, int element) |
static char * | hexFormat (int_32 type, hPTR_t data, char *formatPrefix, int padding, int element) |
static char * | realDateFormat (int_32 type, hPTR_t data, char *formatPrefix, int padding, int element, const char *strftimeFormat) |
static char * | dateFormat (int_32 type, hPTR_t data, char *formatPrefix, int padding, int element) |
static char * | dayFormat (int_32 type, hPTR_t data, char *formatPrefix, int padding, int element) |
static char * | shescapeFormat (int_32 type, hPTR_t data, char *formatPrefix, int padding, int element) |
Variables | |
static unsigned char | header_magic [8] |
static size_t | headerMaxbytes = (32*1024*1024) |
static int | typeSizes [] |
HV_t | hdrVec = &hdrVec1 |
const struct headerSprintfExtension_s | headerDefaultFormats [] |
static struct HV_s | hdrVec1 |
Definition in file header.c.
|
|
|
Sanity check on data size and/or offset. This check imposes a limit of 16Mb, more than enough. Definition at line 58 of file header.c. Referenced by doHeaderUnload(). |
|
Sanity check on no. of tags. This check imposes a limit of 65K tags, more than enough. Definition at line 52 of file header.c. Referenced by doHeaderUnload(). |
|
|
|
Definition at line 32 of file header.c. Referenced by parseFormat(). |
|
Definition at line 33 of file header.c. Referenced by parseExpression(), and parseFormat(). |
|
|
Definition at line 2809 of file header.c. References HEADER_EXT_LAST, HEADER_EXT_MORE, headerSprintfExtension_s::more, headerSprintfExtension_s::type, headerSprintfExtension_s::u, and xcalloc(). |
|
Definition at line 1632 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 319 of file header.c. References _, EXIT_FAILURE, RPM_I18NSTRING_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, and typeSizes. Referenced by copyData(), grabData(), and regionSwab(). |
|
Definition at line 3005 of file header.c. References realDateFormat(). |
|
Definition at line 3014 of file header.c. References realDateFormat(). |
|
Definition at line 2003 of file header.c. Referenced by parseFormat(). |
|
Find matching (tag,type) entry in header.
Definition at line 771 of file header.c. References headerToken::flags, HEADERFLAG_SORTED, headerSort(), headerToken::index, indexCmp(), headerToken::indexUsed, indexEntry::info, RPM_NULL_TYPE, entryInfo::tag, and entryInfo::type. Referenced by addMacro(), delMacro(), expandMacro(), headerFindI18NString(), headerGetRawEntry(), htGetEntry(), htHasEntry(), and intGetEntry(). |
|
Definition at line 2058 of file header.c. References alloca(), HEADER_EXT_LAST, HEADER_EXT_MORE, HEADER_EXT_TAG, headerSprintfExtension_s::more, headerTagTableEntry_s::name, headerSprintfExtension_s::name, stpcpy(), headerSprintfExtension_s::type, headerSprintfExtension_s::u, and xstrcasecmp(). Referenced by parseExpression(), and parseFormat(). |
|
Definition at line 2515 of file header.c. References _, _free(), sprintfTag::arrayCount, sprintfTag::ext, sprintfTag::extNum, sprintfTag::format, headerSprintfExtension_s::formatFunction, getExtension(), HEADER_EXT_FORMAT, HEADER_EXT_LAST, HEADER_EXT_MORE, headerFreeData(), headerGetEntry(), headerSprintfExtension_s::more, headerSprintfExtension_s::name, sprintfTag::pad, RPM_BIN_TYPE, RPM_CHAR_TYPE, RPM_INT16_TYPE, RPM_INT32_TYPE, RPM_INT8_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, stpcpy(), sprintfTag::tag, headerSprintfExtension_s::type, sprintfTag::type, headerSprintfExtension_s::u, xmalloc(), and xstrdup(). Referenced by singleSprintf(). |
|
Definition at line 2832 of file header.c. References _free(), extensionCache::data, HEADER_EXT_LAST, HEADER_EXT_MORE, headerSprintfExtension_s::more, headerSprintfExtension_s::type, and headerSprintfExtension_s::u. |
|
Destroy headerSprintf format array.
Definition at line 2024 of file header.c. References _free(), sprintfToken::array, sprintfToken::cond, sprintfToken::elseFormat, sprintfToken::format, sprintfToken::ifFormat, sprintfToken::numElseTokens, sprintfToken::numIfTokens, sprintfToken::numTokens, and sprintfToken::u. Referenced by parseExpression(), and parseFormat(). |
|
Definition at line 2493 of file header.c. References extensionCache::avail, extensionCache::count, extensionCache::data, extensionCache::freeit, and extensionCache::type. Referenced by formatValue(), and singleSprintf(). |
|
Return (malloc'ed) copy of entry data.
Definition at line 1671 of file header.c. References copyData(), dataLength(), and xmalloc(). |
|
Return i18n string from header that matches locale.
Definition at line 1445 of file header.c. References indexEntry::data, findEntry(), getenv(), HEADER_I18NTABLE, headerMatchLocale(), and RPM_STRING_ARRAY_TYPE. Referenced by intGetEntry(). |
|
Definition at line 1606 of file header.c. References copyEntry(), findEntry(), headerIsEntry(), and RPM_NULL_TYPE. Referenced by headerGetLangs(). |
|
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 1372 of file header.c. References alloca(). Referenced by headerFindI18NString(). |
|
Definition at line 2951 of file header.c. References _, RPM_INT32_TYPE, xmalloc(), and xstrdup(). |
|
Definition at line 188 of file header.c. References indexEntry::info, and entryInfo::tag. Referenced by findEntry(). |
|
Retrieve tag data from header.
Definition at line 1499 of file header.c. References copyEntry(), findEntry(), headerFindI18NString(), indexEntry::info, RPM_I18NSTRING_TYPE, RPM_NULL_TYPE, RPM_STRING_TYPE, and entryInfo::type. |
|
Definition at line 2930 of file header.c. References _, RPM_INT32_TYPE, xmalloc(), and xstrdup(). |
|
Definition at line 212 of file header.c. References indexEntry::data, indexEntry::info, entryInfo::offset, and entryInfo::tag. |
|
Definition at line 2367 of file header.c. References _, sprintfToken::cond, sprintfToken::elseFormat, sprintfTag::ext, sprintfTag::extNum, findTag(), freeFormat(), sprintfToken::ifFormat, sprintfToken::numElseTokens, sprintfToken::numIfTokens, parseFormat(), PARSER_IN_EXPR, sprintfTag::tag, sprintfToken::tag, headerSprintfExtension_s::tagFunction, sprintfToken::type, headerSprintfExtension_s::u, sprintfToken::u, headerTagTableEntry_s::val, and xstrdup(). Referenced by parseFormat(). |
|
Definition at line 2117 of file header.c. References _, sprintfToken::array, sprintfTag::arrayCount, escapedChar(), sprintfTag::ext, sprintfTag::extNum, findTag(), sprintfToken::format, sprintfTag::format, freeFormat(), sprintfTag::justOne, sprintfToken::len, sprintfToken::numTokens, sprintfTag::pad, parseExpression(), PARSER_IN_ARRAY, PARSER_IN_EXPR, sprintfToken::string, sprintfTag::tag, sprintfToken::tag, headerSprintfExtension_s::tagFunction, sprintfTag::type, sprintfToken::type, headerSprintfExtension_s::u, sprintfToken::u, headerTagTableEntry_s::val, xcalloc(), and xisdigit(). Referenced by parseExpression(). |
|
Definition at line 2972 of file header.c. References _, RPM_INT32_TYPE, xmalloc(), and xstrdup(). Referenced by dateFormat(), and dayFormat(). |
|
Definition at line 3024 of file header.c. References alloca(), RPM_INT32_TYPE, and xmalloc(). |
|
Definition at line 2691 of file header.c. References _free(), sprintfToken::array, sprintfTag::arrayCount, sprintfToken::cond, sprintfToken::elseFormat, sprintfTag::ext, sprintfTag::extNum, sprintfToken::format, formatValue(), getExtension(), headerFreeData(), headerGetEntry(), sprintfToken::ifFormat, sprintfTag::justOne, sprintfToken::len, sprintfToken::numElseTokens, sprintfToken::numIfTokens, sprintfToken::numTokens, sprintfToken::string, sprintfTag::tag, sprintfToken::tag, sprintfToken::type, sprintfToken::u, xmalloc(), xrealloc(), and xstrdup(). |
|
Definition at line 10 of file tagName.c. Referenced by checkForDuplicates(), checkForRequired(), db1basename(), db3close(), db3open(), dbiCclose(), dbiClose(), dbiCopen(), dbiCount(), dbiDel(), dbiGet(), dbiOpen(), dbiPut(), dbiSearch(), dbiSync(), dbiUpdateIndex(), dbiVerify(), handlePreambleTag(), i18nTag(), printNewSpecfile(), rpmdbAdd(), rpmdbInitIterator(), rpmdbMoveDatabase(), rpmdbRemove(), rpmdbRemoveDatabase(), rpmHeaderGetEntry(), and stashSt(). |
|
|