FAT: enable -Werror
Change-Id: I4364d1325d4822d7094e985991c97639038522b8 Reviewed-on: https://review.haiku-os.org/c/haiku/+/5436 Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org> Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk> Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
parent
ae7395c833
commit
34596ea53f
@ -724,7 +724,7 @@ rule ArchitectureSetupWarnings architecture
|
||||
EnableWerror src add-ons kernel file_systems bfs ;
|
||||
EnableWerror src add-ons kernel file_systems cdda ;
|
||||
EnableWerror src add-ons kernel file_systems ext2 ;
|
||||
# EnableWerror src add-ons kernel file_systems fat ;
|
||||
EnableWerror src add-ons kernel file_systems fat ;
|
||||
EnableWerror src add-ons kernel file_systems googlefs ;
|
||||
EnableWerror src add-ons kernel file_systems iso9660 ;
|
||||
EnableWerror src add-ons kernel file_systems layers ;
|
||||
|
@ -38,8 +38,6 @@ status_t set_mime_type(vnode *node, const char *filename)
|
||||
status_t
|
||||
dosfs_open_attrdir(fs_volume *_vol, fs_vnode *_node, void **_cookie)
|
||||
{
|
||||
nspace *vol = (nspace *)_vol->private_volume;
|
||||
|
||||
DPRINTF(0, ("dosfs_open_attrdir called\n"));
|
||||
|
||||
if ((*_cookie = malloc(sizeof(uint32))) == NULL) {
|
||||
@ -54,8 +52,6 @@ dosfs_open_attrdir(fs_volume *_vol, fs_vnode *_node, void **_cookie)
|
||||
status_t
|
||||
dosfs_close_attrdir(fs_volume *_vol, fs_vnode *_node, void *_cookie)
|
||||
{
|
||||
nspace *vol = (nspace *)_vol->private_volume;
|
||||
|
||||
DPRINTF(0, ("dosfs_close_attrdir called\n"));
|
||||
|
||||
*(int32 *)_cookie = 1;
|
||||
@ -203,14 +199,14 @@ dosfs_read_attr(fs_volume *_vol, fs_vnode *_node, void *_cookie, off_t pos,
|
||||
if (node->mime == NULL)
|
||||
return ENOENT;
|
||||
|
||||
if ((pos < 0) || (pos > strlen(node->mime)))
|
||||
if ((pos < 0) || (pos > (off_t)strlen(node->mime)))
|
||||
return EINVAL;
|
||||
|
||||
length = user_strlcpy((char*)buffer, node->mime + pos, *_length);
|
||||
if (length < B_OK)
|
||||
return B_BAD_ADDRESS;
|
||||
|
||||
if (length < *_length)
|
||||
if ((size_t)length < *_length)
|
||||
*_length = length + 1;
|
||||
|
||||
return 0;
|
||||
|
@ -92,7 +92,7 @@ enum {
|
||||
};
|
||||
|
||||
static int32
|
||||
_fat_ioctl_(nspace *vol, uint32 action, uint32 cluster, int32 N)
|
||||
_fat_ioctl_(nspace *vol, uint32 action, uint32 cluster, uint32 N)
|
||||
{
|
||||
int32 result = 0;
|
||||
uint32 n = 0, first = 0, last = 0;
|
||||
@ -413,7 +413,7 @@ get_nth_fat_entry(nspace *vol, int32 cluster, uint32 n)
|
||||
uint32
|
||||
count_clusters(nspace *vol, int32 cluster)
|
||||
{
|
||||
int32 count = 0;
|
||||
uint32 count = 0;
|
||||
|
||||
DPRINTF(2, ("count_clusters %" B_PRId32 "\n", cluster));
|
||||
|
||||
@ -509,7 +509,7 @@ allocate_n_fat_entries(nspace *vol, int32 n, int32 *start)
|
||||
return c;
|
||||
|
||||
ASSERT(IS_DATA_CLUSTER(c));
|
||||
ASSERT(count_clusters(vol, c) == n);
|
||||
ASSERT(count_clusters(vol, c) == (uint32)n);
|
||||
|
||||
DPRINTF(2, ("allocated %" B_PRId32 " fat entries at %" B_PRId32 "\n", n,
|
||||
c));
|
||||
@ -524,7 +524,8 @@ set_fat_chain_length(nspace *vol, vnode *node, uint32 clusters,
|
||||
bool discardBlockCache)
|
||||
{
|
||||
status_t result;
|
||||
int32 i, c, n;
|
||||
int32 c, n;
|
||||
uint32 i;
|
||||
|
||||
DPRINTF(1, ("set_fat_chain_length: %" B_PRIdINO " to %" B_PRIu32
|
||||
" clusters (%" B_PRIu32 ")\n", node->vnid, clusters, node->cluster));
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "dosfs.h"
|
||||
|
||||
|
||||
#define vIS_DATA_CLUSTER(vol,cluster) (((cluster) >= 2) && ((cluster) < vol->total_clusters + 2))
|
||||
#define vIS_DATA_CLUSTER(vol,cluster) (((cluster) >= 2) && ((uint32)(cluster) < vol->total_clusters + 2))
|
||||
#define IS_DATA_CLUSTER(cluster) vIS_DATA_CLUSTER(vol,cluster)
|
||||
|
||||
// cluster 1 represents root directory for fat12 and fat16
|
||||
|
@ -400,7 +400,7 @@ dosfs_write(fs_volume *_vol, fs_vnode *_node, void *_cookie, off_t pos,
|
||||
}
|
||||
|
||||
// extend file size if needed
|
||||
if (pos + *len > node->st_size) {
|
||||
if (pos + (off_t)*len > (off_t)node->st_size) {
|
||||
uint32 clusters = (pos + *len + vol->bytes_per_sector*vol->sectors_per_cluster - 1) / vol->bytes_per_sector / vol->sectors_per_cluster;
|
||||
if (node->st_size <= (clusters - 1) * vol->sectors_per_cluster * vol->bytes_per_sector) {
|
||||
if ((result = set_fat_chain_length(vol, node, clusters, false))
|
||||
@ -1255,7 +1255,7 @@ dosfs_get_file_map(fs_volume *_vol, fs_vnode *_node, off_t position,
|
||||
}
|
||||
|
||||
// Truncate to file size, taking overflow into account.
|
||||
if (position + length >= node->st_size || position + length < position)
|
||||
if (position + (off_t)length >= node->st_size || position + (off_t)length < position)
|
||||
length = node->st_size - position;
|
||||
|
||||
result = init_csi(vol, node->cluster, 0, &iter);
|
||||
@ -1274,7 +1274,7 @@ dosfs_get_file_map(fs_volume *_vol, fs_vnode *_node, off_t position,
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT(iter.cluster == get_nth_fat_entry(vol, node->cluster,
|
||||
ASSERT(iter.cluster == (uint32)get_nth_fat_entry(vol, node->cluster,
|
||||
position / vol->bytes_per_sector / vol->sectors_per_cluster));
|
||||
|
||||
offset = position % vol->bytes_per_sector;
|
||||
@ -1282,7 +1282,7 @@ dosfs_get_file_map(fs_volume *_vol, fs_vnode *_node, off_t position,
|
||||
off_t block = csi_to_block(&iter);
|
||||
uint32 sectors = 1;
|
||||
|
||||
length -= min_c(length, vol->bytes_per_sector - offset);
|
||||
length -= min_c((off_t)length, vol->bytes_per_sector - offset);
|
||||
|
||||
while (length > 0) {
|
||||
result = iter_csi(&iter, 1);
|
||||
|
@ -155,7 +155,7 @@ csi_read_blocks(struct csi *csi, uint8 *buffer, ssize_t len)
|
||||
uint8 *buf = buffer;
|
||||
int32 i;
|
||||
|
||||
ASSERT(len >= csi->vol->bytes_per_sector);
|
||||
ASSERT(len > 0 && (size_t)len >= csi->vol->bytes_per_sector);
|
||||
|
||||
if (_validate_cs_(csi->vol, csi->cluster, csi->sector) != 0)
|
||||
return EINVAL;
|
||||
@ -166,7 +166,7 @@ csi_read_blocks(struct csi *csi, uint8 *buffer, ssize_t len)
|
||||
while (1) {
|
||||
old_csi = *csi;
|
||||
err = iter_csi(csi, 1);
|
||||
if (len < (sectors + 1) * csi->vol->bytes_per_sector)
|
||||
if ((size_t)len < (sectors + 1) * csi->vol->bytes_per_sector)
|
||||
break;
|
||||
if ((err < B_OK) || (block + sectors != csi_to_block(csi)))
|
||||
break;
|
||||
@ -196,7 +196,7 @@ csi_write_blocks(struct csi *csi, uint8 *buffer, ssize_t len)
|
||||
uint8 *buf = buffer;
|
||||
int32 i;
|
||||
|
||||
ASSERT(len >= csi->vol->bytes_per_sector);
|
||||
ASSERT(len > 0 && (size_t)len >= csi->vol->bytes_per_sector);
|
||||
|
||||
ASSERT(_validate_cs_(csi->vol, csi->cluster, csi->sector) == 0);
|
||||
if (_validate_cs_(csi->vol, csi->cluster, csi->sector) != 0)
|
||||
@ -208,7 +208,7 @@ csi_write_blocks(struct csi *csi, uint8 *buffer, ssize_t len)
|
||||
while (1) {
|
||||
old_csi = *csi;
|
||||
err = iter_csi(csi, 1);
|
||||
if (len < (sectors + 1) * csi->vol->bytes_per_sector)
|
||||
if ((size_t)len < (sectors + 1) * csi->vol->bytes_per_sector)
|
||||
break;
|
||||
if ((err < B_OK) || (block + sectors != csi_to_block(csi)))
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user