Skip to content

Commit

Permalink
Merge pull request #521 from dartsim/uri_api
Browse files Browse the repository at this point in the history
Fix segfault of rigidShapes app
  • Loading branch information
jslee02 committed Oct 15, 2015
2 parents 24ebfc0 + 39aaf6d commit cd1b7c7
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 6 deletions.
28 changes: 28 additions & 0 deletions dart/common/Uri.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,23 @@ Uri Uri::createFromRelativeUri(const std::string& _base,
return mergedUri;
}

//==============================================================================
Uri Uri::createFromRelativeUri(const Uri& _base,
const std::string& _relative, bool _strict)
{
Uri mergedUri;
if(!mergedUri.fromRelativeUri(_base, _relative, _strict))
{
dtwarn << "[Uri::createFromRelativeUri] Failed merging URI '" << _relative
<< "' with base URI '" << _base.toString() << "'.\n";
}

// We don't need to clear mergedUri since fromRelativeUri() does not set any
// component on failure.

return mergedUri;
}

//==============================================================================
Uri Uri::createFromRelativeUri(const Uri& _baseUri,
const Uri& _relativeUri, bool _strict)
Expand Down Expand Up @@ -541,6 +558,17 @@ std::string Uri::getRelativeUri(
return mergedUri.toString();
}

//==============================================================================
std::string Uri::getRelativeUri(
const Uri& _base, const std::string& _relative, bool _strict)
{
Uri mergedUri;
if(!mergedUri.fromRelativeUri(_base, _relative, _strict))
return "";
else
return mergedUri.toString();
}

//==============================================================================
std::string Uri::getRelativeUri(
const Uri& _baseUri, const Uri& _relativeUri, bool _strict)
Expand Down
11 changes: 11 additions & 0 deletions dart/common/Uri.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ struct Uri final
const std::string& _relative,
bool _strict = false);

/// Create URI resolving a relative path reference; return an empty URI on
/// failure.
static Uri createFromRelativeUri(const Uri& _base,
const std::string& _relative,
bool _strict = false);

/// Create URI resolving a relative path reference; return an empty URI on
/// failure.
static Uri createFromRelativeUri(const Uri& _base,
Expand All @@ -195,6 +201,11 @@ struct Uri final
const std::string& _relative,
bool _strict = false);

/// Resolve a relative path reference; return an empty string on failure.
static std::string getRelativeUri(const Uri& _base,
const std::string& _relative,
bool _strict = false);

/// Resolve a relative path reference; return an empty string on failure.
static std::string getRelativeUri(const Uri& _base,
const Uri& _relative,
Expand Down
2 changes: 0 additions & 2 deletions data/obj/Body_Hip.obj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Blender3D v249 OBJ File:
# www.blender3d.org
mtllib Body_Hip.mtl
v 0.000000 0.000000 0.000000
v 0.017500 -0.009750 -0.136500
v -0.009700 -0.009750 -0.136500
Expand Down Expand Up @@ -10676,7 +10675,6 @@ v -0.088194 -0.004910 0.060807
v -0.088854 -0.005907 0.059665
v -0.089512 -0.006906 0.058525
v -0.088594 -0.007304 0.058072
usemtl Material.001
s 1
f 3 5 2
f 2 5 9
Expand Down
2 changes: 0 additions & 2 deletions data/obj/BoxSmall.obj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Blender3D v249 OBJ File:
# www.blender3d.org
mtllib BoxSmall.mtl
v 0.02000 -0.02000 -0.02000
v 0.02000 -0.02000 0.02000
v -0.02000 -0.02000 0.02000
Expand All @@ -9,7 +8,6 @@ v 0.02000 0.02000 -0.02000
v 0.02000 0.02000 0.02000
v -0.02000 0.02000 0.02000
v -0.02000 0.02000 -0.02000
usemtl Material
s off
f 5 1 4
f 5 4 8
Expand Down
2 changes: 0 additions & 2 deletions data/obj/foot.obj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Blender3D v249 OBJ File:
# www.blender3d.org
mtllib Body_LAR.mtl
v 0.069500 -0.094390 -0.067470
v 0.069500 -0.094480 -0.067200
v 0.069490 -0.094480 -0.067260
Expand Down Expand Up @@ -5070,7 +5069,6 @@ v 0.069040 -0.094480 -0.070000
v 0.068930 -0.094480 -0.069720
v 0.068770 -0.094480 -0.069470
v 0.068560 -0.094480 -0.069260
usemtl Material_001
s off
f 28 1 29
f 29 1 2
Expand Down

0 comments on commit cd1b7c7

Please sign in to comment.