Age | Commit message (Collapse) | Author |
|
unchecked integer overflows in this file.
(TRUE, FALSE): Remove. All uses replaced by true and false.
(struct COLUMN, read_line, print_page, print_stored, open_file,
skip_to_page, init_fps, parallel_files, align_empty_cols,
empty_line, FF_only, explicit_columns, extremities, keep_FF,
print_a_FF, print_a_header, use_form_feed, have_read_stdin,
print_across_flag, storing_columns, balance_columns,
truncate_lines, join_lines, untabify_input, failed_opens,
numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
double_space, ignore_failed_opens, use_col_separator,
pad_vertically, last_line, main, init_parameters, skip_read,
read_line, print_stored):
Use bool for booleans.
(struct COLUMN, char_to_clump, store_char, print_char):
Use char for chars.
(clump_buff, print_clump): Use char[], not int[], for an array whose
elements are always chars.
(first_last_page, main, getoptarg, balance, add_line_number,
char_to_uclump): Remove unnecessary casts.
(init_parameters): Allocate chars, not ints, for clump_buff.
(print_char): Use to_uchar before invoking ISPRINT.
(char_to_clump): Convert to unsigned char before invoking ISPRINT.
|
|
Do not assume that the environ has at most one matching entry
for each option (integer overflow was possible otherwise).
|
|
(portable_chars_only): Use to_uchar rather than a cast.
|
|
|
|
|
|
constant. Do not assume PRIdMAX etc. are strings of length 3 or
less.
(struct tspec): Use it. fmt_string is now an array, not
a pointer, as there's little point to the indirection here.
(struct tspec, flag_dump_strings,
traditional, flag_pseudo_start, limit_bytes_to_format,
abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
decode_one_format, open_next_file, check_and_close,
decode_format_string, skip, write_block, read_char, read_block,
parse_old_offset, dump, dump_strings, main):
Use bool for booleans.
(struct tspec): Use void *, not char *, for generic pointers.
(bytes_to_oct_digits, bytes_to_signed_dec_digits,
bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
Use char, not unsigned int, since char suffices.
(print_s_char, print_char, print_s_short, print_short,
print_int, print_long, print_long_long, print_float,
print_double, print_long_double): Rewrite to avoid casts.
These now take void * arguments, instead of char *.
Use the same body for all functions, except for the choice
of type. Assume C89 to simplify handling of signed char.
(dump_hexl_mode_trailer, print_named_ascii, print_ascii):
Rewrite to avoid casts.
(print_named_ascii, print_ascii): Now takes void *, not char *.
(decode_one_format): Use int for printf field widths, not
unsigned int. Pass void * to subsidiary printers,
not char *. Simplify handling of floating-point formats
by factoring out common code dealing with precision and field width.
(decode_format_string): Avoid need for temporary copy of
each decoded struct tspec.
(get_lcm): Remove unnecessary cast.
(main): Fix bug where more than INT_MAX failed decodes were ignored.
|
|
(enum number_format): Remove.
(FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
not enum values.
(DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
(section_del): Now const.
(print_fmt): Remove.
(starting_line_number, page_incr, blank_join, line_no,
print_lineno, proc_text, main):
Use intmax_t for line numbers.
(reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
Use bool for booleans.
(lineno_format): Now a string, not an enum value.
(build_print_fmt): Remove. All calls removed. This work is
now doen within print_lineno.
(build_type_arg): Use size_t for sizes.
(print_lineno): Check for line number overflow.
(proc_text, main): Remove unnecessary cast.
|
|
extract_dirs_from_files, color_symlink_as_referent,
FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
numeric_ids, print_block_size, dired, print_with_color,
check_symlink_color, print_inode, recursive, immediate_dirs,
all_files, really_all_files, qmark_funny_chars,
print_dir_name, format_needs_stat, format_needs_type, visit_dir,
main, decode_switches, parse_ls_color, print_dir, file_interesting,
gobble_file, make_link_path, basename_is_dot_or_dotdot,
extract_dirs_from_files, print_long_format):
Use bool for booleans.
(dir_defaulted): Remove; no longer needed.
(main): Use int to count files, since it suffices for argv.
Rewrite to avoid need for dir_defaulted.
(main, print_dir, gobble_file, get_link_name,
xstrcoll):
Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
(decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
Remove unnecessary cast to int. Use int instead of unsigned
int to count from 0 to 1.
(get_funky_string, print_type_indicator): Use char for bytes, not int.
(make_link_path): Use NULL for null pointers.
(quote_name): Use to_uchar instead of cast.
|
|
verbose, hard_dir_link, dereference_dest_dir_symlinks,
do_link, main): Use bool for booleans.
|
|
|
|
print_full_info): Use bool for booleans.
(problems): Remove, replacing with....
(ok): New var (inverted from old sense).
(print_user, print_group, print_full_info):
Print uids/gids with %lu, not %u.
(xgetgroups): Don't run out of memory if getgroups or getugroups
returns -1.
|
|
write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
elide_tail_lines_pipe, elide_tail_lines_seekable,
elide_tail_lines_file, head_bytes, head_lines, head, head_file,
string_to_integer, main):
Use bool for booleans.
(main): Rewrite to avoid cast.
|
|
(fold_file, main): Use bool for booleans.
(fold_file, main): Use size_t for sizes.
(main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
of prohibiting widths greater than INT_MAX.
|
|
int, since it suffices.
(factor, print_factors): Use size_t for sizes.
(print_factors, do_stdin, main): Use bool for booleans.
|
|
|
|
|
|
|
|
(cut_file, main): Use bool for booleans.
|
|
(main): Remove unnecessary cast.
|
|
fmt's arbitrary limits.
(TRUE, FALSE): Remove; all uses changed to (true, false).
(main): Use bool for booleans.
Limit maximum width to MAXCHARS / 2. Use xstrtoul, not xstrtol,
to parse width.
(copy_rest): Remove unnecessary cast.
(get_prefix): Rewrite to avoid cast.
(check_punctuation): Use char *, not unsigned char *; C89 requires
this. Avoid off-by-one buffer read overrun when line is empty.
(flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
Remove unnecessary casts.
|
|
next_file, expand, main):
Use bool for booleans.
(tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
expand, main):
Use uintmax_t for column counts.
(add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
All callers changed.
(parse_tabstops): Don't pass a negative char to isblank.
Avoid memory leak with large tab stops.
(validate_tabstops, expand): Don't assume number of tab stops is
<= INT_MAX.
(next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
storing values into exit_status.
(expand): Use same pattern as unexpand for reading chars.
Report an error when input line is too long, instead of silently
screwing up. Do not mishandle tab stops when backspacing left
over start of line.
|
|
dc_parse_stream, dc_parse_file, main): Use bool for booleans.
(dc_parse_stream): Use enum for state, rather than int.
Use ssize_t to store getline result.
|
|
apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
Use bool for booleans.
(translate_buffer): Use to_uchar rather than a cast.
(swab_buffer, copy_simple, copy_with_unblock):
Use size_t for sizes.
|
|
forever, from_start, print_headers, have_read_stdin, valid_file_spec,
write_header, file_lines, pipe_lines, pipe_bytes, recheck,
tail_forever, tail_bytes, tail_lines, tail, tail_file,
parse_obsolescent_option, parse_options, main):
Use bool for booleans.
(struct File_spec, max_n_unchanged_stats_between_opens,
parse_options): Use uintmax_t, not unsigned int or unsigned long int,
for state counters.
(tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
make it a bit clearer.
|
|
|
|
|
|
(xgethostname): Remove decl; xgethostname.h has it.
(sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
&& defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
prototypes rather than K&R form. Assume any negative value from
sysinfo denotes failure, not just -1.
(main): Simplify use of sethostname.
|
|
include_heading, include_mesg, include_exit, need_boottime,
need_deadprocs, need_login, need_initspawn, need_clockchange,
need_runlevel, need_users, my_line_only, main): Use bool for booleans.
(print_runlevel): Use unsigned char for bytes.
(list_entries_who, scan_entries, who): Use size_t for sizes.
(main): No need to pass a non-NULL last arg to getopt_long.
|
|
(list_entries_users): Use char for bytes.
(main): No need to pass a non-NULL last arg to getopt_long.
|
|
(print_uptime): Remove unused local variable.
(main): No need to pass a non-NULL last arg to getopt_long.
|
|
include_project, include_plan, include_home_and_shell, do_short_format,
include_where, main): Use bool for booleans.
(count_ampersands, create_fullname, scan_entries, short_pinky):
Use size_t for sizes.
(create_fullname): Check for overflow in size calculations.
(idle_string): Don't assume that the number of idle days
is less than 10**8 and/or INT_MAX/(24*60*60).
(main): No need to pass a non-NULL last arg to getopt_long.
|
|
(install_file_to_path): Rely on make_path to fail if the destination
is not a directory, by passing preserve_existing==true to it.
Hence we no longer need to call isdir.
Free dest_dir immediately when it's no longer needed, rather than
waiting until the end of the function.
(copy_file): Don't bother calling isdir, as copy will do the
right thing if the destination is a directory.
|
|
print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
Use bool for booleans.
(max_depth): Now size_t, not int, to avoid an arbitrary limit
of INT_MAX on depth.
(G_fail): Remove: no longer needed, now that the relevant
functions return bool.
(process_file): Use return value to signal success rather than
setting a global. Remove first_call static var; not needed, since
we can look at n_alloc. Use size_t for depths. Remove FIXME
about size_t casts, as it's now fixed. Use xnrealloc rather
than the obsolescent XREALLOC. Don't bother to check whether
reallocation is needed unless level > prev_level.
(du_files): Invert sense of result, for consistency with
other coreutils code. All callers changed.
(main): Allow --max-depth values up to SIZE_MAX.
|
|
show_listed_fs, posix_format, require_sync, print_type,
selected_fstype, excluded_fstype, show_dev, show_point, main):
Use bool for booleans.
(df_readable, show_dev): Use UINTMAX_MAX instead of -1.
(show_dev, show_point, main):
Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
Don't assume disk name lengths are <= INT_MAX.
Rewrite pct calculation to avoid cast.
(show_point): Don't assume resolved length is <= SSIZE_MAX.
|
|
|
|
good as uintptr_t in checking for alignments, and has fewer
configuration hassles.
|
|
(word32): Remove. All uses changed to uint32_t.
(isaac_seed_data): Remove unnecessary cast.
|
|
|
|
undoes part of the 2004-07-27 patch.
|
|
|
|
(is_char_class_member): Use bool when appropriate.
|
|
no longer needed now we assume C89 or better.
Include <inttypes.h> before <stdint.h>, as it's the Autoconf-recommended pattern.
(to_uchar): New inline function, moved here from tr.c.
Use full names for int types, e.g. "long int" rather than "long".
|
|
(IS_THOUSANDS_SEP): Use bool when appropriate.
(numcompare, main): Use char, not int, when the value is always a char.
(numcompare): Remove "register"; compilers are smart enough these days.
|
|
(main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
|
|
|
|
AD_push, prompt, remove_dir): Use bool when appropriate.
(top_dir, pop_dir, full_filename_):
Use size_t for sizes.
|
|
(main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
|
|
cp_option_init, do_move, movefile, main): Likewise.
* src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
AD_push, prompt, remove_dir): Likewise.
|
|
copy_file, install_file_to_path, install_file_in_dir,
install_file_in_file, strip_files, dir_arg, cp_option_init, main,
change_attributes, change_timestamps): Likewise.
|
|
re_protect, make_path_private, target_directory_operand, do_copy,
cp_option_init, decode_preserve_arg, main): Use bool when appropriate.
(target_directory_operand): Do not clear *NEW_DST if stat
succeeds. It's not necessary in that case, as *NEW_DST is always
false already.
(do_copy): Rewrite slightly to avoid need for "unreachable" comment.
(main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
|