summaryrefslogtreecommitdiffstats
path: root/src/fat_adv.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2009-02-03 09:29:29 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2009-02-03 09:29:29 +0100
commit203df0e3a588f01ebfb60428eb1a5ab258a4969d (patch)
tree022c7facc406d0eea910638c7b41355964ee8549 /src/fat_adv.c
parentc6e94c6adfe071f4510190069638d70d59675f42 (diff)
Fix some compilation warnings
Diffstat (limited to 'src/fat_adv.c')
-rw-r--r--src/fat_adv.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/fat_adv.c b/src/fat_adv.c
index a5cbfd7..9e19138 100644
--- a/src/fat_adv.c
+++ b/src/fat_adv.c
@@ -43,7 +43,6 @@
#include "fat.h"
#include "lang.h"
#include "fnctdsk.h"
-#include "testdisk.h"
#include "intrf.h"
#include "intrfn.h"
#include "dir.h"
@@ -356,7 +355,7 @@ static unsigned int fat32_find_root_cluster(disk_t *disk_car,const partition_t *
ind_stop|=check_enter_key_or_s(stdscr);
}
#endif
- if(disk_car->pread(disk_car, buffer, cluster_size,
+ if((unsigned)disk_car->pread(disk_car, buffer, cluster_size,
partition->part_offset + (start_data + (uint64_t)(root_cluster - 2) * sectors_per_cluster) *
disk_car->sector_size) == cluster_size)
{
@@ -382,7 +381,7 @@ static unsigned int fat32_find_root_cluster(disk_t *disk_car,const partition_t *
dir_list=dir_fat_aux(buffer, cluster_size, cluster_size, 0);
if(verbose>0)
{
- dir_aff_log(disk_car, partition, NULL, dir_list);
+ dir_aff_log(NULL, dir_list);
}
{
file_data_t *new_file=(file_data_t *)MALLOC(sizeof(*new_file));
@@ -476,7 +475,7 @@ static unsigned int fat32_find_root_cluster(disk_t *disk_car,const partition_t *
return new_root_cluster;
}
/* Read the cluster */
- if(disk_car->pread(disk_car, buffer, cluster_size,
+ if((unsigned)disk_car->pread(disk_car, buffer, cluster_size,
partition->part_offset + (start_data + (uint64_t)(tmp - 2) * sectors_per_cluster) * disk_car->sector_size) != cluster_size)
{
log_critical("cluster can't be read\n");
@@ -515,7 +514,7 @@ static unsigned int fat32_find_root_cluster(disk_t *disk_car,const partition_t *
if(verbose>0)
{
log_verbose("Potential root_cluster %lu\n",root_cluster);
- test_date=dir_aff_log(disk_car, partition, NULL, dir_list);
+ test_date=dir_aff_log(NULL, dir_list);
}
#ifdef HAVE_NCURSES
if(interface>0 && interactive>0 && test_date>0)
@@ -553,7 +552,7 @@ static unsigned int fat32_find_root_cluster(disk_t *disk_car,const partition_t *
}
else
{
- dir_aff_log(disk_car, partition, NULL, rootdir_list);
+ dir_aff_log(NULL, rootdir_list);
#ifdef HAVE_NCURSES
if(interface && (expert>0))
{
@@ -654,7 +653,7 @@ static int fat32_create_rootdir(disk_t *disk_car,const partition_t *partition, c
if(++current_entry==(cluster_size/sizeof(struct msdos_dir_entry)))
{
unsigned int next_cluster;
- if(disk_car->pwrite(disk_car, buffer, cluster_size,
+ if((unsigned)disk_car->pwrite(disk_car, buffer, cluster_size,
partition->part_offset + (start_data + (uint64_t)(cluster - 2) * sectors_per_cluster) * disk_car->sector_size) != cluster_size)
{
display_message("Write error: Can't create FAT32 root cluster.\n");
@@ -674,8 +673,7 @@ static int fat32_create_rootdir(disk_t *disk_car,const partition_t *partition, c
cluster=next_cluster;
}
}
- if(disk_car->pwrite(disk_car, buffer, cluster_size, partition->part_offset + (start_data + (uint64_t)(cluster - 2) * sectors_per_cluster) * disk_car->sector_size) != cluster_size
- )
+ if((unsigned)disk_car->pwrite(disk_car, buffer, cluster_size, partition->part_offset + (start_data + (uint64_t)(cluster - 2) * sectors_per_cluster) * disk_car->sector_size) != cluster_size)
{
display_message("Write error: Can't create FAT32 root cluster.\n");
}
@@ -691,7 +689,7 @@ cluster=next_cluster;
{
file_data_t *dir_list;
dir_list=dir_fat_aux(buffer, cluster_size, cluster_size, 0);
- dir_aff_log(disk_car, partition, NULL, dir_list);
+ dir_aff_log(NULL, dir_list);
delete_list_file(dir_list);
}
#endif
@@ -709,7 +707,7 @@ static int find_dir_entries(disk_t *disk_car,const partition_t *partition, const
hd_offset=partition->part_offset+(uint64_t)offset*disk_car->sector_size;
for(i=0; i<200 && i<offset; i++)
{
- if(disk_car->pread(disk_car, buffer, disk_car->sector_size, hd_offset) != disk_car->sector_size)
+ if((unsigned)disk_car->pread(disk_car, buffer, disk_car->sector_size, hd_offset) != disk_car->sector_size)
{
log_error("dir_entries: read error, dir_entries>=%u (%u sectors)\n",i*(disk_car->sector_size/32),i);
}
@@ -764,7 +762,7 @@ static int analyse_dir_entries(disk_t *disk_car,const partition_t *partition, co
hd_offset=partition->part_offset+(uint64_t)offset*disk_car->sector_size;
for(i=0;i<200;i++)
{
- if(disk_car->pread(disk_car, buffer, disk_car->sector_size, hd_offset) != disk_car->sector_size)
+ if((unsigned)disk_car->pread(disk_car, buffer, disk_car->sector_size, hd_offset) != disk_car->sector_size)
{
log_error("dir_entries: read error, dir_entries>=%u (%u sectors)\n",i*(disk_car->sector_size/32),i);
}
@@ -822,7 +820,7 @@ static int analyse_dir_entries2(disk_t *disk_car,const partition_t *partition, c
}
root_dir_size=(root_size_max*32+disk_car->sector_size-1)/disk_car->sector_size*disk_car->sector_size;
buffer_dir=(unsigned char *)MALLOC(root_dir_size);
- if(disk_car->pread(disk_car, buffer_dir, root_dir_size,
+ if((unsigned)disk_car->pread(disk_car, buffer_dir, root_dir_size,
partition->part_offset + (uint64_t)(reserved + fats * fat_length) * disk_car->sector_size) != root_dir_size)
{
log_error("FAT 1x can't read root directory\n");
@@ -837,7 +835,7 @@ static int analyse_dir_entries2(disk_t *disk_car,const partition_t *partition, c
}
if(verbose>1)
{
- dir_aff_log(disk_car, partition, NULL, dir_list);
+ dir_aff_log(NULL, dir_list);
}
for(current_file=dir_list;(current_file!=NULL)&&(LINUX_S_ISDIR(current_file->stat.st_mode)==0);current_file=current_file->next);
if(current_file!=NULL)
@@ -856,7 +854,7 @@ static int analyse_dir_entries2(disk_t *disk_car,const partition_t *partition, c
{
log_verbose("dir_entries %u, sectors_per_cluster %u\n",dir_entries,sectors_per_cluster);
}
- if(disk_car->pread(disk_car, buffer_dir, disk_car->sector_size,
+ if((unsigned)disk_car->pread(disk_car, buffer_dir, disk_car->sector_size,
partition->part_offset + (start_data + (uint64_t)(new_inode - 2) * sectors_per_cluster) * disk_car->sector_size) == disk_car->sector_size)
{
if((memcmp(&buffer_dir[0],". ",8+3)==0)&&(memcmp(&buffer_dir[0x20],".. ",8+3)==0))
@@ -1042,8 +1040,10 @@ static void menu_write_fat_boot_sector(disk_t *disk_car, partition_t *partition,
/* Write boot sector and backup boot sector */
if(upart_type==UP_FAT32)
{
- if(disk_car->pwrite(disk_car, newboot, 3 * disk_car->sector_size, partition->part_offset) != 3 * disk_car->sector_size ||
- disk_car->pwrite(disk_car, newboot, 3 * disk_car->sector_size, partition->part_offset + (uint64_t)le16(fat_header->backup_boot) * disk_car->sector_size) != 3 * disk_car->sector_size)
+ if((unsigned)disk_car->pwrite(disk_car, newboot, 3 * disk_car->sector_size, partition->part_offset) !=
+ 3 * disk_car->sector_size ||
+ (unsigned)disk_car->pwrite(disk_car, newboot, 3 * disk_car->sector_size, partition->part_offset + (uint64_t)le16(fat_header->backup_boot) * disk_car->sector_size) !=
+ 3 * disk_car->sector_size)
err=1;
}
else
@@ -1074,7 +1074,7 @@ static void create_fat_boot_sector(disk_t *disk_car, partition_t *partition, con
newboot=(unsigned char *)MALLOC(3*disk_car->sector_size);
org_fat_header=(struct fat_boot_sector *)orgboot;
fat_header=(struct fat_boot_sector *)newboot;
- if(disk_car->pread(disk_car, orgboot, 3 * disk_car->sector_size, partition->part_offset) != 3 * disk_car->sector_size)
+ if((unsigned)disk_car->pread(disk_car, orgboot, 3 * disk_car->sector_size, partition->part_offset) != 3 * disk_car->sector_size)
{
log_error("create_fat_boot_sector: Can't read old boot sector\n");
memset(orgboot,0,3*disk_car->sector_size);
@@ -1595,7 +1595,7 @@ static int fat_find_type(disk_t *disk_car,const partition_t *partition,const uin
ind_stop|=check_enter_key_or_s(stdscr);
}
#endif
- if(disk_car->pread(disk_car, buffer, disk_car->sector_size, partition->part_offset + offset) == disk_car->sector_size)
+ if((unsigned)disk_car->pread(disk_car, buffer, disk_car->sector_size, partition->part_offset + offset) == disk_car->sector_size)
{
unsigned long int fat_offset=0;
unsigned int fat_type;
@@ -1667,7 +1667,7 @@ static upart_type_t fat_find_info(disk_t *disk_car,unsigned int*reserved, unsign
if(dump_ind>0 && interface>0)
{
unsigned char *buffer=(unsigned char *)MALLOC(disk_car->sector_size);
- if(disk_car->pread(disk_car, &buffer, disk_car->sector_size, end) == disk_car->sector_size)
+ if((unsigned)disk_car->pread(disk_car, &buffer, disk_car->sector_size, end) == disk_car->sector_size)
{
dump_ncurses(buffer,disk_car->sector_size);
}
@@ -1906,7 +1906,7 @@ static int find_sectors_per_cluster(disk_t *disk_car, partition_t *partition, co
ind_stop|=check_enter_key_or_s(stdscr);
}
#endif
- if(disk_car->pread(disk_car, buffer, disk_car->sector_size, partition->part_offset + offset) == disk_car->sector_size)
+ if((unsigned)disk_car->pread(disk_car, buffer, disk_car->sector_size, partition->part_offset + offset) == disk_car->sector_size)
{
if(memcmp(&buffer[0],". ",8+3)==0 && memcmp(&buffer[0x20],".. ",8+3)==0)
{
@@ -2384,7 +2384,7 @@ int FAT_init_rootdir(disk_t *disk_car, partition_t *partition, const int verbose
}
buffer=(unsigned char *)MALLOC(disk_car->sector_size);
fat_header=(struct fat_boot_sector *)buffer;
- if(disk_car->pread(disk_car, buffer, disk_car->sector_size, partition->part_offset) != disk_car->sector_size)
+ if((unsigned)disk_car->pread(disk_car, buffer, disk_car->sector_size, partition->part_offset) != disk_car->sector_size)
{
display_message("FAT_init_rootdir: Can't read boot sector\n");
free(buffer);
@@ -2395,7 +2395,7 @@ int FAT_init_rootdir(disk_t *disk_car, partition_t *partition, const int verbose
start_data=start_rootdir+(get_dir_entries(fat_header)*32+disk_car->sector_size-1)/disk_car->sector_size;
for(sector=start_rootdir;error==0 && sector<start_data;sector++)
{
- if(disk_car->pread(disk_car, buffer, disk_car->sector_size,
+ if((unsigned)disk_car->pread(disk_car, buffer, disk_car->sector_size,
partition->part_offset + (uint64_t)sector * disk_car->sector_size) != disk_car->sector_size)
{
log_error("FAT_init_rootdir: read error at sector %lu\n", sector);
@@ -2426,7 +2426,7 @@ int FAT_init_rootdir(disk_t *disk_car, partition_t *partition, const int verbose
memset(buffer,0,disk_car->sector_size);
for(sector=start_rootdir;sector<start_data;sector++)
{
- if(disk_car->pwrite(disk_car, buffer, disk_car->sector_size,
+ if((unsigned)disk_car->pwrite(disk_car, buffer, disk_car->sector_size,
partition->part_offset + (uint64_t)sector * disk_car->sector_size) != disk_car->sector_size)
{
err=1;
@@ -2469,7 +2469,7 @@ int repair_FAT_table(disk_t *disk_car, partition_t *partition, const int verbose
unsigned char *buffer;
buffer=(unsigned char *)MALLOC(disk_car->sector_size);
fat_header=(struct fat_boot_sector *)buffer;
- if(disk_car->pread(disk_car, buffer, disk_car->sector_size, partition->part_offset) != disk_car->sector_size)
+ if((unsigned)disk_car->pread(disk_car, buffer, disk_car->sector_size, partition->part_offset) != disk_car->sector_size)
{
display_message("repair_FAT_table: Can't read boot sector\n");
return 1;
@@ -2630,7 +2630,7 @@ int repair_FAT_table(disk_t *disk_car, partition_t *partition, const int verbose
{
log_info("repair_FAT_table: correcting FAT%u (sector %lu) using FAT%u\n",fat_nbr+1,
start_fat1+fat_length*fat_nbr+old_offset_s, good_fat_nbr+1);
- if(disk_car->pwrite(disk_car, buffer_fat[good_fat_nbr], rw_size,
+ if((unsigned)disk_car->pwrite(disk_car, buffer_fat[good_fat_nbr], rw_size,
partition->part_offset + (uint64_t)(start_fat1 + fat_length * fat_nbr + old_offset_s) * disk_car->sector_size) != rw_size)
{
display_message("repair_FAT_table: write failed.\n");
@@ -2662,7 +2662,7 @@ int repair_FAT_table(disk_t *disk_car, partition_t *partition, const int verbose
{
log_info("repair_FAT_table: correcting FAT%u (sector %lu)\n",fat_nbr+1,
start_fat1+fat_length*fat_nbr+old_offset_s);
- if(disk_car->pwrite(disk_car, buffer_fat[fat_nbr], rw_size,
+ if((unsigned)disk_car->pwrite(disk_car, buffer_fat[fat_nbr], rw_size,
partition->part_offset + (uint64_t)(start_fat1 + fat_length * fat_nbr + old_offset_s) * disk_car->sector_size) != rw_size)
{
display_message("repair_FAT_table: write failed.\n");
@@ -2702,7 +2702,7 @@ int repair_FAT_table(disk_t *disk_car, partition_t *partition, const int verbose
}
if(allow_write[fat_nbr]==FAT_REPAIR_YES)
{
- if(disk_car->pwrite(disk_car, buffer_fat[fat_nbr], rw_size,
+ if((unsigned)disk_car->pwrite(disk_car, buffer_fat[fat_nbr], rw_size,
partition->part_offset + (uint64_t)(start_fat1 + fat_length * fat_nbr + old_offset_s) * disk_car->sector_size) != rw_size )
{
display_message("repair_FAT_table: write failed.\n");
@@ -2720,7 +2720,7 @@ int repair_FAT_table(disk_t *disk_car, partition_t *partition, const int verbose
{
log_info("repair_FAT_table: read sector %lu (FAT%u)\n",(start_fat1+fat_length*fat_nbr+offset_s),fat_nbr+1);
}
- if(disk_car->pread(disk_car, buffer_fat[fat_nbr], rw_size,
+ if((unsigned)disk_car->pread(disk_car, buffer_fat[fat_nbr], rw_size,
partition->part_offset + (uint64_t)(start_fat1 + fat_length * fat_nbr + offset_s) * disk_car->sector_size) != rw_size)
{
log_error("repair_FAT_table: read error sector %lu\n",(start_fat1+fat_length*fat_nbr+offset_s));
@@ -2874,7 +2874,7 @@ int repair_FAT_table(disk_t *disk_car, partition_t *partition, const int verbose
}
if(allow_write[fat_nbr]==FAT_REPAIR_YES)
{
- if(disk_car->pwrite(disk_car, buffer_fat[good_fat_nbr], rw_size,
+ if((unsigned)disk_car->pwrite(disk_car, buffer_fat[good_fat_nbr], rw_size,
partition->part_offset + (uint64_t)(start_fat1 + fat_length * fat_nbr + old_offset_s) * disk_car->sector_size) != rw_size)
{
display_message("repair_FAT_table: write failed.\n");
@@ -2906,7 +2906,7 @@ int repair_FAT_table(disk_t *disk_car, partition_t *partition, const int verbose
}
if(allow_write[fat_nbr]==FAT_REPAIR_YES)
{
- if(disk_car->pwrite(disk_car, buffer_fat[fat_nbr], rw_size,
+ if((unsigned)disk_car->pwrite(disk_car, buffer_fat[fat_nbr], rw_size,
partition->part_offset + (uint64_t)(start_fat1 + fat_length * fat_nbr + old_offset_s) * disk_car->sector_size) != rw_size)
{
display_message("repair_FAT_table: write failed.\n");
@@ -2946,7 +2946,7 @@ int repair_FAT_table(disk_t *disk_car, partition_t *partition, const int verbose
}
if(allow_write[fat_nbr]==FAT_REPAIR_YES)
{
- if(disk_car->pwrite(disk_car, buffer_fat[fat_nbr], rw_size,
+ if((unsigned)disk_car->pwrite(disk_car, buffer_fat[fat_nbr], rw_size,
partition->part_offset + (uint64_t)(start_fat1 + fat_length * fat_nbr + old_offset_s) * disk_car->sector_size) != rw_size)
{
display_message("repair_FAT_table: write failed.\n");