Commit 2f48b562 authored by Sean McBride's avatar Sean McBride Committed by Kitware Robot
Browse files

Merge topic 'snprintf'

c5706062

 Uniformize Visual Studio snprintf workarounds
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !1647
parents 445361ed c5706062
......@@ -70,9 +70,7 @@
#endif /* EXODUSII_HAVE_MALLOC_H */
#if defined(_MSC_VER) && (_MSC_VER < 1900)
# define SNPRINTF _snprintf
#else
# define SNPRINTF snprintf
#define snprintf _snprintf
#endif
/// Define this to get printouts summarizing array glomming process
......@@ -4099,7 +4097,7 @@ int vtkExodusIIReaderPrivate::RequestInformation()
blockEntryFileOffset += binfo.Size;
if (binfo.Name.length() == 0)
{
SNPRINTF( tmpName, 255, "Unnamed block ID: %d Type: %s",
snprintf( tmpName, 255, "Unnamed block ID: %d Type: %s",
ids[obj], binfo.TypeName.length() ? binfo.TypeName.c_str() : "NULL");
binfo.Name = tmpName;
}
......@@ -4229,7 +4227,7 @@ int vtkExodusIIReaderPrivate::RequestInformation()
this->GetInitialObjectStatus(obj_types[i], &sinfo);
if (sinfo.Name.length() == 0)
{
SNPRINTF( tmpName, 255, "Unnamed set ID: %d", ids[obj]);
snprintf( tmpName, 255, "Unnamed set ID: %d", ids[obj]);
sinfo.Name = tmpName;
}
sortedObjects[sinfo.Id] = (int) this->SetInfo[obj_types[i]].size();
......@@ -4261,7 +4259,7 @@ int vtkExodusIIReaderPrivate::RequestInformation()
minfo.Name = obj_names[obj];
if (minfo.Name.length() == 0)
{ // make up a name. FIXME: Possible buffer overflow w/ sprintf
SNPRINTF( tmpName, 255, "Unnamed map ID: %d", ids[obj] );
snprintf( tmpName, 255, "Unnamed map ID: %d", ids[obj] );
minfo.Name = tmpName;
}
sortedObjects[minfo.Id] = (int) this->MapInfo[obj_types[i]].size();
......
......@@ -42,7 +42,7 @@
#include <sstream>
#if _MSC_VER && !defined(snprintf)
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define snprintf _snprintf
#endif
......
......@@ -27,7 +27,7 @@ extern "C" {
#include <setjmp.h>
}
#if _MSC_VER
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define snprintf _snprintf
#endif
......
......@@ -24,7 +24,7 @@
#include <vector>
#if _MSC_VER
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define snprintf _snprintf
#endif
......
......@@ -21,7 +21,7 @@
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtk_tiff.h"
#if _MSC_VER
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define snprintf _snprintf
#endif
......
......@@ -49,9 +49,7 @@
#include <cstdio> // for snprintf
#if defined(_MSC_VER) && (_MSC_VER < 1900)
# define SNPRINTF _snprintf
#else
# define SNPRINTF snprintf
#define snprintf _snprintf
#endif
#undef VTK_DBG_LAYOUT
......@@ -1329,7 +1327,7 @@ void vtkScalarBarActor::LayoutTicks()
}
}
SNPRINTF(string, 511, this->LabelFormat, val);
snprintf(string, 511, this->LabelFormat, val);
this->P->TextActors[i]->SetInput(string);
// Shallow copy here so that the size of the label prop is not affected
......
......@@ -41,9 +41,7 @@ PURPOSE. See the above copyright notice for more information.
#include "vtkViewport.h"
#if defined(_MSC_VER) && (_MSC_VER < 1900)
# define SNPRINTF _snprintf
#else
# define SNPRINTF snprintf
#define snprintf _snprintf
#endif
struct _xmlNode;
......@@ -2276,7 +2274,7 @@ void vtkXYPlotActor::PlaceAxes( vtkViewport *viewport, int *size,
switch( this->YTitlePosition )
{
case VTK_XYPLOT_Y_AXIS_TOP:
SNPRINTF( tmp, len, "%s", YTitleActor->GetInput() );
snprintf( tmp, len, "%s", YTitleActor->GetInput() );
textMapper->SetInput( tmp );
break;
case VTK_XYPLOT_Y_AXIS_HCENTER:
......
......@@ -50,9 +50,7 @@
using std::ofstream;
#if defined(_MSC_VER) && (_MSC_VER < 1900)
# define SNPRINTF _snprintf
#else
# define SNPRINTF snprintf
#define snprintf _snprintf
#endif
vtkStandardNewMacro(vtkDynamic2DLabelMapper);
......@@ -428,7 +426,7 @@ void vtkDynamic2DLabelMapper::RenderOpaqueGeometry(vtkViewport *viewport,
}
else // the user specified a label format
{
SNPRINTF(TempString, 1023, LiveFormatString,
snprintf(TempString, 1023, LiveFormatString,
stringData->GetValue(i).c_str());
ResultString = TempString;
} // done printing strings with label format
......
......@@ -47,9 +47,7 @@ vtkStandardNewMacro(vtkLabeledDataMapper);
vtkCxxSetObjectMacro(vtkLabeledDataMapper,Transform,vtkTransform);
#if defined(_MSC_VER) && (_MSC_VER < 1900)
# define SNPRINTF _snprintf
#else
# define SNPRINTF snprintf
#define snprintf _snprintf
#endif
// ----------------------------------------------------------------------
......@@ -612,7 +610,7 @@ void vtkLabeledDataMapper::BuildLabelsInternal(vtkDataSet* input)
}
else // the user specified a label format
{
SNPRINTF(TempString, 1023, LiveFormatString,
snprintf(TempString, 1023, LiveFormatString,
stringData->GetValue(i).c_str());
ResultString = TempString;
} // done printing strings with label format
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment