| ||||||||
CMarkup Known IssuesBugs found in previous releases of CMarkup are already fixed but the notices and fixes remain here for users who are still working with old releases. The great thing about a source code product is that you can fix the bug right in your program and be done with it, no temporary work-arounds, no waiting for the next release. 7.0-9.0 Issue: Memory checkers report uninitialized variable IBM Rational Purify and Boundschecker may complain that Fix: The changes are only in Markup.h in int StartTagLen() const { return nStartTagLen; };
void SetStartTagLen( int n ) { nStartTagLen = n; };
void AdjustStartTagLen( int n ) { nStartTagLen += n; };
int EndTagLen() const { return nEndTagLen; };
void SetEndTagLen( int n ) { nEndTagLen = n; };
Then a few lines below, replace the unsigned int nStartTagLen : 22; // 4MB limit for start tag unsigned int nEndTagLen : 10; // 1K limit for end tag 8.2 Bug: SavePos/RestorePos with non-ASCII names (fixed in 8.3) A report of a crash caused by using the firstobject XML editor tree customization feature with Unicode text turned up an underlying bug in releases 7.0 to 8.2 of CMarkup (MFC) and CMarkupSTL (STL). A non-ASCII character name in Fix: In int Hash( LPCTSTR szName ) { unsigned int n=0;
while (*szName) n += (unsigned int)(*szName++); return n % SPM_SIZE; };
7.2 Bug: Quotes in Attribute Values (fixed in 7.3)
In XML you can use a single quote inside of a double quoted attribute value and visa versa. CMarkup encodes any attribute in an attribute value so you will generally not encounter this, but you may come across an existing document with the unencoded quotes in attribute values such as: <H d="d'd" s='s"s'/>
Release 7.2 introduced a change in the way attribute values are parsed that caused it to reject these.
Fix: An incorrect fix was posted here Oct 6 to Oct 9, please update if you used code posted during those days. In if ( *pDoc == _T('\"') && ! (nParseFlags&PD_INQUOTE_S) )
nParseFlags ^= PD_INQUOTE_D;
else if ( *pDoc == _T('\'') && ! (nParseFlags&PD_INQUOTE_D) )
nParseFlags ^= PD_INQUOTE_S;
6.6-7.1 Bug: Assignment Operator (fixed in 7.2)
The following three cases involve the assignment operator and lead to heap corruption (where xmlTest = xmlEmpty;CMarkup xmlTest( xmlEmpty ); (copy constructor calls assignment operator)xmlTest = CMarkup(); (a temporary empty CMarkup is instantiated and assigned)Fix: In // Copy used part of the index array m_aPos.RemoveAll(); m_aPos.nSize = m_iPosFree; if ( m_aPos.nSize < 8 ) m_aPos.nSize = 8; 7.0 Bug: Previous Element Link (fixed in 7.1)
In CMarkup release 7.0, a link to previous element is not set correctly when an element or subdocument is inserted in between sibling elements causing a problem in Fix: In // Link in after iPosBefore pElem->nFlags = 0; pElem->iElemNext = m_aPos[iPosBefore].iElemNext; if ( ! pElem->iElemNext ) m_aPos[m_aPos[iPosParent].iElemChild].iElemPrev = iPos; else m_aPos[pElem->iElemNext].iElemPrev = iPos; m_aPos[iPosBefore].iElemNext = iPos; pElem->iElemPrev = iPosBefore; 7.0 Bug: Empty Subdocument (fixed in 7.1)
Fix: In function // Link in parent and siblings bool bEmpty = m_aPos[iPos].nFlags & MNF_EMPTY; x_LinkElem( iPosParent, iPosBefore, iPos ); m_aPos[iPosTempParent].iElemNext = m_iPosDeleted; m_iPosDeleted = iPosTempParent; if ( bEmpty ) m_aPos[iPos].nFlags |= MNF_EMPTY; 7.0 Bug: Tag Names (fixed in 7.1)
Release 7.0 parser in both CMarkup and CMarkupSTL erroneously rejects tag names starting with underscore and colon. Errortext e.g.: "Incorrect tag name character at offset 402." Fix: In function if ( *pDoc > 0x60 || ( *pDoc > 0x40 && *pDoc < 0x5b ) )to ( 0x5f is underscore, 0x3a is colon)
if ( *pDoc > 0x60 || ( *pDoc > 0x40 && *pDoc < 0x5b )
|| *pDoc == 0x5f || *pDoc == 0x3a )
6.6 Bug: Comma in Error String (fixed in 7.0) Release 6.6 introduced an extra comma in the error string. After calling Fix: The change is in the if ( ! csResult.IsEmpty() )
{
if ... else ...
}
In the STL version MarkupSTL.cpp use: if ( strResult.size() )
{
if ... else ...
}
6.5 Bug: CMarkupMSXML Leak (fixed in 6.6)
Fix: In the SetDoc() function in MarkupMSXML.cpp the following line:
should read:
It appears again x_AddSubDoc() in MarkupMSXML.cpp the following line:
should read:
6.4 And Prior Bug: MBCS Build (fixed in 6.5)
Fix: In the
to:
6.4 Bug: Add Subdocument With PI (fixed in 6.5)
Fix: In the
to:
6.3 Bug: Windows CE DecodeBase64 (fixed in 6.4)
Fix: In the Markup.cpp
to:
6.2 Bug: OutOfElem Level Wrong (fixed in 6.3)
Fix: The level is not tracked in release 6.3. To take care of it in previous releases by hand, the
instead of
6.2 Bug: CFileException Memory Leak (fixed in 6.3)
Fix: Exceptions are no longer used for compatibility with Windows CE. The 6.2 Issue: Windows CE Compiling (fixed in 6.3)
Fix: If you need to implement the fixes by hand in releases 6.1 and 6.2 do the following: 1. Add the following two defines near the top of Markup.cpp because the double-byte character function defines seem not to be available: #define _tclen(p) 1 #define _tccpy(p1,p2) *(p1)=*(p2) 2. Remove exception handling from the Load method by using bool CMarkup::Load( LPCTSTR szFileName )
{
CString csDoc;
CFile file;
if (!file.Open(szFileName, CFile::modeRead))
return false;
int nLength = file.GetLength();
#if defined(_UNICODE)
// Allocate Buffer for UTF-8 file data
unsigned char* pBuffer = new unsigned char[nLength + 1];
nLength = file.Read( pBuffer, nLength );
pBuffer[nLength] = '\0';
// Convert file from UTF-8 to Windows UNICODE (AKA UCS-2)
int nWideLength = MultiByteToWideChar(CP_UTF8,0,
(const char*)pBuffer,nLength,NULL,0);
nLength = MultiByteToWideChar(CP_UTF8,0,
(const char*)pBuffer,nLength,
csDoc.GetBuffer(nWideLength),nWideLength);
ASSERT( nLength == nWideLength );
delete [] pBuffer;
#else
nLength = file.Read( csDoc.GetBuffer(nLength), nLength );
#endif
csDoc.ReleaseBuffer(nLength);
file.Close();
return SetDoc( csDoc );
}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Posted January 15 2002 updated October 9, 2004. Question or comment about this article? ©Copyright 2008 First Objective Software, Inc. All rights reserved. |