Update code formatting

This commit is contained in:
ridiculousfish 2013-03-21 17:44:51 -07:00
parent 1ed8af2ee8
commit e0e0bcdc1e
6 changed files with 153 additions and 138 deletions

View file

@ -54,7 +54,8 @@
#include "common.h"
struct builtin_printf_state_t {
struct builtin_printf_state_t
{
int exit_code;
void verify_numeric(const wchar_t *s, const wchar_t *end);
@ -376,16 +377,24 @@ void builtin_printf_state_t::print_direc(const wchar_t *start, size_t length, wc
switch (conversion)
{
case L'd': case L'i':
case L'd':
case L'i':
length_modifier = L"lld";
length_modifier_len = sizeof L"lld" - 2;
break;
case L'a': case L'e': case L'f': case L'g':
case L'A': case L'E': case L'F': case L'G':
case L'a':
case L'e':
case L'f':
case L'g':
case L'A':
case L'E':
case L'F':
case L'G':
length_modifier = L"L";
length_modifier_len = 1;
break;
case L's': case L'u':
case L's':
case L'u':
length_modifier = L"l";
length_modifier_len = 1;
break;
@ -485,8 +494,10 @@ void builtin_printf_state_t::print_direc(const wchar_t *start, size_t length, wc
case L's':
if (!have_field_width)
{
if (!have_precision){
append_format(stdout_buffer, fmt.c_str(), argument);}
if (!have_precision)
{
append_format(stdout_buffer, fmt.c_str(), argument);
}
else
append_format(stdout_buffer, fmt.c_str(), precision, argument);
}
@ -505,7 +516,8 @@ void builtin_printf_state_t::print_direc(const wchar_t *start, size_t length, wc
arguments to any `%' directives.
Return the number of elements of ARGV used. */
int builtin_printf_state_t::print_formatted(const wchar_t *format, int argc, wchar_t **argv) {
int builtin_printf_state_t::print_formatted(const wchar_t *format, int argc, wchar_t **argv)
{
int save_argc = argc; /* Preserve original value. */
const wchar_t *f; /* Pointer into `format'. */
const wchar_t *direc_start; /* Start of % directive. */
@ -557,7 +569,9 @@ int builtin_printf_state_t::print_formatted(const wchar_t *format, int argc, wch
ok['a'] = ok['A'] = ok['c'] = ok['e'] = ok['E'] =
ok['o'] = ok['s'] = ok['x'] = ok['X'] = false;
break;
case '-': case '+': case ' ':
case '-':
case '+':
case ' ':
break;
case L'#':
ok['c'] = ok['d'] = ok['i'] = ok['s'] = ok['u'] = false;
@ -569,7 +583,8 @@ int builtin_printf_state_t::print_formatted(const wchar_t *format, int argc, wch
goto no_more_flag_characters;
}
}
no_more_flag_characters:;
no_more_flag_characters:
;
if (*f == L'*')
{
@ -651,7 +666,7 @@ int builtin_printf_state_t::print_formatted(const wchar_t *format, int argc, wch
if (! ok[conversion])
append_format(stderr_buffer,
_("%.*ls: invalid conversion specification"),
(int) (f + 1 - direc_start), direc_start);
(int)(f + 1 - direc_start), direc_start);
}
print_direc(direc_start, direc_length, *f,

View file

@ -359,12 +359,12 @@ class completer_t
bool wants_descriptions() const
{
return !! (flags & COMPLETION_REQUEST_DESCRIPTIONS);
return !!(flags & COMPLETION_REQUEST_DESCRIPTIONS);
}
bool fuzzy() const
{
return !! (flags & COMPLETION_REQUEST_FUZZY_MATCH);
return !!(flags & COMPLETION_REQUEST_FUZZY_MATCH);
}
@ -1794,7 +1794,6 @@ void complete(const wcstring &cmd, std::vector<completion_t> &comps, completion_
/* Make our completer */
completer_t completer(cmd, flags);
const bool fuzzy = !! (flags & COMPLETION_REQUEST_FUZZY_MATCH);
const wchar_t *tok_begin, *tok_end, *cmdsubst_begin, *cmdsubst_end, *prev_begin, *prev_end;
wcstring current_token, prev_token;
wcstring current_command;

View file

@ -139,7 +139,8 @@ public:
bool operator != (const completion_t& rhs) const;
};
enum {
enum
{
COMPLETION_REQUEST_DEFAULT = 0,
COMPLETION_REQUEST_AUTOSUGGESTION = 1 << 0, // indicates the completion is for an autosuggestion
COMPLETION_REQUEST_DESCRIPTIONS = 1 << 1, // indicates that we want descriptions

View file

@ -1158,7 +1158,7 @@ static void run_pager(const wcstring &prefix, int is_quoted, const std::vector<c
for (size_t i=0; i< comp.size(); i++)
{
const completion_t &el = comp.at(i);
if (! (el.flags & COMPLETE_CASE_INSENSITIVE))
if (!(el.flags & COMPLETE_CASE_INSENSITIVE))
{
has_case_sensitive = true;
break;