remove use of snprint, fixes Issue 1037

This commit is contained in:
Erwin Coumans
2017-03-23 15:10:47 -07:00
parent 0a654c2d58
commit acbe8ee5cd
4 changed files with 19 additions and 4 deletions

View File

@@ -378,12 +378,11 @@ ADD_EXECUTABLE(App_ExampleBrowser
${BulletExampleBrowser_SRCS} ${BulletExampleBrowser_SRCS}
) )
FILE( MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/data" )
ADD_CUSTOM_COMMAND( ADD_CUSTOM_COMMAND(
TARGET App_ExampleBrowser TARGET App_ExampleBrowser
POST_BUILD POST_BUILD
COMMAND ${CMAKE_COMMAND} ARGS -E copy_directory ${BULLET_PHYSICS_SOURCE_DIR}/data ${PROJECT_BINARY_DIR}/data COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink ${BULLET_PHYSICS_SOURCE_DIR}/data ${PROJECT_BINARY_DIR}/data
) )
IF (BULLET2_MULTITHREADED_TBB_DEMO AND WIN32) IF (BULLET2_MULTITHREADED_TBB_DEMO AND WIN32)

View File

@@ -1,5 +1,3 @@
#include "OpenGLExampleBrowser.h" #include "OpenGLExampleBrowser.h"
#include "Bullet3Common/b3CommandLineArgs.h" #include "Bullet3Common/b3CommandLineArgs.h"

View File

@@ -173,9 +173,17 @@ struct BulletMJCFImporterInternalData
std::string sourceFileLocation(TiXmlElement* e) std::string sourceFileLocation(TiXmlElement* e)
{ {
#if 0
//no C++11 snprintf etc
char buf[1024]; char buf[1024];
snprintf(buf, sizeof(buf), "%s:%i", m_sourceFileName.c_str(), e->Row()); snprintf(buf, sizeof(buf), "%s:%i", m_sourceFileName.c_str(), e->Row());
return buf; return buf;
#else
char row[1024];
sprintf(row,"%d",e->Row());
std::string str = m_sourceFileName.c_str() + std::string(":") + std::string(row);
return str;
#endif
} }
const UrdfLink* getLink(int modelIndex, int linkIndex) const const UrdfLink* getLink(int modelIndex, int linkIndex) const

View File

@@ -1679,7 +1679,17 @@ bool UrdfParser::loadSDF(const char* sdfText, ErrorLogger* logger)
std::string UrdfParser::sourceFileLocation(TiXmlElement* e) std::string UrdfParser::sourceFileLocation(TiXmlElement* e)
{ {
#if 0
//no C++11 etc, no snprintf
char buf[1024]; char buf[1024];
snprintf(buf, sizeof(buf), "%s:%i", m_urdf2Model.m_sourceFile.c_str(), e->Row()); snprintf(buf, sizeof(buf), "%s:%i", m_urdf2Model.m_sourceFile.c_str(), e->Row());
return buf; return buf;
#else
char row[1024];
sprintf(row,"%d",e->Row());
std::string str = m_urdf2Model.m_sourceFile.c_str() + std::string(":") + std::string(row);
return str;
#endif
} }