Skip to content

Commit

Permalink
fat: Fix compiler warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmlr committed May 2, 2015
1 parent 09592b1 commit 52bf63b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
15 changes: 7 additions & 8 deletions src/add-ons/kernel/file_systems/fat/dosfs.c
Expand Up @@ -711,9 +711,7 @@ dosfs_identify_partition(int fd, partition_data *partition, void **_cookie)
uint8 buf[512];
int i;
uint32 bytes_per_sector;
uint32 sectors_per_cluster;
uint32 fatCount;
uint32 reserved_sectors;
uint32 total_sectors;
uint32 sectors_per_fat;
char name[12];
Expand All @@ -738,13 +736,11 @@ dosfs_identify_partition(int fd, partition_data *partition, void **_cookie)
}

// must be a power of two
sectors_per_cluster = i = buf[0xd];
i = buf[0xd];
if (i != 1 && i != 2 && i != 4 && i != 8 && i != 0x10 && i != 0x20
&& i != 0x40 && i != 0x80)
return -1;

reserved_sectors = read16(buf, 0xe);

fatCount = buf[0x10];
if (fatCount == 0 || fatCount > 8)
return -1;
Expand Down Expand Up @@ -1101,9 +1097,11 @@ dosfs_write_fs_stat(fs_volume *_vol, const struct fs_info * fss, uint32 mask)
goto bi;
}
if ((vol->sectors_per_fat == 0 && (buffer[0x42] != 0x29
|| strncmp(buffer + 0x47, vol->vol_label, 11) != 0))
|| strncmp((const char *)buffer + 0x47, vol->vol_label, 11)
!= 0))
|| (vol->sectors_per_fat != 0 && (buffer[0x26] != 0x29
|| strncmp(buffer + 0x2b, vol->vol_label, 11) == 0))) {
|| strncmp((const char *)buffer + 0x2b, vol->vol_label, 11)
== 0))) {
dprintf("dosfs_wfsstat: label mismatch\n");
block_cache_set_dirty(vol->fBlockCache, 0, false, -1);
result = B_ERROR;
Expand All @@ -1118,7 +1116,8 @@ dosfs_write_fs_stat(fs_volume *_vol, const struct fs_info * fss, uint32 mask)
buffer = diri_init(vol, vol->root_vnode.cluster, vol->vol_entry, &diri);

// check if it is the same as the old volume label
if ((buffer == NULL) || (strncmp(buffer, vol->vol_label, 11) == 0)) {
if (buffer == NULL || strncmp((const char *)buffer, vol->vol_label,
11) == 0) {
dprintf("dosfs_wfsstat: label mismatch\n");
diri_free(&diri);
result = B_ERROR;
Expand Down
4 changes: 2 additions & 2 deletions src/add-ons/kernel/file_systems/fat/iter.c
Expand Up @@ -150,7 +150,7 @@ csi_read_blocks(struct csi *csi, uint8 *buffer, ssize_t len)
uint32 sectors;
off_t block;
status_t err;
char *buf = buffer;
uint8 *buf = buffer;
int32 i;

ASSERT(len >= csi->vol->bytes_per_sector);
Expand Down Expand Up @@ -191,7 +191,7 @@ csi_write_blocks(struct csi *csi, uint8 *buffer, ssize_t len)
uint32 sectors;
off_t block;
status_t err;
char *buf = buffer;
uint8 *buf = buffer;
int32 i;

ASSERT(len >= csi->vol->bytes_per_sector);
Expand Down

0 comments on commit 52bf63b

Please sign in to comment.