make style-all C++ style cleanup

It's time once again to run `make style-all` to fix some style bogosities
that have crept in.
This commit is contained in:
Kurtis Rader
2016-10-04 20:06:14 -07:00
parent 17f5727e7e
commit d389b22afc
11 changed files with 24 additions and 22 deletions

View File

@@ -82,7 +82,7 @@ bool builtin_data_t::operator<(const builtin_data_t *other) const {
/// Counts the number of arguments in the specified null-terminated array
int builtin_count_args(const wchar_t *const *argv) {
int argc;
for (argc = 1; argv[argc] != NULL;){
for (argc = 1; argv[argc] != NULL;) {
argc++;
}
@@ -2941,9 +2941,8 @@ static int builtin_history(parser_t &parser, io_streams_t &streams, wchar_t **ar
wchar_t *end = 0;
max_items = wcstol(w.woptarg, &end, 10);
if (!(*w.woptarg != L'\0' && *end == L'\0')) {
streams.err.append_format(
_(L"%ls: max value '%ls' is not a valid number\n"), argv[0],
w.woptarg);
streams.err.append_format(_(L"%ls: max value '%ls' is not a valid number\n"),
argv[0], w.woptarg);
return STATUS_BUILTIN_ERROR;
}
break;

View File

@@ -180,7 +180,7 @@ int builtin_set_color(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
writembs(tparm(exit_attribute_mode));
} else {
if (!write_color(fg, true /* is_fg */)) {
// We need to do *something* or the lack of any output messes up
// We need to do *something* or the lack of any output messes up
// when the cartesian product here would make "foo" disappear:
// $ echo (set_color foo)bar
set_color(rgb_color_t::reset(), rgb_color_t::none());

View File

@@ -546,7 +546,7 @@ expression *test_parser::parse_args(const wcstring_list_t &args, wcstring &err)
// Handle errors.
// For now we only show the first error.
if (! parser.errors.empty()) {
if (!parser.errors.empty()) {
err.append(L"test: ");
err.append(parser.errors.at(0));
err.push_back(L'\n');

View File

@@ -614,7 +614,6 @@ wcstring vformat_string(const wchar_t *format, va_list va_orig);
void append_format(wcstring &str, const wchar_t *format, ...);
void append_formatv(wcstring &str, const wchar_t *format, va_list ap);
/// This functions returns the end of the quoted substring beginning at \c in. The type of quoting
/// character is detemrined by examining \c in. Returns 0 on error.
///

View File

@@ -1572,7 +1572,6 @@ static wrapper_map_t &wrap_map() {
return *wrapper_map;
}
/// Add a new target that is wrapped by command. Example: __fish_sgrep (command) wraps grep
/// (target).
bool complete_add_wrapper(const wcstring &command, const wcstring &new_target) {

View File

@@ -170,7 +170,10 @@ static struct config_paths_t determine_config_directory_paths(const char *argv0)
paths.bin = L"" BINDIR;
}
debug(2, L"determine_config_directory_paths() results:\npaths.data: %ls\npaths.sysconf: %ls\npaths.doc: %ls\npaths.bin: %ls", paths.data.c_str(), paths.sysconf.c_str(), paths.doc.c_str(), paths.bin.c_str());
debug(2,
L"determine_config_directory_paths() results:\npaths.data: %ls\npaths.sysconf: "
L"%ls\npaths.doc: %ls\npaths.bin: %ls",
paths.data.c_str(), paths.sysconf.c_str(), paths.doc.c_str(), paths.bin.c_str());
return paths;
}

View File

@@ -1277,12 +1277,12 @@ static void test_expand() {
expand_test(L"/tmp/fish_expand_test/b/yyy", EXPAND_FOR_COMPLETIONS | EXPAND_FUZZY_MATCH,
L"/tmp/fish_expand_test/baz/yyy", wnull, L"Wrong fuzzy matching 4");
expand_test(L"/tmp/fish_expand_test/aa/x", EXPAND_FOR_COMPLETIONS | EXPAND_FUZZY_MATCH,
L"/tmp/fish_expand_test/aaa2/x", wnull, L"Wrong fuzzy matching 5");
expand_test(L"/tmp/fish_expand_test/aaa/x", EXPAND_FOR_COMPLETIONS | EXPAND_FUZZY_MATCH,
wnull, L"Wrong fuzzy matching 6 - shouldn't remove valid directory names (#3211)");
expand_test(L"/tmp/fish_expand_test/aaa/x", EXPAND_FOR_COMPLETIONS | EXPAND_FUZZY_MATCH, wnull,
L"Wrong fuzzy matching 6 - shouldn't remove valid directory names (#3211)");
if (!expand_test(L"/tmp/fish_expand_test/.*", 0, L"/tmp/fish_expand_test/.foo", 0)) {
err(L"Expansion not correctly handling dotfiles");

View File

@@ -48,7 +48,7 @@ void output_set_writer(int (*writer)(char)) {
/// Return the current output writer.
int (*output_get_writer())(char) { return out; }
/// Returns true if we think tparm can handle outputting a color index
/// Returns true if we think tparm can handle outputting a color index
static bool term_supports_color_natively(unsigned int c) { return max_colors >= (c + 1); }
color_support_t output_get_color_support(void) { return color_support; }

View File

@@ -130,10 +130,12 @@ line_t pager_t::completion_print_item(const wcstring &prefix, const comp_t *c, s
{
written += print_max(L" ", packed_color, 1, false, &line_data);
}
// hack - this just works around the issue
print_max(L"(", highlight_spec_pager_completion | highlight_make_background(bg_color), 1, false, &line_data);
// hack - this just works around the issue
print_max(L"(", highlight_spec_pager_completion | highlight_make_background(bg_color), 1,
false, &line_data);
print_max(c->desc, packed_color, desc_width, false, &line_data);
print_max(L")", highlight_spec_pager_completion | highlight_make_background(bg_color), 1, false, &line_data);
print_max(L")", highlight_spec_pager_completion | highlight_make_background(bg_color), 1,
false, &line_data);
} else {
while (written < width) {
written += print_max(L" ", 0, 1, false, &line_data);

View File

@@ -206,7 +206,7 @@ size_t escape_code_length(const wchar_t *code) {
if (cur_term != NULL) {
// Detect these terminfo color escapes with parameter value 0..16, all of which don't move
// the cursor.
// the cursor.
char *const esc[] = {
set_a_foreground, set_a_background, set_foreground, set_background,
};
@@ -240,7 +240,7 @@ size_t escape_code_length(const wchar_t *code) {
if (!esc2[p]) continue;
// Test both padded and unpadded version, just to be safe. Most versions of tparm don't
// actually seem to do anything these days.
size_t len = maxi(try_sequence(tparm(esc2[p]), code), try_sequence(esc2[p], code));
if (len) {
resulting_length = len;
@@ -1214,7 +1214,8 @@ void s_reset(screen_t *s, screen_reset_mode_t mode) {
abandon_line_string.push_back(omitted_newline_char);
if (exit_attribute_mode) {
abandon_line_string.append(str2wcstring(tparm(exit_attribute_mode))); // normal text ANSI escape sequence
abandon_line_string.append(
str2wcstring(tparm(exit_attribute_mode))); // normal text ANSI escape sequence
}
abandon_line_string.append(screen_width - non_space_width, L' ');
}

View File

@@ -836,8 +836,7 @@ void wildcard_expander_t::expand(const wcstring &base_dir, const wchar_t *wc,
// Don't do fuzzy matches if the literal segment was valid (#3211)
bool allow_fuzzy = (this->flags & (EXPAND_FUZZY_MATCH | EXPAND_NO_FUZZY_DIRECTORIES)) ==
EXPAND_FUZZY_MATCH;
if (allow_fuzzy &&
this->resolved_completions->size() == before &&
if (allow_fuzzy && this->resolved_completions->size() == before &&
waccess(intermediate_dirpath, F_OK) != 0) {
assert(this->flags & EXPAND_FOR_COMPLETIONS);
DIR *base_dir_fd = open_dir(base_dir);