0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

updated for version 7.0109

This commit is contained in:
Bram Moolenaar 2005-07-18 21:40:44 +00:00
parent e759a7aa9a
commit b635633989
11 changed files with 91 additions and 70 deletions

View File

@ -2,7 +2,7 @@
" Language: Perl " Language: Perl
" Author: Rafael Garcia-Suarez <rgarciasuarez@free.fr> " Author: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
" URL: http://rgarciasuarez.free.fr/vim/indent/perl.vim " URL: http://rgarciasuarez.free.fr/vim/indent/perl.vim
" Last Change: 2003 Apr 25 " Last Change: 2005 Jul 15
" Suggestions and improvements by : " Suggestions and improvements by :
" Aaron J. Sherman (use syntax for hints) " Aaron J. Sherman (use syntax for hints)
@ -28,9 +28,6 @@ let b:did_indent = 1
" Is syntax highlighting active ? " Is syntax highlighting active ?
let b:indent_use_syntax = has("syntax") && &syntax == "perl" let b:indent_use_syntax = has("syntax") && &syntax == "perl"
let s:cpo_save = &cpo
set cpo-=C
setlocal indentexpr=GetPerlIndent() setlocal indentexpr=GetPerlIndent()
setlocal indentkeys+=0=,0),0=or,0=and setlocal indentkeys+=0=,0),0=or,0=and
if !b:indent_use_syntax if !b:indent_use_syntax
@ -42,6 +39,9 @@ if exists("*GetPerlIndent")
finish finish
endif endif
let s:cpo_save = &cpo
set cpo-=C
function GetPerlIndent() function GetPerlIndent()
" Get the line to be indented " Get the line to be indented

View File

@ -216,7 +216,7 @@ CTAGS = ctags
# SNIFF - Include support for SNiFF+. # SNIFF - Include support for SNiFF+.
SNIFF_INCL = if_sniff.h SNIFF_INCL = if_sniff.h
SNIFF_OBJ = $(OBJDIR)/if_sniff.obj SNIFF_OBJ = $(OBJDIR)/if_sniff.obj
SNIFF_LIB = shell32.lib SNIFF_LIB = shell32.lib
SNIFF_DEFS = -DFEAT_SNIFF SNIFF_DEFS = -DFEAT_SNIFF
# The SNiFF integration needs multithreaded libraries! # The SNiFF integration needs multithreaded libraries!
MULTITHREADED = yes MULTITHREADED = yes
@ -250,7 +250,7 @@ NBDEBUG_DEFS = -DNBDEBUG
NBDEBUG_INCL = nbdebug.h NBDEBUG_INCL = nbdebug.h
NBDEBUG_SRC = nbdebug.c NBDEBUG_SRC = nbdebug.c
!endif !endif
NETBEANS_LIB = WSock32.lib NETBEANS_LIB = WSock32.lib
!endif !endif
!ifdef XPM !ifdef XPM
@ -294,7 +294,8 @@ WINVER = 0x0400
CFLAGS = -c /W3 /nologo $(CVARS) -I. -Iproto -DHAVE_PATHDEF -DWIN32 \ CFLAGS = -c /W3 /nologo $(CVARS) -I. -Iproto -DHAVE_PATHDEF -DWIN32 \
$(SNIFF_DEFS) $(CSCOPE_DEFS) $(NETBEANS_DEFS) \ $(SNIFF_DEFS) $(CSCOPE_DEFS) $(NETBEANS_DEFS) \
$(NBDEBUG_DEFS) $(XPM_DEFS) \ $(NBDEBUG_DEFS) $(XPM_DEFS) \
$(DEFINES) -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) $(DEFINES) -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \
/Fo$(OUTDIR)/
#>>>>> end of choices #>>>>> end of choices
########################################################################### ###########################################################################
@ -500,7 +501,8 @@ TCL_VER_LONG = 8.3
!if "$(DYNAMIC_TCL)" == "yes" !if "$(DYNAMIC_TCL)" == "yes"
!message Tcl DLL will be loaded dynamically !message Tcl DLL will be loaded dynamically
TCL_DLL = tcl$(TCL_VER).dll TCL_DLL = tcl$(TCL_VER).dll
CFLAGS = $(CFLAGS) -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"$(TCL_DLL)\" -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\" CFLAGS = $(CFLAGS) -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"$(TCL_DLL)\" \
-DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\"
TCL_OBJ = $(OUTDIR)\if_tcl.obj TCL_OBJ = $(OUTDIR)\if_tcl.obj
TCL_INC = /I "$(TCL)\Include" /I "$(TCL)" TCL_INC = /I "$(TCL)\Include" /I "$(TCL)"
TCL_LIB = $(TCL)\lib\tclstub$(TCL_VER).lib TCL_LIB = $(TCL)\lib\tclstub$(TCL_VER).lib
@ -525,7 +527,8 @@ CFLAGS = $(CFLAGS) -DFEAT_PYTHON
PYTHON_OBJ = $(OUTDIR)\if_python.obj PYTHON_OBJ = $(OUTDIR)\if_python.obj
PYTHON_INC = /I "$(PYTHON)\Include" /I "$(PYTHON)\PC" PYTHON_INC = /I "$(PYTHON)\Include" /I "$(PYTHON)\PC"
!if "$(DYNAMIC_PYTHON)" == "yes" !if "$(DYNAMIC_PYTHON)" == "yes"
CFLAGS = $(CFLAGS) -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\" CFLAGS = $(CFLAGS) -DDYNAMIC_PYTHON \
-DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\"
PYTHON_LIB = /nodefaultlib:python$(PYTHON_VER).lib PYTHON_LIB = /nodefaultlib:python$(PYTHON_VER).lib
!else !else
PYTHON_LIB = $(PYTHON)\libs\python$(PYTHON_VER).lib PYTHON_LIB = $(PYTHON)\libs\python$(PYTHON_VER).lib
@ -541,9 +544,12 @@ MZSCHEME_VER = 205_000
CFLAGS = $(CFLAGS) -DFEAT_MZSCHEME -I $(MZSCHEME)\include CFLAGS = $(CFLAGS) -DFEAT_MZSCHEME -I $(MZSCHEME)\include
!if "$(DYNAMIC_MZSCHEME)" == "yes" !if "$(DYNAMIC_MZSCHEME)" == "yes"
!message MzScheme DLLs will be loaded dynamically !message MzScheme DLLs will be loaded dynamically
CFLAGS = $(CFLAGS) -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"libmzsch$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\" CFLAGS = $(CFLAGS) -DDYNAMIC_MZSCHEME \
-DDYNAMIC_MZSCH_DLL=\"libmzsch$(MZSCHEME_VER).dll\" \
-DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
!else !else
MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib $(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib \
$(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib
!endif !endif
MZSCHEME_OBJ = $(OUTDIR)\if_mzsch.obj MZSCHEME_OBJ = $(OUTDIR)\if_mzsch.obj
!endif !endif
@ -631,7 +637,8 @@ RUBY_LIB = $(RUBY)\lib\$(RUBY_INSTALL_NAME).lib
# Do we want to load Ruby dynamically? # Do we want to load Ruby dynamically?
!if "$(DYNAMIC_RUBY)" == "yes" !if "$(DYNAMIC_RUBY)" == "yes"
!message Ruby DLL will be loaded dynamically !message Ruby DLL will be loaded dynamically
CFLAGS = $(CFLAGS) -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\" -DDYNAMIC_RUBY_VER=$(RUBY_VER) CFLAGS = $(CFLAGS) -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=$(RUBY_VER) \
-DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
!undef RUBY_LIB !undef RUBY_LIB
!endif !endif
!endif # RUBY !endif # RUBY
@ -655,8 +662,7 @@ CFLAGS = $(CFLAGS) -DFEAT_$(FEATURES)
# Always generate the .pdb file, so that we get debug symbols that can be used # Always generate the .pdb file, so that we get debug symbols that can be used
# on a crash (doesn't add overhead to the executable). # on a crash (doesn't add overhead to the executable).
# #
CFLAGS = $(CFLAGS) /Zi CFLAGS = $(CFLAGS) /Zi /Fd$(OUTDIR)/
PDB = /Fd$(OUTDIR)/
LINK_PDB = /PDB:$(OUTDIR)/$(VIM).pdb -debug:full -debugtype:cv,fixup LINK_PDB = /PDB:$(OUTDIR)/$(VIM).pdb -debug:full -debugtype:cv,fixup
# #
@ -676,17 +682,20 @@ conflags = $(conflags) /map /mapinfo:lines
LINKARGS1 = $(linkdebug) $(conflags) /nodefaultlib:libc LINKARGS1 = $(linkdebug) $(conflags) /nodefaultlib:libc
LINKARGS2 = $(CON_LIB) $(GUI_LIB) $(LIBC) $(OLE_LIB) user32.lib $(SNIFF_LIB) \ LINKARGS2 = $(CON_LIB) $(GUI_LIB) $(LIBC) $(OLE_LIB) user32.lib $(SNIFF_LIB) \
$(MZSCHEME_LIB) $(PERL_LIB) $(PYTHON_LIB) $(RUBY_LIB) $(TCL_LIB) \ $(MZSCHEME_LIB) $(PERL_LIB) $(PYTHON_LIB) $(RUBY_LIB) \
$(NETBEANS_LIB) $(XPM_LIB) $(LINK_PDB) $(TCL_LIB) $(NETBEANS_LIB) $(XPM_LIB) $(LINK_PDB)
all: $(VIM).exe vimrun.exe install.exe uninstal.exe xxd/xxd.exe GvimExt/gvimext.dll all: $(VIM).exe vimrun.exe install.exe uninstal.exe xxd/xxd.exe \
GvimExt/gvimext.dll
$(VIM).exe: $(OUTDIR) $(OBJ) $(GUI_OBJ) $(OLE_OBJ) $(OLE_IDL) $(MZSCHEME_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) $(TCL_OBJ) $(SNIFF_OBJ) $(CSCOPE_OBJ) $(NETBEANS_OBJ) $(XPM_OBJ) version.c version.h $(VIM).exe: $(OUTDIR) $(OBJ) $(GUI_OBJ) $(OLE_OBJ) $(OLE_IDL) $(MZSCHEME_OBJ) \
$(CC) $(CFLAGS) version.c /Fo$(OUTDIR)/version.obj $(PDB) $(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) $(TCL_OBJ) $(SNIFF_OBJ) \
$(CSCOPE_OBJ) $(NETBEANS_OBJ) $(XPM_OBJ) version.c version.h
$(CC) $(CFLAGS) version.c
$(link) $(LINKARGS1) -out:$(VIM).exe $(OBJ) $(GUI_OBJ) $(OLE_OBJ) \ $(link) $(LINKARGS1) -out:$(VIM).exe $(OBJ) $(GUI_OBJ) $(OLE_OBJ) \
$(MZSCHEME_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) $(TCL_OBJ) $(SNIFF_OBJ) \ $(MZSCHEME_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) \
$(CSCOPE_OBJ) $(NETBEANS_OBJ) $(XPM_OBJ) \ $(TCL_OBJ) $(SNIFF_OBJ) $(CSCOPE_OBJ) $(NETBEANS_OBJ) \
$(OUTDIR)\version.obj $(LINKARGS2) $(XPM_OBJ) $(OUTDIR)\version.obj $(LINKARGS2)
$(VIM): $(VIM).exe $(VIM): $(VIM).exe
@ -694,7 +703,8 @@ $(OUTDIR):
if not exist $(OUTDIR)/nul mkdir $(OUTDIR) if not exist $(OUTDIR)/nul mkdir $(OUTDIR)
install.exe: dosinst.c install.exe: dosinst.c
$(CC) /nologo -DNDEBUG -DWIN32 dosinst.c kernel32.lib shell32.lib ole32.lib advapi32.lib uuid.lib $(CC) /nologo -DNDEBUG -DWIN32 dosinst.c kernel32.lib shell32.lib \
ole32.lib advapi32.lib uuid.lib
- if exist install.exe del install.exe - if exist install.exe del install.exe
ren dosinst.exe install.exe ren dosinst.exe install.exe
@ -767,7 +777,7 @@ testclean:
!ELSE !ELSE
.c{$(OUTDIR)/}.obj:: .c{$(OUTDIR)/}.obj::
!ENDIF !ENDIF
$(CC) $(CFLAGS) /Fo$(OUTDIR)/ $(PDB) $< $(CC) $(CFLAGS) $<
# Create a default rule for transforming .cpp files to .obj files in $(OUTDIR) # Create a default rule for transforming .cpp files to .obj files in $(OUTDIR)
# Batch compilation is supported by nmake 1.62 (part of VS 5.0) and later) # Batch compilation is supported by nmake 1.62 (part of VS 5.0) and later)
@ -776,7 +786,7 @@ testclean:
!ELSE !ELSE
.cpp{$(OUTDIR)/}.obj:: .cpp{$(OUTDIR)/}.obj::
!ENDIF !ENDIF
$(CC) $(CFLAGS) /Fo$(OUTDIR)/ $(PDB) $< $(CC) $(CFLAGS) $<
$(OUTDIR)/buffer.obj: $(OUTDIR) buffer.c $(INCL) $(OUTDIR)/buffer.obj: $(OUTDIR) buffer.c $(INCL)
@ -817,30 +827,32 @@ $(OUTDIR)/gui_w32.obj: $(OUTDIR) gui_w32.c gui_w48.c $(INCL) $(GUI_INCL)
$(OUTDIR)/if_cscope.obj: $(OUTDIR) if_cscope.c $(INCL) $(OUTDIR)/if_cscope.obj: $(OUTDIR) if_cscope.c $(INCL)
if_perl.c : if_perl.xs typemap if_perl.c : if_perl.xs typemap
$(PERL_EXE) $(XSUBPP) -prototypes -typemap $(XSUBPP_TYPEMAP) -typemap typemap if_perl.xs > if_perl.c $(PERL_EXE) $(XSUBPP) -prototypes -typemap $(XSUBPP_TYPEMAP) \
-typemap typemap if_perl.xs > if_perl.c
$(OUTDIR)/if_perl.obj: $(OUTDIR) if_perl.c $(INCL) $(OUTDIR)/if_perl.obj: $(OUTDIR) if_perl.c $(INCL)
$(CC) $(CFLAGS) $(PERL_INC) if_perl.c /Fo$(OUTDIR)/if_perl.obj $(PDB) $(CC) $(CFLAGS) $(PERL_INC) if_perl.c
$(OUTDIR)/if_perlsfio.obj: $(OUTDIR) if_perlsfio.c $(INCL) $(OUTDIR)/if_perlsfio.obj: $(OUTDIR) if_perlsfio.c $(INCL)
$(CC) $(CFLAGS) $(PERL_INC) if_perlsfio.c /Fo$(OUTDIR)/if_perlsfio.obj $(PDB) $(CC) $(CFLAGS) $(PERL_INC) if_perlsfio.c
$(OUTDIR)/if_mzsch.obj: $(OUTDIR) if_mzsch.c $(INCL) $(OUTDIR)/if_mzsch.obj: $(OUTDIR) if_mzsch.c $(INCL)
$(CC) $(CFLAGS) $(PERL_INC) if_mzsch.c /Fo$(OUTDIR)/if_mzsch.obj $(PDB) -DMZSCHEME_COLLECTS=\"$(MZSCHEME:\=\\)\\collects\" $(CC) $(CFLAGS) $(PERL_INC) if_mzsch.c
-DMZSCHEME_COLLECTS=\"$(MZSCHEME:\=\\)\\collects\"
$(OUTDIR)/if_python.obj: $(OUTDIR) if_python.c $(INCL) $(OUTDIR)/if_python.obj: $(OUTDIR) if_python.c $(INCL)
$(CC) $(CFLAGS) $(PYTHON_INC) if_python.c /Fo$(OUTDIR)/if_python.obj $(PDB) $(CC) $(CFLAGS) $(PYTHON_INC) if_python.c
$(OUTDIR)/if_ole.obj: $(OUTDIR) if_ole.cpp $(INCL) if_ole.h $(OUTDIR)/if_ole.obj: $(OUTDIR) if_ole.cpp $(INCL) if_ole.h
$(OUTDIR)/if_ruby.obj: $(OUTDIR) if_ruby.c $(INCL) $(OUTDIR)/if_ruby.obj: $(OUTDIR) if_ruby.c $(INCL)
$(CC) $(CFLAGS) $(RUBY_INC) if_ruby.c /Fo$(OUTDIR)/if_ruby.obj $(PDB) $(CC) $(CFLAGS) $(RUBY_INC) if_ruby.c
$(OUTDIR)/if_sniff.obj: $(OUTDIR) if_sniff.c $(INCL) $(OUTDIR)/if_sniff.obj: $(OUTDIR) if_sniff.c $(INCL)
$(CC) $(CFLAGS) if_sniff.c /Fo$(OUTDIR)/if_sniff.obj $(PDB) $(CC) $(CFLAGS) if_sniff.c
$(OUTDIR)/if_tcl.obj: $(OUTDIR) if_tcl.c $(INCL) $(OUTDIR)/if_tcl.obj: $(OUTDIR) if_tcl.c $(INCL)
$(CC) $(CFLAGS) $(TCL_INC) if_tcl.c /Fo$(OUTDIR)/if_tcl.obj $(PDB) $(CC) $(CFLAGS) $(TCL_INC) if_tcl.c
$(OUTDIR)/main.obj: $(OUTDIR) main.c $(INCL) $(OUTDIR)/main.obj: $(OUTDIR) main.c $(INCL)
@ -877,7 +889,7 @@ $(OUTDIR)/os_win32.obj: $(OUTDIR) os_win32.c $(INCL) os_win32.h
$(OUTDIR)/os_w32exe.obj: $(OUTDIR) os_w32exe.c $(INCL) $(OUTDIR)/os_w32exe.obj: $(OUTDIR) os_w32exe.c $(INCL)
$(OUTDIR)/pathdef.obj: $(OUTDIR) auto/pathdef.c $(INCL) $(OUTDIR)/pathdef.obj: $(OUTDIR) auto/pathdef.c $(INCL)
$(CC) $(CFLAGS) auto/pathdef.c /Fo$(OUTDIR)/pathdef.obj $(PDB) $(CC) $(CFLAGS) auto/pathdef.c
$(OUTDIR)/quickfix.obj: $(OUTDIR) quickfix.c $(INCL) $(OUTDIR)/quickfix.obj: $(OUTDIR) quickfix.c $(INCL)
@ -902,13 +914,15 @@ $(OUTDIR)/undo.obj: $(OUTDIR) undo.c $(INCL)
$(OUTDIR)/window.obj: $(OUTDIR) window.c $(INCL) $(OUTDIR)/window.obj: $(OUTDIR) window.c $(INCL)
$(OUTDIR)/xpm_w32.obj: $(OUTDIR) xpm_w32.c $(OUTDIR)/xpm_w32.obj: $(OUTDIR) xpm_w32.c
$(CC) $(CFLAGS) $(XPM_INC) xpm_w32.c /Fo$(OUTDIR)/xpm_w32.obj $(PDB) $(CC) $(CFLAGS) $(XPM_INC) xpm_w32.c
$(OUTDIR)/vim.res: $(OUTDIR) vim.rc version.h tools.bmp tearoff.bmp vim.ico vim_error.ico vim_alert.ico vim_info.ico vim_quest.ico $(OUTDIR)/vim.res: $(OUTDIR) vim.rc version.h tools.bmp tearoff.bmp \
vim.ico vim_error.ico vim_alert.ico vim_info.ico vim_quest.ico
$(RC) /l 0x409 /Fo$(OUTDIR)/vim.res $(RCFLAGS) vim.rc $(RC) /l 0x409 /Fo$(OUTDIR)/vim.res $(RCFLAGS) vim.rc
iid_ole.c if_ole.h vim.tlb: if_ole.idl iid_ole.c if_ole.h vim.tlb: if_ole.idl
midl /nologo /error none /proxy nul /iid iid_ole.c /tlb vim.tlb /header if_ole.h if_ole.idl midl /nologo /error none /proxy nul /iid iid_ole.c /tlb vim.tlb \
/header if_ole.h if_ole.idl
dimm.h dimm_i.c: dimm.idl dimm.h dimm_i.c: dimm.idl
midl /nologo /error none /proxy nul dimm.idl midl /nologo /error none /proxy nul dimm.idl

View File

@ -3036,9 +3036,8 @@ maketitle()
else else
{ {
p = transstr(gettail(curbuf->b_fname)); p = transstr(gettail(curbuf->b_fname));
STRNCPY(buf, p, IOSIZE - 100); vim_strncpy(buf, p, IOSIZE - 100);
vim_free(p); vim_free(p);
buf[IOSIZE - 100] = NUL; /* in case it was too long */
} }
switch (bufIsChanged(curbuf) switch (bufIsChanged(curbuf)
@ -3071,15 +3070,15 @@ maketitle()
p = gettail_sep(buf + off); p = gettail_sep(buf + off);
if (p == buf + off) if (p == buf + off)
/* must be a help buffer */ /* must be a help buffer */
STRCPY(buf + off, _("help")); vim_strncpy(buf + off, (char_u *)_("help"),
IOSIZE - off - 1);
else else
*p = NUL; *p = NUL;
/* translate unprintable chars */ /* translate unprintable chars */
p = transstr(buf + off); p = transstr(buf + off);
STRNCPY(buf + off, p, IOSIZE - off); vim_strncpy(buf + off, p, IOSIZE - off - 1);
vim_free(p); vim_free(p);
buf[IOSIZE - 1] = NUL; /* in case it was too long */
STRCAT(buf, ")"); STRCAT(buf, ")");
} }

View File

@ -7286,7 +7286,7 @@ ex_cd(eap)
if (p == NULL || *p == NUL) /* empty is the same as not set */ if (p == NULL || *p == NUL) /* empty is the same as not set */
NameBuff[0] = NUL; NameBuff[0] = NUL;
else else
STRNCPY(NameBuff, p, MAXPATHL); vim_strncpy(NameBuff, p, MAXPATHL - 1);
# else # else
expand_env((char_u *)"$HOME", NameBuff, MAXPATHL); expand_env((char_u *)"$HOME", NameBuff, MAXPATHL);
# endif # endif

View File

@ -257,8 +257,7 @@ add_buff(buf, s, slen)
if (buf->bh_space >= (int)slen) if (buf->bh_space >= (int)slen)
{ {
len = (long_u)STRLEN(buf->bh_curr->b_str); len = (long_u)STRLEN(buf->bh_curr->b_str);
STRNCPY(buf->bh_curr->b_str + len, s, slen); vim_strncpy(buf->bh_curr->b_str + len, s, (size_t)slen);
buf->bh_curr->b_str[len + slen] = NUL;
buf->bh_space -= slen; buf->bh_space -= slen;
} }
else else
@ -272,8 +271,7 @@ add_buff(buf, s, slen)
if (p == NULL) if (p == NULL)
return; /* no space, just forget it */ return; /* no space, just forget it */
buf->bh_space = len - slen; buf->bh_space = len - slen;
STRNCPY(p->b_str, s, slen); vim_strncpy(p->b_str, s, (size_t)slen);
p->b_str[slen] = NUL;
p->b_next = buf->bh_curr->b_next; p->b_next = buf->bh_curr->b_next;
buf->bh_curr->b_next = p; buf->bh_curr->b_next = p;

View File

@ -2769,8 +2769,7 @@ netbeans_inserted(
/* send the "insert" EVT */ /* send the "insert" EVT */
newtxt = alloc(newlen + 1); newtxt = alloc(newlen + 1);
STRNCPY(newtxt, txt, newlen); vim_strncpy(newtxt, txt, newlen);
newtxt[newlen] = '\0';
p = nb_quote(newtxt); p = nb_quote(newtxt);
if (p != NULL) if (p != NULL)
{ {

View File

@ -211,8 +211,7 @@ mac_expandpath(
if (gErr == noErr) if (gErr == noErr)
{ {
STRNCPY (cfilename, &dirname[1], dirname[0]); vim_strncpy(cfilename, &dirname[1], dirname[0]);
cfilename[dirname[0]] = 0;
if (vim_regexec(&regmatch, cfilename, (colnr_T)0)) if (vim_regexec(&regmatch, cfilename, (colnr_T)0))
{ {
if (s[-1] != ':') if (s[-1] != ':')
@ -261,8 +260,7 @@ mac_expandpath(
gErr = PBHGetVInfo (&gMyHPBlock,false); gErr = PBHGetVInfo (&gMyHPBlock,false);
if (gErr == noErr) if (gErr == noErr)
{ {
STRNCPY (cfilename, &dirname[1], dirname[0]); vim_strncpy(cfilename, &dirname[1], dirname[0]);
cfilename[dirname[0]] = 0;
if (vim_regexec(&regmatch, cfilename, (colnr_T)0)) if (vim_regexec(&regmatch, cfilename, (colnr_T)0))
{ {
STRCPY(s, cfilename); STRCPY(s, cfilename);
@ -681,8 +679,7 @@ mch_get_user_name(s, len)
if ((pw = getpwuid(uid)) != NULL if ((pw = getpwuid(uid)) != NULL
&& pw->pw_name != NULL && *(pw->pw_name) != NUL) && pw->pw_name != NULL && *(pw->pw_name) != NUL)
{ {
STRNCPY(s, pw->pw_name, len); vim_strncpy(s, pw->pw_name, len - 1);
s[len - 1] = NUL;
return OK; return OK;
} }
#endif #endif
@ -700,16 +697,15 @@ mch_get_host_name(s, len)
int len; int len;
{ {
#if defined(__MRC__) || defined(__SC__) || defined(__APPLE_CC__) #if defined(__MRC__) || defined(__SC__) || defined(__APPLE_CC__)
STRNCPY(s, "Mac", len); /* TODO: use Gestalt information */ vim_strncpy(s, "Mac", len - 1); /* TODO: use Gestalt information */
#else #else
struct utsname vutsname; struct utsname vutsname;
if (uname(&vutsname) < 0) if (uname(&vutsname) < 0)
*s = NUL; *s = NUL;
else else
STRNCPY(s, vutsname.nodename, len); vim_strncpy(s, vutsname.nodename, len - 1);
#endif #endif
s[len - 1] = NUL; /* make sure it's terminated */
} }
/* /*
@ -950,8 +946,7 @@ mch_FullName(fname, buf, len, force)
} }
else else
{ {
STRNCPY(buf, fname, len); vim_strncpy(buf, fname, len - 1);
buf[len - 1] = NUL;
slash_n_colon_adjust(buf); slash_n_colon_adjust(buf);
} }

View File

@ -523,7 +523,7 @@ mch_get_host_name(s, len)
if (xswi(OS_ReadVarVal, "Machine$Name", s, len, 0, 3) & v_flag) if (xswi(OS_ReadVarVal, "Machine$Name", s, len, 0, 3) & v_flag)
{ {
/* Variable does not exist (normal operation) */ /* Variable does not exist (normal operation) */
STRNCPY(s, "(unknown)", len); vim_strncpy(s, "(unknown)", len - 1);
} }
} }

View File

@ -2545,6 +2545,7 @@ did_set_spelllang(buf)
garray_T ga; garray_T ga;
char_u *splp; char_u *splp;
char_u *region; char_u *region;
char_u region_cp[3];
int filename; int filename;
int region_mask; int region_mask;
slang_T *lp; slang_T *lp;
@ -2577,6 +2578,19 @@ did_set_spelllang(buf)
{ {
filename = TRUE; filename = TRUE;
/* Locate a region and remove it from the file name. */
p = vim_strchr(gettail(lang), '_');
if (p != NULL && ASCII_ISALPHA(p[1]) && ASCII_ISALPHA(p[2])
&& !ASCII_ISALPHA(p[3]))
{
vim_strncpy(region_cp, p + 1, 2);
mch_memmove(p, p + 3, len - (p - lang) - 2);
len -= 3;
region = region_cp;
}
else
dont_use_region = TRUE;
/* Check if we loaded this language before. */ /* Check if we loaded this language before. */
for (lp = first_lang; lp != NULL; lp = lp->sl_next) for (lp = first_lang; lp != NULL; lp = lp->sl_next)
if (fullpathcmp(lang, lp->sl_fname, FALSE) == FPC_SAME) if (fullpathcmp(lang, lp->sl_fname, FALSE) == FPC_SAME)
@ -2590,12 +2604,6 @@ did_set_spelllang(buf)
region = lang + len - 2; region = lang + len - 2;
len -= 3; len -= 3;
lang[len] = NUL; lang[len] = NUL;
/* If the region differs from what was used before then don't
* use it for 'spellfile'. */
if (use_region != NULL && STRCMP(region, use_region) != 0)
dont_use_region = TRUE;
use_region = region;
} }
else else
dont_use_region = TRUE; dont_use_region = TRUE;
@ -2606,6 +2614,15 @@ did_set_spelllang(buf)
break; break;
} }
if (region != NULL)
{
/* If the region differs from what was used before then don't
* use it for 'spellfile'. */
if (use_region != NULL && STRCMP(region, use_region) != 0)
dont_use_region = TRUE;
use_region = region;
}
/* If not found try loading the language now. */ /* If not found try loading the language now. */
if (lp == NULL) if (lp == NULL)
{ {

View File

@ -1897,7 +1897,7 @@ typedef int proftime_T; /* dummy for function prototypes */
/* values for vim_handle_signal() that are not a signal */ /* values for vim_handle_signal() that are not a signal */
#define SIGNAL_BLOCK -1 #define SIGNAL_BLOCK -1
#define SIGNAL_UNBLOCK -2 #define SIGNAL_UNBLOCK -2
#ifndef UNIX #if !defined(UNIX) && !defined(VMS)
# define vim_handle_signal(x) 0 # define vim_handle_signal(x) 0
#endif #endif

View File

@ -4788,8 +4788,7 @@ vim_FullName(fname, buf, len, force)
if (url || retval == FAIL) if (url || retval == FAIL)
{ {
/* something failed; use the file name (truncate when too long) */ /* something failed; use the file name (truncate when too long) */
STRNCPY(buf, fname, len); vim_strncpy(buf, fname, len - 1);
buf[len - 1] = NUL;
} }
#if defined(MACOS_CLASSIC) || defined(OS2) || defined(MSDOS) || defined(MSWIN) #if defined(MACOS_CLASSIC) || defined(OS2) || defined(MSDOS) || defined(MSWIN)
slash_adjust(buf); slash_adjust(buf);