auriemma 00/11/07 06:00:56
Modified: c/src/XPath FunctionSubstring.cpp
Log:
Merged string class changes from hpp to cpp.
Revision Changes Path
1.2 +15 -5 xml-xalan/c/src/XPath/FunctionSubstring.cpp
Index: FunctionSubstring.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionSubstring.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FunctionSubstring.cpp 2000/11/06 19:49:15 1.1
+++ FunctionSubstring.cpp 2000/11/07 14:00:55 1.2
@@ -83,12 +83,14 @@
const XalanDOMString& theSourceString = arg1->str();
const unsigned int theSourceStringLength =
length(theSourceString);
-#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 (theSourceStringLength > 0)
{
@@ -138,8 +140,16 @@
}
}
- 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));
+ }
}