Compare commits

...

9 Commits

Author SHA1 Message Date
Bram Moolenaar
6f586de755 updated for version 7.3.666
Problem:    With MSVC 11 Win32.mak is not found.
Solution:   Add the SDK_INCLUDE_DIR variable. (Raymond Ko)
2012-09-18 22:00:08 +02:00
Bram Moolenaar
2b017fae8f updated for version 7.3.665
Problem:    MSVC 11 is not supported.
Solution:   Recognize MSVC 11. (Raymond Ko)
2012-09-18 18:27:12 +02:00
Bram Moolenaar
4fabd7dd4a updated for version 7.3.664
Problem:    Buffer overflow in unescaping text. (Raymond Ko)
Solution:   Limit check for multi-byte character to 4 bytes.
2012-09-18 18:03:37 +02:00
Bram Moolenaar
be1e9e9fc1 updated for version 7.3.663
Problem:    End of color scheme name not clear in E185. (Aaron Lewis)
Solution:   Put the name in single quotes.
2012-09-18 16:47:07 +02:00
Bram Moolenaar
2623b4f412 updated for version 7.3.662
Problem:    Can't build Ruby interface with Ruby 1.9.3.
Solution:   Add missing functions. (V. Ondruch)
2012-09-18 16:36:32 +02:00
Bram Moolenaar
e8cdcef875 updated for version 7.3.661
Problem:    SEGV in Python code.
Solution:   Initialize len to zero.  Use the right function depending on
            version. (Maxim Philippov)
2012-09-12 20:21:43 +02:00
Bram Moolenaar
fca93c093e updated for version 7.3.660
Problem:    ":help !" jumps to help for ":!".
Solution:   Adjust check for tag header line. (Andy Wokula)
2012-09-12 18:19:46 +02:00
Bram Moolenaar
c11073c9aa updated for version 7.3.659
Problem:    Recent Python changes are not tested.
Solution:   Add tests for Python bindings. (ZyX)
2012-09-05 19:17:42 +02:00
Bram Moolenaar
afa6b9af86 updated for version 7.3.658
Problem:    NUL bytes truncate strings when converted from Python.
Solution:   Handle truncation as an error. (ZyX)
2012-09-05 19:09:11 +02:00
14 changed files with 199 additions and 48 deletions

2
.gitignore vendored
View File

@@ -31,6 +31,7 @@ src/auto/pathdef.c
*.res
*.RES
src/pathdef.c
src/perl.c
src/Obj*/pathdef.c
gvimext.dll
gvimext.lib
@@ -41,6 +42,7 @@ gvimext.lib
*.mo
*.swp
*~
src/po/vim.pot
# Generated by "make test"
src/po/*.ck

View File

@@ -1,7 +1,7 @@
# Makefile for Vim on Win32 (Windows NT/2000/XP/2003 and Windows 95/98/Me)
# and Win64, using the Microsoft Visual C++ compilers. Known to work with
# VC5, VC6 (VS98), VC7.0 (VS2002), VC7.1 (VS2003), VC8 (VS2005),
# VC9 (VS2008), and VC10 (VS2010).
# VC9 (VS2008), VC10 (VS2010) and VC11 (VS2012)
#
# To build using other Windows compilers, see INSTALLpc.txt
#
@@ -15,6 +15,9 @@
# This will build the console version of Vim with no additional interfaces.
# To add features, define any of the following:
#
# For MSVC 11 you need to specify where the Win32.mak file is, e.g.:
# SDK_INCLUDE_DIR="C:\Program Files\Microsoft SDKs\Windows\v7.1\Include"
#
# !!!! After changing features do "nmake clean" first !!!!
#
# Feature Set: FEATURES=[TINY, SMALL, NORMAL, BIG, HUGE] (default is BIG)
@@ -227,7 +230,12 @@ MAKEFLAGS_GVIMEXT = DEBUG=yes
# Get all sorts of useful, standard macros from the Platform SDK.
!ifdef SDK_INCLUDE_DIR
!include $(SDK_INCLUDE_DIR)\Win32.mak
!else
!include <Win32.mak>
!endif
# Flag to turn on Win64 compatibility warnings for VC7.x and VC8.
WP64CHECK = /Wp64
@@ -395,6 +403,9 @@ MSVCVER = 10.0
!if "$(_NMAKE_VER)" == "10.00.30319.01"
MSVCVER = 10.0
!endif
!if "$(_NMAKE_VER)" == "11.00.50727.1"
MSVCVER = 11.0
!endif
!endif
# Abort bulding VIM if version of VC is unrecognised.
@@ -409,7 +420,7 @@ MSVCVER = 10.0
!endif
# Convert processor ID to MVC-compatible number
!if ("$(MSVCVER)" != "8.0") && ("$(MSVCVER)" != "9.0") && ("$(MSVCVER)" != "10.0")
!if ("$(MSVCVER)" != "8.0") && ("$(MSVCVER)" != "9.0") && ("$(MSVCVER)" != "10.0") && ("$(MSVCVER)" != "11.0")
!if "$(CPUNR)" == "i386"
CPUARG = /G3
!elseif "$(CPUNR)" == "i486"
@@ -443,7 +454,7 @@ OPTFLAG = /O2
OPTFLAG = /Ox
!endif
!if ("$(MSVCVER)" == "8.0") || ("$(MSVCVER)" == "9.0") || ("$(MSVCVER)" == "10.0")
!if ("$(MSVCVER)" == "8.0") || ("$(MSVCVER)" == "9.0") || ("$(MSVCVER)" == "10.0") || ("$(MSVCVER)" == "11.0")
# Use link time code generation if not worried about size
!if "$(OPTIMIZE)" != "SPACE"
OPTFLAG = $(OPTFLAG) /GL
@@ -908,7 +919,7 @@ LINKARGS2 = $(CON_LIB) $(GUI_LIB) $(LIBC) $(OLE_LIB) user32.lib $(SNIFF_LIB) \
# Report link time code generation progress if used.
!ifdef NODEBUG
!if ("$(MSVCVER)" == "8.0") || ("$(MSVCVER)" == "9.0") || ("$(MSVCVER)" == "10.0")
!if ("$(MSVCVER)" == "8.0") || ("$(MSVCVER)" == "9.0") || ("$(MSVCVER)" == "10.0") || ("$(MSVCVER)" == "11.0")
!if "$(OPTIMIZE)" != "SPACE"
LINKARGS1 = $(LINKARGS1) /LTCG:STATUS
!endif

View File

@@ -6466,7 +6466,7 @@ ex_colorscheme(eap)
#endif
}
else if (load_colors(eap->arg) == FAIL)
EMSG2(_("E185: Cannot find color scheme %s"), eap->arg);
EMSG2(_("E185: Cannot find color scheme '%s'"), eap->arg);
}
static void

View File

@@ -74,7 +74,7 @@ static struct PyMethodDef OutputMethods[] = {
static PyObject *
OutputWrite(PyObject *self, PyObject *args)
{
Py_ssize_t len;
Py_ssize_t len = 0;
char *str = NULL;
int error = ((OutputObject *)(self))->error;
@@ -2530,8 +2530,10 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookupDict)
#if PY_MAJOR_VERSION >= 3
else if (PyBytes_Check(obj))
{
char_u *result = (char_u *) PyBytes_AsString(obj);
char_u *result;
if (PyString_AsStringAndSize(obj, (char **) &result, NULL) == -1)
return -1;
if (result == NULL)
return -1;
@@ -2549,7 +2551,8 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookupDict)
if (bytes == NULL)
return -1;
result = (char_u *) PyBytes_AsString(bytes);
if(PyString_AsStringAndSize(bytes, (char **) &result, NULL) == -1)
return -1;
if (result == NULL)
return -1;
@@ -2572,7 +2575,8 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookupDict)
if (bytes == NULL)
return -1;
result=(char_u *) PyString_AsString(bytes);
if(PyString_AsStringAndSize(bytes, (char **) &result, NULL) == -1)
return -1;
if (result == NULL)
return -1;
@@ -2587,8 +2591,10 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookupDict)
}
else if (PyString_Check(obj))
{
char_u *result = (char_u *) PyString_AsString(obj);
char_u *result;
if(PyString_AsStringAndSize(obj, (char **) &result, NULL) == -1)
return -1;
if (result == NULL)
return -1;

View File

@@ -44,8 +44,6 @@
# undef _XOPEN_SOURCE /* pyconfig.h defines it as well. */
#endif
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#if defined(MACOS) && !defined(MACOS_X_UNIX)
# include "macglue.h"
@@ -54,6 +52,10 @@
#undef main /* Defined in python.h - aargh */
#undef HAVE_FCNTL_H /* Clash with os_win32.h */
#if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02050000
# define PY_SSIZE_T_CLEAN
#endif
static void init_structs(void);
#define PyBytes_FromString PyString_FromString
@@ -358,8 +360,15 @@ static struct
PYTHON_PROC *ptr;
} python_funcname_table[] =
{
#ifndef PY_SSIZE_T_CLEAN
{"PyArg_Parse", (PYTHON_PROC*)&dll_PyArg_Parse},
{"PyArg_ParseTuple", (PYTHON_PROC*)&dll_PyArg_ParseTuple},
{"Py_BuildValue", (PYTHON_PROC*)&dll_Py_BuildValue},
#else
{"_PyArg_Parse_SizeT", (PYTHON_PROC*)&dll_PyArg_Parse},
{"_PyArg_ParseTuple_SizeT", (PYTHON_PROC*)&dll_PyArg_ParseTuple},
{"_Py_BuildValue_SizeT", (PYTHON_PROC*)&dll_Py_BuildValue},
#endif
{"PyMem_Free", (PYTHON_PROC*)&dll_PyMem_Free},
{"PyMem_Malloc", (PYTHON_PROC*)&dll_PyMem_Malloc},
{"PyDict_SetItemString", (PYTHON_PROC*)&dll_PyDict_SetItemString},
@@ -422,7 +431,6 @@ static struct
{"PySys_SetArgv", (PYTHON_PROC*)&dll_PySys_SetArgv},
{"PyType_Type", (PYTHON_PROC*)&dll_PyType_Type},
{"PyType_Ready", (PYTHON_PROC*)&dll_PyType_Ready},
{"Py_BuildValue", (PYTHON_PROC*)&dll_Py_BuildValue},
{"Py_FindMethod", (PYTHON_PROC*)&dll_Py_FindMethod},
# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02050000 \
&& SIZEOF_SIZE_T != SIZEOF_INT

View File

@@ -42,8 +42,6 @@
# undef _DEBUG
#endif
#define PY_SSIZE_T_CLEAN
#ifdef F_BLANK
# undef F_BLANK
#endif
@@ -66,6 +64,10 @@
#undef main /* Defined in python.h - aargh */
#undef HAVE_FCNTL_H /* Clash with os_win32.h */
#if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02050000
# define PY_SSIZE_T_CLEAN
#endif
static void init_structs(void);
/* The "surrogateescape" error handler is new in Python 3.1 */
@@ -85,6 +87,7 @@ static void init_structs(void);
#define PyString_AsString(obj) PyBytes_AsString(obj)
#define PyString_Size(obj) PyBytes_GET_SIZE(bytes)
#define PyString_FromString(repr) PyUnicode_FromString(repr)
#define PyString_AsStringAndSize(obj, buffer, len) PyBytes_AsStringAndSize(obj, buffer, len)
#if defined(DYNAMIC_PYTHON3) || defined(PROTO)
@@ -327,7 +330,13 @@ static struct
{"PySys_SetArgv", (PYTHON_PROC*)&py3_PySys_SetArgv},
{"Py_SetPythonHome", (PYTHON_PROC*)&py3_Py_SetPythonHome},
{"Py_Initialize", (PYTHON_PROC*)&py3_Py_Initialize},
#ifndef PY_SSIZE_T_CLEAN
{"PyArg_ParseTuple", (PYTHON_PROC*)&py3_PyArg_ParseTuple},
{"Py_BuildValue", (PYTHON_PROC*)&py3_Py_BuildValue},
#else
{"_PyArg_ParseTuple_SizeT", (PYTHON_PROC*)&py3_PyArg_ParseTuple},
{"_Py_BuildValue_SizeT", (PYTHON_PROC*)&py3_Py_BuildValue},
#endif
{"PyMem_Free", (PYTHON_PROC*)&py3_PyMem_Free},
{"PyMem_Malloc", (PYTHON_PROC*)&py3_PyMem_Malloc},
{"PyList_New", (PYTHON_PROC*)&py3_PyList_New},
@@ -363,7 +372,6 @@ static struct
{"PyObject_GetIter", (PYTHON_PROC*)&py3_PyObject_GetIter},
{"PyLong_FromLong", (PYTHON_PROC*)&py3_PyLong_FromLong},
{"PyDict_New", (PYTHON_PROC*)&py3_PyDict_New},
{"Py_BuildValue", (PYTHON_PROC*)&py3_Py_BuildValue},
{"PyType_Ready", (PYTHON_PROC*)&py3_PyType_Ready},
{"PyDict_SetItemString", (PYTHON_PROC*)&py3_PyDict_SetItemString},
{"PyLong_AsLong", (PYTHON_PROC*)&py3_PyLong_AsLong},
@@ -552,7 +560,7 @@ static int py3initialised = 0;
#define DICTKEY_GET(err) \
if (PyBytes_Check(keyObject)) \
{ \
if (PyBytes_AsStringAndSize(keyObject, (char **) &key, NULL) == -1) \
if (PyString_AsStringAndSize(keyObject, (char **) &key, NULL) == -1) \
return err; \
} \
else if (PyUnicode_Check(keyObject)) \
@@ -560,7 +568,7 @@ static int py3initialised = 0;
bytes = PyString_AsBytes(keyObject); \
if (bytes == NULL) \
return err; \
if (PyBytes_AsStringAndSize(bytes, (char **) &key, NULL) == -1) \
if (PyString_AsStringAndSize(bytes, (char **) &key, NULL) == -1) \
return err; \
} \
else \

View File

@@ -178,6 +178,9 @@ static void ruby_vim_init(void);
#define rb_hash_new dll_rb_hash_new
#define rb_inspect dll_rb_inspect
#define rb_int2inum dll_rb_int2inum
#define rb_fix2int dll_rb_fix2int
#define rb_num2int dll_rb_num2int
#define rb_num2uint dll_rb_num2uint
#define rb_lastline_get dll_rb_lastline_get
#define rb_lastline_set dll_rb_lastline_set
#define rb_load_protect dll_rb_load_protect
@@ -268,7 +271,9 @@ static VALUE (*dll_rb_hash_aset) (VALUE, VALUE, VALUE);
static VALUE (*dll_rb_hash_new) (void);
static VALUE (*dll_rb_inspect) (VALUE);
static VALUE (*dll_rb_int2inum) (long);
static VALUE (*dll_rb_int2inum) (long);
static long (*dll_rb_fix2int) (VALUE);
static long (*dll_rb_num2int) (VALUE);
static unsigned long (*dll_rb_num2uint) (VALUE);
static VALUE (*dll_rb_lastline_get) (void);
static void (*dll_rb_lastline_set) (VALUE);
static void (*dll_rb_load_protect) (VALUE, int, int*);
@@ -377,6 +382,9 @@ static struct
{"rb_hash_new", (RUBY_PROC*)&dll_rb_hash_new},
{"rb_inspect", (RUBY_PROC*)&dll_rb_inspect},
{"rb_int2inum", (RUBY_PROC*)&dll_rb_int2inum},
{"rb_fix2int", (RUBY_PROC*)&dll_rb_fix2int},
{"rb_num2int", (RUBY_PROC*)&dll_rb_num2int},
{"rb_num2uint", (RUBY_PROC*)&dll_rb_num2uint},
{"rb_lastline_get", (RUBY_PROC*)&dll_rb_lastline_get},
{"rb_lastline_set", (RUBY_PROC*)&dll_rb_lastline_set},
{"rb_load_protect", (RUBY_PROC*)&dll_rb_load_protect},

View File

@@ -3793,13 +3793,15 @@ mb_charlen_len(str, len)
mb_unescape(pp)
char_u **pp;
{
static char_u buf[MB_MAXBYTES + 1];
int n, m = 0;
static char_u buf[6];
int n;
int m = 0;
char_u *str = *pp;
/* Must translate K_SPECIAL KS_SPECIAL KE_FILLER to K_SPECIAL and CSI
* KS_EXTRA KE_CSI to CSI. */
for (n = 0; str[n] != NUL && m <= MB_MAXBYTES; ++n)
* KS_EXTRA KE_CSI to CSI.
* Maximum length of a utf-8 character is 4 bytes. */
for (n = 0; str[n] != NUL && m < 4; ++n)
{
if (str[n] == K_SPECIAL
&& str[n + 1] == KS_SPECIAL
@@ -3836,6 +3838,10 @@ mb_unescape(pp)
*pp = str + n + 1;
return buf;
}
/* Bail out quickly for ASCII. */
if (buf[0] < 128)
break;
}
return NULL;
}

View File

@@ -1797,7 +1797,7 @@ line_read_in:
*/
if (state == TS_START)
{
if (STRNCMP(lbuf, "!_TAG_", 6) <= 0)
if (STRNCMP(lbuf, "!_TAG_", 6) == 0)
{
/*
* Read header line.

View File

@@ -176,28 +176,62 @@ STARTTEST
:else
: $put ='[0.0, 0.0]'
:endif
:let messages=[]
:py <<EOF
d=vim.bindeval('{}')
m=vim.bindeval('messages')
try:
d['abc']
except Exception as e:
m.extend([e.__class__.__name__])
try:
d['abc']="\0"
except Exception as e:
m.extend([e.__class__.__name__])
try:
d['abc']=vim
except Exception as e:
m.extend([e.__class__.__name__])
try:
d['']=1
except Exception as e:
m.extend([e.__class__.__name__])
try:
d['a\0b']=1
except Exception as e:
m.extend([e.__class__.__name__])
try:
d[b'a\0b']=1
except Exception as e:
m.extend([e.__class__.__name__])
EOF
:$put =messages
:"
:" pyeval()
:let l=pyeval('range(3)')
:$put =string(l)
:let d=pyeval('{"a": "b", "c": 1, "d": ["e"]}')
:$put =sort(items(d))
:try
: let undef=pyeval('undefined_name')
:catch
: $put =v:exception[:13]
:endtry
:try
: let vim=pyeval('vim')
:catch
: $put =v:exception[:13]
:endtry
:if has('float')
: let f=pyeval('0.0')
: $put =string(f)
:else
: $put ='0.0'
:endif
:" Invalid values:
:for e in ['"\0"', '{"\0": 1}', 'undefined_name', 'vim']
: try
: let v=pyeval(e)
: catch
: let toput=e.":\t".v:exception[:13]
: $put =toput
: endtry
:endfor
:endfun
:"
:call Test()

View File

@@ -38,10 +38,18 @@ Vim(put):E684:
Vim(python):E725:
Vim(python):E117:
[0.0, 0.0]
IndexError
TypeError
TypeError
ValueError
TypeError
TypeError
[0, 1, 2]
['a', 'b']
['c', 1]
['d', ['e']]
Vim(let):E858:
Vim(let):E859:
0.0
"\0": Vim(let):E859:
{"\0": 1}: Vim(let):E859:
undefined_name: Vim(let):E858:
vim: Vim(let):E859:

View File

@@ -176,28 +176,62 @@ STARTTEST
:else
: $put ='[0.0, 0.0]'
:endif
:let messages=[]
:py3 <<EOF
d=vim.bindeval('{}')
m=vim.bindeval('messages')
try:
d['abc']
except Exception as e:
m.extend([e.__class__.__name__])
try:
d['abc']="\0"
except Exception as e:
m.extend([e.__class__.__name__])
try:
d['abc']=vim
except Exception as e:
m.extend([e.__class__.__name__])
try:
d['']=1
except Exception as e:
m.extend([e.__class__.__name__])
try:
d['a\0b']=1
except Exception as e:
m.extend([e.__class__.__name__])
try:
d[b'a\0b']=1
except Exception as e:
m.extend([e.__class__.__name__])
EOF
:$put =messages
:"
:" py3eval()
:let l=py3eval('[0, 1, 2]')
:$put =string(l)
:let d=py3eval('{"a": "b", "c": 1, "d": ["e"]}')
:$put =sort(items(d))
:try
: let undef=py3eval('undefined_name')
:catch
: $put =v:exception[:13]
:endtry
:try
: let vim=py3eval('vim')
:catch
: $put =v:exception[:13]
:endtry
:if has('float')
: let f=py3eval('0.0')
: $put =string(f)
:else
: $put ='0.0'
:endif
:" Invalid values:
:for e in ['"\0"', '{"\0": 1}', 'undefined_name', 'vim']
: try
: let v=py3eval(e)
: catch
: let toput=e.":\t".v:exception[:13]
: $put =toput
: endtry
:endfor
:endfun
:"
:call Test()

View File

@@ -38,10 +38,18 @@ Vim(put):E684:
Vim(py3):E725:
Vim(py3):E117:
[0.0, 0.0]
IndexError
TypeError
TypeError
ValueError
TypeError
TypeError
[0, 1, 2]
['a', 'b']
['c', 1]
['d', ['e']]
Vim(let):E860:
Vim(let):E861:
0.0
"\0": Vim(let):E861:
{"\0": 1}: Vim(let):E861:
undefined_name: Vim(let):E860:
vim: Vim(let):E861:

View File

@@ -719,6 +719,24 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
666,
/**/
665,
/**/
664,
/**/
663,
/**/
662,
/**/
661,
/**/
660,
/**/
659,
/**/
658,
/**/
657,
/**/