summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2008-06-23 19:28:58 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2008-06-23 19:28:58 +0200
commitb849a82750086bdddd127c7d43dd0a7381b3c28e (patch)
treeb7d0fd90e7e93e34455f0c582b2193803bbce4e1
parent50a0862d48da7f0260524b17c3b33281a1b5dcc7 (diff)
Make the code less C++ hostile
-rw-r--r--configure.ac20
-rw-r--r--src/adv.c2
-rw-r--r--src/analyse.c2
-rw-r--r--src/common.c2
-rw-r--r--src/cramfs.c2
-rw-r--r--src/crc.c4
-rw-r--r--src/dimage.c2
-rw-r--r--src/edit.c2
-rw-r--r--src/ewf.c6
-rw-r--r--src/ext2_dir.c4
-rw-r--r--src/fat.c4
-rw-r--r--src/fat_adv.c24
-rw-r--r--src/fat_dir.c6
-rw-r--r--src/fatp.c2
-rw-r--r--src/file_txt.c8
-rw-r--r--src/file_zip.c4
-rw-r--r--src/fnctdsk.c2
-rw-r--r--src/hdaccess.c16
-rw-r--r--src/hdcache.c18
-rw-r--r--src/intrf.h2
-rw-r--r--src/io_redir.c12
-rw-r--r--src/list.h34
-rw-r--r--src/lvm.c2
-rw-r--r--src/netware.c2
-rw-r--r--src/ntfs.c4
-rw-r--r--src/ntfs_dir.c6
-rw-r--r--src/parti386.c6
-rw-r--r--src/partnone.c4
-rw-r--r--src/partsun.c2
-rw-r--r--src/photorec.c2
-rw-r--r--src/phrecn.c12
-rw-r--r--src/rfs_dir.c4
-rw-r--r--src/savehdr.c4
-rw-r--r--src/sessionp.c4
-rw-r--r--src/win32.c4
35 files changed, 113 insertions, 121 deletions
diff --git a/configure.ac b/configure.ac
index 4a6a095..9d92f81 100644
--- a/configure.ac
+++ b/configure.ac
@@ -554,25 +554,19 @@ fi
#-Wconversion -Wunreachable-code -Wmissing-noreturn"
-if test "$GCC" = "yes"; then
-CFLAGS="$CFLAGS -Wall -MD -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wwrite-strings -W -Wcast-align -Waggregate-return -Wbad-function-cast -Wcast-qual -Wundef -Wredundant-decls -Wsign-compare -Wnested-externs -Winline -Wdisabled-optimization -Wfloat-equal -Wmissing-format-attribute -Wmultichar"
-
-for option in -Wdeclaration-after-statement; do
+for option in -Wdeclaration-after-statement -Wall -MD -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wwrite-strings -W -Wcast-align -Waggregate-return -Wbad-function-cast -Wcast-qual -Wundef -Wredundant-decls -Wsign-compare -Wnested-externs -Winline -Wdisabled-optimization -Wfloat-equal -Wmissing-format-attribute -Wmultichar
+do
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $option"
-AC_MSG_CHECKING([whether gcc understands $option])
+ AC_MSG_CHECKING([whether gcc understands $option])
AC_TRY_COMPILE([], [],
has_option=yes,
- has_option=no,)
- if test $has_option = no; then
- CFLAGS="$SAVE_CFLAGS"
- fi
-AC_MSG_RESULT($has_option)
+ has_option=no; CFLAGS="$SAVE_CFLAGS",)
+ AC_MSG_RESULT($has_option)
unset has_option
unset SAVE_CFLAGS
- done
- unset option
-fi
+done
+unset option
case "$target" in
*hpux*)
diff --git a/src/adv.c b/src/adv.c
index fa56e4e..225223d 100644
--- a/src/adv.c
+++ b/src/adv.c
@@ -418,7 +418,7 @@ void interface_adv(disk_t *disk_car, const int verbose,const int dump_ind, const
image_dd=ask_location("Do you want to save disk file image.dd in %s%s ? [Y/N]","");
if(image_dd!=NULL)
{
- char *new_recup_dir=MALLOC(strlen(image_dd)+1+strlen(DEFAULT_IMAGE_NAME)+1);
+ char *new_recup_dir=(char *)MALLOC(strlen(image_dd)+1+strlen(DEFAULT_IMAGE_NAME)+1);
strcpy(new_recup_dir,image_dd);
strcat(new_recup_dir,"/");
strcat(new_recup_dir,DEFAULT_IMAGE_NAME);
diff --git a/src/analyse.c b/src/analyse.c
index a59727c..346c76f 100644
--- a/src/analyse.c
+++ b/src/analyse.c
@@ -265,7 +265,7 @@ int search_type_128(unsigned char *buffer, disk_t *disk_car,partition_t *partiti
list_part_t *search_superblock(disk_t *disk_car, const partition_t *partition, const int verbose, const int dump_ind, const int interface)
{
- unsigned char *buffer=MALLOC(2*0x200);
+ unsigned char *buffer=(unsigned char *)MALLOC(2*0x200);
uint64_t hd_offset;
int nbr_sb=0;
list_part_t *list_part=NULL;
diff --git a/src/common.c b/src/common.c
index 1744d54..9d90cdc 100644
--- a/src/common.c
+++ b/src/common.c
@@ -309,7 +309,7 @@ char *gen_local_filename(const char *dir, const char*src)
{
int l1=strlen(dir);
int l2=strlen(src);
- char *dst=MALLOC(l1+l2+1);
+ char *dst=(char *)MALLOC(l1+l2+1);
#if defined(DJGPP)
l1=filename_convert_dos(dst, dir, l1+1);
filename_convert_dos(dst+l1, src, l2+1);
diff --git a/src/cramfs.c b/src/cramfs.c
index 3d486ba..fa49fae 100644
--- a/src/cramfs.c
+++ b/src/cramfs.c
@@ -93,7 +93,7 @@ int recover_cramfs(disk_t *disk_car, const struct cramfs_super *sb,partition_t *
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)
{
- set_part_name(partition,sb->name,16);
+ set_part_name(partition, (const char*)sb->name, 16);
switch(partition->upart_type)
{
case UP_CRAMFS:
diff --git a/src/crc.c b/src/crc.c
index c005103..b1faa6c 100644
--- a/src/crc.c
+++ b/src/crc.c
@@ -89,7 +89,7 @@ unsigned int get_crc32(const void*buf, const unsigned int len, const uint32_t se
{
unsigned int i;
register uint32_t crc32val;
- const unsigned char *s=buf;
+ const unsigned char *s=(const unsigned char *)buf;
crc32val = seed;
for (i = 0; i < len; i ++)
{
@@ -102,7 +102,7 @@ unsigned int get_crc32(const void*buf, const unsigned int len, const uint32_t se
uint32_t* make_crc32_table(uint32_t poly)
{
unsigned i,j;
- uint32_t *crctable = MALLOC(256*sizeof(uint32_t));
+ uint32_t *crctable = (uint32_t *)MALLOC(256*sizeof(uint32_t));
for (i=0;i<256;i++)
{
uint32_t r=i;
diff --git a/src/dimage.c b/src/dimage.c
index b9ffe32..d92dc37 100644
--- a/src/dimage.c
+++ b/src/dimage.c
@@ -75,7 +75,7 @@ int disk_image(disk_t *disk_car, const partition_t *partition, const char *image
const uint64_t offset_end=partition->part_offset+partition->part_size;
const uint64_t offset_inc=(offset_end-offset)/100;
uint64_t offset_next=offset;
- unsigned char *buffer_disk=MALLOC(READ_SIZE);
+ unsigned char *buffer_disk=(unsigned char *)MALLOC(READ_SIZE);
int disk_dst;
#ifdef HAVE_NCURSES
WINDOW *window;
diff --git a/src/edit.c b/src/edit.c
index f7c8e47..21adbf4 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -52,7 +52,7 @@ static void interface_editor_ncurses(disk_t *disk_car)
{
int done = 0;
uint64_t hd_offset=0;
- unsigned char *buffer=MALLOC(disk_car->sector_size);
+ unsigned char *buffer=(unsigned char *)MALLOC(disk_car->sector_size);
log_info("%s\n",disk_car->description(disk_car));
while (done==0)
{
diff --git a/src/ewf.c b/src/ewf.c
index babe9e1..c4498c5 100644
--- a/src/ewf.c
+++ b/src/ewf.c
@@ -81,7 +81,7 @@ disk_t *fewf_init(const char *device, const int verbose, const arch_fnct_t *arch
#ifdef HAVE_GLOB_H
glob_t globbuf;
#endif
- data=MALLOC(sizeof(*data));
+ data=(struct info_fewf_struct *)MALLOC(sizeof(*data));
data->offset=0;
strncpy(data->file_name,device,sizeof(data->file_name));
data->file_name[sizeof(data->file_name)-1]='\0';
@@ -95,14 +95,14 @@ disk_t *fewf_init(const char *device, const int verbose, const arch_fnct_t *arch
glob(data->file_name, GLOB_DOOFFS, NULL, &globbuf);
if(globbuf.gl_pathc>0)
{
- filenames=MALLOC(globbuf.gl_pathc * sizeof(*filenames));
+ filenames=(char **)MALLOC(globbuf.gl_pathc * sizeof(*filenames));
for (num_files=0; num_files<globbuf.gl_pathc; num_files++) {
filenames[num_files]=globbuf.gl_pathv[num_files];
}
}
}
#else
- filenames=MALLOC(1*sizeof(*filenames));
+ filenames=(char **)MALLOC(1*sizeof(*filenames));
filenames[num_files] = data->file_name;
num_files++;
#endif /*HAVE_GLOB_H*/
diff --git a/src/ext2_dir.c b/src/ext2_dir.c
index 55421c7..8ad76d3 100644
--- a/src/ext2_dir.c
+++ b/src/ext2_dir.c
@@ -202,7 +202,7 @@ static int list_dir_proc2(ext2_ino_t dir,
ext2_ino_t ino;
unsigned int thislen;
struct ext2_dir_struct *ls = (struct ext2_dir_struct *) private;
- file_data_t *new_file=MALLOC(sizeof(*new_file));
+ file_data_t *new_file=(file_data_t *)MALLOC(sizeof(*new_file));
new_file->status=0;
new_file->prev=ls->current_file;
new_file->next=NULL;
@@ -346,7 +346,7 @@ int dir_partition_ext2_init(disk_t *disk_car, const partition_t *partition, dir_
ls->current_file=NULL;
/* ls->flags = DIRENT_FLAG_INCLUDE_EMPTY; */
ls->flags = 0;
- my_data=MALLOC(sizeof(*my_data));
+ my_data=(my_data_t *)MALLOC(sizeof(*my_data));
my_data->partition=partition;
my_data->disk_car=disk_car;
ioch=alloc_io_channel(disk_car,my_data);
diff --git a/src/fat.c b/src/fat.c
index 16827d9..3eca20c 100644
--- a/src/fat.c
+++ b/src/fat.c
@@ -281,7 +281,7 @@ int log_fat2_info(const struct fat_boot_sector*fh1, const struct fat_boot_sector
int check_FAT(disk_t *disk_car,partition_t *partition,const int verbose)
{
unsigned char *buffer;
- buffer=MALLOC(3*disk_car->sector_size);
+ buffer=(unsigned char *)MALLOC(3*disk_car->sector_size);
if(disk_car->read(disk_car,3*disk_car->sector_size, buffer, partition->part_offset)!=0)
{
screen_buffer_add("check_FAT: can't read FAT boot sector\n");
@@ -481,7 +481,7 @@ unsigned int fat32_get_prev_cluster(disk_t *disk_car,const partition_t *partitio
const uint32_t *p32;
uint64_t hd_offset=partition->part_offset+(uint64_t)fat_offset*disk_car->sector_size;
unsigned int prev_cluster;
- unsigned char *buffer=MALLOC(disk_car->sector_size);
+ unsigned char *buffer=(unsigned char *)MALLOC(disk_car->sector_size);
p32=(const uint32_t*)buffer;
for(prev_cluster=2;prev_cluster<=no_of_cluster+1;prev_cluster++)
diff --git a/src/fat_adv.c b/src/fat_adv.c
index f3098b3..af7cafe 100644
--- a/src/fat_adv.c
+++ b/src/fat_adv.c
@@ -334,7 +334,7 @@ static unsigned int fat32_find_root_cluster(disk_t *disk_car,const partition_t *
int interactive=1;
unsigned char *buffer;
int ind_stop=0;
- buffer=MALLOC(cluster_size*disk_car->sector_size);
+ buffer=(unsigned char *)MALLOC(cluster_size*disk_car->sector_size);
#ifdef HAVE_NCURSES
if(interface)
{
@@ -385,7 +385,7 @@ static unsigned int fat32_find_root_cluster(disk_t *disk_car,const partition_t *
dir_aff_log(disk_car, partition, NULL, dir_list);
}
{
- file_data_t *new_file=MALLOC(sizeof(*new_file));
+ file_data_t *new_file=(file_data_t *)MALLOC(sizeof(*new_file));
memcpy(new_file,dir_list,sizeof(*new_file));
new_file->prev=current_file;
new_file->next=NULL;
@@ -643,7 +643,7 @@ static int fat32_create_rootdir(disk_t *disk_car,const partition_t *partition, c
log_trace("fat32_create_rootdir(reserved=%u,fat_length=%u,root_cluster=%u,cluster_size=%u)\n",reserved,fat_length,root_cluster,cluster_size);
}
cluster=root_cluster;
- buffer=MALLOC(disk_car->sector_size*cluster_size);
+ buffer=(unsigned char *)MALLOC(disk_car->sector_size*cluster_size);
memset(buffer,0,disk_car->sector_size*cluster_size);
for(current_file=rootdir_list;current_file!=NULL;current_file=current_file->next)
{
@@ -744,7 +744,7 @@ static int analyse_dir_entries(disk_t *disk_car,const partition_t *partition, co
int etat=0;
unsigned int sector_etat1=0;
uint64_t hd_offset;
- unsigned char *buffer=MALLOC(disk_car->sector_size);
+ unsigned char *buffer=(unsigned char *)MALLOC(disk_car->sector_size);
hd_offset=partition->part_offset+(uint64_t)offset*disk_car->sector_size;
for(i=0;i<200;i++)
{
@@ -1047,8 +1047,8 @@ static void create_fat_boot_sector(disk_t *disk_car, partition_t *partition, con
struct fat_boot_sector *fat_header;
int error=0;
unsigned long int part_size=0;
- orgboot=MALLOC(3*disk_car->sector_size);
- newboot=MALLOC(3*disk_car->sector_size);
+ orgboot=(unsigned char *)MALLOC(3*disk_car->sector_size);
+ 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->read(disk_car,3*disk_car->sector_size, orgboot, partition->part_offset)!=0)
@@ -1259,7 +1259,7 @@ static unsigned int fat_find_fat_start(const unsigned char *buffer,const int p_f
info_offset_t *info_offset;
unsigned int nbr_offset=0;
int have_fat_signature=0;
- info_offset=MALLOC(sector_size*sizeof(info_offset_t));
+ info_offset=(info_offset_t *)MALLOC(sector_size*sizeof(info_offset_t));
if(p_fat12!=0)
{
unsigned int i;
@@ -1535,7 +1535,7 @@ static int fat_find_type(disk_t *disk_car,const partition_t *partition,const uin
uint64_t offset;
unsigned long int old_percent=0;
int ind_stop=0;
- unsigned char *buffer=MALLOC(disk_car->sector_size);
+ unsigned char *buffer=(unsigned char *)MALLOC(disk_car->sector_size);
if(verbose>0)
{
log_trace("fat_find_type(max_offset=%lu, p_fat12=%d, p_fat16=%d, p_fat32=%d, debug=%d, dump_ind=%d)\n",
@@ -1639,7 +1639,7 @@ static upart_type_t fat_find_info(disk_t *disk_car,unsigned int*reserved, unsign
#ifdef HAVE_NCURSES
if(dump_ind>0 && interface>0)
{
- unsigned char *buffer=MALLOC(disk_car->sector_size);
+ unsigned char *buffer=(unsigned char *)MALLOC(disk_car->sector_size);
if(disk_car->read(disk_car,disk_car->sector_size, &buffer, end)==0)
{
dump_ncurses(buffer,disk_car->sector_size);
@@ -1854,7 +1854,7 @@ static int find_cluster_size(disk_t *disk_car, partition_t *partition, const int
uint64_t offset;
uint64_t skip_offset;
int ind_stop=0;
- unsigned char *buffer=MALLOC(disk_car->sector_size);
+ unsigned char *buffer=(unsigned char *)MALLOC(disk_car->sector_size);
#ifdef HAVE_NCURSES
if(interface)
{
@@ -2442,7 +2442,7 @@ int repair_FAT_table(disk_t *disk_car, partition_t *partition, const int verbose
struct fat_boot_sector *fat_header;
uint64_t part_size,start_data;
unsigned char *buffer;
- buffer=MALLOC(disk_car->sector_size);
+ buffer=(unsigned char *)MALLOC(disk_car->sector_size);
fat_header=(struct fat_boot_sector *)buffer;
if(disk_car->read(disk_car,disk_car->sector_size, buffer, partition->part_offset)!=0)
{
@@ -2474,7 +2474,7 @@ int repair_FAT_table(disk_t *disk_car, partition_t *partition, const int verbose
unsigned char *buffer_fat[2];
unsigned int rw_size=buffer_size;
for(fat_nbr=0;fat_nbr<fats;fat_nbr++)
- buffer_fat[fat_nbr]=MALLOC(fats*buffer_size);
+ buffer_fat[fat_nbr]=(unsigned char *)MALLOC(fats*buffer_size);
for(fat_nbr=0;fat_nbr<fats;fat_nbr++)
{
fat_history[fat_nbr][FAT_UNREADABLE]=0;
diff --git a/src/fat_dir.c b/src/fat_dir.c
index 69108f7..14e93eb 100644
--- a/src/fat_dir.c
+++ b/src/fat_dir.c
@@ -257,7 +257,7 @@ RecEnd:
if((int8_t) unicode[0] != (int8_t) DELETED_FLAG)
{
unsigned int i;
- file_data_t *new_file=MALLOC(sizeof(*new_file));
+ file_data_t *new_file=(file_data_t *)MALLOC(sizeof(*new_file));
for(i=0;(unicode[i]!=0)&&(i<sizeof(new_file->name)-1);i++)
new_file->name[i]=(char) unicode[i];
new_file->name[i]=0;
@@ -358,7 +358,7 @@ static file_data_t *fat_dir(disk_t *disk_car, const partition_t *partition, dir_
{
file_data_t *dir_list=NULL;
const unsigned int cluster_size=fat_header->cluster_size;
- unsigned char *buffer_dir=MALLOC(fat_sector_size(fat_header)*cluster_size*10);
+ unsigned char *buffer_dir=(unsigned char *)MALLOC(fat_sector_size(fat_header)*cluster_size*10);
unsigned int nbr_cluster;
int stop=0;
uint64_t start_fat1,start_data,part_size;
@@ -517,7 +517,7 @@ static int fat_copy(disk_t *disk_car, const partition_t *partition, dir_data_t *
const struct fat_boot_sector *fat_header=ls->boot_sector;
unsigned int cluster_size=fat_header->cluster_size;
const unsigned int block_size=fat_sector_size(fat_header)*cluster_size;
- unsigned char *buffer_file=MALLOC(block_size);
+ unsigned char *buffer_file=(unsigned char *)MALLOC(block_size);
unsigned int cluster;
unsigned int file_size=file->filestat.st_size;
unsigned int fat_meth=FAT_FOLLOW_CLUSTER;
diff --git a/src/fatp.c b/src/fatp.c
index 14cff16..aec1233 100644
--- a/src/fatp.c
+++ b/src/fatp.c
@@ -139,7 +139,7 @@ unsigned int fat_remove_used_space(disk_t *disk_car, const partition_t *partitio
unsigned int res;
unsigned int sector_size;
const struct fat_boot_sector *fat_header;
- buffer=MALLOC(3*disk_car->sector_size);
+ buffer=(unsigned char *)MALLOC(3*disk_car->sector_size);
fat_header=(const struct fat_boot_sector *)buffer;
if(disk_car->read(disk_car,3*disk_car->sector_size, buffer, partition->part_offset)!=0)
{
diff --git a/src/file_txt.c b/src/file_txt.c
index a7d8461..a9f4c2a 100644
--- a/src/file_txt.c
+++ b/src/file_txt.c
@@ -457,7 +457,7 @@ static int header_check_fasttxt(const unsigned char *buffer, const unsigned int
* DTSTART:19970714T173000Z ;UTC time
* DTSTART;TZID=US-Eastern:19970714T133000 ;Local time and time
*/
- buffer2=MALLOC(buffer_size+1);
+ buffer2=(char *)MALLOC(buffer_size+1);
buffer2[buffer_size]='\0';
memcpy(buffer2, buffer, buffer_size);
date_asc=strstr(buffer2, "DTSTART");
@@ -548,7 +548,7 @@ static int header_check_txt(const unsigned char *buffer, const unsigned int buff
if(buffer_lower==NULL)
{
buffer_lower_size=buffer_size_test+16;
- buffer_lower=MALLOC(buffer_lower_size);
+ buffer_lower=(char *)MALLOC(buffer_lower_size);
}
i=UTF2Lat(buffer_lower,buffer,buffer_size_test);
/* strncasecmp */
@@ -751,7 +751,7 @@ Doc: \r (0xD)
static int data_check_txt(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
unsigned int i;
- char *buffer_lower=MALLOC(buffer_size+16);
+ char *buffer_lower=(char *)MALLOC(buffer_size+16);
i=UTF2Lat(buffer_lower,&buffer[buffer_size/2],buffer_size/2);
if(i<buffer_size/2)
{
@@ -786,7 +786,7 @@ static void file_check_html(file_recovery_t *file_recovery)
int i;
if(fseek(file_recovery->handle,0,SEEK_SET)<0)
return;
- buffer_lower=MALLOC(read_size);
+ buffer_lower=(char *)MALLOC(read_size);
taille=fread(buffer_lower,1,read_size,file_recovery->handle);
if(taille<0)
{
diff --git a/src/file_zip.c b/src/file_zip.c
index 8114314..d712f11 100644
--- a/src/file_zip.c
+++ b/src/file_zip.c
@@ -95,7 +95,7 @@ static uint32_t expected_compressed_size=0;
static int64_t file_get_pos(FILE *f, const void* needle, const unsigned int size)
{
- char *buffer = MALLOC(4096);
+ char *buffer =(char *)MALLOC(4096);
int64_t total = 0;
#ifdef DEBUG_ZIP
log_trace("zip: file_get_pos(f, needle, %u)\n", size);
@@ -154,7 +154,7 @@ static int zip_parse_file_entry(file_recovery_t *fr)
len = le16(file.filename_length);
if (len)
{
- char *filename=MALLOC(len+1);
+ char *filename=(char *)MALLOC(len+1);
fr->file_size += len;
if (fread(filename, len, 1, fr->handle) != 1)
{
diff --git a/src/fnctdsk.c b/src/fnctdsk.c
index 82c9c1c..f0185c0 100644
--- a/src/fnctdsk.c
+++ b/src/fnctdsk.c
@@ -421,7 +421,7 @@ unsigned int get_geometry_from_list_part(const disk_t *disk_car, const list_part
unsigned int nbr;
unsigned int h_index=0;
unsigned int head_max=disk_car->CHS.head;
- disk_t *new_disk_car=MALLOC(sizeof(*new_disk_car));
+ disk_t *new_disk_car=(disk_t *)MALLOC(sizeof(*new_disk_car));
memcpy(new_disk_car,disk_car,sizeof(*new_disk_car));
nbr_max=get_geometry_from_list_part_aux(new_disk_car, list_part, verbose);
for(h_index=0;head_list[h_index]!=0;h_index++)
diff --git a/src/hdaccess.c b/src/hdaccess.c
index 26f78df..d7da33f 100644
--- a/src/hdaccess.c
+++ b/src/hdaccess.c
@@ -986,7 +986,7 @@ static uint64_t compute_device_size(const int hd_h, const char *device, const in
#ifdef HAVE_PREAD
/* This function can failed if there are bad sectors */
uint64_t min_offset, max_offset;
- char *buffer=MALLOC(sector_size);
+ char *buffer=(char *)MALLOC(sector_size);
min_offset=0;
max_offset=sector_size;
/* Search the maximum device size */
@@ -1027,7 +1027,7 @@ static uint64_t compute_device_size(const int hd_h, const char *device, const in
static const char *file_description(disk_t *disk_car)
{
- const struct info_file_struct *data=disk_car->data;
+ const struct info_file_struct *data=(const struct info_file_struct *)disk_car->data;
char buffer_disk_size[100];
snprintf(disk_car->description_txt, sizeof(disk_car->description_txt),"Disk %s - %s - CHS %u %u %u%s",
disk_car->device, size_to_unit(disk_car->disk_size,buffer_disk_size),
@@ -1038,7 +1038,7 @@ static const char *file_description(disk_t *disk_car)
static const char *file_description_short(disk_t *disk_car)
{
- const struct info_file_struct *data=disk_car->data;
+ const struct info_file_struct *data=(const struct info_file_struct *)disk_car->data;
char buffer_disk_size[100];
if(disk_car->model==NULL)
snprintf(disk_car->description_short_txt, sizeof(disk_car->description_txt),"Disk %s - %s%s",
@@ -1056,7 +1056,7 @@ static int file_clean(disk_t *disk_car)
{
if(disk_car->data!=NULL)
{
- struct info_file_struct *data=disk_car->data;
+ struct info_file_struct *data=(struct info_file_struct *)disk_car->data;
/*
#ifdef BLKRRPART
if (ioctl(data->handle, BLKRRPART, NULL)) {
@@ -1186,7 +1186,7 @@ static int file_write(disk_t *disk_car, const unsigned int count, const void *bu
static int file_nowrite(disk_t *disk_car,const unsigned int count, const void *buf, const uint64_t offset)
{
- struct info_file_struct *data=disk_car->data;
+ struct info_file_struct *data=(struct info_file_struct *)disk_car->data;
log_warning("file_nowrite(%d,%u,buffer,%lu(%u/%u/%u)) write refused\n", data->handle,
(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));
@@ -1195,7 +1195,7 @@ static int file_nowrite(disk_t *disk_car,const unsigned int count, const void *b
static int file_sync(disk_t *disk_car)
{
- struct info_file_struct *data=disk_car->data;
+ struct info_file_struct *data=(struct info_file_struct *)disk_car->data;
#ifdef HAVE_FSYNC
return fsync(data->handle);
#else
@@ -1356,7 +1356,7 @@ disk_t *file_test_availability(const char *device, const int verbose, const arch
disk_car->arch=arch;
init_disk(disk_car);
disk_car->device=strdup(device);
- data=MALLOC(sizeof(*data));
+ data=(struct info_file_struct *)MALLOC(sizeof(*data));
data->handle=hd_h;
data->mode=mode;
disk_car->data=data;
@@ -1475,7 +1475,7 @@ void hd_update_geometry(disk_t *disk_car, const int allow_partial_last_cylinder,
unsigned char *buffer;
uint64_t pos;
CHS_t pos_CHS;
- buffer=MALLOC(disk_car->sector_size);
+ buffer=(unsigned char *)MALLOC(disk_car->sector_size);
if(disk_car->autodetect!=0)
{
if(disk_car->read(disk_car,disk_car->sector_size, buffer, 0)==0)
diff --git a/src/hdcache.c b/src/hdcache.c
index fc8103b..4e80b50 100644
--- a/src/hdcache.c
+++ b/src/hdcache.c
@@ -74,7 +74,7 @@ static int cache_read(disk_t *disk_car,const unsigned int count, void *nom_buffe
static int cache_read_aux(disk_t *disk_car,const unsigned int count, void *nom_buffer, const uint64_t offset, const unsigned int can_read_more)
{
- struct cache_struct *data=disk_car->data;
+ struct cache_struct *data=(struct cache_struct *)disk_car->data;
#ifdef DEBUG_CACHE
log_trace("cache_read(count=%u,buffer,offset=%llu)\n", count,(long long unsigned)offset);
#endif
@@ -142,7 +142,7 @@ static int cache_read_aux(disk_t *disk_car,const unsigned int count, void *nom_b
if(cache->buffer==NULL)
{ /* Allocate buffer */
cache->buffer_size=(count_new<CACHE_DEFAULT_SIZE?CACHE_DEFAULT_SIZE:count_new);
- cache->buffer=MALLOC(cache->buffer_size);
+ cache->buffer=(unsigned char *)MALLOC(cache->buffer_size);
}
res=data->disk_car->read(data->disk_car, count_new, cache->buffer, offset);
cache->cache_size=count_new;
@@ -184,7 +184,7 @@ static int cache_read_aux(disk_t *disk_car,const unsigned int count, void *nom_b
static int cache_write(disk_t *disk_car,const unsigned int count, const void *nom_buffer, const uint64_t offset)
{
- struct cache_struct *data=disk_car->data;
+ struct cache_struct *data=(struct cache_struct *)disk_car->data;
unsigned int i;
for(i=0;i<CACHE_BUFFER_NBR;i++)
{
@@ -203,7 +203,7 @@ static int cache_clean(disk_t *disk_car)
{
if(disk_car->data)
{
- struct cache_struct *data=disk_car->data;
+ struct cache_struct *data=(struct cache_struct *)disk_car->data;
unsigned int i;
#ifdef DEBUG_CACHE
log_trace("%s\ncache_read total_call=%u, total_count=%llu\n read total_call=%u, total_count=%llu\n",
@@ -227,15 +227,15 @@ static int cache_clean(disk_t *disk_car)
static int cache_sync(disk_t *disk_car)
{
- struct cache_struct *data=disk_car->data;
+ struct cache_struct *data=(struct cache_struct *)disk_car->data;
return data->disk_car->sync(data->disk_car);
}
disk_t *new_diskcache(disk_t *disk_car, const unsigned int testdisk_mode)
{
unsigned int i;
- struct cache_struct*data=MALLOC(sizeof(*data));
- disk_t *new_disk_car=MALLOC(sizeof(*new_disk_car));
+ struct cache_struct*data=(struct cache_struct*)MALLOC(sizeof(*data));
+ disk_t *new_disk_car=(disk_t *)MALLOC(sizeof(*new_disk_car));
memcpy(new_disk_car,disk_car,sizeof(*new_disk_car));
data->disk_car=disk_car;
data->nbr_fnct_sect=0;
@@ -271,7 +271,7 @@ disk_t *new_diskcache(disk_t *disk_car, const unsigned int testdisk_mode)
static const char *cache_description(disk_t *disk_car)
{
- struct cache_struct *data=disk_car->data;
+ struct cache_struct *data=(struct cache_struct *)disk_car->data;
dup_CHS(&data->disk_car->CHS,&disk_car->CHS);
data->disk_car->disk_size=disk_car->disk_size;
return data->disk_car->description(data->disk_car);
@@ -279,7 +279,7 @@ static const char *cache_description(disk_t *disk_car)
static const char *cache_description_short(disk_t *disk_car)
{
- struct cache_struct *data=disk_car->data;
+ struct cache_struct *data=(struct cache_struct *)disk_car->data;
dup_CHS(&data->disk_car->CHS,&disk_car->CHS);
data->disk_car->disk_size=disk_car->disk_size;
return data->disk_car->description_short(data->disk_car);
diff --git a/src/intrf.h b/src/intrf.h
index 1d4e6a4..a5c090d 100644
--- a/src/intrf.h
+++ b/src/intrf.h
@@ -20,8 +20,6 @@
*/
-typedef enum buffer_cmd buffer_cmd_t;
-
struct MenuItem
{
const int key; /* Keyboard shortcut; if zero, then there is no more items in the menu item table */
diff --git a/src/io_redir.c b/src/io_redir.c
index e0cdf41..006061a 100644
--- a/src/io_redir.c
+++ b/src/io_redir.c
@@ -62,8 +62,8 @@ int io_redir_add_redir(disk_t *disk_car, const uint64_t org_offset, const unsign
{
if(disk_car->read!=io_redir_read)
{
- struct info_io_redir*data=MALLOC(sizeof(*data));
- disk_t *old_disk_car=MALLOC(sizeof(*old_disk_car));
+ struct info_io_redir*data=(struct info_io_redir*)MALLOC(sizeof(*data));
+ disk_t *old_disk_car=(disk_t *)MALLOC(sizeof(*old_disk_car));
#ifdef DEBUG_IO_REDIR
log_trace("io_redir_add_redir: install functions org_offset=%llu, size=%u, new_offset=%llu, mem=%p\n",
(long long unsigned)org_offset,
@@ -82,7 +82,7 @@ int io_redir_add_redir(disk_t *disk_car, const uint64_t org_offset, const unsign
disk_car->clean=io_redir_clean;
}
{
- struct info_io_redir *data=disk_car->data;
+ struct info_io_redir *data=(struct info_io_redir *)disk_car->data;
list_redir_t *prev_redir=NULL;
list_redir_t *current_redir;
for(current_redir=data->list_redir;(current_redir!=NULL) && org_offset<current_redir->org_offset+current_redir->size;current_redir=current_redir->next)
@@ -120,7 +120,7 @@ int io_redir_del_redir(disk_t *disk_car, uint64_t org_offset)
return 1;
}
{
- struct info_io_redir *data=disk_car->data;
+ struct info_io_redir *data=(struct info_io_redir *)disk_car->data;
list_redir_t *current_redir;
for(current_redir=data->list_redir;(current_redir!=NULL) && org_offset!=current_redir->org_offset;current_redir=current_redir->next);
if(current_redir!=NULL)
@@ -153,7 +153,7 @@ int io_redir_del_redir(disk_t *disk_car, uint64_t org_offset)
static int io_redir_read(disk_t *disk_car,const unsigned int count, void *buffer, const uint64_t offset)
{
- struct info_io_redir *data=disk_car->data;
+ struct info_io_redir *data=(struct info_io_redir *)disk_car->data;
uint64_t current_offset=offset;
unsigned int current_count=count;
int res=0;
@@ -220,7 +220,7 @@ static int io_redir_clean(disk_t *disk_car)
{
if(disk_car->data)
{
- struct info_io_redir *data=disk_car->data;
+ struct info_io_redir *data=(struct info_io_redir *)disk_car->data;
data->disk_car->clean(data->disk_car);
free(data->disk_car);
free(disk_car->data);
diff --git a/src/list.h b/src/list.h
index 2bbd200..53e1ff6 100644
--- a/src/list.h
+++ b/src/list.h
@@ -75,40 +75,40 @@ struct td_list_head {
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
-static inline void __td_list_add(struct td_list_head *new,
+static inline void __td_list_add(struct td_list_head *newe,
struct td_list_head *prev,
struct td_list_head *next)
{
- next->prev = new;
- new->next = next;
- new->prev = prev;
- prev->next = new;
+ next->prev = newe;
+ newe->next = next;
+ newe->prev = prev;
+ prev->next = newe;
}
/**
* td_list_add - add a new entry
- * @new: new entry to be added
+ * @newe: new entry to be added
* @head: list head to add it after
*
* Insert a new entry after the specified head.
* This is good for implementing stacks.
*/
-static inline void td_list_add(struct td_list_head *new, struct td_list_head *head)
+static inline void td_list_add(struct td_list_head *newe, struct td_list_head *head)
{
- __td_list_add(new, head, head->next);
+ __td_list_add(newe, head, head->next);
}
/**
* td_list_add_tail - add a new entry
- * @new: new entry to be added
+ * @newe: new entry to be added
* @head: list head to add it before
*
* Insert a new entry before the specified head.
* This is useful for implementing queues.
*/
-static inline void td_list_add_tail(struct td_list_head *new, struct td_list_head *head)
+static inline void td_list_add_tail(struct td_list_head *newe, struct td_list_head *head)
{
- __td_list_add(new, head->prev, head);
+ __td_list_add(newe, head->prev, head);
}
/*
@@ -133,8 +133,8 @@ static inline void __td_list_del(struct td_list_head * prev, struct td_list_head
static inline void td_list_del(struct td_list_head *entry)
{
__td_list_del(entry->prev, entry->next);
- entry->next = LIST_POISON1;
- entry->prev = LIST_POISON2;
+ entry->next = (struct td_list_head*)LIST_POISON1;
+ entry->prev = (struct td_list_head*)LIST_POISON2;
}
/**
@@ -333,18 +333,18 @@ static inline void td_list_splice_init(struct td_list_head *list,
pos = n, n = td_list_entry(n->member.next, typeof(*n), member))
-static inline void td_list_add_sorted(struct td_list_head *new, struct td_list_head *head,
+static inline void td_list_add_sorted(struct td_list_head *newe, struct td_list_head *head,
int (*compar)(const struct td_list_head *a, const struct td_list_head *b))
{
struct td_list_head *pos;
td_list_for_each(pos, head)
{
- if(compar(new,pos)<0)
+ if(compar(newe,pos)<0)
{
- __td_list_add(new, pos->prev, pos);
+ __td_list_add(newe, pos->prev, pos);
return ;
}
}
- td_list_add_tail(new, head);
+ td_list_add_tail(newe, head);
}
#endif
diff --git a/src/lvm.c b/src/lvm.c
index c36ae02..cbb883a 100644
--- a/src/lvm.c
+++ b/src/lvm.c
@@ -126,7 +126,7 @@ static int set_LVM_info(partition_t *partition, const pv_disk_t *pv)
int check_LVM2(disk_t *disk_car,partition_t *partition,const int verbose)
{
- unsigned char *buffer=MALLOC(DEFAULT_SECTOR_SIZE);
+ unsigned char *buffer=(unsigned char *)MALLOC(DEFAULT_SECTOR_SIZE);
if(disk_car->read(disk_car,DEFAULT_SECTOR_SIZE, buffer, partition->part_offset+0x200)!=0)
{
free(buffer);
diff --git a/src/netware.c b/src/netware.c
index 0732bff..a5fae4f 100644
--- a/src/netware.c
+++ b/src/netware.c
@@ -46,7 +46,7 @@ static int test_netware(disk_t *disk_car, const struct disk_netware *netware_blo
int check_netware(disk_t *disk_car,partition_t *partition,const int verbose)
{
- unsigned char *buffer=MALLOC(DEFAULT_SECTOR_SIZE);
+ unsigned char *buffer=(unsigned char *)MALLOC(DEFAULT_SECTOR_SIZE);
if(disk_car->read(disk_car,DEFAULT_SECTOR_SIZE, buffer, partition->part_offset)!=0)
{
free(buffer);
diff --git a/src/ntfs.c b/src/ntfs.c
index 2e2fcc7..8f7ded0 100644
--- a/src/ntfs.c
+++ b/src/ntfs.c
@@ -326,8 +326,8 @@ static int ntfs_get_attr_aux(const char *attr_record, const int my_type, partiti
long lcn;
int64_t deltaxcn = (int64_t)-1; /* Change in [vl]cn. */
mapping_pairs_offset=NTFS_GETU16(attr_record+32);
- buf=attr_record+mapping_pairs_offset;
- attr_end = (const char*)attr_record + attr_len;
+ buf=(const unsigned char*)attr_record + mapping_pairs_offset;
+ attr_end = (const unsigned char*)attr_record + attr_len;
lcn = 0;
/* return first element of the run_list */
{
diff --git a/src/ntfs_dir.c b/src/ntfs_dir.c
index 4ec2843..f0e3b55 100644
--- a/src/ntfs_dir.c
+++ b/src/ntfs_dir.c
@@ -241,7 +241,7 @@ static int ntfs_td_list_entry( struct ntfs_dir_struct *ls, const ntfschar *name
}
{
- file_data_t *new_file=MALLOC(sizeof(*new_file));
+ file_data_t *new_file=(file_data_t *)MALLOC(sizeof(*new_file));
memcpy(new_file->name,filename,(MAX_PATH<sizeof(new_file->name)?MAX_PATH:sizeof(new_file->name)));
new_file->status=0;
new_file->prev=ls->current_file;
@@ -338,7 +338,7 @@ static int ntfs_copy(disk_t *disk_car, const partition_t *partition, dir_data_t
s64 bytes_read, written;
s64 offset;
u32 block_size;
- buffer = MALLOC(bufsize);
+ buffer = (char *)MALLOC(bufsize);
if (!buffer)
return -2;
attr = ntfs_attr_open(inode, AT_DATA, NULL, 0);
@@ -431,7 +431,7 @@ int dir_partition_ntfs_init(disk_t *disk_car, const partition_t *partition, dir_
dev = ntfs_device_alloc("/", 0, &ntfs_device_testdisk_io_ops, NULL);
if (dev)
{
- my_data=MALLOC(sizeof(*my_data));
+ my_data=(my_data_t *)MALLOC(sizeof(*my_data));
my_data->partition=partition;
my_data->disk_car=disk_car;
my_data->offset=0;
diff --git a/src/parti386.c b/src/parti386.c
index 04e5c7d..02444ac 100644
--- a/src/parti386.c
+++ b/src/parti386.c
@@ -347,7 +347,7 @@ static list_part_t *read_part_i386(disk_t *disk_car, const int verbose, const in
int res=0;
CHS_t geometry;
list_part_t *new_list_part=NULL;
- unsigned char *buffer=MALLOC(disk_car->sector_size);
+ unsigned char *buffer=(unsigned char *)MALLOC(disk_car->sector_size);
screen_buffer_reset();
if(disk_car->read(disk_car,disk_car->sector_size, buffer, (uint64_t)0))
{
@@ -634,8 +634,8 @@ int write_part_i386(disk_t *disk_car, const list_part_t *list_part, const int ro
static int write_mbr_i386(disk_t *disk_car, const list_part_t *list_part, const int ro, const int verbose)
{
const list_part_t *element;
- unsigned char *buffer=MALLOC(disk_car->sector_size);
- unsigned char *buffer_org=MALLOC(disk_car->sector_size);
+ unsigned char *buffer=(unsigned char *)MALLOC(disk_car->sector_size);
+ unsigned char *buffer_org=(unsigned char *)MALLOC(disk_car->sector_size);
if(verbose>0)
{
log_trace("\nwrite_mbr_i386: starting...\n");
diff --git a/src/partnone.c b/src/partnone.c
index 741dbf7..8d971be 100644
--- a/src/partnone.c
+++ b/src/partnone.c
@@ -170,7 +170,7 @@ list_part_t *read_part_none(disk_t *disk_car, const int verbose, const int saveh
partition_t *partition;
int res=0;
partition=partition_new(&arch_none);
- buffer_disk=MALLOC(16*DEFAULT_SECTOR_SIZE);
+ buffer_disk=(unsigned char *)MALLOC(16*DEFAULT_SECTOR_SIZE);
partition->part_size=disk_car->disk_size;
if(recover_MD_from_partition(disk_car, partition, verbose)==0)
res=1;
@@ -222,7 +222,7 @@ static int test_structure_none(list_part_t *list_part)
int set_part_type_none(partition_t *partition, unsigned int part_type)
{
- partition->upart_type=part_type;
+ partition->upart_type=(upart_type_t)part_type;
return 0;
}
diff --git a/src/partsun.c b/src/partsun.c
index 3194fd4..52f224c 100644
--- a/src/partsun.c
+++ b/src/partsun.c
@@ -142,7 +142,7 @@ list_part_t *read_part_sun(disk_t *disk_car, const int verbose, const int savehe
unsigned int i;
sun_partition *sunlabel;
list_part_t *new_list_part=NULL;
- unsigned char *buffer=MALLOC(disk_car->sector_size);
+ unsigned char *buffer=(unsigned char *)MALLOC(disk_car->sector_size);
screen_buffer_reset();
sunlabel=(sun_partition*)buffer;
if(disk_car->read(disk_car,DEFAULT_SECTOR_SIZE, buffer, (uint64_t)0))
diff --git a/src/photorec.c b/src/photorec.c
index 772ce19..d1d4d10 100644
--- a/src/photorec.c
+++ b/src/photorec.c
@@ -972,7 +972,7 @@ int main( int argc, char **argv )
int len=strlen(argv[i+1]);
if(argv[i+1][len-1]=='\\' || argv[i+1][len-1]=='/')
{
- char *new_recup_dir=MALLOC(len+strlen(DEFAULT_RECUP_DIR)+1);
+ char *new_recup_dir=(char *)MALLOC(len+strlen(DEFAULT_RECUP_DIR)+1);
strcpy(new_recup_dir,argv[i+1]);
strcat(new_recup_dir,DEFAULT_RECUP_DIR);
recup_dir=new_recup_dir; /* small memory leak */
diff --git a/src/phrecn.c b/src/phrecn.c
index e812590..cbb3cbf 100644
--- a/src/phrecn.c
+++ b/src/phrecn.c
@@ -471,7 +471,7 @@ static int photorec_bf(disk_t *disk_car, partition_t *partition, const int verbo
int pass2=pass;
read_size=((*blocksize)>8192?(*blocksize):8192);
buffer_size=(*blocksize)+READ_SIZE;
- buffer_start=MALLOC(buffer_size);
+ buffer_start=(unsigned char *)MALLOC(buffer_size);
for(search_walker=list_search_space->list.prev, n=search_walker->prev;
search_walker!=&list_search_space->list && ind_stop==0;
search_walker=n,n=search_walker->prev)
@@ -853,7 +853,7 @@ static int photorec_aux(disk_t *disk_car, partition_t *partition, const int verb
.list = TD_LIST_HEAD_INIT(list_cluster.list)
};
buffer_size=(*blocksize)+READ_SIZE;
- buffer_start=MALLOC(buffer_size);
+ buffer_start=(unsigned char *)MALLOC(buffer_size);
buffer_olddata=buffer_start;
buffer=buffer_olddata+(*blocksize);
reset_file_recovery(&file_recovery);
@@ -1297,7 +1297,7 @@ static int photorec(disk_t *disk_car, partition_t *partition, const int verbose,
enable_count++;
}
}
- file_stats=MALLOC(enable_count * sizeof(file_stat_t));
+ file_stats=(file_stat_t *)MALLOC(enable_count * sizeof(file_stat_t));
enable_count=0;
for(file_enable=files_enable;file_enable->file_hint!=NULL;file_enable++)
{
@@ -1386,7 +1386,7 @@ static int photorec(disk_t *disk_car, partition_t *partition, const int verbose,
else
{
free(new_recup_dir);
- new_recup_dir=MALLOC(strlen(res)+1+strlen(DEFAULT_RECUP_DIR)+1);
+ new_recup_dir=(char *)MALLOC(strlen(res)+1+strlen(DEFAULT_RECUP_DIR)+1);
strcpy(new_recup_dir,res);
strcat(new_recup_dir,"/");
strcat(new_recup_dir,DEFAULT_RECUP_DIR);
@@ -1577,7 +1577,7 @@ static void menu_photorec(disk_t *disk_car, const int verbose, const char *recup
res=ask_location("Do you want to save recovered files in %s%s ? [Y/N]\nDo not choose to write the files to the same partition they were stored on.","");
if(res!=NULL)
{
- char *new_recup_dir=MALLOC(strlen(res)+1+strlen(DEFAULT_RECUP_DIR)+1);
+ char *new_recup_dir=(char *)MALLOC(strlen(res)+1+strlen(DEFAULT_RECUP_DIR)+1);
strcpy(new_recup_dir,res);
strcat(new_recup_dir,"/");
strcat(new_recup_dir,DEFAULT_RECUP_DIR);
@@ -1714,7 +1714,7 @@ static void menu_photorec(disk_t *disk_car, const int verbose, const char *recup
res=ask_location("Do you want to save recovered files in %s%s ? [Y/N]\nDo not choose to write the files to the same partition they were stored on.","");
if(res!=NULL)
{
- char *new_recup_dir=MALLOC(strlen(res)+1+strlen(DEFAULT_RECUP_DIR)+1);
+ char *new_recup_dir=(char *)MALLOC(strlen(res)+1+strlen(DEFAULT_RECUP_DIR)+1);
strcpy(new_recup_dir,res);
strcat(new_recup_dir,"/");
strcat(new_recup_dir,DEFAULT_RECUP_DIR);
diff --git a/src/rfs_dir.c b/src/rfs_dir.c
index e4b3c01..e2f2594 100644
--- a/src/rfs_dir.c
+++ b/src/rfs_dir.c
@@ -433,7 +433,7 @@ static file_data_t *reiser_dir(disk_t *disk_car, const partition_t *partition, d
strcat(name,entry.de_name);
if((entity=reiserfs_object_create(ls->current_fs,name,1)))
{
- file_data_t *new_file=MALLOC(sizeof(*new_file));
+ file_data_t *new_file=(file_data_t *)MALLOC(sizeof(*new_file));
thislen=(MAX_NAME_LEN(DEFAULT_BLOCK_SIZE)<DIR_NAME_LEN?MAX_NAME_LEN(DEFAULT_BLOCK_SIZE):DIR_NAME_LEN);
memcpy(new_file->name,entry.de_name,thislen);
new_file->name[thislen-1]='\0';
@@ -470,7 +470,7 @@ int dir_partition_reiser_init(disk_t *disk_car, const partition_t *partition, di
dal_t *dal;
reiserfs_fs_t *fs;
my_data_t *my_data;
- my_data=MALLOC(sizeof(*my_data));
+ my_data=(my_data_t *)MALLOC(sizeof(*my_data));
my_data->partition=partition;
my_data->disk_car=disk_car;
my_data->offset=0;
diff --git a/src/savehdr.c b/src/savehdr.c
index 1a09254..0cbea56 100644
--- a/src/savehdr.c
+++ b/src/savehdr.c
@@ -60,7 +60,7 @@ int save_header(disk_t *disk_car,partition_t *partition, const int verbose)
log_critical("Can't create header.log file: %s\n",strerror(errno));
return -1;
}
- buffer=MALLOC(256*DEFAULT_SECTOR_SIZE);
+ buffer=(unsigned char *)MALLOC(256*DEFAULT_SECTOR_SIZE);
memset(buffer,0,DEFAULT_SECTOR_SIZE);
{
char status='D';
@@ -112,7 +112,7 @@ backup_disk_t *partition_load(const disk_t *disk_car, const int verbose)
log_error("Can't open backup.log file: %s\n",strerror(errno));
return list_backup;
}
- buffer=MALLOC(BACKUP_MAXSIZE);
+ buffer=(char *)MALLOC(BACKUP_MAXSIZE);
taille=fread(buffer,1,BACKUP_MAXSIZE,f_backup);
buffer[(taille<BACKUP_MAXSIZE?taille:BACKUP_MAXSIZE-1)]='\0';
if(verbose>1)
diff --git a/src/sessionp.c b/src/sessionp.c
index 690618d..06c0f27 100644
--- a/src/sessionp.c
+++ b/src/sessionp.c
@@ -71,7 +71,7 @@ int session_load(char **cmd_device, char **current_cmd, alloc_data_t *list_free_
buffer_size=SESSION_MAXSIZE;
else
buffer_size=stat_rec.st_size;
- buffer=MALLOC(buffer_size+1);
+ buffer=(char *)MALLOC(buffer_size+1);
taille=fread(buffer,1,buffer_size,f_session);
buffer[taille]='\0';
fclose(f_session);
@@ -213,7 +213,7 @@ int session_save(alloc_data_t *list_free_space, disk_t *disk_car, const partitio
{ /* Reserve some space */
int res;
char *buffer;
- buffer=MALLOC(SESSION_MAXSIZE);
+ buffer=(char *)MALLOC(SESSION_MAXSIZE);
memset(buffer,0,SESSION_MAXSIZE);
res=fwrite(buffer,1,SESSION_MAXSIZE,f_session);
free(buffer);
diff --git a/src/win32.c b/src/win32.c
index 9e1173a..072276e 100644
--- a/src/win32.c
+++ b/src/win32.c
@@ -310,7 +310,7 @@ disk_t *file_test_availability_win32(const char *device, const int verbose, cons
init_disk(disk_car);
disk_car->arch=arch;
disk_car->device=strdup(device);
- data=MALLOC(sizeof(*data));
+ data=(struct info_file_win32_struct *)MALLOC(sizeof(*data));
data->handle=handle;
data->mode=mode;
disk_car->data=data;
@@ -402,7 +402,7 @@ static int file_win32_clean(disk_t *disk_car)
static unsigned int file_win32_compute_sector_size(HANDLE handle)
{
- char *buffer=MALLOC(4096);
+ char *buffer=(char *)MALLOC(4096);
unsigned int sector_size;
for(sector_size=512;sector_size<=4096;sector_size*=2)
{