diff --git a/rdf/base/src/rdfutil.cpp b/rdf/base/src/rdfutil.cpp index f5aeb926610b..3aa9b5d85aa0 100644 --- a/rdf/base/src/rdfutil.cpp +++ b/rdf/base/src/rdfutil.cpp @@ -75,34 +75,17 @@ rdf_MakeRelativeRef(const nsString& aBaseURI, nsString& aURI) // This implementation is extremely simple: e.g., it can't compute // relative paths, or anything fancy like that. If the context URI // is not a prefix of the URI in question, we'll just bail. - if (aURI.Find(aBaseURI) != 0) - return NS_OK; + PRUint32 prefixLen = aBaseURI.Length(); + if (prefixLen && Substring(aURI, 0, prefixLen) == aBaseURI) { + if (prefixLen < aURI.Length() && aURI.CharAt(prefixLen) == '/') + ++prefixLen; // chop the leading slash so it's not `absolute' - // Otherwise, pare down the target URI, removing the context URI. - aURI.Cut(0, aBaseURI.Length()); - - if (aURI.First() == '/') - aURI.Cut(0, 1); + aURI.Cut(0, prefixLen); + } return NS_OK; } - -nsresult -rdf_MakeRelativeName(const nsString& aBaseURI, nsString& aURI) -{ - nsresult rv; - - rv = rdf_MakeRelativeRef(aBaseURI, aURI); - if (NS_FAILED(rv)) return rv; - - if (aURI.First() == '#') - aURI.Cut(0, 1); - - return NS_OK; -} - - static PRBool rdf_RequiresAbsoluteURI(const nsString& uri) { diff --git a/rdf/base/src/rdfutil.h b/rdf/base/src/rdfutil.h index 4d0482e66b33..7849c85d20f0 100644 --- a/rdf/base/src/rdfutil.h +++ b/rdf/base/src/rdfutil.h @@ -64,9 +64,6 @@ class nsIURI; nsresult rdf_MakeRelativeRef(const nsString& aBaseURI, nsString& aURI); -nsresult -rdf_MakeRelativeName(const nsString& aBaseURI, nsString& aURI); - nsresult rdf_MakeAbsoluteURI(const nsString& aBaseURI, nsString& aURI); diff --git a/rdf/build/dlldeps.cpp b/rdf/build/dlldeps.cpp index d9822cc05db9..1808d4aadf05 100644 --- a/rdf/build/dlldeps.cpp +++ b/rdf/build/dlldeps.cpp @@ -56,7 +56,6 @@ void XXXNeverCalled() // rdfutils rdf_MakeRelativeRef(s, s); - rdf_MakeRelativeName(s, s); rdf_MakeAbsoluteURI(s, s); rdf_MakeAbsoluteURI(s, cStr);