summaryrefslogtreecommitdiff
path: root/ext2fs
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2016-10-03 13:26:02 +0200
committerRichard Braun <rbraun@sceen.net>2017-01-06 20:36:09 +0100
commit76266d8cd0db429093e144a67ef66a0a6532c799 (patch)
tree065731535e0339c52651c61e4cb0eb0bc21b8492 /ext2fs
parentea86767459e01e524c05190127ef1e71f5a47ff9 (diff)
ext2fs: Use correct type for sizes.
* ext2fs/ext2fs.h (ext2_{list,get,set}_xattr): Use 'size_t'. * ext2fs/xattr.c (xattr_entry_{list,get,create): Use 'size_t' where appropriate. (ext2_{list,get,set}_xattr): Likewise.
Diffstat (limited to 'ext2fs')
-rw-r--r--ext2fs/ext2fs.h6
-rw-r--r--ext2fs/xattr.c38
2 files changed, 22 insertions, 22 deletions
diff --git a/ext2fs/ext2fs.h b/ext2fs/ext2fs.h
index 76adf632..2ee97fd0 100644
--- a/ext2fs/ext2fs.h
+++ b/ext2fs/ext2fs.h
@@ -582,9 +582,9 @@ extern void ext2_warning (const char *, ...)
/* ---------------------------------------------------------------- */
/* xattr.c */
-error_t ext2_list_xattr (struct node *np, char *buffer, int *len);
-error_t ext2_get_xattr (struct node *np, const char *name, char *value, int *len);
-error_t ext2_set_xattr (struct node *np, const char *name, const char *value, int len, int flags);
+error_t ext2_list_xattr (struct node *np, char *buffer, size_t *len);
+error_t ext2_get_xattr (struct node *np, const char *name, char *value, size_t *len);
+error_t ext2_set_xattr (struct node *np, const char *name, const char *value, size_t len, int flags);
error_t ext2_free_xattr_block (struct node *np);
#endif
diff --git a/ext2fs/xattr.c b/ext2fs/xattr.c
index 1e298dcb..4592d5e4 100644
--- a/ext2fs/xattr.c
+++ b/ext2fs/xattr.c
@@ -156,11 +156,11 @@ xattr_entry_rehash (struct ext2_xattr_header *header,
* length is not enough for name, ERANGE is returned.
*/
static error_t
-xattr_entry_list (struct ext2_xattr_entry *entry, char *buffer, int *len)
+xattr_entry_list (struct ext2_xattr_entry *entry, char *buffer, size_t *len)
{
int i;
- int size;
+ size_t size;
for (i = 0; xattr_prefixes[i].prefix != NULL; i++)
{
@@ -209,7 +209,7 @@ xattr_entry_list (struct ext2_xattr_entry *entry, char *buffer, int *len)
*/
static error_t
xattr_entry_get (char *block, struct ext2_xattr_entry *entry,
- const char *full_name, char *value, int *len, int *cmp)
+ const char *full_name, char *value, size_t *len, int *cmp)
{
int i;
@@ -261,15 +261,15 @@ xattr_entry_create (struct ext2_xattr_header *header,
struct ext2_xattr_entry *last,
struct ext2_xattr_entry *position,
const char *full_name, const char *value,
- int len, int rest)
+ size_t len, size_t rest)
{
int i;
- int name_len;
+ size_t name_len;
off_t start;
off_t end;
- int entry_size;
- int value_size;
+ size_t entry_size;
+ size_t value_size;
int index;
const char *name;
@@ -316,7 +316,7 @@ xattr_entry_create (struct ext2_xattr_header *header,
static error_t
xattr_entry_remove (struct ext2_xattr_header *header,
struct ext2_xattr_entry *last,
- struct ext2_xattr_entry *position, int rest)
+ struct ext2_xattr_entry *position, size_t rest)
{
size_t size;
@@ -366,11 +366,11 @@ static error_t
xattr_entry_replace (struct ext2_xattr_header *header,
struct ext2_xattr_entry *last,
struct ext2_xattr_entry *position,
- const char *value, int len, int rest)
+ const char *value, size_t len, size_t rest)
{
- ssize_t old_size;
- ssize_t new_size;
+ size_t old_size;
+ size_t new_size;
old_size = EXT2_XATTR_ALIGN (position->e_value_size);
new_size = EXT2_XATTR_ALIGN (len);
@@ -500,7 +500,7 @@ cleanup:
* xattr block is invalid (has no valid h_magic number).
*/
error_t
-ext2_list_xattr (struct node *np, char *buffer, int *len)
+ext2_list_xattr (struct node *np, char *buffer, size_t *len)
{
error_t err;
@@ -519,7 +519,7 @@ ext2_list_xattr (struct node *np, char *buffer, int *len)
if (!len)
return EINVAL;
- int size = *len;
+ size_t size = *len;
ei = dino_ref (np->cache_id);
blkno = ei->i_file_acl;
@@ -575,10 +575,10 @@ cleanup:
* in the block matching the name.
*/
error_t
-ext2_get_xattr (struct node *np, const char *name, char *value, int *len)
+ext2_get_xattr (struct node *np, const char *name, char *value, size_t *len)
{
- int size;
+ size_t size;
int err;
void *block;
struct ext2_inode *ei;
@@ -657,12 +657,12 @@ cleanup:
* the specified entry, free the xattr block.
*/
error_t
-ext2_set_xattr (struct node *np, const char *name, const char *value, int len,
- int flags)
+ext2_set_xattr (struct node *np, const char *name, const char *value,
+ size_t len, int flags)
{
int found;
- int rest;
+ size_t rest;
error_t err;
block_t blkno;
void *block;
@@ -732,7 +732,7 @@ ext2_set_xattr (struct node *np, const char *name, const char *value, int len,
while (!EXT2_XATTR_ENTRY_LAST (entry))
{
- int size;
+ size_t size;
int cmp;
err = xattr_entry_get (NULL, entry, name, NULL, &size, &cmp);