aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBertrand Jacquin <beber@meleeweb.net>2009-05-01 16:50:29 +0200
committerBertrand Jacquin <beber@meleeweb.net>2009-05-01 16:50:29 +0200
commit93bd5027e178073821376364372ce57462170d78 (patch)
treee5884bcfe87c34e80464333141cfc9a3a0ca5053
parentflx: Fix gcc-4.3 'declared with attribute warn_unused_result' (diff)
downloadflxutils-93bd5027e178073821376364372ce57462170d78.tar.gz
flx: Fix signedness warnings
-rw-r--r--flx/fct1.c22
-rw-r--r--flx/flx.h4
-rw-r--r--flx/input_file.c2
-rw-r--r--flx/input_fs.c2
4 files changed, 15 insertions, 15 deletions
diff --git a/flx/fct1.c b/flx/fct1.c
index c074a7a..d7f0921 100644
--- a/flx/fct1.c
+++ b/flx/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);
}
}
@@ -93,14 +93,14 @@ 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 (!(diff & DIFF_LINK) && strcmp(f1->link, f2->link))
+ if (!(diff & DIFF_LINK) && strcmp((const char*)f1->link, (const char*)f2->link))
diff |= DIFF_LINK; /* links differ */
}
}
@@ -223,10 +223,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 ) {
@@ -235,7 +235,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
@@ -247,12 +247,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);
@@ -366,7 +366,7 @@ char *build_line(char *path, char *filename, t_file_desc *info) {
s += sprintf(blk+s, "%s", escape_str(path));
if (S_ISLNK(st->st_mode) && info->link)
- s += sprintf(blk+s, " %s", escape_str(info->link));
+ s += sprintf(blk+s, " %s", escape_str((char*)info->link));
}
else {
if (IS(Options, GOPT_HUMAN_READABLE))
diff --git a/flx/flx.h b/flx/flx.h
index 3315ded..7d0d62d 100644
--- a/flx/flx.h
+++ b/flx/flx.h
@@ -216,8 +216,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/flx/input_file.c b/flx/input_file.c
index ec50c02..01c250a 100644
--- a/flx/input_file.c
+++ b/flx/input_file.c
@@ -132,7 +132,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/flx/input_fs.c b/flx/input_fs.c
index e64f9da..a7e3d2f 100644
--- a/flx/input_fs.c
+++ b/flx/input_fs.c
@@ -47,7 +47,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);
}
}