sed/sed-4.1.5-fix_warnings.patch

111 lines
2.7 KiB
Diff

Index: sed-4.1.5/lib/utils.c
===================================================================
--- sed-4.1.5.orig/lib/utils.c
+++ sed-4.1.5/lib/utils.c
@@ -97,7 +97,6 @@ panic(const char *str, ...)
{
if (open_files->temp)
{
- int fd = fileno (open_files->fp);
fclose (open_files->fp);
errno = 0;
unlink (open_files->name);
@@ -250,7 +249,7 @@ ck_getline(text, buflen, stream)
size_t *buflen;
FILE *stream;
{
- int result;
+ int result = -1;
if (!ferror (stream))
result = getline (text, buflen, stream);
@@ -312,7 +311,6 @@ void
do_ck_fclose(fp)
FILE *fp;
{
- int fd;
ck_fflush(fp);
clearerr(fp);
Index: sed-4.1.5/sed/compile.c
===================================================================
--- sed-4.1.5.orig/sed/compile.c
+++ sed-4.1.5/sed/compile.c
@@ -384,7 +384,6 @@ get_openfile(file_ptrs, mode, fail)
struct buffer *b;
char *file_name;
struct output *p;
- int is_stderr;
b = read_filename();
file_name = get_buffer(b);
@@ -457,7 +456,7 @@ snarf_char_class(b, cur_stat)
{
int ch;
int state = 0;
- int delim;
+ int delim = 0;
bool pending_mb = 0;
ch = inchar();
@@ -1581,7 +1580,6 @@ compile_file(cur_program, cmdfile)
struct vector *cur_program;
const char *cmdfile;
{
- size_t len;
struct vector *ret;
prog.file = stdin;
Index: sed-4.1.5/sed/execute.c
===================================================================
--- sed-4.1.5.orig/sed/execute.c
+++ sed-4.1.5/sed/execute.c
@@ -1062,7 +1062,7 @@ append_replacement (buf, p, regs, repl_m
curr_type &= ~REPL_MODIFIERS;
}
- if (0 <= i)
+ if (0 <= i) {
if (regs->end[i] == regs->start[i] && p->repl_type & REPL_MODIFIERS)
/* Save this modifier, we shall apply it later.
e.g. in s/()([a-z])/\u\1\2/
@@ -1073,6 +1073,7 @@ append_replacement (buf, p, regs, repl_m
str_append_modified(buf, line.active + regs->start[i],
CAST(size_t)(regs->end[i] - regs->start[i]),
curr_type);
+ }
}
return repl_mod;
@@ -1100,7 +1101,7 @@ do_subst(sub)
&regs, sub->max_id + 1))
return;
- if (!sub->replacement && sub->numb <= 1)
+ if (!sub->replacement && sub->numb <= 1) {
if (regs.start[0] == 0 && !sub->global)
{
/* We found a match, set the `replaced' flag. */
@@ -1119,6 +1120,7 @@ do_subst(sub)
line.length = regs.start[0];
goto post_subst;
}
+ }
do
{
@@ -1377,11 +1379,12 @@ execute_program(vec, input)
{
char buf[4096];
int n = fread (buf, sizeof(char), 4096, pipe);
- if (n > 0)
+ if (n > 0) {
if (!cmd_length)
str_append(&s_accum, buf, n);
else
ck_fwrite(buf, 1, n, output_file.fp);
+ }
}
pclose (pipe);