summaryrefslogtreecommitdiffstats
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
parentc6e94c6adfe071f4510190069638d70d59675f42 (diff)
Fix some compilation warnings
-rw-r--r--src/Makefile.am6
-rw-r--r--src/adv.c9
-rw-r--r--src/analyse.c16
-rw-r--r--src/askloc.c6
-rw-r--r--src/bfs.c20
-rw-r--r--src/bfs.h4
-rw-r--r--src/bsd.c1
-rw-r--r--src/chgtype.c7
-rw-r--r--src/chgtypen.c1
-rw-r--r--src/common.c7
-rw-r--r--src/cramfs.c16
-rw-r--r--src/dimage.c18
-rw-r--r--src/dir.c13
-rw-r--r--src/dir.h2
-rw-r--r--src/dirn.c19
-rw-r--r--src/dirpart.c12
-rw-r--r--src/diskcapa.c1
-rw-r--r--src/edit.c2
-rw-r--r--src/ewf.c116
-rw-r--r--src/ext2_dir.c5
-rw-r--r--src/ext2grp.c6
-rw-r--r--src/ext2p.c3
-rw-r--r--src/fat.c93
-rw-r--r--src/fat.h2
-rw-r--r--src/fat32.c8
-rw-r--r--src/fat_adv.c64
-rw-r--r--src/fat_dir.c8
-rw-r--r--src/fatp.c6
-rw-r--r--src/fatx.c20
-rw-r--r--src/fatx.h4
-rw-r--r--src/fidentify.c16
-rw-r--r--src/file_ab.c3
-rw-r--r--src/file_apa.c3
-rw-r--r--src/file_chm.c1
-rw-r--r--src/file_class.c3
-rw-r--r--src/file_dim.c1
-rw-r--r--src/file_ds2.c1
-rw-r--r--src/file_dss.c1
-rw-r--r--src/file_dxf.c4
-rw-r--r--src/file_edb.c3
-rw-r--r--src/file_fcp.c1
-rw-r--r--src/file_fits.c1
-rw-r--r--src/file_ico.c4
-rw-r--r--src/file_ifo.c1
-rw-r--r--src/file_list.c2
-rw-r--r--src/file_mb.c1
-rw-r--r--src/file_mcd.c1
-rw-r--r--src/file_pyc.c3
-rw-r--r--src/file_ses.c3
-rw-r--r--src/file_sp3.c1
-rw-r--r--src/file_tiff.c56
-rw-r--r--src/file_ttf.c6
-rw-r--r--src/file_txt.c1
-rw-r--r--src/file_tz.c3
-rw-r--r--src/file_xv.c3
-rw-r--r--src/fnctdsk.c3
-rw-r--r--src/geometry.c1
-rw-r--r--src/godmode.c11
-rw-r--r--src/hdaccess.c15
-rw-r--r--src/hdaccess.h1
-rw-r--r--src/hdcache.c1
-rw-r--r--src/hdwin32.c1
-rw-r--r--src/hfsp.c8
-rw-r--r--src/hpa_dco.c4
-rw-r--r--src/hpfs.c101
-rw-r--r--src/hpfs.h35
-rw-r--r--src/intrf.c3
-rw-r--r--src/intrface.c2
-rw-r--r--src/intrface.h2
-rw-r--r--src/intrfn.c7
-rw-r--r--src/io_redir.c3
-rw-r--r--src/jfs.c18
-rw-r--r--src/jfs.h2
-rw-r--r--src/luks.c18
-rw-r--r--src/luks.h2
-rw-r--r--src/lvm.c16
-rw-r--r--src/md.c56
-rw-r--r--src/netware.c10
-rw-r--r--src/netware.h2
-rw-r--r--src/ntfs.c26
-rw-r--r--src/ntfs.h6
-rw-r--r--src/ntfs_adv.c23
-rw-r--r--src/ntfs_fix.c14
-rw-r--r--src/ntfs_udl.c6
-rw-r--r--src/ntfs_utl.c2
-rw-r--r--src/ntfsp.c2
-rw-r--r--src/partauto.c3
-rw-r--r--src/partgpt.c18
-rw-r--r--src/partgptn.c20
-rw-r--r--src/parti386.c62
-rw-r--r--src/partmac.c3
-rw-r--r--src/partnone.c16
-rw-r--r--src/partsun.c5
-rw-r--r--src/partxbox.c3
-rw-r--r--src/pbanner.c1
-rw-r--r--src/phcfg.c3
-rw-r--r--src/phmain.c9
-rw-r--r--src/photorec.c38
-rw-r--r--src/phrecn.c19
-rw-r--r--src/ppartsel.c8
-rw-r--r--src/rfs.c32
-rw-r--r--src/savehdr.c1
-rw-r--r--src/sun.c16
-rw-r--r--src/swap.c13
-rw-r--r--src/swap.h4
-rw-r--r--src/sysv.c18
-rw-r--r--src/tbanner.c1
-rw-r--r--src/tdiskop.c1
-rw-r--r--src/tdisksel.c2
-rw-r--r--src/testdisk.c5
-rw-r--r--src/testdisk.h1
-rw-r--r--src/thfs.c2
-rw-r--r--src/thfs.h2
-rw-r--r--src/tload.c10
-rw-r--r--src/tntfs.c6
-rw-r--r--src/tntfs.h2
-rw-r--r--src/ufs.c16
-rw-r--r--src/xfs.c16
118 files changed, 594 insertions, 781 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 1d7090e..f2465f4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -16,11 +16,11 @@ EXTRA_PROGRAMS = fidentify
base_C = common.c crc.c ewf.c fnctdsk.c hdaccess.c hdcache.c hdwin32.c hidden.c hpa_dco.c intrf.c log.c log_part.c misc.c msdos.c parti386.c partgpt.c partmac.c partsun.c partnone.c partxbox.c io_redir.c ntfs_io.c ntfs_utl.c partauto.c sudo.c unicode.c win32.c
base_H = alignio.h common.h crc.h ewf.h fnctdsk.h hdaccess.h hdwin32.h hidden.h guid_cmp.h guid_cpy.h hdcache.h hpa_dco.h intrf.h lang.h log.h log_part.h misc.h types.h io_redir.h msdos.h ntfs_utl.h parti386.h partgpt.h partmac.h partsun.h partxbox.h partauto.h sudo.h unicode.h win32.h
-fs_C = analyse.c bfs.c bsd.c cramfs.c fat.c fatx.c ext2.c jfs.c hfs.c hfsp.c luks.c lvm.c md.c netware.c ntfs.c rfs.c savehdr.c sun.c swap.c sysv.c ufs.c xfs.c
-fs_H = analyse.h bfs.h bsd.h cramfs.h fat.h fatx.h ext2.h jfs_superblock.h jfs.h hfs.h hfsp.h luks.h lvm.h md.h netware.h ntfs.h rfs.h savehdr.h sun.h swap.h sysv.h ufs.h xfs.h
+fs_C = analyse.c bfs.c bsd.c cramfs.c fat.c fatx.c ext2.c jfs.c hfs.c hfsp.c hpfs.c luks.c lvm.c md.c netware.c ntfs.c rfs.c savehdr.c sun.c swap.c sysv.c ufs.c xfs.c
+fs_H = analyse.h bfs.h bsd.h cramfs.h fat.h fatx.h ext2.h jfs_superblock.h jfs.h hfs.h hfsp.h hpfs.h luks.h lvm.h md.h netware.h ntfs.h rfs.h savehdr.h sun.h swap.h sysv.h ufs.h xfs.h
testdisk_ncurses_C = addpart.c adv.c askloc.c chgtype.c chgtypen.c dimage.c dirn.c dirpart.c diskacc.c diskcapa.c edit.c ext2_sb.c ext2_sbn.c fat1x.c fat32.c fat_adv.c fatn.c geometry.c godmode.c hiddenn.c intrface.c intrfn.c nodisk.c ntfs_adv.c ntfs_fix.c ntfs_udl.c parti386n.c partgptn.c partmacn.c partsunn.c partxboxn.c tanalyse.c tbanner.c tdelete.c tdiskop.c tdisksel.c testdisk.c thfs.c tload.c tlog.c tmbrcode.c tntfs.c toptions.c tpartwr.c
-testdisk_ncurses_H = addpart.h adv.h askloc.h chgtype.h chgtypen.h dimage.h dirn.h dirpart.h diskacc.h diskcapa.h edit.h ext2_sb.h ext2_sbn.h fat1x.h fat32.h fat_adv.h fatn.h geometry.h godmode.h hiddenn.h intrface.h intrfn.h nodisk.h ntfs_udl.h partgptn.h parti386n.h partmacn.h partsunn.h partxboxn.h tanalyse.h tdelete.h tdiskop.h tdisksel.h testdisk.h thfs.h tload.h tlog.h tmbrcode.h tntfs.h toptions.h tpartwr.h
+testdisk_ncurses_H = addpart.h adv.h askloc.h chgtype.h chgtypen.h dimage.h dirn.h dirpart.h diskacc.h diskcapa.h edit.h ext2_sb.h ext2_sbn.h fat1x.h fat32.h fat_adv.h fatn.h geometry.h godmode.h hiddenn.h intrface.h intrfn.h nodisk.h ntfs_udl.h partgptn.h parti386n.h partmacn.h partsunn.h partxboxn.h tanalyse.h tdelete.h tdiskop.h tdisksel.h thfs.h tload.h tlog.h tmbrcode.h tntfs.h toptions.h tpartwr.h
testdisk_SOURCES = $(base_C) $(base_H) $(fs_C) $(fs_H) $(testdisk_ncurses_C) $(testdisk_ncurses_H) dir.c dir.h ext2_dir.c ext2_dir.h ext2_inc.h fat_dir.c fat_dir.h ntfs_dir.c ntfs_dir.h ntfs_inc.h rfs_dir.c rfs_dir.h $(ICON_TESTDISK) next.c next.h
diff --git a/src/adv.c b/src/adv.c
index de237c0..3b8de62 100644
--- a/src/adv.c
+++ b/src/adv.c
@@ -41,7 +41,6 @@
#include "fat.h"
#include "ntfs.h"
#include "adv.h"
-#include "analyse.h"
#include "log.h"
#include "log_part.h"
#include "guid_cmp.h"
@@ -180,7 +179,7 @@ void interface_adv(disk_t *disk_car, const int verbose,const int dump_ind, const
#ifdef HAVE_NCURSES
int offset=0;
int current_element_num=0;
- unsigned int old_LINES=LINES;
+ int old_LINES=LINES;
#endif
int rewrite=1;
const char *options;
@@ -444,7 +443,7 @@ void interface_adv(disk_t *disk_car, const int verbose,const int dump_ind, const
}
else if(is_part_ntfs(partition))
{
- ntfs_boot_sector(disk_car, partition, verbose, dump_ind, expert, current_cmd);
+ ntfs_boot_sector(disk_car, partition, verbose, expert, current_cmd);
rewrite=1;
}
else if(partition->upart_type==UP_FAT32)
@@ -459,7 +458,7 @@ void interface_adv(disk_t *disk_car, const int verbose,const int dump_ind, const
}
else if(partition->upart_type==UP_NTFS)
{
- ntfs_boot_sector(disk_car, partition, verbose, dump_ind, expert, current_cmd);
+ ntfs_boot_sector(disk_car, partition, verbose, expert, current_cmd);
rewrite=1;
}
}
@@ -520,7 +519,7 @@ void interface_adv(disk_t *disk_car, const int verbose,const int dump_ind, const
}
if(is_hfs(current_element->part) || is_hfsp(current_element->part))
{
- HFS_HFSP_boot_sector(disk_car, current_element->part, verbose, dump_ind, expert, current_cmd);
+ HFS_HFSP_boot_sector(disk_car, current_element->part, verbose, current_cmd);
}
rewrite=1;
}
diff --git a/src/analyse.c b/src/analyse.c
index 749ae02..152660a 100644
--- a/src/analyse.c
+++ b/src/analyse.c
@@ -24,19 +24,12 @@
#endif
#include <stdio.h>
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "types.h"
#include "common.h"
-#include "fnctdsk.h"
#include "analyse.h"
-#include "intrf.h"
-#include "savehdr.h"
-#include "lang.h"
#include "bfs.h"
#include "bsd.h"
#include "cramfs.h"
@@ -47,6 +40,7 @@
#include "hfsp.h"
#include "jfs_superblock.h"
#include "jfs.h"
+#include "hpfs.h"
#include "luks.h"
#include "lvm.h"
#include "md.h"
@@ -120,15 +114,15 @@ int search_type_0(unsigned char *buffer,disk_t *disk_car,partition_t *partition,
}
if(disk_car->pread(disk_car, buffer, 8 * DEFAULT_SECTOR_SIZE, partition->part_offset) != 8 * DEFAULT_SECTOR_SIZE)
return -1;
- if(recover_Linux_SWAP(disk_car,(const union swap_header *)buffer,partition,verbose,dump_ind)==0) return 1;
+ if(recover_Linux_SWAP((const union swap_header *)buffer, partition)==0) return 1;
if(recover_LVM(disk_car,(const pv_disk_t*)buffer,partition,verbose,dump_ind)==0) return 1;
if(recover_FAT(disk_car,(const struct fat_boot_sector*)buffer,partition,verbose,dump_ind,0)==0) return 1;
- if(recover_HPFS(disk_car,(const struct fat_boot_sector*)buffer,partition,verbose,dump_ind)==0) return 1;
+ if(recover_HPFS(disk_car,(const struct fat_boot_sector*)buffer,partition,verbose)==0) return 1;
if(recover_OS2MB(disk_car,(const struct fat_boot_sector*)buffer,partition,verbose,dump_ind)==0) return 1;
if(recover_NTFS(disk_car,(const struct ntfs_boot_sector*)buffer,partition,verbose,dump_ind,0)==0) return 1;
if(recover_netware(disk_car,(const struct disk_netware *)buffer,partition)==0) return 1;
if(recover_xfs(disk_car,(const struct xfs_sb*)buffer,partition,verbose,dump_ind)==0) return 1;
- if(recover_FATX(disk_car,(const struct disk_fatx*)buffer,partition,verbose,dump_ind)==0) return 1;
+ if(recover_FATX((const struct disk_fatx*)buffer, partition)==0) return 1;
if(recover_LUKS(disk_car,(const struct luks_phdr*)buffer,partition,verbose,dump_ind)==0) return 1;
{ /* MD 1.1 */
const struct mdp_superblock_1 *sb1=(const struct mdp_superblock_1 *)buffer;
@@ -156,7 +150,7 @@ int search_type_1(unsigned char *buffer, disk_t *disk_car,partition_t *partition
if(disk_car->pread(disk_car, buffer, 8 * DEFAULT_SECTOR_SIZE, partition->part_offset) != 8 * DEFAULT_SECTOR_SIZE)
return -1;
if(recover_BSD(disk_car,(const struct disklabel *)(buffer+0x200),partition,verbose,dump_ind)==0) return 1;
- if(recover_BeFS(disk_car,(const struct disk_super_block *)(buffer+0x200),partition,verbose,dump_ind)==0) return 1;
+ if(recover_BeFS(disk_car, (const struct disk_super_block *)(buffer+0x200), partition, dump_ind)==0) return 1;
if(recover_cramfs(disk_car,(const struct cramfs_super*)(buffer+0x200),partition,verbose,dump_ind)==0) return 1;
if(recover_sysv(disk_car,(const struct sysv4_super_block*)(buffer+0x200),partition,verbose,dump_ind)==0) return 1;
if(recover_LVM2(disk_car,(const unsigned char*)(buffer+0x200),partition,verbose,dump_ind)==0) return 1;
diff --git a/src/askloc.c b/src/askloc.c
index e6f584b..9d885b1 100644
--- a/src/askloc.c
+++ b/src/askloc.c
@@ -24,23 +24,18 @@
#endif
#ifdef HAVE_NCURSES
-#include <stdarg.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
-#include <ctype.h>
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
@@ -59,7 +54,6 @@
#include "intrfn.h"
#include "list.h"
#include "dir.h"
-#include "log.h"
#include "askloc.h"
extern const char *monstr[];
diff --git a/src/bfs.c b/src/bfs.c
index 3847f46..1e5d75c 100644
--- a/src/bfs.c
+++ b/src/bfs.c
@@ -34,10 +34,10 @@
#include "fnctdsk.h"
#include "log.h"
-static int set_BeFS_info(disk_t *disk_car, const struct disk_super_block *beos_block,partition_t *partition,const int verbose, const int dump_ind);
-static int test_BeFS(disk_t *disk_car, const struct disk_super_block*beos_block,partition_t *partition,const int verbose, const int dump_ind);
+static int set_BeFS_info(const struct disk_super_block *beos_block, partition_t *partition);
+static int test_BeFS(disk_t *disk_car, const struct disk_super_block*beos_block,partition_t *partition, const int dump_ind);
-int check_BeFS(disk_t *disk_car,partition_t *partition,const int verbose)
+int check_BeFS(disk_t *disk_car,partition_t *partition)
{
unsigned char *buffer;
buffer=(unsigned char*)MALLOC(BFS_SUPERBLOCK_SIZE);
@@ -46,27 +46,27 @@ int check_BeFS(disk_t *disk_car,partition_t *partition,const int verbose)
free(buffer);
return 1;
}
- if(test_BeFS(disk_car,(struct disk_super_block*)buffer,partition,verbose,0)!=0)
+ if(test_BeFS(disk_car,(struct disk_super_block*)buffer,partition,0)!=0)
{
free(buffer);
return 1;
}
- set_BeFS_info(disk_car,(struct disk_super_block*)buffer,partition,verbose,0);
+ set_BeFS_info((struct disk_super_block*)buffer, partition);
free(buffer);
return 0;
}
-int recover_BeFS(disk_t *disk_car, const struct disk_super_block *beos_block,partition_t *partition,const int verbose, const int dump_ind)
+int recover_BeFS(disk_t *disk_car, const struct disk_super_block *beos_block, partition_t *partition, const int dump_ind)
{
- if(test_BeFS(disk_car,beos_block,partition,verbose,dump_ind)!=0)
+ if(test_BeFS(disk_car,beos_block,partition,dump_ind)!=0)
return 1;
- set_BeFS_info(disk_car,beos_block,partition,verbose,0);
+ set_BeFS_info(beos_block, partition);
partition->part_size=le64(beos_block->num_blocks) * (1<<le32(beos_block->block_shift));
partition->part_type_i386=(unsigned char)P_BEOS;
return 0;
}
-static int test_BeFS(disk_t *disk_car, const struct disk_super_block*beos_block,partition_t *partition,const int verbose, const int dump_ind)
+static int test_BeFS(disk_t *disk_car, const struct disk_super_block*beos_block,partition_t *partition, const int dump_ind)
{
if(beos_block->magic1==le32(SUPER_BLOCK_MAGIC1) &&
beos_block->magic2==(signed)le32(SUPER_BLOCK_MAGIC2) &&
@@ -83,7 +83,7 @@ static int test_BeFS(disk_t *disk_car, const struct disk_super_block*beos_block,
return 1;
}
-static int set_BeFS_info(disk_t *disk_car, const struct disk_super_block *beos_block,partition_t *partition,const int verbose, const int dump_ind)
+static int set_BeFS_info(const struct disk_super_block *beos_block, partition_t *partition)
{
partition->info[0]='\0';
set_part_name(partition,beos_block->name,B_OS_NAME_LENGTH);
diff --git a/src/bfs.h b/src/bfs.h
index 7ce5d4c..8d2d734 100644
--- a/src/bfs.h
+++ b/src/bfs.h
@@ -82,8 +82,8 @@ typedef struct disk_super_block /* super block as it is on disk */
/* this is stored in the fs_byte_order field... it's kind of dumb */
#define BFS_BIG_ENDIAN 0x42494745 /* BIGE */
/* int test_beos(struct disk_super_block *,partition_t); */
-int check_BeFS(disk_t *disk_car,partition_t *partition,const int verbose);
-int recover_BeFS(disk_t *disk_car, const struct disk_super_block *beos_block,partition_t *partition,const int verbose, const int dump_ind);
+int check_BeFS(disk_t *disk_car, partition_t *partition);
+int recover_BeFS(disk_t *disk_car, const struct disk_super_block *beos_block, partition_t *partition, const int dump_ind);
#ifdef __cplusplus
} /* closing brace for extern "C" */
diff --git a/src/bsd.c b/src/bsd.c
index c6526f4..c6936b8 100644
--- a/src/bsd.c
+++ b/src/bsd.c
@@ -32,7 +32,6 @@
#include "common.h"
#include "bsd.h"
#include "intrf.h"
-#include "fnctdsk.h"
#include "log.h"
static int test_BSD(disk_t *disk_car, const struct disklabel*bsd_header,partition_t *partition,const int verbose, const int dump_ind, const unsigned int max_partitions);
diff --git a/src/chgtype.c b/src/chgtype.c
index 1097234..a3b85c9 100644
--- a/src/chgtype.c
+++ b/src/chgtype.c
@@ -27,18 +27,11 @@
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
#include "types.h"
#include "common.h"
-#include "lang.h"
-#include "intrf.h"
-#include "fnctdsk.h"
#include "chgtype.h"
#include "log.h"
#include "log_part.h"
-#include "partgpt.h"
extern const arch_fnct_t arch_gpt;
extern const arch_fnct_t arch_none;
diff --git a/src/chgtypen.c b/src/chgtypen.c
index c5b7e1d..ef9e8b3 100644
--- a/src/chgtypen.c
+++ b/src/chgtypen.c
@@ -32,7 +32,6 @@
#endif
#include "types.h"
#include "common.h"
-#include "lang.h"
#include "intrf.h"
#include "intrfn.h"
#include "fnctdsk.h"
diff --git a/src/common.c b/src/common.c
index 0fe3738..f91b08a 100644
--- a/src/common.c
+++ b/src/common.c
@@ -32,23 +32,16 @@
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
-#include <stdarg.h>
#include "types.h"
#include "common.h"
-#include "lang.h"
-#include <ctype.h> /* tolower */
#ifdef HAVE_STRING_H
#include <string.h>
#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
#ifdef __MINGW32__
#ifdef HAVE_IO_H
#include <io.h>
#endif
#endif
-#include "intrf.h"
#include "log.h"
static unsigned int up2power_aux(const unsigned int number);
diff --git a/src/cramfs.c b/src/cramfs.c
index 9ddf309..a78b1e0 100644
--- a/src/cramfs.c
+++ b/src/cramfs.c
@@ -37,8 +37,8 @@
#include "fnctdsk.h"
#include "log.h"
-static int set_cramfs_info(const disk_t *disk_car, const struct cramfs_super *sb,partition_t *partition, const int verbose, const int dump_ind);
-static int test_cramfs(const disk_t *disk_car, const struct cramfs_super *sb,partition_t *partition,const int verbose, const int dump_ind);
+static int set_cramfs_info(const struct cramfs_super *sb, partition_t *partition);
+static int test_cramfs(const disk_t *disk_car, const struct cramfs_super *sb, partition_t *partition, const int verbose);
int check_cramfs(disk_t *disk_car,partition_t *partition,const int verbose)
{
@@ -48,9 +48,9 @@ int check_cramfs(disk_t *disk_car,partition_t *partition,const int verbose)
free(buffer);
return 1;
}
- if(test_cramfs(disk_car,(struct cramfs_super*)buffer,partition,verbose,0)==0)
+ if(test_cramfs(disk_car, (struct cramfs_super*)buffer, partition, verbose)==0)
{
- set_cramfs_info(disk_car,(struct cramfs_super*)buffer,partition,verbose,0);
+ set_cramfs_info((struct cramfs_super*)buffer, partition);
free(buffer);
return 0;
}
@@ -58,7 +58,7 @@ int check_cramfs(disk_t *disk_car,partition_t *partition,const int verbose)
return 1;
}
-static int test_cramfs(const disk_t *disk_car, const struct cramfs_super *sb,partition_t *partition,const int verbose, const int dump_ind)
+static int test_cramfs(const disk_t *disk_car, const struct cramfs_super *sb,partition_t *partition, const int verbose)
{
if (sb->magic==le32(CRAMFS_MAGIC))
{
@@ -73,7 +73,7 @@ static int test_cramfs(const disk_t *disk_car, const struct cramfs_super *sb,par
int recover_cramfs(disk_t *disk_car, const struct cramfs_super *sb,partition_t *partition,const int verbose, const int dump_ind)
{
- if(test_cramfs(disk_car,sb,partition,verbose,dump_ind)!=0)
+ if(test_cramfs(disk_car, sb, partition, verbose)!=0)
return 1;
if(verbose>0 || dump_ind!=0)
{
@@ -88,11 +88,11 @@ int recover_cramfs(disk_t *disk_car, const struct cramfs_super *sb,partition_t *
partition->part_type_mac= PMAC_LINUX;
partition->part_type_sun= PSUN_LINUX;
partition->part_type_gpt= GPT_ENT_TYPE_LINUX_DATA;
- set_cramfs_info(disk_car,sb,partition,verbose,dump_ind);
+ set_cramfs_info(sb, partition);
return 0;
}
-static int set_cramfs_info(const disk_t *disk_car,const struct cramfs_super *sb,partition_t *partition, const int verbose, const int dump_ind)
+static int set_cramfs_info(const struct cramfs_super *sb, partition_t *partition)
{
set_part_name(partition, (const char*)sb->name, 16);
switch(partition->upart_type)
diff --git a/src/dimage.c b/src/dimage.c
index adbf910..d3b9cca 100644
--- a/src/dimage.c
+++ b/src/dimage.c
@@ -27,31 +27,15 @@
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_LOCALE_H
-#include <locale.h> /* setlocale */
-#endif
-#ifdef HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#ifdef HAVE_TIME_H
-#include <time.h>
-#endif
#include <sys/types.h>
-#include <sys/stat.h>
#include <fcntl.h>
#include "types.h"
#include "common.h"
-#include "testdisk.h"
#include "intrf.h"
#include "intrfn.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include "intrface.h"
-#include "fnctdsk.h"
#include "log.h"
#include "dimage.h"
@@ -102,7 +86,7 @@ int disk_image(disk_t *disk_car, const partition_t *partition, const char *image
int update=0;
if(offset_end-offset < READ_SIZE)
readsize=offset_end-offset;
- if(disk_car->pread(disk_car, buffer_disk, readsize, offset) != readsize)
+ if((unsigned)disk_car->pread(disk_car, buffer_disk, readsize, offset) != readsize)
{
update=1;
nbr_read_error++;
diff --git a/src/dir.c b/src/dir.c
index 0d398bc..a9ec4a9 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -44,17 +44,8 @@
#include <io.h>
#endif
#include "common.h"
-#include "fat.h"
-#include "lang.h"
-#include "fnctdsk.h"
-#include "testdisk.h"
-#include "intrf.h"
#include <stdio.h>
#include "dir.h"
-#include "ext2_dir.h"
-#include "fat_dir.h"
-#include "ntfs_dir.h"
-#include "rfs_dir.h"
#include "log.h"
#include "log_part.h"
@@ -161,7 +152,7 @@ void mode_string (const unsigned int mode, char *str)
#endif
}
-int dir_aff_log(const disk_t *disk, const partition_t *partition, const dir_data_t *dir_data, const file_data_t*dir_list)
+int dir_aff_log(const dir_data_t *dir_data, const file_data_t*dir_list)
{
int test_date=0;
const file_data_t *current_file;
@@ -300,7 +291,7 @@ static int dir_whole_partition_log_aux(disk_t *disk, const partition_t *partitio
if(dir_data->verbose>0)
log_info("\ndir_partition inode=%lu\n",inode);
dir_list=dir_data->get_dir(disk, partition, dir_data, inode);
- dir_aff_log(disk, partition, dir_data, dir_list);
+ dir_aff_log(dir_data, dir_list);
/* Not perfect for FAT32 root cluster */
inode_known[dir_nbr++]=inode;
for(current_file=dir_list;current_file!=NULL;current_file=current_file->next)
diff --git a/src/dir.h b/src/dir.h
index 8dcb716..7f62017 100644
--- a/src/dir.h
+++ b/src/dir.h
@@ -75,7 +75,7 @@ typedef struct
unsigned int status;
} file_info_t;
-int dir_aff_log(const disk_t *disk_car, const partition_t *partition, const dir_data_t *dir_data, const file_data_t*dir_list);
+int dir_aff_log(const dir_data_t *dir_data, const file_data_t*dir_list);
int log_list_file(const disk_t *disk_car, const partition_t *partition, const dir_data_t *dir_data, const file_info_t*list);
unsigned int delete_list_file(file_data_t *file_list);
void delete_list_file_info(struct td_list_head *list);
diff --git a/src/dirn.c b/src/dirn.c
index da7e7df..c4af7c0 100644
--- a/src/dirn.c
+++ b/src/dirn.c
@@ -33,26 +33,11 @@
#ifdef HAVE_TIME_H
#include <time.h>
#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
#include "types.h"
-#ifdef HAVE_UTIME_H
-#include <utime.h>
-#endif
-#include <errno.h>
#include "common.h"
-#include "fat.h"
-#include "lang.h"
-#include "fnctdsk.h"
-#include "testdisk.h"
#include "intrf.h"
#include "intrfn.h"
#include "dir.h"
-#include "ext2_dir.h"
-#include "fat_dir.h"
-#include "ntfs_dir.h"
-#include "rfs_dir.h"
#include "log.h"
#include "log_part.h"
#include "dirn.h"
@@ -366,7 +351,7 @@ static int dir_partition_aux(disk_t *disk, const partition_t *partition, dir_dat
/* Not perfect for FAT32 root cluster */
inode_known[depth]=inode;
dir_list=dir_data->get_dir(disk, partition, dir_data, inode);
- dir_aff_log(disk, partition, dir_data, dir_list);
+ dir_aff_log(dir_data, dir_list);
if(*current_cmd!=NULL)
{
dir_data->current_directory[current_directory_namelength]='\0';
@@ -384,7 +369,7 @@ static int dir_partition_aux(disk_t *disk, const partition_t *partition, dir_dat
unsigned int new_inode_ok=1;
unsigned int i;
for(i=0;i<=depth && new_inode_ok!=0;i++)
- if(new_inode==inode_known[i]) /* Avoid loop */
+ if((unsigned)new_inode==inode_known[i]) /* Avoid loop */
new_inode_ok=0;
if(new_inode_ok>0)
{
diff --git a/src/dirpart.c b/src/dirpart.c
index e19b9a3..0318c98 100644
--- a/src/dirpart.c
+++ b/src/dirpart.c
@@ -26,21 +26,9 @@
#ifdef HAVE_STRING_H
#include <string.h>
#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_TIME_H
-#include <time.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
#include "types.h"
#include "common.h"
#include "fat.h"
-#include "lang.h"
-#include "fnctdsk.h"
-#include "testdisk.h"
#include "intrf.h"
#ifdef HAVE_NCURSES
#include "intrfn.h"
diff --git a/src/diskcapa.c b/src/diskcapa.c
index 4b4d2c4..9f8fc8f 100644
--- a/src/diskcapa.c
+++ b/src/diskcapa.c
@@ -25,7 +25,6 @@
#include "types.h"
#include "common.h"
-#include "lang.h"
#include "intrf.h"
#ifdef HAVE_NCURSES
#include "intrfn.h"
diff --git a/src/edit.c b/src/edit.c
index 7026c0d..4ecca70 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -79,7 +79,7 @@ static void interface_editor_ncurses(disk_t *disk_car)
wclrtoeol(stdscr);
wprintw(stdscr,"%lu ", (unsigned long)(hd_offset/disk_car->sector_size));
aff_LBA2CHS(disk_car,hd_offset/disk_car->sector_size);
- 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)
{
wprintw(stdscr,msg_PART_RD_ERR);
}
diff --git a/src/ewf.c b/src/ewf.c
index 361da99..407a6ff 100644
--- a/src/ewf.c
+++ b/src/ewf.c
@@ -55,12 +55,12 @@
#include "log.h"
#include "hdaccess.h"
-static const char *fewf_description(disk_t *disk_car);
-static const char *fewf_description_short(disk_t *disk_car);
-static int fewf_clean(disk_t *disk_car);
-static int fewf_pread(disk_t *disk_car, const unsigned int count, void *nom_buffer, const uint64_t offset);
-static int fewf_nopwrite(disk_t *disk_car, const unsigned int count, const void *nom_buffer, const uint64_t offset);
-static int fewf_sync(disk_t *disk_car);
+static const char *fewf_description(disk_t *disk);
+static const char *fewf_description_short(disk_t *disk);
+static int fewf_clean(disk_t *disk);
+static int fewf_pread(disk_t *disk, void *buffer, const unsigned int count, const uint64_t offset);
+static int fewf_nopwrite(disk_t *disk, const void *buffer, const unsigned int count, const uint64_t offset);
+static int fewf_sync(disk_t *disk);
struct info_fewf_struct
{
@@ -76,7 +76,7 @@ disk_t *fewf_init(const char *device, const int verbose, const arch_fnct_t *arch
{
unsigned int num_files=0;
char **filenames= NULL;
- disk_t *disk_car=NULL;
+ disk_t *disk=NULL;
struct info_fewf_struct *data;
#ifdef HAVE_GLOB_H
glob_t globbuf;
@@ -122,110 +122,110 @@ disk_t *fewf_init(const char *device, const int verbose, const arch_fnct_t *arch
{
log_error("%s Unable to parse EWF header values\n", device);
}
- disk_car=(disk_t *)MALLOC(sizeof(*disk_car));
- init_disk(disk_car);
- disk_car->arch=arch;
- disk_car->device=strdup(device);
- disk_car->data=data;
- disk_car->description=fewf_description;
- disk_car->description_short=fewf_description_short;
- disk_car->pread=fewf_pread;
- disk_car->pwrite=fewf_nopwrite;
- disk_car->sync=fewf_sync;
- disk_car->access_mode=TESTDISK_O_RDONLY;
- disk_car->clean=fewf_clean;
+ disk=(disk_t *)MALLOC(sizeof(*disk));
+ init_disk(disk);
+ disk->arch=arch;
+ disk->device=strdup(device);
+ disk->data=data;
+ disk->description=fewf_description;
+ disk->description_short=fewf_description_short;
+ disk->pread=fewf_pread;
+ disk->pwrite=fewf_nopwrite;
+ disk->sync=fewf_sync;
+ disk->access_mode=TESTDISK_O_RDONLY;
+ disk->clean=fewf_clean;
#ifdef LIBEWF_GET_BYTES_PER_SECTOR_HAVE_TWO_ARGUMENTS
{
uint32_t bytes_per_sector;
if(libewf_get_bytes_per_sector(data->handle, &bytes_per_sector)<0)
- disk_car->sector_size=DEFAULT_SECTOR_SIZE;
+ disk->sector_size=DEFAULT_SECTOR_SIZE;
else
- disk_car->sector_size=bytes_per_sector;
+ disk->sector_size=bytes_per_sector;
}
#else
- disk_car->sector_size=libewf_get_bytes_per_sector(data->handle);
+ disk->sector_size=libewf_get_bytes_per_sector(data->handle);
#endif
-// printf("libewf_get_bytes_per_sector %u\n",disk_car->sector_size);
- if(disk_car->sector_size==0)
- disk_car->sector_size=DEFAULT_SECTOR_SIZE;
+// printf("libewf_get_bytes_per_sector %u\n",disk->sector_size);
+ if(disk->sector_size==0)
+ disk->sector_size=DEFAULT_SECTOR_SIZE;
/* Set geometry */
- disk_car->geom.cylinders=0;
- disk_car->geom.heads_per_cylinder=1;
- disk_car->geom.sectors_per_head=1;
+ disk->geom.cylinders=0;
+ disk->geom.heads_per_cylinder=1;
+ disk->geom.sectors_per_head=1;
/* Get disk_real_size */
#ifdef LIBEWF_GET_MEDIA_SIZE_HAVE_TWO_ARGUMENTS
{
size64_t media_size;
if(libewf_get_media_size(data->handle, &media_size)<0)
- disk_car->disk_real_size=0;
+ disk->disk_real_size=0;
else
- disk_car->disk_real_size=media_size;
+ disk->disk_real_size=media_size;
}
#else
- disk_car->disk_real_size=libewf_get_media_size(data->handle);
+ disk->disk_real_size=libewf_get_media_size(data->handle);
#endif
- update_disk_car_fields(disk_car);
+ update_disk_car_fields(disk);
#ifdef HAVE_GLOB_H
globfree(&globbuf);
#endif
free(filenames);
- return disk_car;
+ return disk;
}
-static const char *fewf_description(disk_t *disk_car)
+static const char *fewf_description(disk_t *disk)
{
- const struct info_fewf_struct *data=(const struct info_fewf_struct *)disk_car->data;
+ const struct info_fewf_struct *data=(const struct info_fewf_struct *)disk->data;
char buffer_disk_size[100];
- snprintf(disk_car->description_txt, sizeof(disk_car->description_txt),"Image %s - %s - CHS %u %u %u%s",
- data->file_name, size_to_unit(disk_car->disk_size,buffer_disk_size),
- disk_car->geom.cylinders, disk_car->geom.heads_per_cylinder, disk_car->geom.sectors_per_head,
+ snprintf(disk->description_txt, sizeof(disk->description_txt),"Image %s - %s - CHS %u %u %u%s",
+ data->file_name, size_to_unit(disk->disk_size,buffer_disk_size),
+ disk->geom.cylinders, disk->geom.heads_per_cylinder, disk->geom.sectors_per_head,
((data->mode&O_RDWR)==O_RDWR?"":" (RO)"));
- return disk_car->description_txt;
+ return disk->description_txt;
}
-static const char *fewf_description_short(disk_t *disk_car)
+static const char *fewf_description_short(disk_t *disk)
{
- const struct info_fewf_struct *data=(const struct info_fewf_struct *)disk_car->data;
+ const struct info_fewf_struct *data=(const struct info_fewf_struct *)disk->data;
char buffer_disk_size[100];
- snprintf(disk_car->description_short_txt, sizeof(disk_car->description_txt),"Image %s - %s%s",
- data->file_name, size_to_unit(disk_car->disk_size,buffer_disk_size),
+ snprintf(disk->description_short_txt, sizeof(disk->description_txt),"Image %s - %s%s",
+ data->file_name, size_to_unit(disk->disk_size,buffer_disk_size),
((data->mode&O_RDWR)==O_RDWR?"":" (RO)"));
- return disk_car->description_short_txt;
+ return disk->description_short_txt;
}
-static int fewf_clean(disk_t *disk_car)
+static int fewf_clean(disk_t *disk)
{
- if(disk_car->data!=NULL)
+ if(disk->data!=NULL)
{
- struct info_fewf_struct *data=(struct info_fewf_struct *)disk_car->data;
+ struct info_fewf_struct *data=(struct info_fewf_struct *)disk->data;
libewf_close(data->handle);
if(data->buffer!=NULL)
{
free(data->buffer);
data->buffer=NULL;
}
- free(disk_car->data);
- disk_car->data=NULL;
+ free(disk->data);
+ disk->data=NULL;
}
return 0;
}
-static int fewf_sync(disk_t *disk_car)
+static int fewf_sync(disk_t *disk)
{
errno=EINVAL;
return -1;
}
-static int fewf_pread(disk_t *disk_car,const unsigned int count, void *nom_buffer, const uint64_t offset)
+static int fewf_pread(disk_t *disk, void *buffer, const unsigned int count, const uint64_t offset)
{
- struct info_fewf_struct *data=(struct info_fewf_struct *)disk_car->data;
+ struct info_fewf_struct *data=(struct info_fewf_struct *)disk->data;
int64_t taille;
- taille=libewf_read_random(data->handle, nom_buffer, count, offset);
+ taille=libewf_read_random(data->handle, buffer, count, offset);
if(taille!=count)
{
log_error("fewf_pread(xxx,%u,buffer,%lu(%u/%u/%u)) read err: ",
- (unsigned)(count/disk_car->sector_size), (long unsigned)(offset/disk_car->sector_size),
- offset2cylinder(disk_car,offset), offset2head(disk_car,offset), offset2sector(disk_car,offset));
+ (unsigned)(count/disk->sector_size), (long unsigned)(offset/disk->sector_size),
+ offset2cylinder(disk,offset), offset2head(disk,offset), offset2sector(disk,offset));
if(taille<0)
log_error("%s\n", strerror(errno));
else if(taille==0)
@@ -238,11 +238,11 @@ static int fewf_pread(disk_t *disk_car,const unsigned int count, void *nom_buffe
return taille;
}
-static int fewf_nopwrite(disk_t *disk_car,const unsigned int count, const void *nom_buffer, const uint64_t offset)
+static int fewf_nopwrite(disk_t *disk, const void *buffer, const unsigned int count, const uint64_t offset)
{
log_error("fewf_nopwrite(xx,%u,buffer,%lu(%u/%u/%u)) write refused\n",
- (unsigned)(count/disk_car->sector_size), (long unsigned)(offset/disk_car->sector_size),
- offset2cylinder(disk_car,offset), offset2head(disk_car,offset), offset2sector(disk_car,offset));
+ (unsigned)(count/disk->sector_size), (long unsigned)(offset/disk->sector_size),
+ offset2cylinder(disk,offset), offset2head(disk,offset), offset2sector(disk,offset));
return -1;
}
diff --git a/src/ext2_dir.c b/src/ext2_dir.c
index 3dadcca..bf50ef6 100644
--- a/src/ext2_dir.c
+++ b/src/ext2_dir.c
@@ -30,9 +30,6 @@
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
#ifdef HAVE_EXT2FS_EXT2_FS_H
#include "ext2fs/ext2_fs.h"
@@ -159,7 +156,7 @@ static errcode_t my_set_blksize(io_channel channel, int blksize)
static errcode_t my_read_blk(io_channel channel, unsigned long block, int count, void *buf)
{
- size_t size;
+ ssize_t size;
my_data_t *my_data=(my_data_t*)channel->private_data;
EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
diff --git a/src/ext2grp.c b/src/ext2grp.c
index 4e40bbd..25c69ce 100644
--- a/src/ext2grp.c
+++ b/src/ext2grp.c
@@ -26,20 +26,14 @@
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
#include "types.h"
#include "common.h"
#include "list.h"
#include "filegen.h"
-#include "intrf.h"
-#include "intrfn.h"
#include "dir.h"
#include "ext2grp.h"
#include "ext2.h"
#include "log.h"
-#include "phrecn.h"
#include "photorec.h"
unsigned int ext2_fix_group(alloc_data_t *list_search_space, disk_t *disk, partition_t *partition)
diff --git a/src/ext2p.c b/src/ext2p.c
index 80fe951..eab28f7 100644
--- a/src/ext2p.c
+++ b/src/ext2p.c
@@ -26,9 +26,6 @@
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
#include "types.h"
#include "common.h"
#include "list.h"
diff --git a/src/fat.c b/src/fat.c
index 0cac0f1..3732353 100644
--- a/src/fat.c
+++ b/src/fat.c
@@ -40,18 +40,16 @@
#include "fat.h"
#include "lang.h"
#include "fnctdsk.h"
-#include "testdisk.h"
#include "intrf.h"
#include "log.h"
#include "log_part.h"
extern const arch_fnct_t arch_i386;
extern const arch_fnct_t arch_mac;
-static int set_FAT_info(disk_t *disk_car, const struct fat_boot_sector *fat_header, partition_t *partition,const int verbose);
+static int set_FAT_info(disk_t *disk_car, const struct fat_boot_sector *fat_header, partition_t *partition);
static void fat_set_part_name(partition_t *partition,const unsigned char *src,const int max_size);
static int fat32_set_part_name(disk_t *disk_car, partition_t *partition, const struct fat_boot_sector*fat_header);
static int log_fat_info(const struct fat_boot_sector*fh1, const upart_type_t upart_type, const unsigned int sector_size);
-static int test_HPFS(disk_t *disk_car,const struct fat_boot_sector *fat_header, partition_t *partition,const int verbose, const int dump_ind);
static int test_OS2MB(disk_t *disk_car,const struct fat_boot_sector *fat_header, partition_t *partition,const int verbose, const int dump_ind);
static int is_fat12(const partition_t *partition);
static int is_fat16(const partition_t *partition);
@@ -183,7 +181,7 @@ int check_FAT(disk_t *disk_car,partition_t *partition,const int verbose)
{
unsigned char *buffer;
buffer=(unsigned char *)MALLOC(3*disk_car->sector_size);
- if(disk_car->pread(disk_car, buffer, 3 * disk_car->sector_size, partition->part_offset) != 3 * disk_car->sector_size)
+ if((unsigned)disk_car->pread(disk_car, buffer, 3 * disk_car->sector_size, partition->part_offset) != 3 * disk_car->sector_size)
{
screen_buffer_add("check_FAT: can't read FAT boot sector\n");
log_error("check_FAT: can't read FAT boot sector\n");
@@ -201,13 +199,13 @@ int check_FAT(disk_t *disk_car,partition_t *partition,const int verbose)
free(buffer);
return 1;
}
- set_FAT_info(disk_car,(const struct fat_boot_sector *)buffer,partition,verbose);
+ set_FAT_info(disk_car,(const struct fat_boot_sector *)buffer,partition);
/* screen_buffer_add("Ok\n"); */
free(buffer);
return 0;
}
-static int set_FAT_info(disk_t *disk_car, const struct fat_boot_sector *fat_header, partition_t *partition,const int verbose)
+static int set_FAT_info(disk_t *disk_car, const struct fat_boot_sector *fat_header, partition_t *partition)
{
const char*buffer=(const char*)fat_header;
partition->fsname[0]='\0';
@@ -257,7 +255,7 @@ unsigned int get_next_cluster(disk_t *disk_car,const partition_t *partition, con
{
offset_s=(cluster+cluster/2)/disk_car->sector_size;
offset_o=(cluster+cluster/2)%disk_car->sector_size;
- if(disk_car->pread(disk_car, buffer, 2 * disk_car->sector_size,
+ if((unsigned)disk_car->pread(disk_car, buffer, 2 * disk_car->sector_size,
partition->part_offset + (uint64_t)(offset + offset_s) * disk_car->sector_size) != 2 * disk_car->sector_size)
{
log_error("get_next_cluster read error\n");
@@ -276,7 +274,7 @@ unsigned int get_next_cluster(disk_t *disk_car,const partition_t *partition, con
const uint16_t *p16=(const uint16_t*)buffer;
offset_s=cluster/(disk_car->sector_size/2);
offset_o=cluster%(disk_car->sector_size/2);
- 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)(offset + offset_s) * disk_car->sector_size) != disk_car->sector_size)
{
log_error("get_next_cluster read error\n");
@@ -292,7 +290,7 @@ unsigned int get_next_cluster(disk_t *disk_car,const partition_t *partition, con
const uint32_t *p32=(const uint32_t*)buffer;
offset_s=cluster/(disk_car->sector_size/4);
offset_o=cluster%(disk_car->sector_size/4);
- 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)(offset + offset_s) * disk_car->sector_size) != disk_car->sector_size)
{
log_error("get_next_cluster read error\n");
@@ -342,7 +340,7 @@ int set_next_cluster(disk_t *disk_car,const partition_t *partition, const upart_
free(buffer);
return 1;
}
- if(disk_car->pread(disk_car, buffer, buffer_size,
+ if((unsigned)disk_car->pread(disk_car, buffer, buffer_size,
partition->part_offset + (uint64_t)(offset + offset_s) * disk_car->sector_size) != buffer_size)
{
log_error("set_next_cluster read error\n");
@@ -377,7 +375,7 @@ int set_next_cluster(disk_t *disk_car,const partition_t *partition, const upart_
default: /* Avoid compiler warning */
break;
}
- if(disk_car->pwrite(disk_car, buffer, buffer_size, partition->part_offset + (uint64_t)(offset + offset_s) * disk_car->sector_size) != buffer_size)
+ if((unsigned)disk_car->pwrite(disk_car, buffer, buffer_size, partition->part_offset + (uint64_t)(offset + offset_s) * disk_car->sector_size) != buffer_size)
{
log_error("Write error: set_next_cluster write error\n");
free(buffer);
@@ -401,7 +399,7 @@ unsigned int fat32_get_prev_cluster(disk_t *disk_car,const partition_t *partitio
offset_o=prev_cluster%(disk_car->sector_size/4);
if((offset_o==0)||(prev_cluster==2))
{
- 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("fat32_get_prev_cluster error\n"); return 0;
}
@@ -700,14 +698,14 @@ int comp_FAT(disk_t *disk, const partition_t *partition, const unsigned long int
{
const unsigned int read_size=(reste > 16 * disk->sector_size ? 16 * disk->sector_size :reste);
reste-=read_size;
- if(disk->pread(disk, buffer, read_size, hd_offset) != read_size)
+ if((unsigned)disk->pread(disk, buffer, read_size, hd_offset) != read_size)
{
log_error("comp_FAT: can't read FAT1\n");
free(buffer2);
free(buffer);
return 1;
}
- if(disk->pread(disk, buffer2, read_size, hd_offset2) != read_size)
+ if((unsigned)disk->pread(disk, buffer2, read_size, hd_offset2) != read_size)
{
log_error("comp_FAT: can't read FAT2\n");
free(buffer2);
@@ -761,7 +759,7 @@ int recover_FAT(disk_t *disk_car, const struct fat_boot_sector*fat_header, parti
partition->sborg_offset=0;
partition->sb_size=512;
partition->sb_offset=0;
- set_FAT_info(disk_car,fat_header,partition,verbose);
+ set_FAT_info(disk_car, fat_header, partition);
switch(partition->upart_type)
{
case UP_FAT12:
@@ -827,7 +825,7 @@ static int fat32_set_part_name(disk_t *disk_car, partition_t *partition, const s
if((fat_header->sectors_per_cluster>0)&&(fat_header->sectors_per_cluster<=128))
{
unsigned char *buffer=(unsigned char*)MALLOC(fat_header->sectors_per_cluster*disk_car->sector_size);
- if(disk_car->pread(disk_car, buffer,
+ if((unsigned)disk_car->pread(disk_car, buffer,
fat_header->sectors_per_cluster * disk_car->sector_size,
partition->part_offset + (le16(fat_header->reserved) + fat_header->fats * le32(fat_header->fat32_length) + (uint64_t)(le32(fat_header->root_cluster) - 2) * fat_header->sectors_per_cluster) * disk_car->sector_size) != fat_header->sectors_per_cluster * disk_car->sector_size)
{
@@ -863,69 +861,10 @@ static int fat32_set_part_name(disk_t *disk_car, partition_t *partition, const s
return 0;
}
-int check_HPFS(disk_t *disk_car,partition_t *partition,const int verbose)
-{
- unsigned char buffer[512];
- if(disk_car->pread(disk_car, &buffer, disk_car->sector_size, partition->part_offset) != disk_car->sector_size)
- {
- screen_buffer_add("check_HPFS: Read error\n");
- log_error("check_HPFS: Read error\n");
- return 1;
- }
- if(test_HPFS(disk_car,(const struct fat_boot_sector *)buffer,partition,verbose,0)!=0)
- {
- if(verbose>0)
- {
- log_info("\n\ntest_HPFS()\n");
- log_partition(disk_car,partition);
- }
- return 1;
- }
- return 0;
-}
-
-static int test_HPFS(disk_t *disk_car,const struct fat_boot_sector *fat_header, partition_t *partition,const int verbose, const int dump_ind)
-{
- const char*buffer=(const char*)fat_header;
- if(le16(fat_header->marker)==0xAA55)
- {
- if(memcmp(buffer+OS2_NAME,"IBM",3)==0)
- { /* D'apres une analyse de OS2 sur systeme FAT...
- FAT_NAME1=FAT
- */
- if(verbose||dump_ind)
- {
- log_info("\nHPFS maybe at %u/%u/%u\n",
- offset2cylinder(disk_car,partition->part_offset),
- offset2head(disk_car,partition->part_offset),
- offset2sector(disk_car,partition->part_offset));
- }
- if(dump_ind!=0)
- dump_log(buffer, DEFAULT_SECTOR_SIZE);
- partition->part_size=(uint64_t)(sectors(fat_header)>0?sectors(fat_header):le32(fat_header->total_sect)) *
- fat_sector_size(fat_header);
- partition->upart_type=UP_HPFS;
- return 0;
- }
- } /* fin marqueur de fin :)) */
- return 1;
-}
-
-int recover_HPFS(disk_t *disk_car,const struct fat_boot_sector*fat_header, partition_t *partition, const int verbose, const int dump_ind)
-{
- if(test_HPFS(disk_car,fat_header,partition,verbose,0)!=0)
- return 1;
- partition->part_type_i386=P_HPFS;
- partition->part_type_gpt=GPT_ENT_TYPE_MAC_HFS;
- partition->fsname[0]='\0';
- partition->info[0]='\0';
- return 0;
-}
-
int check_OS2MB(disk_t *disk_car,partition_t *partition,const int verbose)
{
unsigned char buffer[0x200];
- 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)
{
screen_buffer_add("check_OS2MB: Read error\n");
log_error("check_OS2MB: Read error\n");
@@ -1094,7 +1033,7 @@ int fat32_free_info(disk_t *disk_car,const partition_t *partition, const unsigne
offset_o=prev_cluster%(disk_car->sector_size/4);
if((offset_o==0)||(prev_cluster==2))
{
- 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("fat32_free_info read error\n");
*next_free=0xFFFFFFFF;
diff --git a/src/fat.h b/src/fat.h
index df939c1..f4827e6 100644
--- a/src/fat.h
+++ b/src/fat.h
@@ -148,8 +148,6 @@ unsigned long int fat32_get_next_free(const unsigned char *boot_fat32, const uns
int recover_FAT(disk_t *disk_car,const struct fat_boot_sector*fat_header, partition_t *partition, const int verbose, const int dump_ind, const int backup);
int check_FAT(disk_t *disk_car,partition_t *partition, const int verbose);
int test_FAT(disk_t *disk_car,const struct fat_boot_sector *fat_header, partition_t *partition,const int verbose, const int dump_ind);
-int recover_HPFS(disk_t *disk_car, const struct fat_boot_sector*fat_header, partition_t *partition, const int verbose, const int dump_ind);
-int check_HPFS(disk_t *disk_car,partition_t *partition, const int verbose);
int recover_OS2MB(disk_t *disk_car, const struct fat_boot_sector*fat_header, partition_t *partition, const int verbose, const int dump_ind);
int check_OS2MB(disk_t *disk_car,partition_t *partition, const int verbose);
int check_VFAT_volume_name(const char *name, const unsigned int max_size);
diff --git a/src/fat32.c b/src/fat32.c
index 0f23b10..951ff52 100644
--- a/src/fat32.c
+++ b/src/fat32.c
@@ -119,7 +119,7 @@ int fat32_boot_sector(disk_t *disk_car, partition_t *partition, const int verbos
log_info("\nfat32_boot_sector\n");
log_partition(disk_car,partition);
screen_buffer_add("Boot sector\n");
- if(disk_car->pread(disk_car, buffer_bs, 3 * disk_car->sector_size, partition->part_offset) != 3 * disk_car->sector_size)
+ if((unsigned)disk_car->pread(disk_car, buffer_bs, 3 * disk_car->sector_size, partition->part_offset) != 3 * disk_car->sector_size)
{
screen_buffer_add("fat32_boot_sector: Can't read boot sector.\n");
memset(buffer_bs,0,3*disk_car->sector_size);
@@ -142,7 +142,7 @@ int fat32_boot_sector(disk_t *disk_car, partition_t *partition, const int verbos
screen_buffer_add("Bad\n");
}
screen_buffer_add("\nBackup boot sector\n");
- if(disk_car->pread(disk_car, buffer_backup_bs, 3 * disk_car->sector_size, partition->part_offset + 6 * disk_car->sector_size) != 3 * disk_car->sector_size)
+ if((unsigned)disk_car->pread(disk_car, buffer_backup_bs, 3 * disk_car->sector_size, partition->part_offset + 6 * disk_car->sector_size) != 3 * disk_car->sector_size)
{
screen_buffer_add("fat32_boot_sector: Can't read backup boot sector.\n");
memset(buffer_backup_bs,0,3*disk_car->sector_size);
@@ -268,7 +268,7 @@ int fat32_boot_sector(disk_t *disk_car, partition_t *partition, const int verbos
if(ask_confirmation("Copy original FAT32 boot sector over backup boot, confirm ? (Y/N)")!=0)
{
log_info("copy original boot sector over backup boot\n");
- if(disk_car->pwrite(disk_car, buffer_bs, 3 * disk_car->sector_size, partition->part_offset + 6 * disk_car->sector_size) != 3 * disk_car->sector_size)
+ if((unsigned)disk_car->pwrite(disk_car, buffer_bs, 3 * disk_car->sector_size, partition->part_offset + 6 * disk_car->sector_size) != 3 * disk_car->sector_size)
{
display_message("Write error: Can't overwrite FAT32 backup boot sector\n");
}
@@ -282,7 +282,7 @@ int fat32_boot_sector(disk_t *disk_car, partition_t *partition, const int verbos
if(ask_confirmation("Copy backup FAT32 boot sector over boot sector, confirm ? (Y/N)")!=0)
{
log_info("copy backup boot sector over boot sector\n");
- if(disk_car->pwrite(disk_car, buffer_backup_bs, 3 * disk_car->sector_size, partition->part_offset) != 3 * disk_car->sector_size)
+ if((unsigned)disk_car->pwrite(disk_car, buffer_backup_bs, 3 * disk_car->sector_size, partition->part_offset) != 3 * disk_car->sector_size)
{
display_message("Write error: Can't overwrite FAT32 boot sector\n");
}
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");
diff --git a/src/fat_dir.c b/src/fat_dir.c
index 06ae3ac..b0f3ad9 100644
--- a/src/fat_dir.c
+++ b/src/fat_dir.c
@@ -41,8 +41,6 @@
#include "common.h"
#include "fat.h"
#include "lang.h"
-#include "fnctdsk.h"
-#include "testdisk.h"
#include "intrf.h"
#include "dir.h"
#include "fat_dir.h"
@@ -380,7 +378,7 @@ static file_data_t *fat_dir(disk_t *disk_car, const partition_t *partition, dir_
{
log_info("FAT: cluster=%u(0x%x), pos=%lu\n",cluster,cluster,(long unsigned)(start/fat_sector_size(fat_header)));
}
- if(disk_car->pread(disk_car, buffer_dir + (uint64_t)cluster_size * nbr_cluster, cluster_size, start) != cluster_size)
+ if((unsigned)disk_car->pread(disk_car, buffer_dir + (uint64_t)cluster_size * nbr_cluster, cluster_size, start) != cluster_size)
{
log_error("FAT: Can't read directory cluster.\n");
stop=1;
@@ -446,7 +444,7 @@ static file_data_t *fat1x_rootdir(disk_t *disk_car, const partition_t *partition
unsigned char *buffer_dir;
buffer_dir=(unsigned char*)MALLOC(root_size);
start=partition->part_offset+(uint64_t)((le16(fat_header->reserved)+fat_header->fats*le16(fat_header->fat_length))*disk_car->sector_size);
- if(disk_car->pread(disk_car, buffer_dir, root_size, start) != root_size)
+ if((unsigned)disk_car->pread(disk_car, buffer_dir, root_size, start) != root_size)
{
log_error("FAT 1x: Can't read root directory.\n");
/* Don't return yet, it may have been a partial read */
@@ -555,7 +553,7 @@ static int fat_copy(disk_t *disk_car, const partition_t *partition, dir_data_t *
unsigned int toread = block_size;
if (toread > file_size)
toread = file_size;
- if(disk_car->pread(disk_car, buffer_file, toread, start) != toread)
+ if((unsigned)disk_car->pread(disk_car, buffer_file, toread, start) != toread)
{
log_error("fat_copy: Can't read cluster %u.\n", cluster);
}
diff --git a/src/fatp.c b/src/fatp.c
index 32f627c..615d8e4 100644
--- a/src/fatp.c
+++ b/src/fatp.c
@@ -57,7 +57,7 @@ static void fat16_remove_used_space(disk_t *disk_car,const partition_t *partitio
offset_o=prev_cluster%(sector_size/2);
if((offset_o==0)||(prev_cluster==2))
{
- if(disk_car->pread(disk_car, buffer, sector_size, hd_offset) != sector_size)
+ if((unsigned)disk_car->pread(disk_car, buffer, sector_size, hd_offset) != sector_size)
{
/* Consider these FAT sectors points to free clusters */
}
@@ -100,7 +100,7 @@ static void fat32_remove_used_space(disk_t *disk_car,const partition_t *partitio
offset_o=prev_cluster%(sector_size/4);
if((offset_o==0)||(prev_cluster==2))
{
- if(disk_car->pread(disk_car, buffer, sector_size, hd_offset) != sector_size)
+ if((unsigned)disk_car->pread(disk_car, buffer, sector_size, hd_offset) != sector_size)
{
/* Consider these FAT sectors points to free clusters */
}
@@ -139,7 +139,7 @@ unsigned int fat_remove_used_space(disk_t *disk_car, const partition_t *partitio
const struct fat_boot_sector *fat_header;
buffer=(unsigned char *)MALLOC(3*disk_car->sector_size);
fat_header=(const struct fat_boot_sector *)buffer;
- if(disk_car->pread(disk_car, buffer, 3 * disk_car->sector_size, partition->part_offset) != 3 * disk_car->sector_size)
+ if((unsigned)disk_car->pread(disk_car, buffer, 3 * disk_car->sector_size, partition->part_offset) != 3 * disk_car->sector_size)
{
free(buffer);
return 0;
diff --git a/src/fatx.c b/src/fatx.c
index cb6fe55..526c155 100644
--- a/src/fatx.c
+++ b/src/fatx.c
@@ -29,10 +29,10 @@
#include "types.h"
#include "common.h"
#include "fatx.h"
-static void set_FATX_info(disk_t *disk_car, const struct disk_fatx *fatx_block,partition_t *partition);
-static int test_fatx(disk_t *disk_car, const struct disk_fatx *fatx_block,partition_t *partition,const int verbose, const int dump_ind);
+static void set_FATX_info(partition_t *partition);
+static int test_fatx(const struct disk_fatx *fatx_block, partition_t *partition);
-static int test_fatx(disk_t *disk_car, const struct disk_fatx *fatx_block,partition_t *partition,const int verbose, const int dump_ind)
+static int test_fatx(const struct disk_fatx *fatx_block, partition_t *partition)
{
if(memcmp(fatx_block->magic,"FATX",4)==0)
{
@@ -42,29 +42,29 @@ static int test_fatx(disk_t *disk_car, const struct disk_fatx *fatx_block,partit
return 1;
}
-int check_FATX(disk_t *disk_car,partition_t *partition,const int verbose)
+int check_FATX(disk_t *disk_car,partition_t *partition)
{
unsigned char buffer[8*DEFAULT_SECTOR_SIZE];
if(disk_car->pread(disk_car, &buffer, sizeof(buffer), partition->part_offset) != sizeof(buffer))
{ return 1; }
- if(test_fatx(disk_car,(const struct disk_fatx *)&buffer,partition,verbose,0)!=0)
+ if(test_fatx((const struct disk_fatx *)&buffer, partition)!=0)
return 1;
- set_FATX_info(disk_car,(const struct disk_fatx *)&buffer,partition);
+ set_FATX_info(partition);
return 0;
}
-int recover_FATX(disk_t *disk_car, const struct disk_fatx *fatx_block,partition_t *partition, const int verbose, const int dump_ind)
+int recover_FATX(const struct disk_fatx *fatx_block, partition_t *partition)
{
- if(test_fatx(disk_car,fatx_block,partition,0,0)!=0)
+ if(test_fatx(fatx_block, partition)!=0)
return 1;
- set_FATX_info(disk_car,fatx_block,partition);
+ set_FATX_info(partition);
partition->part_type_xbox=PXBOX_FATX;
/* FIXME: Locate the partition but cannot get the part_size unfortunatly */
partition->part_size=(uint64_t)le32(fatx_block->cluster_size_in_sector)*512;
return 0;
}
-static void set_FATX_info(disk_t *disk_car, const struct disk_fatx *fatx_block,partition_t *partition)
+static void set_FATX_info(partition_t *partition)
{
partition->fsname[0]='\0';
strncpy(partition->info,"FATX",sizeof(partition->info));
diff --git a/src/fatx.h b/src/fatx.h
index 9287b44..379a264 100644
--- a/src/fatx.h
+++ b/src/fatx.h
@@ -32,8 +32,8 @@ struct disk_fatx
uint32_t unknown;
} __attribute__ ((__packed__));
-int check_FATX(disk_t *disk_car,partition_t *partition,const int verbose);
-int recover_FATX(disk_t *disk_car, const struct disk_fatx *fatx_block, partition_t *partition, const int verbose, const int dump_ind);
+int check_FATX(disk_t *disk_car, partition_t *partition);
+int recover_FATX(const struct disk_fatx *fatx_block, partition_t *partition);
#ifdef __cplusplus
} /* closing brace for extern "C" */
diff --git a/src/fidentify.c b/src/fidentify.c
index 2fe0310..aa68042 100644
--- a/src/fidentify.c
+++ b/src/fidentify.c
@@ -153,6 +153,22 @@ int main(int argc, char **argv)
FILE *log_handle=NULL;
file_stat_t *file_stats;
log_handle=log_open("fidentify.log", TD_LOG_CREATE);
+ if(log_handle!=NULL)
+ {
+ unsigned int i;
+ time_t my_time;
+#ifdef HAVE_DUP2
+ dup2(fileno(log_handle),2);
+#endif
+ my_time=time(NULL);
+ log_info("\n\n%s",ctime(&my_time));
+ log_info("Command line: PhotoRec");
+ for(i=1;i<argc;i++)
+ log_info(" %s", argv[i]);
+ log_info("\n\n");
+ log_flush();
+ }
+ log_info("fidentify%s, Data Recovery Utility, %s\nChristophe GRENIER <grenier@cgsecurity.org>\nhttp://www.cgsecurity.org\n", VERSION, TESTDISKDATE);
reset_list_file_enable(list_file_enable);
file_stats=init_file_stats(list_file_enable);
if(argc>1)
diff --git a/src/file_ab.c b/src/file_ab.c
index 00c8696..e49f752 100644
--- a/src/file_ab.c
+++ b/src/file_ab.c
@@ -23,9 +23,6 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
#include <stdio.h>
#include "types.h"
#include "filegen.h"
diff --git a/src/file_apa.c b/src/file_apa.c
index 8e8a736..0316043 100644
--- a/src/file_apa.c
+++ b/src/file_apa.c
@@ -23,9 +23,6 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
diff --git a/src/file_chm.c b/src/file_chm.c
index 4131ef3..5b2626f 100644
--- a/src/file_chm.c
+++ b/src/file_chm.c
@@ -29,7 +29,6 @@
#include <stdio.h>
#include "types.h"
#include "filegen.h"
-#include "log.h"
static void register_header_check_chm(file_stat_t *file_stat);
static int header_check_chm(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);
diff --git a/src/file_class.c b/src/file_class.c
index 933528c..9c0116f 100644
--- a/src/file_class.c
+++ b/src/file_class.c
@@ -23,9 +23,6 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
diff --git a/src/file_dim.c b/src/file_dim.c
index 02777d0..3f46d8e 100644
--- a/src/file_dim.c
+++ b/src/file_dim.c
@@ -28,7 +28,6 @@
#include <stdio.h>
#include "types.h"
#include "filegen.h"
-#include "log.h"
static void register_header_check_dim(file_stat_t *file_stat);
static int header_check_dim(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);
diff --git a/src/file_ds2.c b/src/file_ds2.c
index c35f6cc..073849d 100644
--- a/src/file_ds2.c
+++ b/src/file_ds2.c
@@ -31,7 +31,6 @@
#include <stdio.h>
#include "types.h"
#include "filegen.h"
-#include "log.h"
static void register_header_check_ds2(file_stat_t *file_stat);
static int header_check_ds2(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);
diff --git a/src/file_dss.c b/src/file_dss.c
index 6e115d7..5769837 100644
--- a/src/file_dss.c
+++ b/src/file_dss.c
@@ -31,7 +31,6 @@
#include <stdio.h>
#include "types.h"
#include "filegen.h"
-#include "log.h"
static void register_header_check_dss(file_stat_t *file_stat);
static int header_check_dss(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);
diff --git a/src/file_dxf.c b/src/file_dxf.c
index 3c62503..ba1925f 100644
--- a/src/file_dxf.c
+++ b/src/file_dxf.c
@@ -23,9 +23,6 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
@@ -36,7 +33,6 @@
#include "types.h"
#include "common.h"
#include "filegen.h"
-#include "log.h"
static void register_header_check_dxf(file_stat_t *file_stat);
static int header_check_dxf(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);
diff --git a/src/file_edb.c b/src/file_edb.c
index 86072c9..1db9f5a 100644
--- a/src/file_edb.c
+++ b/src/file_edb.c
@@ -23,9 +23,6 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
diff --git a/src/file_fcp.c b/src/file_fcp.c
index 4918168..bf825a8 100644
--- a/src/file_fcp.c
+++ b/src/file_fcp.c
@@ -28,7 +28,6 @@
#include <stdio.h>
#include "types.h"
#include "filegen.h"
-#include "log.h"
static void register_header_check_fcp(file_stat_t *file_stat);
static int header_check_fcp(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);
diff --git a/src/file_fits.c b/src/file_fits.c
index 95f2afa..0dd26e8 100644
--- a/src/file_fits.c
+++ b/src/file_fits.c
@@ -32,7 +32,6 @@
#include <stdio.h>
#include "types.h"
#include "filegen.h"
-#include "log.h"
static void register_header_check_fits(file_stat_t *file_stat);
static int header_check_fits(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);
diff --git a/src/file_ico.c b/src/file_ico.c
index 5e4d885..9a3ed56 100644
--- a/src/file_ico.c
+++ b/src/file_ico.c
@@ -23,9 +23,6 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
@@ -36,7 +33,6 @@
#include "types.h"
#include "common.h"
#include "filegen.h"
-#include "log.h"
static void register_header_check_ico(file_stat_t *file_stat);
static int header_check_ico(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);
diff --git a/src/file_ifo.c b/src/file_ifo.c
index b6cdb31..43d4f81 100644
--- a/src/file_ifo.c
+++ b/src/file_ifo.c
@@ -32,7 +32,6 @@
#include <stdio.h>
#include "types.h"
#include "filegen.h"
-#include "log.h"
static void register_header_check_ifo(file_stat_t *file_stat);
static int header_check_ifo(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);
diff --git a/src/file_list.c b/src/file_list.c
index 668fd15..6c8cf4e 100644
--- a/src/file_list.c
+++ b/src/file_list.c
@@ -128,7 +128,6 @@ extern const file_hint_t file_hint_mus;
extern const file_hint_t file_hint_mxf;
extern const file_hint_t file_hint_mysql;
extern const file_hint_t file_hint_njx;
-extern const file_hint_t file_hint_nk2;
extern const file_hint_t file_hint_ogg;
extern const file_hint_t file_hint_one;
extern const file_hint_t file_hint_orf;
@@ -299,7 +298,6 @@ file_enable_t list_file_enable[]=
{ .enable=0, .file_hint=&file_hint_mysql },
{ .enable=0, .file_hint=&file_hint_mxf },
{ .enable=0, .file_hint=&file_hint_njx },
- { .enable=0, .file_hint=&file_hint_nk2 },
{ .enable=0, .file_hint=&file_hint_ogg },
{ .enable=0, .file_hint=&file_hint_one },
{ .enable=0, .file_hint=&file_hint_orf },
diff --git a/src/file_mb.c b/src/file_mb.c
index 29e8697..9e9bcaf 100644
--- a/src/file_mb.c
+++ b/src/file_mb.c
@@ -29,7 +29,6 @@
#include <stdio.h>
#include "types.h"
#include "filegen.h"
-#include "log.h"
static void register_header_check_mb(file_stat_t *file_stat);
static int header_check_mb(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);
diff --git a/src/file_mcd.c b/src/file_mcd.c
index 9ded945..ae52af9 100644
--- a/src/file_mcd.c
+++ b/src/file_mcd.c
@@ -28,7 +28,6 @@
#include <stdio.h>
#include "types.h"
#include "filegen.h"
-#include "log.h"
static void register_header_check_mcd(file_stat_t *file_stat);
static int header_check_mcd(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);
diff --git a/src/file_pyc.c b/src/file_pyc.c
index 5a0a563..cfe3568 100644
--- a/src/file_pyc.c
+++ b/src/file_pyc.c
@@ -23,9 +23,6 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
diff --git a/src/file_ses.c b/src/file_ses.c
index d8f7493..9f8522a 100644
--- a/src/file_ses.c
+++ b/src/file_ses.c
@@ -23,9 +23,6 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
diff --git a/src/file_sp3.c b/src/file_sp3.c
index 0a1893c..e645e97 100644
--- a/src/file_sp3.c
+++ b/src/file_sp3.c
@@ -34,7 +34,6 @@
#include "filegen.h"
#include "file_sp3.h"
#include "common.h"
-#include "log.h"
static void register_header_check_sp3(file_stat_t *file_stat);
static int header_check_sp3(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);
diff --git a/src/file_tiff.c b/src/file_tiff.c
index cd9eaa5..0673097 100644
--- a/src/file_tiff.c
+++ b/src/file_tiff.c
@@ -287,18 +287,18 @@ static uint64_t header_check_tiff_le(FILE *in, const uint32_t tiff_diroff, const
if(tiff_diroff == 0)
return 0;
if(tiff_diroff % 2 != 0)
- return -1;
+ return 0;
if(fseek(in, tiff_diroff, SEEK_SET) < 0)
- return -1;
+ return 0;
data_read=fread(buffer, 1, sizeof(buffer), in);
if(data_read<2)
- return -1;
+ return 0;
n=buffer[0]+(buffer[1]<<8);
#ifdef DEBUG_TIFF
log_info("header_check_tiff_le(in, %lu, %u, %u) => %u entries\n", (long unsigned)tiff_diroff, depth, count, n);
#endif
//sizeof(TIFFDirEntry)=12;
- if(n > (data_read-2)/12)
+ if(n > (unsigned)(data_read-2)/12)
n=(data_read-2)/12;
if(n==0)
return 0;
@@ -319,8 +319,8 @@ static uint64_t header_check_tiff_le(FILE *in, const uint32_t tiff_diroff, const
if(val>4)
{
const uint64_t new_offset=le32(entry->tdir_offset)+val;
- if(new_offset==-1)
- return -1;
+ if(new_offset==0)
+ return 0;
if(max_offset < new_offset)
max_offset=new_offset;
}
@@ -344,8 +344,8 @@ static uint64_t header_check_tiff_le(FILE *in, const uint32_t tiff_diroff, const
if(val==4)
{
uint64_t new_offset=header_check_tiff_le(in, le32(entry->tdir_offset), depth+1, 0);
- if(new_offset==-1)
- return -1;
+ if(new_offset==0)
+ return 0;
if(max_offset < new_offset)
max_offset=new_offset;
}
@@ -360,20 +360,20 @@ static uint64_t header_check_tiff_le(FILE *in, const uint32_t tiff_diroff, const
if(fseek(in, le32(entry->tdir_offset), SEEK_SET) < 0)
{
free(subifd_offsetp);
- return -1;
+ return 0;
}
if(fread(subifd_offsetp, sizeof(*subifd_offsetp), nbr, in) != nbr)
{
free(subifd_offsetp);
- return -1;
+ return 0;
}
for(j=0; j<nbr; j++)
{
const uint64_t new_offset=header_check_tiff_le(in, le32(subifd_offsetp[j]), depth+1, 0);
- if(new_offset==-1)
+ if(new_offset==0)
{
free(subifd_offsetp);
- return -1;
+ return 0;
}
if(max_offset < new_offset)
max_offset = new_offset;
@@ -392,8 +392,8 @@ static uint64_t header_check_tiff_le(FILE *in, const uint32_t tiff_diroff, const
tiff_next_diroff=(uint32_t *)entry;
{
uint64_t new_offset=header_check_tiff_le(in, le32(*tiff_next_diroff), depth, count+1);
- if(new_offset==-1)
- return -1;
+ if(new_offset==0)
+ return 0;
if(max_offset < new_offset)
max_offset=new_offset;
}
@@ -419,18 +419,18 @@ static uint64_t header_check_tiff_be(FILE *in, const uint32_t tiff_diroff, const
if(tiff_diroff == 0)
return 0;
if(tiff_diroff % 2 != 0)
- return -1;
+ return 0;
if(fseek(in, tiff_diroff, SEEK_SET) < 0)
- return -1;
+ return 0;
data_read=fread(buffer, 1, sizeof(buffer), in);
if(data_read<2)
- return -1;
+ return 0;
n=(buffer[0]<<8)+buffer[1];
#ifdef DEBUG_TIFF
log_info("header_check_tiff_be(in, %lu, %u, %u) => %u entries\n", (long unsigned)tiff_diroff, depth, count, n);
#endif
//sizeof(TIFFDirEntry)=12;
- if(n > (data_read-2)/12)
+ if(n > (unsigned)(data_read-2)/12)
n=(data_read-2)/12;
if(n==0)
return 0;
@@ -451,8 +451,8 @@ static uint64_t header_check_tiff_be(FILE *in, const uint32_t tiff_diroff, const
if(val>4)
{
const uint64_t new_offset=be32(entry->tdir_offset)+val;
- if(new_offset==-1)
- return -1;
+ if(new_offset==0)
+ return 0;
if(max_offset < new_offset)
max_offset=new_offset;
}
@@ -476,8 +476,8 @@ static uint64_t header_check_tiff_be(FILE *in, const uint32_t tiff_diroff, const
if(val==4)
{
uint64_t new_offset=header_check_tiff_be(in, be32(entry->tdir_offset), depth+1, 0);
- if(new_offset==-1)
- return -1;
+ if(new_offset==0)
+ return 0;
if(max_offset < new_offset)
max_offset=new_offset;
}
@@ -492,20 +492,20 @@ static uint64_t header_check_tiff_be(FILE *in, const uint32_t tiff_diroff, const
if(fseek(in, be32(entry->tdir_offset), SEEK_SET) < 0)
{
free(subifd_offsetp);
- return -1;
+ return 0;
}
if(fread(subifd_offsetp, sizeof(*subifd_offsetp), nbr, in) != nbr)
{
free(subifd_offsetp);
- return -1;
+ return 0;
}
for(j=0; j<nbr; j++)
{
const uint64_t new_offset=header_check_tiff_be(in, be32(subifd_offsetp[j]), depth+1, 0);
- if(new_offset==-1)
+ if(new_offset==0)
{
free(subifd_offsetp);
- return -1;
+ return 0;
}
if(max_offset < new_offset)
max_offset = new_offset;
@@ -524,8 +524,8 @@ static uint64_t header_check_tiff_be(FILE *in, const uint32_t tiff_diroff, const
tiff_next_diroff=(uint32_t *)entry;
{
uint64_t new_offset=header_check_tiff_be(in, be32(*tiff_next_diroff), depth, count+1);
- if(new_offset==-1)
- return -1;
+ if(new_offset==0)
+ return 0;
if(max_offset < new_offset)
max_offset=new_offset;
}
diff --git a/src/file_ttf.c b/src/file_ttf.c
index ffc475a..8623623 100644
--- a/src/file_ttf.c
+++ b/src/file_ttf.c
@@ -23,9 +23,6 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
@@ -36,7 +33,6 @@
#include "types.h"
#include "common.h"
#include "filegen.h"
-#include "log.h"
static void register_header_check_ttf(file_stat_t *file_stat);
static int header_check_ttf(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);
@@ -111,7 +107,7 @@ static int header_check_ttf(const unsigned char *buffer, const unsigned int buff
{
const struct ttf_table_directory*ttf_dir=(const struct ttf_table_directory*)(ttf+1);
uint64_t max_offset=0;
- int i;
+ unsigned int i;
for(i=0; i<numTables; i++,ttf_dir++)
{
/* | 0x3: align the end of the table */
diff --git a/src/file_txt.c b/src/file_txt.c
index f158194..538e5e1 100644
--- a/src/file_txt.c
+++ b/src/file_txt.c
@@ -39,7 +39,6 @@
#include "filegen.h"
#include "log.h"
#include "memmem.h"
-#include "log.h"
extern const file_hint_t file_hint_doc;
extern const file_hint_t file_hint_jpg;
diff --git a/src/file_tz.c b/src/file_tz.c
index e711e6e..75cfe50 100644
--- a/src/file_tz.c
+++ b/src/file_tz.c
@@ -23,9 +23,6 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
diff --git a/src/file_xv.c b/src/file_xv.c
index 04dd313..5177325 100644
--- a/src/file_xv.c
+++ b/src/file_xv.c
@@ -23,9 +23,6 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
diff --git a/src/fnctdsk.c b/src/fnctdsk.c
index 4de30d9..d1b27bf 100644
--- a/src/fnctdsk.c
+++ b/src/fnctdsk.c
@@ -34,9 +34,6 @@
#include "types.h"
#include "common.h"
#include "fnctdsk.h"
-#include "lang.h"
-#include "testdisk.h"
-#include "analyse.h"
#include "log.h"
#include "log_part.h"
#include "guid_cpy.h"
diff --git a/src/geometry.c b/src/geometry.c
index b65debb..73e8414 100644
--- a/src/geometry.c
+++ b/src/geometry.c
@@ -29,7 +29,6 @@
#ifdef HAVE_STRING_H
#include <string.h>
#endif
-#include <ctype.h>
#include "types.h"
#include "common.h"
#include "intrf.h"
diff --git a/src/godmode.c b/src/godmode.c
index 13df273..73f99d8 100644
--- a/src/godmode.c
+++ b/src/godmode.c
@@ -24,27 +24,20 @@
#endif
#include <stdio.h>
-#include <ctype.h> /* tolower */
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
#include "types.h"
#include "common.h"
#include "fnctdsk.h"
#include "analyse.h"
#include "lang.h"
#include "godmode.h"
-#include "testdisk.h"
#include "intrface.h"
-#include "fat.h"
#include "ext2.h"
#include "intrf.h"
#include "intrfn.h"
#include "md.h"
-#include "adv.h"
#include "ntfs.h"
#include "next.h"
#include "tpartwr.h"
@@ -1184,12 +1177,12 @@ static int use_backup(disk_t *disk_car, const list_part_t *list_part, const int
fat32_boot_sector(disk_car, element->part, verbose, dump_ind, expert,current_cmd);
break;
case UP_NTFS:
- ntfs_boot_sector(disk_car, element->part, verbose, dump_ind, expert, current_cmd);
+ ntfs_boot_sector(disk_car, element->part, verbose, expert, current_cmd);
break;
case UP_HFS:
case UP_HFSP:
case UP_HFSX:
- HFS_HFSP_boot_sector(disk_car, element->part, verbose, dump_ind, expert, current_cmd);
+ HFS_HFSP_boot_sector(disk_car, element->part, verbose, current_cmd);
break;
default:
log_warning("Need to fix\n");
diff --git a/src/hdaccess.c b/src/hdaccess.c
index 474349b..e4252e1 100644
--- a/src/hdaccess.c
+++ b/src/hdaccess.c
@@ -126,13 +126,12 @@ static int file_pread(disk_t *disk_car, void *buf, const unsigned int count, con
static int file_pwrite(disk_t *disk_car, const void *buf, const unsigned int count, const uint64_t offset);
static int file_nopwrite(disk_t *disk_car, const void *buf, const unsigned int count, const uint64_t offset);
static int file_sync(disk_t *disk_car);
-static int generic_clean(disk_t *disk_car);
#ifndef DJGPP
static uint64_t compute_device_size(const int hd_h, const char *device, const int verbose, const unsigned int sector_size);
-static void disk_get_model(const int hd_h, disk_t *disk_car, const int verbose);
+static void disk_get_model(const int hd_h, disk_t *disk);
#endif
-static int generic_clean(disk_t *disk_car)
+int generic_clean(disk_t *disk_car)
{
free(disk_car->data);
disk_car->data=NULL;
@@ -908,7 +907,7 @@ static int scsi_query_product_info (const int hd_h, char **vendor, char **produc
#endif
#ifndef DJGPP
-static void disk_get_model(const int hd_h, disk_t *dev, const int verbose)
+static void disk_get_model(const int hd_h, disk_t *dev)
{
#ifdef TARGET_LINUX
if(dev->model!=NULL)
@@ -971,7 +970,7 @@ static void disk_get_model(const int hd_h, disk_t *dev, const int verbose)
#else
handle=(HANDLE)_get_osfhandle(hd_h);
#endif
- file_win32_disk_get_model(handle, dev, verbose);
+ file_win32_disk_get_model(handle, dev);
}
#endif
}
@@ -1391,7 +1390,7 @@ disk_t *file_test_availability(const char *device, const int verbose, const arch
In order to avoid this, discard all blocks on /dev/hda. */
ioctl(hd_h, BLKFLSBUF); /* ignore errors */
#endif
- disk_get_model(hd_h, disk_car, verbose);
+ disk_get_model(hd_h, disk_car);
disk_get_hpa_dco(hd_h, disk_car, verbose);
}
else
@@ -1478,7 +1477,7 @@ void hd_update_geometry(disk_t *disk_car, const int allow_partial_last_cylinder,
buffer=(unsigned char *)MALLOC(disk_car->sector_size);
if(disk_car->autodetect!=0)
{
- if(disk_car->pread(disk_car, buffer, disk_car->sector_size, 0) == disk_car->sector_size)
+ if((unsigned)disk_car->pread(disk_car, buffer, disk_car->sector_size, 0) == disk_car->sector_size)
{
if(verbose>1)
{
@@ -1510,7 +1509,7 @@ void hd_update_geometry(disk_t *disk_car, const int allow_partial_last_cylinder,
data->geo_phys.cylinders=0;
}
#endif
- if(disk_car->pread(disk_car, buffer, disk_car->sector_size, pos) == disk_car->sector_size)
+ if((unsigned)disk_car->pread(disk_car, buffer, disk_car->sector_size, pos) == disk_car->sector_size)
{
disk_car->geom.cylinders++;
if(disk_car->disk_size < (uint64_t)disk_car->geom.cylinders * disk_car->geom.heads_per_cylinder * disk_car->geom.sectors_per_head * disk_car->sector_size)
diff --git a/src/hdaccess.h b/src/hdaccess.h
index 251d165..fd7a8dc 100644
--- a/src/hdaccess.h
+++ b/src/hdaccess.h
@@ -31,6 +31,7 @@ disk_t *file_test_availability(const char *device, const int verbose, const arch
void autoset_unit(disk_t *disk_car);
void update_disk_car_fields(disk_t *disk_car);
void init_disk(disk_t *disk);
+int generic_clean(disk_t *disk_car);
#ifdef __cplusplus
} /* closing brace for extern "C" */
diff --git a/src/hdcache.c b/src/hdcache.c
index a103ed4..ba32723 100644
--- a/src/hdcache.c
+++ b/src/hdcache.c
@@ -32,7 +32,6 @@
#include "types.h"
#include "common.h"
#include "hdcache.h"
-#include "fnctdsk.h"
#include "log.h"
#define CACHE_BUFFER_NBR 128
diff --git a/src/hdwin32.c b/src/hdwin32.c
index 0adac21..0cf5393 100644
--- a/src/hdwin32.c
+++ b/src/hdwin32.c
@@ -44,7 +44,6 @@
#ifdef HAVE_DDK_NTDDSTOR_H
#include <ddk/ntddstor.h>
#endif
-#include "fnctdsk.h"
#include "log.h"
#include "hdwin32.h"
diff --git a/src/hfsp.c b/src/hfsp.c
index 931ee47..b28f383 100644
--- a/src/hfsp.c
+++ b/src/hfsp.c
@@ -36,7 +36,7 @@
#include "fnctdsk.h"
#include "log.h"
-static int set_HFSP_info(partition_t *partition, const struct hfsp_vh *vh);
+static int set_HFSP_info(partition_t *partition);
int check_HFSP(disk_t *disk_car,partition_t *partition,const int verbose)
{
@@ -51,7 +51,7 @@ int check_HFSP(disk_t *disk_car,partition_t *partition,const int verbose)
free(buffer);
return 1;
}
- set_HFSP_info(partition,(struct hfsp_vh *)buffer);
+ set_HFSP_info(partition);
free(buffer);
return 0;
}
@@ -73,7 +73,7 @@ int recover_HFSP(disk_t *disk_car, const struct hfsp_vh *vh,partition_t *partiti
partition->part_offset-=partition->sb_offset;
}
partition->part_size=part_size;
- set_HFSP_info(partition,vh);
+ set_HFSP_info(partition);
partition->part_type_i386=P_HFSP;
partition->part_type_mac=PMAC_HFS;
partition->part_type_gpt=GPT_ENT_TYPE_MAC_HFS;
@@ -123,7 +123,7 @@ int test_HFSP(disk_t *disk_car, const struct hfsp_vh *vh,partition_t *partition,
return 0;
}
-static int set_HFSP_info(partition_t *partition, const struct hfsp_vh *vh)
+static int set_HFSP_info(partition_t *partition)
{
partition->fsname[0]='\0';
if(partition->upart_type==UP_HFSP)
diff --git a/src/hpa_dco.c b/src/hpa_dco.c
index 72191b2..ac09f0c 100644
--- a/src/hpa_dco.c
+++ b/src/hpa_dco.c
@@ -36,7 +36,6 @@
#include <fcntl.h> /* open */
#endif
#include <stdio.h>
-#include <errno.h>
#include "types.h"
#ifdef HAVE_LINUX_TYPES_H
#include <linux/types.h>
@@ -48,9 +47,6 @@
#ifdef HAVE_LINUX_HDREG_H
#include <linux/hdreg.h>
#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
#ifdef HAVE_FNCTL_H
#include <fnctl.h>
#endif
diff --git a/src/hpfs.c b/src/hpfs.c
new file mode 100644
index 0000000..4c47bca
--- /dev/null
+++ b/src/hpfs.c
@@ -0,0 +1,101 @@
+/*
+
+ File: hpfs.c
+
+ Copyright (C) 1998-2009 Christophe GRENIER <grenier@cgsecurity.org>
+
+ This software is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write the Free Software Foundation, Inc., 51
+ Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#include "types.h"
+#include "common.h"
+#include "fat.h"
+#include "hpfs.h"
+#include "fnctdsk.h"
+#include "intrf.h"
+#include "log.h"
+#include "log_part.h"
+
+static int test_HPFS(disk_t *disk_car,const struct fat_boot_sector *hpfs_header, partition_t *partition,const int verbose, const int dump_ind);
+
+static int test_HPFS(disk_t *disk_car,const struct fat_boot_sector *hpfs_header, partition_t *partition,const int verbose, const int dump_ind)
+{
+ const char*buffer=(const char*)hpfs_header;
+ if(le16(hpfs_header->marker)==0xAA55)
+ {
+ if(memcmp(buffer+OS2_NAME,"IBM",3)==0)
+ { /* D'apres une analyse de OS2 sur systeme FAT...
+ FAT_NAME1=FAT
+ */
+ if(verbose||dump_ind)
+ {
+ log_info("\nHPFS maybe at %u/%u/%u\n",
+ offset2cylinder(disk_car,partition->part_offset),
+ offset2head(disk_car,partition->part_offset),
+ offset2sector(disk_car,partition->part_offset));
+ }
+ if(dump_ind!=0)
+ dump_log(buffer, DEFAULT_SECTOR_SIZE);
+ partition->part_size=(uint64_t)(sectors(hpfs_header)>0?sectors(hpfs_header):le32(hpfs_header->total_sect)) *
+ fat_sector_size(hpfs_header);
+ partition->upart_type=UP_HPFS;
+ return 0;
+ }
+ } /* fin marqueur de fin :)) */
+ return 1;
+}
+
+int recover_HPFS(disk_t *disk_car,const struct fat_boot_sector*fat_header, partition_t *partition, const int verbose)
+{
+ if(test_HPFS(disk_car,fat_header,partition,verbose,0)!=0)
+ return 1;
+ partition->part_type_i386=P_HPFS;
+ partition->part_type_gpt=GPT_ENT_TYPE_MAC_HFS;
+ partition->fsname[0]='\0';
+ partition->info[0]='\0';
+ return 0;
+}
+
+int check_HPFS(disk_t *disk_car,partition_t *partition,const int verbose)
+{
+ unsigned char buffer[512];
+ if((unsigned)disk_car->pread(disk_car, &buffer, disk_car->sector_size, partition->part_offset) != disk_car->sector_size)
+ {
+ screen_buffer_add("check_HPFS: Read error\n");
+ log_error("check_HPFS: Read error\n");
+ return 1;
+ }
+ if(test_HPFS(disk_car,(const struct fat_boot_sector *)buffer,partition,verbose,0)!=0)
+ {
+ if(verbose>0)
+ {
+ log_info("\n\ntest_HPFS()\n");
+ log_partition(disk_car,partition);
+ }
+ return 1;
+ }
+ return 0;
+}
+
+
diff --git a/src/hpfs.h b/src/hpfs.h
new file mode 100644
index 0000000..b5947d4
--- /dev/null
+++ b/src/hpfs.h
@@ -0,0 +1,35 @@
+/*
+
+ File: hpfs.h
+
+ Copyright (C) 2009 Christophe GRENIER <grenier@cgsecurity.org>
+
+ This software is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write the Free Software Foundation, Inc., 51
+ Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ */
+
+#ifndef _HPFS_H
+#define _HPFS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int recover_HPFS(disk_t *disk_car, const struct fat_boot_sector *hpfs_header, partition_t *partition, const int verbose);
+int check_HPFS(disk_t *disk_car,partition_t *partition, const int verbose);
+
+#ifdef __cplusplus
+} /* closing brace for extern "C" */
+#endif
+#endif
diff --git a/src/intrf.c b/src/intrf.c
index 34dca68..208bb19 100644
--- a/src/intrf.c
+++ b/src/intrf.c
@@ -53,9 +53,6 @@
#ifdef HAVE_LIBGEN_H
#include <libgen.h>
#endif
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
#include <errno.h>
#include "types.h"
#include "common.h"
diff --git a/src/intrface.c b/src/intrface.c
index 05de5d8..b14006c 100644
--- a/src/intrface.c
+++ b/src/intrface.c
@@ -51,7 +51,7 @@
extern const arch_fnct_t arch_none;
-void interface_list(disk_t *disk_car, const int verbose, const int saveheader, const int backup, char **current_cmd)
+void interface_list(disk_t *disk_car, const int verbose, const int saveheader, const int backup)
{
list_part_t *list_part;
log_info("\nAnalyse ");
diff --git a/src/intrface.h b/src/intrface.h
index 54f1996..78c8f90 100644
--- a/src/intrface.h
+++ b/src/intrface.h
@@ -24,7 +24,7 @@ extern "C" {
#endif
list_part_t *ask_structure(disk_t *disk_car,list_part_t *list_part, const int verbose, char **current_cmd);
-void interface_list(disk_t *disk_car, const int verbose, const int saveheader, const int backup, char **current_cmd);
+void interface_list(disk_t *disk_car, const int verbose, const int saveheader, const int backup);
#ifdef __cplusplus
} /* closing brace for extern "C" */
diff --git a/src/intrfn.c b/src/intrfn.c
index 69983a3..0df480a 100644
--- a/src/intrfn.c
+++ b/src/intrfn.c
@@ -53,21 +53,16 @@
#ifdef HAVE_LIBGEN_H
#include <libgen.h>
#endif
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
#include <errno.h>
#include "types.h"
#include "common.h"
#include "lang.h"
#include "intrf.h"
#include "intrfn.h"
-#include "fnctdsk.h"
#include "list.h"
#include "dir.h"
#include "log.h"
#include "hdaccess.h"
-#include "askloc.h"
extern const arch_fnct_t arch_i386;
extern const arch_fnct_t arch_gpt;
@@ -257,7 +252,7 @@ static int wmenuUpdate(WINDOW *window, const int yinfo, int y, int x, const stru
{
x += (lenName < itemLength?itemLength:lenName) + MENU_SPACING;
if( menuType & MENU_BUTTON ) x += 2;
- if( x > COLUMNS - lmargin - 12 )
+ if( x + lmargin + 12 > COLUMNS )
{
x = lmargin;
y ++ ;
diff --git a/src/io_redir.c b/src/io_redir.c
index c9b9c5b..a8f85ca 100644
--- a/src/io_redir.c
+++ b/src/io_redir.c
@@ -33,7 +33,6 @@
#include <errno.h>
#include "types.h"
#include "common.h"
-#include "fnctdsk.h"
#include "io_redir.h"
#include "log.h"
@@ -209,7 +208,7 @@ static int io_redir_pread(disk_t *disk_car, void *buffer, const unsigned int cou
#endif
res=data->disk_car->pread(data->disk_car, buffer, read_size, current_offset);
}
- if(res!=read_size)
+ if((unsigned)res!=read_size)
return res;
current_count-=read_size;
current_offset+=read_size;
diff --git a/src/jfs.c b/src/jfs.c
index 868ba3a..0733c81 100644
--- a/src/jfs.c
+++ b/src/jfs.c
@@ -37,10 +37,10 @@
#include "log.h"
#include "guid_cpy.h"
-static int test_JFS(disk_t *disk_car, const struct jfs_superblock *sb,partition_t *partition,const int verbose, const int dump_ind);
-static int set_JFS_info(disk_t *disk_car, const struct jfs_superblock *sb,partition_t *partition,const int verbose, const int dump_ind);
+static int test_JFS(disk_t *disk_car, const struct jfs_superblock *sb, partition_t *partition, const int dump_ind);
+static int set_JFS_info(const struct jfs_superblock *sb, partition_t *partition);
-int check_JFS(disk_t *disk_car,partition_t *partition,const int verbose)
+int check_JFS(disk_t *disk_car, partition_t *partition)
{
unsigned char *buffer=(unsigned char*)MALLOC(JFS_SUPERBLOCK_SIZE);
if(disk_car->pread(disk_car, buffer, JFS_SUPERBLOCK_SIZE, partition->part_offset + 64 * 512) != JFS_SUPERBLOCK_SIZE)
@@ -48,17 +48,17 @@ int check_JFS(disk_t *disk_car,partition_t *partition,const int verbose)
free(buffer);
return 1;
}
- if(test_JFS(disk_car,(struct jfs_superblock*)buffer,partition,verbose,0)!=0)
+ if(test_JFS(disk_car, (struct jfs_superblock*)buffer, partition,0)!=0)
{
free(buffer);
return 1;
}
- set_JFS_info(disk_car,(struct jfs_superblock*)buffer,partition,verbose,0);
+ set_JFS_info((struct jfs_superblock*)buffer, partition);
free(buffer);
return 0;
}
-static int set_JFS_info(disk_t *disk_car, const struct jfs_superblock *sb,partition_t *partition,const int verbose, const int dump_ind)
+static int set_JFS_info(const struct jfs_superblock *sb, partition_t *partition)
{
snprintf(partition->info,sizeof(partition->info),"JFS %u",(unsigned int)le32(sb->s_version));
partition->fsname[0]='\0';
@@ -74,9 +74,9 @@ Primary superblock is at 0x8000
*/
int recover_JFS(disk_t *disk_car, const struct jfs_superblock *sb,partition_t *partition,const int verbose, const int dump_ind)
{
- if(test_JFS(disk_car,sb,partition,verbose,dump_ind)!=0)
+ if(test_JFS(disk_car, sb, partition, dump_ind)!=0)
return 1;
- set_JFS_info(disk_car,sb,partition,verbose,dump_ind);
+ set_JFS_info(sb, partition);
partition->part_type_i386=P_LINUX;
partition->part_type_sun=PSUN_LINUX;
partition->part_type_mac=PMAC_LINUX;
@@ -100,7 +100,7 @@ int recover_JFS(disk_t *disk_car, const struct jfs_superblock *sb,partition_t *p
return 0;
}
-static int test_JFS(disk_t *disk_car, const struct jfs_superblock *sb,partition_t *partition,const int verbose, const int dump_ind)
+static int test_JFS(disk_t *disk_car, const struct jfs_superblock *sb, partition_t *partition, const int dump_ind)
{
if(memcmp(sb->s_magic,"JFS1",4)!=0)
return 1;
diff --git a/src/jfs.h b/src/jfs.h
index ddee86f..74d38d7 100644
--- a/src/jfs.h
+++ b/src/jfs.h
@@ -26,7 +26,7 @@ extern "C" {
#define JFS_SUPERBLOCK_SIZE 512
#define L2BPERDMAP 13 /* l2 num of blks per dmap */
-int check_JFS(disk_t *disk_car,partition_t *partition,const int verbose);
+int check_JFS(disk_t *disk_car, partition_t *partition);
int recover_JFS(disk_t *disk_car, const struct jfs_superblock *sb,partition_t *partition,const int verbose, const int dump_ind);
#ifdef __cplusplus
diff --git a/src/luks.c b/src/luks.c
index 756b2e3..a9a4659 100644
--- a/src/luks.c
+++ b/src/luks.c
@@ -36,11 +36,11 @@
#include "log.h"
#include "guid_cpy.h"
-static int test_LUKS(disk_t *disk_car, const struct luks_phdr *sb,partition_t *partition,const int verbose, const int dump_ind);
-static int set_LUKS_info(disk_t *disk_car, const struct luks_phdr *sb,partition_t *partition,const int verbose, const int dump_ind);
+static int test_LUKS(disk_t *disk_car, const struct luks_phdr *sb, partition_t *partition, const int dump_ind);
+static int set_LUKS_info(const struct luks_phdr *sb, partition_t *partition);
static const uint8_t LUKS_MAGIC[LUKS_MAGIC_L] = {'L','U','K','S', 0xba, 0xbe};
-int check_LUKS(disk_t *disk_car,partition_t *partition,const int verbose)
+int check_LUKS(disk_t *disk_car,partition_t *partition)
{
unsigned char *buffer=(unsigned char*)MALLOC(DEFAULT_SECTOR_SIZE);
if(disk_car->pread(disk_car, buffer, DEFAULT_SECTOR_SIZE, partition->part_offset) != DEFAULT_SECTOR_SIZE)
@@ -48,17 +48,17 @@ int check_LUKS(disk_t *disk_car,partition_t *partition,const int verbose)
free(buffer);
return 1;
}
- if(test_LUKS(disk_car,(struct luks_phdr*)buffer,partition,verbose,0)!=0)
+ if(test_LUKS(disk_car, (struct luks_phdr*)buffer, partition, 0)!=0)
{
free(buffer);
return 1;
}
- set_LUKS_info(disk_car,(struct luks_phdr*)buffer,partition,verbose,0);
+ set_LUKS_info((struct luks_phdr*)buffer, partition);
free(buffer);
return 0;
}
-static int set_LUKS_info(disk_t *disk_car, const struct luks_phdr *sb,partition_t *partition,const int verbose, const int dump_ind)
+static int set_LUKS_info(const struct luks_phdr *sb, partition_t *partition)
{
sprintf(partition->info,"LUKS %u (Data size unknown)",be16(sb->version));
return 0;
@@ -66,11 +66,11 @@ static int set_LUKS_info(disk_t *disk_car, const struct luks_phdr *sb,partition_
int recover_LUKS(disk_t *disk_car, const struct luks_phdr *sb,partition_t *partition,const int verbose, const int dump_ind)
{
- if(test_LUKS(disk_car,sb,partition,verbose,dump_ind)!=0)
+ if(test_LUKS(disk_car, sb, partition, dump_ind)!=0)
return 1;
if(partition==NULL)
return 0;
- set_LUKS_info(disk_car,sb,partition,verbose,dump_ind);
+ set_LUKS_info(sb, partition);
partition->part_type_i386=P_LINUX;
partition->part_type_mac=PMAC_LINUX;
partition->part_type_sun=PSUN_LINUX;
@@ -88,7 +88,7 @@ int recover_LUKS(disk_t *disk_car, const struct luks_phdr *sb,partition_t *parti
return 0;
}
-static int test_LUKS(disk_t *disk_car, const struct luks_phdr *sb,partition_t *partition,const int verbose, const int dump_ind)
+static int test_LUKS(disk_t *disk_car, const struct luks_phdr *sb, partition_t *partition, const int dump_ind)
{
if(memcmp(sb->magic,LUKS_MAGIC,LUKS_MAGIC_L)!=0)
return 1;
diff --git a/src/luks.h b/src/luks.h
index fa23cb5..de67e4b 100644
--- a/src/luks.h
+++ b/src/luks.h
@@ -56,7 +56,7 @@ struct luks_phdr {
luks_keyslot_t keyslot[LUKS_NUMKEYS];
};
-int check_LUKS(disk_t *disk_car,partition_t *partition,const int verbose);
+int check_LUKS(disk_t *disk_car, partition_t *partition);
int recover_LUKS(disk_t *disk_car, const struct luks_phdr *sb,partition_t *partition,const int verbose, const int dump_ind);
#ifdef __cplusplus
diff --git a/src/lvm.c b/src/lvm.c
index 7acce61..526baf6 100644
--- a/src/lvm.c
+++ b/src/lvm.c
@@ -37,10 +37,10 @@
#include "log.h"
#include "guid_cpy.h"
-static int set_LVM_info(partition_t *partition, const pv_disk_t *pv);
+static int set_LVM_info(partition_t *partition);
static int test_LVM(disk_t *disk_car, const pv_disk_t *pv,partition_t *partition,const int verbose, const int dump_ind);
-static int set_LVM2_info(partition_t*partition, const unsigned char *buf);
+static int set_LVM2_info(partition_t*partition);
static int test_LVM2(disk_t *disk_car, const struct lvm2_label_header *lh,partition_t *partition,const int verbose, const int dump_ind);
int check_LVM(disk_t *disk_car,partition_t *partition,const int verbose)
@@ -56,7 +56,7 @@ int check_LVM(disk_t *disk_car,partition_t *partition,const int verbose)
free(buffer);
return 1;
}
- set_LVM_info(partition,(pv_disk_t *)buffer);
+ set_LVM_info(partition);
free(buffer);
return 0;
}
@@ -65,7 +65,7 @@ int recover_LVM(disk_t *disk_car, const pv_disk_t *pv,partition_t *partition,con
{
if(test_LVM(disk_car,pv,partition,verbose,dump_ind)!=0)
return 1;
- set_LVM_info(partition,pv);
+ set_LVM_info(partition);
partition->part_type_i386=P_LVM;
partition->part_type_sun=PSUN_LVM;
partition->part_type_gpt=GPT_ENT_TYPE_LINUX_LVM;
@@ -119,7 +119,7 @@ static int test_LVM(disk_t *disk_car, const pv_disk_t *pv,partition_t *partition
return 1;
}
-static int set_LVM_info(partition_t *partition, const pv_disk_t *pv)
+static int set_LVM_info(partition_t *partition)
{
partition->fsname[0]='\0';
partition->info[0]='\0';
@@ -140,7 +140,7 @@ int check_LVM2(disk_t *disk_car,partition_t *partition,const int verbose)
free(buffer);
return 1;
}
- set_LVM2_info(partition,buffer);
+ set_LVM2_info(partition);
free(buffer);
return 0;
}
@@ -150,7 +150,7 @@ int recover_LVM2(disk_t *disk_car, const unsigned char *buf,partition_t *partiti
const struct lvm2_label_header *lh=(const struct lvm2_label_header *)buf;
if(test_LVM2(disk_car,lh,partition,verbose,dump_ind)!=0)
return 1;
- set_LVM2_info(partition,buf);
+ set_LVM2_info(partition);
partition->part_type_i386=P_LVM;
partition->part_type_sun=PSUN_LVM;
partition->part_type_gpt=GPT_ENT_TYPE_LINUX_LVM;
@@ -187,7 +187,7 @@ static int test_LVM2(disk_t *disk_car, const struct lvm2_label_header *lh,partit
return 1;
}
-static int set_LVM2_info(partition_t*partition, const unsigned char *buf)
+static int set_LVM2_info(partition_t*partition)
{
partition->fsname[0]='\0';
partition->info[0]='\0';
diff --git a/src/md.c b/src/md.c
index 388ca30..aab4ae6 100644
--- a/src/md.c
+++ b/src/md.c
@@ -35,10 +35,10 @@
#include "md.h"
#include "fnctdsk.h"
#include "log.h"
-static int test_MD(disk_t *disk_car, const struct mdp_superblock_s *sb, partition_t *partition, const int verbose, const int dump_ind);
-static int test_MD_be(disk_t *disk_car, const struct mdp_superblock_s *sb, partition_t *partition, const int verbose, const int dump_ind);
-static int set_MD_info(disk_t *disk_car, const struct mdp_superblock_s *sb,partition_t *partition,const int verbose, const int dump_ind);
-static int set_MD_info_be(disk_t *disk_car, const struct mdp_superblock_s *sb,partition_t *partition,const int verbose, const int dump_ind);
+static int test_MD(disk_t *disk_car, const struct mdp_superblock_s *sb, partition_t *partition, const int dump_ind);
+static int test_MD_be(disk_t *disk_car, const struct mdp_superblock_s *sb, partition_t *partition, const int dump_ind);
+static int set_MD_info(const struct mdp_superblock_s *sb, partition_t *partition, const int verbose);
+static int set_MD_info_be(const struct mdp_superblock_s *sb, partition_t *partition, const int verbose);
int check_MD(disk_t *disk_car, partition_t *partition, const int verbose)
{
@@ -50,20 +50,20 @@ int check_MD(disk_t *disk_car, partition_t *partition, const int verbose)
if(le32(sb1->md_magic)==(unsigned int)MD_SB_MAGIC &&
le32(sb1->major_version)==1 &&
le64(sb1->super_offset)==0 &&
- test_MD(disk_car,(struct mdp_superblock_s*)buffer,partition,verbose,0)==0)
+ test_MD(disk_car, (struct mdp_superblock_s*)buffer, partition, 0)==0)
{
log_info("check_MD 1.1\n");
- set_MD_info(disk_car,(struct mdp_superblock_s*)buffer,partition,verbose,0);
+ set_MD_info((struct mdp_superblock_s*)buffer, partition, verbose);
free(buffer);
return 0;
}
if(be32(sb1->md_magic)==(unsigned int)MD_SB_MAGIC &&
be32(sb1->major_version)==1 &&
be64(sb1->super_offset)==0 &&
- test_MD_be(disk_car,(struct mdp_superblock_s*)buffer,partition,verbose,0)==0)
+ test_MD_be(disk_car, (struct mdp_superblock_s*)buffer, partition, 0)==0)
{
log_info("check_MD 1.1 (BigEndian)\n");
- set_MD_info_be(disk_car,(struct mdp_superblock_s*)buffer,partition,verbose,0);
+ set_MD_info_be((struct mdp_superblock_s*)buffer, partition, verbose);
free(buffer);
return 0;
}
@@ -75,20 +75,20 @@ int check_MD(disk_t *disk_car, partition_t *partition, const int verbose)
if(le32(sb1->md_magic)==(unsigned int)MD_SB_MAGIC &&
le32(sb1->major_version)==1 &&
le64(sb1->super_offset)==8 &&
- test_MD(disk_car,(struct mdp_superblock_s*)buffer,partition,verbose,0)==0)
+ test_MD(disk_car, (struct mdp_superblock_s*)buffer, partition, 0)==0)
{
log_info("check_MD 1.2\n");
- set_MD_info(disk_car,(struct mdp_superblock_s*)buffer,partition,verbose,0);
+ set_MD_info((struct mdp_superblock_s*)buffer, partition, verbose);
free(buffer);
return 0;
}
if(be32(sb1->md_magic)==(unsigned int)MD_SB_MAGIC &&
be32(sb1->major_version)==1 &&
be64(sb1->super_offset)==8 &&
- test_MD_be(disk_car,(struct mdp_superblock_s*)buffer,partition,verbose,0)==0)
+ test_MD_be(disk_car, (struct mdp_superblock_s*)buffer, partition, 0)==0)
{
log_info("check_MD 1.2 (BigEndian)\n");
- set_MD_info_be(disk_car,(struct mdp_superblock_s*)buffer,partition,verbose,0);
+ set_MD_info_be((struct mdp_superblock_s*)buffer, partition, verbose);
free(buffer);
return 0;
}
@@ -105,19 +105,19 @@ int check_MD(disk_t *disk_car, partition_t *partition, const int verbose)
{
if(le32(sb->md_magic)==(unsigned int)MD_SB_MAGIC &&
le32(sb->major_version)==0 &&
- test_MD(disk_car,(struct mdp_superblock_s*)buffer,partition,verbose,0)==0)
+ test_MD(disk_car, (struct mdp_superblock_s*)buffer, partition, 0)==0)
{
log_info("check_MD 0.90\n");
- set_MD_info(disk_car,(struct mdp_superblock_s*)buffer,partition,verbose,0);
+ set_MD_info((struct mdp_superblock_s*)buffer, partition, verbose);
free(buffer);
return 0;
}
if(be32(sb->md_magic)==(unsigned int)MD_SB_MAGIC &&
be32(sb->major_version)==0 &&
- test_MD_be(disk_car,(struct mdp_superblock_s*)buffer,partition,verbose,0)==0)
+ test_MD_be(disk_car, (struct mdp_superblock_s*)buffer, partition, 0)==0)
{
log_info("check_MD 0.90 (BigEndian)\n");
- set_MD_info_be(disk_car,(struct mdp_superblock_s*)buffer,partition,verbose,0);
+ set_MD_info_be((struct mdp_superblock_s*)buffer, partition, verbose);
free(buffer);
return 0;
}
@@ -137,20 +137,20 @@ int check_MD(disk_t *disk_car, partition_t *partition, const int verbose)
if(le32(sb1->md_magic)==(unsigned int)MD_SB_MAGIC &&
le32(sb1->major_version)==1 &&
le64(sb1->super_offset)==(offset/512) &&
- test_MD(disk_car,(struct mdp_superblock_s*)buffer,partition,verbose,0)==0)
+ test_MD(disk_car, (struct mdp_superblock_s*)buffer, partition, 0)==0)
{
log_info("check_MD 1.0\n");
- set_MD_info(disk_car,(struct mdp_superblock_s*)buffer,partition,verbose,0);
+ set_MD_info((struct mdp_superblock_s*)buffer, partition, verbose);
free(buffer);
return 0;
}
if(be32(sb1->md_magic)==(unsigned int)MD_SB_MAGIC &&
be32(sb1->major_version)==1 &&
be64(sb1->super_offset)==(offset/512) &&
- test_MD_be(disk_car,(struct mdp_superblock_s*)buffer,partition,verbose,0)==0)
+ test_MD_be(disk_car, (struct mdp_superblock_s*)buffer, partition, 0)==0)
{
log_info("check_MD 1.0 (BigEndian)\n");
- set_MD_info_be(disk_car,(struct mdp_superblock_s*)buffer,partition,verbose,0);
+ set_MD_info_be((struct mdp_superblock_s*)buffer, partition, verbose);
free(buffer);
return 0;
}
@@ -198,9 +198,9 @@ int recover_MD_from_partition(disk_t *disk_car, partition_t *partition, const in
int recover_MD(disk_t *disk_car, const struct mdp_superblock_s *sb, partition_t *partition, const int verbose, const int dump_ind)
{
- if(test_MD(disk_car,sb,partition,verbose,dump_ind)==0)
+ if(test_MD(disk_car, sb, partition, dump_ind)==0)
{
- set_MD_info(disk_car,sb,partition,verbose,dump_ind);
+ set_MD_info(sb, partition, verbose);
partition->part_type_i386=P_RAID;
partition->part_type_sun=PSUN_RAID;
partition->part_type_gpt=GPT_ENT_TYPE_LINUX_RAID;
@@ -218,9 +218,9 @@ int recover_MD(disk_t *disk_car, const struct mdp_superblock_s *sb, partition_t
}
return 0;
}
- if(test_MD_be(disk_car,sb,partition,verbose,dump_ind)==0)
+ if(test_MD_be(disk_car, sb, partition, dump_ind)==0)
{
- set_MD_info_be(disk_car,sb,partition,verbose,dump_ind);
+ set_MD_info_be(sb, partition, verbose);
partition->part_type_i386=P_RAID;
partition->part_type_sun=PSUN_RAID;
partition->part_type_gpt=GPT_ENT_TYPE_LINUX_RAID;
@@ -241,7 +241,7 @@ int recover_MD(disk_t *disk_car, const struct mdp_superblock_s *sb, partition_t
return 1;
}
-static int set_MD_info(disk_t *disk_car, const struct mdp_superblock_s *sb, partition_t *partition, const int verbose, const int dump_ind)
+static int set_MD_info(const struct mdp_superblock_s *sb, partition_t *partition, const int verbose)
{
unsigned int i,d;
if(le32(sb->major_version)==0)
@@ -299,7 +299,7 @@ static int set_MD_info(disk_t *disk_car, const struct mdp_superblock_s *sb, part
return 0;
}
-static int set_MD_info_be(disk_t *disk_car, const struct mdp_superblock_s *sb, partition_t *partition, const int verbose, const int dump_ind)
+static int set_MD_info_be(const struct mdp_superblock_s *sb, partition_t *partition, const int verbose)
{
unsigned int i,d;
if(be32(sb->major_version)==0)
@@ -357,7 +357,7 @@ static int set_MD_info_be(disk_t *disk_car, const struct mdp_superblock_s *sb, p
return 0;
}
-static int test_MD(disk_t *disk_car, const struct mdp_superblock_s *sb,partition_t *partition,const int verbose, const int dump_ind)
+static int test_MD(disk_t *disk_car, const struct mdp_superblock_s *sb, partition_t *partition, const int dump_ind)
{
if(le32(sb->md_magic)==(unsigned int)MD_SB_MAGIC)
{
@@ -388,7 +388,7 @@ static int test_MD(disk_t *disk_car, const struct mdp_superblock_s *sb,partition
return 1;
}
-static int test_MD_be(disk_t *disk_car, const struct mdp_superblock_s *sb,partition_t *partition,const int verbose, const int dump_ind)
+static int test_MD_be(disk_t *disk_car, const struct mdp_superblock_s *sb, partition_t *partition, const int dump_ind)
{
if(be32(sb->md_magic)==(unsigned int)MD_SB_MAGIC)
{
diff --git a/src/netware.c b/src/netware.c
index 5c7bb8c..e2468c5 100644
--- a/src/netware.c
+++ b/src/netware.c
@@ -32,9 +32,9 @@
#include "types.h"
#include "common.h"
#include "netware.h"
-static int test_netware(disk_t *disk_car, const struct disk_netware *netware_block,partition_t *partition,const int verbose, const int dump_ind);
+static int test_netware(const struct disk_netware *netware_block, partition_t *partition);
-static int test_netware(disk_t *disk_car, const struct disk_netware *netware_block,partition_t *partition,const int verbose, const int dump_ind)
+static int test_netware(const struct disk_netware *netware_block, partition_t *partition)
{
if(memcmp(netware_block->magic,"Nw_PaRtItIoN",12)==0)
{
@@ -44,7 +44,7 @@ static int test_netware(disk_t *disk_car, const struct disk_netware *netware_blo
return 1;
}
-int check_netware(disk_t *disk_car,partition_t *partition,const int verbose)
+int check_netware(disk_t *disk_car, partition_t *partition)
{
unsigned char *buffer=(unsigned char *)MALLOC(DEFAULT_SECTOR_SIZE);
if(disk_car->pread(disk_car, buffer, DEFAULT_SECTOR_SIZE, partition->part_offset) != DEFAULT_SECTOR_SIZE)
@@ -52,7 +52,7 @@ int check_netware(disk_t *disk_car,partition_t *partition,const int verbose)
free(buffer);
return 1;
}
- if(test_netware(disk_car,(const struct disk_netware *)buffer,partition,verbose,0)!=0)
+ if(test_netware((const struct disk_netware *)buffer, partition)!=0)
{
free(buffer);
return 1;
@@ -63,7 +63,7 @@ int check_netware(disk_t *disk_car,partition_t *partition,const int verbose)
int recover_netware(disk_t *disk_car, const struct disk_netware *netware_block,partition_t *partition)
{
- if(test_netware(disk_car,netware_block,partition,0,0)!=0)
+ if(test_netware(netware_block, partition)!=0)
return 1;
partition->part_type_i386=P_NETWARE;
partition->part_size=(uint64_t)le32(netware_block->nbr_sectors) * disk_car->sector_size;
diff --git a/src/netware.h b/src/netware.h
index 6dd5e6c..8fb59c6 100644
--- a/src/netware.h
+++ b/src/netware.h
@@ -32,7 +32,7 @@ typedef struct disk_netware
int32_t nbr_sectors;
} disk_netware;
-int check_netware(disk_t *disk_car,partition_t *partition,const int verbose);
+int check_netware(disk_t *disk_car, partition_t *partition);
int recover_netware(disk_t *disk_car, const struct disk_netware *netware_block, partition_t *partition);
#ifdef __cplusplus
diff --git a/src/ntfs.c b/src/ntfs.c
index d12debf..2556c4e 100644
--- a/src/ntfs.c
+++ b/src/ntfs.c
@@ -47,9 +47,9 @@
extern const arch_fnct_t arch_i386;
extern const arch_fnct_t arch_mac;
-static int set_NTFS_info(disk_t *disk_car, const struct ntfs_boot_sector*ntfs_header,partition_t *partition,const int verbose, const int dump_ind);
-static int ntfs_read_MFT(disk_t *disk_car, partition_t *partition, const struct ntfs_boot_sector*ntfs_header,const int my_type,const int verbose, const int dump_ind);
-static int ntfs_get_attr_aux(const char *attr_record, const int my_type, partition_t *partition, const char *end, const int verbose, const int dump_ind, const char*file_name_to_find);
+static int set_NTFS_info(disk_t *disk_car, const struct ntfs_boot_sector*ntfs_header,partition_t *partition,const int verbose);
+static int ntfs_read_MFT(disk_t *disk_car, partition_t *partition, const struct ntfs_boot_sector*ntfs_header, const int my_type, const int verbose);
+static int ntfs_get_attr_aux(const char *attr_record, const int my_type, partition_t *partition, const char *end, const int verbose, const char*file_name_to_find);
unsigned int ntfs_sector_size(const struct ntfs_boot_sector *ntfs_header)
{ return (ntfs_header->sector_size[1]<<8)+ntfs_header->sector_size[0]; }
@@ -68,7 +68,7 @@ int check_NTFS(disk_t *disk_car,partition_t *partition,const int verbose,const i
free(buffer);
return 1;
}
- set_NTFS_info(disk_car,(struct ntfs_boot_sector*)buffer,partition,verbose,dump_ind);
+ set_NTFS_info(disk_car, (struct ntfs_boot_sector*)buffer, partition, verbose);
free(buffer);
return 0;
}
@@ -107,18 +107,18 @@ int recover_NTFS(disk_t *disk_car, const struct ntfs_boot_sector*ntfs_header,par
partition->part_size=part_size;
partition->part_type_i386=P_NTFS;
partition->part_type_gpt=GPT_ENT_TYPE_MS_BASIC_DATA;
- set_NTFS_info(disk_car,ntfs_header,partition,verbose,dump_ind);
+ set_NTFS_info(disk_car, ntfs_header, partition, verbose);
return 0;
}
-static int set_NTFS_info(disk_t *disk_car, const struct ntfs_boot_sector*ntfs_header,partition_t *partition,const int verbose, const int dump_ind)
+static int set_NTFS_info(disk_t *disk_car, const struct ntfs_boot_sector*ntfs_header,partition_t *partition,const int verbose)
{
partition->fsname[0]='\0';
if(partition->sb_offset==0)
strncpy(partition->info, "NTFS", sizeof(partition->info));
else
strncpy(partition->info, "NTFS found using backup sector!", sizeof(partition->info));
- return ntfs_read_MFT(disk_car, partition, ntfs_header,0x60,verbose,dump_ind);
+ return ntfs_read_MFT(disk_car, partition, ntfs_header, 0x60, verbose);
}
int test_NTFS(const disk_t *disk_car,const struct ntfs_boot_sector*ntfs_header, partition_t *partition,const int verbose, const int dump_ind)
@@ -186,7 +186,7 @@ int test_NTFS(const disk_t *disk_car,const struct ntfs_boot_sector*ntfs_header,
}
/* */
-int ntfs_get_attr(const char *mft_record, const int my_type, partition_t *partition, const char *end, const int verbose, const int dump_ind, const char*file_name_to_find)
+int ntfs_get_attr(const char *mft_record, const int my_type, partition_t *partition, const char *end, const int verbose, const char*file_name_to_find)
{
const char *attr_record;
/* Only check for magic DWORD here, fixup should have happened before */
@@ -200,10 +200,10 @@ int ntfs_get_attr(const char *mft_record, const int my_type, partition_t *partit
/* screen_buffer_add("main MFT record %lu ",NTFS_GETU64(mft_record+0x20)); */
/* location of first attribute */
attr_record= mft_record + NTFS_GETU16(mft_record + 0x14);
- return ntfs_get_attr_aux(attr_record, my_type, partition, end, verbose, dump_ind, file_name_to_find);
+ return ntfs_get_attr_aux(attr_record, my_type, partition, end, verbose, file_name_to_find);
}
-static int ntfs_get_attr_aux(const char *attr_record, const int my_type, partition_t *partition, const char *end, const int verbose, const int dump_ind, const char*file_name_to_find)
+static int ntfs_get_attr_aux(const char *attr_record, const int my_type, partition_t *partition, const char *end, const int verbose, const char*file_name_to_find)
{
int attr_type;
while(1)
@@ -398,7 +398,7 @@ static int ntfs_get_attr_aux(const char *attr_record, const int my_type, partiti
}
}
-static int ntfs_read_MFT(disk_t *disk_car, partition_t *partition, const struct ntfs_boot_sector*ntfs_header,const int my_type,const int verbose, const int dump_ind)
+static int ntfs_read_MFT(disk_t *disk_car, partition_t *partition, const struct ntfs_boot_sector*ntfs_header, const int my_type, const int verbose)
{
unsigned char *buffer;
char *attr;
@@ -424,7 +424,7 @@ static int ntfs_read_MFT(disk_t *disk_car, partition_t *partition, const struct
return 1;
}
buffer=(unsigned char *)MALLOC(mft_size);
- if(disk_car->pread(disk_car, buffer, mft_size, mft_pos) != mft_size)
+ if((unsigned)disk_car->pread(disk_car, buffer, mft_size, mft_pos) != mft_size)
{
log_error("NTFS: Can't read MFT\n");
free(buffer);
@@ -433,7 +433,7 @@ static int ntfs_read_MFT(disk_t *disk_car, partition_t *partition, const struct
attr=(char*)buffer;
while(attr+0x30<=(char*)(buffer+mft_size))
{
- int res=ntfs_get_attr(attr,my_type,partition,(char*)buffer+mft_size,verbose,dump_ind,NULL);
+ int res=ntfs_get_attr(attr, my_type, partition, (char*)buffer+mft_size, verbose, NULL);
if((res>0)|| (NTFS_GETU32(attr + 0x1C)<0x30))
{
free(buffer);
diff --git a/src/ntfs.h b/src/ntfs.h
index 8916595..bdcdc31 100644
--- a/src/ntfs.h
+++ b/src/ntfs.h
@@ -60,7 +60,7 @@ int log_ntfs2_info(const struct ntfs_boot_sector *nh1, const struct ntfs_boot_se
int log_ntfs_info(const struct ntfs_boot_sector *ntfs_header);
int is_ntfs(const partition_t *partition);
int is_part_ntfs(const partition_t *partition);
-int ntfs_get_attr(const char *mft_record, const int my_type, partition_t *partition, const char *end, const int verbose, const int dump_ind, const char*file_name_to_find);
+int ntfs_get_attr(const char *mft_record, const int my_type, partition_t *partition, const char *end, const int verbose, const char*file_name_to_find);
int recover_NTFS(disk_t *disk_car, const struct ntfs_boot_sector*ntfs_header,partition_t *partition,const int verbose, const int dump_ind, const int backup);
int test_NTFS(const disk_t *disk_car,const struct ntfs_boot_sector*ntfs_header, partition_t *partition,const int verbose, const int dump_ind);
#define NTFS_GETU8(p) (*(const uint8_t*)(p))
@@ -68,8 +68,8 @@ int test_NTFS(const disk_t *disk_car,const struct ntfs_boot_sector*ntfs_header,
#define NTFS_GETU32(p) (le32(*(const uint32_t*)(p)))
#define NTFS_GETU64(p) (le64(*(const uint64_t*)(p)))
unsigned int ntfs_sector_size(const struct ntfs_boot_sector *ntfs_header);
-int rebuild_NTFS_BS(disk_t *disk_car,partition_t *partition, const int verbose, const int dump_ind,const int interface, const unsigned int expert, char**current_cmd);
-int repair_MFT(disk_t *disk_car, partition_t *partition, const int verbose, const unsigned int expert, char **current_cmd);
+int rebuild_NTFS_BS(disk_t *disk_car,partition_t *partition, const int verbose, const int interface, const unsigned int expert, char**current_cmd);
+int repair_MFT(disk_t *disk_car, partition_t *partition, const int verbose, const unsigned int expert);
int repair_MFT_Vol(disk_t *disk_car, partition_t *partition, const int verbose);
#ifdef __cplusplus
diff --git a/src/ntfs_adv.c b/src/ntfs_adv.c
index 814877b..4e2f977 100644
--- a/src/ntfs_adv.c
+++ b/src/ntfs_adv.c
@@ -37,7 +37,6 @@
#include "intrfn.h"
#include "dirpart.h"
#include "ntfs.h"
-#include "fnctdsk.h"
#include "lang.h"
#include "io_redir.h"
#include "log.h"
@@ -312,10 +311,10 @@ static int create_ntfs_boot_sector(disk_t *disk_car, partition_t *partition, con
ntfs_header->sectors_nbr=le64(partition->part_size/disk_car->sector_size-1);
ntfs_header->mft_lcn=le64(mft_lcn);
ntfs_header->mftmirr_lcn=le64(mftmirr_lcn);
- ntfs_header->clusters_per_mft_record=(mft_record_size >= cluster_size?mft_record_size / cluster_size:
- -(testdisk_ffs(mft_record_size) - 1));
- ntfs_header->clusters_per_index_record =(index_block_size >= cluster_size?index_block_size / cluster_size:
- -(testdisk_ffs(index_block_size) - 1));
+ ntfs_header->clusters_per_mft_record=(mft_record_size >= cluster_size ?
+ mft_record_size / cluster_size : -(testdisk_ffs(mft_record_size) - 1));
+ ntfs_header->clusters_per_index_record =(index_block_size >= cluster_size ?
+ index_block_size / cluster_size : -(testdisk_ffs(index_block_size) - 1));
ntfs_header->reserved0[0]=0;
ntfs_header->reserved0[1]=0;
ntfs_header->reserved0[2]=0;
@@ -360,7 +359,7 @@ static int read_mft_info(disk_t *disk_car, partition_t *partition, const uint64_
display_message("NTFS: Can't read mft_sector\n");
return 1;
}
- *mft_lcn=ntfs_get_attr(attr,0x80,partition,buffer+8*DEFAULT_SECTOR_SIZE,verbose,0,NULL);
+ *mft_lcn=ntfs_get_attr(attr, 0x80, partition, buffer+8*DEFAULT_SECTOR_SIZE, verbose, NULL);
*mft_record_size=NTFS_GETU32(attr + 0x1C);
if(*mft_record_size==0)
{
@@ -369,7 +368,7 @@ static int read_mft_info(disk_t *disk_car, partition_t *partition, const uint64_
return 2;
}
attr+= NTFS_GETU32(attr + 0x1C);
- *mftmirr_lcn=ntfs_get_attr(attr,0x80,partition,buffer+8*DEFAULT_SECTOR_SIZE,verbose,0,NULL);
+ *mftmirr_lcn=ntfs_get_attr(attr, 0x80, partition,buffer+8*DEFAULT_SECTOR_SIZE, verbose, NULL);
/* Try to divide by the biggest number first */
if(*mft_lcn<*mftmirr_lcn)
{
@@ -434,7 +433,7 @@ static int read_mft_info(disk_t *disk_car, partition_t *partition, const uint64_
return 3;
}
-int rebuild_NTFS_BS(disk_t *disk_car, partition_t *partition, const int verbose, const int dump_ind,const int interface, const unsigned int expert, char **current_cmd)
+int rebuild_NTFS_BS(disk_t *disk_car, partition_t *partition, const int verbose, const int interface, const unsigned int expert, char **current_cmd)
{
uint64_t sector;
char buffer[8*DEFAULT_SECTOR_SIZE];
@@ -470,7 +469,7 @@ int rebuild_NTFS_BS(disk_t *disk_car, partition_t *partition, const int verbose,
&&(NTFS_GETU16(buffer+22)==1)) /* MFT_RECORD_IN_USE */
{
int res;
- res=ntfs_get_attr(buffer,0x30,partition,buffer+2*DEFAULT_SECTOR_SIZE,verbose,0,"$MFT");
+ res=ntfs_get_attr(buffer, 0x30, partition, buffer+2*DEFAULT_SECTOR_SIZE, verbose, "$MFT");
if(res==1)
{
int tmp;
@@ -524,7 +523,7 @@ int rebuild_NTFS_BS(disk_t *disk_car, partition_t *partition, const int verbose,
if(memcmp(buffer,"FILE",4)==0 && (NTFS_GETU16(buffer+ 0x14)%8==0) && (NTFS_GETU16(buffer+ 0x14)>=42))
{
int res;
- res=ntfs_get_attr(buffer,0x30,partition,buffer+2*DEFAULT_SECTOR_SIZE,verbose,0,"$MFT");
+ res=ntfs_get_attr(buffer, 0x30, partition, buffer+2*DEFAULT_SECTOR_SIZE, verbose, "$MFT");
if(res==1)
{
int tmp;
@@ -632,12 +631,12 @@ int rebuild_NTFS_BS(disk_t *disk_car, partition_t *partition, const int verbose,
log_info("ntfs_find_mft: mftmirr_lcn %lu\n",(long unsigned int)mftmirr_lcn);
log_info("ntfs_find_mft: mft_record_size %u\n",mft_record_size);
/* Read "root directory" in MFT */
- if(disk_car->pread(disk_car, &buffer, mft_record_size, partition->part_offset + (uint64_t)mft_lcn * sectors_per_cluster * disk_car->sector_size + 5 * (uint64_t)mft_record_size) != mft_record_size)
+ if((unsigned)disk_car->pread(disk_car, &buffer, mft_record_size, partition->part_offset + (uint64_t)mft_lcn * sectors_per_cluster * disk_car->sector_size + 5 * (uint64_t)mft_record_size) != mft_record_size)
{
display_message("NTFS Can't read \"root directory\" in MFT\n");
return 1;
}
- index_block_size=ntfs_get_attr(buffer,0x90,partition,buffer+mft_record_size,verbose,0,NULL);
+ index_block_size=ntfs_get_attr(buffer, 0x90, partition, buffer+mft_record_size, verbose, NULL);
if(index_block_size%512!=0)
index_block_size=4096;
log_info("ntfs_find_mft: index_block_size %u\n",index_block_size);
diff --git a/src/ntfs_fix.c b/src/ntfs_fix.c
index 956e7d3..004fc8a 100644
--- a/src/ntfs_fix.c
+++ b/src/ntfs_fix.c
@@ -49,7 +49,7 @@
#define INTER_MFT_X 0
#define INTER_MFT_Y 18
-int repair_MFT(disk_t *disk_car, partition_t *partition, const int verbose, const unsigned int expert, char **current_cmd)
+int repair_MFT(disk_t *disk_car, partition_t *partition, const int verbose, const unsigned int expert)
{
struct ntfs_boot_sector *ntfs_header;
unsigned char *buffer_mft;
@@ -103,7 +103,7 @@ int repair_MFT(disk_t *disk_car, partition_t *partition, const int verbose, cons
}
/* Check if MFT mirror is identical to the beginning of MFT */
buffer_mft=(unsigned char *)MALLOC(mftmirr_size_bytes);
- if(disk_car->pread(disk_car, buffer_mft, mftmirr_size_bytes, mft_pos) != mftmirr_size_bytes)
+ if((unsigned)disk_car->pread(disk_car, buffer_mft, mftmirr_size_bytes, mft_pos) != mftmirr_size_bytes)
{
display_message("Can't read NTFS MFT.\n");
log_error("Can't read NTFS MFT.\n");
@@ -112,7 +112,7 @@ int repair_MFT(disk_t *disk_car, partition_t *partition, const int verbose, cons
return -1;
}
buffer_mftmirr=(unsigned char *)MALLOC(mftmirr_size_bytes);
- if(disk_car->pread(disk_car, buffer_mftmirr, mftmirr_size_bytes, mftmirr_pos) != mftmirr_size_bytes)
+ if((unsigned)disk_car->pread(disk_car, buffer_mftmirr, mftmirr_size_bytes, mftmirr_pos) != mftmirr_size_bytes)
{
display_message("Can't read NTFS MFT mirror.\n");
log_error("Can't read NTFS MFT mirror.\n");
@@ -174,7 +174,7 @@ int repair_MFT(disk_t *disk_car, partition_t *partition, const int verbose, cons
if(dir_list!=NULL)
{
log_info("NTFS listing using MFT:\n");
- dir_aff_log(disk_car, partition, &dir_data, dir_list);
+ dir_aff_log(&dir_data, dir_list);
if(delete_list_file(dir_list)>2)
res1++;
}
@@ -191,7 +191,7 @@ int repair_MFT(disk_t *disk_car, partition_t *partition, const int verbose, cons
if(dir_list!=NULL)
{
log_info("NTFS listing using MFT mirror:\n");
- dir_aff_log(disk_car, partition, &dir_data, dir_list);
+ dir_aff_log(&dir_data, dir_list);
if(delete_list_file(dir_list)>2)
res2++;
}
@@ -278,7 +278,7 @@ int repair_MFT(disk_t *disk_car, partition_t *partition, const int verbose, cons
}
if(use_MFT==2)
{
- if(disk_car->pwrite(disk_car, buffer_mftmirr, mftmirr_size_bytes, mft_pos) != mftmirr_size_bytes)
+ if((unsigned)disk_car->pwrite(disk_car, buffer_mftmirr, mftmirr_size_bytes, mft_pos) != mftmirr_size_bytes)
{
display_message("Failed to fix MFT: write error.\n");
}
@@ -290,7 +290,7 @@ int repair_MFT(disk_t *disk_car, partition_t *partition, const int verbose, cons
}
else if(use_MFT==1)
{
- if(disk_car->pwrite(disk_car, buffer_mft, mftmirr_size_bytes, mftmirr_pos) != mftmirr_size_bytes)
+ if((unsigned)disk_car->pwrite(disk_car, buffer_mft, mftmirr_size_bytes, mftmirr_pos) != mftmirr_size_bytes)
{
display_message("Failed to fix MFT mirror: write error.\n");
}
diff --git a/src/ntfs_udl.c b/src/ntfs_udl.c
index 90424f7..1bdeea1 100644
--- a/src/ntfs_udl.c
+++ b/src/ntfs_udl.c
@@ -32,7 +32,6 @@
#ifdef HAVE_FEATURES_H
#include <features.h>
#endif
-#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
@@ -93,7 +92,6 @@
#include "ntfs_inc.h"
#include "ntfs_dir.h"
#include "ntfs_utl.h"
-#include "dir.h"
#include "askloc.h"
extern const char *monstr[];
@@ -319,7 +317,7 @@ static void get_parent_name(struct filename* name, ntfs_volume* vol)
free(name->parent_name);
name->parent_name=npn;
}
- if(inode_num!=MREF(filename_attr->parent_directory))
+ if((unsigned)inode_num!=MREF(filename_attr->parent_directory))
{
inode_num=MREF(filename_attr->parent_directory);
ok=1;
@@ -1052,7 +1050,7 @@ free:
static file_info_t *ufile_to_file_data(const struct ufile *file)
{
file_info_t *new_file;
- int len;
+ unsigned int len;
if(file->pref_name==NULL)
return NULL;
new_file=(file_info_t *)MALLOC(sizeof(*new_file));
diff --git a/src/ntfs_utl.c b/src/ntfs_utl.c
index c4e3582..a82dfb8 100644
--- a/src/ntfs_utl.c
+++ b/src/ntfs_utl.c
@@ -159,7 +159,7 @@ int utils_cluster_in_use(ntfs_volume *vol, long long lcn)
}
/* Does lcn lie in the section of $Bitmap we already have cached? */
- if ((bmplcn <0 ) || (lcn < bmplcn) || (lcn >= (bmplcn + (sizeof(buffer) << 3)))) {
+ if ((bmplcn <0 ) ||(lcn < (unsigned)bmplcn) || (lcn >= ((unsigned)bmplcn + ((unsigned)sizeof(buffer) << 3)))) {
ntfs_attr *attr;
#ifdef DEBUG_NTFS
log_debug("Bit lies outside cache.\n");
diff --git a/src/ntfsp.c b/src/ntfsp.c
index 86d5e9a..a26eba5 100644
--- a/src/ntfsp.c
+++ b/src/ntfsp.c
@@ -87,7 +87,7 @@ unsigned int ntfs_remove_used_space(disk_t *disk_car,const partition_t *partitio
{
static long long int bmplcn = - (SIZEOF_BUFFER << 3); /* Which bit of $Bitmap is in the buffer */
int byte, bit;
- if ((lcn < bmplcn) || (lcn >= (bmplcn + (SIZEOF_BUFFER << 3))))
+ if ((bmplcn < 0) || (lcn < (unsigned)bmplcn) || (lcn >= ((unsigned)bmplcn + (SIZEOF_BUFFER << 3))))
{
ntfs_attr *attr;
/* Mark the buffer as not in use, in case the read is shorter. */
diff --git a/src/partauto.c b/src/partauto.c
index 50c204b..8704f6f 100644
--- a/src/partauto.c
+++ b/src/partauto.c
@@ -24,9 +24,6 @@
#include <config.h>
#endif
#include <stdio.h>
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
diff --git a/src/partgpt.c b/src/partgpt.c
index 6615d50..b32e383 100644
--- a/src/partgpt.c
+++ b/src/partgpt.c
@@ -43,7 +43,6 @@
#include <sys/uuid.h>
#endif
#include "common.h"
-#include "testdisk.h"
#include "fnctdsk.h"
#include "lang.h"
#include "intrf.h"
@@ -53,8 +52,6 @@
#include "cramfs.h"
#include "ext2.h"
#include "fat.h"
-#include "hfs.h"
-#include "hfsp.h"
#include "jfs_superblock.h"
#include "jfs.h"
#include "ntfs.h"
@@ -66,7 +63,6 @@
#include "guid_cpy.h"
#include "unicode.h"
#include "crc.h"
-#include "partgptn.h"
extern const arch_fnct_t arch_i386;
@@ -164,7 +160,7 @@ list_part_t *read_part_gpt(disk_t *disk_car, const int verbose, const int savehe
gpt=(struct gpt_hdr*)MALLOC(disk_car->sector_size);
screen_buffer_reset();
- if(disk_car->pread(disk_car, gpt, disk_car->sector_size, disk_car->sector_size) != disk_car->sector_size)
+ if((unsigned)disk_car->pread(disk_car, gpt, disk_car->sector_size, disk_car->sector_size) != disk_car->sector_size)
{
free(gpt);
return NULL;
@@ -262,7 +258,7 @@ list_part_t *read_part_gpt(disk_t *disk_car, const int verbose, const int savehe
}
gpt_entries=(struct gpt_ent*)MALLOC(gpt_entries_size);
- if(disk_car->pread(disk_car, gpt_entries, gpt_entries_size, gpt_entries_offset) != gpt_entries_size)
+ if((unsigned)disk_car->pread(disk_car, gpt_entries, gpt_entries_size, gpt_entries_offset) != gpt_entries_size)
{
free(gpt_entries);
free(gpt);
@@ -479,13 +475,13 @@ static int write_part_gpt(disk_t *disk_car, const list_part_t *list_part, const
gpt->hdr_lba_alt=le64((disk_car->disk_size-1)/disk_car->sector_size);
gpt->hdr_lba_table=le64(1+1);
gpt->hdr_crc_self=le32(get_crc32(gpt, le32(gpt->hdr_size), 0xFFFFFFFF)^0xFFFFFFFF);
- if(disk_car->pwrite(disk_car, gpt_entries, gpt_entries_size, le64(gpt->hdr_lba_table) * disk_car->sector_size) != gpt_entries_size)
+ if((unsigned)disk_car->pwrite(disk_car, gpt_entries, gpt_entries_size, le64(gpt->hdr_lba_table) * disk_car->sector_size) != gpt_entries_size)
{
free(gpt);
free(gpt_entries);
return 1;
}
- if(disk_car->pwrite(disk_car, gpt, disk_car->sector_size, le64(gpt->hdr_lba_self) * disk_car->sector_size) != disk_car->sector_size)
+ if((unsigned)disk_car->pwrite(disk_car, gpt, disk_car->sector_size, le64(gpt->hdr_lba_self) * disk_car->sector_size) != disk_car->sector_size)
{
free(gpt);
free(gpt_entries);
@@ -495,13 +491,13 @@ static int write_part_gpt(disk_t *disk_car, const list_part_t *list_part, const
gpt->hdr_lba_alt=le64(1);
gpt->hdr_lba_table=le64((disk_car->disk_size-1 - gpt_entries_size)/disk_car->sector_size);
gpt->hdr_crc_self=le32(get_crc32(gpt, le32(gpt->hdr_size), 0xFFFFFFFF)^0xFFFFFFFF);
- if(disk_car->pwrite(disk_car, gpt_entries, gpt_entries_size, le64(gpt->hdr_lba_table) * disk_car->sector_size) != gpt_entries_size)
+ if((unsigned)disk_car->pwrite(disk_car, gpt_entries, gpt_entries_size, le64(gpt->hdr_lba_table) * disk_car->sector_size) != gpt_entries_size)
{
free(gpt);
free(gpt_entries);
return 1;
}
- if(disk_car->pwrite(disk_car, gpt, disk_car->sector_size, le64(gpt->hdr_lba_self) * disk_car->sector_size) != disk_car->sector_size)
+ if((unsigned)disk_car->pwrite(disk_car, gpt, disk_car->sector_size, le64(gpt->hdr_lba_self) * disk_car->sector_size) != disk_car->sector_size)
{
free(gpt);
free(gpt_entries);
@@ -656,7 +652,7 @@ static int check_part_gpt(disk_t *disk_car,const int verbose,partition_t *partit
if(ret!=0)
ret=check_NTFS(disk_car,partition,verbose,0);
if(ret!=0)
- ret=check_JFS(disk_car,partition,verbose);
+ ret=check_JFS(disk_car, partition);
if(ret!=0)
ret=check_rfs(disk_car,partition,verbose);
if(ret!=0)
diff --git a/src/partgptn.c b/src/partgptn.c
index 729a67f..392bf4e 100644
--- a/src/partgptn.c
+++ b/src/partgptn.c
@@ -32,7 +32,6 @@
#ifdef HAVE_STRING_H
#include <string.h>
#endif
-#include <ctype.h> /* tolower */
#include "types.h"
#if defined(HAVE_UUID_H)
#include <uuid.h>
@@ -43,30 +42,11 @@
#include <sys/uuid.h>
#endif
#include "common.h"
-#include "testdisk.h"
#include "fnctdsk.h"
-#include "lang.h"
#include "intrf.h"
#include "intrfn.h"
#include "chgtypen.h"
-#include "partgpt.h"
-#include "savehdr.h"
-#include "cramfs.h"
-#include "ext2.h"
-#include "fat.h"
-#include "hfs.h"
-#include "hfsp.h"
-#include "jfs_superblock.h"
-#include "jfs.h"
-#include "ntfs.h"
-#include "rfs.h"
-#include "xfs.h"
-#include "log.h"
-#include "log_part.h"
#include "guid_cmp.h"
-#include "guid_cpy.h"
-#include "unicode.h"
-#include "crc.h"
#include "partgptn.h"
extern const arch_fnct_t arch_gpt;
diff --git a/src/parti386.c b/src/parti386.c
index a250946..75d8fb1 100644
--- a/src/parti386.c
+++ b/src/parti386.c
@@ -35,7 +35,6 @@
#include <ctype.h> /* tolower */
#include "types.h"
#include "common.h"
-#include "testdisk.h"
#include "fnctdsk.h"
#include "lang.h"
#include "intrf.h"
@@ -58,7 +57,6 @@
#include "rfs.h"
#include "sun.h"
#include "swap.h"
-#include "ufs.h"
#include "xfs.h"
#include "log.h"
#include "parti386.h"
@@ -85,21 +83,19 @@ struct partition_dos {
#define s_cyl(p) (((p)->cyl & (unsigned)0xff) | (((p)->sector << 2) & (unsigned)0x300))
-#define s_head(p) ((p)->head)
#define s_sect(p) ((p)->sector & (unsigned)0x3f)
#define e_cyl(p) (((p)->end_cyl & (unsigned)0xff) | (((p)->end_sector << 2) & (unsigned)0x300))
-#define e_head(p) ((p)->end_head)
#define e_sect(p) ((p)->end_sector & (unsigned)0x3f)
static uint64_t get_start_sect(const struct partition_dos *p);
static uint64_t get_nr_sects(const struct partition_dos *p);
-static void log_dos_entry(const disk_t *disk_car, const struct partition_dos*);
+static void log_dos_entry(const struct partition_dos*);
static int get_geometry_from_i386mbr(const unsigned char *buffer, const int verbose, CHSgeometry_t *geometry);
static list_part_t *get_ext_data_i386(disk_t *disk_car, list_part_t *list_part, const int verbose, const int saveheader);
static void test_MBR_data(list_part_t *list_part);
static int test_MBR_over(disk_t *disk_car,list_part_t *list_part);
static int write_mbr_i386(disk_t *disk_car, const list_part_t *list_part, const int ro, const int verbose);
-static int write_all_log_i386(disk_t *disk_car, const list_part_t *list_part, const int ro , const int verbose, const int align);
-static int diff(const disk_t *disk_car,const unsigned char buffer[DEFAULT_SECTOR_SIZE], const unsigned char buffer_org[DEFAULT_SECTOR_SIZE]);
+static int write_all_log_i386(disk_t *disk_car, const list_part_t *list_part, const int ro , const int verbose);
+static int diff(const unsigned char buffer[DEFAULT_SECTOR_SIZE], const unsigned char buffer_org[DEFAULT_SECTOR_SIZE]);
static list_part_t *read_part_i386(disk_t *disk_car, const int verbose, const int saveheader);
static int write_part_i386(disk_t *disk_car, const list_part_t *list_part, const int ro , const int verbose, const int align);
@@ -301,8 +297,8 @@ int get_geometry_from_i386mbr(const unsigned char *buffer, const int verbose, CH
{
if(geometry->cylinders<e_cyl(p)+1)
geometry->cylinders=e_cyl(p)+1;
- if(geometry->heads_per_cylinder<e_head(p)+1)
- geometry->heads_per_cylinder=e_head(p)+1;
+ if(geometry->heads_per_cylinder < (unsigned int)p->end_head+1)
+ geometry->heads_per_cylinder= (unsigned int)p->end_head+1;
if(geometry->sectors_per_head<e_sect(p))
geometry->sectors_per_head=e_sect(p);
}
@@ -363,7 +359,7 @@ static list_part_t *read_part_i386(disk_t *disk_car, const int verbose, const in
list_part_t *new_list_part=NULL;
unsigned char *buffer=(unsigned char *)MALLOC(disk_car->sector_size);
screen_buffer_reset();
- if(disk_car->pread(disk_car, buffer, disk_car->sector_size, (uint64_t)0) != disk_car->sector_size)
+ if((unsigned)disk_car->pread(disk_car, buffer, disk_car->sector_size, (uint64_t)0) != disk_car->sector_size)
{
screen_buffer_add( msg_PART_RD_ERR);
free(buffer);
@@ -397,7 +393,7 @@ static list_part_t *read_part_i386(disk_t *disk_car, const int verbose, const in
partition_t *new_partition=partition_new(&arch_i386);
i386_entry2partition(disk_car, (uint64_t)0, new_partition, p, status,i+1,verbose,saveheader);
if(verbose>1)
- log_dos_entry(disk_car,p);
+ log_dos_entry(p);
aff_part_buffer(AFF_PART_ORDER|AFF_PART_STATUS,disk_car,new_partition);
if(new_partition->errcode!=BAD_NOERR)
{
@@ -545,7 +541,7 @@ static list_part_t *get_ext_data_i386(disk_t *disk_car, list_part_t *list_part,
partition_t *new_partition=partition_new(&arch_i386);
new_partition->order=order;
if(verbose>1)
- log_dos_entry(disk_car,p);
+ log_dos_entry(p);
if(is_extended(p->sys_ind))
{
partition_next_ext=new_partition;
@@ -587,7 +583,7 @@ static list_part_t *get_ext_data_i386(disk_t *disk_car, list_part_t *list_part,
i386_entry2partition(disk_car,partition_ext->part_offset, new_partition, p, STATUS_LOG,order,verbose,saveheader);
order++;
if(verbose>1)
- log_dos_entry(disk_car,p);
+ log_dos_entry(p);
aff_part_buffer(AFF_PART_ORDER|AFF_PART_STATUS,disk_car,new_partition);
if(new_partition->errcode!=BAD_NOERR)
{
@@ -634,7 +630,7 @@ int write_part_i386(disk_t *disk_car, const list_part_t *list_part, const int ro
{
int res=0;
res+=write_mbr_i386(disk_car,list_part,ro,verbose);
- res+=write_all_log_i386(disk_car,list_part,ro,verbose,align);
+ res+=write_all_log_i386(disk_car,list_part,ro,verbose);
disk_car->sync(disk_car);
return res;
}
@@ -696,9 +692,9 @@ static int write_mbr_i386(disk_t *disk_car, const list_part_t *list_part, const
for(i=0;i<4;i++)
{
const struct partition_dos *p=pt_offset(buffer,i);
- log_dos_entry(disk_car,p);
+ log_dos_entry(p);
}
- diff(disk_car,buffer,buffer_org);
+ diff(buffer, buffer_org);
}
if(ro==0)
{
@@ -714,7 +710,7 @@ static int write_mbr_i386(disk_t *disk_car, const list_part_t *list_part, const
return 0;
}
-static int write_all_log_i386(disk_t *disk_car, const list_part_t *list_part, const int ro, const int verbose, const int align)
+static int write_all_log_i386(disk_t *disk_car, const list_part_t *list_part, const int ro, const int verbose)
{
const list_part_t *element;
const list_part_t *pos_ext=NULL;
@@ -766,7 +762,7 @@ static int write_all_log_i386(disk_t *disk_car, const list_part_t *list_part, co
if(ro)
{
if(verbose>1)
- diff(disk_car,buffer,buffer_org);
+ diff(buffer, buffer_org);
}
else
{
@@ -846,9 +842,9 @@ static int write_all_log_i386(disk_t *disk_car, const list_part_t *list_part, co
{
const struct partition_dos *p=pt_offset(buffer,j);
if(p->sys_ind!=0)
- log_dos_entry(disk_car,p);
+ log_dos_entry(p);
}
- diff(disk_car,buffer,buffer_org);
+ diff(buffer, buffer_org);
}
}
else
@@ -865,7 +861,7 @@ static int write_all_log_i386(disk_t *disk_car, const list_part_t *list_part, co
return res;
}
-static int diff(const disk_t *disk_car, const unsigned char buffer[DEFAULT_SECTOR_SIZE], const unsigned char buffer_org[DEFAULT_SECTOR_SIZE])
+static int diff(const unsigned char buffer[DEFAULT_SECTOR_SIZE], const unsigned char buffer_org[DEFAULT_SECTOR_SIZE])
{
int j;
if(memcmp(buffer,buffer_org,DEFAULT_SECTOR_SIZE))
@@ -876,14 +872,14 @@ static int diff(const disk_t *disk_car, const unsigned char buffer[DEFAULT_SECTO
{
const struct partition_dos *p=pt_offset_const(buffer_org,j);
if(p->sys_ind!=0)
- log_dos_entry(disk_car,p);
+ log_dos_entry(p);
}
log_info("buffer\n");
for(j=0;j<4;j++)
{
const struct partition_dos *p=pt_offset_const(buffer,j);
if(p->sys_ind!=0)
- log_dos_entry(disk_car,p);
+ log_dos_entry(p);
}
for(j=0;j<DEFAULT_SECTOR_SIZE;j++)
if(buffer_org[j]!=buffer[j])
@@ -1014,10 +1010,10 @@ static int i386_entry2partition(disk_t *disk_car, const uint64_t offset, partiti
start.cylinder=s_cyl(p);
- start.head=s_head(p);
+ start.head=p->head;
start.sector=s_sect(p);
end.cylinder=e_cyl(p);
- end.head=e_head(p);
+ end.head=p->end_head;
end.sector=e_sect(p);
switch(status)
{
@@ -1107,7 +1103,7 @@ static const char* errmsg_i386_entry2partition(const errcode_type_t errcode)
return "";
}
-static void log_dos_entry(const disk_t *disk_car, const struct partition_dos *entree)
+static void log_dos_entry(const struct partition_dos *entree)
{
if(get_partition_typename_i386_aux(entree->sys_ind)!=NULL)
log_info(" %-20s ", get_partition_typename_i386_aux(entree->sys_ind));
@@ -1117,8 +1113,8 @@ static void log_dos_entry(const disk_t *disk_car, const struct partition_dos *en
" %4u %3u %2u"
" %10lu"
" %10lu\n",
- s_cyl(entree),s_head(entree),s_sect(entree),
- e_cyl(entree),e_head(entree),e_sect(entree),
+ s_cyl(entree), entree->head, s_sect(entree),
+ e_cyl(entree), entree->end_head, e_sect(entree),
(long unsigned)get_start_sect(entree),(long unsigned)get_nr_sects(entree));
}
@@ -1459,7 +1455,7 @@ static int check_part_i386(disk_t *disk_car,const int verbose,partition_t *parti
switch(partition->part_type_i386)
{
case P_BEOS:
- ret=check_BeFS(disk_car,partition,verbose);
+ ret=check_BeFS(disk_car,partition);
break;
case P_12FAT:
case P_16FAT:
@@ -1490,7 +1486,7 @@ static int check_part_i386(disk_t *disk_car,const int verbose,partition_t *parti
}
break;
case P_LINUX:
- ret=check_JFS(disk_car,partition,verbose);
+ ret=check_JFS(disk_car, partition);
if(ret!=0)
{
ret=check_rfs(disk_car,partition,verbose);
@@ -1509,13 +1505,13 @@ static int check_part_i386(disk_t *disk_car,const int verbose,partition_t *parti
}
if(ret!=0)
{
- ret=check_LUKS(disk_car,partition,verbose);
+ ret=check_LUKS(disk_car,partition);
}
if(ret!=0)
{ screen_buffer_add("No EXT2, JFS, Reiser, cramfs or XFS marker\n"); }
break;
case P_LINSWAP:
- ret=check_Linux_SWAP(disk_car,partition,verbose);
+ ret=check_Linux_SWAP(disk_car, partition);
break;
case P_LVM:
ret=check_LVM(disk_car,partition,verbose);
@@ -1549,7 +1545,7 @@ static int check_part_i386(disk_t *disk_car,const int verbose,partition_t *parti
case P_LINUXEXTENDX:
break;
case P_NETWARE:
- /* res=check_netware(disk_car, partition, verbose); */
+ /* res=check_netware(disk_car, partition); */
break;
default:
if(verbose>0)
diff --git a/src/partmac.c b/src/partmac.c
index 4ba254c..df3bb20 100644
--- a/src/partmac.c
+++ b/src/partmac.c
@@ -35,7 +35,6 @@
#include <ctype.h> /* tolower */
#include "types.h"
#include "common.h"
-#include "testdisk.h"
#include "fnctdsk.h"
#include "lang.h"
#include "intrf.h"
@@ -364,7 +363,7 @@ static int check_part_mac(disk_t *disk_car,const int verbose,partition_t *partit
case PMAC_PRODOS:
break;
case PMAC_LINUX:
- ret=check_JFS(disk_car,partition,verbose);
+ ret=check_JFS(disk_car, partition);
if(ret!=0)
{
ret=check_rfs(disk_car,partition,verbose);
diff --git a/src/partnone.c b/src/partnone.c
index 7b8e729..b510159 100644
--- a/src/partnone.c
+++ b/src/partnone.c
@@ -35,13 +35,10 @@
#include <ctype.h> /* tolower */
#include "types.h"
#include "common.h"
-#include "testdisk.h"
#include "fnctdsk.h"
#include "analyse.h"
#include "lang.h"
#include "intrf.h"
-#include "chgtype.h"
-#include "savehdr.h"
#include "bfs.h"
#include "bsd.h"
#include "cramfs.h"
@@ -50,6 +47,7 @@
#include "fatx.h"
#include "hfs.h"
#include "hfsp.h"
+#include "hpfs.h"
#include "jfs_superblock.h"
#include "jfs.h"
#include "luks.h"
@@ -250,7 +248,7 @@ static int check_part_none(disk_t *disk_car,const int verbose,partition_t *parti
switch(partition->upart_type)
{
case UP_BEOS:
- ret=check_BeFS(disk_car,partition,verbose);
+ ret=check_BeFS(disk_car,partition);
break;
case UP_CRAMFS:
ret=check_cramfs(disk_car,partition,verbose);
@@ -268,7 +266,7 @@ static int check_part_none(disk_t *disk_car,const int verbose,partition_t *parti
ret=check_FAT(disk_car,partition,verbose);
break;
case UP_FATX:
- ret=check_FATX(disk_car,partition,verbose);
+ ret=check_FATX(disk_car, partition);
break;
case UP_FREEBSD:
ret=check_BSD(disk_car,partition,verbose,BSD_MAXPARTITIONS);
@@ -284,14 +282,14 @@ static int check_part_none(disk_t *disk_car,const int verbose,partition_t *parti
ret=check_HPFS(disk_car,partition,verbose);
break;
case UP_JFS:
- ret=check_JFS(disk_car,partition,verbose);
+ ret=check_JFS(disk_car, partition);
break;
case UP_LINSWAP:
case UP_LINSWAP2:
- ret=check_Linux_SWAP(disk_car,partition,verbose);
+ ret=check_Linux_SWAP(disk_car, partition);
break;
case UP_LUKS:
- ret=check_LUKS(disk_car, partition, verbose);
+ ret=check_LUKS(disk_car, partition);
break;
case UP_LVM:
ret=check_LVM(disk_car,partition,verbose);
@@ -300,7 +298,7 @@ static int check_part_none(disk_t *disk_car,const int verbose,partition_t *parti
ret=check_LVM2(disk_car,partition,verbose);
break;
case UP_NETWARE:
- ret=check_netware(disk_car,partition,verbose);
+ ret=check_netware(disk_car, partition);
break;
case UP_NTFS:
ret=check_NTFS(disk_car,partition,verbose,0);
diff --git a/src/partsun.c b/src/partsun.c
index 64517e4..9f0f6ad 100644
--- a/src/partsun.c
+++ b/src/partsun.c
@@ -35,7 +35,6 @@
#include <ctype.h> /* tolower */
#include "types.h"
#include "common.h"
-#include "testdisk.h"
#include "fnctdsk.h"
#include "lang.h"
#include "intrf.h"
@@ -355,7 +354,7 @@ static int check_part_sun(disk_t *disk_car,const int verbose,partition_t *partit
ret=check_ufs(disk_car,partition,verbose);
break;
case PSUN_LINUX:
- ret=check_JFS(disk_car,partition,verbose);
+ ret=check_JFS(disk_car, partition);
if(ret!=0)
{
ret=check_rfs(disk_car,partition,verbose);
@@ -377,7 +376,7 @@ static int check_part_sun(disk_t *disk_car,const int verbose,partition_t *partit
break;
case PSUN_LINSWAP:
- ret=check_Linux_SWAP(disk_car,partition,verbose);
+ ret=check_Linux_SWAP(disk_car, partition);
break;
default:
if(verbose>0)
diff --git a/src/partxbox.c b/src/partxbox.c
index aa83859..cabf3f7 100644
--- a/src/partxbox.c
+++ b/src/partxbox.c
@@ -35,7 +35,6 @@
#include <ctype.h> /* tolower */
#include "types.h"
#include "common.h"
-#include "testdisk.h"
#include "fnctdsk.h"
#include "lang.h"
#include "intrf.h"
@@ -280,7 +279,7 @@ static int check_part_xbox(disk_t *disk_car,const int verbose,partition_t *parti
switch(partition->part_type_xbox)
{
case PXBOX_FATX:
- ret=check_FATX(disk_car,partition,verbose);
+ ret=check_FATX(disk_car, partition);
if(ret!=0)
{ screen_buffer_add("Invalid FATX signature\n"); }
break;
diff --git a/src/pbanner.c b/src/pbanner.c
index 82388c2..500b16c 100644
--- a/src/pbanner.c
+++ b/src/pbanner.c
@@ -26,7 +26,6 @@
#ifdef HAVE_NCURSES
#include "types.h"
#include "common.h"
-#include "testdisk.h"
#include "intrf.h"
#include "intrfn.h"
diff --git a/src/phcfg.c b/src/phcfg.c
index 409e40e..34640d1 100644
--- a/src/phcfg.c
+++ b/src/phcfg.c
@@ -37,9 +37,6 @@
#endif
#include <stdio.h>
#include <errno.h>
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
#include "types.h"
#include "common.h"
#include "filegen.h"
diff --git a/src/phmain.c b/src/phmain.c
index f697fb5..fade7ad 100644
--- a/src/phmain.c
+++ b/src/phmain.c
@@ -53,13 +53,9 @@
#include <sys/wait.h>
#endif
#include <errno.h>
-#ifdef HAVE_TIME_H
-#include <time.h>
-#endif
#include "types.h"
#include "common.h"
#include "intrf.h"
-#include "godmode.h"
#include "fnctdsk.h"
#ifdef HAVE_NCURSES
#include "intrfn.h"
@@ -72,14 +68,9 @@
#include "dir.h"
#include "filegen.h"
#include "photorec.h"
-#include "fat.h"
#include "hdcache.h"
-#include "ext2p.h"
-#include "fatp.h"
-#include "ntfsp.h"
#include "ewf.h"
#include "log.h"
-#include "phrecn.h"
#include "hdaccess.h"
#include "sudo.h"
#include "phcfg.h"
diff --git a/src/photorec.c b/src/photorec.c
index 757da0d..3d4e473 100644
--- a/src/photorec.c
+++ b/src/photorec.c
@@ -26,62 +26,24 @@
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
-#include <stdarg.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* unlink, ftruncate */
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
-#ifdef HAVE_TIME_H
-#include <time.h>
-#endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-#include <ctype.h> /* tolower */
-#ifdef HAVE_LOCALE_H
-#include <locale.h> /* setlocale */
-#endif
-#ifdef HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
#include <errno.h>
-#ifdef HAVE_TIME_H
-#include <time.h>
-#endif
#include "types.h"
#include "common.h"
-#include "intrf.h"
-#include "godmode.h"
#include "fnctdsk.h"
#include <stdio.h>
-#ifdef HAVE_JPEGLIB_H
-#include <jpeglib.h>
-#endif
#include "dir.h"
#include "filegen.h"
#include "photorec.h"
-#include "fat.h"
#include "ext2p.h"
#include "fatp.h"
#include "ntfsp.h"
-#include "ewf.h"
#include "log.h"
-#include "phrecn.h"
-#include "hdaccess.h"
-#include "sudo.h"
-#include "phcfg.h"
-#include "misc.h"
-#include "ext2_dir.h"
-#include "ntfs_dir.h"
-#include "pdisksel.h"
/* #define DEBUG_FILE_FINISH */
/* #define DEBUG_UPDATE_SEARCH_SPACE */
diff --git a/src/phrecn.c b/src/phrecn.c
index 1fea2fa..cf0f82d 100644
--- a/src/phrecn.c
+++ b/src/phrecn.c
@@ -55,26 +55,19 @@
#include <stdarg.h>
#include <winbase.h>
#endif
-#include "fnctdsk.h"
#include "dir.h"
#include "fat_dir.h"
#include "list.h"
-#include "chgtype.h"
#include "lang.h"
#include "filegen.h"
#include "photorec.h"
#include "sessionp.h"
#include "phrecn.h"
-#include "partauto.h"
#include "log.h"
#include "log_part.h"
-#include "hdaccess.h"
#include "file_tar.h"
#include "phcfg.h"
-#include "ext2grp.h"
-#include "pdisksel.h"
#include "pblocksize.h"
-#include "pfree_whole.h"
#include "askloc.h"
/* #define DEBUG */
@@ -88,7 +81,7 @@ extern file_check_list_t file_check_list;
#ifdef HAVE_NCURSES
static int photorec_progressbar(WINDOW *window, const unsigned int pass, const photorec_status_t status, const uint64_t offset, disk_t *disk_car, partition_t *partition, const unsigned int file_nbr, const time_t elapsed_time, const file_stat_t *file_stats);
-static void recovery_finished(const unsigned int file_nbr, const char *recup_dir, const int ind_stop, char **current_cmd);
+static void recovery_finished(const unsigned int file_nbr, const char *recup_dir, const int ind_stop);
#endif
static int photorec_bf(disk_t *disk_car, partition_t *partition, const int verbose, const int paranoid, const char *recup_dir, const int interface, file_stat_t *file_stats, unsigned int *file_nbr, const unsigned int blocksize, alloc_data_t *list_search_space, const time_t real_start_time, unsigned int *dir_num, const photorec_status_t status, const unsigned int pass);
@@ -482,7 +475,7 @@ static int photorec_bf_aux(disk_t *disk_car, partition_t *partition, const int p
uint64_t original_offset_error, file_offset;
long int save_seek;
unsigned char *block_buffer;
- int blocs_to_skip,i;
+ unsigned int blocs_to_skip, i;
int ind_stop;
int testbf=0;
time_t previous_time=0;
@@ -585,7 +578,7 @@ static int photorec_bf_aux(disk_t *disk_car, partition_t *partition, const int p
#ifdef DEBUG_BF
log_debug("Skip %u extra blocs\n", blocs_to_skip);
#endif
- for(i=0; i<blocs_to_skip;i++)
+ for(i=0; i<blocs_to_skip; i++)
{
get_next_sector(list_search_space, &current_search_space, &offset, blocksize);
}
@@ -995,7 +988,7 @@ static int photorec_aux(disk_t *disk_car, partition_t *partition, const int verb
dir_list=dir_fat_aux(buffer,read_size,0,0);
if(dir_list!=NULL)
{
- dir_aff_log(disk_car, partition, NULL, dir_list);
+ dir_aff_log(NULL, dir_list);
delete_list_file(dir_list);
}
}
@@ -1164,7 +1157,7 @@ static int photorec_aux(disk_t *disk_car, partition_t *partition, const int verb
}
#ifdef HAVE_NCURSES
-static void recovery_finished(const unsigned int file_nbr, const char *recup_dir, const int ind_stop, char **current_cmd)
+static void recovery_finished(const unsigned int file_nbr, const char *recup_dir, const int ind_stop)
{
wmove(stdscr,9,0);
wclrtoeol(stdscr);
@@ -1447,7 +1440,7 @@ int photorec(disk_t *disk_car, partition_t *partition, const int verbose, const
free_search_space(list_search_space);
#ifdef HAVE_NCURSES
if(interface && *current_cmd==NULL)
- recovery_finished(file_nbr, recup_dir, ind_stop, current_cmd);
+ recovery_finished(file_nbr, recup_dir, ind_stop);
#endif
free(file_stats);
free_header_check();
diff --git a/src/ppartsel.c b/src/ppartsel.c
index 48cb12d..a1e042b 100644
--- a/src/ppartsel.c
+++ b/src/ppartsel.c
@@ -81,7 +81,7 @@ void menu_photorec(disk_t *disk_car, const int verbose, const char *recup_dir, f
int allow_partial_last_cylinder=0;
int paranoid=1;
int keep_corrupted_file=0;
- int current_element_num;
+ unsigned int current_element_num;
unsigned int mode_ext2=0;
unsigned int blocksize=0;
unsigned int expert=0;
@@ -91,7 +91,7 @@ void menu_photorec(disk_t *disk_car, const int verbose, const char *recup_dir, f
int mode_init_space=(td_list_empty(&list_search_space->list)?INIT_SPACE_WHOLE:INIT_SPACE_PREINIT);
#ifdef HAVE_NCURSES
int command;
- int offset=0;
+ unsigned int offset=0;
unsigned int menu=0;
static const struct MenuItem menuMain[]=
{
@@ -340,7 +340,7 @@ void menu_photorec(disk_t *disk_car, const int verbose, const char *recup_dir, f
}
break;
case KEY_PPAGE:
- for(i=0; i<INTER_SELECT && current_element->prev!=NULL; i++)
+ for(i=0; (signed)i<INTER_SELECT && current_element->prev!=NULL; i++)
{
current_element=current_element->prev;
current_element_num--;
@@ -354,7 +354,7 @@ void menu_photorec(disk_t *disk_car, const int verbose, const char *recup_dir, f
}
break;
case KEY_NPAGE:
- for(i=0; i<INTER_SELECT && current_element->next!=NULL; i++)
+ for(i=0; (signed)i<INTER_SELECT && current_element->next!=NULL; i++)
{
current_element=current_element->next;
current_element_num++;
diff --git a/src/rfs.c b/src/rfs.c
index f616935..0ea8f42 100644
--- a/src/rfs.c
+++ b/src/rfs.c
@@ -38,11 +38,11 @@
#include "log.h"
#include "guid_cpy.h"
-static int set_rfs_info(const disk_t *disk_car, const struct reiserfs_super_block *sb,partition_t *partition, const int verbose, const int dump_ind);
-static int test_rfs(const disk_t *disk_car, const struct reiserfs_super_block *sb,partition_t *partition,const int verbose, const int dump_ind);
+static int set_rfs_info(const struct reiserfs_super_block *sb, partition_t *partition);
+static int test_rfs(const disk_t *disk_car, const struct reiserfs_super_block *sb, partition_t *partition, const int verbose);
-static int test_rfs4(const disk_t *disk_car, const struct reiser4_master_sb*sb,partition_t *partition,const int verbose, const int dump_ind);
-static int set_rfs4_info(const disk_t *disk_car, const struct reiser4_master_sb*sb,partition_t *partition, const int verbose, const int dump_ind);
+static int test_rfs4(const disk_t *disk_car, const struct reiser4_master_sb*sb, partition_t *partition, const int verbose);
+static int set_rfs4_info(partition_t *partition);
int check_rfs(disk_t *disk_car,partition_t *partition,const int verbose)
{
@@ -52,15 +52,15 @@ int check_rfs(disk_t *disk_car,partition_t *partition,const int verbose)
free(buffer);
return 1;
}
- if(test_rfs(disk_car,(struct reiserfs_super_block*)buffer,partition,verbose,0)==0)
+ if(test_rfs(disk_car, (struct reiserfs_super_block*)buffer, partition, verbose)==0)
{
- set_rfs_info(disk_car,(struct reiserfs_super_block*)buffer,partition,verbose,0);
+ set_rfs_info((struct reiserfs_super_block*)buffer, partition);
free(buffer);
return 0;
}
- if(test_rfs4(disk_car,(struct reiser4_master_sb*)buffer,partition,verbose,0)==0)
+ if(test_rfs4(disk_car, (struct reiser4_master_sb*)buffer, partition, verbose)==0)
{
- set_rfs4_info(disk_car,(struct reiser4_master_sb*)buffer,partition,verbose,0);
+ set_rfs4_info(partition);
free(buffer);
return 0;
}
@@ -68,7 +68,7 @@ int check_rfs(disk_t *disk_car,partition_t *partition,const int verbose)
return 1;
}
-static int test_rfs(const disk_t *disk_car, const struct reiserfs_super_block *sb,partition_t *partition,const int verbose, const int dump_ind)
+static int test_rfs(const disk_t *disk_car, const struct reiserfs_super_block *sb, partition_t *partition, const int verbose)
{
if (memcmp(sb->s_magic,REISERFS_SUPER_MAGIC,sizeof(REISERFS_SUPER_MAGIC)) == 0)
{
@@ -117,7 +117,7 @@ static int test_rfs(const disk_t *disk_car, const struct reiserfs_super_block *s
return 0;
}
-static int test_rfs4(const disk_t *disk_car, const struct reiser4_master_sb *sb,partition_t *partition,const int verbose, const int dump_ind)
+static int test_rfs4(const disk_t *disk_car, const struct reiser4_master_sb *sb, partition_t *partition, const int verbose)
{
if (memcmp(sb->magic,REISERFS4_SUPER_MAGIC,sizeof(REISERFS4_SUPER_MAGIC)) == 0)
{
@@ -139,7 +139,7 @@ static int test_rfs4(const disk_t *disk_car, const struct reiser4_master_sb *sb,
int recover_rfs(disk_t *disk_car, const struct reiserfs_super_block *sb,partition_t *partition,const int verbose, const int dump_ind)
{
const struct reiser4_master_sb *sb4=(const struct reiser4_master_sb *)sb;
- if(test_rfs(disk_car,sb,partition,verbose,dump_ind)==0)
+ if(test_rfs(disk_car, sb, partition, verbose)==0)
{
if(verbose>0 || dump_ind!=0)
{
@@ -157,10 +157,10 @@ int recover_rfs(disk_t *disk_car, const struct reiserfs_super_block *sb,partitio
partition->part_type_sun= PSUN_LINUX;
partition->part_type_gpt=GPT_ENT_TYPE_LINUX_DATA;
guid_cpy(&partition->part_uuid, (const efi_guid_t *)&sb->s_uuid);
- set_rfs_info(disk_car,sb,partition,verbose,dump_ind);
+ set_rfs_info(sb, partition);
return 0;
}
- if(test_rfs4(disk_car,sb4,partition,verbose,dump_ind)==0)
+ if(test_rfs4(disk_car, sb4, partition, verbose)==0)
{
const struct format40_super *fmt40_super=(const struct format40_super *)((const char*)sb4+le16(sb4->blocksize));
if(verbose>0 || dump_ind!=0)
@@ -179,13 +179,13 @@ int recover_rfs(disk_t *disk_car, const struct reiserfs_super_block *sb,partitio
partition->part_type_sun= PSUN_LINUX;
partition->part_type_gpt=GPT_ENT_TYPE_LINUX_DATA;
guid_cpy(&partition->part_uuid, (const efi_guid_t *)&sb4->uuid);
- set_rfs4_info(disk_car,sb4,partition,verbose,dump_ind);
+ set_rfs4_info(partition);
return 0;
}
return 1;
}
-static int set_rfs_info(const disk_t *disk_car,const struct reiserfs_super_block *sb,partition_t *partition, const int verbose, const int dump_ind)
+static int set_rfs_info(const struct reiserfs_super_block *sb, partition_t *partition)
{
partition->fsname[0]='\0';
partition->info[0]='\0';
@@ -217,7 +217,7 @@ static int set_rfs_info(const disk_t *disk_car,const struct reiserfs_super_block
return 0;
}
-static int set_rfs4_info(const disk_t *disk_car,const struct reiser4_master_sb *sb,partition_t *partition, const int verbose, const int dump_ind)
+static int set_rfs4_info(partition_t *partition)
{
partition->fsname[0]='\0';
partition->info[0]='\0';
diff --git a/src/savehdr.c b/src/savehdr.c
index a179a40..00017de 100644
--- a/src/savehdr.c
+++ b/src/savehdr.c
@@ -40,7 +40,6 @@
#include "types.h"
#include "common.h"
#include "fnctdsk.h" /* get_LBA_part */
-#include "analyse.h"
#include "savehdr.h"
#include "log.h"
#define BACKUP_MAXSIZE 5120
diff --git a/src/sun.c b/src/sun.c
index fb81430..7f5bf29 100644
--- a/src/sun.c
+++ b/src/sun.c
@@ -41,8 +41,8 @@
#define SUN_LABEL_MAGIC 0xDABE
extern const arch_fnct_t arch_sun;
-static int set_sun_info_i386(const disk_t *disk_car, const sun_partition_i386 *sunlabel,partition_t *partition, const int verbose, const int dump_ind);
-static int test_sun_i386(const disk_t *disk_car, const sun_partition_i386 *sunlabel,partition_t *partition,const int verbose, const int dump_ind);
+static int set_sun_info_i386(partition_t *partition);
+static int test_sun_i386(const disk_t *disk_car, const sun_partition_i386 *sunlabel, partition_t *partition, const int verbose);
int check_sun_i386(disk_t *disk_car,partition_t *partition,const int verbose)
{
@@ -53,17 +53,17 @@ int check_sun_i386(disk_t *disk_car,partition_t *partition,const int verbose)
free(buffer);
return 1;
}
- if(test_sun_i386(disk_car,sunlabel,partition,verbose,0)!=0)
+ if(test_sun_i386(disk_car, sunlabel, partition, verbose)!=0)
{
free(buffer);
return 1;
}
- set_sun_info_i386(disk_car,sunlabel,partition,verbose,0);
+ set_sun_info_i386(partition);
free(buffer);
return 0;
}
-static int test_sun_i386(const disk_t *disk_car, const sun_partition_i386 *sunlabel,partition_t *partition,const int verbose, const int dump_ind)
+static int test_sun_i386(const disk_t *disk_car, const sun_partition_i386 *sunlabel, partition_t *partition, const int verbose)
{
if ((le16(sunlabel->magic) == SUN_LABEL_MAGIC)
&& (le32(sunlabel->magic_start) == SUN_LABEL_MAGIC_START))
@@ -101,7 +101,7 @@ static int test_sun_i386(const disk_t *disk_car, const sun_partition_i386 *sunla
int recover_sun_i386(disk_t *disk_car, const sun_partition_i386 *sunlabel, partition_t *partition,const int verbose, const int dump_ind)
{
- if(test_sun_i386(disk_car,sunlabel,partition,verbose,dump_ind)!=0)
+ if(test_sun_i386(disk_car, sunlabel, partition, verbose)!=0)
return 1;
if(verbose>0 || dump_ind!=0)
{
@@ -112,13 +112,13 @@ int recover_sun_i386(disk_t *disk_car, const sun_partition_i386 *sunlabel, parti
}
}
partition->part_size=(uint64_t)le32(sunlabel->partitions[2].num_sectors) * le16(sunlabel->sector_size);
- set_sun_info_i386(disk_car,sunlabel,partition,verbose,dump_ind);
+ set_sun_info_i386(partition);
partition->part_type_i386 = P_SUN;
partition->part_type_gpt=GPT_ENT_TYPE_SOLARIS_ROOT;
return 0;
}
-static int set_sun_info_i386(const disk_t *disk_car,const sun_partition_i386 *sunlabel,partition_t *partition, const int verbose, const int dump_ind)
+static int set_sun_info_i386(partition_t *partition)
{
partition->info[0]='\0';
partition->fsname[0]='\0';
diff --git a/src/swap.c b/src/swap.c
index 6f2ab71..6267087 100644
--- a/src/swap.c
+++ b/src/swap.c
@@ -33,11 +33,10 @@
#include "types.h"
#include "common.h"
#include "swap.h"
-#include "fnctdsk.h"
static int set_Linux_SWAP_info(const union swap_header *swap_header,partition_t *partition);
-static int test_Linux_SWAP(disk_t *disk_car, const union swap_header *swap_header,partition_t *partition,const int verbose, const int dump_ind);
+static int test_Linux_SWAP(const union swap_header *swap_header, partition_t *partition);
-int check_Linux_SWAP(disk_t *disk_car,partition_t *partition,const int verbose)
+int check_Linux_SWAP(disk_t *disk_car, partition_t *partition)
{
unsigned char *buffer=(unsigned char*)MALLOC(SWAP_SIZE);
if(disk_car->pread(disk_car, buffer, SWAP_SIZE, partition->part_offset) != SWAP_SIZE)
@@ -45,7 +44,7 @@ int check_Linux_SWAP(disk_t *disk_car,partition_t *partition,const int verbose)
free(buffer);
return 1;
}
- if(test_Linux_SWAP(disk_car,(union swap_header*)buffer,partition,verbose,0)!=0)
+ if(test_Linux_SWAP((union swap_header*)buffer, partition)!=0)
{
free(buffer);
return 1;
@@ -74,7 +73,7 @@ static int set_Linux_SWAP_info(const union swap_header *swap_header,partition_t
return 0;
}
-static int test_Linux_SWAP(disk_t *disk_car, const union swap_header *swap_header,partition_t *partition,const int verbose, const int dump_ind)
+static int test_Linux_SWAP(const union swap_header *swap_header, partition_t *partition)
{
if(memcmp(swap_header->magic.magic,"SWAP-SPACE",10)==0)
{
@@ -91,9 +90,9 @@ static int test_Linux_SWAP(disk_t *disk_car, const union swap_header *swap_heade
return 1;
}
-int recover_Linux_SWAP(disk_t *disk_car, const union swap_header *swap_header,partition_t *partition,const int verbose, const int dump_ind)
+int recover_Linux_SWAP(const union swap_header *swap_header, partition_t *partition)
{
- if(test_Linux_SWAP(disk_car,swap_header,partition,verbose,dump_ind)!=0)
+ if(test_Linux_SWAP(swap_header, partition)!=0)
return 1;
set_Linux_SWAP_info(swap_header,partition);
partition->part_type_i386=P_LINSWAP;
diff --git a/src/swap.h b/src/swap.h
index c802eda..b496e1a 100644
--- a/src/swap.h
+++ b/src/swap.h
@@ -44,8 +44,8 @@ union swap_header {
} info;
};
-int check_Linux_SWAP(disk_t *disk_car,partition_t *partition,const int verbose);
-int recover_Linux_SWAP(disk_t *disk_car, const union swap_header *swap_header,partition_t *partition,const int verbose, const int dump_ind);
+int check_Linux_SWAP(disk_t *disk_car, partition_t *partition);
+int recover_Linux_SWAP(const union swap_header *swap_header, partition_t *partition);
#ifdef __cplusplus
} /* closing brace for extern "C" */
diff --git a/src/sysv.c b/src/sysv.c
index 42e5c05..0b197e3 100644
--- a/src/sysv.c
+++ b/src/sysv.c
@@ -58,8 +58,8 @@
#define SYSV4_CIGAM_4GB 0x94192305
-static int set_sysv4_info(const disk_t *disk_car, const struct sysv4_super_block *sbd,partition_t *partition, const int verbose, const int dump_ind);
-static int test_sysv4(const disk_t *disk_car, const struct sysv4_super_block *sbd,partition_t *partition,const int verbose, const int dump_ind);
+static int set_sysv4_info(const struct sysv4_super_block *sbd, partition_t *partition);
+static int test_sysv4(const disk_t *disk_car, const struct sysv4_super_block *sbd, partition_t *partition, const int verbose);
int check_sysv(disk_t *disk_car,partition_t *partition,const int verbose)
{
@@ -69,9 +69,9 @@ int check_sysv(disk_t *disk_car,partition_t *partition,const int verbose)
free(buffer);
return 1;
}
- if(test_sysv4(disk_car,(const struct sysv4_super_block *)buffer,partition,verbose,0)==0)
+ if(test_sysv4(disk_car, (const struct sysv4_super_block *)buffer, partition, verbose)==0)
{
- set_sysv4_info(disk_car,(const struct sysv4_super_block *)buffer,partition,verbose,0);
+ set_sysv4_info((const struct sysv4_super_block *)buffer, partition);
free(buffer);
return 0;
}
@@ -79,9 +79,9 @@ int check_sysv(disk_t *disk_car,partition_t *partition,const int verbose)
return 1;
}
-static int test_sysv4(const disk_t *disk_car, const struct sysv4_super_block *sbd,partition_t *partition,const int verbose, const int dump_ind)
+static int test_sysv4(const disk_t *disk_car, const struct sysv4_super_block *sbd, partition_t *partition, const int verbose)
{
- if ((sbd->s_magic== le32(0xfd187e20))||(sbd->s_magic== be32(0xfd187e20)))
+ if (sbd->s_magic == (signed)le32(0xfd187e20) || sbd->s_magic == (signed)be32(0xfd187e20))
{
partition->upart_type = UP_SYSV4;
}
@@ -97,7 +97,7 @@ static int test_sysv4(const disk_t *disk_car, const struct sysv4_super_block *sb
int recover_sysv(disk_t *disk_car, const struct sysv4_super_block *sbd, partition_t *partition,const int verbose, const int dump_ind)
{
- if(test_sysv4(disk_car,sbd,partition,verbose,dump_ind)==0)
+ if(test_sysv4(disk_car, sbd,partition, verbose)==0)
{
if(verbose>0 || dump_ind!=0)
{
@@ -116,14 +116,14 @@ int recover_sysv(disk_t *disk_car, const struct sysv4_super_block *sbd, partiti
partition->part_size = (uint64_t)be32(sbd->s_fsize)*(512<<(be32(sbd->s_type)-1));
break;
}
- set_sysv4_info(disk_car,sbd,partition,verbose,dump_ind);
+ set_sysv4_info(sbd, partition);
partition->part_type_i386 = P_SYSV;
return 0;
}
return 1;
}
-static int set_sysv4_info(const disk_t *disk_car,const struct sysv4_super_block *sbd,partition_t *partition, const int verbose, const int dump_ind)
+static int set_sysv4_info(const struct sysv4_super_block *sbd, partition_t *partition)
{
strncpy(partition->info,"SysV4",sizeof(partition->info));
set_part_name(partition,sbd->s_fname,sizeof(sbd->s_fname));
diff --git a/src/tbanner.c b/src/tbanner.c
index 45fc4ab..a49c310 100644
--- a/src/tbanner.c
+++ b/src/tbanner.c
@@ -26,7 +26,6 @@
#ifdef HAVE_NCURSES
#include "types.h"
#include "common.h"
-#include "testdisk.h"
#include "intrf.h"
#include "intrfn.h"
diff --git a/src/tdiskop.c b/src/tdiskop.c
index c2bfdf1..23e6fcf 100644
--- a/src/tdiskop.c
+++ b/src/tdiskop.c
@@ -36,7 +36,6 @@
#endif
#include "godmode.h"
#include "fnctdsk.h"
-#include "testdisk.h"
#include "adv.h"
#include "edit.h"
#include "log.h"
diff --git a/src/tdisksel.c b/src/tdisksel.c
index faf7426..fd9836d 100644
--- a/src/tdisksel.c
+++ b/src/tdisksel.c
@@ -37,8 +37,6 @@
#else
#include <stdio.h>
#endif
-#include "fnctdsk.h"
-#include "testdisk.h"
#include "partauto.h"
#include "log.h"
#include "hdaccess.h"
diff --git a/src/testdisk.c b/src/testdisk.c
index 06bc90c..ecb8e4e 100644
--- a/src/testdisk.c
+++ b/src/testdisk.c
@@ -40,7 +40,6 @@
#endif
#include "types.h"
#include "common.h"
-#include "testdisk.h"
#include "intrf.h"
#ifdef HAVE_NCURSES
#include "intrfn.h"
@@ -269,7 +268,7 @@ int main( int argc, char **argv )
autoset_unit(element_disk->disk);
else
element_disk->disk->unit=unit;
- interface_list(element_disk->disk, verbose, saveheader, create_backup, &cmd_run);
+ interface_list(element_disk->disk, verbose, saveheader, create_backup);
}
delete_list_disk(list_disk);
return 0;
@@ -404,7 +403,7 @@ int main( int argc, char **argv )
{
case 'L':
for(element_disk=list_disk;element_disk!=NULL;element_disk=element_disk->next)
- interface_list(element_disk->disk, verbose, saveheader, create_backup, &cmd_run);
+ interface_list(element_disk->disk, verbose, saveheader, create_backup);
break;
case 'q':
case 'Q':
diff --git a/src/testdisk.h b/src/testdisk.h
index c710acf..1b14b49 100644
--- a/src/testdisk.h
+++ b/src/testdisk.h
@@ -24,7 +24,6 @@ extern "C" {
#endif
int test_MBR(disk_t *disk_car,int verbose);
-int analyse_file(char *);
#ifdef __cplusplus
} /* closing brace for extern "C" */
diff --git a/src/thfs.c b/src/thfs.c
index 6b44282..99a8618 100644
--- a/src/thfs.c
+++ b/src/thfs.c
@@ -71,7 +71,7 @@ static void hfs_dump(disk_t *disk_car, const partition_t *partition, const unsig
#endif
}
-int HFS_HFSP_boot_sector(disk_t *disk_car, partition_t *partition, const int verbose, const int dump_ind, const unsigned int expert, char **current_cmd)
+int HFS_HFSP_boot_sector(disk_t *disk_car, partition_t *partition, const int verbose, char **current_cmd)
{
unsigned char *buffer_bs;
unsigned char *buffer_backup_bs;
diff --git a/src/thfs.h b/src/thfs.h
index 693bfa0..a62e675 100644
--- a/src/thfs.h
+++ b/src/thfs.h
@@ -23,7 +23,7 @@
extern "C" {
#endif
-int HFS_HFSP_boot_sector(disk_t *disk_car, partition_t *partition, const int verbose, const int dump_ind, const unsigned int expert, char **current_cmd);
+int HFS_HFSP_boot_sector(disk_t *disk_car, partition_t *partition, const int verbose, char **current_cmd);
#ifdef __cplusplus
} /* closing brace for extern "C" */
diff --git a/src/tload.c b/src/tload.c
index 2538e4e..310d093 100644
--- a/src/tload.c
+++ b/src/tload.c
@@ -50,13 +50,13 @@
#include "tload.h"
#ifdef HAVE_NCURSES
-static list_part_t *merge_partition_list(list_part_t *list_part,list_part_t *backup_part, const int verbose);
+static list_part_t *merge_partition_list(list_part_t *list_part, list_part_t *backup_part);
#define INTER_LOAD 13
#define INTER_LOAD_X 0
#define INTER_LOAD_Y 22
-static struct td_list_head *interface_load_ncurses(disk_t *disk_car, backup_disk_t *backup_list, const int verbose)
+static struct td_list_head *interface_load_ncurses(disk_t *disk_car, backup_disk_t *backup_list)
{
int offset=0;
int backup_current_num=0;
@@ -178,7 +178,7 @@ static struct td_list_head *interface_load_ncurses(disk_t *disk_car, backup_disk
}
}
-static list_part_t *merge_partition_list(list_part_t *list_part,list_part_t *backup_part, const int verbose)
+static list_part_t *merge_partition_list(list_part_t *list_part, list_part_t *backup_part)
{
list_part_t *partition;
for(partition=backup_part;partition!=NULL;partition=partition->next)
@@ -209,7 +209,7 @@ list_part_t *interface_load(disk_t *disk_car,list_part_t *list_part, const int v
log_partition(disk_car,element->part);
}
#ifdef HAVE_NCURSES
- backup_current=interface_load_ncurses(disk_car, backup_list, verbose);
+ backup_current=interface_load_ncurses(disk_car, backup_list);
#endif
if(backup_current!=NULL)
{
@@ -221,7 +221,7 @@ list_part_t *interface_load(disk_t *disk_car,list_part_t *list_part, const int v
/* Check partition and load partition name */
disk_car->arch->check_part(disk_car,verbose,partition->part,0);
}
- list_part=merge_partition_list(list_part,backup->list_part,verbose);
+ list_part=merge_partition_list(list_part, backup->list_part);
}
{ /* Cleanup */
struct td_list_head *backup_walker_next = NULL;
diff --git a/src/tntfs.c b/src/tntfs.c
index 8d7c552..def2818 100644
--- a/src/tntfs.c
+++ b/src/tntfs.c
@@ -71,7 +71,7 @@ static void dump_NTFS(disk_t *disk_car, const partition_t *partition, const unsi
#endif
}
-int ntfs_boot_sector(disk_t *disk_car, partition_t *partition, const int verbose, const int dump_ind, const unsigned int expert, char **current_cmd)
+int ntfs_boot_sector(disk_t *disk_car, partition_t *partition, const int verbose, const unsigned int expert, char **current_cmd)
{
unsigned char *buffer_bs;
unsigned char *buffer_backup_bs;
@@ -279,10 +279,10 @@ int ntfs_boot_sector(disk_t *disk_car, partition_t *partition, const int verbose
dir_partition(disk_car, partition, 0,current_cmd);
break;
case 'M':
- repair_MFT(disk_car, partition, verbose, expert, current_cmd);
+ repair_MFT(disk_car, partition, verbose, expert);
break;
case 'R': /* R : rebuild boot sector */
- rebuild_NTFS_BS(disk_car,partition,verbose,dump_ind,1,expert,current_cmd);
+ rebuild_NTFS_BS(disk_car, partition, verbose, 1, expert, current_cmd);
rescan=1;
break;
case 'D':
diff --git a/src/tntfs.h b/src/tntfs.h
index f03d2d4..aef113d 100644
--- a/src/tntfs.h
+++ b/src/tntfs.h
@@ -23,7 +23,7 @@
extern "C" {
#endif
-int ntfs_boot_sector(disk_t *disk_car, partition_t *partition, const int verbose, const int dump_ind, const unsigned int expert, char **current_cmd);
+int ntfs_boot_sector(disk_t *disk_car, partition_t *partition, const int verbose, const unsigned int expert, char **current_cmd);
#ifdef __cplusplus
} /* closing brace for extern "C" */
diff --git a/src/ufs.c b/src/ufs.c
index 452d40f..7c48de6 100644
--- a/src/ufs.c
+++ b/src/ufs.c
@@ -37,8 +37,8 @@
#include "fnctdsk.h"
#include "log.h"
-static int set_ufs_info(const disk_t *disk_car, const struct ufs_super_block *sb,partition_t *partition, const int verbose, const int dump_ind);
-static int test_ufs(const disk_t *disk_car, const struct ufs_super_block *sb,partition_t *partition,const int verbose, const int dump_ind);
+static int set_ufs_info(const struct ufs_super_block *sb, partition_t *partition);
+static int test_ufs(const disk_t *disk_car, const struct ufs_super_block *sb, partition_t *partition, const int verbose);
int check_ufs(disk_t *disk_car,partition_t *partition,const int verbose)
{
@@ -51,17 +51,17 @@ int check_ufs(disk_t *disk_car,partition_t *partition,const int verbose)
free(buffer);
return 1;
}
- if(test_ufs(disk_car,sb,partition,verbose,0)!=0)
+ if(test_ufs(disk_car, sb, partition, verbose)!=0)
{
free(buffer);
return 1;
}
- set_ufs_info(disk_car,sb,partition,verbose,0);
+ set_ufs_info(sb, partition);
free(buffer);
return 0;
}
-static int test_ufs(const disk_t *disk_car, const struct ufs_super_block *sb,partition_t *partition,const int verbose, const int dump_ind)
+static int test_ufs(const disk_t *disk_car, const struct ufs_super_block *sb, partition_t *partition, const int verbose)
{
if(le32(sb->fs_magic)==UFS_MAGIC && le32(sb->fs_size) > 0 &&
(le32(sb->fs_fsize)==512 || le32(sb->fs_fsize)==1024 || le32(sb->fs_fsize)==2048 || le32(sb->fs_fsize)==4096))
@@ -100,7 +100,7 @@ static int test_ufs(const disk_t *disk_car, const struct ufs_super_block *sb,par
int recover_ufs(disk_t *disk_car, const struct ufs_super_block *sb, partition_t *partition,const int verbose, const int dump_ind)
{
- if(test_ufs(disk_car,sb,partition,verbose,dump_ind)!=0)
+ if(test_ufs(disk_car, sb, partition, verbose)!=0)
return 1;
if(dump_ind!=0)
{
@@ -145,7 +145,7 @@ int recover_ufs(disk_t *disk_car, const struct ufs_super_block *sb, partition_t
break;
}
- set_ufs_info(disk_car,sb,partition,verbose,dump_ind);
+ set_ufs_info(sb, partition);
if(strcmp(partition->fsname,"/")==0)
{
partition->part_type_sun = (unsigned char)PSUN_ROOT;
@@ -174,7 +174,7 @@ int recover_ufs(disk_t *disk_car, const struct ufs_super_block *sb, partition_t
return 0;
}
-static int set_ufs_info(const disk_t *disk_car,const struct ufs_super_block *sb,partition_t *partition, const int verbose, const int dump_ind)
+static int set_ufs_info(const struct ufs_super_block *sb, partition_t *partition)
{
partition->fsname[0]='\0';
partition->info[0]='\0';
diff --git a/src/xfs.c b/src/xfs.c
index e575f18..5b73d48 100644
--- a/src/xfs.c
+++ b/src/xfs.c
@@ -38,8 +38,8 @@
#include "log.h"
#include "guid_cpy.h"
-static int set_xfs_info(const disk_t *disk_car, const struct xfs_sb *sb,partition_t *partition, const int verbose, const int dump_ind);
-static int test_xfs(const disk_t *disk_car, const struct xfs_sb *sb,partition_t *partition,const int verbose, const int dump_ind);
+static int set_xfs_info(const struct xfs_sb *sb, partition_t *partition);
+static int test_xfs(const disk_t *disk_car, const struct xfs_sb *sb, partition_t *partition, const int verbose);
int check_xfs(disk_t *disk_car,partition_t *partition,const int verbose)
{
@@ -49,17 +49,17 @@ int check_xfs(disk_t *disk_car,partition_t *partition,const int verbose)
free(buffer);
return 1;
}
- if(test_xfs(disk_car,(struct xfs_sb*)buffer,partition,verbose,0)!=0)
+ if(test_xfs(disk_car, (struct xfs_sb*)buffer, partition, verbose)!=0)
{
free(buffer);
return 1;
}
- set_xfs_info(disk_car,(struct xfs_sb*)buffer,partition,verbose,0);
+ set_xfs_info((struct xfs_sb*)buffer, partition);
free(buffer);
return 0;
}
-static int test_xfs(const disk_t *disk_car, const struct xfs_sb *sb,partition_t *partition,const int verbose, const int dump_ind)
+static int test_xfs(const disk_t *disk_car, const struct xfs_sb *sb, partition_t *partition, const int verbose)
{
if (sb->sb_magicnum==be32(XFS_SB_MAGIC))
{
@@ -92,7 +92,7 @@ static int test_xfs(const disk_t *disk_car, const struct xfs_sb *sb,partition_t
int recover_xfs(disk_t *disk_car, const struct xfs_sb *sb,partition_t *partition,const int verbose, const int dump_ind)
{
- if(test_xfs(disk_car,sb,partition,verbose,dump_ind)!=0)
+ if(test_xfs(disk_car, sb, partition, verbose)!=0)
return 1;
if(verbose>0 || dump_ind!=0)
{
@@ -108,12 +108,12 @@ int recover_xfs(disk_t *disk_car, const struct xfs_sb *sb,partition_t *partition
partition->part_type_mac=PMAC_LINUX;
partition->part_type_sun=PSUN_LINUX;
partition->part_type_gpt=GPT_ENT_TYPE_LINUX_DATA;
- set_xfs_info(disk_car,sb,partition,verbose,dump_ind);
+ set_xfs_info(sb, partition);
guid_cpy(&partition->part_uuid, (const efi_guid_t *)&sb->sb_uuid);
return 0;
}
-static int set_xfs_info(const disk_t *disk_car,const struct xfs_sb *sb,partition_t *partition, const int verbose, const int dump_ind)
+static int set_xfs_info(const struct xfs_sb *sb, partition_t *partition)
{
partition->fsname[0]='\0';
partition->info[0]='\0';