summaryrefslogtreecommitdiffstats
path: root/src/fat.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2009-05-05 13:13:14 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2009-05-05 13:13:14 +0200
commit9d0ddd4ce3471d1f8c15845684df8c19b4876c7c (patch)
treef64678a1ce0a61b7847b980377d3b441704e89e6 /src/fat.c
parent8a36ff31fdfeee2ddbb3004f9157de7c3dbb42e4 (diff)
Limit the scope of several variables
Diffstat (limited to 'src/fat.c')
-rw-r--r--src/fat.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/fat.c b/src/fat.c
index 3732353..b6c09ff 100644
--- a/src/fat.c
+++ b/src/fat.c
@@ -245,14 +245,14 @@ unsigned int get_next_cluster(disk_t *disk_car,const partition_t *partition, con
/* Offset can be offset to FAT1 or to FAT2 */
/* log_trace("get_next_cluster(upart_type=%u,offset=%u,cluster=%u\n",upart_type,offset,cluster); */
unsigned char *buffer;
- unsigned int next_cluster;
- unsigned long int offset_s,offset_o;
const unsigned int buffer_size=(upart_type==UP_FAT12?2*disk_car->sector_size:disk_car->sector_size);
buffer=(unsigned char*)MALLOC(buffer_size);
switch(upart_type)
{
case UP_FAT12:
{
+ unsigned int next_cluster;
+ unsigned long int offset_s,offset_o;
offset_s=(cluster+cluster/2)/disk_car->sector_size;
offset_o=(cluster+cluster/2)%disk_car->sector_size;
if((unsigned)disk_car->pread(disk_car, buffer, 2 * disk_car->sector_size,
@@ -271,6 +271,8 @@ unsigned int get_next_cluster(disk_t *disk_car,const partition_t *partition, con
}
case UP_FAT16:
{
+ unsigned int next_cluster;
+ unsigned long int offset_s,offset_o;
const uint16_t *p16=(const uint16_t*)buffer;
offset_s=cluster/(disk_car->sector_size/2);
offset_o=cluster%(disk_car->sector_size/2);
@@ -287,6 +289,8 @@ unsigned int get_next_cluster(disk_t *disk_car,const partition_t *partition, con
}
case UP_FAT32:
{
+ unsigned int next_cluster;
+ unsigned long int offset_s,offset_o;
const uint32_t *p32=(const uint32_t*)buffer;
offset_s=cluster/(disk_car->sector_size/4);
offset_o=cluster%(disk_car->sector_size/4);