fixes resulting from non-standard usage of swprintf

[SVN r7927]
This commit is contained in:
John Maddock
2000-10-12 11:25:16 +00:00
parent 224cb764cf
commit 65b6a3ba3e
8 changed files with 131 additions and 205 deletions

View File

@ -29,16 +29,9 @@
#ifndef BOOST_RE_NO_WCHAR_H
#include <cwchar>
#endif
#ifndef BOOST_RE_NO_WCTYPE_H
#include <cwctype>
#endif
#include <cstring>
#include <cstdio>
#if defined(BOOST_RE_NO_SWPRINTF) && !defined(BOOST_RE_NO_WSPRINTF)
#include <widec.h>
#endif
namespace boost{
namespace {
@ -124,7 +117,7 @@ BOOST_RE_IX_DECL unsigned int BOOST_RE_CCALL regerrorW(int code, const regex_tW*
}
return result;
}
#if !defined(BOOST_RE_NO_SWPRINTF) || !defined(BOOST_RE_NO_WSPRINTF)
#if !defined(BOOST_RE_NO_SWPRINTF)
if(code == REG_ATOI)
{
wchar_t localbuf[5];
@ -134,21 +127,13 @@ BOOST_RE_IX_DECL unsigned int BOOST_RE_CCALL regerrorW(int code, const regex_tW*
{
if(std::wcscmp(e->re_endp, wnames[i]) == 0)
{
#if defined(BOOST_RE_NO_SWPRINTF)
wsprintf(localbuf, "%d", i);
#else
std::swprintf(localbuf, L"%d", i);
#endif
std::swprintf(localbuf, 5, L"%d", i);
if(std::wcslen(localbuf) < buf_size)
std::wcscpy(buf, localbuf);
return std::wcslen(localbuf) + 1;
}
}
#if defined(BOOST_RE_NO_SWPRINTF)
wsprintf(localbuf, "%d", 0);
#else
std::swprintf(localbuf, L"%d", 0);
#endif
std::swprintf(localbuf, 5, L"%d", 0);
if(std::wcslen(localbuf) < buf_size)
std::wcscpy(buf, localbuf);
return std::wcslen(localbuf) + 1;