knoaman 2002/12/03 07:31:20
Modified: c/src/xercesc/internal XMLReader.hpp XMLReader.cpp
ReaderMgr.hpp ReaderMgr.cpp
Log:
Enable/disable calculation of src offset.
Revision Changes Path
1.9 +7 -0 xml-xerces/c/src/xercesc/internal/XMLReader.hpp
Index: XMLReader.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/XMLReader.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XMLReader.hpp 2 Dec 2002 17:20:05 -0000 1.8
+++ XMLReader.hpp 3 Dec 2002 15:31:19 -0000 1.9
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.9 2002/12/03 15:31:19 knoaman
+ * Enable/disable calculation of src offset.
+ *
* Revision 1.8 2002/12/02 17:20:05 knoaman
* Remove unused data member.
*
@@ -262,6 +265,7 @@
, const Types type
, const Sources source
, const bool throwAtEnd = false
+ , const bool calculateSrcOfs = true
);
XMLReader
@@ -274,6 +278,7 @@
, const Types type
, const Sources source
, const bool throwAtEnd = false
+ , const bool calculateSrcOfs = true
);
XMLReader
@@ -286,6 +291,7 @@
, const Types type
, const Sources source
, const bool throwAtEnd = false
+ , const bool calculateSrcOfs = true
);
~XMLReader();
@@ -564,6 +570,7 @@
Sources fSource;
unsigned int fSrcOfsBase;
bool fSrcOfsSupported;
+ bool fCalculateSrcOfs;
XMLCh* fSystemId;
BinInputStream* fStream;
bool fSwapped;
1.10 +15 -7 xml-xerces/c/src/xercesc/internal/XMLReader.cpp
Index: XMLReader.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/XMLReader.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- XMLReader.cpp 2 Dec 2002 17:20:05 -0000 1.9
+++ XMLReader.cpp 3 Dec 2002 15:31:19 -0000 1.10
@@ -169,7 +169,8 @@
, const RefFrom from
, const Types type
, const Sources source
- , const bool throwAtEnd) :
+ , const bool throwAtEnd
+ , const bool calculateSrcOfs) :
fCharIndex(0)
, fCharsAvail(0)
, fCurCol(1)
@@ -186,6 +187,7 @@
, fSource(source)
, fSrcOfsBase(0)
, fSrcOfsSupported(false)
+ , fCalculateSrcOfs(calculateSrcOfs)
, fStream(streamToAdopt)
, fSystemId(XMLString::replicate(sysId))
, fSwapped(false)
@@ -242,7 +244,8 @@
, const RefFrom from
, const Types type
, const Sources source
- , const bool throwAtEnd) :
+ , const bool throwAtEnd
+ , const bool calculateSrcOfs) :
fCharIndex(0)
, fCharsAvail(0)
, fCurCol(1)
@@ -260,6 +263,7 @@
, fSource(source)
, fSrcOfsBase(0)
, fSrcOfsSupported(false)
+ , fCalculateSrcOfs(calculateSrcOfs)
, fStream(streamToAdopt)
, fSystemId(XMLString::replicate(sysId))
, fSwapped(false)
@@ -353,7 +357,8 @@
, const RefFrom from
, const Types type
, const Sources source
- , const bool throwAtEnd) :
+ , const bool throwAtEnd
+ , const bool calculateSrcOfs) :
fCharIndex(0)
, fCharsAvail(0)
, fCurCol(1)
@@ -371,6 +376,7 @@
, fSource(source)
, fSrcOfsBase(0)
, fSrcOfsSupported(false)
+ , fCalculateSrcOfs(calculateSrcOfs)
, fStream(streamToAdopt)
, fSystemId(XMLString::replicate(sysId))
, fSwapped(false)
@@ -447,7 +453,7 @@
// ---------------------------------------------------------------------------
unsigned int XMLReader::getSrcOffset() const
{
- if (!fSrcOfsSupported)
+ if (!fSrcOfsSupported || !fCalculateSrcOfs)
ThrowXML(RuntimeException, XMLExcepts::Reader_SrcOfsNotSupported);
//
@@ -515,8 +521,10 @@
// Add the number of source bytes eaten so far to the base src
// offset member.
//
- for (startInd = 0; startInd < fCharIndex; startInd++)
- fSrcOfsBase += fCharSizeBuf[startInd];
+ if (fCalculateSrcOfs) {
+ for (startInd = 0; startInd < fCharIndex; startInd++)
+ fSrcOfsBase += fCharSizeBuf[startInd];
+ }
//
// If there are spare chars, then move then down to the bottom. We
1.5 +7 -0 xml-xerces/c/src/xercesc/internal/ReaderMgr.hpp
Index: ReaderMgr.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/ReaderMgr.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ReaderMgr.hpp 4 Nov 2002 14:58:18 -0000 1.4
+++ ReaderMgr.hpp 3 Dec 2002 15:31:19 -0000 1.5
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.5 2002/12/03 15:31:19 knoaman
+ * Enable/disable calculation of src offset.
+ *
* Revision 1.4 2002/11/04 14:58:18 tng
* C++ Namespace Support.
*
@@ -218,6 +221,7 @@
, const XMLReader::RefFrom refFrom
, const XMLReader::Types type
, const XMLReader::Sources source
+ , const bool calcSrsOfs = true
);
XMLReader* createReader
(
@@ -228,6 +232,7 @@
, const XMLReader::Types type
, const XMLReader::Sources source
, InputSource*& srcToFill
+ , const bool calcSrcOfs = true
);
XMLReader* createReader
(
@@ -239,6 +244,7 @@
, const XMLReader::Types type
, const XMLReader::Sources source
, InputSource*& srcToFill
+ , const bool calcSrcOfs = true
);
XMLReader* createIntEntReader
(
@@ -248,6 +254,7 @@
, const XMLCh* const dataBuf
, const unsigned int dataLen
, const bool copyBuf
+ , const bool calcSrcOfs = true
);
bool isScanningPERefOutOfLiteral() const;
bool pushReader
1.8 +17 -5 xml-xerces/c/src/xercesc/internal/ReaderMgr.cpp
Index: ReaderMgr.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/ReaderMgr.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ReaderMgr.cpp 25 Nov 2002 21:31:08 -0000 1.7
+++ ReaderMgr.cpp 3 Dec 2002 15:31:19 -0000 1.8
@@ -411,7 +411,8 @@
, const bool xmlDecl
, const XMLReader::RefFrom refFrom
, const XMLReader::Types type
- , const XMLReader::Sources source)
+ , const XMLReader::Sources source
+ , const bool calcSrcOfs)
{
//
// Ask the input source to create us an input stream. The particular
@@ -447,6 +448,8 @@
, refFrom
, type
, source
+ , false
+ , calcSrcOfs
);
}
else
@@ -459,6 +462,8 @@
, refFrom
, type
, source
+ , false
+ , calcSrcOfs
);
}
}
@@ -487,7 +492,8 @@
, const XMLReader::RefFrom refFrom
, const XMLReader::Types type
, const XMLReader::Sources source
- , InputSource*& srcToFill)
+ , InputSource*& srcToFill
+ , const bool calcSrcOfs)
{
// Create a buffer for expanding the system id
XMLBuffer expSysId;
@@ -565,6 +571,7 @@
, refFrom
, type
, source
+ , calcSrcOfs
);
// Either way, we can release the input source now
@@ -587,7 +594,8 @@
, const XMLReader::RefFrom refFrom
, const XMLReader::Types type
, const XMLReader::Sources source
- , InputSource*& srcToFill)
+ , InputSource*& srcToFill
+ , const bool calcSrcOfs)
{
// Create a buffer for expanding the system id
XMLBuffer expSysId;
@@ -666,6 +674,7 @@
, refFrom
, type
, source
+ , calcSrcOfs
);
// Either way, we can release the input source now
@@ -687,7 +696,8 @@
, const XMLReader::Types type
, const XMLCh* const dataBuf
, const unsigned int dataLen
- , const bool copyBuf)
+ , const bool copyBuf
+ , const bool calcSrcOfs)
{
//
// This one is easy, we just create an input stream for the data and
@@ -716,6 +726,8 @@
, refFrom
, type
, XMLReader::Source_Internal
+ , false
+ , calcSrcOfs
);
// If it failed for any reason, then return zero.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]