summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/fatp.c2
-rw-r--r--src/file_cow.c2
-rw-r--r--src/file_fat.c7
-rw-r--r--src/file_fits.c8
-rw-r--r--src/file_jpg.c7
-rw-r--r--src/testdisk.c1
6 files changed, 11 insertions, 16 deletions
diff --git a/src/fatp.c b/src/fatp.c
index 2a9342f..2b0f886 100644
--- a/src/fatp.c
+++ b/src/fatp.c
@@ -41,7 +41,6 @@ static void fat32_remove_used_space(disk_t *disk_car,const partition_t *partitio
static void fat12_remove_used_space(disk_t *disk,const partition_t *partition, alloc_data_t *list_search_space, const unsigned int fat_offset, const unsigned int no_of_cluster, const unsigned int start_data, const unsigned int cluster_size, const unsigned int sector_size)
{
unsigned char *buffer;
- const uint16_t *p16;
unsigned int cluster;
const uint64_t hd_offset=partition->part_offset+(uint64_t)fat_offset*sector_size;
uint64_t start_free=0;
@@ -49,7 +48,6 @@ static void fat12_remove_used_space(disk_t *disk,const partition_t *partition, a
unsigned long int offset_s_prev=0;
log_trace("fat12_remove_used_space\n");
buffer=(unsigned char *)MALLOC(2*sector_size);
- p16=(const uint16_t*)buffer;
del_search_space(list_search_space, partition->part_offset,
partition->part_offset+(uint64_t)(start_data*sector_size)-1);
for(cluster=2; cluster<=no_of_cluster+1; cluster++)
diff --git a/src/file_cow.c b/src/file_cow.c
index 1bc2eba..e057988 100644
--- a/src/file_cow.c
+++ b/src/file_cow.c
@@ -99,7 +99,9 @@ static int header_check_cow(const unsigned char *buffer, const unsigned int buff
}
if(memcmp(buffer, cow_header2, sizeof(cow_header2))==0)
{
+#ifdef DEBUG_COW
const QCowHeader2_t *header=(const QCowHeader2_t*)buffer;
+#endif
reset_file_recovery(file_recovery_new);
file_recovery_new->extension=file_hint_cow.extension;
#ifdef DEBUG_COW
diff --git a/src/file_fat.c b/src/file_fat.c
index 78c4a82..de9f0d2 100644
--- a/src/file_fat.c
+++ b/src/file_fat.c
@@ -60,7 +60,7 @@ static void register_header_check_fat(file_stat_t *file_stat)
static int header_check_fat(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new)
{
const struct fat_boot_sector *fat_header=(const struct fat_boot_sector *)buffer;
- uint64_t start_fat1,start_fat2,start_rootdir,start_data,part_size,end_data;
+ uint64_t start_fat1,start_data,part_size;
unsigned long int no_of_cluster,fat_length,fat_length_calc;
if(!(le16(fat_header->marker)==0xAA55
&& (fat_header->ignored[0]==0xeb || fat_header->ignored[0]==0xe9)
@@ -91,10 +91,8 @@ static int header_check_fat(const unsigned char *buffer, const unsigned int buff
fat_length=le16(fat_header->fat_length)>0?le16(fat_header->fat_length):le32(fat_header->fat32_length);
part_size=(sectors(fat_header)>0?sectors(fat_header):le32(fat_header->total_sect));
start_fat1=le16(fat_header->reserved);
- start_fat2=start_fat1+(fat_header->fats>1?fat_length:0);
start_data=start_fat1+fat_header->fats*fat_length+(get_dir_entries(fat_header)*32+fat_sector_size(fat_header)-1)/fat_sector_size(fat_header);
no_of_cluster=(part_size-start_data)/fat_header->sectors_per_cluster;
- end_data=start_data+no_of_cluster*fat_header->sectors_per_cluster-1;
if(no_of_cluster<4085)
{
/* FAT12 */
@@ -102,7 +100,6 @@ static int header_check_fat(const unsigned char *buffer, const unsigned int buff
return 0;
if((le16(fat_header->fat_length)>256)||(le16(fat_header->fat_length)==0))
return 0;
- start_rootdir=start_fat2+fat_length;
fat_length_calc=((no_of_cluster+2+fat_sector_size(fat_header)*2/3-1)*3/2/fat_sector_size(fat_header));
}
else if(no_of_cluster<65525)
@@ -112,7 +109,6 @@ static int header_check_fat(const unsigned char *buffer, const unsigned int buff
return 0;
if((get_dir_entries(fat_header)==0)||(get_dir_entries(fat_header)%16!=0))
return 0;
- start_rootdir=start_fat2+fat_length;
fat_length_calc=((no_of_cluster+2+fat_sector_size(fat_header)/2-1)*2/fat_sector_size(fat_header));
}
else
@@ -124,7 +120,6 @@ static int header_check_fat(const unsigned char *buffer, const unsigned int buff
return 0;
if((le32(fat_header->root_cluster)<2) ||(le32(fat_header->root_cluster)>=2+no_of_cluster))
return 0;
- start_rootdir=start_data+(uint64_t)(le32(fat_header->root_cluster)-2)*fat_header->sectors_per_cluster;
fat_length_calc=((no_of_cluster+2+fat_sector_size(fat_header)/4-1)*4/fat_sector_size(fat_header));
}
if(fat_length<fat_length_calc)
diff --git a/src/file_fits.c b/src/file_fits.c
index 997000c..71ef8d9 100644
--- a/src/file_fits.c
+++ b/src/file_fits.c
@@ -87,8 +87,6 @@ static int header_check_fits(const unsigned char *buffer, const unsigned int buf
do
{
uint64_t naxis_size=1;
- unsigned int naxis=0;
- naxis_size=1;
/* Header is composed of 80 character fixed-length strings */
for(; i<buffer_size &&
memcmp(&buffer[i], "END ", 4)!=0;
@@ -96,12 +94,12 @@ static int header_check_fits(const unsigned char *buffer, const unsigned int buf
{
if(memcmp(&buffer[i], "NAXIS ",6)==0)
{
- naxis=fits_get_val(&buffer[i]);
+ /* naxis value is dicarded */
+ fits_get_val(&buffer[i]);
}
else if(memcmp(&buffer[i], "NAXIS",5)==0)
{
- uint64_t naxis_val;
- naxis_val=fits_get_val(&buffer[i]);
+ const uint64_t naxis_val=fits_get_val(&buffer[i]);
if(naxis_val>0)
naxis_size*=naxis_val;
}
diff --git a/src/file_jpg.c b/src/file_jpg.c
index f3f5d8f..f6272be 100644
--- a/src/file_jpg.c
+++ b/src/file_jpg.c
@@ -1174,8 +1174,9 @@ static uint64_t jpg_check_structure(file_recovery_t *file_recovery, const unsign
{
unsigned int j=thumb_offset+2;
unsigned int thumb_sos_found=0;
- unsigned int j_old;
- j_old=j;
+#ifdef DEBUG_JPEG
+ unsigned int j_old=j;
+#endif
if(buffer[thumb_offset]!=0xff)
{
file_recovery->offset_error=thumb_offset;
@@ -1239,7 +1240,9 @@ static uint64_t jpg_check_structure(file_recovery_t *file_recovery, const unsign
}
if(file_recovery->offset_ok<j)
file_recovery->offset_ok=j;
+#ifdef DEBUG_JPEG
j_old=j;
+#endif
j+=2+(buffer[j+2]<<8)+buffer[j+3];
}
if(thumb_sos_found>0 && extract_thumb>0
diff --git a/src/testdisk.c b/src/testdisk.c
index 37c23a6..b044c7d 100644
--- a/src/testdisk.c
+++ b/src/testdisk.c
@@ -289,7 +289,6 @@ int main( int argc, char **argv )
for(element_disk=list_disk;element_disk!=NULL;element_disk=element_disk->next)
{
disk_t *disk=element_disk->disk;
- const int hpa_dco=is_hpa_or_dco(disk);
autodetect_arch(disk, NULL);
if(unit==UNIT_DEFAULT)
autoset_unit(disk);