--- sax/source/expatwrap/saxwriter.cxx.old 2005-09-08 14:05:06.000000000 +0200 +++ sax/source/expatwrap/saxwriter.cxx 2006-06-21 13:58:54.000000000 +0200 @@ -455,7 +455,7 @@ inline sal_Bool SaxWriterHelper::convert sal_Int8(0x80 | ((nSurrogate >> 6) & 0x3F)), sal_Int8(0x80 | ((nSurrogate >> 0) & 0x3F)) }; if ((rPos + 4) > SEQUENCESIZE) - AddBytes(pTarget, rPos, aBytes, 3); + AddBytes(pTarget, rPos, aBytes, 4); else { pTarget[rPos] = aBytes[0]; @@ -565,6 +565,8 @@ inline void SaxWriterHelper::insertInden } else { + if (nCurrentPos == SEQUENCESIZE) + nCurrentPos = writeSequence(); mp_Sequence[nCurrentPos] = LINEFEED; nLastLineFeedPos = nCurrentPos; nCurrentPos++; @@ -590,22 +592,20 @@ inline void SaxWriterHelper::startDocume { const char pc[] = ""; const int nLen = strlen( pc ); - if ((nCurrentPos + nLen + 1) <= SEQUENCESIZE) + if ((nCurrentPos + nLen) <= SEQUENCESIZE) { memcpy( mp_Sequence, pc , nLen ); nCurrentPos += nLen; - mp_Sequence[nCurrentPos] = LINEFEED; - nCurrentPos++; } else - { AddBytes(mp_Sequence, nCurrentPos, (sal_Int8*)pc, nLen); - OSL_ENSURE(nCurrentPos <= SEQUENCESIZE, "not reset current position"); - if (nCurrentPos == SEQUENCESIZE) - nCurrentPos = writeSequence(); - mp_Sequence[nCurrentPos] = LINEFEED; - nCurrentPos++; - } + + OSL_ENSURE(nCurrentPos <= SEQUENCESIZE, "not reset current position"); + if (nCurrentPos == SEQUENCESIZE) + nCurrentPos = writeSequence(); + mp_Sequence[nCurrentPos] = LINEFEED; + nCurrentPos++; + if (nCurrentPos == SEQUENCESIZE) nCurrentPos = writeSequence(); }