summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-04-17 22:14:47 +0000
committerBram Moolenaar <Bram@vim.org>2006-04-17 22:14:47 +0000
commita93fa7ee7856b54d3778e613c7b7e4b76aaeb2af (patch)
tree4797f43c4e1694903d93da1b61ba972955cb6aad /src
parentb21e5843e53d3582df5f521f57e7e52e83d51d10 (diff)
downloadvim-git-a93fa7ee7856b54d3778e613c7b7e4b76aaeb2af.tar.gz
updated for version 7.0e01v7.0e01
Diffstat (limited to 'src')
-rw-r--r--src/GvimExt/gvimext.cpp6
-rw-r--r--src/GvimExt/gvimext.h8
-rw-r--r--src/Make_mvc.mak7
-rw-r--r--src/buffer.c8
-rw-r--r--src/charset.c2
-rw-r--r--src/diff.c4
-rw-r--r--src/edit.c24
-rw-r--r--src/eval.c93
-rw-r--r--src/ex_cmds.c36
-rw-r--r--src/ex_cmds2.c2
-rw-r--r--src/ex_docmd.c10
-rw-r--r--src/ex_eval.c2
-rw-r--r--src/ex_getln.c8
-rw-r--r--src/fileio.c30
-rw-r--r--src/fold.c10
-rw-r--r--src/getchar.c2
-rw-r--r--src/gui.c12
-rw-r--r--src/gui_w32.c12
-rw-r--r--src/gui_w48.c2
-rw-r--r--src/hardcopy.c32
-rw-r--r--src/hashtab.c16
-rw-r--r--src/if_cscope.c48
-rw-r--r--src/if_ruby.c14
-rw-r--r--src/main.c2
-rw-r--r--src/mbyte.c16
-rw-r--r--src/memline.c8
-rw-r--r--src/menu.c2
-rw-r--r--src/message.c26
-rw-r--r--src/misc1.c22
-rw-r--r--src/misc2.c2
-rw-r--r--src/netbeans.c32
-rw-r--r--src/normal.c4
-rw-r--r--src/ops.c10
-rw-r--r--src/option.c12
-rw-r--r--src/os_mswin.c26
-rw-r--r--src/os_win32.c14
-rw-r--r--src/po/zh_TW.UTF-8.po13
-rw-r--r--src/popupmnu.c4
-rw-r--r--src/proto/os_mswin.pro4
-rw-r--r--src/quickfix.c8
-rw-r--r--src/screen.c26
-rw-r--r--src/search.c14
-rw-r--r--src/spell.c182
-rw-r--r--src/syntax.c8
-rw-r--r--src/tag.c12
-rw-r--r--src/undo.c2
-rw-r--r--src/version.h6
47 files changed, 439 insertions, 404 deletions
diff --git a/src/GvimExt/gvimext.cpp b/src/GvimExt/gvimext.cpp
index c204a0c57..dbd769abe 100644
--- a/src/GvimExt/gvimext.cpp
+++ b/src/GvimExt/gvimext.cpp
@@ -103,7 +103,7 @@ getRuntimeDir(char *buf)
strcpy(buf, searchpath(buf));
// remove "gvim.exe" from the end
- for (idx = strlen(buf) - 1; idx >= 0; idx--)
+ for (idx = (int)strlen(buf) - 1; idx >= 0; idx--)
if (buf[idx] == '\\' || buf[idx] == '/')
{
buf[idx + 1] = 0;
@@ -279,7 +279,7 @@ dyn_gettext_load(void)
getRuntimeDir(szBuff);
if (szBuff[0] != 0)
{
- len = strlen(szBuff);
+ len = (DWORD)strlen(szBuff);
if (dyn_libintl_init(szBuff))
{
strcpy(szBuff + len, "lang");
@@ -740,7 +740,7 @@ STDMETHODIMP CShellExt::PushToWindow(HWND hParent,
return NOERROR;
}
-STDMETHODIMP CShellExt::GetCommandString(UINT idCmd,
+STDMETHODIMP CShellExt::GetCommandString(UINT_PTR idCmd,
UINT uFlags,
UINT FAR *reserved,
LPSTR pszName,
diff --git a/src/GvimExt/gvimext.h b/src/GvimExt/gvimext.h
index d68807320..c0e39cb17 100644
--- a/src/GvimExt/gvimext.h
+++ b/src/GvimExt/gvimext.h
@@ -43,6 +43,12 @@
#include <windowsx.h>
#include <shlobj.h>
+/* Accommodate old versions of VC that don't have a modern Platform SDK */
+#if _MSC_VER < 1300
+#undef UINT_PTR
+#define UINT_PTR UINT
+#endif
+
#define ResultFromShort(i) ResultFromScode(MAKE_SCODE(SEVERITY_SUCCESS, 0, (USHORT)(i)))
// Initialize GUIDs (should be done only and at-least once per DLL/EXE)
@@ -152,7 +158,7 @@ public:
STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi);
- STDMETHODIMP GetCommandString(UINT idCmd,
+ STDMETHODIMP GetCommandString(UINT_PTR idCmd,
UINT uFlags,
UINT FAR *reserved,
LPSTR pszName,
diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak
index 9bb048703..f9d211d34 100644
--- a/src/Make_mvc.mak
+++ b/src/Make_mvc.mak
@@ -167,13 +167,16 @@ OBJDIR = $(OBJDIR)Z
OBJDIR = $(OBJDIR)d
!endif
-# Win32.mak requires that CPU be set appropriately
+# Win32.mak requires that CPU be set appropriately.
+# To cross-compile for Win64, set CPU=AMD64 or CPU=IA64.
!ifdef PROCESSOR_ARCHITECTURE
# We're on Windows NT or using VC 6+
+! ifndef CPU
CPU = $(PROCESSOR_ARCHITECTURE)
-! if ("$(CPU)" == "x86") || ("$(CPU)" == "X86")
+! if ("$(CPU)" == "x86") || ("$(CPU)" == "X86")
CPU = i386
+! endif
! endif
!else # !PROCESSOR_ARCHITECTURE
# We're on Windows 95
diff --git a/src/buffer.c b/src/buffer.c
index 64ed9711d..7d625f2e5 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -3171,7 +3171,7 @@ maketitle()
i_name = gettail(curbuf->b_ffname);
*i_str = NUL;
/* Truncate name at 100 bytes. */
- len = STRLEN(i_name);
+ len = (int)STRLEN(i_name);
if (len > 100)
{
len -= 100;
@@ -3425,7 +3425,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
}
else
#endif
- n = (p - t) - item[groupitem[groupdepth]].maxwid + 1;
+ n = (long)(p - t) - item[groupitem[groupdepth]].maxwid + 1;
*t = '<';
mch_memmove(t + 1, t + n, p - (t + n));
@@ -3461,7 +3461,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
mch_memmove(t + n - l, t, p - t);
l = n - l;
if (p + l >= out + outlen)
- l = (out + outlen) - p - 1;
+ l = (long)((out + outlen) - p - 1);
p += l;
for (n = groupitem[groupdepth] + 1; n < curitem; n++)
item[n].start += l;
@@ -3792,7 +3792,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
{
item[curitem].type = Highlight;
item[curitem].start = p;
- item[curitem].minwid = -syn_namen2id(t, s - t);
+ item[curitem].minwid = -syn_namen2id(t, (int)(s - t));
curitem++;
}
++s;
diff --git a/src/charset.c b/src/charset.c
index df8685216..6ad8ae587 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -351,7 +351,7 @@ transstr(s)
else
{
transchar_hex(hexbuf, c);
- len += STRLEN(hexbuf);
+ len += (int)STRLEN(hexbuf);
}
}
else
diff --git a/src/diff.c b/src/diff.c
index f5577f16b..5f8a84a17 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -1850,8 +1850,8 @@ diff_find_change(wp, lnum, startp, endp)
&& vim_iswhite(line_org[si_org])
&& vim_iswhite(line_new[si_new]))
{
- si_org = skipwhite(line_org + si_org) - line_org;
- si_new = skipwhite(line_new + si_new) - line_new;
+ si_org = (int)(skipwhite(line_org + si_org) - line_org);
+ si_new = (int)(skipwhite(line_new + si_new) - line_new);
}
else
{
diff --git a/src/edit.c b/src/edit.c
index 8fd9ed451..c6287e056 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -2485,7 +2485,7 @@ ins_compl_show_pum()
compl_match_arraysize = 0;
compl = compl_first_match;
if (compl_leader != NULL)
- lead_len = STRLEN(compl_leader);
+ lead_len = (int)STRLEN(compl_leader);
do
{
if ((compl->cp_flags & ORIGINAL_TEXT) == 0
@@ -2643,7 +2643,7 @@ ins_compl_dictionaries(dict_start, pat, flags, thesaurus)
* pattern. */
if (ctrl_x_mode == CTRL_X_WHOLE_LINE)
{
- i = STRLEN(pat) + 8;
+ i = (int)STRLEN(pat) + 8;
ptr = alloc(i);
if (ptr == NULL)
return;
@@ -2967,7 +2967,7 @@ ins_compl_bs()
mb_ptr_back(line, p);
vim_free(compl_leader);
- compl_leader = vim_strnsave(line + compl_col, (p - line) - compl_col);
+ compl_leader = vim_strnsave(line + compl_col, (int)(p - line) - compl_col);
if (compl_leader != NULL)
{
ins_compl_del_pum();
@@ -3988,7 +3988,7 @@ ins_compl_next(allow_get_expansion, count, insert_match)
/* Set "compl_shown_match" to the actually shown match, it may differ
* when "compl_leader" is used to omit some of the matches. */
while (!ins_compl_equal(compl_shown_match,
- compl_leader, STRLEN(compl_leader))
+ compl_leader, (int)STRLEN(compl_leader))
&& compl_shown_match->cp_next != NULL
&& compl_shown_match->cp_next != compl_first_match)
compl_shown_match = compl_shown_match->cp_next;
@@ -4038,7 +4038,7 @@ ins_compl_next(allow_get_expansion, count, insert_match)
if ((compl_shown_match->cp_flags & ORIGINAL_TEXT) == 0
&& compl_leader != NULL
&& !ins_compl_equal(compl_shown_match,
- compl_leader, STRLEN(compl_leader)))
+ compl_leader, (int)STRLEN(compl_leader)))
++todo;
else
/* Remember a matching item. */
@@ -4446,7 +4446,7 @@ ins_complete(c)
}
else if (ctrl_x_mode == CTRL_X_WHOLE_LINE)
{
- compl_col = skipwhite(line) - line;
+ compl_col = (colnr_T)(skipwhite(line) - line);
compl_length = (int)curs_col - (int)compl_col;
if (compl_length < 0) /* cursor in indent: empty pattern */
compl_length = 0;
@@ -5668,7 +5668,7 @@ auto_format(trailblank, prev_line)
if (!wasatend && has_format_option(FO_WHITE_PAR))
{
new = ml_get_curline();
- len = STRLEN(new);
+ len = (colnr_T)STRLEN(new);
if (curwin->w_cursor.col == len)
{
pnew = vim_strnsave(new, len + 2);
@@ -5984,7 +5984,7 @@ stop_insert(end_insert_pos, esc)
* deleted characters. */
if (VIsual_active && VIsual.lnum == curwin->w_cursor.lnum)
{
- cc = STRLEN(ml_get_curline());
+ cc = (int)STRLEN(ml_get_curline());
if (VIsual.col > (colnr_T)cc)
{
VIsual.col = cc;
@@ -6718,7 +6718,7 @@ replace_do_bs()
del_char(FALSE);
# ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
- orig_len = STRLEN(ml_get_cursor());
+ orig_len = (int)STRLEN(ml_get_cursor());
# endif
replace_push(cc);
}
@@ -6728,7 +6728,7 @@ replace_do_bs()
pchar_cursor(cc);
#ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
- orig_len = STRLEN(ml_get_cursor()) - 1;
+ orig_len = (int)STRLEN(ml_get_cursor()) - 1;
#endif
}
replace_pop_ins();
@@ -6738,7 +6738,7 @@ replace_do_bs()
{
/* Get the number of screen cells used by the inserted characters */
p = ml_get_cursor();
- ins_len = STRLEN(p) - orig_len;
+ ins_len = (int)STRLEN(p) - orig_len;
vcol = start_vcol;
for (i = 0; i < ins_len; ++i)
{
@@ -7908,7 +7908,7 @@ ins_bs(c, mode, inserted_space_p)
TRUE);
int len;
- len = STRLEN(ptr);
+ len = (int)STRLEN(ptr);
if (len > 0 && ptr[len - 1] == ' ')
ptr[len - 1] = NUL;
}
diff --git a/src/eval.c b/src/eval.c
index 4dc6a299d..1f208b918 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1913,7 +1913,7 @@ list_hashtable_vars(ht, prefix, empty)
dictitem_T *di;
int todo;
- todo = ht->ht_used;
+ todo = (int)ht->ht_used;
for (hi = ht->ht_array; todo > 0 && !got_int; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -2666,7 +2666,7 @@ set_var_lval(lp, endp, rettv, copy, op)
typval_T tv;
/* handle +=, -= and .= */
- if (get_var_tv(lp->ll_name, STRLEN(lp->ll_name),
+ if (get_var_tv(lp->ll_name, (int)STRLEN(lp->ll_name),
&tv, TRUE) == OK)
{
if (tv_op(&tv, rettv, op) == OK)
@@ -3129,7 +3129,7 @@ ex_call(eap)
++fudi.fd_dict->dv_refcount;
/* If it is the name of a variable of type VAR_FUNC use its contents. */
- len = STRLEN(tofree);
+ len = (int)STRLEN(tofree);
name = deref_func_name(tofree, &len);
/* Skip white space to allow ":call func ()". Not good, but required for
@@ -3164,7 +3164,7 @@ ex_call(eap)
curwin->w_cursor.col = 0;
}
arg = startarg;
- if (get_func_tv(name, STRLEN(name), &rettv, &arg,
+ if (get_func_tv(name, (int)STRLEN(name), &rettv, &arg,
eap->line1, eap->line2, &doesrange,
!eap->skip, fudi.fd_dict) == FAIL)
{
@@ -3491,7 +3491,7 @@ item_lock(tv, deep, lock)
if (deep < 0 || deep > 1)
{
/* recursive: lock/unlock the items the List contains */
- todo = d->dv_hashtab.ht_used;
+ todo = (int)d->dv_hashtab.ht_used;
for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -3534,7 +3534,7 @@ del_menutrans_vars()
int todo;
hash_lock(&globvarht);
- todo = globvarht.ht_used;
+ todo = (int)globvarht.ht_used;
for (hi = globvarht.ht_array; todo > 0 && !got_int; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -5480,7 +5480,7 @@ dict_equal(d1, d2, ic)
if (dict_len(d1) != dict_len(d2))
return FALSE;
- todo = d1->dv_hashtab.ht_used;
+ todo = (int)d1->dv_hashtab.ht_used;
for (hi = d1->dv_hashtab.ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -6130,7 +6130,7 @@ set_ref_in_ht(ht, copyID)
int todo;
hashitem_T *hi;
- todo = ht->ht_used;
+ todo = (int)ht->ht_used;
for (hi = ht->ht_array; todo > 0; ++hi)
if (!HASHITEM_EMPTY(hi))
{
@@ -6251,7 +6251,7 @@ dict_free(d)
/* Lock the hashtab, we don't want it to resize while freeing items. */
hash_lock(&d->dv_hashtab);
- todo = d->dv_hashtab.ht_used;
+ todo = (int)d->dv_hashtab.ht_used;
for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -6280,7 +6280,7 @@ dictitem_alloc(key)
{
dictitem_T *di;
- di = (dictitem_T *)alloc(sizeof(dictitem_T) + STRLEN(key));
+ di = (dictitem_T *)alloc((unsigned)(sizeof(dictitem_T) + STRLEN(key)));
if (di != NULL)
{
STRCPY(di->di_key, key);
@@ -6298,7 +6298,8 @@ dictitem_copy(org)
{
dictitem_T *di;
- di = (dictitem_T *)alloc(sizeof(dictitem_T) + STRLEN(org->di_key));
+ di = (dictitem_T *)alloc((unsigned)(sizeof(dictitem_T)
+ + STRLEN(org->di_key)));
if (di != NULL)
{
STRCPY(di->di_key, org->di_key);
@@ -6365,7 +6366,7 @@ dict_copy(orig, deep, copyID)
orig->dv_copyID = copyID;
orig->dv_copydict = copy;
}
- todo = orig->dv_hashtab.ht_used;
+ todo = (int)orig->dv_hashtab.ht_used;
for (hi = orig->dv_hashtab.ht_array; todo > 0 && !got_int; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -6462,7 +6463,7 @@ dict_len(d)
{
if (d == NULL)
return 0L;
- return d->dv_hashtab.ht_used;
+ return (long)d->dv_hashtab.ht_used;
}
/*
@@ -6567,7 +6568,7 @@ dict2string(tv, copyID)
ga_init2(&ga, (int)sizeof(char), 80);
ga_append(&ga, '{');
- todo = d->dv_hashtab.ht_used;
+ todo = (int)d->dv_hashtab.ht_used;
for (hi = d->dv_hashtab.ht_array; todo > 0 && !got_int; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -6859,7 +6860,7 @@ string_quote(str, function)
len = (function ? 13 : 3);
if (str != NULL)
{
- len += STRLEN(str);
+ len += (unsigned)STRLEN(str);
for (p = str; *p != NUL; mb_ptr_adv(p))
if (*p == '\'')
++len;
@@ -7291,7 +7292,7 @@ deref_func_name(name, lenp)
*lenp = 0;
return (char_u *)""; /* just in case */
}
- *lenp = STRLEN(v->di_tv.vval.v_string);
+ *lenp = (int)STRLEN(v->di_tv.vval.v_string);
return v->di_tv.vval.v_string;
}
@@ -7554,21 +7555,21 @@ call_func(name, len, rettv, argcount, argvars, firstline, lastline,
switch (error)
{
case ERROR_UNKNOWN:
- emsg_funcname("E117: Unknown function: %s", name);
+ emsg_funcname(N_("E117: Unknown function: %s"), name);
break;
case ERROR_TOOMANY:
emsg_funcname(e_toomanyarg, name);
break;
case ERROR_TOOFEW:
- emsg_funcname("E119: Not enough arguments for function: %s",
+ emsg_funcname(N_("E119: Not enough arguments for function: %s"),
name);
break;
case ERROR_SCRIPT:
- emsg_funcname("E120: Using <SID> not in a script context: %s",
+ emsg_funcname(N_("E120: Using <SID> not in a script context: %s"),
name);
break;
case ERROR_DICT:
- emsg_funcname("E725: Calling dict function without Dictionary: %s",
+ emsg_funcname(N_("E725: Calling dict function without Dictionary: %s"),
name);
break;
}
@@ -8047,7 +8048,7 @@ f_byteidx(argvars, rettv)
return;
t += (*mb_ptr2len)(t);
}
- rettv->vval.v_number = t - str;
+ rettv->vval.v_number = (varnumber_T)(t - str);
#else
if (idx <= STRLEN(str))
rettv->vval.v_number = idx;
@@ -8110,7 +8111,7 @@ f_call(argvars, rettv)
}
if (item == NULL)
- (void)call_func(func, STRLEN(func), rettv, argc, argv,
+ (void)call_func(func, (int)STRLEN(func), rettv, argc, argv,
curwin->w_cursor.lnum, curwin->w_cursor.lnum,
&dummy, TRUE, selfdict);
@@ -8191,7 +8192,7 @@ f_col(argvars, rettv)
{
/* '> can be MAXCOL, get the length of the line then */
if (fp->lnum <= curbuf->b_ml.ml_line_count)
- col = STRLEN(ml_get(fp->lnum)) + 1;
+ col = (colnr_T)STRLEN(ml_get(fp->lnum)) + 1;
else
col = MAXCOL;
}
@@ -8420,7 +8421,7 @@ f_count(argvars, rettv)
EMSG(_(e_invarg));
}
- todo = error ? 0 : d->dv_hashtab.ht_used;
+ todo = error ? 0 : (int)d->dv_hashtab.ht_used;
for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -8952,7 +8953,7 @@ f_extend(argvars, rettv)
/* Go over all entries in the second dict and add them to the
* first dict. */
- todo = d2->dv_hashtab.ht_used;
+ todo = (int)d2->dv_hashtab.ht_used;
for (hi2 = d2->dv_hashtab.ht_array; todo > 0; ++hi2)
{
if (!HASHITEM_EMPTY(hi2))
@@ -9154,7 +9155,7 @@ filter_map(argvars, rettv, map)
ht = &d->dv_hashtab;
hash_lock(ht);
- todo = ht->ht_used;
+ todo = (int)ht->ht_used;
for (hi = ht->ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -11320,7 +11321,7 @@ f_input(argvars, rettv)
if (xp_name == NULL)
return;
- xp_namelen = STRLEN(xp_name);
+ xp_namelen = (int)STRLEN(xp_name);
if (parse_compl_arg(xp_name, xp_namelen, &xp_type, &argt,
&xp_arg) == FAIL)
@@ -11634,7 +11635,7 @@ dict_list(argvars, rettv, what)
if (rettv_list_alloc(rettv) == FAIL)
return;
- todo = d->dv_hashtab.ht_used;
+ todo = (int)d->dv_hashtab.ht_used;
for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -12153,8 +12154,8 @@ find_some_match(argvars, rettv, type)
else
{
#ifdef FEAT_MBYTE
- startcol = regmatch.startp[0]
- + (*mb_ptr2len)(regmatch.startp[0]) - str;
+ startcol = (colnr_T)(regmatch.startp[0]
+ + (*mb_ptr2len)(regmatch.startp[0]) - str);
#else
startcol = regmatch.startp[0] + 1 - str;
#endif
@@ -12198,7 +12199,7 @@ find_some_match(argvars, rettv, type)
else
rettv->vval.v_number =
(varnumber_T)(regmatch.endp[0] - str);
- rettv->vval.v_number += str - expr;
+ rettv->vval.v_number += (varnumber_T)(str - expr);
}
}
vim_free(regmatch.regprog);
@@ -12323,7 +12324,7 @@ max_min(argvars, rettv, domax)
d = argvars[0].vval.v_dict;
if (d != NULL)
{
- todo = d->dv_hashtab.ht_used;
+ todo = (int)d->dv_hashtab.ht_used;
for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -12711,7 +12712,7 @@ f_readfile(argvars, rettv)
filtd = 0;
while (cnt < maxline || maxline < 0)
{
- readlen = fread(buf + filtd, 1, FREAD_SIZE - filtd, fd);
+ readlen = (int)fread(buf + filtd, 1, FREAD_SIZE - filtd, fd);
buflen = filtd + readlen;
tolist = 0;
for ( ; filtd < buflen || readlen <= 0; ++filtd)
@@ -14599,7 +14600,7 @@ item_compare2(s1, s2)
copy_tv(&(*(listitem_T **)s2)->li_tv, &argv[1]);
rettv.v_type = VAR_UNKNOWN; /* clear_tv() uses this */
- res = call_func(item_compare_func, STRLEN(item_compare_func),
+ res = call_func(item_compare_func, (int)STRLEN(item_compare_func),
&rettv, 2, argv, 0L, 0L, &dummy, TRUE, NULL);
clear_tv(&argv[0]);
clear_tv(&argv[1]);
@@ -15134,7 +15135,7 @@ f_strridx(argvars, rettv)
needle = get_tv_string_chk(&argvars[1]);
haystack = get_tv_string_buf_chk(&argvars[0], buf);
- haystack_len = STRLEN(haystack);
+ haystack_len = (int)STRLEN(haystack);
rettv->vval.v_number = -1;
if (needle == NULL || haystack == NULL)
@@ -16972,7 +16973,7 @@ handle_subscript(arg, rettv, evaluate, verbose)
/* Invoke the function. Recursive! */
s = functv.vval.v_string;
- ret = get_func_tv(s, STRLEN(s), rettv, arg,
+ ret = get_func_tv(s, (int)STRLEN(s), rettv, arg,
curwin->w_cursor.lnum, curwin->w_cursor.lnum,
&len, evaluate, selfdict);
@@ -17512,7 +17513,7 @@ vars_clear_ext(ht, free_val)
dictitem_T *v;
hash_lock(ht);
- todo = ht->ht_used;
+ todo = (int)ht->ht_used;
for (hi = ht->ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -18166,7 +18167,7 @@ ex_function(eap)
{
if (!eap->skip)
{
- todo = func_hashtab.ht_used;
+ todo = (int)func_hashtab.ht_used;
for (hi = func_hashtab.ht_array; todo > 0 && !got_int; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -18200,7 +18201,7 @@ ex_function(eap)
{
regmatch.rm_ic = p_ic;
- todo = func_hashtab.ht_used;
+ todo = (int)func_hashtab.ht_used;
for (hi = func_hashtab.ht_array; todo > 0 && !got_int; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -18684,8 +18685,8 @@ ex_function(eap)
if (scriptname != NULL)
{
p = vim_strchr(scriptname, '/');
- plen = STRLEN(p);
- slen = STRLEN(sourcing_name);
+ plen = (int)STRLEN(p);
+ slen = (int)STRLEN(sourcing_name);
if (slen > plen && fnamecmp(p,
sourcing_name + slen - plen) == 0)
j = OK;
@@ -18866,7 +18867,7 @@ trans_function_name(pp, skip, flags, fdp)
if (lv.ll_exp_name != NULL)
{
- len = STRLEN(lv.ll_exp_name);
+ len = (int)STRLEN(lv.ll_exp_name);
if (lead <= 2 && lv.ll_name == lv.ll_exp_name
&& STRNCMP(lv.ll_name, "s:", 2) == 0)
{
@@ -19110,7 +19111,7 @@ func_dump_profile(fd)
ufunc_T **sorttab;
int st_len = 0;
- todo = func_hashtab.ht_used;
+ todo = (int)func_hashtab.ht_used;
sorttab = (ufunc_T **)alloc((unsigned)(sizeof(ufunc_T) * todo));
for (hi = func_hashtab.ht_array; todo > 0; ++hi)
@@ -20274,7 +20275,7 @@ write_viminfo_varlist(fp)
fprintf(fp, _("\n# global variables:\n"));
- todo = globvarht.ht_used;
+ todo = (int)globvarht.ht_used;
for (hi = globvarht.ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -20310,7 +20311,7 @@ store_session_globals(fd)
int todo;
char_u *p, *t;
- todo = globvarht.ht_used;
+ todo = (int)globvarht.ht_used;
for (hi = globvarht.ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -20542,7 +20543,7 @@ shortpath_for_partial(fnamep, bufp, fnamelen)
else
pbuf = tfname = FullName_save(*fnamep, FALSE);
- len = tflen = STRLEN(tfname);
+ len = tflen = (int)STRLEN(tfname);
if (!get_short_pathname(&tfname, &pbuf, &len))
return -1;
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 533b2cc09..aafe31cf0 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -435,7 +435,7 @@ ex_sort(eap)
for (lnum = eap->line1; lnum <= eap->line2; ++lnum)
{
s = ml_get(lnum);
- len = STRLEN(s);
+ len = (int)STRLEN(s);
if (maxlen < len)
maxlen = len;
@@ -445,11 +445,11 @@ ex_sort(eap)
{
if (sort_rx)
{
- start_col = regmatch.startp[0] - s;
- end_col = regmatch.endp[0] - s;
+ start_col = (colnr_T)(regmatch.startp[0] - s);
+ end_col = (colnr_T)(regmatch.endp[0] - s);
}
else
- start_col = regmatch.endp[0] - s;
+ start_col = (colnr_T)(regmatch.endp[0] - s);
}
else
if (regmatch.regprog != NULL)
@@ -526,7 +526,7 @@ ex_sort(eap)
count = 0;
/* Adjust marks for deleted (or added) lines and prepare for displaying. */
- deleted = count - (lnum - eap->line2);
+ deleted = (long)(count - (lnum - eap->line2));
if (deleted > 0)
mark_adjust(eap->line2 - deleted, eap->line2, (long)MAXLNUM, -deleted);
else if (deleted < 0)
@@ -3182,7 +3182,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
/* Set v:swapcommand for the SwapExists autocommands. */
if (command != NULL)
- len = STRLEN(command) + 3;
+ len = (int)STRLEN(command) + 3;
else
len = 30;
p = alloc((unsigned)len);
@@ -3986,7 +3986,7 @@ ex_z(eap)
switch (*kind)
{
case '-':
- start = lnum - bigness * (x - kind);
+ start = lnum - bigness * (linenr_T)(x - kind);
end = start + bigness;
curs = end;
break;
@@ -4013,7 +4013,7 @@ ex_z(eap)
default: /* '+' */
start = lnum;
if (*kind == '+')
- start += bigness * (x - kind - 1) + 1;
+ start += bigness * (linenr_T)(x - kind - 1) + 1;
else if (eap->addr_count == 0)
++start;
end = start + bigness - 1;
@@ -4514,7 +4514,7 @@ do_sub(eap)
* Avoids that ":s/\nB\@=//gc" get stuck. */
if (nmatch > 1)
{
- matchcol = STRLEN(sub_firstline);
+ matchcol = (colnr_T)STRLEN(sub_firstline);
nmatch = 1;
}
sub_nsubs++;
@@ -4671,7 +4671,7 @@ do_sub(eap)
* Avoids that ":s/\nB\@=//gc" get stuck. */
if (nmatch > 1)
{
- matchcol = STRLEN(sub_firstline);
+ matchcol = (colnr_T)STRLEN(sub_firstline);
nmatch = 1;
}
goto skip;
@@ -5028,7 +5028,7 @@ do_sub_msg(count_only)
if (got_int)
{
STRCPY(msg_buf, _("(Interrupted) "));
- len = STRLEN(msg_buf);
+ len = (int)STRLEN(msg_buf);
}
if (sub_nsubs == 1)
vim_snprintf((char *)msg_buf + len, sizeof(msg_buf) - len,
@@ -5037,7 +5037,7 @@ do_sub_msg(count_only)
vim_snprintf((char *)msg_buf + len, sizeof(msg_buf) - len,
count_only ? _("%ld matches") : _("%ld substitutions"),
sub_nsubs);
- len = STRLEN(msg_buf);
+ len = (int)STRLEN(msg_buf);
if (sub_nlines == 1)
vim_snprintf((char *)msg_buf + len, sizeof(msg_buf) - len,
"%s", _(" on 1 line"));
@@ -5407,7 +5407,7 @@ ex_help(eap)
/* Find first item with the requested language. */
for (i = 0; i < num_matches; ++i)
{
- len = STRLEN(matches[i]);
+ len = (int)STRLEN(matches[i]);
if (len > 3 && matches[i][len - 3] == '@'
&& STRICMP(matches[i] + len - 2, lang) == 0)
break;
@@ -5539,7 +5539,7 @@ erret:
check_help_lang(arg)
char_u *arg;
{
- int len = STRLEN(arg);
+ int len = (int)STRLEN(arg);
if (len >= 3 && arg[len - 3] == '@' && ASCII_ISALPHA(arg[len - 2])
&& ASCII_ISALPHA(arg[len - 1]))
@@ -6039,7 +6039,7 @@ ex_helptags(eap)
ga_init2(&ga, 1, 10);
for (i = 0; i < filecount; ++i)
{
- len = STRLEN(files[i]);
+ len = (int)STRLEN(files[i]);
if (len > 4)
{
if (STRICMP(files[i] + len - 4, ".txt") == 0)
@@ -6172,7 +6172,7 @@ helptags_one(dir, ext, tagfname)
got_int = TRUE;
else
{
- s = alloc(18 + STRLEN(tagfname));
+ s = alloc(18 + (unsigned)STRLEN(tagfname));
if (s == NULL)
got_int = TRUE;
else
@@ -6549,7 +6549,7 @@ ex_sign(eap)
for (s = arg; s < p; ++s)
if (!vim_isprintc(*s))
break;
- cells = s - arg;
+ cells = (int)(s - arg);
}
/* Currently must be one or two display cells */
if (s != p || cells < 1 || cells > 2)
@@ -6562,7 +6562,7 @@ ex_sign(eap)
vim_free(sp->sn_text);
/* Allocate one byte more if we need to pad up
* with a space. */
- len = p - arg + ((cells == 1) ? 1 : 0);
+ len = (int)(p - arg + ((cells == 1) ? 1 : 0));
sp->sn_text = vim_strnsave(arg, len);
if (sp->sn_text != NULL && cells == 1)
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 3d6e217d5..4d01039ad 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -1023,7 +1023,7 @@ ex_profile(eap)
int len;
e = skiptowhite(eap->arg);
- len = e - eap->arg;
+ len = (int)(e - eap->arg);
e = skipwhite(e);
if (len == 5 && STRNCMP(eap->arg, "start", 5) == 0 && *e != NUL)
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 8323ca83e..27c44ff5b 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -2142,7 +2142,7 @@ do_one_cmd(cmdlinep, sourcing,
#ifdef FEAT_USR_CMDS
if (!USER_CMDIDX(ea.cmdidx))
#endif
- ea.argt = cmdnames[(int)ea.cmdidx].cmd_argt;
+ ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt;
if (!ea.skip)
{
@@ -2898,7 +2898,7 @@ find_ucmd(eap, p, full, xp, compl)
eap->cmdidx = CMD_USER;
else
eap->cmdidx = CMD_USER_BUF;
- eap->argt = uc->uc_argt;
+ eap->argt = (long)uc->uc_argt;
eap->useridx = j;
# ifdef FEAT_CMDL_COMPL
@@ -3164,7 +3164,7 @@ set_one_cmd_context(xp, buff)
#ifdef FEAT_USR_CMDS
if (!USER_CMDIDX(ea.cmdidx))
#endif
- ea.argt = cmdnames[(int)ea.cmdidx].cmd_argt;
+ ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt;
arg = skipwhite(p);
@@ -5145,7 +5145,7 @@ uc_list(name, name_len)
for (i = 0; i < gap->ga_len; ++i)
{
cmd = USER_CMD_GA(gap, i);
- a = cmd->uc_argt;
+ a = (long)cmd->uc_argt;
/* Skip commands which don't match the requested prefix */
if (STRNCMP(name, cmd->uc_name, name_len) != 0)
@@ -7295,7 +7295,7 @@ ex_open(eap)
regmatch.rm_ic = p_ic;
p = ml_get_curline();
if (vim_regexec(&regmatch, p, (colnr_T)0))
- curwin->w_cursor.col = regmatch.startp[0] - p;
+ curwin->w_cursor.col = (colnr_T)(regmatch.startp[0] - p);
else
EMSG(_(e_nomatch));
vim_free(regmatch.regprog);
diff --git a/src/ex_eval.c b/src/ex_eval.c
index eaa5dec8c..1da7f1bc1 100644
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -453,7 +453,7 @@ throw_exception(value, type, cmdname)
mesg = excp->messages->throw_msg;
if (cmdname != NULL && *cmdname != NUL)
{
- cmdlen = STRLEN(cmdname);
+ cmdlen = (int)STRLEN(cmdname);
excp->value = vim_strnsave((char_u *)"Vim(",
4 + cmdlen + 2 + (int)STRLEN(mesg));
if (excp->value == NULL)
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 044429e17..10f33550d 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -674,7 +674,7 @@ getcmdline(firstc, count, indent)
if (p != NULL && realloc_cmdbuff((int)STRLEN(p) + 1) == OK)
{
- ccline.cmdlen = STRLEN(p);
+ ccline.cmdlen = (int)STRLEN(p);
STRCPY(ccline.cmdbuff, p);
vim_free(p);
@@ -2917,7 +2917,7 @@ cmdline_paste(regname, literally)
--w;
}
}
- len = (ccline.cmdbuff + ccline.cmdlen) - w;
+ len = (int)((ccline.cmdbuff + ccline.cmdlen) - w);
if (p_ic ? STRNICMP(w, arg, len) == 0 : STRNCMP(w, arg, len) == 0)
p += len;
}
@@ -4794,7 +4794,7 @@ globpath(path, file)
{
ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT);
for (len = 0, i = 0; i < num_p; ++i)
- len += (long_u)STRLEN(p[i]) + 1;
+ len += (int)STRLEN(p[i]) + 1;
/* Concatenate new results to previous ones. */
if (ga_grow(&ga, len) == OK)
@@ -5071,7 +5071,7 @@ add_to_history(histype, new_entry, in_map, sep)
vim_free(hisptr->hisstr);
/* Store the separator after the NUL of the string. */
- len = STRLEN(new_entry);
+ len = (int)STRLEN(new_entry);
hisptr->hisstr = vim_strnsave(new_entry, len + 2);
if (hisptr->hisstr != NULL)
hisptr->hisstr[len + 1] = sep;
diff --git a/src/fileio.c b/src/fileio.c
index 46b50f8cf..1c4cab829 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1143,7 +1143,7 @@ retry:
* multiple of 2
* ucs-4 to utf-8: 4 bytes become up to 6 bytes, size must be
* multiple of 4 */
- real_size = size;
+ real_size = (int)size;
# ifdef USE_ICONV
if (iconv_fd != (iconv_t)-1)
size = size / ICONV_MULT;
@@ -1200,7 +1200,7 @@ retry:
/* Filled up to "size", append partial line.
* Change NL to NUL to reverse the effect done
* below. */
- n = size - tlen;
+ n = (int)(size - tlen);
for (ni = 0; ni < n; ++ni)
{
if (p[ni] == NL)
@@ -1488,7 +1488,7 @@ retry:
/* Handle CP_UTF8 input ourselves to be able to handle
* trailing bytes properly.
* Get one UTF-8 character from src. */
- bytelen = utf_ptr2len_len(src, size);
+ bytelen = (int)utf_ptr2len_len(src, size);
if (bytelen > size)
{
/* Only got some bytes of a character. Normally
@@ -1559,7 +1559,7 @@ retry:
* the data doesn't fit in this encoding. */
dstlen = WideCharToMultiByte(enc_codepage, 0,
(LPCWSTR)ucs2buf, ucs2len,
- (LPSTR)dst, (src - dst),
+ (LPSTR)dst, (int)(src - dst),
replstr, &bad);
if (bad)
found_bad = TRUE;
@@ -1599,7 +1599,7 @@ retry:
}
/* The new size is equal to how much "dst" was advanced. */
- size = dst - ptr;
+ size = (long)(dst - ptr);
}
else
# endif
@@ -1840,7 +1840,7 @@ retry:
* read in the previous read() call. */
for (p = ptr - utf_head_off(buffer, ptr); ; ++p)
{
- int todo = (ptr + size) - p;
+ int todo = (int)((ptr + size) - p);
int l;
if (todo <= 0)
@@ -4538,7 +4538,7 @@ nofail:
if (errmsg != NULL)
{
- int numlen = errnum != NULL ? STRLEN(errnum) : 0;
+ int numlen = errnum != NULL ? (int)STRLEN(errnum) : 0;
attr = hl_attr(HLF_E); /* set highlight for error messages */
msg_add_fname(buf,
@@ -4958,7 +4958,7 @@ buf_write_bytes(ip)
* The buffer has been allocated to be big enough. */
while (fromlen > 0)
{
- n = utf_ptr2len_len(from, fromlen);
+ n = (int)utf_ptr2len_len(from, (int)fromlen);
if (n > (int)fromlen) /* incomplete byte sequence */
break;
u8c = utf_ptr2char(from);
@@ -4977,7 +4977,7 @@ buf_write_bytes(ip)
return FAIL;
}
mch_memmove(ip->bw_rest, from, fromlen);
- ip->bw_restlen = fromlen;
+ ip->bw_restlen = (int)fromlen;
}
else
{
@@ -4985,13 +4985,13 @@ buf_write_bytes(ip)
* buffer. The buffer has been allocated to be big enough. */
ip->bw_restlen = 0;
needed = MultiByteToWideChar(enc_codepage,
- MB_ERR_INVALID_CHARS, (LPCSTR)from, fromlen,
+ MB_ERR_INVALID_CHARS, (LPCSTR)from, (int)fromlen,
NULL, 0);
if (needed == 0)
{
/* When conversion fails there may be a trailing byte. */
needed = MultiByteToWideChar(enc_codepage,
- MB_ERR_INVALID_CHARS, (LPCSTR)from, fromlen - 1,
+ MB_ERR_INVALID_CHARS, (LPCSTR)from, (int)fromlen - 1,
NULL, 0);
if (needed == 0)
{
@@ -5004,7 +5004,7 @@ buf_write_bytes(ip)
ip->bw_restlen = 1;
}
needed = MultiByteToWideChar(enc_codepage, MB_ERR_INVALID_CHARS,
- (LPCSTR)from, fromlen - ip->bw_restlen,
+ (LPCSTR)from, (int)(fromlen - ip->bw_restlen),
(LPWSTR)to, needed);
if (needed == 0)
{
@@ -5033,7 +5033,7 @@ buf_write_bytes(ip)
return FAIL;
}
}
- len = to - buf;
+ len = (int)(to - buf);
}
else
#endif
@@ -5044,7 +5044,7 @@ buf_write_bytes(ip)
* fail. */
len = WideCharToMultiByte(FIO_GET_CP(flags), 0,
(LPCWSTR)ip->bw_conv_buf, (int)fromlen / sizeof(WCHAR),
- (LPSTR)to, ip->bw_conv_buflen - fromlen, 0, &bad);
+ (LPSTR)to, (int)(ip->bw_conv_buflen - fromlen), 0, &bad);
if (bad)
{
ip->bw_conv_error = TRUE;
@@ -7835,7 +7835,7 @@ do_autocmd_event(event, pat, nested, cmd, forceit, group)
/* normalize pat into standard "<buffer>#N" form */
sprintf((char *)buflocal_pat, "<buffer=%d>", buflocal_nr);
pat = buflocal_pat; /* can modify pat and patlen */
- patlen = STRLEN(buflocal_pat); /* but not endpat */
+ patlen = (int)STRLEN(buflocal_pat); /* but not endpat */
}
/*
diff --git a/src/fold.c b/src/fold.c
index 4e23d6335..8cd51a9c2 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -2006,7 +2006,7 @@ foldtext_cleanup(str)
/* Ignore leading and trailing white space in 'commentstring'. */
cms_start = skipwhite(curbuf->b_p_cms);
- cms_slen = STRLEN(cms_start);
+ cms_slen = (int)STRLEN(cms_start);
while (cms_slen > 0 && vim_iswhite(cms_start[cms_slen - 1]))
--cms_slen;
@@ -2014,8 +2014,8 @@ foldtext_cleanup(str)
cms_end = (char_u *)strstr((char *)cms_start, "%s");
if (cms_end != NULL)
{
- cms_elen = cms_slen - (cms_end - cms_start);
- cms_slen = cms_end - cms_start;
+ cms_elen = cms_slen - (int)(cms_end - cms_start);
+ cms_slen = (int)(cms_end - cms_start);
/* exclude white space before "%s" */
while (cms_slen > 0 && vim_iswhite(cms_start[cms_slen - 1]))
@@ -2023,7 +2023,7 @@ foldtext_cleanup(str)
/* skip "%s" and white space after it */
s = skipwhite(cms_end + 2);
- cms_elen -= s - cms_end;
+ cms_elen -= (int)(s - cms_end);
cms_end = s;
}
parseMarker(curwin);
@@ -2047,7 +2047,7 @@ foldtext_cleanup(str)
if (p >= str + cms_slen
&& STRNCMP(p - cms_slen, cms_start, cms_slen) == 0)
{
- len += (s - p) + cms_slen;
+ len += (int)(s - p) + cms_slen;
s = p - cms_slen;
}
}
diff --git a/src/getchar.c b/src/getchar.c
index 4c38cd758..3d851653d 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -270,7 +270,7 @@ add_buff(buf, s, slen)
TRUE);
if (p == NULL)
return; /* no space, just forget it */
- buf->bh_space = len - slen;
+ buf->bh_space = (int)(len - slen);
vim_strncpy(p->b_str, s, (size_t)slen);
p->b_next = buf->bh_curr->b_next;
diff --git a/src/gui.c b/src/gui.c
index 5ede4c1be..c377a35df 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -2566,7 +2566,7 @@ gui_redraw_block(row1, col1, row2, col2, flags)
/* Put the cursor back where it was */
gui.row = old_row;
gui.col = old_col;
- gui.highlight_mask = old_hl_mask;
+ gui.highlight_mask = (int)old_hl_mask;
return retval;
}
@@ -4345,7 +4345,7 @@ gui_do_horiz_scroll()
if (curwin->w_leftcol == scrollbar_value)
return FALSE;
- curwin->w_leftcol = scrollbar_value;
+ curwin->w_leftcol = (colnr_T)scrollbar_value;
/* When the line of the cursor is too short, move the cursor to the
* longest visible line. Do a sanity check on "longest_lnum", just in
@@ -4427,9 +4427,9 @@ gui_get_lightness(pixel)
{
long_u rgb = gui_mch_get_rgb(pixel);
- return ( (((rgb >> 16) & 0xff) * 299)
- + (((rgb >> 8) & 0xff) * 587)
- + ((rgb & 0xff) * 114)) / 1000;
+ return (int)( (((rgb >> 16) & 0xff) * 299)
+ + (((rgb >> 8) & 0xff) * 587)
+ + ((rgb & 0xff) * 114)) / 1000;
}
#if defined(FEAT_GUI_X11) || defined(PROTO)
@@ -4808,7 +4808,7 @@ get_find_dialog_text(arg, wwordp, mcasep)
text = vim_strsave(text);
if (text != NULL)
{
- int len = STRLEN(text);
+ int len = (int)STRLEN(text);
int i;
/* Remove "\V" */
diff --git a/src/gui_w32.c b/src/gui_w32.c
index 21b757b60..be5a78ba9 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -186,7 +186,7 @@ static void delete_tooltip __ARGS((BalloonEval *beval));
static VOID CALLBACK BevalTimerProc __ARGS((HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime));
static BalloonEval *cur_beval = NULL;
-static UINT BevalTimerId = 0;
+static UINT_PTR BevalTimerId = 0;
static DWORD LastActivity = 0;
/*
@@ -758,7 +758,7 @@ _WndProc(
case WM_CHAR:
/* Don't use HANDLE_MSG() for WM_CHAR, it truncates wParam to a single
* byte while we want the UTF-16 character value. */
- _OnChar(hwnd, wParam, (int)(short)LOWORD(lParam));
+ _OnChar(hwnd, (UINT)wParam, (int)(short)LOWORD(lParam));
return 0L;
case WM_SYSCHAR:
@@ -774,7 +774,7 @@ _WndProc(
)
#endif
{
- _OnSysChar(hwnd, wParam, (int)(short)LOWORD(lParam));
+ _OnSysChar(hwnd, (UINT)wParam, (int)(short)LOWORD(lParam));
return 0L;
}
#ifdef FEAT_MENU
@@ -2362,7 +2362,7 @@ gui_mch_add_menu(
infow.wID = menu->id;
infow.fType = MFT_STRING;
infow.dwTypeData = wn;
- infow.cch = wcslen(wn);
+ infow.cch = (UINT)wcslen(wn);
infow.hSubMenu = menu->submenu_id;
n = InsertMenuItemW((parent == NULL)
? s_menuBar : parent->submenu_id,
@@ -2990,7 +2990,7 @@ gui_mch_dialog(
if (last_white != NULL)
{
/* break the line just after a space */
- ga.ga_len -= pend - (last_white + 1);
+ ga.ga_len -= (int)(pend - (last_white + 1));
pend = last_white + 1;
last_white = NULL;
}
@@ -3374,7 +3374,7 @@ nCopyAnsiToWideChar(
if (wn != NULL)
{
wcscpy(lpWCStr, wn);
- nChar = wcslen(wn) + 1;
+ nChar = (int)wcslen(wn) + 1;
vim_free(wn);
}
}
diff --git a/src/gui_w48.c b/src/gui_w48.c
index ef1e0713d..f417c72d8 100644
--- a/src/gui_w48.c
+++ b/src/gui_w48.c
@@ -3612,7 +3612,7 @@ get_cmd_args(char *prog, char *cmdline, char ***argvp, char **tofree)
{
/* Backslashes are only special when followed by a double
* quote. */
- i = strspn(p, "\\");
+ i = (int)strspn(p, "\\");
if (p[i] == '"')
{
/* Halve the number of backslashes. */
diff --git a/src/hardcopy.c b/src/hardcopy.c
index 2b5c70e23..62567a3db 100644
--- a/src/hardcopy.c
+++ b/src/hardcopy.c
@@ -901,7 +901,7 @@ hardcopy_line(psettings, page_line, ppos)
if (line[col] == TAB || tab_spaces != 0)
{
if (tab_spaces == 0)
- tab_spaces = curbuf->b_p_ts - (print_pos % curbuf->b_p_ts);
+ tab_spaces = (int)(curbuf->b_p_ts - (print_pos % curbuf->b_p_ts));
while (tab_spaces > 0)
{
@@ -936,7 +936,7 @@ hardcopy_line(psettings, page_line, ppos)
}
ppos->lead_spaces = tab_spaces;
- ppos->print_pos = print_pos;
+ ppos->print_pos = (int)print_pos;
/*
* Start next line of file if we clip lines, or have reached end of the
@@ -1476,7 +1476,7 @@ prt_write_file_raw_len(buffer, bytes)
prt_write_file(buffer)
char_u *buffer;
{
- prt_write_file_len(buffer, STRLEN(buffer));
+ prt_write_file_len(buffer, (int)STRLEN(buffer));
}
static void
@@ -1937,7 +1937,7 @@ prt_open_resource(resource)
vim_memset(prt_resfile.buffer, NUL, PRT_FILE_BUFFER_LEN);
/* Parse first line to ensure valid resource file */
- prt_resfile.len = fread((char *)prt_resfile.buffer, sizeof(char_u),
+ prt_resfile.len = (int)fread((char *)prt_resfile.buffer, sizeof(char_u),
PRT_FILE_BUFFER_LEN, fd_resource);
if (ferror(fd_resource))
{
@@ -1955,7 +1955,7 @@ prt_open_resource(resource)
offset = 0;
if (prt_resfile_strncmp(offset, PRT_RESOURCE_HEADER,
- STRLEN(PRT_RESOURCE_HEADER)) != 0)
+ (int)STRLEN(PRT_RESOURCE_HEADER)) != 0)
{
EMSG2(_("E618: file \"%s\" is not a PostScript resource file"),
resource->filename);
@@ -1964,7 +1964,7 @@ prt_open_resource(resource)
}
/* Skip over any version numbers and following ws */
- offset += STRLEN(PRT_RESOURCE_HEADER);
+ offset += (int)STRLEN(PRT_RESOURCE_HEADER);
offset = prt_resfile_skip_nonws(offset);
if (offset == -1)
return FALSE;
@@ -1973,24 +1973,24 @@ prt_open_resource(resource)
return FALSE;
if (prt_resfile_strncmp(offset, PRT_RESOURCE_RESOURCE,
- STRLEN(PRT_RESOURCE_RESOURCE)) != 0)
+ (int)STRLEN(PRT_RESOURCE_RESOURCE)) != 0)
{
EMSG2(_("E619: file \"%s\" is not a supported PostScript resource file"),
resource->filename);
fclose(fd_resource);
return FALSE;
}
- offset += STRLEN(PRT_RESOURCE_RESOURCE);
+ offset += (int)STRLEN(PRT_RESOURCE_RESOURCE);
/* Decide type of resource in the file */
if (prt_resfile_strncmp(offset, PRT_RESOURCE_PROCSET,
- STRLEN(PRT_RESOURCE_PROCSET)) == 0)
+ (int)STRLEN(PRT_RESOURCE_PROCSET)) == 0)
resource->type = PRT_RESOURCE_TYPE_PROCSET;
else if (prt_resfile_strncmp(offset, PRT_RESOURCE_ENCODING,
- STRLEN(PRT_RESOURCE_ENCODING)) == 0)
+ (int)STRLEN(PRT_RESOURCE_ENCODING)) == 0)
resource->type = PRT_RESOURCE_TYPE_ENCODING;
else if (prt_resfile_strncmp(offset, PRT_RESOURCE_CMAP,
- STRLEN(PRT_RESOURCE_CMAP)) == 0)
+ (int)STRLEN(PRT_RESOURCE_CMAP)) == 0)
resource->type = PRT_RESOURCE_TYPE_CMAP;
else
{
@@ -2414,7 +2414,7 @@ prt_match_encoding(p_encoding, p_cmap, pp_mbenc)
*pp_mbenc = NULL;
/* Look for recognised encoding */
- enc_len = STRLEN(p_encoding);
+ enc_len = (int)STRLEN(p_encoding);
p_mbenc = p_cmap->encodings;
for (mbenc = 0; mbenc < p_cmap->num_encodings; mbenc++)
{
@@ -2441,7 +2441,7 @@ prt_match_charset(p_charset, p_cmap, pp_mbchar)
/* Look for recognised character set, using default if one is not given */
if (*p_charset == NUL)
p_charset = p_cmap->defcs;
- char_len = STRLEN(p_charset);
+ char_len = (int)STRLEN(p_charset);
p_mbchar = p_cmap->charsets;
for (mbchar = 0; mbchar < p_cmap->num_charsets; mbchar++)
{
@@ -2831,7 +2831,7 @@ prt_add_resource(resource)
}
if (bytes_read == 0)
break;
- prt_write_file_raw_len(resource_buffer, bytes_read);
+ prt_write_file_raw_len(resource_buffer, (int)bytes_read);
if (prt_file_error)
{
fclose(fd_resource);
@@ -3634,7 +3634,7 @@ mch_print_set_font(iBold, iItalic, iUnderline)
mch_print_set_bg(bgcol)
long_u bgcol;
{
- prt_bgcol = bgcol;
+ prt_bgcol = (int)bgcol;
prt_attribute_change = TRUE;
prt_need_bgcol = TRUE;
}
@@ -3645,7 +3645,7 @@ mch_print_set_fg(fgcol)
{
if (fgcol != (long_u)prt_fgcol)
{
- prt_fgcol = fgcol;
+ prt_fgcol = (int)fgcol;
prt_attribute_change = TRUE;
prt_need_fgcol = TRUE;
}
diff --git a/src/hashtab.c b/src/hashtab.c
index e3306b3c9..e0d3e1a08 100644
--- a/src/hashtab.c
+++ b/src/hashtab.c
@@ -95,10 +95,10 @@ hash_clear_all(ht, off)
hashtab_T *ht;
int off;
{
- int todo;
+ long todo;
hashitem_T *hi;
- todo = ht->ht_used;
+ todo = (long)ht->ht_used;
for (hi = ht->ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -150,7 +150,7 @@ hash_lookup(ht, key, hash)
* - skip over a removed item
* - return if the item matches
*/
- idx = hash & ht->ht_mask;
+ idx = (int)(hash & ht->ht_mask);
hi = &ht->ht_array[idx];
if (hi->hi_key == NULL)
@@ -176,7 +176,7 @@ hash_lookup(ht, key, hash)
#ifdef HT_DEBUG
++hash_count_perturb; /* count a "miss" for hashtab lookup */
#endif
- idx = (idx << 2) + idx + perturb + 1;
+ idx = (int)((idx << 2) + idx + perturb + 1);
hi = &ht->ht_array[idx & ht->ht_mask];
if (hi->hi_key == NULL)
return freeitem == NULL ? hi : freeitem;
@@ -387,7 +387,7 @@ hash_may_resize(ht, minitems)
{
/* Use specified size. */
if ((long_u)minitems < ht->ht_used) /* just in case... */
- minitems = ht->ht_used;
+ minitems = (int)ht->ht_used;
minsize = minitems * 3 / 2; /* array is up to 2/3 full */
}
@@ -439,7 +439,7 @@ hash_may_resize(ht, minitems)
* is also a cleanup action.
*/
newmask = newsize - 1;
- todo = ht->ht_used;
+ todo = (int)ht->ht_used;
for (olditem = oldarray; todo > 0; ++olditem)
if (!HASHITEM_EMPTY(olditem))
{
@@ -448,13 +448,13 @@ hash_may_resize(ht, minitems)
* the algorithm to find an item in hash_lookup(). But we only
* need to search for a NULL key, thus it's simpler.
*/
- newi = olditem->hi_hash & newmask;
+ newi = (int)(olditem->hi_hash & newmask);
newitem = &newarray[newi];
if (newitem->hi_key != NULL)
for (perturb = olditem->hi_hash; ; perturb >>= PERTURB_SHIFT)
{
- newi = (newi << 2) + newi + perturb + 1;
+ newi = (int)((newi << 2) + newi + perturb + 1);
newitem = &newarray[newi & newmask];
if (newitem->hi_key == NULL)
break;
diff --git a/src/if_cscope.c b/src/if_cscope.c
index aef48d064..81c7a6a1f 100644
--- a/src/if_cscope.c
+++ b/src/if_cscope.c
@@ -475,7 +475,7 @@ staterr:
/* if filename is a directory, append the cscope database name to it */
if ((statbuf.st_mode & S_IFMT) == S_IFDIR)
{
- fname2 = (char *)alloc(strlen(CSCOPE_DBFILE) + strlen(fname) + 2);
+ fname2 = (char *)alloc((unsigned)(strlen(CSCOPE_DBFILE) + strlen(fname) + 2));
if (fname2 == NULL)
goto add_err;
@@ -700,7 +700,7 @@ cs_create_cmd(csoption, pattern)
return NULL;
}
- if ((cmd = (char *)alloc(strlen(pattern) + 2)) == NULL)
+ if ((cmd = (char *)alloc((unsigned)(strlen(pattern) + 2))) == NULL)
return NULL;
(void)sprintf(cmd, "%d%s", search, pattern);
@@ -723,7 +723,7 @@ cs_create_connection(i)
char *prog, *cmd, *ppath = NULL;
#ifndef UNIX
int in_save, out_save, err_save;
- int ph;
+ long ph;
# ifdef FEAT_GUI
HWND activewnd = NULL;
HWND consolewnd = NULL;
@@ -792,7 +792,7 @@ err_closing:
expand_env((char_u *)p_csprg, (char_u *)prog, MAXPATHL);
/* alloc space to hold the cscope command */
- len = strlen(prog) + strlen(csinfo[i].fname) + 32;
+ len = (int)(strlen(prog) + strlen(csinfo[i].fname) + 32);
if (csinfo[i].ppath)
{
/* expand the prepend path for env var's */
@@ -807,11 +807,11 @@ err_closing:
}
expand_env((char_u *)csinfo[i].ppath, (char_u *)ppath, MAXPATHL);
- len += strlen(ppath);
+ len += (int)strlen(ppath);
}
if (csinfo[i].flags)
- len += strlen(csinfo[i].flags);
+ len += (int)strlen(csinfo[i].flags);
if ((cmd = (char *)alloc(len)) == NULL)
{
@@ -881,9 +881,9 @@ err_closing:
/* May be use &shell, &shellquote etc */
# ifdef __BORLANDC__
/* BCC 5.5 uses a different function name for spawnlp */
- ph = spawnlp(P_NOWAIT, prog, cmd, NULL);
+ ph = (long)spawnlp(P_NOWAIT, prog, cmd, NULL);
# else
- ph = _spawnlp(_P_NOWAIT, prog, cmd, NULL);
+ ph = (long)_spawnlp(_P_NOWAIT, prog, cmd, NULL);
# endif
vim_free(prog);
vim_free(cmd);
@@ -1034,7 +1034,7 @@ cs_find_common(opt, pat, forceit, verbose, use_ll)
if (!verbose)
return FALSE;
- buf = (char *)alloc(strlen(opt) + strlen(pat) + strlen(nf));
+ buf = (char *)alloc((unsigned)(strlen(opt) + strlen(pat) + strlen(nf)));
if (buf == NULL)
(void)EMSG(nf);
else
@@ -1086,7 +1086,7 @@ cs_find_common(opt, pat, forceit, verbose, use_ll)
if (strchr(CSQF_FLAGS, *qfpos) == NULL)
{
char *nf = _("E469: invalid cscopequickfix flag %c for %c");
- char *buf = (char *)alloc(strlen(nf));
+ char *buf = (char *)alloc((unsigned)strlen(nf));
/* strlen will be enough because we use chars */
if (buf != NULL)
@@ -1330,14 +1330,14 @@ cs_insert_filelist(fname, ppath, flags, sb)
return -1;
}
- if ((csinfo[i].fname = (char *)alloc(strlen(fname)+1)) == NULL)
+ if ((csinfo[i].fname = (char *)alloc((unsigned)strlen(fname)+1)) == NULL)
return -1;
(void)strcpy(csinfo[i].fname, (const char *)fname);
if (ppath != NULL)
{
- if ((csinfo[i].ppath = (char *)alloc(strlen(ppath) + 1)) == NULL)
+ if ((csinfo[i].ppath = (char *)alloc((unsigned)strlen(ppath) + 1)) == NULL)
{
vim_free(csinfo[i].fname);
csinfo[i].fname = NULL;
@@ -1349,7 +1349,7 @@ cs_insert_filelist(fname, ppath, flags, sb)
if (flags != NULL)
{
- if ((csinfo[i].flags = (char *)alloc(strlen(flags) + 1)) == NULL)
+ if ((csinfo[i].flags = (char *)alloc((unsigned)strlen(flags) + 1)) == NULL)
{
vim_free(csinfo[i].fname);
vim_free(csinfo[i].ppath);
@@ -1526,7 +1526,7 @@ cs_make_vim_style_matches(fname, slno, search, tagstr)
if (search != NULL)
{
- amt = strlen(fname) + strlen(slno) + strlen(tagstr) + strlen(search)+6;
+ amt = (int)(strlen(fname) + strlen(slno) + strlen(tagstr) + strlen(search)+6);
if ((buf = (char *)alloc(amt)) == NULL)
return NULL;
@@ -1534,7 +1534,7 @@ cs_make_vim_style_matches(fname, slno, search, tagstr)
}
else
{
- amt = strlen(fname) + strlen(slno) + strlen(tagstr) + 5;
+ amt = (int)(strlen(fname) + strlen(slno) + strlen(tagstr) + 5);
if ((buf = (char *)alloc(amt)) == NULL)
return NULL;
@@ -1720,7 +1720,7 @@ cs_file_results(f, nummatches_a)
&slno, &search)) == NULL)
continue;
- context = (char *)alloc(strlen(cntx)+5);
+ context = (char *)alloc((unsigned)strlen(cntx)+5);
if (context==NULL)
continue;
@@ -1884,13 +1884,13 @@ cs_print_tags_priv(matches, cntxts, num_matches)
assert (num_matches > 0);
- if ((tbuf = (char *)alloc(strlen(matches[0]) + 1)) == NULL)
+ if ((tbuf = (char *)alloc((unsigned)strlen(matches[0]) + 1)) == NULL)
return;
strcpy(tbuf, matches[0]);
ptag = strtok(tbuf, "\t");
- newsize = strlen(cstag_msg) + strlen(ptag);
+ newsize = (int)(strlen(cstag_msg) + strlen(ptag));
buf = (char *)alloc(newsize);
if (buf != NULL)
{
@@ -1914,7 +1914,7 @@ cs_print_tags_priv(matches, cntxts, num_matches)
* by parsing matches[i] on the fly and placing stuff into buf
* directly, but that's too much of a hassle
*/
- if ((tbuf = (char *)alloc(strlen(matches[idx]) + 1)) == NULL)
+ if ((tbuf = (char *)alloc((unsigned)strlen(matches[idx]) + 1)) == NULL)
continue;
(void)strcpy(tbuf, matches[idx]);
@@ -1935,7 +1935,7 @@ cs_print_tags_priv(matches, cntxts, num_matches)
lno[strlen(lno)-2] = '\0'; /* ignore ;" at the end */
/* hopefully 'num' (num of matches) will be less than 10^16 */
- newsize = strlen(csfmt_str) + 16 + strlen(lno);
+ newsize = (int)(strlen(csfmt_str) + 16 + strlen(lno));
if (bufsize < newsize)
{
buf = (char *)vim_realloc(buf, newsize);
@@ -1957,7 +1957,7 @@ cs_print_tags_priv(matches, cntxts, num_matches)
context = cntxts[idx];
else
context = globalcntx;
- newsize = strlen(context) + strlen(cntxformat);
+ newsize = (int)(strlen(context) + strlen(cntxformat));
if (bufsize < newsize)
{
@@ -2018,7 +2018,7 @@ cs_read_prompt(i)
char *cs_emsg;
int maxlen;
static char *eprompt = "Press the RETURN key to continue:";
- int epromptlen = strlen(eprompt);
+ int epromptlen = (int)strlen(eprompt);
int n;
cs_emsg = _("E609: Cscope error: %s");
@@ -2236,9 +2236,9 @@ cs_resolve_file(i, name)
* fullname is freed after cs_make_vim_style_matches, after it's been
* copied into the tag buffer used by vim
*/
- len = strlen(name) + 2;
+ len = (int)(strlen(name) + 2);
if (csinfo[i].ppath != NULL)
- len += strlen(csinfo[i].ppath);
+ len += (int)strlen(csinfo[i].ppath);
if ((fullname = (char *)alloc(len)) == NULL)
return NULL;
diff --git a/src/if_ruby.c b/src/if_ruby.c
index 6bafdeb6b..78ccc00f1 100644
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -362,7 +362,7 @@ void ex_rubydo(exarg_T *eap)
line = rb_lastline_get();
if (!NIL_P(line)) {
if (TYPE(line) != T_STRING) {
- EMSG("E265: $_ must be an instance of String");
+ EMSG(_("E265: $_ must be an instance of String"));
return;
}
ml_replace(i, (char_u *) STR2CSTR(line), 1);
@@ -452,26 +452,26 @@ static void error_print(int state)
switch (state) {
case TAG_RETURN:
- EMSG("E267: unexpected return");
+ EMSG(_("E267: unexpected return"));
break;
case TAG_NEXT:
- EMSG("E268: unexpected next");
+ EMSG(_("E268: unexpected next"));
break;
case TAG_BREAK:
- EMSG("E269: unexpected break");
+ EMSG(_("E269: unexpected break"));
break;
case TAG_REDO:
- EMSG("E270: unexpected redo");
+ EMSG(_("E270: unexpected redo"));
break;
case TAG_RETRY:
- EMSG("E271: retry outside of rescue clause");
+ EMSG(_("E271: retry outside of rescue clause"));
break;
case TAG_RAISE:
case TAG_FATAL:
eclass = CLASS_OF(ruby_errinfo);
einfo = rb_obj_as_string(ruby_errinfo);
if (eclass == rb_eRuntimeError && RSTRING(einfo)->len == 0) {
- EMSG("E272: unhandled exception");
+ EMSG(_("E272: unhandled exception"));
}
else {
VALUE epath;
diff --git a/src/main.c b/src/main.c
index f8b4fa94e..51cd2c724 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1872,7 +1872,7 @@ command_line_scan(parmp)
{
set_option_value((char_u *)"verbosefile", 0L,
(char_u *)argv[0] + argv_idx, 0);
- argv_idx = STRLEN(argv[0]);
+ argv_idx = (int)STRLEN(argv[0]);
}
break;
diff --git a/src/mbyte.c b/src/mbyte.c
index 5db5c0483..98d4e0009 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -1104,7 +1104,7 @@ intable(table, size, c)
/* binary search in table */
bot = 0;
- top = size / sizeof(struct interval) - 1;
+ top = (int)(size / sizeof(struct interval) - 1);
while (top >= bot)
{
mid = (bot + top) / 2;
@@ -2271,7 +2271,7 @@ mb_strnicmp(s1, s2, nn)
int i, j, l;
int cdiff;
int incomplete = FALSE;
- int n = nn;
+ int n = (int)nn;
for (i = 0; i < n; i += l)
{
@@ -2365,7 +2365,7 @@ show_utf8()
}
sprintf((char *)IObuff + rlen, "%02x ", line[i]);
--clen;
- rlen += STRLEN(IObuff + rlen);
+ rlen += (int)STRLEN(IObuff + rlen);
if (rlen > IOSIZE - 20)
break;
}
@@ -2640,12 +2640,12 @@ utf_find_illegal()
|| utf_char2len(utf_ptr2char(p)) != len))
{
if (vimconv.vc_type == CONV_NONE)
- curwin->w_cursor.col += p - ml_get_cursor();
+ curwin->w_cursor.col += (colnr_T)(p - ml_get_cursor());
else
{
int l;
- len = p - tofree;
+ len = (int)(p - tofree);
for (p = ml_get_cursor(); *p != NUL && len-- > 0; p += l)
{
l = utf_ptr2len(p);
@@ -3263,7 +3263,7 @@ iconv_string(vcp, str, slen, unconvlenp)
{
/* Handle an incomplete sequence at the end. */
*to = NUL;
- *unconvlenp = fromlen;
+ *unconvlenp = (int)fromlen;
break;
}
@@ -3280,12 +3280,12 @@ iconv_string(vcp, str, slen, unconvlenp)
if ((*mb_ptr2cells)((char_u *)from) > 1)
*to++ = '?';
if (enc_utf8)
- l = utfc_ptr2len_len((char_u *)from, fromlen);
+ l = utfc_ptr2len_len((char_u *)from, (int)fromlen);
else
{
l = (*mb_ptr2len)((char_u *)from);
if (l > (int)fromlen)
- l = fromlen;
+ l = (int)fromlen;
}
from += l;
fromlen -= l;
diff --git a/src/memline.c b/src/memline.c
index 5543e5d39..9284abbda 100644
--- a/src/memline.c
+++ b/src/memline.c
@@ -809,7 +809,7 @@ add_b0_fenc(b0p, buf)
{
int n;
- n = STRLEN(buf->b_p_fenc);
+ n = (int)STRLEN(buf->b_p_fenc);
if (STRLEN(b0p->b0_fname) + n + 1 > B0_FNAME_SIZE)
b0p->b0_flags &= ~B0_HAS_FENC;
else
@@ -1066,7 +1066,7 @@ ml_recover()
for (p = b0p->b0_fname + B0_FNAME_SIZE;
p > b0p->b0_fname && p[-1] != NUL; --p)
;
- b0_fenc = vim_strnsave(p, b0p->b0_fname + B0_FNAME_SIZE - p);
+ b0_fenc = vim_strnsave(p, (int)(b0p->b0_fname + B0_FNAME_SIZE - p));
}
mf_put(mfp, hp, FALSE, FALSE); /* release block 0 */
@@ -2638,7 +2638,7 @@ ml_append_int(buf, lnum, line, len, newfile, mark)
if (usingNetbeans)
{
if (STRLEN(line) > 0)
- netbeans_inserted(buf, lnum+1, (colnr_T)0, line, STRLEN(line));
+ netbeans_inserted(buf, lnum+1, (colnr_T)0, line, (int)STRLEN(line));
netbeans_inserted(buf, lnum+1, (colnr_T)STRLEN(line),
(char_u *)"\n", 1);
}
@@ -2676,7 +2676,7 @@ ml_replace(lnum, line, copy)
if (usingNetbeans)
{
netbeans_removed(curbuf, lnum, 0, (long)STRLEN(ml_get(lnum)));
- netbeans_inserted(curbuf, lnum, 0, line, STRLEN(line));
+ netbeans_inserted(curbuf, lnum, 0, line, (int)STRLEN(line));
}
#endif
if (curbuf->b_ml.ml_line_lnum != lnum) /* other line buffered */
diff --git a/src/menu.c b/src/menu.c
index b9c79229b..b4f06d242 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -759,7 +759,7 @@ add_menu_path(menu_path, menuarg, pri_tab, call_data
STRCPY(menu->strings[i] + 1, call_data);
if (c == Ctrl_C)
{
- int len = STRLEN(menu->strings[i]);
+ int len = (int)STRLEN(menu->strings[i]);
/* Append CTRL-\ CTRL-G to obey 'insertmode'. */
menu->strings[i][len] = Ctrl_BSL;
diff --git a/src/message.c b/src/message.c
index 0d56759df..69b194d4e 100644
--- a/src/message.c
+++ b/src/message.c
@@ -2102,7 +2102,7 @@ inc_msg_scrolled()
p = (char_u *)_("Unknown");
else
{
- len = STRLEN(p) + 40;
+ len = (int)STRLEN(p) + 40;
tofree = alloc(len);
if (tofree != NULL)
{
@@ -3511,11 +3511,11 @@ msg_show_console_dialog(message, buttons, dfltbutton)
}
else
{
- len += STRLEN(message)
- + 2 /* for the NL's */
- + STRLEN(buttons)
- + 3; /* for the ": " and NUL */
- lenhotkey++; /* for the NUL */
+ len += (int)(STRLEN(message)
+ + 2 /* for the NL's */
+ + STRLEN(buttons)
+ + 3); /* for the ": " and NUL */
+ lenhotkey++; /* for the NUL */
/* If no hotkey is specified first char is used. */
if (!has_hotkey[0])
@@ -4429,8 +4429,8 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
/* zero padding to specified minimal field width? */
if (!justify_left && zero_padding)
{
- int n = min_field_width - (str_arg_l
- + number_of_zeros_to_pad);
+ int n = (int)(min_field_width - (str_arg_l
+ + number_of_zeros_to_pad));
if (n > 0)
number_of_zeros_to_pad += n;
}
@@ -4464,7 +4464,7 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
if (!justify_left)
{
/* left padding with blank or zero */
- int pn = min_field_width - (str_arg_l + number_of_zeros_to_pad);
+ int pn = (int)(min_field_width - (str_arg_l + number_of_zeros_to_pad));
if (pn > 0)
{
@@ -4491,7 +4491,7 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
{
/* insert first part of numerics (sign or '0x') before zero
* padding */
- int zn = zero_padding_insertion_ind;
+ int zn = (int)zero_padding_insertion_ind;
if (zn > 0)
{
@@ -4507,7 +4507,7 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
/* insert zero padding as requested by the precision or min
* field width */
- zn = number_of_zeros_to_pad;
+ zn = (int)number_of_zeros_to_pad;
if (zn > 0)
{
if (str_l < str_m)
@@ -4524,7 +4524,7 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
/* insert formatted string
* (or as-is conversion specifier for unknown conversions) */
{
- int sn = str_arg_l - zero_padding_insertion_ind;
+ int sn = (int)(str_arg_l - zero_padding_insertion_ind);
if (sn > 0)
{
@@ -4544,7 +4544,7 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
if (justify_left)
{
/* right blank padding to the field width */
- int pn = min_field_width - (str_arg_l + number_of_zeros_to_pad);
+ int pn = (int)(min_field_width - (str_arg_l + number_of_zeros_to_pad));
if (pn > 0)
{
diff --git a/src/misc1.c b/src/misc1.c
index 6c3b5ad25..7d86e460e 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -263,7 +263,7 @@ set_indent(size, flags)
/* Correct saved cursor position if it's after the indent. */
if (saved_cursor.lnum == curwin->w_cursor.lnum
&& saved_cursor.col >= (colnr_T)(p - oldline))
- saved_cursor.col += ind_len - (p - oldline);
+ saved_cursor.col += ind_len - (colnr_T)(p - oldline);
retval = TRUE;
}
else
@@ -1013,7 +1013,7 @@ open_line(dir, flags, old_indent)
mb_ptr_back(leader, p);
old_size += ptr2cells(p);
}
- l = lead_repl_len - (endp - p);
+ l = lead_repl_len - (int)(endp - p);
if (l != 0)
mch_memmove(endp + l, endp,
(size_t)((leader + lead_len) - endp));
@@ -3418,7 +3418,7 @@ init_homedir()
/* Convert from active codepage to UTF-8. Other conversions are
* not done, because they would fail for non-ASCII characters. */
- acp_to_enc(var, STRLEN(var), &pp, &len);
+ acp_to_enc(var, (int)STRLEN(var), &pp, &len);
if (pp != NULL)
{
homedir = pp;
@@ -3497,7 +3497,7 @@ expand_env_esc(srcp, dst, dstlen, esc, startstr)
int startstr_len = 0;
if (startstr != NULL)
- startstr_len = STRLEN(startstr);
+ startstr_len = (int)STRLEN(startstr);
src = skipwhite(srcp);
--dstlen; /* leave one char space for "\," */
@@ -3705,7 +3705,7 @@ expand_env_esc(srcp, dst, dstlen, esc, startstr)
{
STRCPY(dst, var);
dstlen -= (int)STRLEN(var);
- c = STRLEN(var);
+ c = (int)STRLEN(var);
/* if var[] ends in a path separator and tail[] starts
* with it, skip a character */
if (*var != NUL && after_pathsep(dst, dst + c)
@@ -3780,7 +3780,7 @@ vim_getenv(name, mustfree)
/* Convert from active codepage to UTF-8. Other conversions are
* not done, because they would fail for non-ASCII characters. */
- acp_to_enc(p, STRLEN(p), &pp, &len);
+ acp_to_enc(p, (int)STRLEN(p), &pp, &len);
if (pp != NULL)
{
p = pp;
@@ -3825,7 +3825,7 @@ vim_getenv(name, mustfree)
/* Convert from active codepage to UTF-8. Other conversions
* are not done, because they would fail for non-ASCII
* characters. */
- acp_to_enc(p, STRLEN(p), &pp, &len);
+ acp_to_enc(p, (int)STRLEN(p), &pp, &len);
if (pp != NULL)
{
if (mustfree)
@@ -5144,11 +5144,11 @@ cin_first_id_amount()
line = ml_get_curline();
p = skipwhite(line);
- len = skiptowhite(p) - p;
+ len = (int)(skiptowhite(p) - p);
if (len == 6 && STRNCMP(p, "static", 6) == 0)
{
p = skipwhite(p + 6);
- len = skiptowhite(p) - p;
+ len = (int)(skiptowhite(p) - p);
}
if (len == 6 && STRNCMP(p, "struct", 6) == 0)
p = skipwhite(p + 6);
@@ -5489,7 +5489,7 @@ cin_iswhileofdo_end(terminated, ind_maxparen, ind_maxcomment)
{
/* Found ");" at end of the line, now check there is "while"
* before the matching '('. XXX */
- i = p - line;
+ i = (int)(p - line);
curwin->w_cursor.col = i;
trypos = find_match_paren(ind_maxparen, ind_maxcomment);
if (trypos != NULL)
@@ -6468,7 +6468,7 @@ get_c_indent()
* our matching '('. */
curwin->w_cursor.lnum = our_paren_pos.lnum;
line = ml_get_curline();
- look_col = look - line;
+ look_col = (int)(look - line);
curwin->w_cursor.col = look_col + 1;
if ((trypos = findmatchlimit(NULL, ')', 0, ind_maxparen))
!= NULL
diff --git a/src/misc2.c b/src/misc2.c
index 004974a20..f8a583bc7 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -2447,7 +2447,7 @@ find_special_key(srcp, modp, keycode)
int modifiers;
int bit;
int key;
- long_u n;
+ unsigned long n;
src = *srcp;
if (src[0] != '<')
diff --git a/src/netbeans.c b/src/netbeans.c
index ded490134..8928342d2 100644
--- a/src/netbeans.c
+++ b/src/netbeans.c
@@ -86,7 +86,13 @@ static void nb_parse_cmd __ARGS((char_u *));
static int nb_do_cmd __ARGS((int, char_u *, int, int, char_u *));
static void nb_send __ARGS((char *buf, char *fun));
-static int sd = -1; /* socket fd for Netbeans connection */
+#ifdef WIN64
+typedef __int64 NBSOCK;
+#else
+typedef int NBSOCK;
+#endif
+
+static NBSOCK sd = -1; /* socket fd for Netbeans connection */
#ifdef FEAT_GUI_MOTIF
static XtInputId inputHandler; /* Cookie for input */
#endif
@@ -315,7 +321,7 @@ netbeans_connect(void)
#ifdef INET_SOCKETS
port = atoi(address);
- if ((sd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
+ if ((sd = (NBSOCK)socket(AF_INET, SOCK_STREAM, 0)) == (NBSOCK)-1)
{
PERROR("socket() in netbeans_connect()");
goto theend;
@@ -357,7 +363,7 @@ netbeans_connect(void)
{
sock_close(sd);
#ifdef INET_SOCKETS
- if ((sd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
+ if ((sd = (NBSOCK)socket(AF_INET, SOCK_STREAM, 0)) == (NBSOCK)-1)
{
PERROR("socket()#2 in netbeans_connect()");
goto theend;
@@ -630,7 +636,7 @@ nb_parse_messages(void)
* prepend the text to that buffer and delete this one. */
if (node->next == &head)
return;
- p = alloc(STRLEN(node->buffer) + STRLEN(node->next->buffer) + 1);
+ p = alloc((unsigned)(STRLEN(node->buffer) + STRLEN(node->next->buffer) + 1));
if (p == NULL)
return; /* out of memory */
STRCPY(p, node->buffer);
@@ -1010,7 +1016,7 @@ netbeans_end(void)
nbdebug(("EVT: %s", buf));
/* nb_send(buf, "netbeans_end"); avoid "write failed" messages */
if (sd >= 0)
- sock_write(sd, buf, STRLEN(buf)); /* ignore errors */
+ sock_write(sd, buf, (int)STRLEN(buf)); /* ignore errors */
}
}
@@ -1030,7 +1036,7 @@ nb_send(char *buf, char *fun)
EMSG2("E630: %s(): write while not connected", fun);
did_error = TRUE;
}
- else if (sock_write(sd, buf, STRLEN(buf)) != (int)STRLEN(buf))
+ else if (sock_write(sd, buf, (int)STRLEN(buf)) != (int)STRLEN(buf))
{
if (!did_error)
EMSG2("E631: %s(): write failed", fun);
@@ -1073,7 +1079,7 @@ nb_reply_text(int cmdno, char_u *result)
nbdebug(("REP %d: %s\n", cmdno, (char *)result));
- reply = alloc(STRLEN(result) + 32);
+ reply = alloc((unsigned)STRLEN(result) + 32);
sprintf((char *)reply, "%d %s\n", cmdno, (char *)result);
nb_send((char *)reply, "nb_reply_text");
@@ -1105,7 +1111,7 @@ nb_reply_nr(int cmdno, long result)
static char_u *
nb_quote(char_u *txt)
{
- char_u *buf = alloc(2 * STRLEN(txt) + 1);
+ char_u *buf = alloc((unsigned)(2 * STRLEN(txt) + 1));
char_u *p = txt;
char_u *q = buf;
@@ -1149,7 +1155,7 @@ nb_unquote(char_u *p, char_u **endp)
int done = 0;
/* result is never longer than input */
- result = (char *)alloc_clear(STRLEN(p) + 1);
+ result = (char *)alloc_clear((unsigned)STRLEN(p) + 1);
if (result == NULL)
return NULL;
@@ -1547,7 +1553,7 @@ nb_do_cmd(
/* Insert halfway a line. For simplicity we assume we
* need to append to the line. */
- newline = alloc_check(STRLEN(oldline) + len + 1);
+ newline = alloc_check((unsigned)(STRLEN(oldline) + len + 1));
if (newline != NULL)
{
STRCPY(newline, oldline);
@@ -1559,7 +1565,7 @@ nb_do_cmd(
{
/* Append a new line. Not that we always do this,
* also when the text doesn't end in a "\n". */
- ml_append((linenr_T)(lnum - 1), args, len + 1, FALSE);
+ ml_append((linenr_T)(lnum - 1), args, (colnr_T)(len + 1), FALSE);
++added;
}
@@ -3292,7 +3298,7 @@ get_buf_size(buf_T *bufp)
eol_size = 1;
for (lnum = 1; lnum <= bufp->b_ml.ml_line_count; ++lnum)
{
- char_count += STRLEN(ml_get(lnum)) + eol_size;
+ char_count += (long)STRLEN(ml_get(lnum)) + eol_size;
/* Check for a CTRL-C every 100000 characters */
if (char_count > last_check)
{
@@ -3393,7 +3399,7 @@ print_read_msg(buf)
nbbuf_T *buf;
{
int lnum = buf->bufp->b_ml.ml_line_count;
- long nchars = buf->bufp->b_orig_size;
+ long nchars = (long)buf->bufp->b_orig_size;
char_u c;
msg_add_fname(buf->bufp, buf->bufp->b_ffname);
diff --git a/src/normal.c b/src/normal.c
index bc6955d8a..189b21c66 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -3389,7 +3389,7 @@ find_ident_at_pos(wp, lnum, startcol, string, find_type)
else
# endif
this_class = mb_get_class(ptr + col);
- while (col > 0)
+ while (col > 0 && this_class != 0)
{
prevcol = col - 1 - (*mb_head_off)(ptr, ptr + col - 1);
prev_class = mb_get_class(ptr + prevcol);
@@ -6986,7 +6986,7 @@ n_swapchar(cap)
if (did_change)
{
ptr = ml_get(pos.lnum);
- count = STRLEN(ptr) - pos.col;
+ count = (int)STRLEN(ptr) - pos.col;
netbeans_removed(curbuf, pos.lnum, pos.col,
(long)count);
netbeans_inserted(curbuf, pos.lnum, pos.col,
diff --git a/src/ops.c b/src/ops.c
index a13cee76a..5122b87e0 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -2023,7 +2023,7 @@ op_replace(oap, c)
#ifdef FEAT_MBYTE
if (has_mbyte)
{
- n = STRLEN(newp);
+ n = (int)STRLEN(newp);
while (--num_chars >= 0)
n += (*mb_char2bytes)(c, newp + n);
}
@@ -2225,7 +2225,7 @@ op_tilde(oap)
while (pos.lnum < oap->end.lnum)
{
ptr = ml_get_buf(curbuf, pos.lnum, FALSE);
- count = STRLEN(ptr) - pos.col;
+ count = (int)STRLEN(ptr) - pos.col;
netbeans_removed(curbuf, pos.lnum, pos.col, (long)count);
netbeans_inserted(curbuf, pos.lnum, pos.col,
&ptr[pos.col], count);
@@ -2886,7 +2886,7 @@ op_yank(oap, deleting, mess)
else
{
if (endcol == MAXCOL)
- endcol = STRLEN(p);
+ endcol = (colnr_T)STRLEN(p);
bd.textlen = endcol - startcol + oap->inclusive;
}
bd.textstart = p + startcol;
@@ -4910,7 +4910,7 @@ do_addsub(command, Prenum1)
char_u buf2[NUMBUFLEN];
int hex; /* 'X' or 'x': hex; '0': octal */
static int hexupper = FALSE; /* 0xABC */
- long_u n;
+ unsigned long n;
long_u oldn;
char_u *ptr;
int c;
@@ -5317,7 +5317,7 @@ write_viminfo_registers(fp)
/* Skip register if there is more text than the maximum size. */
len = 0;
for (j = 0; j < num_lines; j++)
- len += STRLEN(y_regs[i].y_array[j]) + 1L;
+ len += (long)STRLEN(y_regs[i].y_array[j]) + 1L;
if (len > (long)max_kbyte * 1024L)
continue;
}
diff --git a/src/option.c b/src/option.c
index 70f686a51..cb456bf7e 100644
--- a/src/option.c
+++ b/src/option.c
@@ -2909,7 +2909,7 @@ set_init_1()
{
char_u *p;
int opt_idx;
- long n;
+ long_u n;
#ifdef FEAT_LANGMAP
langmap_init();
@@ -2970,7 +2970,7 @@ set_init_1()
if (p != NULL && *p != NUL)
{
/* First time count the NUL, otherwise count the ','. */
- len = STRLEN(p) + 3;
+ len = (int)STRLEN(p) + 3;
if (ga_grow(&ga, len) == OK)
{
if (ga.ga_len > 0)
@@ -4631,7 +4631,7 @@ skip:
if (errmsg != NULL)
{
vim_strncpy(IObuff, (char_u *)_(errmsg), IOSIZE - 1);
- i = STRLEN(IObuff) + 2;
+ i = (int)STRLEN(IObuff) + 2;
if (i + (arg - startarg) < IOSIZE)
{
/* append the argument with the error */
@@ -5336,7 +5336,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
char_u *s, *p;
int did_chartab = FALSE;
char_u **gvarp;
- int free_oldval = (options[opt_idx].flags & P_ALLOCED);
+ long_u free_oldval = (options[opt_idx].flags & P_ALLOCED);
/* Get the global option to compare with, otherwise we would have to check
* two values for all local options. */
@@ -6191,7 +6191,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
if (varp == &(curbuf->b_p_spf))
{
- l = STRLEN(curbuf->b_p_spf);
+ l = (int)STRLEN(curbuf->b_p_spf);
if (l > 0 && (l < 4 || STRCMP(curbuf->b_p_spf + l - 4,
".add") != 0))
errmsg = e_invarg;
@@ -8122,7 +8122,7 @@ set_option_value(name, number, string, opt_flags)
{
int opt_idx;
char_u *varp;
- int flags;
+ long_u flags;
opt_idx = findoption(name);
if (opt_idx == -1)
diff --git a/src/os_mswin.c b/src/os_mswin.c
index d196c869a..642dc43b4 100644
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -1094,7 +1094,7 @@ enc_to_ucs2(char_u *str, int *lenp)
if (lenp == NULL)
{
- len_loc = STRLEN(str) + 1;
+ len_loc = (int)STRLEN(str) + 1;
lenp = &len_loc;
}
@@ -1153,7 +1153,7 @@ ucs2_to_enc(short_u *str, int *lenp)
if (lenp == NULL)
{
- len_loc = wcslen(str) + 1;
+ len_loc = (int)wcslen(str) + 1;
lenp = &len_loc;
}
@@ -1267,7 +1267,7 @@ clip_mch_request_selection(VimClipboard *cbd)
{
n = STRLEN(p_enc) + 1;
str = rawp + n;
- str_size = metadata.rawlen - n;
+ str_size = (int)(metadata.rawlen - n);
}
else
{
@@ -1292,7 +1292,7 @@ clip_mch_request_selection(VimClipboard *cbd)
/* Use the length of our metadata if possible, but limit it to the
* GlobalSize() for safety. */
- maxlen = GlobalSize(hMemW) / sizeof(WCHAR);
+ maxlen = (int)(GlobalSize(hMemW) / sizeof(WCHAR));
if (metadata.ucslen >= 0)
{
if (metadata.ucslen > maxlen)
@@ -1321,7 +1321,7 @@ clip_mch_request_selection(VimClipboard *cbd)
/* The length is either what our metadata says or the strlen().
* But limit it to the GlobalSize() for safety. */
- maxlen = GlobalSize(hMem);
+ maxlen = (int)GlobalSize(hMem);
if (metadata.txtlen >= 0)
{
if (metadata.txtlen > maxlen)
@@ -1444,7 +1444,7 @@ clip_mch_set_selection(VimClipboard *cbd)
{
LPSTR lpszMemRaw;
- metadata.rawlen = txtlen + STRLEN(p_enc) + 1;
+ metadata.rawlen = (int)(txtlen + STRLEN(p_enc) + 1);
hMemRaw = (LPSTR)GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE,
metadata.rawlen + 1);
lpszMemRaw = (LPSTR)GlobalLock(hMemRaw);
@@ -2370,7 +2370,7 @@ mch_resolve_shortcut(char_u *fname)
* CoCreateInstance(), it's quite slow. */
if (fname == NULL)
return rfname;
- len = STRLEN(fname);
+ len = (int)STRLEN(fname);
if (len <= 4 || STRNICMP(fname + len - 4, ".lnk", 4) != 0)
return rfname;
@@ -2484,7 +2484,7 @@ serverSendEnc(HWND target)
data.dwData = COPYDATA_ENCODING;
#ifdef FEAT_MBYTE
- data.cbData = STRLEN(p_enc) + 1;
+ data.cbData = (DWORD)STRLEN(p_enc) + 1;
data.lpData = p_enc;
#else
data.cbData = STRLEN("latin1") + 1;
@@ -2600,10 +2600,10 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
else
reply.dwData = COPYDATA_RESULT;
reply.lpData = res;
- reply.cbData = STRLEN(res) + 1;
+ reply.cbData = (DWORD)STRLEN(res) + 1;
serverSendEnc(sender);
- retval = SendMessage(sender, WM_COPYDATA, (WPARAM)message_window,
+ retval = (int)SendMessage(sender, WM_COPYDATA, (WPARAM)message_window,
(LPARAM)(&reply));
vim_free(res);
return retval;
@@ -2772,7 +2772,7 @@ serverSetName(char_u *name)
char_u *p;
/* Leave enough space for a 9-digit suffix to ensure uniqueness! */
- ok_name = alloc(STRLEN(name) + 10);
+ ok_name = alloc((unsigned)STRLEN(name) + 10);
STRCPY(ok_name, name);
p = ok_name + STRLEN(name);
@@ -2849,7 +2849,7 @@ serverSendReply(name, reply)
return -1;
data.dwData = COPYDATA_REPLY;
- data.cbData = STRLEN(reply) + 1;
+ data.cbData = (DWORD)STRLEN(reply) + 1;
data.lpData = reply;
serverSendEnc(target);
@@ -2885,7 +2885,7 @@ serverSendToVim(name, cmd, result, ptarget, asExpr, silent)
*(HWND *)ptarget = target;
data.dwData = asExpr ? COPYDATA_EXPR : COPYDATA_KEYS;
- data.cbData = STRLEN(cmd) + 1;
+ data.cbData = (DWORD)STRLEN(cmd) + 1;
data.lpData = cmd;
serverSendEnc(target);
diff --git a/src/os_win32.c b/src/os_win32.c
index 397359231..630df5a4a 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -2652,7 +2652,7 @@ mch_writable(char_u *name)
mch_can_exe(char_u *name)
{
char_u buf[_MAX_PATH];
- int len = STRLEN(name);
+ int len = (int)STRLEN(name);
char_u *p;
if (len >= _MAX_PATH) /* safety check */
@@ -3914,7 +3914,7 @@ mch_write(
{
/* optimization: use one single write_chars for runs of text,
* rather than once per character It ain't curses, but it helps. */
- DWORD prefix = strcspn(s, "\n\r\b\a\033");
+ DWORD prefix = (DWORD)strcspn(s, "\n\r\b\a\033");
if (p_wd)
{
@@ -4065,7 +4065,7 @@ mch_write(
delete_lines(arg1);
}
- len -= p - s;
+ len -= (int)(p - s);
s = p + 1;
break;
@@ -4716,8 +4716,8 @@ copy_substream(HANDLE sh, void *context, WCHAR *to, WCHAR *substream, long len)
for (done = 0; done < len; done += written)
{
/* (size_t) cast for Borland C 5.5 */
- todo = (size_t)(len - done) > sizeof(buf) ? sizeof(buf)
- : (size_t)(len - done);
+ todo = (DWORD)((size_t)(len - done) > sizeof(buf) ? sizeof(buf)
+ : (size_t)(len - done));
if (!BackupRead(sh, (LPBYTE)buf, todo, &readcnt,
FALSE, FALSE, context)
|| readcnt != todo
@@ -4765,7 +4765,7 @@ copy_infostreams(char_u *from, char_u *to)
/* Get the header to find the length of the stream name. If
* the "readcount" is zero we have done all info streams. */
ZeroMemory(&sid, sizeof(WIN32_STREAM_ID));
- headersize = (char *)&sid.cStreamName - (char *)&sid.dwStreamId;
+ headersize = (int)((char *)&sid.cStreamName - (char *)&sid.dwStreamId);
if (!BackupRead(sh, (LPBYTE)&sid, headersize,
&readcount, FALSE, FALSE, &context)
|| readcount == 0)
@@ -4986,7 +4986,7 @@ get_cmd_argsW(char ***argvp)
/* Convert each Unicode argument to the current codepage. */
WideCharToMultiByte_alloc(GetACP(), 0,
- ArglistW[i], wcslen(ArglistW[i]) + 1,
+ ArglistW[i], (int)wcslen(ArglistW[i]) + 1,
(LPSTR *)&argv[i], &len, 0, 0);
if (argv[i] == NULL)
{
diff --git a/src/po/zh_TW.UTF-8.po b/src/po/zh_TW.UTF-8.po
index 199bb76d8..b4260b458 100644
--- a/src/po/zh_TW.UTF-8.po
+++ b/src/po/zh_TW.UTF-8.po
@@ -5,8 +5,15 @@
#
# FIRST AUTHOR Francis S.Lin <piaip@csie.ntu.edu.tw>, 2000
# FIRST RELEASE Thu Jun 14 14:24:17 CST 2001
+# MAINTAINER: Debian VIM Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
#
-# Last update: 2005/01/27 07:03 (6.3)
+# Last update: $LastChangedDate: 2006-04-16 22:06:40 -0400 (dom, 16 apr 2006) $
+#
+# XXX This file is in need of a new maintainer, Debian VIM Maintainers maintain
+# it only because patches have been submitted for it by Debian users and the
+# former maintainer was MIA (Missing In Action), taking over its
+# maintenance was thus the only way to include those patches.
+# If you care about this file, and have time to maintain it please do so!
#
# To update, search pattern: /fuzzy\|^msgstr ""\(\n"\)\@!
#
@@ -3288,11 +3295,11 @@ msgstr "少於一行 "
#, c-format
msgid "%ld more lines"
-msgstr "還有 %ld 行 "
+msgstr "多了 %ld 行 "
#, c-format
msgid "%ld fewer lines"
-msgstr "只剩 %ld 行 "
+msgstr "少了 %ld 行 "
msgid " (Interrupted)"
msgstr " (已中斷)"
diff --git a/src/popupmnu.c b/src/popupmnu.c
index a3324772c..fc5ffff3a 100644
--- a/src/popupmnu.c
+++ b/src/popupmnu.c
@@ -279,7 +279,7 @@ pum_redraw()
if (*p == NUL || *p == TAB || totwidth + w > pum_width)
{
/* Display the text that fits or comes before a Tab. */
- screen_puts_len(s, p - s, row, col, attr);
+ screen_puts_len(s, (int)(p - s), row, col, attr);
col += width;
if (*p != TAB)
@@ -462,7 +462,7 @@ pum_set_selected(n)
else
{
*e = NUL;
- ml_append(lnum++, p, e - p + 1, FALSE);
+ ml_append(lnum++, p, (int)(e - p + 1), FALSE);
*e = '\n';
p = e + 1;
}
diff --git a/src/proto/os_mswin.pro b/src/proto/os_mswin.pro
index aaef05b1a..f46a3f852 100644
--- a/src/proto/os_mswin.pro
+++ b/src/proto/os_mswin.pro
@@ -46,8 +46,8 @@ extern int mch_print_blank_page __ARGS((void));
extern void mch_print_start_line __ARGS((int margin, int page_line));
extern int mch_print_text_out __ARGS((char_u *p, int len));
extern void mch_print_set_font __ARGS((int iBold, int iItalic, int iUnderline));
-extern void mch_print_set_bg __ARGS((unsigned long bgcol));
-extern void mch_print_set_fg __ARGS((unsigned long fgcol));
+extern void mch_print_set_bg __ARGS((long_u bgcol));
+extern void mch_print_set_fg __ARGS((long_u fgcol));
extern char_u *mch_resolve_shortcut __ARGS((char_u *fname));
extern void win32_set_foreground __ARGS((void));
extern void serverInitMessaging __ARGS((void));
diff --git a/src/quickfix.c b/src/quickfix.c
index f22c860c7..21b524ca0 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -511,9 +511,9 @@ qf_init_ext(qi, efile, buf, tv, errorformat, newlist, lnumfirst, lnumlast)
p = vim_strchr(p_str, '\n');
if (p)
- len = p - p_str + 1;
+ len = (int)(p - p_str + 1);
else
- len = STRLEN(p_str);
+ len = (int)STRLEN(p_str);
if (len > CMDBUFFSIZE - 2)
vim_strncpy(IObuff, p_str, CMDBUFFSIZE - 2);
@@ -531,7 +531,7 @@ qf_init_ext(qi, efile, buf, tv, errorformat, newlist, lnumfirst, lnumlast)
if (!p_li) /* End of the list */
break;
- len = STRLEN(p_li->li_tv.vval.v_string);
+ len = (int)STRLEN(p_li->li_tv.vval.v_string);
if (len > CMDBUFFSIZE - 2)
len = CMDBUFFSIZE - 2;
@@ -3684,7 +3684,7 @@ ex_helpgrep(eap)
{
if (vim_regexec(&regmatch, IObuff, (colnr_T)0))
{
- int l = STRLEN(IObuff);
+ int l = (int)STRLEN(IObuff);
/* remove trailing CR, LF, spaces, etc. */
while (l > 0 && IObuff[l - 1] <= ' ')
diff --git a/src/screen.c b/src/screen.c
index 8d2a69ef7..c293de115 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -2896,7 +2896,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
{
/* For checking first word with a capital skip white space. */
if (cap_col == 0)
- cap_col = skipwhite(line) - line;
+ cap_col = (int)(skipwhite(line) - line);
/* To be able to spell-check over line boundaries copy the end of the
* current line into nextline[]. Above the start of the next line was
@@ -2909,7 +2909,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
}
else
{
- v = STRLEN(line);
+ v = (long)STRLEN(line);
if (v < SPWORDLEN)
{
/* Short line, use it completely and append the start of the
@@ -3008,14 +3008,14 @@ win_line(wp, lnum, startrow, endrow, nochange)
pos = wp->w_cursor;
wp->w_cursor.lnum = lnum;
- wp->w_cursor.col = ptr - line;
+ wp->w_cursor.col = (colnr_T)(ptr - line);
len = spell_move_to(wp, FORWARD, TRUE, TRUE, &spell_hlf);
if (len == 0 || (int)wp->w_cursor.col > ptr - line)
{
/* no bad word found at line start, don't check until end of a
* word */
spell_hlf = HLF_COUNT;
- word_end = spell_to_word_end(ptr, wp->w_buffer) - line + 1;
+ word_end = (int)(spell_to_word_end(ptr, wp->w_buffer) - line + 1);
}
else
{
@@ -3223,7 +3223,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
if (p_extra != NULL)
{
c_extra = NUL;
- n_extra = STRLEN(p_extra);
+ n_extra = (int)STRLEN(p_extra);
}
char_attr = sign_get_attr(text_sign, FALSE);
}
@@ -3867,7 +3867,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
p = nextline + (prev_ptr - line) - nextlinecol;
else
p = prev_ptr;
- cap_col -= (prev_ptr - line);
+ cap_col -= (int)(prev_ptr - line);
len = spell_check(wp, p, &spell_hlf, &cap_col,
nochange);
word_end = v + len;
@@ -3891,7 +3891,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
/* Remember that the good word continues at the
* start of the next line. */
checked_lnum = lnum + 1;
- checked_col = (p - nextline) + len - nextline_idx;
+ checked_col = (int)((p - nextline) + len - nextline_idx);
}
/* Turn index into actual attributes. */
@@ -3906,12 +3906,12 @@ win_line(wp, lnum, startrow, endrow, nochange)
/* Remember that the word in the next line
* must start with a capital. */
capcol_lnum = lnum + 1;
- cap_col = (p - nextline) + cap_col
- - nextline_idx;
+ cap_col = (int)((p - nextline) + cap_col
+ - nextline_idx);
}
else
/* Compute the actual column. */
- cap_col += (prev_ptr - line);
+ cap_col += (int)(prev_ptr - line);
}
}
}
@@ -5871,7 +5871,7 @@ win_redr_custom(wp, draw_ruler)
buf, sizeof(buf),
p, use_sandbox,
fillchar, maxwidth, hltab, tabtab);
- len = STRLEN(buf);
+ len = (int)STRLEN(buf);
while (width < maxwidth && len < sizeof(buf) - 1)
{
@@ -8904,7 +8904,7 @@ draw_tabline()
if (wincount > 1)
{
vim_snprintf((char *)NameBuff, MAXPATHL, "%d", wincount);
- len = STRLEN(NameBuff);
+ len = (int)STRLEN(NameBuff);
if (col + len >= Columns - 3)
break;
screen_puts_len(NameBuff, len, 0, col,
@@ -8946,7 +8946,7 @@ draw_tabline()
if (len > Columns - col - 1)
len = Columns - col - 1;
- screen_puts_len(p, STRLEN(p), 0, col, attr);
+ screen_puts_len(p, (int)STRLEN(p), 0, col, attr);
col += len;
}
screen_putchar(' ', 0, col++, attr);
diff --git a/src/search.c b/src/search.c
index addb9cdb0..0e535ab22 100644
--- a/src/search.c
+++ b/src/search.c
@@ -909,7 +909,7 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum)
if (pos->lnum > buf->b_ml.ml_line_count)
{
pos->lnum = buf->b_ml.ml_line_count;
- pos->col = STRLEN(ml_get_buf(buf, pos->lnum, FALSE));
+ pos->col = (int)STRLEN(ml_get_buf(buf, pos->lnum, FALSE));
if (pos->col > 0)
--pos->col;
}
@@ -1075,7 +1075,7 @@ do_search(oap, dirc, pat, count, options)
if (strcopy != ps)
{
/* made a copy of "pat" to change "\?" to "?" */
- searchcmdlen += STRLEN(pat) - STRLEN(strcopy);
+ searchcmdlen += (int)(STRLEN(pat) - STRLEN(strcopy));
pat = strcopy;
searchstr = strcopy;
}
@@ -3660,7 +3660,7 @@ in_html_tag(end_tag)
}
pos.lnum = curwin->w_cursor.lnum;
- pos.col = p - line;
+ pos.col = (colnr_T)(p - line);
mb_ptr_adv(p);
if (end_tag)
@@ -3780,7 +3780,7 @@ again:
p = ml_get_cursor();
for (cp = p; *cp != NUL && *cp != '>' && !vim_iswhite(*cp); mb_ptr_adv(cp))
;
- len = cp - p;
+ len = (int)(cp - p);
if (len == 0)
{
curwin->w_cursor = old_pos;
@@ -4527,7 +4527,7 @@ find_pattern_in_path(ptr, dir, len, whole, skip_comments,
if (inc_opt != NULL && strstr((char *)inc_opt, "\\zs") != NULL)
/* Use text from '\zs' to '\ze' (or end) of 'include'. */
new_fname = find_file_name_in_path(incl_regmatch.startp[0],
- incl_regmatch.endp[0] - incl_regmatch.startp[0],
+ (int)(incl_regmatch.endp[0] - incl_regmatch.startp[0]),
FNAME_EXP|FNAME_INCL|FNAME_REL, 1L, p_fname);
else
/* Use text after match with 'include'. */
@@ -4613,7 +4613,7 @@ find_pattern_in_path(ptr, dir, len, whole, skip_comments,
{
/* Nothing found, use the rest of the line. */
p = incl_regmatch.endp[0];
- i = STRLEN(p);
+ i = (int)STRLEN(p);
}
else
{
@@ -5270,7 +5270,7 @@ wvsp_one(fp, idx, s, sc)
{
if (spats[idx].pat != NULL)
{
- fprintf(fp, "\n# Last %sSearch Pattern:\n~", s);
+ fprintf(fp, _("\n# Last %sSearch Pattern:\n~"), s);
/* off.dir is not stored, it's reset to forward */
fprintf(fp, "%c%c%c%c%ld%s%c",
spats[idx].magic ? 'M' : 'm', /* magic */
diff --git a/src/spell.c b/src/spell.c
index 803f32d53..3ae44d4d0 100644
--- a/src/spell.c
+++ b/src/spell.c
@@ -587,7 +587,7 @@ typedef struct wordcount_S
} wordcount_T;
static wordcount_T dumwc;
-#define WC_KEY_OFF (dumwc.wc_word - (char_u *)&dumwc)
+#define WC_KEY_OFF (unsigned)(dumwc.wc_word - (char_u *)&dumwc)
#define HI2WC(hi) ((wordcount_T *)((hi)->hi_key - WC_KEY_OFF))
#define MAXWORDCOUNT 0xffff
@@ -1048,7 +1048,7 @@ spell_check(wp, ptr, attrp, capcol, docount)
mi.mi_end = skiphex(ptr + 2);
else
mi.mi_end = skipdigits(ptr);
- nrlen = mi.mi_end - ptr;
+ nrlen = (int)(mi.mi_end - ptr);
}
/* Find the normal end of the word (until the next non-word character). */
@@ -1086,7 +1086,7 @@ spell_check(wp, ptr, attrp, capcol, docount)
(void)spell_casefold(ptr, (int)(mi.mi_fend - ptr), mi.mi_fword,
MAXWLEN + 1);
- mi.mi_fwordlen = STRLEN(mi.mi_fword);
+ mi.mi_fwordlen = (int)STRLEN(mi.mi_fword);
/* The word is bad unless we recognize it. */
mi.mi_result = SP_BAD;
@@ -1187,7 +1187,7 @@ spell_check(wp, ptr, attrp, capcol, docount)
mb_ptr_adv(fp);
if (p >= mi.mi_end)
break;
- mi.mi_compoff = fp - mi.mi_fword;
+ mi.mi_compoff = (int)(fp - mi.mi_fword);
find_word(&mi, FIND_COMPOUND);
if (mi.mi_result != SP_BAD)
{
@@ -1416,7 +1416,7 @@ find_word(mip, mode)
{
for (s = ptr; s < ptr + wlen; mb_ptr_adv(s))
mb_ptr_adv(p);
- wlen = p - mip->mi_word;
+ wlen = (int)(p - mip->mi_word);
}
}
#endif
@@ -1617,7 +1617,7 @@ find_word(mip, mode)
{
for (s = ptr; s < ptr + wlen; mb_ptr_adv(s))
mb_ptr_adv(p);
- mip->mi_compoff = p - mip->mi_fword;
+ mip->mi_compoff = (int)(p - mip->mi_fword);
}
}
#endif
@@ -1980,7 +1980,7 @@ fold_more(mip)
(void)spell_casefold(p, (int)(mip->mi_fend - p),
mip->mi_fword + mip->mi_fwordlen,
MAXWLEN - mip->mi_fwordlen);
- flen = STRLEN(mip->mi_fword + mip->mi_fwordlen);
+ flen = (int)STRLEN(mip->mi_fword + mip->mi_fwordlen);
mip->mi_fwordlen += flen;
return flen;
}
@@ -2074,7 +2074,7 @@ spell_move_to(wp, dir, allwords, curline, attrp)
{
line = ml_get_buf(wp->w_buffer, lnum, FALSE);
- len = STRLEN(line);
+ len = (int)STRLEN(line);
if (buflen < len + MAXWLEN + 2)
{
vim_free(buf);
@@ -2090,7 +2090,19 @@ spell_move_to(wp, dir, allwords, curline, attrp)
/* For checking first word with a capital skip white space. */
if (capcol == 0)
- capcol = skipwhite(line) - line;
+ capcol = (int)(skipwhite(line) - line);
+ else if (curline && wp == curwin)
+ {
+ int col = (int)(skipwhite(line) - line);
+
+ /* For spellbadword(): check if first word needs a capital. */
+ if (check_need_cap(lnum, col))
+ capcol = col;
+
+ /* Need to get the line again, may have looked at the previous
+ * one. */
+ line = ml_get_buf(wp->w_buffer, lnum, FALSE);
+ }
/* Copy the line into "buf" and append the start of the next line if
* possible. */
@@ -2134,7 +2146,7 @@ spell_move_to(wp, dir, allwords, curline, attrp)
# ifdef FEAT_SYN_HL
if (has_syntax)
{
- col = p - buf;
+ col = (int)(p - buf);
(void)syn_get_id(wp, lnum, (colnr_T)col,
FALSE, &can_spell);
}
@@ -2145,7 +2157,7 @@ spell_move_to(wp, dir, allwords, curline, attrp)
if (can_spell)
{
found_pos.lnum = lnum;
- found_pos.col = p - buf;
+ found_pos.col = (int)(p - buf);
#ifdef FEAT_VIRTUALEDIT
found_pos.coladd = 0;
#endif
@@ -2231,11 +2243,11 @@ spell_move_to(wp, dir, allwords, curline, attrp)
/* Skip the characters at the start of the next line that were
* included in a match crossing line boundaries. */
if (attr == HLF_COUNT)
- skip = p - endp;
+ skip = (int)(p - endp);
else
skip = 0;
- /* Capscol skips over the inserted space. */
+ /* Capcol skips over the inserted space. */
--capcol;
/* But after empty line check first word in next line */
@@ -2271,7 +2283,7 @@ spell_cat_line(buf, line, maxlen)
{
*buf = ' ';
vim_strncpy(buf + 1, line, maxlen - 2);
- n = p - line;
+ n = (int)(p - line);
if (n >= maxlen)
n = maxlen - 1;
vim_memset(buf + 1, ' ', n);
@@ -3161,7 +3173,7 @@ read_sal_section(fd, slang)
break;
*p++ = c;
}
- smp->sm_leadlen = p - smp->sm_lead;
+ smp->sm_leadlen = (int)(p - smp->sm_lead);
*p++ = NUL;
/* Put (abc) chars in sm_oneof, if any. */
@@ -3321,7 +3333,7 @@ count_common_word(lp, word, len, count)
hi = hash_lookup(&lp->sl_wordcount, p, hash);
if (HASHITEM_EMPTY(hi))
{
- wc = (wordcount_T *)alloc(sizeof(wordcount_T) + STRLEN(p));
+ wc = (wordcount_T *)alloc((unsigned)(sizeof(wordcount_T) + STRLEN(p)));
if (wc == NULL)
return;
STRCPY(wc->wc_word, p);
@@ -3632,9 +3644,9 @@ init_syl_tab(slang)
s = p;
p = vim_strchr(p, '/');
if (p == NULL)
- l = STRLEN(s);
+ l = (int)STRLEN(s);
else
- l = p - s;
+ l = (int)(p - s);
if (l >= SY_MAXLEN)
return SP_FORMERROR;
if (ga_grow(&slang->sl_syl_items, 1) == FAIL)
@@ -4101,7 +4113,7 @@ did_set_spelllang(buf)
copy_option_part(&splp, lang, MAXWLEN, ",");
region = NULL;
- len = STRLEN(lang);
+ len = (int)STRLEN(lang);
/* If the name ends in ".spl" use it as the name of the spell file.
* If there is a region name let "region" point to it and remove it
@@ -4390,7 +4402,7 @@ use_midword(lp, buf)
else
{
/* Append multi-byte chars to "b_spell_ismw_mb". */
- n = STRLEN(buf->b_spell_ismw_mb);
+ n = (int)STRLEN(buf->b_spell_ismw_mb);
bp = vim_strnsave(buf->b_spell_ismw_mb, n + l);
if (bp != NULL)
{
@@ -5312,9 +5324,9 @@ spell_read_aff(spin, fname)
{
/* Concatenate this string to previously defined ones, using a
* slash to separate them. */
- l = STRLEN(items[1]) + 1;
+ l = (int)STRLEN(items[1]) + 1;
if (compflags != NULL)
- l += STRLEN(compflags) + 1;
+ l += (int)STRLEN(compflags) + 1;
p = getroom(spin, l, FALSE);
if (p != NULL)
{
@@ -6100,9 +6112,9 @@ process_compflags(spin, aff, compflags)
/* Make room for the old and the new compflags, concatenated with a / in
* between. Processing it makes it shorter, but we don't know by how
* much, thus allocate the maximum. */
- len = STRLEN(compflags) + 1;
+ len = (int)STRLEN(compflags) + 1;
if (spin->si_compflags != NULL)
- len += STRLEN(spin->si_compflags) + 1;
+ len += (int)STRLEN(spin->si_compflags) + 1;
p = getroom(spin, len, FALSE);
if (p == NULL)
return;
@@ -6285,9 +6297,9 @@ add_fromto(spin, gap, from, to)
if (ga_grow(gap, 1) == OK)
{
ftp = ((fromto_T *)gap->ga_data) + gap->ga_len;
- (void)spell_casefold(from, STRLEN(from), word, MAXWLEN);
+ (void)spell_casefold(from, (int)STRLEN(from), word, MAXWLEN);
ftp->ft_from = getroom_save(spin, word);
- (void)spell_casefold(to, STRLEN(to), word, MAXWLEN);
+ (void)spell_casefold(to, (int)STRLEN(to), word, MAXWLEN);
ftp->ft_to = getroom_save(spin, word);
++gap->ga_len;
}
@@ -6338,7 +6350,7 @@ spell_free_aff(aff)
/* All this trouble to free the "ae_prog" items... */
for (ht = &aff->af_pref; ; ht = &aff->af_suff)
{
- todo = ht->ht_used;
+ todo = (int)ht->ht_used;
for (hi = ht->ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -6428,7 +6440,7 @@ spell_read_dic(spin, fname, affile)
/* Remove CR, LF and white space from the end. White space halfway
* the word is kept to allow e.g., "et al.". */
- l = STRLEN(line);
+ l = (int)STRLEN(line);
while (l > 0 && line[l - 1] <= ' ')
--l;
if (l == 0)
@@ -6727,7 +6739,7 @@ store_aff_word(spin, word, afflist, affile, ht, xht, condit, flags,
size_t wordlen = STRLEN(word);
int use_condit;
- todo = ht->ht_used;
+ todo = (int)ht->ht_used;
for (hi = ht->ht_array; todo > 0 && retval == OK; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -6802,7 +6814,7 @@ store_aff_word(spin, word, afflist, affile, ht, xht, condit, flags,
{
/* Remove chop string. */
p = newword + STRLEN(newword);
- i = MB_CHARLEN(ae->ae_chop);
+ i = (int)MB_CHARLEN(ae->ae_chop);
for ( ; i > 0; --i)
mb_ptr_back(newword, p);
*p = NUL;
@@ -7006,7 +7018,7 @@ spell_read_wordfile(spin, fname)
continue;
/* Remove CR, LF and white space from the end. */
- l = STRLEN(rline);
+ l = (int)STRLEN(rline);
while (l > 0 && rline[l - 1] <= ' ')
--l;
if (l == 0)
@@ -7080,7 +7092,7 @@ spell_read_wordfile(spin, fname)
fname, lnum, line);
else
{
- spin->si_region_count = STRLEN(line) / 2;
+ spin->si_region_count = (int)STRLEN(line) / 2;
STRCPY(spin->si_region_name, line);
/* Adjust the mask for a word valid in all regions. */
@@ -7200,7 +7212,7 @@ getroom(spin, len, align)
}
p = bl->sb_data + bl->sb_used;
- bl->sb_used += len;
+ bl->sb_used += (int)len;
return p;
}
@@ -7267,7 +7279,7 @@ store_word(spin, word, flags, region, pfxlist, need_affix)
char_u *pfxlist; /* list of prefix IDs or NULL */
int need_affix; /* only store word with affix ID */
{
- int len = STRLEN(word);
+ int len = (int)STRLEN(word);
int ct = captype(word, word + len);
char_u foldword[MAXWLEN];
int res = OK;
@@ -7715,7 +7727,7 @@ node_compress(spin, node, ht, tot)
n = np->wn_flags + (np->wn_region << 8) + (np->wn_affixID << 16);
else
/* byte node: use the byte value and the child pointer */
- n = np->wn_byte + ((long_u)np->wn_child << 8);
+ n = (unsigned)(np->wn_byte + ((long_u)np->wn_child << 8));
nr = nr * 101 + n;
}
@@ -7884,7 +7896,7 @@ write_vim_spell(spin, fname)
putc(SN_INFO, fd); /* <sectionID> */
putc(0, fd); /* <sectionflags> */
- i = STRLEN(spin->si_info);
+ i = (int)STRLEN(spin->si_info);
put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */
}
@@ -7956,7 +7968,7 @@ write_vim_spell(spin, fname)
putc(SN_MIDWORD, fd); /* <sectionID> */
putc(SNF_REQUIRED, fd); /* <sectionflags> */
- i = STRLEN(spin->si_midword);
+ i = (int)STRLEN(spin->si_midword);
put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
fwrite(spin->si_midword, (size_t)i, (size_t)1, fd); /* <midword> */
}
@@ -8014,8 +8026,8 @@ write_vim_spell(spin, fname)
for (i = 0; i < gap->ga_len; ++i)
{
ftp = &((fromto_T *)gap->ga_data)[i];
- l += 1 + STRLEN(ftp->ft_from); /* count <*fromlen> and <*from> */
- l += 1 + STRLEN(ftp->ft_to); /* count <*tolen> and <*to> */
+ l += 1 + (int)STRLEN(ftp->ft_from); /* count <*fromlen> and <*from> */
+ l += 1 + (int)STRLEN(ftp->ft_to); /* count <*tolen> and <*to> */
}
if (round == 2)
++l; /* count <salflags> */
@@ -8042,7 +8054,7 @@ write_vim_spell(spin, fname)
for (rr = 1; rr <= 2; ++rr)
{
p = rr == 1 ? ftp->ft_from : ftp->ft_to;
- l = STRLEN(p);
+ l = (int)STRLEN(p);
putc(l, fd);
fwrite(p, l, (size_t)1, fd);
}
@@ -8057,14 +8069,14 @@ write_vim_spell(spin, fname)
putc(SN_SOFO, fd); /* <sectionID> */
putc(0, fd); /* <sectionflags> */
- l = STRLEN(spin->si_sofofr);
+ l = (int)STRLEN(spin->si_sofofr);
put_bytes(fd, (long_u)(l + STRLEN(spin->si_sofoto) + 4), 4);
/* <sectionlen> */
put_bytes(fd, (long_u)l, 2); /* <sofofromlen> */
fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */
- l = STRLEN(spin->si_sofoto);
+ l = (int)STRLEN(spin->si_sofoto);
put_bytes(fd, (long_u)l, 2); /* <sofotolen> */
fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */
}
@@ -8084,11 +8096,11 @@ write_vim_spell(spin, fname)
int len = 0;
hashitem_T *hi;
- todo = spin->si_commonwords.ht_used;
+ todo = (int)spin->si_commonwords.ht_used;
for (hi = spin->si_commonwords.ht_array; todo > 0; ++hi)
if (!HASHITEM_EMPTY(hi))
{
- l = STRLEN(hi->hi_key) + 1;
+ l = (int)STRLEN(hi->hi_key) + 1;
len += l;
if (round == 2) /* <word> */
fwrite(hi->hi_key, (size_t)l, (size_t)1, fd);
@@ -8147,9 +8159,9 @@ write_vim_spell(spin, fname)
putc(SN_COMPOUND, fd); /* <sectionID> */
putc(0, fd); /* <sectionflags> */
- l = STRLEN(spin->si_compflags);
+ l = (int)STRLEN(spin->si_compflags);
for (i = 0; i < spin->si_comppat.ga_len; ++i)
- l += STRLEN(((char_u **)(spin->si_comppat.ga_data))[i]) + 1;
+ l += (int)STRLEN(((char_u **)(spin->si_comppat.ga_data))[i]) + 1;
put_bytes(fd, (long_u)(l + 7), 4); /* <sectionlen> */
putc(spin->si_compmax, fd); /* <compmax> */
@@ -8162,7 +8174,7 @@ write_vim_spell(spin, fname)
for (i = 0; i < spin->si_comppat.ga_len; ++i)
{
p = ((char_u **)(spin->si_comppat.ga_data))[i];
- putc(STRLEN(p), fd); /* <comppatlen> */
+ putc((int)STRLEN(p), fd); /* <comppatlen> */
fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);/* <comppattext> */
}
/* <compflags> */
@@ -8188,7 +8200,7 @@ write_vim_spell(spin, fname)
putc(SN_SYLLABLE, fd); /* <sectionID> */
putc(0, fd); /* <sectionflags> */
- l = STRLEN(spin->si_syllable);
+ l = (int)STRLEN(spin->si_syllable);
put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd); /* <syllable> */
}
@@ -8499,7 +8511,7 @@ spell_make_sugfile(spin, wfname)
* Make the file name by changing ".spl" to ".sug".
*/
STRCPY(fname, wfname);
- len = STRLEN(fname);
+ len = (int)STRLEN(fname);
fname[len - 2] = 'u';
fname[len - 1] = 'g';
sug_write(spin, fname);
@@ -8874,7 +8886,7 @@ sug_write(spin, fname)
{
/* <sugline>: <sugnr> ... NUL */
line = ml_get_buf(spin->si_spellbuf, lnum, FALSE);
- len = STRLEN(line) + 1;
+ len = (int)STRLEN(line) + 1;
if (fwrite(line, (size_t)len, (size_t)1, fd) == 0)
{
EMSG(_(e_write));
@@ -8981,7 +8993,7 @@ mkspell(fcount, fnames, ascii, overwrite, added_word)
if (fcount >= 1)
{
- len = STRLEN(fnames[0]);
+ len = (int)STRLEN(fnames[0]);
if (fcount == 1 && len > 4 && STRCMP(fnames[0] + len - 4, ".add") == 0)
{
/* For ":mkspell path/en.latin1.add" output file is
@@ -9048,7 +9060,7 @@ mkspell(fcount, fnames, ascii, overwrite, added_word)
if (incount > 1)
{
- len = STRLEN(innames[i]);
+ len = (int)STRLEN(innames[i]);
if (STRLEN(gettail(innames[i])) < 5
|| innames[i][len - 3] != '_')
{
@@ -9215,7 +9227,7 @@ spell_message(spin, str)
ex_spell(eap)
exarg_T *eap;
{
- spell_add_word(eap->arg, STRLEN(eap->arg), eap->cmdidx == CMD_spellwrong,
+ spell_add_word(eap->arg, (int)STRLEN(eap->arg), eap->cmdidx == CMD_spellwrong,
eap->forceit ? 0 : (int)eap->line2,
eap->cmdidx == CMD_spellundo);
}
@@ -9419,16 +9431,16 @@ init_spellfile()
else
{
/* Create the "spell" directory if it doesn't exist yet. */
- l = STRLEN(buf);
+ l = (int)STRLEN(buf);
vim_snprintf((char *)buf + l, MAXPATHL - l, "/spell");
if (!filewritable(buf) != 2)
vim_mkdir(buf, 0755);
- l = STRLEN(buf);
+ l = (int)STRLEN(buf);
vim_snprintf((char *)buf + l, MAXPATHL - l,
"/%.*s", (int)(lend - lstart), lstart);
}
- l = STRLEN(buf);
+ l = (int)STRLEN(buf);
fname = LANGP_ENTRY(curbuf->b_langp, 0)->lp_slang->sl_fname;
vim_snprintf((char *)buf + l, MAXPATHL - l, ".%s.add",
fname != NULL
@@ -9812,7 +9824,7 @@ write_spell_prefcond(fd, gap)
p = ((char_u **)gap->ga_data)[i];
if (p != NULL)
{
- len = STRLEN(p);
+ len = (int)STRLEN(p);
if (fd != NULL)
{
fputc(len, fd);
@@ -10009,7 +10021,7 @@ spell_suggest(count)
beep_flush();
return;
}
- curwin->w_cursor.col = p - line;
+ curwin->w_cursor.col = (colnr_T)(p - line);
}
/* Get the word and its length. */
@@ -10152,10 +10164,10 @@ spell_suggest(count)
}
/* Replace the word. */
- p = alloc(STRLEN(line) - stp->st_orglen + stp->st_wordlen + 1);
+ p = alloc((unsigned)STRLEN(line) - stp->st_orglen + stp->st_wordlen + 1);
if (p != NULL)
{
- c = sug.su_badptr - line;
+ c = (int)(sug.su_badptr - line);
mch_memmove(p, line, c);
STRCPY(p + c, stp->st_word);
STRCAT(p, sug.su_badptr + stp->st_orglen);
@@ -10216,7 +10228,7 @@ check_need_cap(lnum, col)
/* Append a space in place of the line break. */
line_copy = concat_str(line, (char_u *)" ");
line = line_copy;
- endcol = STRLEN(line);
+ endcol = (colnr_T)STRLEN(line);
}
}
}
@@ -10270,9 +10282,9 @@ ex_spellrepall(eap)
EMSG(_("E752: No previous spell replacement"));
return;
}
- addlen = STRLEN(repl_to) - STRLEN(repl_from);
+ addlen = (int)(STRLEN(repl_to) - STRLEN(repl_from));
- frompat = alloc(STRLEN(repl_from) + 7);
+ frompat = alloc((unsigned)STRLEN(repl_from) + 7);
if (frompat == NULL)
return;
sprintf((char *)frompat, "\\V\\<%s\\>", repl_from);
@@ -10293,7 +10305,7 @@ ex_spellrepall(eap)
if (addlen <= 0 || STRNCMP(line + curwin->w_cursor.col,
repl_to, STRLEN(repl_to)) != 0)
{
- p = alloc(STRLEN(line) + addlen + 1);
+ p = alloc((unsigned)STRLEN(line) + addlen + 1);
if (p == NULL)
break;
mch_memmove(p, line, curwin->w_cursor.col);
@@ -10309,7 +10321,7 @@ ex_spellrepall(eap)
}
++sub_nsubs;
}
- curwin->w_cursor.col += STRLEN(repl_to);
+ curwin->w_cursor.col += (colnr_T)STRLEN(repl_to);
}
p_ws = save_ws;
@@ -10352,7 +10364,7 @@ spell_suggest_list(gap, word, maxcount, need_cap, interactive)
/* The suggested word may replace only part of "word", add the not
* replaced part. */
wcopy = alloc(stp->st_wordlen
- + STRLEN(sug.su_badptr + stp->st_orglen) + 1);
+ + (unsigned)STRLEN(sug.su_badptr + stp->st_orglen) + 1);
if (wcopy == NULL)
break;
STRCPY(wcopy, stp->st_word);
@@ -11060,9 +11072,9 @@ suggest_try_change(su)
* to find matches (esp. REP items). Append some more text, changing
* chars after the bad word may help. */
STRCPY(fword, su->su_fbadword);
- n = STRLEN(fword);
+ n = (int)STRLEN(fword);
p = su->su_badptr + su->su_badlen;
- (void)spell_casefold(p, STRLEN(p), fword + n, MAXWLEN - n);
+ (void)spell_casefold(p, (int)STRLEN(p), fword + n, MAXWLEN - n);
for (lpi = 0; lpi < curbuf->b_langp.ga_len; ++lpi)
{
@@ -11266,7 +11278,7 @@ suggest_trie_walk(su, lp, fword, soundfold)
tword[sp->ts_twordlen] = NUL;
make_case_word(tword + sp->ts_splitoff,
preword + sp->ts_prewordlen, flags);
- sp->ts_prewordlen = STRLEN(preword);
+ sp->ts_prewordlen = (char_u)STRLEN(preword);
sp->ts_splitoff = sp->ts_twordlen;
}
break;
@@ -11674,7 +11686,7 @@ suggest_trie_walk(su, lp, fword, soundfold)
/* Append a space to preword when splitting. */
if (!try_compound && !fword_ends)
STRCAT(preword, " ");
- sp->ts_prewordlen = STRLEN(preword);
+ sp->ts_prewordlen = (char_u)STRLEN(preword);
sp->ts_splitoff = sp->ts_twordlen;
sp->ts_splitfidx = sp->ts_fidx;
@@ -12482,8 +12494,8 @@ suggest_trie_walk(su, lp, fword, soundfold)
/* Change the "from" to the "to" string. */
++depth;
- fl = STRLEN(ftp->ft_from);
- tl = STRLEN(ftp->ft_to);
+ fl = (int)STRLEN(ftp->ft_from);
+ tl = (int)STRLEN(ftp->ft_to);
if (fl != tl)
{
mch_memmove(p + tl, p + fl, STRLEN(p + fl) + 1);
@@ -12511,8 +12523,8 @@ suggest_trie_walk(su, lp, fword, soundfold)
else
gap = &lp->lp_replang->sl_rep;
ftp = (fromto_T *)gap->ga_data + sp->ts_curi - 1;
- fl = STRLEN(ftp->ft_from);
- tl = STRLEN(ftp->ft_to);
+ fl = (int)STRLEN(ftp->ft_from);
+ tl = (int)STRLEN(ftp->ft_to);
p = fword + sp->ts_fidx;
if (fl != tl)
{
@@ -13054,7 +13066,7 @@ suggest_try_soundalike_finish()
if (slang->sl_sal.ga_len > 0 && slang->sl_sbyts != NULL)
{
/* Free the info about handled words. */
- todo = slang->sl_sounddone.ht_used;
+ todo = (int)slang->sl_sounddone.ht_used;
for (hi = slang->sl_sounddone.ht_array; todo > 0; ++hi)
if (!HASHITEM_EMPTY(hi))
{
@@ -13106,7 +13118,7 @@ add_sound_suggest(su, goodword, score, lp)
hi = hash_lookup(&slang->sl_sounddone, goodword, hash);
if (HASHITEM_EMPTY(hi))
{
- sft = (sftword_T *)alloc(sizeof(sftword_T) + STRLEN(goodword));
+ sft = (sftword_T *)alloc((unsigned)(sizeof(sftword_T) + STRLEN(goodword)));
if (sft != NULL)
{
sft->sft_score = score;
@@ -13533,8 +13545,8 @@ add_suggestion(su, gap, goodword, badlenarg, score, altscore, had_bonus,
pbad = su->su_badptr + badlenarg;
for (;;)
{
- goodlen = pgood - goodword;
- badlen = pbad - su->su_badptr;
+ goodlen = (int)(pgood - goodword);
+ badlen = (int)(pbad - su->su_badptr);
if (goodlen <= 0 || badlen <= 0)
break;
mb_ptr_back(goodword, pgood);
@@ -13867,7 +13879,7 @@ spell_soundfold(slang, inword, folded, res)
word = inword;
else
{
- (void)spell_casefold(inword, STRLEN(inword), fword, MAXWLEN);
+ (void)spell_casefold(inword, (int)STRLEN(inword), fword, MAXWLEN);
word = fword;
}
@@ -14590,8 +14602,8 @@ soundalike_score(goodstart, badstart)
}
}
- goodlen = STRLEN(goodsound);
- badlen = STRLEN(badsound);
+ goodlen = (int)STRLEN(goodsound);
+ badlen = (int)STRLEN(badsound);
/* Return quickly if the lenghts are too different to be fixed by two
* changes. */
@@ -14813,8 +14825,8 @@ spell_edit_score(slang, badword, goodword)
else
#endif
{
- badlen = STRLEN(badword) + 1;
- goodlen = STRLEN(goodword) + 1;
+ badlen = (int)STRLEN(badword) + 1;
+ goodlen = (int)STRLEN(goodword) + 1;
}
/* We use "cnt" as an array: CNT(badword_idx, goodword_idx). */
@@ -15450,7 +15462,7 @@ spell_dump_compl(buf, pat, ic, dir, dumpflags_arg)
/* When matching with a pattern and there are no prefixes only use
* parts of the tree that match "pat". */
if (pat != NULL && slang->sl_pbyts == NULL)
- patlen = STRLEN(pat);
+ patlen = (int)STRLEN(pat);
else
patlen = 0;
@@ -15804,7 +15816,7 @@ spell_word_start(startcol)
/* Go back to start of the word. */
while (p > line)
{
- col = p - line;
+ col = (int)(p - line);
mb_ptr_back(line, p);
if (!spell_iswordp(p, curbuf))
break;
diff --git a/src/syntax.c b/src/syntax.c
index d6ce69cc5..baded608b 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -2986,7 +2986,7 @@ syn_add_end_off(result, regmatch, spp, idx, extra)
if (result->lnum > syn_buf->b_ml.ml_line_count)
len = 0;
else
- len = STRLEN(ml_get_buf(syn_buf, result->lnum, FALSE));
+ len = (int)STRLEN(ml_get_buf(syn_buf, result->lnum, FALSE));
if (col > len)
result->col = len;
else
@@ -3950,7 +3950,7 @@ syn_list_keywords(id, ht, did_header, attr)
* Unfortunately, this list of keywords is not sorted on alphabet but on
* hash value...
*/
- todo = ht->ht_used;
+ todo = (int)ht->ht_used;
for (hi = ht->ht_array; todo > 0 && !got_int; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -4038,7 +4038,7 @@ syn_clear_keyword(id, ht)
int todo;
hash_lock(ht);
- todo = ht->ht_used;
+ todo = (int)ht->ht_used;
for (hi = ht->ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -4087,7 +4087,7 @@ clear_keywtab(ht)
keyentry_T *kp;
keyentry_T *kp_next;
- todo = ht->ht_used;
+ todo = (int)ht->ht_used;
for (hi = ht->ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))
diff --git a/src/tag.c b/src/tag.c
index a9ac537c5..3f0a35b96 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -796,7 +796,7 @@ do_tag(tag, type, count, forceit, verbose)
parse_match(matches[i], &tagp);
/* Save the tag name */
- len = tagp.tagname_end - tagp.tagname;
+ len = (int)(tagp.tagname_end - tagp.tagname);
if (len > 128)
len = 128;
vim_strncpy(tag_name, tagp.tagname, len);
@@ -872,7 +872,7 @@ do_tag(tag, type, count, forceit, verbose)
STRCAT(cmd, "\\V");
len += 2;
- cmd_len = cmd_end - cmd_start + 1;
+ cmd_len = (int)(cmd_end - cmd_start + 1);
if (cmd_len > (CMDBUFFSIZE - 5))
cmd_len = CMDBUFFSIZE - 5;
STRNCAT(cmd, cmd_start, cmd_len);
@@ -1490,7 +1490,7 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname)
{
/* Prefer help tags according to 'helplang'. Put the
* two-letter language name in help_lang[]. */
- i = STRLEN(tag_fname);
+ i = (int)STRLEN(tag_fname);
if (i > 3 && tag_fname[i - 3] == '-')
STRCPY(help_lang, tag_fname + i - 2);
else
@@ -1507,7 +1507,7 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname)
if ((flags & TAG_KEEP_LANG)
&& help_lang_find == NULL
&& curbuf->b_fname != NULL
- && (i = STRLEN(curbuf->b_fname)) > 4
+ && (i = (int)STRLEN(curbuf->b_fname)) > 4
&& curbuf->b_fname[i - 1] == 'x'
&& curbuf->b_fname[i - 4] == '.'
&& STRNICMP(curbuf->b_fname + i - 3, help_lang, 2) == 0)
@@ -3766,7 +3766,7 @@ add_tag_field(dict, field_name, start, end)
while (end > start && (end[-1] == '\r' || end[-1] == '\n'))
--end;
}
- len = end - start;
+ len = (int)(end - start);
if (len > sizeof(buf) - 1)
len = sizeof(buf) - 1;
vim_strncpy(buf, start, len);
@@ -3840,7 +3840,7 @@ get_tags(list, pat)
n = p;
while (*p != NUL && *p >= ' ' && *p < 127 && *p != ':')
++p;
- len = p - n;
+ len = (int)(p - n);
if (*p == ':' && len > 0)
{
s = ++p;
diff --git a/src/undo.c b/src/undo.c
index a2861d536..f9e735aaa 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -1393,7 +1393,7 @@ u_add_time(buf, buflen, tt)
}
else
#endif
- vim_snprintf((char *)buf, buflen, "%ld seconds ago",
+ vim_snprintf((char *)buf, buflen, _("%ld seconds ago"),
(long)(time(NULL) - tt));
}
diff --git a/src/version.h b/src/version.h
index 7f6e96ecf..f631b8fcf 100644
--- a/src/version.h
+++ b/src/version.h
@@ -35,6 +35,6 @@
*/
#define VIM_VERSION_NODOT "vim70e"
#define VIM_VERSION_SHORT "7.0e"
-#define VIM_VERSION_MEDIUM "7.0e BETA"
-#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0e BETA (2006 Apr 16)"
-#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0e BETA (2006 Apr 16, compiled "
+#define VIM_VERSION_MEDIUM "7.0e01 BETA"
+#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0e01 BETA (2006 Apr 17)"
+#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0e01 BETA (2006 Apr 17, compiled "