Fix lint issues

This commit is contained in:
Jason Schulz
2016-01-14 22:33:51 -08:00
parent 7ad3f077dc
commit f82e982bda
11 changed files with 600 additions and 544 deletions

View File

@@ -1063,8 +1063,7 @@ static char_u *repl_to = NULL;
//
// Returns the length of the word in bytes, also when it's OK, so that the
// caller can skip over the word.
size_t
spell_check (
size_t spell_check(
win_T *wp, // current window
char_u *ptr,
hlf_T *attrp,
@@ -1082,12 +1081,14 @@ spell_check (
// A word never starts at a space or a control character. Return quickly
// then, skipping over the character.
if (*ptr <= ' ')
if (*ptr <= ' ') {
return 1;
}
// Return here when loading language files failed.
if (GA_EMPTY(&wp->w_s->b_langp))
if (GA_EMPTY(&wp->w_s->b_langp)) {
return 1;
}
memset(&mi, 0, sizeof(matchinf_T));
@@ -1095,12 +1096,13 @@ spell_check (
// 0X99FF. But always do check spelling to find "3GPP" and "11
// julifeest".
if (*ptr >= '0' && *ptr <= '9') {
if (*ptr == '0' && (ptr[1] == 'b' || ptr[1] == 'B'))
mi.mi_end = skipbin(ptr + 2);
else if (*ptr == '0' && (ptr[1] == 'x' || ptr[1] == 'X'))
if (*ptr == '0' && (ptr[1] == 'b' || ptr[1] == 'B')) {
mi.mi_end = (char_u*) skipbin((char*) ptr + 2);
} else if (*ptr == '0' && (ptr[1] == 'x' || ptr[1] == 'X')) {
mi.mi_end = skiphex(ptr + 2);
else
} else {
mi.mi_end = skipdigits(ptr);
}
nrlen = (size_t)(mi.mi_end - ptr);
}
@@ -1115,12 +1117,14 @@ spell_check (
if (capcol != NULL && *capcol == 0 && wp->w_s->b_cap_prog != NULL) {
// Check word starting with capital letter.
c = PTR2CHAR(ptr);
if (!SPELL_ISUPPER(c))
if (!SPELL_ISUPPER(c)) {
wrongcaplen = (size_t)(mi.mi_fend - ptr);
}
}
}
if (capcol != NULL)
if (capcol != NULL) {
*capcol = -1;
}
// We always use the characters up to the next non-word character,
// also for bad words.
@@ -1133,8 +1137,9 @@ spell_check (
// case-fold the word with one non-word character, so that we can check
// for the word end.
if (*mi.mi_fend != NUL)
if (*mi.mi_fend != NUL) {
mb_ptr_adv(mi.mi_fend);
}
(void)spell_casefold(ptr, (int)(mi.mi_fend - ptr), mi.mi_fword, MAXWLEN + 1);
mi.mi_fwordlen = (int)STRLEN(mi.mi_fword);
@@ -1151,8 +1156,9 @@ spell_check (
// If reloading fails the language is still in the list but everything
// has been cleared.
if (mi.mi_lp->lp_slang->sl_fidxs == NULL)
if (mi.mi_lp->lp_slang->sl_fidxs == NULL) {
continue;
}
// Check for a matching word in case-folded words.
find_word(&mi, FIND_FOLDWORD);
@@ -1183,18 +1189,18 @@ spell_check (
// If we found a number skip over it. Allows for "42nd". Do flag
// rare and local words, e.g., "3GPP".
if (nrlen > 0) {
if (mi.mi_result == SP_BAD || mi.mi_result == SP_BANNED)
if (mi.mi_result == SP_BAD || mi.mi_result == SP_BANNED) {
return nrlen;
}
}
} else if (!spell_iswordp_nmw(ptr, wp)) {
// When we are at a non-word character there is no error, just
// skip over the character (try looking for a word after it).
else if (!spell_iswordp_nmw(ptr, wp)) {
if (capcol != NULL && wp->w_s->b_cap_prog != NULL) {
regmatch_T regmatch;
// Check for end of sentence.
regmatch.regprog = wp->w_s->b_cap_prog;
regmatch.rm_ic = FALSE;
regmatch.rm_ic = false;
int r = vim_regexec(&regmatch, ptr, 0);
wp->w_s->b_cap_prog = regmatch.regprog;
if (r) {
@@ -1206,12 +1212,12 @@ spell_check (
return (size_t)(*mb_ptr2len)(ptr);
}
return 1;
} else if (mi.mi_end == ptr)
} else if (mi.mi_end == ptr) {
// Always include at least one character. Required for when there
// is a mixup in "midword".
mb_ptr_adv(mi.mi_end);
else if (mi.mi_result == SP_BAD
&& LANGP_ENTRY(wp->w_s->b_langp, 0)->lp_slang->sl_nobreak) {
} else if (mi.mi_result == SP_BAD
&& LANGP_ENTRY(wp->w_s->b_langp, 0)->lp_slang->sl_nobreak) {
char_u *p, *fp;
int save_result = mi.mi_result;
@@ -1221,11 +1227,12 @@ spell_check (
if (mi.mi_lp->lp_slang->sl_fidxs != NULL) {
p = mi.mi_word;
fp = mi.mi_fword;
for (;; ) {
for (;;) {
mb_ptr_adv(p);
mb_ptr_adv(fp);
if (p >= mi.mi_end)
if (p >= mi.mi_end) {
break;
}
mi.mi_compoff = (int)(fp - mi.mi_fword);
find_word(&mi, FIND_COMPOUND);
if (mi.mi_result != SP_BAD) {
@@ -1237,12 +1244,13 @@ spell_check (
}
}
if (mi.mi_result == SP_BAD || mi.mi_result == SP_BANNED)
if (mi.mi_result == SP_BAD || mi.mi_result == SP_BANNED) {
*attrp = HLF_SPB;
else if (mi.mi_result == SP_RARE)
} else if (mi.mi_result == SP_RARE) {
*attrp = HLF_SPR;
else
} else {
*attrp = HLF_SPL;
}
}
if (wrongcaplen > 0 && (mi.mi_result == SP_OK || mi.mi_result == SP_RARE)) {