updated for version 7.2.333

Problem:    Warnings from static code analysis.
Solution:   Small changes to various lines. (Dominique Pelle)
This commit is contained in:
Bram Moolenaar
2010-01-19 14:59:56 +01:00
parent 3ea38ef239
commit 2660c0ea9b
11 changed files with 19 additions and 28 deletions

View File

@ -315,7 +315,7 @@ close_buffer(win, buf, action)
{ {
#ifdef FEAT_AUTOCMD #ifdef FEAT_AUTOCMD
int is_curbuf; int is_curbuf;
int nwindows = buf->b_nwindows; int nwindows;
#endif #endif
int unload_buf = (action != 0); int unload_buf = (action != 0);
int del_buf = (action == DOBUF_DEL || action == DOBUF_WIPE); int del_buf = (action == DOBUF_DEL || action == DOBUF_WIPE);

View File

@ -4048,7 +4048,7 @@ ins_compl_get_exp(ini)
save_p_ic = p_ic; save_p_ic = p_ic;
p_ic = ignorecase(compl_pattern); p_ic = ignorecase(compl_pattern);
/* Find up to TAG_MANY matches. Avoids that an enourmous number /* Find up to TAG_MANY matches. Avoids that an enormous number
* of matches is found when compl_pattern is empty */ * of matches is found when compl_pattern is empty */
if (find_tags(compl_pattern, &num_matches, &matches, if (find_tags(compl_pattern, &num_matches, &matches,
TAG_REGEXP | TAG_NAMES | TAG_NOIC | TAG_REGEXP | TAG_NAMES | TAG_NOIC |
@ -4219,7 +4219,7 @@ ins_compl_get_exp(ini)
|| IObuff[len - 2] == '!')))) || IObuff[len - 2] == '!'))))
IObuff[len++] = ' '; IObuff[len++] = ' ';
} }
/* copy as much as posible of the new word */ /* copy as much as possible of the new word */
if (tmp_ptr - ptr >= IOSIZE - len) if (tmp_ptr - ptr >= IOSIZE - len)
tmp_ptr = ptr + IOSIZE - len - 1; tmp_ptr = ptr + IOSIZE - len - 1;
STRNCPY(IObuff + len, ptr, tmp_ptr - ptr); STRNCPY(IObuff + len, ptr, tmp_ptr - ptr);
@ -5827,10 +5827,7 @@ internal_format(textwidth, second_indent, flags, format_only, c)
#endif #endif
&& !has_format_option(FO_WRAP)) && !has_format_option(FO_WRAP))
{
textwidth = 0;
break; break;
}
if ((startcol = curwin->w_cursor.col) == 0) if ((startcol = curwin->w_cursor.col) == 0)
break; break;

View File

@ -2193,7 +2193,6 @@ getexmodeline(promptc, cookie, indent)
{ {
if (ga_grow(&line_ga, 40) == FAIL) if (ga_grow(&line_ga, 40) == FAIL)
break; break;
pend = (char_u *)line_ga.ga_data + line_ga.ga_len;
/* Get one character at a time. Don't use inchar(), it can't handle /* Get one character at a time. Don't use inchar(), it can't handle
* special characters. */ * special characters. */
@ -3314,7 +3313,7 @@ nextwild(xp, type, options)
WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE
|options, type); |options, type);
vim_free(p1); vim_free(p1);
/* longest match: make sure it is not shorter (happens with :help */ /* longest match: make sure it is not shorter, happens with :help */
if (p2 != NULL && type == WILD_LONGEST) if (p2 != NULL && type == WILD_LONGEST)
{ {
for (j = 0; j < xp->xp_pattern_len; ++j) for (j = 0; j < xp->xp_pattern_len; ++j)

View File

@ -7072,8 +7072,8 @@ vim_tempname(extra_char)
*/ */
for (i = 0; i < (int)(sizeof(tempdirs) / sizeof(char *)); ++i) for (i = 0; i < (int)(sizeof(tempdirs) / sizeof(char *)); ++i)
{ {
size_t itmplen;
# ifndef HAVE_MKDTEMP # ifndef HAVE_MKDTEMP
size_t itmplen;
long nr; long nr;
long off; long off;
# endif # endif
@ -7091,7 +7091,6 @@ vim_tempname(extra_char)
else else
# endif # endif
add_pathsep(itmp); add_pathsep(itmp);
itmplen = STRLEN(itmp);
# ifdef HAVE_MKDTEMP # ifdef HAVE_MKDTEMP
/* Leave room for filename */ /* Leave room for filename */
@ -7104,6 +7103,7 @@ vim_tempname(extra_char)
* otherwise it doesn't matter. The use of mkdir() avoids any * otherwise it doesn't matter. The use of mkdir() avoids any
* security problems because of the predictable number. */ * security problems because of the predictable number. */
nr = (mch_get_pid() + (long)time(NULL)) % 1000000L; nr = (mch_get_pid() + (long)time(NULL)) % 1000000L;
itmplen = STRLEN(itmp);
/* Try up to 10000 different values until we find a name that /* Try up to 10000 different values until we find a name that
* doesn't exist. */ * doesn't exist. */

View File

@ -2069,7 +2069,7 @@ cs_print_tags_priv(matches, cntxts, num_matches)
continue; continue;
(void)strcpy(tbuf, matches[idx]); (void)strcpy(tbuf, matches[idx]);
if ((fname = strtok(tbuf, (const char *)"\t")) == NULL) if (strtok(tbuf, (const char *)"\t") == NULL)
continue; continue;
if ((fname = strtok(NULL, (const char *)"\t")) == NULL) if ((fname = strtok(NULL, (const char *)"\t")) == NULL)
continue; continue;

View File

@ -873,7 +873,7 @@ nb_parse_cmd(char_u *cmd)
{ {
#ifdef NBDEBUG #ifdef NBDEBUG
/* /*
* This happens because the ExtEd can send a cammand or 2 after * This happens because the ExtEd can send a command or 2 after
* doing a stopDocumentListen command. It doesn't harm anything * doing a stopDocumentListen command. It doesn't harm anything
* so I'm disabling it except for debugging. * so I'm disabling it except for debugging.
*/ */
@ -1174,7 +1174,7 @@ nb_quote(char_u *txt)
break; break;
} }
} }
*q++ = '\0'; *q = '\0';
return buf; return buf;
} }
@ -3070,7 +3070,7 @@ netbeans_removed(
} }
/* /*
* Send netbeans an unmodufied command. * Send netbeans an unmodified command.
*/ */
void void
netbeans_unmodified(buf_T *bufp UNUSED) netbeans_unmodified(buf_T *bufp UNUSED)
@ -3366,7 +3366,7 @@ netbeans_gutter_click(linenr_T lnum)
/* /*
* Add a sign of the reqested type at the requested location. * Add a sign of the requested type at the requested location.
* *
* Reverse engineering: * Reverse engineering:
* Apparently an annotation is defined the first time it is used in a buffer. * Apparently an annotation is defined the first time it is used in a buffer.

View File

@ -5591,13 +5591,13 @@ x11_export_final_selection()
*/ */
if (has_mbyte) if (has_mbyte)
{ {
char_u *conv_str = str;
vimconv_T vc; vimconv_T vc;
vc.vc_type = CONV_NONE; vc.vc_type = CONV_NONE;
if (convert_setup(&vc, p_enc, (char_u *)"latin1") == OK) if (convert_setup(&vc, p_enc, (char_u *)"latin1") == OK)
{ {
int intlen = len; int intlen = len;
char_u *conv_str;
conv_str = string_convert(&vc, str, &intlen); conv_str = string_convert(&vc, str, &intlen);
len = intlen; len = intlen;

View File

@ -1899,7 +1899,6 @@ qf_list(eap)
int i; int i;
int idx1 = 1; int idx1 = 1;
int idx2 = -1; int idx2 = -1;
int need_return = TRUE;
char_u *arg = eap->arg; char_u *arg = eap->arg;
int all = eap->forceit; /* if not :cl!, only show int all = eap->forceit; /* if not :cl!, only show
recognised errors */ recognised errors */
@ -1939,13 +1938,9 @@ qf_list(eap)
{ {
if ((qfp->qf_valid || all) && idx1 <= i && i <= idx2) if ((qfp->qf_valid || all) && idx1 <= i && i <= idx2)
{ {
if (need_return) msg_putchar('\n');
{ if (got_int)
msg_putchar('\n'); break;
if (got_int)
break;
need_return = FALSE;
}
fname = NULL; fname = NULL;
if (qfp->qf_fnum != 0 if (qfp->qf_fnum != 0
@ -1988,7 +1983,6 @@ qf_list(eap)
IObuff, IOSIZE); IObuff, IOSIZE);
msg_prt_line(IObuff, FALSE); msg_prt_line(IObuff, FALSE);
out_flush(); /* show one line at a time */ out_flush(); /* show one line at a time */
need_return = TRUE;
} }
qfp = qfp->qf_next; qfp = qfp->qf_next;

View File

@ -4167,7 +4167,6 @@ clear_keywtab(ht)
if (!HASHITEM_EMPTY(hi)) if (!HASHITEM_EMPTY(hi))
{ {
--todo; --todo;
kp = HI2KE(hi);
for (kp = HI2KE(hi); kp != NULL; kp = kp_next) for (kp = HI2KE(hi); kp != NULL; kp = kp_next)
{ {
kp_next = kp->ke_next; kp_next = kp->ke_next;

View File

@ -2383,7 +2383,7 @@ yank_cut_buffer0(dpy, cbd)
* 'enc' anyway. */ * 'enc' anyway. */
if (has_mbyte) if (has_mbyte)
{ {
char_u *conv_buf = buffer; char_u *conv_buf;
vimconv_T vc; vimconv_T vc;
vc.vc_type = CONV_NONE; vc.vc_type = CONV_NONE;

View File

@ -681,6 +681,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
333,
/**/ /**/
332, 332,
/**/ /**/