more fixes to MSC

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8515 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-01-22 07:00:32 +00:00
commit 0ee6a0446a
6 changed files with 21 additions and 8 deletions

View file

@ -285,7 +285,7 @@ namespace swig
return swig::as<T>(item, true);
} catch (std::exception& e) {
char msg[1024];
snprintf(msg, sizeof(msg), "in sequence element %d ", _index);
sprintf(msg, "in sequence element %d ", _index);
if (!PyErr_Occurred()) {
%type_error(swig::type_name<T>());
}
@ -485,7 +485,7 @@ namespace swig
if (!swig::check<value_type>(item)) {
if (set_err) {
char msg[1024];
snprintf(msg, sizeof(msg), "in sequence element %d of type %s", i, swig::type_name<value_type>());
sprintf(msg, "in sequence element %d", i);
SWIG_Error(SWIG_RuntimeError, msg);
}
return false;

View file

@ -4,7 +4,10 @@
/* Add PyOS_snprintf for old Pythons */
#if PY_VERSION_HEX < 0x02020000
#define PyOS_snprintf snprintf
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
# define PyOS_snprintf _snprintf
#else
# define PyOS_snprintf snprintf
#endif
/* A crude PyString_FromFormat implementation for old Pythons */