Use idx_t, not size_t, for xattr value lengths.

* src/tar.h (struct xattr_map):
* src/xattrs.c (xattr_map_add): Prefer idx_t to size_t.  All uses
changed.
This commit is contained in:
Paul Eggert
2024-08-12 17:39:21 -07:00
parent 09aec02e32
commit ef290cb171
3 changed files with 6 additions and 6 deletions

View File

@@ -915,7 +915,7 @@ void xattr_map_init (struct xattr_map *map);
void xattr_map_copy (struct xattr_map *dst,
const struct xattr_map *src);
void xattr_map_add (struct xattr_map *map,
const char *key, const char *val, size_t len);
const char *key, const char *val, idx_t len);
void xattr_map_free (struct xattr_map *xattr_map);
/* Module system.c */

View File

@@ -281,7 +281,7 @@ struct xattr_array
{
char *xkey;
char *xval_ptr;
size_t xval_len;
idx_t xval_len;
};
struct xattr_map

View File

@@ -66,7 +66,7 @@ xattr_map_free (struct xattr_map *xattr_map)
void
xattr_map_add (struct xattr_map *map,
const char *key, const char *val, size_t len)
const char *key, const char *val, idx_t len)
{
struct xattr_array *p;
@@ -75,7 +75,7 @@ xattr_map_add (struct xattr_map *map,
sizeof (map->xm_map[0]));
p = &map->xm_map[map->xm_size];
p->xkey = xstrdup (key);
p->xval_ptr = xmemdup (val, len + 1);
p->xval_ptr = ximemdup (val, len + 1);
p->xval_len = len;
map->xm_size++;
}
@@ -854,8 +854,8 @@ xattrs_print (struct tar_stat_info const *st)
{
char *keyword = st->xattr_map.xm_map[i].xkey + XATTRS_PREFIX_LEN;
if (!xattrs_masked_out (keyword, false /* like extracting */ ))
fprintf (stdlis, " x: %lu %s\n",
(unsigned long) st->xattr_map.xm_map[i].xval_len, keyword);
fprintf (stdlis, " x: %td %s\n",
st->xattr_map.xm_map[i].xval_len, keyword);
}
}
}