aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBertrand Jacquin <beber@meleeweb.net>2009-04-23 18:15:30 +0200
committerBertrand Jacquin <beber@meleeweb.net>2009-04-23 18:15:30 +0200
commitb938234ada9bbc19412fbbd279088c01c69d3da7 (patch)
tree6c13c712e90e12c807072df35048df092d18bec2
parentQA: Fix warning about missing decleration of 'exit' (diff)
downloadflx-master.tar.gz
QA: Correct cast mismatchHEADmaster
Imply fct1.c flx.h input_file.c input_fs.c
-rw-r--r--fct1.c22
-rw-r--r--flx.h4
-rw-r--r--input_file.c2
-rw-r--r--input_fs.c2
4 files changed, 15 insertions, 15 deletions
diff --git a/fct1.c b/fct1.c
index 811391a..53a87f3 100644
--- a/fct1.c
+++ b/fct1.c
@@ -45,7 +45,7 @@ t_file_desc *complete_info_from_file(char *path, t_file_desc *desc, int flag) {
PFERROR("readlink(%s)", path);
} else {
temp[l] = 0;
- desc->link = strdup(temp);
+ desc->link = (unsigned char*)strdup(temp);
desc->md5 = checksum_md5_from_data(temp, l);
}
}
@@ -92,13 +92,13 @@ int files_are_the_same(t_file_desc *f1, t_file_desc *f2, int Diff, char *path)
PFERROR("readlink(%s)",path);
} else {
temp[l] = 0;
- if (!f1->link) f1->link = strdup(temp);
- if (!f2->link) f2->link = strdup(temp);
+ if (!f1->link) f1->link = (unsigned char*)strdup(temp);
+ if (!f2->link) f2->link = (unsigned char*)strdup(temp);
if (!f1->md5) f1->md5 = checksum_md5_from_data(temp, l);
if (!f2->md5) f2->md5 = checksum_md5_from_data(temp, l);
}
}
- if (strcmp(f1->link, f2->link))
+ if (strcmp((const char*)f1->link, (const char*)f2->link))
diff |= DIFF_LINK; /* links differ */
}
}
@@ -222,10 +222,10 @@ int browse_over_path(char *path, PROTO_FS(*fct), void *data) {
/* build an MD5 checksum from data in file */
-char *checksum_md5_from_file(char *file) {
+unsigned char *checksum_md5_from_file(char *file) {
int fd;
ssize_t size;
- char *checksum_md5 = NULL, blk[BUFFER_LENGTH];
+ unsigned char *checksum_md5 = NULL, *blk[BUFFER_LENGTH];
MD5_CTX md5_ctx;
if ((fd = open(file, O_RDONLY)) < 0 ) {
@@ -234,7 +234,7 @@ char *checksum_md5_from_file(char *file) {
else {
MD5_Init(&md5_ctx);
while ((size = read(fd, blk, BUFFER_LENGTH)) > 0)
- MD5_Update(&md5_ctx, blk, size);
+ MD5_Update(&md5_ctx, (const void*)blk, size);
close(fd);
// if size = -1, there is a read error, don't do anything
if (size == 0) { // last read is null
@@ -246,12 +246,12 @@ char *checksum_md5_from_file(char *file) {
}
/* build an MD5 checksum from a string */
-char *checksum_md5_from_data(char *data, int len) {
- char *checksum_md5 = 0;
+unsigned char *checksum_md5_from_data(char *data, int len) {
+ unsigned char *checksum_md5 = 0;
MD5_CTX md5_ctx;
MD5_Init(&md5_ctx);
- MD5_Update(&md5_ctx, data, len);
+ MD5_Update(&md5_ctx, (const void*)data, len);
checksum_md5 = MALLOC(16);
MD5_Final(checksum_md5, &md5_ctx);
return (checksum_md5);
@@ -365,7 +365,7 @@ char *build_line(char *path, char *filename, t_file_desc *info) {
s += sprintf(blk+s, "%s", backslashed_str(path, " \\\n()\t"));
if (S_ISLNK(st->st_mode) && info->link)
- s += sprintf(blk+s, " %s", backslashed_str(info->link, " \\\n()\t"));
+ s += sprintf(blk+s, " %s", backslashed_str((char*)info->link, " \\\n()\t"));
}
else {
if (IS(Options, GOPT_HUMAN_READABLE))
diff --git a/flx.h b/flx.h
index 68e351f..e8a3020 100644
--- a/flx.h
+++ b/flx.h
@@ -214,8 +214,8 @@ struct s_dtree {
extern int browse_over_path(char *path, void *(*fct)(), void *data) ;
-extern char *checksum_md5_from_file(char *file) ;
-extern char *checksum_md5_from_data(char *data, int len) ;
+extern unsigned char *checksum_md5_from_file(char *file) ;
+extern unsigned char *checksum_md5_from_data(char *data, int len) ;
extern char *end_field(char *line) ;
extern int mkdir_with_parent(char *pathname, mode_t mode) ;
extern char *build_line(char *path, char *filename, t_file_desc *info) ;
diff --git a/input_file.c b/input_file.c
index 5a4b0c5..ad56ded 100644
--- a/input_file.c
+++ b/input_file.c
@@ -127,7 +127,7 @@ t_file_desc *fill_from_signfs_line(char **tab, char **rpath, t_file_desc **desc)
if (rpath) *rpath = p1;
break;
case 8: /* link */
- (*desc)->link = strdup(p1);
+ (*desc)->link = (unsigned char*)strdup(p1);
break;
}
}
diff --git a/input_fs.c b/input_fs.c
index 042134c..2aa1009 100644
--- a/input_fs.c
+++ b/input_fs.c
@@ -46,7 +46,7 @@ static t_file_desc *complete_info_from_fs(char *path, t_file_desc *desc) {
PFERROR("readlink(%s)", path);
} else {
temp[l] = 0;
- desc->link = strdup(temp);
+ desc->link = (unsigned char*)strdup(temp);
desc->md5 = checksum_md5_from_data(temp, l);
}
}