Compare commits

...

8 Commits

Author SHA1 Message Date
Bram Moolenaar
9ac38129b6 patch 8.2.3721: using memory freed by losing the clipboard selection
Problem:    Using memory freed by losing the clipboard selection. (Dominique
            Pellé)
Solution:   Check y_array is still valid after calling changed_lines().
            (closes #9253)
2021-12-02 18:42:33 +00:00
Bram Moolenaar
69c76171f1 patch 8.2.3720: Vim9: Internal error when invoking closure in legacy context
Problem:    Vim9: Internal error when invoking closure in legacy context.
Solution:   Give a more appropriate error message. (closes #9251)
2021-12-02 16:38:52 +00:00
Bram Moolenaar
f8bc0ce267 patch 8.2.3719: MS-Windows: test sometimes runs into existing swap file
Problem:    MS-Windows: test sometimes runs into existing swap file.
Solution:   Use a different file name.
2021-12-02 12:30:22 +00:00
Bram Moolenaar
3569c0de67 patch 8.2.3718: compiler warns for unused variable without +textprop
Problem:    Compiler warns for unused variable without the +textprop feature.
            (John Marriott)
Solution:   Adjust #ifdefs.
2021-12-02 11:34:21 +00:00
Bram Moolenaar
db9ff9ab5d patch 8.2.3717: Vim9: error for constant list size is only given at runtime
Problem:    Vim9: error for constant list size is only given at runtime.
Solution:   Give the error at compile time if possible.
2021-12-01 17:38:01 +00:00
Bram Moolenaar
e4eed8c6db patch 8.2.3716: Vim9: range without a command is not compiled
Problem:    Vim9: range without a command is not compiled.
Solution:   Add the ISN_EXECRANGE byte code.
2021-12-01 15:22:56 +00:00
Bram Moolenaar
f0e496a85a patch 8.2.3715: Vim9: valgrind reports spurious problems for a test
Problem:    Vim9: valgrind reports spurious problems for a test.
Solution:   Move the test to the set that is known to fail.
2021-12-01 12:41:31 +00:00
DungSaga
7e5503c17a patch 8.2.3714: some unused assignments and ugly code in xxd
Problem:    Some unused assignments and ugly code in xxd.
Solution:   Leave out assignments.  Use marcro for fprintf(). (closes #9246)
2021-12-01 11:24:52 +00:00
17 changed files with 272 additions and 91 deletions

View File

@@ -265,13 +265,14 @@ win_line(
int c_extra = NUL; // extra chars, all the same
int c_final = NUL; // final char, mandatory if set
int extra_attr = 0; // attributes when n_extra != 0
#ifdef FEAT_LINEBREAK
#if defined(FEAT_LINEBREAK) && defined(FEAT_PROP_POPUP)
int in_linebreak = FALSE; // n_extra set for showing linebreak
#endif
static char_u *at_end_str = (char_u *)""; // used for p_extra when
// displaying eol at end-of-line
int lcs_eol_one = wp->w_lcs_chars.eol; // eol until it's been used
int lcs_prec_todo = wp->w_lcs_chars.prec; // prec until it's been used
int lcs_prec_todo = wp->w_lcs_chars.prec;
// prec until it's been used
// saved "extra" items for when draw_state becomes WL_LINE (again)
int saved_n_extra = 0;
@@ -1717,7 +1718,7 @@ win_line(
++p_extra;
}
--n_extra;
#ifdef FEAT_LINEBREAK
#if defined(FEAT_LINEBREAK) && defined(FEAT_PROP_POPUP)
if (n_extra <= 0)
in_linebreak = FALSE;
#endif
@@ -2046,8 +2047,10 @@ win_line(
c_extra = mb_off > 0 ? MB_FILLER_CHAR : ' ';
c_final = NUL;
# if defined(FEAT_PROP_POPUP)
if (n_extra > 0 && c != TAB)
in_linebreak = TRUE;
# endif
if (VIM_ISWHITE(c))
{
# ifdef FEAT_CONCEAL

View File

@@ -316,7 +316,8 @@ EXTERN char e_cannot_index_number[]
INIT(= N_("E1062: Cannot index a Number"));
EXTERN char e_type_mismatch_for_v_variable[]
INIT(= N_("E1063: Type mismatch for v: variable"));
// E1064 unused
EXTERN char e_yank_register_changed_while_using_it[]
INIT(= N_("E1064: Yank register changed while using it"));
// E1065 unused
EXTERN char e_cannot_declare_a_register_str[]
INIT(= N_("E1066: Cannot declare a register: %s"));
@@ -689,3 +690,5 @@ EXTERN char e_cannot_find_variable_to_unlock_str[]
INIT(= N_("E1246: Cannot find variable to (un)lock: %s"));
EXTERN char e_line_number_out_of_range[]
INIT(= N_("E1247: Line number out of range"));
EXTERN char e_closure_called_from_invalid_context[]
INIT(= N_("E1248: Closure called from invalid context"));

View File

@@ -1977,43 +1977,7 @@ do_one_cmd(
*/
if (ea.skip) // skip this if inside :if
goto doend;
if ((*ea.cmd == '|' || (exmode_active && ea.line1 != ea.line2))
#ifdef FEAT_EVAL
&& !vim9script
#endif
)
{
ea.cmdidx = CMD_print;
ea.argt = EX_RANGE+EX_COUNT+EX_TRLBAR;
if ((errormsg = invalid_range(&ea)) == NULL)
{
correct_range(&ea);
ex_print(&ea);
}
}
else if (ea.addr_count != 0)
{
if (ea.line2 > curbuf->b_ml.ml_line_count)
{
// With '-' in 'cpoptions' a line number past the file is an
// error, otherwise put it at the end of the file.
if (vim_strchr(p_cpo, CPO_MINUS) != NULL)
ea.line2 = -1;
else
ea.line2 = curbuf->b_ml.ml_line_count;
}
if (ea.line2 < 0)
errormsg = _(e_invalid_range);
else
{
if (ea.line2 == 0)
curwin->w_cursor.lnum = 1;
else
curwin->w_cursor.lnum = ea.line2;
beginline(BL_SOL | BL_FIX);
}
}
errormsg = ex_range_without_command(&ea);
goto doend;
}
@@ -2707,6 +2671,55 @@ ex_errmsg(char *msg, char_u *arg)
return ex_error_buf;
}
/*
* Handle a range without a command.
* Returns an error message on failure.
*/
char *
ex_range_without_command(exarg_T *eap)
{
char *errormsg = NULL;
if ((*eap->cmd == '|' || (exmode_active && eap->line1 != eap->line2))
#ifdef FEAT_EVAL
&& !in_vim9script()
#endif
)
{
eap->cmdidx = CMD_print;
eap->argt = EX_RANGE+EX_COUNT+EX_TRLBAR;
if ((errormsg = invalid_range(eap)) == NULL)
{
correct_range(eap);
ex_print(eap);
}
}
else if (eap->addr_count != 0)
{
if (eap->line2 > curbuf->b_ml.ml_line_count)
{
// With '-' in 'cpoptions' a line number past the file is an
// error, otherwise put it at the end of the file.
if (vim_strchr(p_cpo, CPO_MINUS) != NULL)
eap->line2 = -1;
else
eap->line2 = curbuf->b_ml.ml_line_count;
}
if (eap->line2 < 0)
errormsg = _(e_invalid_range);
else
{
if (eap->line2 == 0)
curwin->w_cursor.lnum = 1;
else
curwin->w_cursor.lnum = eap->line2;
beginline(BL_SOL | BL_FIX);
}
}
return errormsg;
}
/*
* Check for an Ex command with optional tail.
* If there is a match advance "pp" to the argument and return TRUE.

View File

@@ -7,6 +7,7 @@ int getline_equal(char_u *(*fgetline)(int, void *, int, getline_opt_T), void *co
void *getline_cookie(char_u *(*fgetline)(int, void *, int, getline_opt_T), void *cookie);
char_u *getline_peek(char_u *(*fgetline)(int, void *, int, getline_opt_T), void *cookie);
char *ex_errmsg(char *msg, char_u *arg);
char *ex_range_without_command(exarg_T *eap);
int checkforcmd(char_u **pp, char *cmd, int len);
int checkforcmd_noparen(char_u **pp, char *cmd, int len);
int parse_command_modifiers(exarg_T *eap, char **errormsg, cmdmod_T *cmod, int skip_only);
@@ -22,7 +23,7 @@ int cmd_exists(char_u *name);
void f_fullcommand(typval_T *argvars, typval_T *rettv);
cmdidx_T excmd_get_cmdidx(char_u *cmd, int len);
long excmd_get_argt(cmdidx_T idx);
char_u *skip_range(char_u *cmd, int skip_star, int *ctx);
char_u *skip_range(char_u *cmd_start, int skip_star, int *ctx);
void ex_ni(exarg_T *eap);
int expand_filename(exarg_T *eap, char_u **cmdlinep, char **errormsgp);
void separate_nextcmd(exarg_T *eap);

View File

@@ -1550,6 +1550,7 @@ do_put(
long j;
struct block_def bd;
char_u **y_array = NULL;
yankreg_T *y_current_used = NULL;
long nr_lines = 0;
pos_T new_cursor;
int indent;
@@ -1660,6 +1661,7 @@ do_put(
y_width = y_current->y_width;
y_size = y_current->y_size;
y_array = y_current->y_array;
y_current_used = y_current;
}
if (y_type == MLINE)
@@ -2208,6 +2210,14 @@ error:
else
changed_lines(curbuf->b_op_start.lnum, 0,
curbuf->b_op_start.lnum, nr_lines);
if (y_current_used != NULL && (y_current_used != y_current
|| y_current->y_array != y_array))
{
// Something invoked through changed_lines() has changed the
// yank buffer, e.g. a GUI clipboard callback.
emsg(_(e_yank_register_changed_while_using_it));
goto end;
}
// Put the '] mark on the first byte of the last inserted character.
// Correct the length for change in indent.

View File

@@ -389,12 +389,12 @@ func Test_buffer_scheme()
set noshellslash
%bwipe!
let bufnames = [
\ #{id: 'b0', name: 'test://xyz/foo/b0' , match: 1},
\ #{id: 'b1', name: 'test+abc://xyz/foo/b1', match: 0},
\ #{id: 'b2', name: 'test_abc://xyz/foo/b2', match: 0},
\ #{id: 'b3', name: 'test-abc://xyz/foo/b3', match: 1},
\ #{id: 'b4', name: '-test://xyz/foo/b4' , match: 0},
\ #{id: 'b5', name: 'test-://xyz/foo/b5' , match: 0},
\ #{id: 'ssb0', name: 'test://xyz/foo/ssb0' , match: 1},
\ #{id: 'ssb1', name: 'test+abc://xyz/foo/ssb1', match: 0},
\ #{id: 'ssb2', name: 'test_abc://xyz/foo/ssb2', match: 0},
\ #{id: 'ssb3', name: 'test-abc://xyz/foo/ssb3', match: 1},
\ #{id: 'ssb4', name: '-test://xyz/foo/ssb4' , match: 0},
\ #{id: 'ssb5', name: 'test-://xyz/foo/ssb5' , match: 0},
\]
for buf in bufnames
new `=buf.name`

View File

@@ -383,6 +383,27 @@ def Test_assign_unpack()
END
CheckDefAndScriptSuccess(lines)
lines =<< trim END
var v1: number
var v2: number
[v1, v2] = [1, 2, 3]
END
CheckDefFailure(lines, 'E1093: Expected 2 items but got 3', 3)
lines =<< trim END
var v1: number
var v2: number
[v1, v2] = [1]
END
CheckDefFailure(lines, 'E1093: Expected 2 items but got 1', 3)
lines =<< trim END
var v1: number
var v2: number
[v1, v2; _] = [1]
END
CheckDefFailure(lines, 'E1093: Expected 2 items but got 1', 3)
lines =<< trim END
var v1: number
var v2: number

View File

@@ -1879,17 +1879,7 @@ def Test_job_info()
endif
enddef
def Test_job_info_return_type()
if !has('job')
CheckFeature job
else
job_start(&shell)
var jobs = job_info()
assert_equal('list<job>', typename(jobs))
assert_equal('dict<any>', typename(job_info(jobs[0])))
job_stop(jobs[0])
endif
enddef
" Test_job_info_return_type() is in test_vim9_fails.vim
def Test_job_setoptions()
if !has('job')

View File

@@ -471,7 +471,6 @@ def Test_disassemble_list_assign_with_op()
'\d\+ PUSHNR 4\_s*' ..
'\d\+ PUSHNR 5\_s*' ..
'\d\+ NEWLIST size 2\_s*' ..
'\d\+ CHECKLEN 2\_s*' ..
'\d\+ LOAD $0\_s*' ..
'\d\+ ITEM 0 with op\_s*' ..
'\d\+ OPNR +\_s*' ..
@@ -1999,6 +1998,25 @@ def Test_disassemble_execute()
res)
enddef
def s:OnlyRange()
:$
:123
:'m
enddef
def Test_disassemble_range_only()
var res = execute('disass s:OnlyRange')
assert_match('\<SNR>\d*_OnlyRange\_s*' ..
':$\_s*' ..
'\d EXECRANGE $\_s*' ..
':123\_s*' ..
'\d EXECRANGE 123\_s*' ..
':''m\_s*' ..
'\d EXECRANGE ''m\_s*' ..
'\d\+ RETURN void',
res)
enddef
def s:Echomsg()
echomsg 'some' 'message'
echoconsole 'nothing'

View File

@@ -8,3 +8,17 @@ def Test_assignment()
var job2: job = job_start('willfail')
endif
enddef
" Unclear why this test causes valgrind to report problems.
def Test_job_info_return_type()
if !has('job')
CheckFeature job
else
var job: job = job_start(&shell)
var jobs = job_info()
assert_equal('list<job>', typename(jobs))
assert_equal('dict<any>', typename(job_info(jobs[0])))
job_stop(job)
endif
enddef

View File

@@ -2384,6 +2384,21 @@ def Test_global_closure_called_directly()
delfunc g:Inner
enddef
def Test_closure_called_from_legacy()
var lines =<< trim END
vim9script
def Func()
var outer = 'foo'
var F = () => {
outer = 'bar'
}
execute printf('call %s()', string(F))
enddef
Func()
END
CheckScriptFailure(lines, 'E1248')
enddef
def Test_failure_in_called_function()
# this was using the frame index as the return value
var lines =<< trim END

View File

@@ -496,8 +496,9 @@ def Test_try_catch_throw()
endtry
assert_equal(266, n)
l = [1, 2, 3]
try
[n] = [1, 2, 3]
[n] = l
catch /E1093:/
n = 277
endtry
@@ -4327,7 +4328,8 @@ def Test_catch_exception_in_callback()
var x: string
var y: string
# this error should be caught with CHECKLEN
[x, y] = ['']
var sl = ['']
[x, y] = sl
catch
g:caught = 'yes'
endtry

View File

@@ -753,6 +753,22 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
3721,
/**/
3720,
/**/
3719,
/**/
3718,
/**/
3717,
/**/
3716,
/**/
3715,
/**/
3714,
/**/
3713,
/**/

View File

@@ -15,6 +15,7 @@ typedef enum {
ISN_EXEC, // execute Ex command line isn_arg.string
ISN_EXECCONCAT, // execute Ex command from isn_arg.number items on stack
ISN_EXEC_SPLIT, // execute Ex command from isn_arg.string split at NL
ISN_EXECRANGE, // execute EX command that is only a range
ISN_LEGACY_EVAL, // evaluate expression isn_arg.string with legacy syntax.
ISN_ECHO, // :echo with isn_arg.echo.echo_count items on top of stack
ISN_EXECUTE, // :execute with isn_arg.number items on top of stack

View File

@@ -2275,8 +2275,12 @@ generate_PUT(cctx_T *cctx, int regname, linenr_T lnum)
return OK;
}
/*
* Generate an EXEC instruction that takes a string argument.
* A copy is made of "line".
*/
static int
generate_EXEC(cctx_T *cctx, isntype_T isntype, char_u *line)
generate_EXEC_copy(cctx_T *cctx, isntype_T isntype, char_u *line)
{
isn_T *isn;
@@ -2287,6 +2291,29 @@ generate_EXEC(cctx_T *cctx, isntype_T isntype, char_u *line)
return OK;
}
/*
* Generate an EXEC instruction that takes a string argument.
* "str" must be allocated, it is consumed.
*/
static int
generate_EXEC(cctx_T *cctx, isntype_T isntype, char_u *str)
{
isn_T *isn;
if (cctx->ctx_skip == SKIP_YES)
{
vim_free(str);
return OK;
}
if ((isn = generate_instr(cctx, isntype)) == NULL)
{
vim_free(str);
return FAIL;
}
isn->isn_arg.string = str;
return OK;
}
static int
generate_LEGACY_EVAL(cctx_T *cctx, char_u *line)
{
@@ -6972,6 +6999,8 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
if (cctx->ctx_skip != SKIP_YES)
{
type_T *stacktype;
int needed_list_len;
int did_check = FALSE;
stacktype = stack->ga_len == 0 ? &t_void
: ((type_T **)stack->ga_data)[stack->ga_len - 1];
@@ -6983,9 +7012,26 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
if (need_type(stacktype, &t_list_any, -1, 0, cctx,
FALSE, FALSE) == FAIL)
goto theend;
// TODO: check the length of a constant list here
generate_CHECKLEN(cctx, semicolon ? var_count - 1 : var_count,
semicolon);
// If a constant list was used we can check the length right here.
needed_list_len = semicolon ? var_count - 1 : var_count;
if (instr->ga_len > 0)
{
isn_T *isn = ((isn_T *)instr->ga_data) + instr->ga_len - 1;
if (isn->isn_type == ISN_NEWLIST)
{
did_check = TRUE;
if (semicolon ? isn->isn_arg.number < needed_list_len
: isn->isn_arg.number != needed_list_len)
{
semsg(_(e_expected_nr_items_but_got_nr),
needed_list_len, isn->isn_arg.number);
goto theend;
}
}
}
if (!did_check)
generate_CHECKLEN(cctx, needed_list_len, semicolon);
if (stacktype->tt_member != NULL)
rhs_type = stacktype->tt_member;
}
@@ -7552,7 +7598,7 @@ compile_lock_unlock(
vim_snprintf((char *)buf, len, "%s %s",
eap->cmdidx == CMD_lockvar ? "lockvar" : "unlockvar",
p);
ret = generate_EXEC(cctx, isn, buf);
ret = generate_EXEC_copy(cctx, isn, buf);
vim_free(buf);
*name_end = cc;
@@ -9248,7 +9294,7 @@ compile_exec(char_u *line_arg, exarg_T *eap, cctx_T *cctx)
generate_EXECCONCAT(cctx, count);
}
else
generate_EXEC(cctx, ISN_EXEC, line);
generate_EXEC_copy(cctx, ISN_EXEC, line);
theend:
if (*nextcmd != NUL)
@@ -9874,10 +9920,12 @@ compile_def_function(
if (ends_excmd2(line, ea.cmd))
{
// A range without a command: jump to the line.
// TODO: compile to a more efficient command, possibly
// calling parse_cmd_address().
ea.cmdidx = CMD_SIZE;
line = compile_exec(line, &ea, &cctx);
line = skipwhite(line);
while (*line == ':')
++line;
generate_EXEC(&cctx, ISN_EXECRANGE,
vim_strnsave(line, ea.cmd - line));
line = ea.cmd;
goto nextline;
}
}
@@ -10350,6 +10398,7 @@ delete_instr(isn_T *isn)
{
case ISN_DEF:
case ISN_EXEC:
case ISN_EXECRANGE:
case ISN_EXEC_SPLIT:
case ISN_LEGACY_EVAL:
case ISN_LOADAUTO:

View File

@@ -1774,6 +1774,28 @@ exec_instructions(ectx_T *ectx)
}
break;
// execute Ex command line that is only a range
case ISN_EXECRANGE:
{
exarg_T ea;
char *error = NULL;
CLEAR_FIELD(ea);
ea.cmdidx = CMD_SIZE;
ea.addr_type = ADDR_LINES;
ea.cmd = iptr->isn_arg.string;
parse_cmd_address(&ea, &error, FALSE);
if (error == NULL)
error = ex_range_without_command(&ea);
if (error != NULL)
{
SOURCING_LNUM = iptr->isn_lnum;
emsg(error);
goto on_error;
}
}
break;
// Evaluate an expression with legacy syntax, push it onto the
// stack.
case ISN_LEGACY_EVAL:
@@ -2711,7 +2733,13 @@ exec_instructions(ectx_T *ectx)
if (outer == NULL)
{
SOURCING_LNUM = iptr->isn_lnum;
iemsg("LOADOUTER depth more than scope levels");
if (ectx->ec_frame_idx == ectx->ec_initial_frame_idx
|| ectx->ec_outer_ref == NULL)
// Possibly :def function called from legacy
// context.
emsg(_(e_closure_called_from_invalid_context));
else
iemsg("LOADOUTER depth more than scope levels");
goto theend;
}
tv = ((typval_T *)outer->out_stack->ga_data)
@@ -5068,6 +5096,9 @@ list_instructions(char *pfx, isn_T *instr, int instr_count, ufunc_T *ufunc)
case ISN_EXEC_SPLIT:
smsg("%s%4d EXEC_SPLIT %s", pfx, current, iptr->isn_arg.string);
break;
case ISN_EXECRANGE:
smsg("%s%4d EXECRANGE %s", pfx, current, iptr->isn_arg.string);
break;
case ISN_LEGACY_EVAL:
smsg("%s%4d EVAL legacy %s", pfx, current,
iptr->isn_arg.string);

View File

@@ -275,12 +275,8 @@ fputs_or_die(char *s, FILE *fpo)
perror_exit(3);
}
static void
fprintf_or_die(FILE *fpo, char *format, char *s, int d)
{
if (fprintf(fpo, format, s, d) < 0)
perror_exit(3);
}
/* Use a macro to allow for different arguments. */
#define FPRINTF_OR_DIE(args) if (fprintf args < 0) perror_exit(3)
static void
fclose_or_die(FILE *fpi, FILE *fpo)
@@ -377,7 +373,7 @@ huntype(
have_off = base_off + want_off;
#endif
if (base_off + want_off < have_off)
error_exit(5, "sorry, cannot seek backwards.");
error_exit(5, "Sorry, cannot seek backwards.");
for (; have_off < base_off + want_off; have_off++)
putc_or_die(0, fpo);
}
@@ -714,7 +710,7 @@ main(int argc, char *argv[])
if (revert)
{
if (hextype && (hextype != HEX_POSTSCRIPT))
error_exit(-1, "sorry, cannot revert this type of hexdump");
error_exit(-1, "Sorry, cannot revert this type of hexdump");
return huntype(fp, fpo, cols, hextype,
negseek ? -seekoff : seekoff);
}
@@ -728,7 +724,7 @@ main(int argc, char *argv[])
e = fseek(fp, negseek ? -seekoff : seekoff,
negseek ? SEEK_END : SEEK_SET);
if (e < 0 && negseek)
error_exit(4, "sorry cannot seek.");
error_exit(4, "Sorry, cannot seek.");
if (e >= 0)
seekoff = ftell(fp);
else
@@ -737,9 +733,9 @@ main(int argc, char *argv[])
long s = seekoff;
while (s--)
if ((c = getc_or_die(fp)) == EOF)
if (getc_or_die(fp) == EOF)
{
error_exit(4, "sorry cannot seek.");
error_exit(4, "Sorry, cannot seek.");
}
}
}
@@ -748,7 +744,7 @@ main(int argc, char *argv[])
{
if (fp != stdin)
{
fprintf_or_die(fpo, "unsigned char %s", isdigit((int)argv[1][0]) ? "__" : "", 0);
FPRINTF_OR_DIE((fpo, "unsigned char %s", isdigit((int)argv[1][0]) ? "__" : ""));
for (e = 0; (c = argv[1][e]) != 0; e++)
putc_or_die(isalnum(c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo);
fputs_or_die("[] = {\n", fpo);
@@ -758,8 +754,8 @@ main(int argc, char *argv[])
c = 0;
while ((length < 0 || p < length) && (c = getc_or_die(fp)) != EOF)
{
fprintf_or_die(fpo, (hexx == hexxa) ? "%s0x%02x" : "%s0X%02X",
(p % cols) ? ", " : (!p ? " " : ",\n "), c);
FPRINTF_OR_DIE((fpo, (hexx == hexxa) ? "%s0x%02x" : "%s0X%02X",
(p % cols) ? ", " : (!p ? " " : ",\n "), c));
p++;
}
@@ -769,10 +765,10 @@ main(int argc, char *argv[])
if (fp != stdin)
{
fputs_or_die("};\n", fpo);
fprintf_or_die(fpo, "unsigned int %s", isdigit((int)argv[1][0]) ? "__" : "", 0);
FPRINTF_OR_DIE((fpo, "unsigned int %s", isdigit((int)argv[1][0]) ? "__" : ""));
for (e = 0; (c = argv[1][e]) != 0; e++)
putc_or_die(isalnum(c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo);
fprintf_or_die(fpo, "_%s = %d;\n", capitalize ? "LEN" : "len", p);
FPRINTF_OR_DIE((fpo, "_%s = %d;\n", capitalize ? "LEN" : "len", p));
}
fclose_or_die(fp, fpo);
@@ -782,7 +778,6 @@ main(int argc, char *argv[])
if (hextype == HEX_POSTSCRIPT)
{
p = cols;
e = 0;
while ((length < 0 || n < length) && (e = getc_or_die(fp)) != EOF)
{
putc_or_die(hexx[(e >> 4) & 0xf], fpo);
@@ -807,7 +802,6 @@ main(int argc, char *argv[])
else /* hextype == HEX_BITS */
grplen = 8 * octspergrp + 1;
e = 0;
while ((length < 0 || n < length) && (e = getc_or_die(fp)) != EOF)
{
int x;