Normalize source code

Add .gitattributes
Remove trailing whitespaces
This commit is contained in:
Eduardo Bart 2012-07-28 00:54:47 -03:00
parent a240429cb8
commit d85dd3e20f
16 changed files with 151 additions and 145 deletions

6
.gitattributes vendored Normal file
View File

@ -0,0 +1,6 @@
# Normalize source code before commits
*.lua eol=lf
*.txt eol=lf
*.ot* eol=lf
*.cpp eol=lf
*.h eol=lf

View File

@ -74,7 +74,7 @@ function Options.init()
optionsWindow = g_ui.displayUI('options.otui') optionsWindow = g_ui.displayUI('options.otui')
optionsWindow:hide() optionsWindow:hide()
optionsButton = TopMenu.addLeftButton('optionsButton', tr('Options') .. ' (Ctrl+D)', 'options.png', Options.toggle) optionsButton = TopMenu.addLeftButton('optionsButton', tr('Options') .. ' (Ctrl+D)', 'options.png', Options.toggle)
optionsTabBar = optionsWindow:getChildById('optionsTabBar') optionsTabBar = optionsWindow:getChildById('optionsTabBar')
optionsTabBar:setContentWidget(optionsWindow:getChildById('optionsTabContent')) optionsTabBar:setContentWidget(optionsWindow:getChildById('optionsTabContent'))
@ -146,7 +146,7 @@ function Options.setOption(key, value)
value = 0 value = 0
end end
if graphicsPanel then if graphicsPanel then
graphicsPanel:getChildById('backgroundFrameRateLabel'):setText(tr('Game framerate limit: %s', text)) graphicsPanel:getChildById('backgroundFrameRateLabel'):setText(tr('Game framerate limit: %s', text))
end end
g_app.setBackgroundPaneMaxFps(value) g_app.setBackgroundPaneMaxFps(value)

View File

@ -4,7 +4,7 @@ Table < UITable
header-row-style: HeaderTableRow header-row-style: HeaderTableRow
column-style: TableColumn column-style: TableColumn
row-style: TableRow row-style: TableRow
TableData < UIScrollArea TableData < UIScrollArea
layout: verticalBox layout: verticalBox

View File

@ -84,7 +84,7 @@ end
function TopMenu.addRightGameButton(id, description, icon, callback) function TopMenu.addRightGameButton(id, description, icon, callback)
return addButton(id, description, icon, callback, rightGameButtonsPanel, false) return addButton(id, description, icon, callback, rightGameButtonsPanel, false)
end end
function TopMenu.addRightGameToggleButton(id, description, icon, callback, right) function TopMenu.addRightGameToggleButton(id, description, icon, callback, right)
return addButton(id, description, icon, callback, rightGameButtonsPanel, true) return addButton(id, description, icon, callback, rightGameButtonsPanel, true)
end end

View File

@ -62,7 +62,7 @@ TopPanel
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.left: prev.right anchors.left: prev.right
visible: false visible: false
UILabel UILabel
id: frameCounter id: frameCounter
text-align: right text-align: right

View File

@ -5,7 +5,7 @@ function Bit.bit(p)
end end
function Bit.hasBit(x, p) function Bit.hasBit(x, p)
return x % (p + p) >= p return x % (p + p) >= p
end end
function Bit.setbit(x, p) function Bit.setbit(x, p)

View File

@ -18,7 +18,7 @@ LogoutWindow < MainWindow
anchors.left: parent.left anchors.left: parent.left
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
margin-left: 65 margin-left: 65
Button Button
id: buttonNo id: buttonNo
!text: tr('No') !text: tr('No')

View File

@ -183,16 +183,16 @@ local function updateDetails(itemId, descriptions, purchaseStats, saleStats)
else else
for k, stat in pairs(saleStats) do for k, stat in pairs(saleStats) do
if not table.empty(stat) then if not table.empty(stat) then
sellStatsTable:addRow({{['text'] = 'Total Transations:'}, sellStatsTable:addRow({{['text'] = 'Total Transations:'},
{['text'] = stat[1], ['width'] = 270}}) {['text'] = stat[1], ['width'] = 270}})
sellStatsTable:addRow({{['text'] = 'Highest Price:'}, sellStatsTable:addRow({{['text'] = 'Highest Price:'},
{['text'] = stat[3], ['width'] = 270}}) {['text'] = stat[3], ['width'] = 270}})
sellStatsTable:addRow({{['text'] = 'Average Price:'}, sellStatsTable:addRow({{['text'] = 'Average Price:'},
{['text'] = math.floor(stat[2]/stat[1])}}) {['text'] = math.floor(stat[2]/stat[1])}})
sellStatsTable:addRow({{['text'] = 'Lowest Price:'}, sellStatsTable:addRow({{['text'] = 'Lowest Price:'},
{['text'] = stat[4], ['width'] = 270}}) {['text'] = stat[4], ['width'] = 270}})
end end
end end
@ -205,16 +205,16 @@ local function updateDetails(itemId, descriptions, purchaseStats, saleStats)
else else
for k, stat in pairs(purchaseStats) do for k, stat in pairs(purchaseStats) do
if not table.empty(stat) then if not table.empty(stat) then
buyStatsTable:addRow({{['text'] = 'Total Transations:'}, buyStatsTable:addRow({{['text'] = 'Total Transations:'},
{['text'] = stat[1], ['width'] = 270}}) {['text'] = stat[1], ['width'] = 270}})
buyStatsTable:addRow({{['text'] = 'Highest Price:'}, buyStatsTable:addRow({{['text'] = 'Highest Price:'},
{['text'] = stat[3], ['width'] = 270}}) {['text'] = stat[3], ['width'] = 270}})
buyStatsTable:addRow({{['text'] = 'Average Price:'}, buyStatsTable:addRow({{['text'] = 'Average Price:'},
{['text'] = math.floor(stat[2]/stat[1]), ['width'] = 270}}) {['text'] = math.floor(stat[2]/stat[1]), ['width'] = 270}})
buyStatsTable:addRow({{['text'] = 'Lowest Price:'}, buyStatsTable:addRow({{['text'] = 'Lowest Price:'},
{['text'] = stat[4], ['width'] = 270}}) {['text'] = stat[4], ['width'] = 270}})
end end
end end
@ -230,7 +230,7 @@ local function updateSelectedItem(newItem)
nameLabel:setText(selectedItem.item.marketData.name) nameLabel:setText(selectedItem.item.marketData.name)
-- update offer types -- update offer types
Market.enableCreateOffer(true) Market.enableCreateOffer(true)
MarketProtocol.sendMarketBrowse(selectedItem.item.ptr:getId()) -- send browsed msg MarketProtocol.sendMarketBrowse(selectedItem.item.ptr:getId()) -- send browsed msg
else else
Market.Market.clearSelectedItem() Market.Market.clearSelectedItem()
@ -429,7 +429,7 @@ local function initInterface()
-- setup 'My Offer' section tabs -- setup 'My Offer' section tabs
myOffersPanel = g_ui.loadUI('ui/myoffers.otui') myOffersPanel = g_ui.loadUI('ui/myoffers.otui')
mainTabBar:addTab(tr('My Offers'), myOffersPanel) mainTabBar:addTab(tr('My Offers'), myOffersPanel)
offersTabBar = myOffersPanel:getChildById('offersTabBar') offersTabBar = myOffersPanel:getChildById('offersTabBar')
offersTabBar:setContentWidget(myOffersPanel:getChildById('offersTabContent')) offersTabBar:setContentWidget(myOffersPanel:getChildById('offersTabContent'))
@ -483,7 +483,7 @@ local function initInterface()
categoryList:addOption(getMarketCategoryName(255)) -- meta weapons categoryList:addOption(getMarketCategoryName(255)) -- meta weapons
categoryList:setCurrentOption(getMarketCategoryName(MarketCategory.First)) categoryList:setCurrentOption(getMarketCategoryName(MarketCategory.First))
subCategoryList:setEnabled(false) subCategoryList:setEnabled(false)
-- hook item filters -- hook item filters
categoryList.onOptionChange = onChangeCategory categoryList.onOptionChange = onChangeCategory
subCategoryList.onOptionChange = onChangeSubCategory subCategoryList.onOptionChange = onChangeSubCategory
@ -521,7 +521,7 @@ function terminate()
if marketWindow then if marketWindow then
marketWindow:destroy() marketWindow:destroy()
end end
Market = nil Market = nil
end end
@ -693,7 +693,7 @@ function Market.loadDepotItems(depotItems)
table.insert(items, newItem) table.insert(items, newItem)
end end
end end
for _, newItem in pairs(items) do for _, newItem in pairs(items) do
local marketData = newItem:getMarketData() local marketData = newItem:getMarketData()

View File

@ -1 +1 @@

View File

@ -4,7 +4,7 @@
# FRAMEWORK_NET # FRAMEWORK_NET
# FRAMEWORK_XML # FRAMEWORK_XML
# CMAKE_CURRENT_LIST_DIR cmake 2.6 compatiblity # CMAKE_CURRENT_LIST_DIR cmake 2.6 compatibility
if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6) if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)
get_filename_component(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) get_filename_component(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
endif(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6) endif(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)

View File

@ -224,7 +224,7 @@ class TiXmlString
// to the normal allocation, although use an 'int' for systems // to the normal allocation, although use an 'int' for systems
// that are overly picky about structure alignment. // that are overly picky about structure alignment.
const size_type bytesNeeded = sizeof(Rep) + cap; const size_type bytesNeeded = sizeof(Rep) + cap;
const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int ); const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int );
rep_ = reinterpret_cast<Rep*>( new int[ intsNeeded ] ); rep_ = reinterpret_cast<Rep*>( new int[ intsNeeded ] );
rep_->str[ rep_->size = sz ] = '\0'; rep_->str[ rep_->size = sz ] = '\0';

View File

@ -57,7 +57,7 @@ void TiXmlBase::EncodeString( const TIXML_STRING& str, TIXML_STRING* outString )
{ {
unsigned char c = (unsigned char) str[i]; unsigned char c = (unsigned char) str[i];
if ( c == '&' if ( c == '&'
&& i < ( (int)str.length() - 2 ) && i < ( (int)str.length() - 2 )
&& str[i+1] == '#' && str[i+1] == '#'
&& str[i+2] == 'x' ) && str[i+2] == 'x' )
@ -110,12 +110,12 @@ void TiXmlBase::EncodeString( const TIXML_STRING& str, TIXML_STRING* outString )
// Easy pass at non-alpha/numeric/symbol // Easy pass at non-alpha/numeric/symbol
// Below 32 is symbolic. // Below 32 is symbolic.
char buf[ 32 ]; char buf[ 32 ];
#if defined(TIXML_SNPRINTF) #if defined(TIXML_SNPRINTF)
TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) ); TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) );
#else #else
sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) ); sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) );
#endif #endif
//*ME: warning C4267: convert 'size_t' to 'int' //*ME: warning C4267: convert 'size_t' to 'int'
//*ME: Int-Cast to make compiler happy ... //*ME: Int-Cast to make compiler happy ...
@ -154,14 +154,14 @@ TiXmlNode::~TiXmlNode()
temp = node; temp = node;
node = node->next; node = node->next;
delete temp; delete temp;
} }
} }
void TiXmlNode::CopyTo( TiXmlNode* target ) const void TiXmlNode::CopyTo( TiXmlNode* target ) const
{ {
target->SetValue (value.c_str() ); target->SetValue (value.c_str() );
target->userData = userData; target->userData = userData;
target->location = location; target->location = location;
} }
@ -176,7 +176,7 @@ void TiXmlNode::Clear()
temp = node; temp = node;
node = node->next; node = node->next;
delete temp; delete temp;
} }
firstChild = 0; firstChild = 0;
lastChild = 0; lastChild = 0;
@ -191,7 +191,7 @@ TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node )
if ( node->Type() == TiXmlNode::TINYXML_DOCUMENT ) if ( node->Type() == TiXmlNode::TINYXML_DOCUMENT )
{ {
delete node; delete node;
if ( GetDocument() ) if ( GetDocument() )
GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
return 0; return 0;
} }
@ -215,7 +215,7 @@ TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis )
{ {
if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT )
{ {
if ( GetDocument() ) if ( GetDocument() )
GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
return 0; return 0;
} }
@ -228,13 +228,13 @@ TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis )
TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ) TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis )
{ {
if ( !beforeThis || beforeThis->parent != this ) { if ( !beforeThis || beforeThis->parent != this ) {
return 0; return 0;
} }
if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT )
{ {
if ( GetDocument() ) if ( GetDocument() )
GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
return 0; return 0;
} }
@ -267,7 +267,7 @@ TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& a
} }
if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT )
{ {
if ( GetDocument() ) if ( GetDocument() )
GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
return 0; return 0;
} }
@ -304,7 +304,7 @@ TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& wit
if ( withThis.ToDocument() ) { if ( withThis.ToDocument() ) {
// A document can never be a child. Thanks to Noam. // A document can never be a child. Thanks to Noam.
TiXmlDocument* document = GetDocument(); TiXmlDocument* document = GetDocument();
if ( document ) if ( document )
document->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); document->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
return 0; return 0;
} }
@ -339,7 +339,7 @@ bool TiXmlNode::RemoveChild( TiXmlNode* removeThis )
} }
if ( removeThis->parent != this ) if ( removeThis->parent != this )
{ {
assert( 0 ); assert( 0 );
return false; return false;
} }
@ -410,7 +410,7 @@ const TiXmlNode* TiXmlNode::IterateChildren( const char * val, const TiXmlNode*
} }
const TiXmlNode* TiXmlNode::NextSibling( const char * _value ) const const TiXmlNode* TiXmlNode::NextSibling( const char * _value ) const
{ {
const TiXmlNode* node; const TiXmlNode* node;
for ( node = next; node; node = node->next ) for ( node = next; node; node = node->next )
@ -515,7 +515,7 @@ const TiXmlDocument* TiXmlNode::GetDocument() const
return 0; return 0;
} }
TiXmlElement::TiXmlElement( const std::string& _value ) TiXmlElement::TiXmlElement( const std::string& _value )
: TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) : TiXmlNode( TiXmlNode::TINYXML_ELEMENT )
{ {
firstChild = lastChild = 0; firstChild = lastChild = 0;
@ -526,7 +526,7 @@ TiXmlElement::TiXmlElement( const TiXmlElement& copy)
: TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) : TiXmlNode( TiXmlNode::TINYXML_ELEMENT )
{ {
firstChild = lastChild = 0; firstChild = lastChild = 0;
copy.CopyTo( this ); copy.CopyTo( this );
} }
@ -658,7 +658,7 @@ void TiXmlElement::CopyTo( TiXmlElement* target ) const
// superclass: // superclass:
TiXmlNode::CopyTo( target ); TiXmlNode::CopyTo( target );
// Element class: // Element class:
// Clone the attributes, then clone the children. // Clone the attributes, then clone the children.
const TiXmlAttribute* attribute = 0; const TiXmlAttribute* attribute = 0;
for( attribute = attributeSet.First(); for( attribute = attributeSet.First();
@ -677,7 +677,7 @@ void TiXmlElement::CopyTo( TiXmlElement* target ) const
bool TiXmlElement::Accept( TiXmlVisitor* visitor ) const bool TiXmlElement::Accept( TiXmlVisitor* visitor ) const
{ {
if ( visitor->VisitEnter( *this, attributeSet.First() ) ) if ( visitor->VisitEnter( *this, attributeSet.First() ) )
{ {
for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() )
{ {
@ -771,7 +771,7 @@ bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding )
value = filename; value = filename;
// reading in binary mode so that tinyxml can normalize the EOL // reading in binary mode so that tinyxml can normalize the EOL
FILE* file = TiXmlFOpen( value.c_str (), "rb" ); FILE* file = TiXmlFOpen( value.c_str (), "rb" );
if ( file ) if ( file )
{ {
@ -788,7 +788,7 @@ bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding )
bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding ) bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding )
{ {
if ( !file ) if ( !file )
{ {
SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN );
return false; return false;
@ -815,13 +815,13 @@ bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding )
// 2.11 End-of-Line Handling // 2.11 End-of-Line Handling
// <snip> // <snip>
// <quote> // <quote>
// ...the XML processor MUST behave as if it normalized all line breaks in external // ...the XML processor MUST behave as if it normalized all line breaks in external
// parsed entities (including the document entity) on input, before parsing, by translating // parsed entities (including the document entity) on input, before parsing, by translating
// both the two-character sequence #xD #xA and any #xD that is not followed by #xA to // both the two-character sequence #xD #xA and any #xD that is not followed by #xA to
// a single #xA character. // a single #xA character.
// </quote> // </quote>
// //
// It is not clear fgets does that, and certainly isn't clear it works cross platform. // It is not clear fgets does that, and certainly isn't clear it works cross platform.
// Generally, you expect fgets to translate from the convention of the OS to the c/unix // Generally, you expect fgets to translate from the convention of the OS to the c/unix
// convention, and not work generally. // convention, and not work generally.
@ -846,7 +846,7 @@ bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding )
// a newline-carriage return is hit. // a newline-carriage return is hit.
// //
// Wikipedia: // Wikipedia:
// Systems based on ASCII or a compatible character set use either LF (Line feed, '\n', 0x0A, 10 in decimal) or // Systems based on ASCII or a compatible character set use either LF (Line feed, '\n', 0x0A, 10 in decimal) or
// CR (Carriage return, '\r', 0x0D, 13 in decimal) individually, or CR followed by LF (CR+LF, 0x0D 0x0A)... // CR (Carriage return, '\r', 0x0D, 13 in decimal) individually, or CR followed by LF (CR+LF, 0x0D 0x0A)...
// * LF: Multics, Unix and Unix-like systems (GNU/Linux, AIX, Xenix, Mac OS X, FreeBSD, etc.), BeOS, Amiga, RISC OS, and others // * LF: Multics, Unix and Unix-like systems (GNU/Linux, AIX, Xenix, Mac OS X, FreeBSD, etc.), BeOS, Amiga, RISC OS, and others
// * CR+LF: DEC RT-11 and most other early non-Unix, non-IBM OSes, CP/M, MP/M, DOS, OS/2, Microsoft Windows, Symbian OS // * CR+LF: DEC RT-11 and most other early non-Unix, non-IBM OSes, CP/M, MP/M, DOS, OS/2, Microsoft Windows, Symbian OS
@ -900,7 +900,7 @@ bool TiXmlDocument::SaveFile( const char * filename ) const
bool TiXmlDocument::SaveFile( FILE* fp ) const bool TiXmlDocument::SaveFile( FILE* fp ) const
{ {
if ( useMicrosoftBOM ) if ( useMicrosoftBOM )
{ {
const unsigned char TIXML_UTF_LEAD_0 = 0xefU; const unsigned char TIXML_UTF_LEAD_0 = 0xefU;
const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; const unsigned char TIXML_UTF_LEAD_1 = 0xbbU;
@ -930,7 +930,7 @@ void TiXmlDocument::CopyTo( TiXmlDocument* target ) const
for ( node = firstChild; node; node = node->NextSibling() ) for ( node = firstChild; node; node = node->NextSibling() )
{ {
target->LinkEndChild( node->Clone() ); target->LinkEndChild( node->Clone() );
} }
} }
@ -1053,7 +1053,7 @@ int TiXmlAttribute::QueryDoubleValue( double* dval ) const
void TiXmlAttribute::SetIntValue( int _value ) void TiXmlAttribute::SetIntValue( int _value )
{ {
char buf [64]; char buf [64];
#if defined(TIXML_SNPRINTF) #if defined(TIXML_SNPRINTF)
TIXML_SNPRINTF(buf, sizeof(buf), "%d", _value); TIXML_SNPRINTF(buf, sizeof(buf), "%d", _value);
#else #else
sprintf (buf, "%d", _value); sprintf (buf, "%d", _value);
@ -1064,7 +1064,7 @@ void TiXmlAttribute::SetIntValue( int _value )
void TiXmlAttribute::SetDoubleValue( double _value ) void TiXmlAttribute::SetDoubleValue( double _value )
{ {
char buf [256]; char buf [256];
#if defined(TIXML_SNPRINTF) #if defined(TIXML_SNPRINTF)
TIXML_SNPRINTF( buf, sizeof(buf), "%g", _value); TIXML_SNPRINTF( buf, sizeof(buf), "%g", _value);
#else #else
sprintf (buf, "%g", _value); sprintf (buf, "%g", _value);
@ -1167,7 +1167,7 @@ bool TiXmlText::Accept( TiXmlVisitor* visitor ) const
TiXmlNode* TiXmlText::Clone() const TiXmlNode* TiXmlText::Clone() const
{ {
TiXmlText* clone = 0; TiXmlText* clone = 0;
clone = new TiXmlText( "" ); clone = new TiXmlText( "" );
@ -1206,7 +1206,7 @@ TiXmlDeclaration::TiXmlDeclaration( const std::string& _version,
TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy ) TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy )
: TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) : TiXmlNode( TiXmlNode::TINYXML_DECLARATION )
{ {
copy.CopyTo( this ); copy.CopyTo( this );
} }
@ -1257,7 +1257,7 @@ bool TiXmlDeclaration::Accept( TiXmlVisitor* visitor ) const
TiXmlNode* TiXmlDeclaration::Clone() const TiXmlNode* TiXmlDeclaration::Clone() const
{ {
TiXmlDeclaration* clone = new TiXmlDeclaration(); TiXmlDeclaration* clone = new TiXmlDeclaration();
if ( !clone ) if ( !clone )
@ -1395,7 +1395,7 @@ TiXmlAttribute* TiXmlAttributeSet::FindOrCreate( const char* _name )
} }
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
std::istream& operator>> (std::istream & in, TiXmlNode & base) std::istream& operator>> (std::istream & in, TiXmlNode & base)
{ {
TIXML_STRING tag; TIXML_STRING tag;
@ -1408,7 +1408,7 @@ std::istream& operator>> (std::istream & in, TiXmlNode & base)
#endif #endif
#ifdef TIXML_USE_STL #ifdef TIXML_USE_STL
std::ostream& operator<< (std::ostream & out, const TiXmlNode & base) std::ostream& operator<< (std::ostream & out, const TiXmlNode & base)
{ {
TiXmlPrinter printer; TiXmlPrinter printer;
@ -1578,12 +1578,12 @@ bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute
attrib->Print( 0, 0, &buffer ); attrib->Print( 0, 0, &buffer );
} }
if ( !element.FirstChild() ) if ( !element.FirstChild() )
{ {
buffer += " />"; buffer += " />";
DoLineBreak(); DoLineBreak();
} }
else else
{ {
buffer += ">"; buffer += ">";
if ( element.FirstChild()->ToText() if ( element.FirstChild()->ToText()
@ -1598,7 +1598,7 @@ bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute
DoLineBreak(); DoLineBreak();
} }
} }
++depth; ++depth;
return true; return true;
} }
@ -1606,11 +1606,11 @@ bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute
bool TiXmlPrinter::VisitExit( const TiXmlElement& element ) bool TiXmlPrinter::VisitExit( const TiXmlElement& element )
{ {
--depth; --depth;
if ( !element.FirstChild() ) if ( !element.FirstChild() )
{ {
// nothing. // nothing.
} }
else else
{ {
if ( simpleTextPrint ) if ( simpleTextPrint )
{ {

View File

@ -2,12 +2,12 @@
www.sourceforge.net/projects/tinyxml www.sourceforge.net/projects/tinyxml
Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com) Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any warranty. In no event will the authors be held liable for any
damages arising from the use of this software. damages arising from the use of this software.
Permission is granted to anyone to use this software for any Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions: 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

View File

@ -2,23 +2,23 @@
www.sourceforge.net/projects/tinyxml www.sourceforge.net/projects/tinyxml
Original code by Lee Thomason (www.grinninglizard.com) Original code by Lee Thomason (www.grinninglizard.com)
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any warranty. In no event will the authors be held liable for any
damages arising from the use of this software. damages arising from the use of this software.
Permission is granted to anyone to use this software for any Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions: 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 not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation software in a product, an acknowledgment in the product documentation
would be appreciated but is not required. 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. 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. distribution.
*/ */
@ -39,8 +39,8 @@ distribution.
// Note tha "PutString" hardcodes the same list. This // Note tha "PutString" hardcodes the same list. This
// is less flexible than it appears. Changing the entries // is less flexible than it appears. Changing the entries
// or order will break putstring. // or order will break putstring.
TiXmlBase::Entity TiXmlBase::entity[ TiXmlBase::NUM_ENTITY ] = TiXmlBase::Entity TiXmlBase::entity[ TiXmlBase::NUM_ENTITY ] =
{ {
{ "&amp;", 5, '&' }, { "&amp;", 5, '&' },
{ "&lt;", 4, '<' }, { "&lt;", 4, '<' },
@ -54,16 +54,16 @@ TiXmlBase::Entity TiXmlBase::entity[ TiXmlBase::NUM_ENTITY ] =
// Including the basic of this table, which determines the #bytes in the // Including the basic of this table, which determines the #bytes in the
// sequence from the lead byte. 1 placed for invalid sequences -- // sequence from the lead byte. 1 placed for invalid sequences --
// although the result will be junk, pass it through as much as possible. // although the result will be junk, pass it through as much as possible.
// Beware of the non-characters in UTF-8: // Beware of the non-characters in UTF-8:
// ef bb bf (Microsoft "lead bytes") // ef bb bf (Microsoft "lead bytes")
// ef bf be // ef bf be
// ef bf bf // ef bf bf
const unsigned char TIXML_UTF_LEAD_0 = 0xefU; const unsigned char TIXML_UTF_LEAD_0 = 0xefU;
const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; const unsigned char TIXML_UTF_LEAD_1 = 0xbbU;
const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; const unsigned char TIXML_UTF_LEAD_2 = 0xbfU;
const int TiXmlBase::utf8ByteTable[256] = const int TiXmlBase::utf8ByteTable[256] =
{ {
// 0 1 2 3 4 5 6 7 8 9 a b c d e f // 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, // 0x00
@ -75,9 +75,9 @@ const int TiXmlBase::utf8ByteTable[256] =
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, // 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, // 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, // 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, // 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, // 0xa0
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0 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 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 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 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xe0 0xe0 to 0xef 3 byte
@ -91,7 +91,7 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng
const unsigned long BYTE_MARK = 0x80; const unsigned long BYTE_MARK = 0x80;
const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
if (input < 0x80) if (input < 0x80)
*length = 1; *length = 1;
else if ( input < 0x800 ) else if ( input < 0x800 )
*length = 2; *length = 2;
@ -105,22 +105,22 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng
output += *length; output += *length;
// Scary scary fall throughs. // Scary scary fall throughs.
switch (*length) switch (*length)
{ {
case 4: case 4:
--output; --output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK); *output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6; input >>= 6;
case 3: case 3:
--output; --output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK); *output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6; input >>= 6;
case 2: case 2:
--output; --output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK); *output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6; input >>= 6;
case 1: case 1:
--output; --output;
*output = (char)(input | FIRST_BYTE_MARK[*length]); *output = (char)(input | FIRST_BYTE_MARK[*length]);
} }
} }
@ -130,7 +130,7 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng
{ {
// This will only work for low-ascii, everything else is assumed to be a valid // 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 // letter. I'm not sure this is the best approach, but it is quite tricky trying
// to figure out alhabetical vs. not across encoding. So take a very // to figure out alhabetical vs. not across encoding. So take a very
// conservative approach. // conservative approach.
// if ( encoding == TIXML_ENCODING_UTF8 ) // if ( encoding == TIXML_ENCODING_UTF8 )
@ -151,7 +151,7 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng
{ {
// This will only work for low-ascii, everything else is assumed to be a valid // 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 // letter. I'm not sure this is the best approach, but it is quite tricky trying
// to figure out alhabetical vs. not across encoding. So take a very // to figure out alhabetical vs. not across encoding. So take a very
// conservative approach. // conservative approach.
// if ( encoding == TIXML_ENCODING_UTF8 ) // if ( encoding == TIXML_ENCODING_UTF8 )
@ -224,7 +224,7 @@ void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding )
case '\r': case '\r':
// bump down to the next line // bump down to the next line
++row; ++row;
col = 0; col = 0;
// Eat the character // Eat the character
++p; ++p;
@ -266,11 +266,11 @@ void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding )
// In these cases, don't advance the column. These are // In these cases, don't advance the column. These are
// 0-width spaces. // 0-width spaces.
if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 ) if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 )
p += 3; p += 3;
else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU ) else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU )
p += 3; p += 3;
else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU ) else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU )
p += 3; p += 3;
else else
{ p +=3; ++col; } // A normal character. { p +=3; ++col; } // A normal character.
} }
@ -322,10 +322,10 @@ const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding )
while ( *p ) while ( *p )
{ {
const unsigned char* pU = (const unsigned char*)p; const unsigned char* pU = (const unsigned char*)p;
// Skip the stupid Microsoft UTF-8 Byte order marks // Skip the stupid Microsoft UTF-8 Byte order marks
if ( *(pU+0)==TIXML_UTF_LEAD_0 if ( *(pU+0)==TIXML_UTF_LEAD_0
&& *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+1)==TIXML_UTF_LEAD_1
&& *(pU+2)==TIXML_UTF_LEAD_2 ) && *(pU+2)==TIXML_UTF_LEAD_2 )
{ {
p += 3; p += 3;
@ -413,12 +413,12 @@ const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncodi
// After that, they can be letters, underscores, numbers, // After that, they can be letters, underscores, numbers,
// hyphens, or colons. (Colons are valid ony for namespaces, // hyphens, or colons. (Colons are valid ony for namespaces,
// but tinyxml can't tell namespaces from names.) // but tinyxml can't tell namespaces from names.)
if ( p && *p if ( p && *p
&& ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) ) && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) )
{ {
const char* start = p; const char* start = p;
while( p && *p while( p && *p
&& ( IsAlphaNum( (unsigned char ) *p, encoding ) && ( IsAlphaNum( (unsigned char ) *p, encoding )
|| *p == '_' || *p == '_'
|| *p == '-' || *p == '-'
|| *p == '.' || *p == '.'
@ -469,7 +469,7 @@ const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXml
ucs += mult * (*q - 'a' + 10); ucs += mult * (*q - 'a' + 10);
else if ( *q >= 'A' && *q <= 'F' ) else if ( *q >= 'A' && *q <= 'F' )
ucs += mult * (*q - 'A' + 10 ); ucs += mult * (*q - 'A' + 10 );
else else
return 0; return 0;
mult *= 16; mult *= 16;
--q; --q;
@ -492,7 +492,7 @@ const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXml
{ {
if ( *q >= '0' && *q <= '9' ) if ( *q >= '0' && *q <= '9' )
ucs += mult * (*q - '0'); ucs += mult * (*q - '0');
else else
return 0; return 0;
mult *= 10; mult *= 10;
--q; --q;
@ -571,10 +571,10 @@ bool TiXmlBase::StringEqual( const char* p,
return false; return false;
} }
const char* TiXmlBase::ReadText( const char* p, const char* TiXmlBase::ReadText( const char* p,
TIXML_STRING * text, TIXML_STRING * text,
bool trimWhiteSpace, bool trimWhiteSpace,
const char* endTag, const char* endTag,
bool caseInsensitive, bool caseInsensitive,
TiXmlEncoding encoding ) TiXmlEncoding encoding )
{ {
@ -647,7 +647,7 @@ void TiXmlDocument::StreamIn( std::istream * in, TIXML_STRING * tag )
// This "pre-streaming" will never read the closing ">" so the // This "pre-streaming" will never read the closing ">" so the
// sub-tag can orient itself. // sub-tag can orient itself.
if ( !StreamTo( in, '<', tag ) ) if ( !StreamTo( in, '<', tag ) )
{ {
SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
return; return;
@ -669,7 +669,7 @@ void TiXmlDocument::StreamIn( std::istream * in, TIXML_STRING * tag )
if ( in->good() ) if ( in->good() )
{ {
// We now have something we presume to be a node of // We now have something we presume to be a node of
// some sort. Identify it, and call the node to // some sort. Identify it, and call the node to
// continue streaming. // continue streaming.
TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING ); TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING );
@ -778,7 +778,7 @@ const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiX
encoding = TIXML_ENCODING_UTF8; encoding = TIXML_ENCODING_UTF8;
else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) ) else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) )
encoding = TIXML_ENCODING_UTF8; // incorrect, but be nice encoding = TIXML_ENCODING_UTF8; // incorrect, but be nice
else else
encoding = TIXML_ENCODING_LEGACY; encoding = TIXML_ENCODING_LEGACY;
} }
@ -796,7 +796,7 @@ const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiX
} }
void TiXmlDocument::SetError( int err, const char* pError, TiXmlParsingData* data, TiXmlEncoding encoding ) void TiXmlDocument::SetError( int err, const char* pError, TiXmlParsingData* data, TiXmlEncoding encoding )
{ {
// The first error in a chain is more accurate - don't set again! // The first error in a chain is more accurate - don't set again!
if ( error ) if ( error )
return; return;
@ -832,7 +832,7 @@ TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding )
return 0; return 0;
} }
// What is this thing? // What is this thing?
// - Elements start with a letter or underscore, but xml is reserved. // - Elements start with a letter or underscore, but xml is reserved.
// - Comments: <!-- // - Comments: <!--
// - Decleration: <?xml // - Decleration: <?xml
@ -915,7 +915,7 @@ void TiXmlElement::StreamIn (std::istream * in, TIXML_STRING * tag)
return; return;
} }
(*tag) += (char) c ; (*tag) += (char) c ;
if ( c == '>' ) if ( c == '>' )
break; break;
} }
@ -925,7 +925,7 @@ void TiXmlElement::StreamIn (std::istream * in, TIXML_STRING * tag)
// Okay...if we are a "/>" tag, then we're done. We've read a complete tag. // Okay...if we are a "/>" tag, then we're done. We've read a complete tag.
// If not, identify and stream. // If not, identify and stream.
if ( tag->at( tag->length() - 1 ) == '>' if ( tag->at( tag->length() - 1 ) == '>'
&& tag->at( tag->length() - 2 ) == '/' ) && tag->at( tag->length() - 2 ) == '/' )
{ {
// All good! // All good!
@ -943,7 +943,7 @@ void TiXmlElement::StreamIn (std::istream * in, TIXML_STRING * tag)
StreamWhiteSpace( in, tag ); StreamWhiteSpace( in, tag );
// Do we have text? // Do we have text?
if ( in->good() && in->peek() != '<' ) if ( in->good() && in->peek() != '<' )
{ {
// Yep, text. // Yep, text.
TiXmlText text( "" ); TiXmlText text( "" );
@ -976,7 +976,7 @@ void TiXmlElement::StreamIn (std::istream * in, TIXML_STRING * tag)
document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
return; return;
} }
if ( c == '>' ) if ( c == '>' )
break; break;
@ -1095,7 +1095,7 @@ const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
// Empty tag. // Empty tag.
if ( *p != '>' ) if ( *p != '>' )
{ {
if ( document ) document->SetError( TIXML_ERROR_PARSING_EMPTY, p, data, encoding ); if ( document ) document->SetError( TIXML_ERROR_PARSING_EMPTY, p, data, encoding );
return 0; return 0;
} }
return (p+1); return (p+1);
@ -1117,7 +1117,7 @@ const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
// We should find the end tag now // We should find the end tag now
// note that: // note that:
// </foo > and // </foo > and
// </foo> // </foo>
// are both valid end tags. // are both valid end tags.
if ( StringEqual( p, endTag.c_str(), false, encoding ) ) if ( StringEqual( p, endTag.c_str(), false, encoding ) )
{ {
@ -1211,8 +1211,8 @@ const char* TiXmlElement::ReadValue( const char* p, TiXmlParsingData* data, TiXm
LinkEndChild( textNode ); LinkEndChild( textNode );
else else
delete textNode; delete textNode;
} }
else else
{ {
// We hit a '<' // We hit a '<'
// Have we hit a new element or an end tag? This could also be // Have we hit a new element or an end tag? This could also be
@ -1228,7 +1228,7 @@ const char* TiXmlElement::ReadValue( const char* p, TiXmlParsingData* data, TiXm
{ {
p = node->Parse( p, data, encoding ); p = node->Parse( p, data, encoding );
LinkEndChild( node ); LinkEndChild( node );
} }
else else
{ {
return 0; return 0;
@ -1242,7 +1242,7 @@ const char* TiXmlElement::ReadValue( const char* p, TiXmlParsingData* data, TiXm
if ( !p ) if ( !p )
{ {
if ( document ) document->SetError( TIXML_ERROR_READING_ELEMENT_VALUE, 0, 0, encoding ); if ( document ) document->SetError( TIXML_ERROR_READING_ELEMENT_VALUE, 0, 0, encoding );
} }
return p; return p;
} }
@ -1252,7 +1252,7 @@ void TiXmlUnknown::StreamIn( std::istream * in, TIXML_STRING * tag )
{ {
while ( in->good() ) while ( in->good() )
{ {
int c = in->get(); int c = in->get();
if ( c <= 0 ) if ( c <= 0 )
{ {
TiXmlDocument* document = GetDocument(); TiXmlDocument* document = GetDocument();
@ -1265,7 +1265,7 @@ void TiXmlUnknown::StreamIn( std::istream * in, TIXML_STRING * tag )
if ( c == '>' ) if ( c == '>' )
{ {
// All is well. // All is well.
return; return;
} }
} }
} }
@ -1298,7 +1298,7 @@ const char* TiXmlUnknown::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
if ( !p ) if ( !p )
{ {
if ( document ) if ( document )
document->SetError( TIXML_ERROR_PARSING_UNKNOWN, 0, 0, encoding ); document->SetError( TIXML_ERROR_PARSING_UNKNOWN, 0, 0, encoding );
} }
if ( p && *p == '>' ) if ( p && *p == '>' )
@ -1311,7 +1311,7 @@ void TiXmlComment::StreamIn( std::istream * in, TIXML_STRING * tag )
{ {
while ( in->good() ) while ( in->good() )
{ {
int c = in->get(); int c = in->get();
if ( c <= 0 ) if ( c <= 0 )
{ {
TiXmlDocument* document = GetDocument(); TiXmlDocument* document = GetDocument();
@ -1322,12 +1322,12 @@ void TiXmlComment::StreamIn( std::istream * in, TIXML_STRING * tag )
(*tag) += (char) c; (*tag) += (char) c;
if ( c == '>' if ( c == '>'
&& tag->at( tag->length() - 2 ) == '-' && tag->at( tag->length() - 2 ) == '-'
&& tag->at( tag->length() - 3 ) == '-' ) && tag->at( tag->length() - 3 ) == '-' )
{ {
// All is well. // All is well.
return; return;
} }
} }
} }
@ -1363,11 +1363,11 @@ const char* TiXmlComment::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
// //
// from the XML spec: // from the XML spec:
/* /*
[Definition: Comments may appear anywhere in a document outside other markup; in addition, [Definition: Comments may appear anywhere in a document outside other markup; in addition,
they may appear within the document type declaration at places allowed by the grammar. they may appear within the document type declaration at places allowed by the grammar.
They are not part of the document's character data; an XML processor MAY, but need not, They are not part of the document's character data; an XML processor MAY, but need not,
make it possible for an application to retrieve the text of comments. For compatibility, make it possible for an application to retrieve the text of comments. For compatibility,
the string "--" (double-hyphen) MUST NOT occur within comments.] Parameter entity the string "--" (double-hyphen) MUST NOT occur within comments.] Parameter entity
references MUST NOT be recognized within comments. references MUST NOT be recognized within comments.
An example of a comment: An example of a comment:
@ -1382,7 +1382,7 @@ const char* TiXmlComment::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
value.append( p, 1 ); value.append( p, 1 );
++p; ++p;
} }
if ( p && *p ) if ( p && *p )
p += strlen( endTag ); p += strlen( endTag );
return p; return p;
@ -1421,7 +1421,7 @@ const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlE
if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
return 0; return 0;
} }
const char* end; const char* end;
const char SINGLE_QUOTE = '\''; const char SINGLE_QUOTE = '\'';
const char DOUBLE_QUOTE = '\"'; const char DOUBLE_QUOTE = '\"';
@ -1450,7 +1450,7 @@ const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlE
{ {
if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) { if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) {
// [ 1451649 ] Attribute values with trailing quotes not handled correctly // [ 1451649 ] Attribute values with trailing quotes not handled correctly
// We did not have an opening quote but seem to have a // We did not have an opening quote but seem to have a
// closing one. Give up and throw an error. // closing one. Give up and throw an error.
if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
return 0; return 0;
@ -1467,8 +1467,8 @@ void TiXmlText::StreamIn( std::istream * in, TIXML_STRING * tag )
{ {
while ( in->good() ) while ( in->good() )
{ {
int c = in->peek(); int c = in->peek();
if ( !cdata && (c == '<' ) ) if ( !cdata && (c == '<' ) )
{ {
return; return;
} }
@ -1489,7 +1489,7 @@ void TiXmlText::StreamIn( std::istream * in, TIXML_STRING * tag )
// terminator of cdata. // terminator of cdata.
return; return;
} }
} }
} }
} }
#endif #endif
@ -1529,7 +1529,7 @@ const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncodi
++p; ++p;
} }
TIXML_STRING dummy; TIXML_STRING dummy;
p = ReadText( p, &dummy, false, endTag, false, encoding ); p = ReadText( p, &dummy, false, endTag, false, encoding );
return p; return p;
} }
@ -1603,19 +1603,19 @@ const char* TiXmlDeclaration::Parse( const char* p, TiXmlParsingData* data, TiXm
if ( StringEqual( p, "version", true, _encoding ) ) if ( StringEqual( p, "version", true, _encoding ) )
{ {
TiXmlAttribute attrib; TiXmlAttribute attrib;
p = attrib.Parse( p, data, _encoding ); p = attrib.Parse( p, data, _encoding );
version = attrib.Value(); version = attrib.Value();
} }
else if ( StringEqual( p, "encoding", true, _encoding ) ) else if ( StringEqual( p, "encoding", true, _encoding ) )
{ {
TiXmlAttribute attrib; TiXmlAttribute attrib;
p = attrib.Parse( p, data, _encoding ); p = attrib.Parse( p, data, _encoding );
encoding = attrib.Value(); encoding = attrib.Value();
} }
else if ( StringEqual( p, "standalone", true, _encoding ) ) else if ( StringEqual( p, "standalone", true, _encoding ) )
{ {
TiXmlAttribute attrib; TiXmlAttribute attrib;
p = attrib.Parse( p, data, _encoding ); p = attrib.Parse( p, data, _encoding );
standalone = attrib.Value(); standalone = attrib.Value();
} }
else else

View File

@ -1,4 +1,4 @@
# CMAKE_CURRENT_LIST_DIR cmake 2.6 compatiblity # CMAKE_CURRENT_LIST_DIR cmake 2.6 compatibility
if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6) if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)
get_filename_component(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) get_filename_component(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
endif(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6) endif(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)

View File

@ -21,7 +21,7 @@ def generate_bitmap_font(timg, tdrawable, font, font_size, first_char, glyph_wid
glyphs_layer = gimp.Layer(image, "Glyphs", width, height, RGBA_IMAGE, 100, NORMAL_MODE) glyphs_layer = gimp.Layer(image, "Glyphs", width, height, RGBA_IMAGE, 100, NORMAL_MODE)
image.add_layer(glyphs_layer, 0) image.add_layer(glyphs_layer, 0)
disp = gimp.Display(image) disp = gimp.Display(image)
for i in range(char_begin, char_end): for i in range(char_begin, char_end):