mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[misc] fix 32-bit arithmetic overflow operation warnings
* Also disable C28251 annotation warning
This commit is contained in:
parent
67d324f82b
commit
65523bbdf9
21 changed files with 53 additions and 48 deletions
|
@ -128,7 +128,7 @@
|
|||
<CompileAs>CompileAsC</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<DisableSpecificWarnings>4091;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings>4091;28251;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
|
@ -153,7 +153,7 @@
|
|||
<CompileAs>CompileAsC</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<DisableSpecificWarnings>4091;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings>4091;28251;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
@ -179,7 +179,7 @@
|
|||
<CompileAs>CompileAsC</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<DisableSpecificWarnings>4091;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings>4091;28251;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
@ -209,7 +209,7 @@
|
|||
<CompileAs>CompileAsC</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<DisableSpecificWarnings>4091;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings>4091;28251;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
|
@ -234,7 +234,7 @@
|
|||
<CompileAs>CompileAsC</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<DisableSpecificWarnings>4091;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings>4091;28251;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<UndefinePreprocessorDefinitions>NDEBUG</UndefinePreprocessorDefinitions>
|
||||
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
|
@ -259,7 +259,7 @@
|
|||
<CompileAs>CompileAsC</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<DisableSpecificWarnings>4091;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings>4091;28251;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<UndefinePreprocessorDefinitions>NDEBUG</UndefinePreprocessorDefinitions>
|
||||
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
|
@ -286,7 +286,7 @@
|
|||
<CompileAs>CompileAsC</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<DisableSpecificWarnings>4091;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings>4091;28251;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<UndefinePreprocessorDefinitions>NDEBUG</UndefinePreprocessorDefinitions>
|
||||
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
|
@ -316,7 +316,7 @@
|
|||
<CompileAs>CompileAsC</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<DisableSpecificWarnings>4091;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings>4091;28251;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<UndefinePreprocessorDefinitions>NDEBUG</UndefinePreprocessorDefinitions>
|
||||
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
|
|
|
@ -262,7 +262,7 @@ unpack_lzma_stream(transformer_state_t *xstate)
|
|||
|
||||
rc = rc_init(xstate->src_fd); /*, RC_BUFFER_SIZE); */
|
||||
|
||||
while (global_pos + buffer_pos < header.dst_size) {
|
||||
while ((uint64_t)global_pos + buffer_pos < header.dst_size) {
|
||||
int pos_state = (buffer_pos + global_pos) & pos_state_mask;
|
||||
uintptr_t off1 = LZMA_IS_MATCH + (state << LZMA_NUM_POS_BITS_MAX) + pos_state;
|
||||
uint16_t *prob1 = p + off1;
|
||||
|
|
|
@ -113,7 +113,7 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
|
|||
if (retval)
|
||||
return retval;
|
||||
start_blk += fs->inode_blocks_per_group;
|
||||
start_blk += ((fs->stride * group) %
|
||||
start_blk += (((blk64_t)fs->stride * group) %
|
||||
(last_blk - start_blk + 1));
|
||||
if (start_blk >= last_blk)
|
||||
start_blk = group_blk;
|
||||
|
|
|
@ -129,7 +129,7 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list)
|
|||
inode.i_ctime = fs->now ? fs->now : time(0);
|
||||
ext2fs_iblk_set(fs, &inode, rec.bad_block_count);
|
||||
retval = ext2fs_inode_size_set(fs, &inode,
|
||||
rec.bad_block_count * fs->blocksize);
|
||||
(ext2_off64_t)rec.bad_block_count * fs->blocksize);
|
||||
if (retval)
|
||||
goto cleanup;
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs,
|
|||
|
||||
start = 1;
|
||||
end = fs->super->s_inodes_count;
|
||||
real_end = (EXT2_INODES_PER_GROUP(fs->super) * fs->group_desc_count);
|
||||
real_end = ((__u64)EXT2_INODES_PER_GROUP(fs->super) * fs->group_desc_count);
|
||||
|
||||
/* Are we permitted to use new-style bitmaps? */
|
||||
if (fs->flags & EXT2_FLAG_64BITS)
|
||||
|
|
|
@ -726,13 +726,13 @@ static errcode_t rb_set_bmap_range(ext2fs_generic_bitmap_64 bitmap,
|
|||
continue;
|
||||
|
||||
rb_insert_extent(start + first_set - bitmap->start,
|
||||
i - first_set, bp);
|
||||
(__u64)i - first_set, bp);
|
||||
check_tree(&bp->root, __func__);
|
||||
first_set = -1;
|
||||
}
|
||||
if (first_set != -1) {
|
||||
rb_insert_extent(start + first_set - bitmap->start,
|
||||
num - first_set, bp);
|
||||
(__u64)num - first_set, bp);
|
||||
check_tree(&bp->root, __func__);
|
||||
}
|
||||
|
||||
|
@ -792,8 +792,8 @@ static errcode_t rb_get_bmap_range(ext2fs_generic_bitmap_64 bitmap,
|
|||
int offset = (pos - start) >> 3;
|
||||
|
||||
memset(((char *) out) + offset, 0xFF, nbytes);
|
||||
pos += nbytes << 3;
|
||||
count -= nbytes << 3;
|
||||
pos += (__u64)nbytes << 3;
|
||||
count -= (__u64)nbytes << 3;
|
||||
continue;
|
||||
}
|
||||
ext2fs_fast_set_bit64((pos - start), out);
|
||||
|
|
|
@ -165,7 +165,7 @@ static int block_iterate_dind(blk_t *dind_block, blk_t ref_block,
|
|||
}
|
||||
check_for_ro_violation_return(ctx, ret);
|
||||
if (!*dind_block || (ret & BLOCK_ABORT)) {
|
||||
ctx->bcount += limit*limit;
|
||||
ctx->bcount += (e2_blkcnt_t)limit * limit;
|
||||
return ret;
|
||||
}
|
||||
if (*dind_block >= ext2fs_blocks_count(ctx->fs->super) ||
|
||||
|
@ -284,7 +284,7 @@ static int block_iterate_tind(blk_t *tind_block, blk_t ref_block,
|
|||
} else {
|
||||
for (i = 0; i < limit; i++, block_nr++) {
|
||||
if (*block_nr == 0) {
|
||||
ctx->bcount += limit*limit;
|
||||
ctx->bcount += (e2_blkcnt_t)limit * limit;
|
||||
continue;
|
||||
}
|
||||
flags = block_iterate_dind(block_nr,
|
||||
|
@ -544,7 +544,7 @@ errcode_t ext2fs_block_iterate3(ext2_filsys fs,
|
|||
if (ret & BLOCK_ABORT)
|
||||
goto abort_exit;
|
||||
} else
|
||||
ctx.bcount += limit * limit;
|
||||
ctx.bcount += (e2_blkcnt_t)limit * limit;
|
||||
if (inode.i_block[EXT2_TIND_BLOCK] || (flags & BLOCK_FLAG_APPEND)) {
|
||||
ret |= block_iterate_tind(&inode.i_block[EXT2_TIND_BLOCK],
|
||||
0, EXT2_TIND_BLOCK, &ctx);
|
||||
|
|
|
@ -417,7 +417,7 @@ errcode_t ext2fs_bmap2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
|
|||
|
||||
/* Doubly indirect block */
|
||||
block -= addr_per_block;
|
||||
if (block < addr_per_block * addr_per_block) {
|
||||
if (block < (blk64_t)addr_per_block * addr_per_block) {
|
||||
b = inode_bmap(inode, EXT2_DIND_BLOCK);
|
||||
if (!b) {
|
||||
if (!(bmap_flags & BMAP_ALLOC)) {
|
||||
|
@ -444,7 +444,7 @@ errcode_t ext2fs_bmap2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
|
|||
}
|
||||
|
||||
/* Triply indirect block */
|
||||
block -= addr_per_block * addr_per_block;
|
||||
block -= (blk64_t)addr_per_block * addr_per_block;
|
||||
b = inode_bmap(inode, EXT2_TIND_BLOCK);
|
||||
if (!b) {
|
||||
if (!(bmap_flags & BMAP_ALLOC)) {
|
||||
|
|
|
@ -89,7 +89,7 @@ errcode_t ext2fs_super_and_bgd_loc2(ext2_filsys fs,
|
|||
old_desc_blocks = fs->super->s_first_meta_bg;
|
||||
else
|
||||
old_desc_blocks =
|
||||
fs->desc_blocks + fs->super->s_reserved_gdt_blocks;
|
||||
(blk64_t)fs->desc_blocks + fs->super->s_reserved_gdt_blocks;
|
||||
|
||||
has_super = ext2fs_bg_has_super(fs, group);
|
||||
|
||||
|
|
|
@ -1875,14 +1875,17 @@ _INLINE_ errcode_t ext2fs_free_mem(void *ptr)
|
|||
_INLINE_ errcode_t ext2fs_resize_mem(unsigned long EXT2FS_ATTR((unused)) old_size,
|
||||
unsigned long size, void *ptr)
|
||||
{
|
||||
void *p;
|
||||
void *p, *old_p;
|
||||
|
||||
/* Use "memcpy" for pointer assignments here to avoid problems
|
||||
* with C99 strict type aliasing rules. */
|
||||
memcpy(&p, ptr, sizeof(p));
|
||||
old_p = p;
|
||||
p = realloc(p, size);
|
||||
if (!p)
|
||||
if (!p) {
|
||||
free(old_p);
|
||||
return EXT2_ET_NO_MEMORY;
|
||||
}
|
||||
memcpy(ptr, &p, sizeof(p));
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1568,8 +1568,8 @@ errcode_t ext2fs_extent_set_bmap(ext2_extent_handle_t handle,
|
|||
}
|
||||
}
|
||||
/* add post-split extent */
|
||||
extent.e_pblk += extent.e_len + 1;
|
||||
extent.e_lblk += extent.e_len + 1;
|
||||
extent.e_pblk += (blk64_t)extent.e_len + 1;
|
||||
extent.e_lblk += (blk64_t)extent.e_len + 1;
|
||||
extent.e_len = save_length - extent.e_len - 1;
|
||||
retval = ext2fs_extent_insert(handle,
|
||||
EXT2_EXTENT_INSERT_AFTER, &extent);
|
||||
|
|
|
@ -682,7 +682,7 @@ int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap gen_bmap,
|
|||
|
||||
/* convert to clusters if necessary */
|
||||
block >>= bmap->cluster_bits;
|
||||
end += (1 << bmap->cluster_bits) - 1;
|
||||
end += (1ULL << bmap->cluster_bits) - 1;
|
||||
end >>= bmap->cluster_bits;
|
||||
num = end - block;
|
||||
|
||||
|
@ -723,7 +723,7 @@ void ext2fs_mark_block_bitmap_range2(ext2fs_block_bitmap gen_bmap,
|
|||
|
||||
/* convert to clusters if necessary */
|
||||
block >>= bmap->cluster_bits;
|
||||
end += (1 << bmap->cluster_bits) - 1;
|
||||
end += (1ULL << bmap->cluster_bits) - 1;
|
||||
end >>= bmap->cluster_bits;
|
||||
num = end - block;
|
||||
|
||||
|
@ -764,7 +764,7 @@ void ext2fs_unmark_block_bitmap_range2(ext2fs_block_bitmap gen_bmap,
|
|||
|
||||
/* convert to clusters if necessary */
|
||||
block >>= bmap->cluster_bits;
|
||||
end += (1 << bmap->cluster_bits) - 1;
|
||||
end += (1ULL << bmap->cluster_bits) - 1;
|
||||
end >>= bmap->cluster_bits;
|
||||
num = end - block;
|
||||
|
||||
|
@ -799,8 +799,7 @@ errcode_t ext2fs_convert_subcluster_bitmap(ext2_filsys fs,
|
|||
ext2fs_generic_bitmap_64 bmap, cmap;
|
||||
ext2fs_block_bitmap gen_bmap = *bitmap, gen_cmap;
|
||||
errcode_t retval;
|
||||
blk64_t i, b_end, c_end;
|
||||
int n, ratio;
|
||||
blk64_t i, b_end, c_end, n, ratio;
|
||||
|
||||
bmap = (ext2fs_generic_bitmap_64) gen_bmap;
|
||||
if (fs->cluster_ratio_bits == ext2fs_get_bitmap_granularity(gen_bmap))
|
||||
|
@ -818,7 +817,7 @@ errcode_t ext2fs_convert_subcluster_bitmap(ext2_filsys fs,
|
|||
c_end = cmap->end;
|
||||
cmap->end = cmap->real_end;
|
||||
n = 0;
|
||||
ratio = 1 << fs->cluster_ratio_bits;
|
||||
ratio = 1ULL << fs->cluster_ratio_bits;
|
||||
while (i < bmap->real_end) {
|
||||
if (ext2fs_test_block_bitmap2(gen_bmap, i)) {
|
||||
ext2fs_mark_block_bitmap2(gen_cmap, i);
|
||||
|
|
|
@ -967,6 +967,10 @@ errcode_t ext2fs_write_inode2(ext2_filsys fs, ext2_ino_t ino,
|
|||
if ((offset + length) > fs->blocksize)
|
||||
clen = fs->blocksize - offset;
|
||||
|
||||
if (!fs->icache) {
|
||||
retval = EXT2_ET_GDESC_READ;
|
||||
goto errout;
|
||||
}
|
||||
if (fs->icache->buffer_blk != block_nr) {
|
||||
retval = io_channel_read_blk64(fs->io, block_nr, 1,
|
||||
fs->icache->buffer);
|
||||
|
|
|
@ -106,7 +106,7 @@ static errcode_t write_bitmaps(ext2_filsys fs, int do_inode, int do_block)
|
|||
}
|
||||
}
|
||||
skip_this_block_bitmap:
|
||||
blk_itr += block_nbytes << 3;
|
||||
blk_itr += (blk64_t)block_nbytes << 3;
|
||||
skip_block_bitmap:
|
||||
|
||||
if (!do_inode)
|
||||
|
@ -322,7 +322,7 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block)
|
|||
blk_itr, cnt, block_bitmap);
|
||||
if (retval)
|
||||
goto cleanup;
|
||||
blk_itr += block_nbytes << 3;
|
||||
blk_itr += (blk64_t)block_nbytes << 3;
|
||||
}
|
||||
if (inode_bitmap) {
|
||||
blk = ext2fs_inode_bitmap_loc(fs, i);
|
||||
|
|
|
@ -169,7 +169,7 @@ static void sha512_done(struct hash_state * md, unsigned char *out)
|
|||
int i;
|
||||
|
||||
/* increase the length of the message */
|
||||
md->sha512.length += md->sha512.curlen * CONST64(8);
|
||||
md->sha512.length += (__u64)md->sha512.curlen * CONST64(8);
|
||||
|
||||
/* append the '1' bit */
|
||||
md->sha512.buf[md->sha512.curlen++] = (unsigned char)0x80;
|
||||
|
|
|
@ -187,7 +187,7 @@ cdio_read_mode1_sector (const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn,
|
|||
return p_cdio->op.read_mode1_sector(p_cdio->env, p_buf, i_lsn, b_form2);
|
||||
} else if (p_cdio->op.lseek && p_cdio->op.read) {
|
||||
char buf[M2RAW_SECTOR_SIZE] = { 0, };
|
||||
if (0 > cdio_lseek(p_cdio, CDIO_CD_FRAMESIZE*i_lsn, SEEK_SET))
|
||||
if (0 > cdio_lseek(p_cdio, (long long)CDIO_CD_FRAMESIZE * i_lsn, SEEK_SET))
|
||||
return -1;
|
||||
if (0 > cdio_read(p_cdio, buf, CDIO_CD_FRAMESIZE))
|
||||
return -1;
|
||||
|
|
|
@ -133,13 +133,12 @@ udf_stamp_to_time(time_t *dest, long int *dest_usec,
|
|||
return NULL;
|
||||
}
|
||||
*dest = year_seconds[src.year - EPOCH_YEAR];
|
||||
*dest -= offset * SECS_PER_MINUTE;
|
||||
*dest -= (time_t)offset * SECS_PER_MINUTE;
|
||||
|
||||
yday = ((__mon_yday[__isleap (src.year)]
|
||||
[src.month-1]) + (src.day-1));
|
||||
*dest += src.second +
|
||||
( SECS_PER_MINUTE *
|
||||
( ( (yday* HOURS_PER_DAY) + src.hour ) * 60 + src.minute ) );
|
||||
*dest += (time_t)src.second + ((time_t)SECS_PER_MINUTE *
|
||||
( ( ((time_t)yday* HOURS_PER_DAY) + src.hour ) * 60 + src.minute ) );
|
||||
|
||||
*dest_usec = src.microseconds
|
||||
+ (src.centiseconds * 10000)
|
||||
|
|
|
@ -37,7 +37,7 @@ int is_fat_32_br(FILE *fp)
|
|||
int i;
|
||||
|
||||
for(i=0 ; i<3 ; i++)
|
||||
if( ! contains_data(fp, 0x1FE + i*0x200, aucRef, sizeof(aucRef)))
|
||||
if( ! contains_data(fp, 0x1FEULL + i * 0x200ULL, aucRef, sizeof(aucRef)))
|
||||
return 0;
|
||||
if( ! contains_data(fp, 0x03, aucMagic, sizeof(aucMagic)))
|
||||
return 0;
|
||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
|||
IDD_DIALOG DIALOGEX 12, 12, 232, 326
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_ACCEPTFILES
|
||||
CAPTION "Rufus 3.9.1606"
|
||||
CAPTION "Rufus 3.9.1607"
|
||||
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
||||
|
@ -394,8 +394,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,9,1606,0
|
||||
PRODUCTVERSION 3,9,1606,0
|
||||
FILEVERSION 3,9,1607,0
|
||||
PRODUCTVERSION 3,9,1607,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -413,13 +413,13 @@ BEGIN
|
|||
VALUE "Comments", "https://rufus.ie"
|
||||
VALUE "CompanyName", "Akeo Consulting"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "3.9.1606"
|
||||
VALUE "FileVersion", "3.9.1607"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
|
||||
VALUE "OriginalFilename", "rufus-3.9.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "3.9.1606"
|
||||
VALUE "ProductVersion", "3.9.1607"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
|
@ -34,7 +34,7 @@ libfat_sector_t libfat_clustertosector(const struct libfat_filesystem *fs,
|
|||
else if (cluster < 2 || cluster >= fs->endcluster)
|
||||
return -1;
|
||||
else
|
||||
return fs->data + ((libfat_sector_t) (cluster - 2) << fs->clustshift);
|
||||
return fs->data + (((libfat_sector_t)cluster - 2) << fs->clustshift);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -66,7 +66,7 @@ libfat_open(int (*readfunc) (intptr_t, void *, size_t, libfat_sector_t),
|
|||
if (!fatsize)
|
||||
fatsize = read32(&bs->u.fat32.bpb_fatsz32);
|
||||
|
||||
fs->rootdir = fs->fat + fatsize * read8(&bs->bsFATs);
|
||||
fs->rootdir = fs->fat + (libfat_sector_t)fatsize * read8(&bs->bsFATs);
|
||||
|
||||
rootdirsize = ((read16(&bs->bsRootDirEnts) << 5) + LIBFAT_SECTOR_MASK)
|
||||
>> LIBFAT_SECTOR_SHIFT;
|
||||
|
|
Loading…
Reference in a new issue