From 9af9d28a46452e2c1a41544f97ea5bb51da4965d Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 31 Aug 2015 18:13:34 -0400 Subject: [PATCH] sys-fs/e2tools: fix various build time warnings --- sys-fs/e2tools/e2tools-0.0.16.ebuild | 4 +- .../files/e2tools-0.0.16-prototypes.patch | 167 ++++++++++++++++++ .../files/e2tools-0.0.16-qsort-const.patch | 102 +++++++++++ 3 files changed, 272 insertions(+), 1 deletion(-) create mode 100644 sys-fs/e2tools/files/e2tools-0.0.16-prototypes.patch create mode 100644 sys-fs/e2tools/files/e2tools-0.0.16-qsort-const.patch diff --git a/sys-fs/e2tools/e2tools-0.0.16.ebuild b/sys-fs/e2tools/e2tools-0.0.16.ebuild index 052ef631c0f7..6bf35dbf2a66 100644 --- a/sys-fs/e2tools/e2tools-0.0.16.ebuild +++ b/sys-fs/e2tools/e2tools-0.0.16.ebuild @@ -4,7 +4,7 @@ EAPI="5" -inherit toolchain-funcs +inherit toolchain-funcs eutils DESCRIPTION="utilities to read, write, and manipulate files in an ext2/ext3 filesystem" HOMEPAGE="http://home.earthlink.net/~k_sheff/sw/e2tools/" @@ -20,6 +20,8 @@ DEPEND="sys-fs/e2fsprogs RDEPEND="${DEPEND}" src_prepare() { + epatch "${FILESDIR}"/${P}-prototypes.patch + epatch "${FILESDIR}"/${P}-qsort-const.patch sed -i '/e2cp_LDADD/s:-L@[^@]*@::' Makefile.in || die } diff --git a/sys-fs/e2tools/files/e2tools-0.0.16-prototypes.patch b/sys-fs/e2tools/files/e2tools-0.0.16-prototypes.patch new file mode 100644 index 000000000000..39a9ddb7daad --- /dev/null +++ b/sys-fs/e2tools/files/e2tools-0.0.16-prototypes.patch @@ -0,0 +1,167 @@ +fix various missing prototype warnings + +--- a/e2tools.h ++++ b/e2tools.h +@@ -63,38 +63,33 @@ + #define E2T_FORCE 1 + #define E2T_DO_MV 2 + +-#ifndef COPY_C ++/* copy.c */ + extern long copy(int argc, char *argv[]); + extern int my_strcmp(const void *n1, const void *n2); +-#endif + +-#ifdef LN_C ++/* ln.c */ + extern long do_ln(int argc, char *argv[]); + + extern long create_hard_link(ext2_filsys fs, ext2_ino_t cwd, ext2_ino_t + new_file_ino, char *newfile, int ln_flags); +-#endif + +-#ifndef LS_C ++/* ls.c */ + extern long do_list_dir(int argc, char *argv[]); +-#endif + +-#ifndef MKDIR_C ++/* mkdir.c */ + extern long e2mkdir(int argc, char *argv[]); + extern long create_dir(ext2_filsys fs, ext2_ino_t root, ext2_ino_t *cwd, + char *dirname, struct stat *def_stat); +-#endif ++extern long change_cwd(ext2_filsys fs, ext2_ino_t root, ext2_ino_t *cwd, ++ char *dirname); + +-#ifdef MV_C ++/* mv.c */ + extern long do_mv(int argc, char *argv[]); + extern long get_file_parts(ext2_filsys fs, ext2_ino_t root, char *pathname, + ext2_ino_t *dir_ino, char **dir_name, + char **base_name); + +-#endif +- +- +-#ifndef READ_C ++/* read.c */ + extern long get_file(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, + char *infile, char *outfile, int keep); + extern long retrieve_data(ext2_filsys fs, ext2_ino_t src, int dest_fd, +@@ -102,17 +97,14 @@ extern long retrieve_data(ext2_filsys fs, ext2_ino_t src, int dest_fd, + ext2_off_t *ret_pos); + extern long read_to_eof(ext2_file_t infile, int dest_fd, ext2_off_t offset, + ext2_off_t *ret_pos); +-#endif + +-#ifndef RM_C ++/* rm.c */ + extern long e2rm(int argc, char *argv[]); +-#endif + +-#ifndef TAIL_C ++/* tail.c */ + extern long do_tail(int argc, char *argv[]); +-#endif + +-#ifndef UTIL_C ++/* util.c */ + extern mode_t ext2_mode_xlate(__u16 lmode); + extern __u16 host_mode_xlate(mode_t hmode); + extern long open_filesystem(char *name, ext2_filsys *fs, ext2_ino_t *root, int +@@ -125,13 +117,14 @@ extern long rm_file(ext2_filsys fs, ext2_ino_t cwd, char *outfile, ext2_ino_t + delfile); + extern long delete_file(ext2_filsys fs, ext2_ino_t inode); + extern void init_stat_buf(struct stat *buf); +-#endif ++#include ++extern regex_t *make_regexp(char *shell); ++extern int is_file_regexp(char *ptr); + +-#ifndef WRITE_C ++/* write.c */ + extern long + put_file(ext2_filsys fs, ext2_ino_t cwd, char *infile, char *outfile, + ext2_ino_t *outfile_ino, int keep, struct stat *def_stat); +-#endif + + #endif + +--- a/elist.c ++++ b/elist.c +@@ -41,12 +41,9 @@ + /* Feature Test Switches */ + /* Headers */ + #include ++#include + #include "elist.h" + +-#ifndef NULL +-#define NULL ((void *)0) +-#endif +- + elist_t * + elist_new() + { +--- a/ls.c ++++ b/ls.c +@@ -703,7 +703,7 @@ void short_disp(ls_file_t *info, int *col, int options) + char lbr, rbr; + char tmp[300]; + int thislen; +- static max_col_size = 0; ++ static int max_col_size = 0; + + if (max_col_size == 0) + { +--- a/mkdir.c ++++ b/mkdir.c +@@ -357,7 +357,7 @@ create_dir(ext2_filsys fs, ext2_ino_t root, ext2_ino_t *cwd, + def_stat))) + { + fprintf(stderr, +- "create_dir: error creating directory %s/%s:%d\n", ++ "create_dir: error creating directory %s/%s:%ld\n", + dirname, dname, retval); + ext2fs_free_mem((void **) &buf); + return(retval); +@@ -415,7 +415,7 @@ create_dir(ext2_filsys fs, ext2_ino_t root, ext2_ino_t *cwd, + if ((retval = create_subdir(fs, root, cwd, dirname, def_stat))) + { + fprintf(stderr, +- "create_dir: error creating directory %s:%d\n", ++ "create_dir: error creating directory %s:%ld\n", + dirname, retval); + return(retval); + } +--- a/progress.c ++++ b/progress.c +@@ -26,6 +26,8 @@ + /* Feature Test Switches */ + /* System Headers */ + #include ++#include ++#include + #include + #include + #include +@@ -154,7 +156,7 @@ void update_progress(unsigned long num_bytes) + if (prog_sbuf != NULL && prog_time != tv.tv_sec) + { + prog_time = tv.tv_sec; +- fprintf(stderr, "%s %10d / %10d\r", prog_file, num_bytes, ++ fprintf(stderr, "%s %10lu / %10jd\r", prog_file, num_bytes, + prog_sbuf->st_size); + fflush(stderr); + } +--- a/rm.c ++++ b/rm.c +@@ -244,7 +244,6 @@ e2rm(int argc, char *argv[]) + retval = ext2fs_dir_iterate2(gbl_fs, curr_ino, + DIRENT_FLAG_INCLUDE_EMPTY, 0, + rm_dir_proc, +- (void *) + (verbose) ? &verbose : NULL); + } + else diff --git a/sys-fs/e2tools/files/e2tools-0.0.16-qsort-const.patch b/sys-fs/e2tools/files/e2tools-0.0.16-qsort-const.patch new file mode 100644 index 000000000000..532b8fb45630 --- /dev/null +++ b/sys-fs/e2tools/files/e2tools-0.0.16-qsort-const.patch @@ -0,0 +1,102 @@ +the qsort func expects a callback with const pointers, so update all the +prototypes to match + +--- a/elist.c ++++ b/elist.c +@@ -136,7 +133,7 @@ elist_insert(elist_t *l, void *data) + return(l); + } + +-void elist_sort(elist_t *l, int (sort_func)(void *, void *), int reverse) ++void elist_sort(elist_t *l, int (sort_func)(const void *, const void *), int reverse) + { + int c=0; + elist_t *tl; +--- a/elist.h ++++ b/elist.h +@@ -33,7 +33,7 @@ extern void elist_free(elist_t *l, void (*data_free)(void *)); + extern elist_t * elist_append(elist_t *l, void *data); + extern elist_t * elist_insert(elist_t *l, void *data); + extern void +-elist_sort(elist_t *l, int (sort_func)(void *, void *), int reverse); ++elist_sort(elist_t *l, int (sort_func)(const void *, const void *), int reverse); + #endif + + #endif +--- a/ls.c ++++ b/ls.c +@@ -98,15 +98,15 @@ long_disp(ls_file_t *info, int *col, int options); + void + short_disp(ls_file_t *info, int *col, int options); + int +-no_sort(void *n1, void *n2); ++no_sort(const void *n1, const void *n2); + int +-name_sort(void *n1, void *n2); ++name_sort(const void *n1, const void *n2); + int +-inode_sort(void *n1, void *n2); ++inode_sort(const void *n1, const void *n2); + int +-mod_time_sort(void *n1, void *n2); ++mod_time_sort(const void *n1, const void *n2); + int +-creat_time_sort(void *n1, void *n2); ++creat_time_sort(const void *n1, const void *n2); + long + add_ls_file(char *name, int namelen, ext2_ino_t dir, ext2_ino_t ino, + int entry, int type, struct list_dir_struct *ls); +@@ -331,7 +331,7 @@ do_list_dir(int argc, char *argv[]) + char *dup_path = NULL; + char *dir_name; + char *base_name; +- int (*file_sort)(void *n1, void *n2) = name_sort; ++ int (*file_sort)(const void *n1, const void *n2) = name_sort; + void (*file_disp)(ls_file_t *n, int *col, int options) = short_disp; + elist_t *files=NULL; + int col=0; +@@ -791,7 +791,7 @@ void short_disp(ls_file_t *info, int *col, int options) + * MM/DD/YY Name Description + * + */ +-int no_sort(void *n1, void *n2) ++int no_sort(const void *n1, const void *n2) + { + ls_file_t *f1 = *((ls_file_t **) n1); + ls_file_t *f2 = *((ls_file_t **) n2); +@@ -835,7 +835,7 @@ int no_sort(void *n1, void *n2) + * MM/DD/YY Name Description + * + */ +-int name_sort(void *n1, void *n2) ++int name_sort(const void *n1, const void *n2) + { + ls_file_t *f1 = *((ls_file_t **) n1); + ls_file_t *f2 = *((ls_file_t **) n2); +@@ -880,7 +880,7 @@ int name_sort(void *n1, void *n2) + * MM/DD/YY Name Description + * + */ +-int inode_sort(void *n1, void *n2) ++int inode_sort(const void *n1, const void *n2) + { + ls_file_t *f1 = *((ls_file_t **) n1); + ls_file_t *f2 = *((ls_file_t **) n2); +@@ -925,7 +925,7 @@ int inode_sort(void *n1, void *n2) + * MM/DD/YY Name Description + * + */ +-int mod_time_sort(void *n1, void *n2) ++int mod_time_sort(const void *n1, const void *n2) + { + ls_file_t *f1 = *((ls_file_t **) n1); + ls_file_t *f2 = *((ls_file_t **) n2); +@@ -971,7 +971,7 @@ int mod_time_sort(void *n1, void *n2) + * MM/DD/YY Name Description + * + */ +-int creat_time_sort(void *n1, void *n2) ++int creat_time_sort(const void *n1, const void *n2) + { + ls_file_t *f1 = *((ls_file_t **) n1); + ls_file_t *f2 = *((ls_file_t **) n2); -- 2.26.2