lib: Convert push_file_id_16 to take uint8_t instead of char
authorVolker Lendecke <vl@samba.org>
Sun, 28 Apr 2024 17:51:25 +0000 (19:51 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 30 Apr 2024 22:44:32 +0000 (22:44 +0000)
All callers had a cast from uint8_t to char, avoid those.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/file_id.c
source3/lib/file_id.h
source3/lib/xattr_tdb.c
source3/modules/vfs_acl_tdb.c
source3/modules/vfs_default.c
source3/modules/vfs_streams_depot.c

index 545437afefa8d604ed746fb86e90be6dc3079e60..5499320f615fb6f9624205df92f4faf2a6e6c932 100644 (file)
@@ -46,7 +46,7 @@ char *file_id_str_buf(struct file_id fid, struct file_id_buf *dst)
   push a 16 byte version of a file id into a buffer.  This ignores the extid
   and is needed when dev/inodes are stored in persistent storage (tdbs).
  */
-void push_file_id_16(char *buf, const struct file_id *id)
+void push_file_id_16(uint8_t *buf, const struct file_id *id)
 {
        SIVAL(buf,  0, id->devid&0xFFFFFFFF);
        SIVAL(buf,  4, id->devid>>32);
index 255b1ddc5c5e210d888868463088393bc1f45945..90f074528c23fc72f248ed2f05bc1c3bfdfb1b57 100644 (file)
@@ -37,7 +37,7 @@ char *file_id_str_buf(struct file_id fid, struct file_id_buf *dst);
 /*
   an allocated string for a file_id structure
  */
-void push_file_id_16(char *buf, const struct file_id *id);
+void push_file_id_16(uint8_t *buf, const struct file_id *id);
 void push_file_id_24(char *buf, const struct file_id *id);
 void pull_file_id_24(const char *buf, struct file_id *id);
 
index 564cdd80965c29adca18079f1872586d3584ae0c..8c1cc7398c16002d80877b871b1215218d58f151 100644 (file)
@@ -109,7 +109,7 @@ static NTSTATUS xattr_tdb_load_attrs(TALLOC_CTX *mem_ctx,
        TDB_DATA data;
 
        /* For backwards compatibility only store the dev/inode. */
-       push_file_id_16((char *)id_buf, id);
+       push_file_id_16(id_buf, id);
 
        status = dbwrap_fetch(db_ctx, mem_ctx,
                              make_tdb_data(id_buf, sizeof(id_buf)),
@@ -137,7 +137,7 @@ static struct db_record *xattr_tdb_lock_attrs(TALLOC_CTX *mem_ctx,
        uint8_t id_buf[16];
 
        /* For backwards compatibility only store the dev/inode. */
-       push_file_id_16((char *)id_buf, id);
+       push_file_id_16(id_buf, id);
        return dbwrap_fetch_locked(db_ctx, mem_ctx,
                                   make_tdb_data(id_buf, sizeof(id_buf)));
 }
index bccb1ab0bec75b23e6059d94c417e68fe3f226f2..5ecba7ba75726c2f747aaba4d47ef71a654a51ae 100644 (file)
@@ -102,7 +102,7 @@ static NTSTATUS acl_tdb_delete(vfs_handle_struct *handle,
        uint8_t id_buf[16];
 
        /* For backwards compatibility only store the dev/inode. */
-       push_file_id_16((char *)id_buf, &id);
+       push_file_id_16(id_buf, &id);
 
        status = dbwrap_delete(db, make_tdb_data(id_buf, sizeof(id_buf)));
        return status;
@@ -131,7 +131,7 @@ static NTSTATUS fget_acl_blob(TALLOC_CTX *ctx,
        id = vfs_file_id_from_sbuf(handle->conn, &fsp->fsp_name->st);
 
        /* For backwards compatibility only store the dev/inode. */
-       push_file_id_16((char *)id_buf, &id);
+       push_file_id_16(id_buf, &id);
 
        status = dbwrap_fetch(db,
                              ctx,
@@ -179,7 +179,7 @@ static NTSTATUS store_acl_blob_fsp(vfs_handle_struct *handle,
        id = vfs_file_id_from_sbuf(handle->conn, &fsp->fsp_name->st);
 
        /* For backwards compatibility only store the dev/inode. */
-       push_file_id_16((char *)id_buf, &id);
+       push_file_id_16(id_buf, &id);
 
        status = dbwrap_store(
                db, make_tdb_data(id_buf, sizeof(id_buf)), data, 0);
index 8db4fd7817abf987dd90dea644a883e49b0bb28e..379802fc547f864e8c261701e72a5497a394aaaa 100644 (file)
@@ -1496,9 +1496,9 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle,
                }
 
                /* For backwards compatibility only store the dev/inode. */
-               push_file_id_16((char *)return_data, &fsp->file_id);
+               push_file_id_16(return_data, &fsp->file_id);
                memcpy(return_data+16,create_volume_objectid(fsp->conn,objid),16);
-               push_file_id_16((char *)return_data+32, &fsp->file_id);
+               push_file_id_16(return_data + 32, &fsp->file_id);
                memset(return_data+48, 0, 16);
                *_out_data = return_data;
                return NT_STATUS_OK;
index f9701cc66ed77c0cb4a2a4695761fe15fd2ca97c..1221b2c2be220d2c28c92d5b9aa9c8dd9dee7104 100644 (file)
@@ -215,7 +215,7 @@ static char *stream_dir(vfs_handle_struct *handle,
 
        id = SMB_VFS_FILE_ID_CREATE(handle->conn, &base_sbuf_tmp);
 
-       push_file_id_16((char *)id_buf, &id);
+       push_file_id_16(id_buf, &id);
 
        hash = hash_fn(data_blob_const(id_buf, sizeof(id_buf)));