Revision: 52936
http://brlcad.svn.sourceforge.net/brlcad/?rev=52936&view=rev
Author: brlcad
Date: 2012-10-10 07:07:36 +0000 (Wed, 10 Oct 2012)
Log Message:
-----------
avoid throwing exceptions due to max() being bigger than actually supported.
seems like an stl exception bug given it throws a length_error exception and
the parameter is supposed to default to the value we're setting, but work
around it anyways. we just set npos and avoid specifying a constructor limit
if the value is npos.
Modified Paths:
--------------
brlcad/trunk/src/other/step/src/cldai/sdaiString.cc
brlcad/trunk/src/other/step/src/cldai/sdaiString.h
Modified: brlcad/trunk/src/other/step/src/cldai/sdaiString.cc
===================================================================
--- brlcad/trunk/src/other/step/src/cldai/sdaiString.cc 2012-10-10 07:04:33 UTC
(rev 52935)
+++ brlcad/trunk/src/other/step/src/cldai/sdaiString.cc 2012-10-10 07:07:36 UTC
(rev 52936)
@@ -13,16 +13,25 @@
#include <sstream>
#include "scl_memmgr.h"
-SDAI_String::SDAI_String( const char * str, size_t max ) {
- content = std::string( str, max );
+SDAI_String::SDAI_String( const char * str, size_t max )
+{
+ if (!str)
+ str = "";
+
+ if (max == std::string::npos)
+ content = std::string(str);
+ else
+ content = std::string(str, max);
}
-SDAI_String::SDAI_String( const std::string & s ) {
- content = std::string( s );
+SDAI_String::SDAI_String( const std::string & s )
+ : content(std::string( s ))
+{
}
-SDAI_String::SDAI_String( const SDAI_String & s ) {
- content = std::string( s.c_str() );
+SDAI_String::SDAI_String( const SDAI_String & s )
+ : content(std::string(s.c_str()))
+{
}
SDAI_String::~SDAI_String( void ) {
Modified: brlcad/trunk/src/other/step/src/cldai/sdaiString.h
===================================================================
--- brlcad/trunk/src/other/step/src/cldai/sdaiString.h 2012-10-10 07:04:33 UTC
(rev 52935)
+++ brlcad/trunk/src/other/step/src/cldai/sdaiString.h 2012-10-10 07:07:36 UTC
(rev 52936)
@@ -21,7 +21,7 @@
public:
//constructor(s) & destructor
- SDAI_String( const char * str = 0, size_t max =
std::numeric_limits<std::size_t>::max() );
+ SDAI_String( const char * str = "", size_t max = std::string::npos);
SDAI_String( const std::string & s );
SDAI_String( const SDAI_String & s );
~SDAI_String( void );
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits