From acbe8ee5cdabb8c46e704ceb68fee4db464ed16f Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Thu, 23 Mar 2017 15:10:47 -0700 Subject: [PATCH] remove use of snprint, fixes Issue 1037 --- examples/ExampleBrowser/CMakeLists.txt | 3 +-- examples/ExampleBrowser/main.cpp | 2 -- .../Importers/ImportMJCFDemo/BulletMJCFImporter.cpp | 8 ++++++++ examples/Importers/ImportURDFDemo/UrdfParser.cpp | 10 ++++++++++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/examples/ExampleBrowser/CMakeLists.txt b/examples/ExampleBrowser/CMakeLists.txt index 127ab11f5..de69074ed 100644 --- a/examples/ExampleBrowser/CMakeLists.txt +++ b/examples/ExampleBrowser/CMakeLists.txt @@ -378,12 +378,11 @@ ADD_EXECUTABLE(App_ExampleBrowser ${BulletExampleBrowser_SRCS} ) -FILE( MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/data" ) ADD_CUSTOM_COMMAND( TARGET App_ExampleBrowser 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) diff --git a/examples/ExampleBrowser/main.cpp b/examples/ExampleBrowser/main.cpp index 0395fcbd9..46bbd2b0b 100644 --- a/examples/ExampleBrowser/main.cpp +++ b/examples/ExampleBrowser/main.cpp @@ -1,5 +1,3 @@ - - #include "OpenGLExampleBrowser.h" #include "Bullet3Common/b3CommandLineArgs.h" diff --git a/examples/Importers/ImportMJCFDemo/BulletMJCFImporter.cpp b/examples/Importers/ImportMJCFDemo/BulletMJCFImporter.cpp index 563c657a4..17f77631c 100644 --- a/examples/Importers/ImportMJCFDemo/BulletMJCFImporter.cpp +++ b/examples/Importers/ImportMJCFDemo/BulletMJCFImporter.cpp @@ -173,9 +173,17 @@ struct BulletMJCFImporterInternalData std::string sourceFileLocation(TiXmlElement* e) { +#if 0 + //no C++11 snprintf etc char buf[1024]; snprintf(buf, sizeof(buf), "%s:%i", m_sourceFileName.c_str(), e->Row()); 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 diff --git a/examples/Importers/ImportURDFDemo/UrdfParser.cpp b/examples/Importers/ImportURDFDemo/UrdfParser.cpp index 0b42eb2c9..53857c6c2 100644 --- a/examples/Importers/ImportURDFDemo/UrdfParser.cpp +++ b/examples/Importers/ImportURDFDemo/UrdfParser.cpp @@ -1679,7 +1679,17 @@ bool UrdfParser::loadSDF(const char* sdfText, ErrorLogger* logger) std::string UrdfParser::sourceFileLocation(TiXmlElement* e) { +#if 0 + //no C++11 etc, no snprintf + char buf[1024]; snprintf(buf, sizeof(buf), "%s:%i", m_urdf2Model.m_sourceFile.c_str(), e->Row()); 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 + }