- used by filestates and nothing else apparently, duh..
size_t need;
switch (rpmtdType(td)) {
+ case RPM_INT8_TYPE:
+ case RPM_CHAR_TYPE:
+ need = 10 + padding + 20; /* we can do better, just for now ... */
+ val = xmalloc(need);
+ strcat(formatPrefix, "hhd");
+ sprintf(val, formatPrefix, *rpmtdGetChar(td));
+ break;
case RPM_INT16_TYPE:
need = 10 + padding + 20; /* we can do better, just for now ... */
val = xmalloc(need);
- strcat(formatPrefix, "d");
- sprintf(val, formatPrefix, *rpmtdGetUint32(td));
+ strcat(formatPrefix, "hd");
+ sprintf(val, formatPrefix, *rpmtdGetUint16(td));
break;
case RPM_INT32_TYPE:
need = 10 + padding + 20; /* we can do better, just for now ... */
return i;
}
+char * rpmtdGetChar(rpmtd td)
+{
+ char *res = NULL;
+
+ assert(td != NULL);
+
+ if (td->type == RPM_CHAR_TYPE) {
+ int ix = (td->ix >= 0 ? td->ix : 0);
+ res = (char *) td->data + ix;
+ }
+ return res;
+}
uint16_t * rpmtdGetUint16(rpmtd td)
{
uint16_t *res = NULL;
int rpmtdNext(rpmtd td);
/** \ingroup rpmtd
+ * Return char 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 char type, NULL is returned.
+ * @param td Tag data container
+ * @return Pointer to uint16_t, NULL on error
+ */
+char *rpmtdGetChar(rpmtd td);
+
+/** \ingroup rpmtd
* Return uint16_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