Commit d8641f7f authored by cutealien's avatar cutealien

Initialize CXMLReader::IsEmptyElement in constructor.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4080 dfc29bdd-3216-0410-991c-e03cc46cb475
parent b51d8a14
......@@ -12,7 +12,7 @@
#ifdef _DEBUG
#define IRR_DEBUGPRINT(x) printf((x));
#else // _DEBUG
#else // _DEBUG
#define IRR_DEBUGPRINT(x)
#endif // _DEBUG
......@@ -32,7 +32,7 @@ public:
//! Constructor
CXMLReaderImpl(IFileReadCallBack* callback, bool deleteCallBack = true)
: TextData(0), P(0), TextBegin(0), TextSize(0), CurrentNodeType(EXN_NONE),
SourceFormat(ETF_ASCII), TargetFormat(ETF_ASCII)
SourceFormat(ETF_ASCII), TargetFormat(ETF_ASCII), IsEmptyElement(false)
{
if (!callback)
return;
......@@ -42,7 +42,7 @@ public:
// read whole xml file
readFile(callback);
// clean up
if (deleteCallBack)
......@@ -55,7 +55,7 @@ public:
// set pointer to text begin
P = TextBegin;
}
//! Destructor
virtual ~CXMLReaderImpl()
......@@ -64,8 +64,8 @@ public:
}
//! Reads forward to the next xml node.
//! \return Returns false, if there was no further node.
//! Reads forward to the next xml node.
//! \return Returns false, if there was no further node.
virtual bool read()
{
// if not end reached, parse the node
......@@ -103,7 +103,7 @@ public:
}
//! Returns the value of an attribute.
//! Returns the value of an attribute.
virtual const char_type* getAttributeValue(int idx) const
{
if ((unsigned int)idx >= Attributes.size())
......@@ -113,7 +113,7 @@ public:
}
//! Returns the value of an attribute.
//! Returns the value of an attribute.
virtual const char_type* getAttributeValue(const char_type* name) const
{
const SAttribute* attr = getAttributeByName(name);
......@@ -136,7 +136,7 @@ public:
//! Returns the value of an attribute as integer.
//! Returns the value of an attribute as integer.
int getAttributeValueAsInt(const char_type* name) const
{
const SAttribute* attr = getAttributeByName(name);
......@@ -148,7 +148,7 @@ public:
}
//! Returns the value of an attribute as integer.
//! Returns the value of an attribute as integer.
int getAttributeValueAsInt(int idx) const
{
const char_type* attrvalue = getAttributeValue(idx);
......@@ -160,7 +160,7 @@ public:
}
//! Returns the value of an attribute as float.
//! Returns the value of an attribute as float.
float getAttributeValueAsFloat(const char_type* name) const
{
const SAttribute* attr = getAttributeByName(name);
......@@ -172,7 +172,7 @@ public:
}
//! Returns the value of an attribute as float.
//! Returns the value of an attribute as float.
float getAttributeValueAsFloat(int idx) const
{
const char_type* attrvalue = getAttributeValue(idx);
......@@ -245,14 +245,14 @@ private:
switch(*P)
{
case L'/':
parseClosingXMLElement();
parseClosingXMLElement();
break;
case L'?':
ignoreDefinition();
ignoreDefinition();
break;
case L'!':
if (!parseCDATA())
parseComment();
parseComment();
break;
default:
parseOpeningXMLElement();
......@@ -265,7 +265,7 @@ private:
//! sets the state that text was found. Returns true if set should be set
bool setText(char_type* start, char_type* end)
{
// check if text is more than 2 characters, and if not, check if there is
// check if text is more than 2 characters, and if not, check if there is
// only white space, so that this text won't be reported
if (end - start < 3)
{
......@@ -369,7 +369,7 @@ private:
// read the attribute value
// check for quotes and single quotes, thx to murphy
while( (*P != L'\"') && (*P != L'\'') && *P)
while( (*P != L'\"') && (*P != L'\'') && *P)
++P;
if (!*P) // malformatted xml file
......@@ -379,7 +379,7 @@ private:
++P;
const char_type* attributeValueBegin = P;
while(*P != attributeQuoteChar && *P)
++P;
......@@ -390,10 +390,10 @@ private:
++P;
SAttribute attr;
attr.Name = core::string<char_type>(attributeNameBegin,
attr.Name = core::string<char_type>(attributeNameBegin,
(int)(attributeNameEnd - attributeNameBegin));
core::string<char_type> s(attributeValueBegin,
core::string<char_type> s(attributeValueBegin,
(int)(attributeValueEnd - attributeValueBegin));
attr.Value = replaceSpecialCharacters(s);
......@@ -416,7 +416,7 @@ private:
IsEmptyElement = true;
endName--;
}
NodeName = core::string<char_type>(startName, (int)(endName - startName));
++P;
......@@ -465,7 +465,7 @@ private:
// find end of CDATA
while(*P && !cDataEnd)
{
if (*P == L'>' &&
if (*P == L'>' &&
(*(P-1) == L']') &&
(*(P-2) == L']'))
{
......@@ -548,7 +548,7 @@ private:
// find next &
oldPos = pos;
pos = origstr.findNext(L'&', pos);
pos = origstr.findNext(L'&', pos);
}
if (oldPos < (int)origstr.size()-1)
......@@ -562,7 +562,7 @@ private:
//! reads the xml file and converts it into the wanted character format.
bool readFile(IFileReadCallBack* callback)
{
long size = callback->getSize();
long size = callback->getSize();
if (size<0)
return false;
size += 4; // We need four terminating 0's at the end.
......@@ -581,7 +581,7 @@ private:
memset(data8+size-4, 0, 4);
char16* data16 = reinterpret_cast<char16*>(data8);
char32* data32 = reinterpret_cast<char32*>(data8);
char32* data32 = reinterpret_cast<char32*>(data8);
// now we need to convert the data to the desired target format
// based on the byte order mark.
......@@ -593,7 +593,7 @@ private:
const u32 UTF32_LE = 0x0000FEFF;
// check source for all utf versions and convert to target data format
if (size >= 4 && data32[0] == static_cast<char32>(UTF32_BE))
{
// UTF-32, big endian
......@@ -649,7 +649,7 @@ private:
void convertTextData(src_char_type* source, char* pointerToStore, int sizeWithoutHeader)
{
// convert little to big endian if necessary
if (sizeof(src_char_type) > 1 &&
if (sizeof(src_char_type) > 1 &&
isLittleEndian(TargetFormat) != isLittleEndian(SourceFormat))
convertToLittleEndian(source);
......@@ -663,9 +663,9 @@ private:
}
else
{
// convert source into target data format.
// TODO: implement a real conversion. This one just
// copies bytes. This is a problem when there are
// convert source into target data format.
// TODO: implement a real conversion. This one just
// copies bytes. This is a problem when there are
// unicode symbols using more than one character.
TextData = new char_type[sizeWithoutHeader];
......@@ -695,7 +695,7 @@ private:
template<class src_char_type>
void convertToLittleEndian(src_char_type* t)
{
if (sizeof(src_char_type) == 4)
if (sizeof(src_char_type) == 4)
{
// 32 bit
......@@ -710,7 +710,7 @@ private:
}
else
{
// 16 bit
// 16 bit
while(*t)
{
......@@ -740,7 +740,7 @@ private:
//! generates a list with xml special characters
void createSpecialCharacterList()
{
// list of strings containing special symbols,
// list of strings containing special symbols,
// the first character is the special character,
// the following is the symbol string without trailing &.
......@@ -749,7 +749,7 @@ private:
SpecialCharacters.push_back(">gt;");
SpecialCharacters.push_back("\"quot;");
SpecialCharacters.push_back("'apos;");
}
......@@ -775,13 +775,13 @@ private:
switch(sizeof(char_type))
{
case 1:
case 1:
TargetFormat = ETF_UTF8;
break;
case 2:
case 2:
TargetFormat = ETF_UTF16_LE;
break;
case 4:
case 4:
TargetFormat = ETF_UTF32_LE;
break;
default:
......@@ -809,7 +809,7 @@ private:
core::array< core::string<char_type> > SpecialCharacters; // see createSpecialCharacterList()
core::array<SAttribute> Attributes; // attributes of current element
}; // end CXMLReaderImpl
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment