From 6ea17f9ca4f1434510be658fc048de21ec3b2109 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Tue, 8 Jul 2008 16:37:23 +0300 Subject: Shove header legacy interfaces into rpmlegacy.h - get them out of sight from main header.h - turn headerSprintf() into macro around headerFormat(), that way rpmTagTable and rpmHeaderFormats lossage can be hidden away as far as headerSprintf() use is concerned --- lib/rpmlegacy.h | 181 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 181 insertions(+) (limited to 'lib/rpmlegacy.h') diff --git a/lib/rpmlegacy.h b/lib/rpmlegacy.h index f86a81a00..b29c00631 100644 --- a/lib/rpmlegacy.h +++ b/lib/rpmlegacy.h @@ -2,6 +2,7 @@ #define _RPMLEGACY_H #include +#include /* ==================================================================== */ /* LEGACY INTERFACES AND TYPES, DO NOT USE IN NEW CODE! */ @@ -20,6 +21,186 @@ typedef int8_t int_8; typedef uint32_t uint_32; typedef uint16_t uint_16; typedef uint8_t uint_8; + +/* legacy header interfaces */ + +/** \ingroup header_legacy + * Retrieve tag value. + * Will never return RPM_I18NSTRING_TYPE! RPM_STRING_TYPE elements with + * RPM_I18NSTRING_TYPE equivalent entries are translated (if HEADER_I18NTABLE + * entry is present). + * @deprecated Use headerGet() instead + * + * @param h header + * @param tag tag + * @retval *type tag value data type (or NULL) + * @retval *p pointer to tag value(s) (or NULL) + * @retval *c number of values (or NULL) + * @return 1 on success, 0 on failure + */ +int headerGetEntry(Header h, rpmTag tag, + rpmTagType * type, + rpm_data_t * p, + rpm_count_t * c) RPM_GNUC_DEPRECATED; + +/** \ingroup header_legacy + * Retrieve tag value using header internal array. + * Get an entry using as little extra RAM as possible to return the tag value. + * This is only an issue for RPM_STRING_ARRAY_TYPE. + * @deprecated Use headerGet() instead + * + * @param h header + * @param tag tag + * @retval *type tag value data type (or NULL) + * @retval *p pointer to tag value(s) (or NULL) + * @retval *c number of values (or NULL) + * @return 1 on success, 0 on failure + */ +int headerGetEntryMinMemory(Header h, rpmTag tag, + rpmTagType * type, + rpm_data_t * p, + rpm_count_t * c) RPM_GNUC_DEPRECATED; + +/** \ingroup header_legacy + * Add tag to header. + * Duplicate tags are okay, but only defined for iteration (with the + * exceptions noted below). While you are allowed to add i18n string + * arrays through this function, you probably don't mean to. See + * headerAddI18NString() instead. + * + * @param h header + * @param tag tag + * @param type tag value data type + * @param p pointer to tag value(s) + * @param c number of values + * @return 1 on success, 0 on failure + */ +int headerAddEntry(Header h, rpmTag tag, rpmTagType type, + rpm_constdata_t p, rpm_count_t c) RPM_GNUC_DEPRECATED; + +/** \ingroup header_legacy + * Append element to tag array in header. + * Appends item p to entry w/ tag and type as passed. Won't work on + * RPM_STRING_TYPE. Any pointers into header memory returned from + * headerGetEntryMinMemory() for this entry are invalid after this + * call has been made! + * + * @param h header + * @param tag tag + * @param type tag value data type + * @param p pointer to tag value(s) + * @param c number of values + * @return 1 on success, 0 on failure + */ +int headerAppendEntry(Header h, rpmTag tag, rpmTagType type, + rpm_constdata_t p, rpm_count_t c) RPM_GNUC_DEPRECATED; + +/** \ingroup header_legacy + * Add or append element to tag array in header. + * @param h header + * @param tag tag + * @param type tag value data type + * @param p pointer to tag value(s) + * @param c number of values + * @return 1 on success, 0 on failure + */ +int headerAddOrAppendEntry(Header h, rpmTag tag, rpmTagType type, + rpm_constdata_t p, rpm_count_t c) RPM_GNUC_DEPRECATED; + +/** \ingroup header_legacy + * Modify tag in header. + * If there are multiple entries with this tag, the first one gets replaced. + * @deprecated Use headerMod() instead + * + * @param h header + * @param tag tag + * @param type tag value data type + * @param p pointer to tag value(s) + * @param c number of values + * @return 1 on success, 0 on failure + */ +int headerModifyEntry(Header h, rpmTag tag, rpmTagType type, + rpm_constdata_t p, rpm_count_t c) RPM_GNUC_DEPRECATED; + +/** \ingroup header_legacy + * Delete tag in header. + * Removes all entries of type tag from the header, returns 1 if none were + * found. + * @deprecated Use headerDel() instead + * + * @param h header + * @param tag tag + * @return 0 on success, 1 on failure (INCONSISTENT) + */ +int headerRemoveEntry(Header h, rpmTag tag) RPM_GNUC_DEPRECATED; + +/** \ingroup header_legacy + * Return formatted output string from header tags. + * The returned string must be free()d. + * @deprecated Use headerFormat() instead + * + * @param _h header + * @param _fmt format to use + * @param _tbltags array of tag name/value pairs (unused) + * @param _exts chained table of formatting extensions. (unused) + * @retval _emsg error message (if any) + * @return formatted output string (malloc'ed) + */ +#define headerSprintf(_h, _fmt, _tbltags, _exts, _emsg) \ + headerFormat((_h), (_fmt), (_emsg)) + +/** \ingroup header_legacy + * Return next tag from header. + * @deprecated Use headerNext() instead. + * + * @param hi header tag iterator + * @retval *tag tag + * @retval *type tag value data type + * @retval *p pointer to tag value(s) + * @retval *c number of values + * @return 1 on success, 0 on failure + */ +int headerNextIterator(HeaderIterator hi, + rpmTag * tag, + rpmTagType * type, + rpm_data_t * p, + rpm_count_t * c) RPM_GNUC_DEPRECATED; + +/** \ingroup header_legacy + * Free data allocated when retrieved from header. + * @deprecated Use rpmtdFreeData() instead + * + * @param h header + * @param data pointer to tag value(s) + * @param type type of data (or -1 to force free) + * @return NULL always + */ +void * headerFreeTag(Header h, rpm_data_t data, rpmTagType type) RPM_GNUC_DEPRECATED; + +/** \ingroup header_legacy + * Free data allocated when retrieved from header. + * @deprecated Use rpmtdFreeData() instead. + * + * @param data address of data (or NULL) + * @param type type of data (or RPM_FORCEFREE_TYPE to force free) + * @return NULL always + */ +void * headerFreeData(rpm_data_t data, rpmTagType type) RPM_GNUC_DEPRECATED; + +/** \ingroup header_legacy + * Prototypes for headerGetEntry(), headerFreeData() etc vectors. + * @{ + */ +typedef void * (*HFD_t) (rpm_data_t data, rpmTagType type); +typedef int (*HGE_t) (Header h, rpmTag tag, rpmTagType * type, + rpm_data_t * p, rpm_count_t * c); +typedef int (*HAE_t) (Header h, rpmTag tag, rpmTagType type, + rpm_constdata_t p, rpm_count_t c); +typedef int (*HME_t) (Header h, rpmTag tag, rpmTagType type, + rpm_constdata_t p, rpm_count_t c); +typedef int (*HRE_t) (Header h, rpmTag tag); +/** @} */ + #endif /* _RPM_4_4_COMPAT */ #ifdef __cplusplus -- cgit v1.2.3