summaryrefslogtreecommitdiff
path: root/src/contrib
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2010-11-21 16:20:55 +0000
committerPaul Buetow <paul@buetow.org>2010-11-21 16:20:55 +0000
commit6fde6b0fe90abde84011202edd40fe46eb06af44 (patch)
treeef760338c50b4df3ae9cca96347bca962fdbec7e /src/contrib
parent55b08bd93257d32df76efc4e8e3f49311c39ee82 (diff)
Diffstat (limited to 'src/contrib')
-rw-r--r--src/contrib/crypt/md5.cpp5
-rw-r--r--src/contrib/crypt/md5.h3
-rw-r--r--src/contrib/crypt/md5crypt.cpp33
-rw-r--r--src/contrib/xml/tinyxml.cpp33
-rw-r--r--src/contrib/xml/tinyxml.h75
-rw-r--r--src/contrib/xml/tinyxmlerror.cpp55
-rw-r--r--src/contrib/xml/tinyxmlparser.cpp130
7 files changed, 162 insertions, 172 deletions
diff --git a/src/contrib/crypt/md5.cpp b/src/contrib/crypt/md5.cpp
index 1f74478..492f8b6 100644
--- a/src/contrib/crypt/md5.cpp
+++ b/src/contrib/crypt/md5.cpp
@@ -1,12 +1,11 @@
/*:*
*: File: ./src/contrib/crypt/md5.cpp
*:
- *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
*: Copyright (C) 2005 EXA Digital Solutions GbR
- *: Copyright (C) 2006, 2007 Paul C. Buetow
*:
*: This program is free software; you can redistribute it and/or
*: modify it under the terms of the GNU General Public License
@@ -140,7 +139,7 @@ MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
}
/*
- * Final wrapup - pad to 64-byte boundary with the bit pattern
+ * Final wrapup - pad to 64-byte boundary with the bit pattern
* 1 0* (64-bit count of bits processed, MSB-first)
*/
void
diff --git a/src/contrib/crypt/md5.h b/src/contrib/crypt/md5.h
index 9ac8a49..0681ef4 100644
--- a/src/contrib/crypt/md5.h
+++ b/src/contrib/crypt/md5.h
@@ -1,12 +1,11 @@
/*:*
*: File: ./src/contrib/crypt/md5.h
*:
- *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
*: Copyright (C) 2005 EXA Digital Solutions GbR
- *: Copyright (C) 2006, 2007 Paul C. Buetow
*:
*: This program is free software; you can redistribute it and/or
*: modify it under the terms of the GNU General Public License
diff --git a/src/contrib/crypt/md5crypt.cpp b/src/contrib/crypt/md5crypt.cpp
index 1e30c88..90606f1 100644
--- a/src/contrib/crypt/md5crypt.cpp
+++ b/src/contrib/crypt/md5crypt.cpp
@@ -1,12 +1,11 @@
/*:*
*: File: ./src/contrib/crypt/md5crypt.cpp
*:
- *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
*: Copyright (C) 2005 EXA Digital Solutions GbR
- *: Copyright (C) 2006, 2007 Paul C. Buetow
*:
*: This program is free software; you can redistribute it and/or
*: modify it under the terms of the GNU General Public License
@@ -66,12 +65,12 @@ to64(char *s, unsigned long v, int n)
char *
MD5Crypt(const char *pw, const char *salt)
{
- static const char *magic = "$1$"; /*
- * This string is magic for
- * this algorithm. Having
- * it this way, we can get
- * get better later on
- */
+ static char *magic = "$1$"; /*
+ * This string is magic for
+ * this algorithm. Having
+ * it this way, we can get
+ * get better later on
+ */
static char passwd[120], *p;
static const char *sp,*ep;
unsigned char final[16];
@@ -83,11 +82,11 @@ MD5Crypt(const char *pw, const char *salt)
sp = salt;
/* If it starts with the magic string, then skip that */
- if (!strncmp(sp,magic,strlen(magic)))
+ if(!strncmp(sp,magic,strlen(magic)))
sp += strlen(magic);
/* It stops at the first '$', max 8 chars */
- for (ep=sp;*ep && *ep != '$' && ep < (sp+8);ep++)
+ for(ep=sp;*ep && *ep != '$' && ep < (sp+8);ep++)
continue;
/* get the length of the true salt */
@@ -110,7 +109,7 @@ MD5Crypt(const char *pw, const char *salt)
MD5Update(&ctx1,(const unsigned char*)sp,sl);
MD5Update(&ctx1,(const unsigned char*)pw,strlen(pw));
MD5Final(final,&ctx1);
- for (pl = strlen(pw); pl > 0; pl -= 16)
+ for(pl = strlen(pw); pl > 0; pl -= 16)
MD5Update(&ctx,final,pl>16 ? 16 : pl);
/* Don't leave anything around in vm they could use. */
@@ -118,7 +117,7 @@ MD5Crypt(const char *pw, const char *salt)
/* Then something really weird... */
for (j=0,i = strlen(pw); i ; i >>= 1)
- if (i&1)
+ if(i&1)
MD5Update(&ctx, final+j, 1);
else
MD5Update(&ctx, (const unsigned char*)pw+j, 1);
@@ -135,21 +134,21 @@ MD5Crypt(const char *pw, const char *salt)
* On a 60 Mhz Pentium this takes 34 msec, so you would
* need 30 seconds to build a 1000 entry dictionary...
*/
- for (i=0;i<1000;i++)
+ for(i=0;i<1000;i++)
{
MD5Init(&ctx1);
- if (i & 1)
+ if(i & 1)
MD5Update(&ctx1,(const unsigned char*)pw,strlen(pw));
else
MD5Update(&ctx1,final,16);
- if (i % 3)
+ if(i % 3)
MD5Update(&ctx1,(const unsigned char*)sp,sl);
- if (i % 7)
+ if(i % 7)
MD5Update(&ctx1,(const unsigned char*)pw,strlen(pw));
- if (i & 1)
+ if(i & 1)
MD5Update(&ctx1,final,16);
else
MD5Update(&ctx1,(const unsigned char*)pw,strlen(pw));
diff --git a/src/contrib/xml/tinyxml.cpp b/src/contrib/xml/tinyxml.cpp
index 727fe87..fe9a616 100644
--- a/src/contrib/xml/tinyxml.cpp
+++ b/src/contrib/xml/tinyxml.cpp
@@ -1,12 +1,11 @@
/*:*
*: File: ./src/contrib/xml/tinyxml.cpp
*:
- *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
*: Copyright (C) 2005 EXA Digital Solutions GbR
- *: Copyright (C) 2006, 2007 Paul C. Buetow
*:
*: This program is free software; you can redistribute it and/or
*: modify it under the terms of the GNU General Public License
@@ -26,23 +25,23 @@
/*
www.sourceforge.net/projects/tinyxml
Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
-
+
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
-
+
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
-
+
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
-
+
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
-
+
3. This notice may not be removed or altered from any source
distribution.
*/
@@ -68,7 +67,7 @@ void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_STRING* outString )
{
int i=0;
- while ( i<(int)str.length() )
+ while( i<(int)str.length() )
{
unsigned char c = (unsigned char) str[i];
@@ -480,7 +479,7 @@ TiXmlDocument* TiXmlNode::GetDocument() const
{
const TiXmlNode* node;
- for ( node = this; node; node = node->parent )
+ for( node = this; node; node = node->parent )
{
if ( node->ToDocument() )
return node->ToDocument();
@@ -531,7 +530,7 @@ TiXmlElement::~TiXmlElement()
void TiXmlElement::ClearThis()
{
Clear();
- while ( attributeSet.First() )
+ while( attributeSet.First() )
{
TiXmlAttribute* node = attributeSet.First();
attributeSet.Remove( node );
@@ -682,7 +681,7 @@ void TiXmlElement::Print( FILE* cfile, int depth ) const
node->Print( cfile, depth+1 );
}
fprintf( cfile, "\n" );
- for ( i=0; i<depth; ++i )
+ for( i=0; i<depth; ++i )
fprintf( cfile, " " );
fprintf( cfile, "</%s>", value.c_str() );
}
@@ -727,9 +726,9 @@ void TiXmlElement::CopyTo( TiXmlElement* target ) const
// Element class:
// Clone the attributes, then clone the children.
TiXmlAttribute* attribute = 0;
- for ( attribute = attributeSet.First();
- attribute;
- attribute = attribute->Next() )
+ for( attribute = attributeSet.First();
+ attribute;
+ attribute = attribute->Next() )
{
target->SetAttribute( attribute->Name(), attribute->Value() );
}
@@ -854,7 +853,7 @@ bool TiXmlDocument::LoadFile( const char* filename, TiXmlEncoding encoding )
const int BUF_SIZE = 2048;
char buf[BUF_SIZE];
- while ( fgets( buf, BUF_SIZE, file ) )
+ while( fgets( buf, BUF_SIZE, file ) )
{
data += buf;
}
@@ -1270,7 +1269,7 @@ void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe )
{
TiXmlAttribute* node;
- for ( node = sentinel.next; node != &sentinel; node = node->next )
+ for( node = sentinel.next; node != &sentinel; node = node->next )
{
if ( node == removeMe )
{
@@ -1288,7 +1287,7 @@ TiXmlAttribute* TiXmlAttributeSet::Find( const char * name ) const
{
TiXmlAttribute* node;
- for ( node = sentinel.next; node != &sentinel; node = node->next )
+ for( node = sentinel.next; node != &sentinel; node = node->next )
{
if ( node->name == name )
return node;
diff --git a/src/contrib/xml/tinyxml.h b/src/contrib/xml/tinyxml.h
index 9d0015d..88db93e 100644
--- a/src/contrib/xml/tinyxml.h
+++ b/src/contrib/xml/tinyxml.h
@@ -1,12 +1,11 @@
/*:*
*: File: ./src/contrib/xml/tinyxml.h
*:
- *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
*: Copyright (C) 2005 EXA Digital Solutions GbR
- *: Copyright (C) 2006, 2007 Paul C. Buetow
*:
*: This program is free software; you can redistribute it and/or
*: modify it under the terms of the GNU General Public License
@@ -29,23 +28,23 @@
/*
www.sourceforge.net/projects/tinyxml
Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
-
+
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
-
+
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
-
+
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
-
+
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
-
+
3. This notice may not be removed or altered from any source
distribution.
*/
@@ -137,22 +136,22 @@ const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN;
/** TiXmlBase is a base class for every class in TinyXml.
It does little except to establish that TinyXml classes
can be printed and provide some utility functions.
-
+
In XML, the document and elements can contain
other elements and other types of nodes.
-
+
@verbatim
A Document can contain: Element (container or leaf)
Comment (leaf)
Unknown (leaf)
Declaration( leaf )
-
+
An Element can contain: Element (container or leaf)
Text (leaf)
Attributes (not on tree)
Comment (leaf)
Unknown (leaf)
-
+
A Decleration contains: Attributes (not on tree)
@endverbatim
*/
@@ -681,7 +680,7 @@ public:
TiXmlDocument* ToDocument() const
{
- return ( this && type == DOCUMENT ) ? (TiXmlDocument*) this : 0;
+ return ( this && type == DOCUMENT ) ? (TiXmlDocument*) this : 0;
} ///< Cast to a more defined type. Will return null not of the requested type.
TiXmlElement* ToElement() const
{
@@ -705,7 +704,7 @@ public:
} ///< Cast to a more defined type. Will return null not of the requested type.
/** Create an exact duplicate of this node and return it. The memory must be deleted
- by the caller.
+ by the caller.
*/
virtual TiXmlNode* Clone() const = 0;
@@ -749,7 +748,7 @@ private:
/** An attribute is a name-value pair. Elements have an arbitrary
number of attributes, each with a unique name.
-
+
@note The attributes are not TiXmlNodes, since they are not
part of the tinyXML document object model. There are other
suggested ways to look at this problem.
@@ -799,7 +798,7 @@ public:
/** QueryIntValue examines the value string. It is an alternative to the
IntValue() method with richer error checking.
- If the value is an integer, it is stored in 'value' and
+ If the value is an integer, it is stored in 'value' and
the call returns TIXML_SUCCESS. If it is not
an integer, it returns TIXML_WRONG_TYPE.
@@ -885,12 +884,12 @@ private:
/* A class used to manage a group of attributes.
It is only used internally, both by the ELEMENT and the DECLARATION.
-
+
The set can be changed transparent to the Element and Declaration
classes that use it, but NOT transparent to the Attribute
which has to implement a next() and previous() method. Which makes
it a bit problematic and prevents the use of STL.
-
+
This version is implemented with circular lists because:
- I like circular lists
- it demonstrates some independence from the (typical) doubly linked list.
@@ -963,7 +962,7 @@ public:
/** QueryIntAttribute examines the attribute - it is an alternative to the
Attribute() method with richer error checking.
- If the attribute is an integer, it is stored in 'value' and
+ If the attribute is an integer, it is stored in 'value' and
the call returns TIXML_SUCCESS. If it is not
an integer, it returns TIXML_WRONG_TYPE. If the attribute
does not exist, then TIXML_NO_ATTRIBUTE is returned.
@@ -1179,11 +1178,11 @@ private:
@verbatim
<?xml version="1.0" standalone="yes"?>
@endverbatim
-
+
TinyXml will happily read or write files without a declaration,
however. There are 3 possible attributes to the declaration:
version, encoding, and standalone.
-
+
Note: In this version of the code, the attributes are
handled as special cases, not generic attributes, simply
because there can only be at most 3 and they are always the same.
@@ -1258,7 +1257,7 @@ private:
unknown. It is a tag of text, but should not be modified.
It will be written back to the XML, unchanged, when the file
is saved.
-
+
DTD tags get thrown into TiXmlUnknowns.
*/
class TiXmlUnknown : public TiXmlNode
@@ -1481,7 +1480,7 @@ private:
A TiXmlHandle is a class that wraps a node pointer with null checks; this is
an incredibly useful thing. Note that TiXmlHandle is not part of the TinyXml
DOM structure. It is a separate utility class.
-
+
Take an example:
@verbatim
<Document>
@@ -1491,10 +1490,10 @@ private:
</Element>
<Document>
@endverbatim
-
- Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very
+
+ Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very
easy to write a *lot* of code that looks like:
-
+
@verbatim
TiXmlElement* root = document.FirstChildElement( "Document" );
if ( root )
@@ -1510,11 +1509,11 @@ private:
{
// Finally do something useful.
@endverbatim
-
+
And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity
- of such code. A TiXmlHandle checks for null pointers so it is perfectly safe
+ of such code. A TiXmlHandle checks for null pointers so it is perfectly safe
and correct to use:
-
+
@verbatim
TiXmlHandle docHandle( &document );
TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).Element();
@@ -1522,18 +1521,18 @@ private:
{
// do something useful
@endverbatim
-
+
Which is MUCH more concise and useful.
-
+
It is also safe to copy handles - internally they are nothing more than node pointers.
@verbatim
TiXmlHandle handleCopy = handle;
@endverbatim
-
+
What they should not be used for is iteration:
-
+
@verbatim
- int i=0;
+ int i=0;
while ( true )
{
TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).Element();
@@ -1543,14 +1542,14 @@ private:
++i;
}
@endverbatim
-
- It seems reasonable, but it is in fact two embedded while loops. The Child method is
- a linear walk to find the element, so this code would iterate much more than it needs
+
+ It seems reasonable, but it is in fact two embedded while loops. The Child method is
+ a linear walk to find the element, so this code would iterate much more than it needs
to. Instead, prefer:
-
+
@verbatim
TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild( "Child" ).Element();
-
+
for( child; child; child=child->NextSiblingElement() )
{
// do something
diff --git a/src/contrib/xml/tinyxmlerror.cpp b/src/contrib/xml/tinyxmlerror.cpp
index 066a9d6..1c27bb2 100644
--- a/src/contrib/xml/tinyxmlerror.cpp
+++ b/src/contrib/xml/tinyxmlerror.cpp
@@ -1,12 +1,11 @@
/*:*
*: File: ./src/contrib/xml/tinyxmlerror.cpp
*:
- *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
*: Copyright (C) 2005 EXA Digital Solutions GbR
- *: Copyright (C) 2006, 2007 Paul C. Buetow
*:
*: This program is free software; you can redistribute it and/or
*: modify it under the terms of the GNU General Public License
@@ -26,23 +25,23 @@
/*
www.sourceforge.net/projects/tinyxml
Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any
-purpose, including commercial applications, and to alter it and
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
-
+
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
-
+
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
-
+
3. This notice may not be removed or altered from any source
distribution.
*/
@@ -57,20 +56,20 @@ distribution.
//
const char* TiXmlBase::errorString[ TIXML_ERROR_STRING_COUNT ] =
-{
- "No error",
- "Error",
- "Failed to open file",
- "Memory allocation failed.",
- "Error parsing Element.",
- "Failed to read Element name",
- "Error reading Element value.",
- "Error reading Attributes.",
- "Error: empty tag.",
- "Error reading end tag.",
- "Error parsing Unknown.",
- "Error parsing Comment.",
- "Error parsing Declaration.",
- "Error document empty.",
- "Error null (0) or unexpected EOF found in input stream.",
-};
+ {
+ "No error",
+ "Error",
+ "Failed to open file",
+ "Memory allocation failed.",
+ "Error parsing Element.",
+ "Failed to read Element name",
+ "Error reading Element value.",
+ "Error reading Attributes.",
+ "Error: empty tag.",
+ "Error reading end tag.",
+ "Error parsing Unknown.",
+ "Error parsing Comment.",
+ "Error parsing Declaration.",
+ "Error document empty.",
+ "Error null (0) or unexpected EOF found in input stream.",
+ };
diff --git a/src/contrib/xml/tinyxmlparser.cpp b/src/contrib/xml/tinyxmlparser.cpp
index 510cc0b..6879008 100644
--- a/src/contrib/xml/tinyxmlparser.cpp
+++ b/src/contrib/xml/tinyxmlparser.cpp
@@ -1,12 +1,11 @@
/*:*
*: File: ./src/contrib/xml/tinyxmlparser.cpp
*:
- *: yChat; Homepage: ychat.buetow.org; Version 0.9.0-CURRENT
+ *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
*:
*: Copyright (C) 2003 Paul C. Buetow, Volker Richter
*: Copyright (C) 2004 Paul C. Buetow
*: Copyright (C) 2005 EXA Digital Solutions GbR
- *: Copyright (C) 2006, 2007 Paul C. Buetow
*:
*: This program is free software; you can redistribute it and/or
*: modify it under the terms of the GNU General Public License
@@ -26,24 +25,24 @@
/*
www.sourceforge.net/projects/tinyxml
Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any
-purpose, including commercial applications, and to alter it and
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must
+
+1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and
+
+2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source
+
+3. This notice may not be removed or altered from any source
distribution.
*/
@@ -56,13 +55,13 @@ distribution.
// is less flexible than it appears. Changing the entries
// or order will break putstring.
TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] =
-{
- { "&amp;", 5, '&' },
- { "&lt;", 4, '<' },
- { "&gt;", 4, '>' },
- { "&quot;", 6, '\"' },
- { "&apos;", 6, '\'' }
-};
+ {
+ { "&amp;", 5, '&' },
+ { "&lt;", 4, '<' },
+ { "&gt;", 4, '>' },
+ { "&quot;", 6, '\"' },
+ { "&apos;", 6, '\'' }
+ };
// Bunch of unicode info at:
// http://www.unicode.org/faq/utf_bom.html
@@ -77,25 +76,25 @@ TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] =
const int TiXmlBase::utf8ByteTable[256] =
-{
- // 0 1 2 3 4 5 6 7 8 9 a b c d e f
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x10
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x20
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x30
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x50
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x70 End of ASCII range
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x80 0x80 to 0xc1 invalid
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x90
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xa0
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0
- 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xc0 0xc2 to 0xdf 2 byte
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xd0
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xe0 0xe0 to 0xef 3 byte
- 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 0xf0 0xf0 to 0xf4 4 byte, 0xf5 and higher invalid
-};
+ {
+ // 0 1 2 3 4 5 6 7 8 9 a b c d e f
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x10
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x20
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x30
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x50
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x70 End of ASCII range
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x80 0x80 to 0xc1 invalid
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x90
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xa0
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0
+ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xc0 0xc2 to 0xdf 2 byte
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xd0
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xe0 0xe0 to 0xef 3 byte
+ 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 0xf0 0xf0 to 0xf4 4 byte, 0xf5 and higher invalid
+ };
void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length )
@@ -103,9 +102,9 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng
const unsigned long BYTE_MASK = 0xBF;
const unsigned long BYTE_MARK = 0x80;
const unsigned long FIRST_BYTE_MARK[7] =
- {
- 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC
- };
+ {
+ 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC
+ };
if (input < 0x80)
*length = 1;
@@ -145,8 +144,7 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng
}
-/*static*/
-int TiXmlBase::IsAlpha( unsigned char anyByte, TiXmlEncoding encoding )
+/*static*/ int TiXmlBase::IsAlpha( unsigned char anyByte, TiXmlEncoding encoding )
{
// This will only work for low-ascii, everything else is assumed to be a valid
// letter. I'm not sure this is the best approach, but it is quite tricky trying
@@ -167,8 +165,7 @@ int TiXmlBase::IsAlpha( unsigned char anyByte, TiXmlEncoding encoding )
}
-/*static*/
-int TiXmlBase::IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding )
+/*static*/ int TiXmlBase::IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding )
{
// This will only work for low-ascii, everything else is assumed to be a valid
// letter. I'm not sure this is the best approach, but it is quite tricky trying
@@ -356,16 +353,16 @@ const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding )
p += 3;
continue;
}
- else if (*(p+0)==(char) 0xef
- && *(p+1)==(char) 0xbf
- && *(p+2)==(char) 0xbe )
+ else if(*(p+0)==(char) 0xef
+ && *(p+1)==(char) 0xbf
+ && *(p+2)==(char) 0xbe )
{
p += 3;
continue;
}
- else if (*(p+0)==(char) 0xef
- && *(p+1)==(char) 0xbf
- && *(p+2)==(char) 0xbf )
+ else if(*(p+0)==(char) 0xef
+ && *(p+1)==(char) 0xbf
+ && *(p+2)==(char) 0xbf )
{
p += 3;
continue;
@@ -389,7 +386,7 @@ const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding )
#ifdef TIXML_USE_STL
/*static*/ bool TiXmlBase::StreamWhiteSpace( TIXML_ISTREAM * in, TIXML_STRING * tag )
{
- for ( ;; )
+ for( ;; )
{
if ( !in->good() )
return false;
@@ -404,8 +401,7 @@ const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding )
}
}
-/*static*/
-bool TiXmlBase::StreamTo( TIXML_ISTREAM * in, int character, TIXML_STRING * tag )
+/*static*/ bool TiXmlBase::StreamTo( TIXML_ISTREAM * in, int character, TIXML_STRING * tag )
{
//assert( character > 0 && character < 128 ); // else it won't work in utf-8
while ( in->good() )
@@ -439,12 +435,12 @@ const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncodi
if ( p && *p
&& ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) )
{
- while ( p && *p
- && ( IsAlphaNum( (unsigned char ) *p, encoding )
- || *p == '_'
- || *p == '-'
- || *p == '.'
- || *p == ':' ) )
+ while( p && *p
+ && ( IsAlphaNum( (unsigned char ) *p, encoding )
+ || *p == '_'
+ || *p == '-'
+ || *p == '.'
+ || *p == ':' ) )
{
(*name) += *p;
++p;
@@ -535,7 +531,7 @@ const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXml
}
// Now try to match it.
- for ( i=0; i<NUM_ENTITY; ++i )
+ for( i=0; i<NUM_ENTITY; ++i )
{
if ( strncmp( entity[i].str, p, entity[i].strLength ) == 0 )
{
@@ -833,7 +829,7 @@ TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding )
TiXmlNode* returnNode = 0;
p = SkipWhiteSpace( p, encoding );
- if ( !p || !*p || *p != '<' )
+ if( !p || !*p || *p != '<' )
{
return 0;
}
@@ -924,7 +920,7 @@ void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
{
// We're called with some amount of pre-parsing. That is, some of "this"
// element is in "tag". Go ahead and stream to the closing ">"
- while ( in->good() )
+ while( in->good() )
{
int c = in->get
();
@@ -985,7 +981,7 @@ void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
bool closingTag = false;
bool firstCharFound = false;
- for ( ;; )
+ for( ;; )
{
if ( !in->good() )
return;
@@ -1564,7 +1560,7 @@ const char* TiXmlDeclaration::Parse( const char* p, TiXmlParsingData* data, TiXm
else
{
// Read over whatever it is.
- while ( p && *p && *p != '>' && !IsWhiteSpace( *p ) )
+ while( p && *p && *p != '>' && !IsWhiteSpace( *p ) )
++p;
}
}