From: oan Date: Mon, 16 Jan 2023 11:59:08 +0000 (+0300) Subject: 0028089: Mesh - New algorithm for triangulation of 2d polygons X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=d44ac07d7bb3c27238fff0b1b7815657ad291262;p=occt.git 0028089: Mesh - New algorithm for triangulation of 2d polygons Added Vsprintf() wrapper for vsprintf() preserving C locale. --- diff --git a/src/Standard/Standard_CString.cxx b/src/Standard/Standard_CString.cxx index dc0a2223a1..ac0a8f98cf 100755 --- a/src/Standard/Standard_CString.cxx +++ b/src/Standard/Standard_CString.cxx @@ -129,3 +129,9 @@ int Sprintf (char* theBuffer, const char* theFormat, ...) va_end(argp); return result; } + +int Vsprintf (char* theBuffer, const char* theFormat, va_list theArgList) +{ + SAVE_TL(); + return vsprintf_l(theBuffer, Standard_CLocaleSentry::GetCLocale(), theFormat, theArgList); +} diff --git a/src/Standard/Standard_CString.hxx b/src/Standard/Standard_CString.hxx index f28414f0bd..ea999b65e8 100644 --- a/src/Standard/Standard_CString.hxx +++ b/src/Standard/Standard_CString.hxx @@ -51,6 +51,15 @@ __Standard_API int Printf (const char* theFormat, ...); __Standard_API int Fprintf (FILE* theFile, const char* theFormat, ...); __Standard_API int Sprintf (char* theBuffer, const char* theFormat, ...); +//! Equivalent of standard C function vsprintf() that always uses C locale. +//! Note that this function does not check buffer bounds and should be used with precaution measures +//! (only with format fitting into the buffer of known size). +//! @param theBuffer [in] [out] string buffer to fill +//! @param theFormat [in] format to apply +//! @param theArgList [in] argument list for specified format +//! @return the total number of characters written, or a negative number on error +Standard_EXPORT int Vsprintf (char* theBuffer, const char* theFormat, va_list theArgList); + //============================================================================ //==== IsEqual : Returns Standard_True if two booleans have the same value //============================================================================