Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2013-11-29 00:26:55 +0400
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2013-11-29 00:35:28 +0400
commit19a41e5a1095504a524333879593b8945fe8ea06 (patch)
treea87097ad414fc186195f58c2fa445c44a92b5ae3 /intern/itasc/kdl/tree.hpp
parent28a2d5e2648c304cd47ce70cf698889cbb87a90f (diff)
Fix iTaSC build error when building with libc++.
This was using TreeElement before it was fully defined, which gives undefined behavior that happened to work with other libraries but not libc++. Based on patch by Marcus von Appen, modifications for brevity and to ensure we don't dereference invalid memory. Ref T37477.
Diffstat (limited to 'intern/itasc/kdl/tree.hpp')
-rw-r--r--intern/itasc/kdl/tree.hpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/intern/itasc/kdl/tree.hpp b/intern/itasc/kdl/tree.hpp
index 82794f96b94..8f971200969 100644
--- a/intern/itasc/kdl/tree.hpp
+++ b/intern/itasc/kdl/tree.hpp
@@ -41,32 +41,28 @@ namespace KDL
{
//Forward declaration
class TreeElement;
-#if defined(__APPLE__)
-# if MAC_OS_X_VERSION_MIN_REQUIRED <= 1050
+#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1050
typedef std::map<std::string,TreeElement> SegmentMap;
-# else
- // Eigen allocator is needed for alignment of Eigen data types
- typedef std::map<std::string,TreeElement, std::less<std::string>, Eigen::aligned_allocator<std::pair<std::string, TreeElement> > > SegmentMap;
-# endif /* MAC_OS_X_VERSION_MIN_REQUIRED */
#else
// Eigen allocator is needed for alignment of Eigen data types
typedef std::map<std::string,TreeElement, std::less<std::string>, Eigen::aligned_allocator<std::pair<std::string, TreeElement> > > SegmentMap;
#endif
+
class TreeElement
{
public:
- TreeElement():q_nr(0)
+ TreeElement():q_nr(0),parent(0)
{};
public:
Segment segment;
unsigned int q_nr;
- SegmentMap::const_iterator parent;
+ SegmentMap::value_type const *parent;
std::vector<SegmentMap::const_iterator > children;
- TreeElement(const Segment& segment_in,const SegmentMap::const_iterator& parent_in,unsigned int q_nr_in)
+ TreeElement(const Segment& segment_in,const SegmentMap::value_type& parent_in,unsigned int q_nr_in)
{
q_nr=q_nr_in;
segment=segment_in;
- parent=parent_in;
+ parent=&parent_in;
};
static TreeElement Root()
{
@@ -167,7 +163,15 @@ namespace KDL
return segments.find(segment_name);
};
+ SegmentMap::value_type const* getSegmentPtr(const std::string& segment_name)const
+ {
+ SegmentMap::const_iterator it = segments.find(segment_name);
+
+ if (it == segments.end())
+ return 0;
+ return &*it;
+ };
const SegmentMap& getSegments()const
{