define HAVE_BROKEN_SWPRINTF_DECL for VC7.1 as while it does have the standard declaration its implementation is broken
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41208 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -201,7 +201,15 @@ bool WXDLLEXPORT wxOKlibc()
|
|||||||
// all compilers under Windows should have swprintf()
|
// all compilers under Windows should have swprintf()
|
||||||
#define HAVE_SWPRINTF
|
#define HAVE_SWPRINTF
|
||||||
#endif
|
#endif
|
||||||
#if defined(__WXWINCE__) || ( defined(__VISUALC__) && __VISUALC__ <= 1200 ) || defined(__GNUWIN32__)
|
|
||||||
|
// NB: MSVC 6 has only non-standard swprintf() declaration and while MSVC 7
|
||||||
|
// and 7.1 do have the standard one, it's completely broken unless
|
||||||
|
// /Zc:wchar_t is used while the other one works so use it instead, and
|
||||||
|
// only VC8 has a working standard-compliant swprintf()
|
||||||
|
#if defined(__WXWINCE__) || \
|
||||||
|
(defined(__VISUALC__) && __VISUALC__ < 1400) || \
|
||||||
|
defined(__GNUWIN32__) || \
|
||||||
|
defined(__BORLANDC__)
|
||||||
#define HAVE_BROKEN_SWPRINTF_DECL
|
#define HAVE_BROKEN_SWPRINTF_DECL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -394,7 +402,7 @@ bool wxPrintfConvSpec::Parse(const wxChar *format)
|
|||||||
#define CHECK_PREC \
|
#define CHECK_PREC \
|
||||||
if (in_prec && !prec_dot) \
|
if (in_prec && !prec_dot) \
|
||||||
{ \
|
{ \
|
||||||
m_szFlags[flagofs++] = '.'; \
|
m_szFlags[flagofs++] = wxT('.'); \
|
||||||
prec_dot = true; \
|
prec_dot = true; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -534,7 +542,7 @@ bool wxPrintfConvSpec::Parse(const wxChar *format)
|
|||||||
case wxT('X'):
|
case wxT('X'):
|
||||||
CHECK_PREC
|
CHECK_PREC
|
||||||
m_szFlags[flagofs++] = ch;
|
m_szFlags[flagofs++] = ch;
|
||||||
m_szFlags[flagofs] = '\0';
|
m_szFlags[flagofs] = wxT('\0');
|
||||||
if (ilen == 0)
|
if (ilen == 0)
|
||||||
m_type = wxPAT_INT;
|
m_type = wxPAT_INT;
|
||||||
else if (ilen == -1)
|
else if (ilen == -1)
|
||||||
@@ -562,7 +570,7 @@ bool wxPrintfConvSpec::Parse(const wxChar *format)
|
|||||||
case wxT('G'):
|
case wxT('G'):
|
||||||
CHECK_PREC
|
CHECK_PREC
|
||||||
m_szFlags[flagofs++] = ch;
|
m_szFlags[flagofs++] = ch;
|
||||||
m_szFlags[flagofs] = '\0';
|
m_szFlags[flagofs] = wxT('\0');
|
||||||
if (ilen == 2)
|
if (ilen == 2)
|
||||||
m_type = wxPAT_LONGDOUBLE;
|
m_type = wxPAT_LONGDOUBLE;
|
||||||
else
|
else
|
||||||
@@ -673,6 +681,10 @@ void wxPrintfConvSpec::ReplaceAsteriskWith(int width)
|
|||||||
int maxlen = (m_szFlags + wxMAX_SVNPRINTF_FLAGBUFFER_LEN - pwidth) / sizeof(wxChar);
|
int maxlen = (m_szFlags + wxMAX_SVNPRINTF_FLAGBUFFER_LEN - pwidth) / sizeof(wxChar);
|
||||||
int offset = system_sprintf(pwidth, maxlen, wxT("%d"), abs(width));
|
int offset = system_sprintf(pwidth, maxlen, wxT("%d"), abs(width));
|
||||||
|
|
||||||
|
#ifdef HAVE_BROKEN_SWPRINTF_DECL
|
||||||
|
wxUnusedVar(maxlen); // avoid dummy warnings
|
||||||
|
#endif
|
||||||
|
|
||||||
// restore after the expanded * what was following it
|
// restore after the expanded * what was following it
|
||||||
wxStrcpy(pwidth+offset, temp);
|
wxStrcpy(pwidth+offset, temp);
|
||||||
}
|
}
|
||||||
@@ -954,6 +966,10 @@ int wxPrintfConvSpec::Process(wxChar *buf, size_t lenMax, wxPrintfArg *p)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_BROKEN_SWPRINTF_DECL
|
||||||
|
wxUnusedVar(lenScratch); // avoid dummy warnings
|
||||||
|
#endif
|
||||||
|
|
||||||
// if we used system's sprintf() then we now need to append the s_szScratch
|
// if we used system's sprintf() then we now need to append the s_szScratch
|
||||||
// buffer to the given one...
|
// buffer to the given one...
|
||||||
switch (m_type)
|
switch (m_type)
|
||||||
|
Reference in New Issue
Block a user