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/07 14:30:21 UTC
cvs commit: xml-xalan/c/src/XPath FunctionTranslate.cpp
auriemma 00/11/07 05:30:19
Modified: c/src/XPath FunctionTranslate.cpp
Log:
Merged string class changes from hpp to cpp.
Revision Changes Path
1.2 +15 -5 xml-xalan/c/src/XPath/FunctionTranslate.cpp
Index: FunctionTranslate.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionTranslate.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FunctionTranslate.cpp 2000/11/06 19:49:15 1.1
+++ FunctionTranslate.cpp 2000/11/07 13:30:17 1.2
@@ -88,13 +88,15 @@
const unsigned int theSecondStringLength = length(theSecondString);
const unsigned int theThirdStringLength = length(theThirdString);
-#if !defined(XALAN_NO_NAMESPACES)
- using std::vector;
+#if defined(XALAN_NO_NAMESPACES)
+ typedef vector<XalanDOMChar> VectorType;
+#else
+ typedef std::vector<XalanDOMChar> VectorType;
#endif
// A vector to contain the new characters. We'll use it to construct
// the result string.
- vector<XalanDOMChar> theBuffer;
+ VectorType theBuffer;
// The result string can only be as large as the first string, so
// just reserve the space now. Also reserve space for the
@@ -129,8 +131,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));
+ }
}