You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by au...@locus.apache.org on 2000/11/06 23:21:29 UTC
cvs commit: xml-xalan/c/src/XPath FunctionSubstringBefore.cpp
auriemma 00/11/06 14:21:28
Modified: c/src/XPath FunctionSubstringBefore.cpp
Log:
Merged string class changes from hpp to cpp.
Revision Changes Path
1.2 +16 -5 xml-xalan/c/src/XPath/FunctionSubstringBefore.cpp
Index: FunctionSubstringBefore.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionSubstringBefore.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FunctionSubstringBefore.cpp 2000/11/06 19:49:15 1.1
+++ FunctionSubstringBefore.cpp 2000/11/06 22:21:25 1.2
@@ -85,12 +85,14 @@
const unsigned int theIndex = indexOf(theFirstString,
theSecondString);
-#if !defined(XALAN_NO_NAMESPACES)
- using std::vector;
+#if defined(XALAN_NO_NAMESPACES)
+ typedef vector<XalanDOMChar> VectorType;
+#else
+ typedef std::vector<XalanDOMChar> VectorType;
#endif
// This buffer will hold the output characters.
- vector<XalanDOMChar> theBuffer;
+ VectorType theBuffer;
if (theIndex < length(theFirstString))
{
@@ -106,8 +108,17 @@
}
}
- return executionContext.getXObjectFactory().createString(
- XalanDOMString(theBuffer.begin(), theBuffer.size()));
+ const VectorType::size_type theSize = theBuffer.size();
+
+ if (theSize == 0)
+ {
+ return executionContext.getXObjectFactory().createString(XalanDOMString());
+ }
+ else
+ {
+ return executionContext.getXObjectFactory().createString(XalanDOMString(
+ theBuffer.begin(), theSize));
+ }
}