summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <[email protected]>2010-08-23 16:01:55 +0200
committerChristophe Grenier <[email protected]>2010-08-23 16:01:55 +0200
commit90f2b63eac56a8c5dfb8d6471f817b3f9c9ecdc0 (patch)
tree5397292a9a47fd7eba91c3913f4fd396e0dccecc
parent643d625772c17a9467512f050b95e81b83b8594c (diff)
Code cleanup
-rw-r--r--src/dir.c4
-rw-r--r--src/ewf.c7
-rw-r--r--src/file_dbn.c1
-rw-r--r--src/file_prc.c2
-rw-r--r--src/file_ps.c2
-rw-r--r--src/godmode.c2
-rw-r--r--src/hdaccess.c2
-rw-r--r--src/msdos.c2
-rw-r--r--src/parthumax.c2
-rw-r--r--src/parti386.c2
10 files changed, 9 insertions, 17 deletions
diff --git a/src/dir.c b/src/dir.c
index cbbef9d8..c17d8eb8 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -613,7 +613,6 @@ char *mkdir_local(const char *localroot, const char *pathname)
while(*src!='\0')
{
unsigned int n=0;
- unsigned int l;
const char *src_org=src;
char *dst_org=dst;
for(n=0;
@@ -624,6 +623,7 @@ char *mkdir_local(const char *localroot, const char *pathname)
#ifdef __MINGW32__
if(mkdir(localdir)<0 && errno==EINVAL)
{
+ unsigned int l;
l=filename_convert(dst_org, src_org, n);
dst=dst_org+l;
mkdir(localdir);
@@ -632,6 +632,7 @@ char *mkdir_local(const char *localroot, const char *pathname)
if(memcmp(&localdir[1],":/cygdrive",11)!=0 &&
mkdir(localdir, 0775)<0 && errno==EINVAL)
{
+ unsigned int l;
l=filename_convert(dst_org, src_org, n);
dst=dst_org+l;
mkdir(localdir, 0775);
@@ -639,6 +640,7 @@ char *mkdir_local(const char *localroot, const char *pathname)
#else
if(mkdir(localdir, 0775)<0 && errno==EINVAL)
{
+ unsigned int l;
l=filename_convert(dst_org, src_org, n);
dst=dst_org+l;
mkdir(localdir, 0775);
diff --git a/src/ewf.c b/src/ewf.c
index ed068415..6174b0ad 100644
--- a/src/ewf.c
+++ b/src/ewf.c
@@ -199,11 +199,8 @@ static int fewf_clean(disk_t *disk)
{
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(data->buffer);
+ data->buffer=NULL;
free(disk->data);
disk->data=NULL;
}
diff --git a/src/file_dbn.c b/src/file_dbn.c
index f8dbdb10..8b233ba7 100644
--- a/src/file_dbn.c
+++ b/src/file_dbn.c
@@ -33,7 +33,6 @@
static void register_header_check_dbn(file_stat_t *file_stat);
static int header_check_dbn(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);
-static void file_check_dbn(file_recovery_t *file_recovery);
const file_hint_t file_hint_dbn= {
.extension="dbn",
diff --git a/src/file_prc.c b/src/file_prc.c
index bd383f98..3177ce1a 100644
--- a/src/file_prc.c
+++ b/src/file_prc.c
@@ -51,7 +51,7 @@ static void register_header_check_prc(file_stat_t *file_stat)
register_header_check(0x30, prc_header,sizeof(prc_header), &header_check_prc, file_stat);
}
-typedef struct DatabaseHdrType_s {
+struct DatabaseHdrType_s {
unsigned char name[32];
uint16_t attributes; /* 0x20 */
uint32_t creationDate; /* 0x22 */
diff --git a/src/file_ps.c b/src/file_ps.c
index 91d84fef..28830ec8 100644
--- a/src/file_ps.c
+++ b/src/file_ps.c
@@ -89,9 +89,9 @@ static int header_check_ps(const unsigned char *buffer, const unsigned int buffe
static int data_check_ps(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
- unsigned int i;
if(buffer_size>8)
{
+ unsigned int i;
for(i=(buffer_size/2)-4;i+4<buffer_size;i++)
{
if(buffer[i]=='%' && buffer[i+1]=='%' && buffer[i+2]=='E' && buffer[i+3]=='O' && buffer[i+4]=='F')
diff --git a/src/godmode.c b/src/godmode.c
index 834261d3..28ae96c2 100644
--- a/src/godmode.c
+++ b/src/godmode.c
@@ -471,7 +471,6 @@ static list_part_t *search_part(disk_t *disk_car, const list_part_t *list_part_o
/* Scan the disk */
while(ind_stop==0 && search_location < search_location_max)
{
- unsigned int sector_inc=0;
static CHS_t start;
offset2CHS_inline(disk_car,search_location,&start);
#ifdef HAVE_NCURSES
@@ -489,6 +488,7 @@ static list_part_t *search_part(disk_t *disk_car, const list_part_t *list_part_o
}
#endif
{
+ unsigned int sector_inc=0;
int test_nbr=0;
int search_now=0;
int search_now_raid=0;
diff --git a/src/hdaccess.c b/src/hdaccess.c
index dc8651ce..e1d2538f 100644
--- a/src/hdaccess.c
+++ b/src/hdaccess.c
@@ -1228,8 +1228,8 @@ static int file_nopwrite(disk_t *disk_car, const void *buf, const unsigned int c
static int file_sync(disk_t *disk_car)
{
- struct info_file_struct *data=(struct info_file_struct *)disk_car->data;
#ifdef HAVE_FSYNC
+ struct info_file_struct *data=(struct info_file_struct *)disk_car->data;
return fsync(data->handle);
#else
errno=EINVAL;
diff --git a/src/msdos.c b/src/msdos.c
index 7d53f93d..06cca88e 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -491,7 +491,6 @@ static int disk_pread(disk_t *disk_car, void *buf, const unsigned int count, con
static int disk_pwrite_aux(disk_t *disk_car, const void *buf, const unsigned int count, const uint64_t hd_offset)
{
- struct info_disk_struct*data=disk_car->data;
int i=0;
int rc;
disk_car->write_used=1;
@@ -542,7 +541,6 @@ static int disk_clean(disk_t *disk_car)
static int hd_report_error(disk_t *disk_car, const uint64_t hd_offset, const unsigned int count, const int rc)
{
- struct info_disk_struct*data=disk_car->data;
log_error(" lba=%lu(%u/%u/%u) nbr_sector=%u, rc=%d\n",(long unsigned int)(hd_offset/disk_car->sector_size),
offset2cylinder(disk_car,hd_offset),offset2head(disk_car,hd_offset),offset2sector(disk_car,hd_offset),
count/disk_car->sector_size,rc);
diff --git a/src/parthumax.c b/src/parthumax.c
index dd2afc9f..4fefd515 100644
--- a/src/parthumax.c
+++ b/src/parthumax.c
@@ -154,9 +154,7 @@ static int write_part_humax(disk_t *disk_car, const list_part_t *list_part, cons
static list_part_t *init_part_order_humax(const disk_t *disk_car, list_part_t *list_part)
{
- int insert_error=0;
int nbr_prim=0;
- partition_t *new_partition;
list_part_t *element;
for(element=list_part;element!=NULL;element=element->next)
{
diff --git a/src/parti386.c b/src/parti386.c
index 673e1c3d..f39b9ad1 100644
--- a/src/parti386.c
+++ b/src/parti386.c
@@ -358,7 +358,6 @@ static list_part_t *init_part_order_i386(const disk_t *disk_car, list_part_t *li
static list_part_t *read_part_i386(disk_t *disk_car, const int verbose, const int saveheader)
{
unsigned int i;
- int res=0;
CHSgeometry_t geometry;
list_part_t *new_list_part=NULL;
unsigned char *buffer=(unsigned char *)MALLOC(disk_car->sector_size);
@@ -402,7 +401,6 @@ static list_part_t *read_part_i386(disk_t *disk_car, const int verbose, const in
if(new_partition->errcode!=BAD_NOERR)
{
screen_buffer_add("%s\n",errmsg_i386_entry2partition(new_partition->errcode));
- res|=1;
}
new_list_part=insert_new_partition(new_list_part,new_partition, 0, &insert_error);
if(insert_error>0)