Add access methods for 64bit integer types to rpmtd
This commit is contained in:
parent
d1c9e039a4
commit
05db695ee6
24
lib/rpmtd.c
24
lib/rpmtd.c
|
@ -123,6 +123,16 @@ uint32_t *rpmtdNextUint32(rpmtd td)
|
|||
return res;
|
||||
}
|
||||
|
||||
uint64_t *rpmtdNextUint64(rpmtd td)
|
||||
{
|
||||
assert(td != NULL);
|
||||
uint64_t *res = NULL;
|
||||
if (rpmtdNext(td) >= 0) {
|
||||
res = rpmtdGetUint64(td);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
const char *rpmtdNextString(rpmtd td)
|
||||
{
|
||||
assert(td != NULL);
|
||||
|
@ -170,6 +180,20 @@ uint32_t * rpmtdGetUint32(rpmtd td)
|
|||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
uint64_t * rpmtdGetUint64(rpmtd td)
|
||||
{
|
||||
uint64_t *res = NULL;
|
||||
|
||||
assert(td != NULL);
|
||||
|
||||
if (td->type == RPM_INT64_TYPE) {
|
||||
int ix = (td->ix >= 0 ? td->ix : 0);
|
||||
res = (uint64_t *) td->data + ix;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
const char * rpmtdGetString(rpmtd td)
|
||||
{
|
||||
const char *str = NULL;
|
||||
|
|
17
lib/rpmtd.h
17
lib/rpmtd.h
|
@ -110,6 +110,13 @@ int rpmtdNext(rpmtd td);
|
|||
*/
|
||||
uint32_t *rpmtdNextUint32(rpmtd td);
|
||||
|
||||
/** \ingroup rpmtd
|
||||
* Iterate over uint64_t type tag data container.
|
||||
* @param td Tag data container
|
||||
* @return Pointer to next value, NULL on termination or error
|
||||
*/
|
||||
uint64_t *rpmtdNextUint64(rpmtd td);
|
||||
|
||||
/** \ingroup rpmtd
|
||||
* Iterate over string / string array type tag data container.
|
||||
* @param td Tag data container
|
||||
|
@ -147,6 +154,16 @@ uint16_t * rpmtdGetUint16(rpmtd td);
|
|||
*/
|
||||
uint32_t * rpmtdGetUint32(rpmtd td);
|
||||
|
||||
/** \ingroup rpmtd
|
||||
* Return uint64_t data from tag container.
|
||||
* For scalar return type, just return pointer to the integer. On array
|
||||
* types, return pointer to current iteration index. If the tag container
|
||||
* is not for int64 type, NULL is returned.
|
||||
* @param td Tag data container
|
||||
* @return Pointer to uint64_t, NULL on error
|
||||
*/
|
||||
uint64_t * rpmtdGetUint64(rpmtd td);
|
||||
|
||||
/** \ingroup rpmtd
|
||||
* Return string data from tag container.
|
||||
* For string types, just return the string. On string array types,
|
||||
|
|
Loading…
Reference in New Issue