diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..c7413510 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +# Normalize source code before commits +*.lua eol=lf +*.txt eol=lf +*.ot* eol=lf +*.cpp eol=lf +*.h eol=lf diff --git a/modules/client_options/options.lua b/modules/client_options/options.lua index f6495fae..3a933f80 100644 --- a/modules/client_options/options.lua +++ b/modules/client_options/options.lua @@ -74,7 +74,7 @@ function Options.init() optionsWindow = g_ui.displayUI('options.otui') optionsWindow:hide() optionsButton = TopMenu.addLeftButton('optionsButton', tr('Options') .. ' (Ctrl+D)', 'options.png', Options.toggle) - + optionsTabBar = optionsWindow:getChildById('optionsTabBar') optionsTabBar:setContentWidget(optionsWindow:getChildById('optionsTabContent')) @@ -146,7 +146,7 @@ function Options.setOption(key, value) value = 0 end - if graphicsPanel then + if graphicsPanel then graphicsPanel:getChildById('backgroundFrameRateLabel'):setText(tr('Game framerate limit: %s', text)) end g_app.setBackgroundPaneMaxFps(value) diff --git a/modules/client_skins/skins/default/styles/tables.otui b/modules/client_skins/skins/default/styles/tables.otui index 344ed97d..a6d80cbb 100644 --- a/modules/client_skins/skins/default/styles/tables.otui +++ b/modules/client_skins/skins/default/styles/tables.otui @@ -4,7 +4,7 @@ Table < UITable header-row-style: HeaderTableRow column-style: TableColumn row-style: TableRow - + TableData < UIScrollArea layout: verticalBox diff --git a/modules/client_topmenu/topmenu.lua b/modules/client_topmenu/topmenu.lua index 8d203591..ec616f74 100644 --- a/modules/client_topmenu/topmenu.lua +++ b/modules/client_topmenu/topmenu.lua @@ -84,7 +84,7 @@ end function TopMenu.addRightGameButton(id, description, icon, callback) return addButton(id, description, icon, callback, rightGameButtonsPanel, false) end - + function TopMenu.addRightGameToggleButton(id, description, icon, callback, right) return addButton(id, description, icon, callback, rightGameButtonsPanel, true) end diff --git a/modules/client_topmenu/topmenu.otui b/modules/client_topmenu/topmenu.otui index dcdbfbd2..3ce681e1 100644 --- a/modules/client_topmenu/topmenu.otui +++ b/modules/client_topmenu/topmenu.otui @@ -62,7 +62,7 @@ TopPanel anchors.bottom: parent.bottom anchors.left: prev.right visible: false - + UILabel id: frameCounter text-align: right diff --git a/modules/corelib/bitwise.lua b/modules/corelib/bitwise.lua index dcce309c..0eed21c4 100644 --- a/modules/corelib/bitwise.lua +++ b/modules/corelib/bitwise.lua @@ -5,7 +5,7 @@ function Bit.bit(p) end function Bit.hasBit(x, p) - return x % (p + p) >= p + return x % (p + p) >= p end function Bit.setbit(x, p) diff --git a/modules/game_interface/styles/logoutwindow.otui b/modules/game_interface/styles/logoutwindow.otui index 559d3623..ee4a1793 100644 --- a/modules/game_interface/styles/logoutwindow.otui +++ b/modules/game_interface/styles/logoutwindow.otui @@ -18,7 +18,7 @@ LogoutWindow < MainWindow anchors.left: parent.left anchors.bottom: parent.bottom margin-left: 65 - + Button id: buttonNo !text: tr('No') diff --git a/modules/game_market/market.lua b/modules/game_market/market.lua index 7253a274..297657fe 100644 --- a/modules/game_market/market.lua +++ b/modules/game_market/market.lua @@ -183,16 +183,16 @@ local function updateDetails(itemId, descriptions, purchaseStats, saleStats) else for k, stat in pairs(saleStats) do if not table.empty(stat) then - sellStatsTable:addRow({{['text'] = 'Total Transations:'}, + sellStatsTable:addRow({{['text'] = 'Total Transations:'}, {['text'] = stat[1], ['width'] = 270}}) - sellStatsTable:addRow({{['text'] = 'Highest Price:'}, + sellStatsTable:addRow({{['text'] = 'Highest Price:'}, {['text'] = stat[3], ['width'] = 270}}) - sellStatsTable:addRow({{['text'] = 'Average Price:'}, + sellStatsTable:addRow({{['text'] = 'Average Price:'}, {['text'] = math.floor(stat[2]/stat[1])}}) - sellStatsTable:addRow({{['text'] = 'Lowest Price:'}, + sellStatsTable:addRow({{['text'] = 'Lowest Price:'}, {['text'] = stat[4], ['width'] = 270}}) end end @@ -205,16 +205,16 @@ local function updateDetails(itemId, descriptions, purchaseStats, saleStats) else for k, stat in pairs(purchaseStats) do if not table.empty(stat) then - buyStatsTable:addRow({{['text'] = 'Total Transations:'}, + buyStatsTable:addRow({{['text'] = 'Total Transations:'}, {['text'] = stat[1], ['width'] = 270}}) - buyStatsTable:addRow({{['text'] = 'Highest Price:'}, + buyStatsTable:addRow({{['text'] = 'Highest Price:'}, {['text'] = stat[3], ['width'] = 270}}) - buyStatsTable:addRow({{['text'] = 'Average Price:'}, + buyStatsTable:addRow({{['text'] = 'Average Price:'}, {['text'] = math.floor(stat[2]/stat[1]), ['width'] = 270}}) - buyStatsTable:addRow({{['text'] = 'Lowest Price:'}, + buyStatsTable:addRow({{['text'] = 'Lowest Price:'}, {['text'] = stat[4], ['width'] = 270}}) end end @@ -230,7 +230,7 @@ local function updateSelectedItem(newItem) nameLabel:setText(selectedItem.item.marketData.name) -- update offer types Market.enableCreateOffer(true) - + MarketProtocol.sendMarketBrowse(selectedItem.item.ptr:getId()) -- send browsed msg else Market.Market.clearSelectedItem() @@ -429,7 +429,7 @@ local function initInterface() -- setup 'My Offer' section tabs myOffersPanel = g_ui.loadUI('ui/myoffers.otui') mainTabBar:addTab(tr('My Offers'), myOffersPanel) - + offersTabBar = myOffersPanel:getChildById('offersTabBar') offersTabBar:setContentWidget(myOffersPanel:getChildById('offersTabContent')) @@ -483,7 +483,7 @@ local function initInterface() categoryList:addOption(getMarketCategoryName(255)) -- meta weapons categoryList:setCurrentOption(getMarketCategoryName(MarketCategory.First)) subCategoryList:setEnabled(false) - + -- hook item filters categoryList.onOptionChange = onChangeCategory subCategoryList.onOptionChange = onChangeSubCategory @@ -521,7 +521,7 @@ function terminate() if marketWindow then marketWindow:destroy() end - + Market = nil end @@ -693,7 +693,7 @@ function Market.loadDepotItems(depotItems) table.insert(items, newItem) end end - + for _, newItem in pairs(items) do local marketData = newItem:getMarketData() diff --git a/modules/game_tibiafiles/.gitignore b/modules/game_tibiafiles/.gitignore index 8d1c8b69..8b137891 100644 --- a/modules/game_tibiafiles/.gitignore +++ b/modules/game_tibiafiles/.gitignore @@ -1 +1 @@ - + diff --git a/src/framework/CMakeLists.txt b/src/framework/CMakeLists.txt index 7214dde2..2f7d6e0f 100644 --- a/src/framework/CMakeLists.txt +++ b/src/framework/CMakeLists.txt @@ -4,7 +4,7 @@ # FRAMEWORK_NET # 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) get_filename_component(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) endif(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6) diff --git a/src/framework/xml/tinystr.h b/src/framework/xml/tinystr.h index e10bb2c4..29915bb9 100644 --- a/src/framework/xml/tinystr.h +++ b/src/framework/xml/tinystr.h @@ -224,7 +224,7 @@ class TiXmlString // to the normal allocation, although use an 'int' for systems // that are overly picky about structure alignment. 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( new int[ intsNeeded ] ); rep_->str[ rep_->size = sz ] = '\0'; diff --git a/src/framework/xml/tinyxml.cpp b/src/framework/xml/tinyxml.cpp index 4e58378f..ea336f85 100644 --- a/src/framework/xml/tinyxml.cpp +++ b/src/framework/xml/tinyxml.cpp @@ -57,7 +57,7 @@ void TiXmlBase::EncodeString( const TIXML_STRING& str, TIXML_STRING* outString ) { unsigned char c = (unsigned char) str[i]; - if ( c == '&' + if ( c == '&' && i < ( (int)str.length() - 2 ) && str[i+1] == '#' && 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 // Below 32 is symbolic. char buf[ 32 ]; - - #if defined(TIXML_SNPRINTF) + + #if defined(TIXML_SNPRINTF) TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) ); #else sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) ); - #endif + #endif //*ME: warning C4267: convert 'size_t' to 'int' //*ME: Int-Cast to make compiler happy ... @@ -154,14 +154,14 @@ TiXmlNode::~TiXmlNode() temp = node; node = node->next; delete temp; - } + } } void TiXmlNode::CopyTo( TiXmlNode* target ) const { target->SetValue (value.c_str() ); - target->userData = userData; + target->userData = userData; target->location = location; } @@ -176,7 +176,7 @@ void TiXmlNode::Clear() temp = node; node = node->next; delete temp; - } + } firstChild = 0; lastChild = 0; @@ -191,7 +191,7 @@ TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node ) if ( node->Type() == TiXmlNode::TINYXML_DOCUMENT ) { delete node; - if ( GetDocument() ) + if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); return 0; } @@ -215,7 +215,7 @@ TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis ) { if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) { - if ( GetDocument() ) + if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); return 0; } @@ -228,13 +228,13 @@ TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis ) TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ) -{ +{ if ( !beforeThis || beforeThis->parent != this ) { return 0; } if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) { - if ( GetDocument() ) + if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); return 0; } @@ -267,7 +267,7 @@ TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& a } if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) { - if ( GetDocument() ) + if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); return 0; } @@ -304,7 +304,7 @@ TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& wit if ( withThis.ToDocument() ) { // A document can never be a child. Thanks to Noam. TiXmlDocument* document = GetDocument(); - if ( document ) + if ( document ) document->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); return 0; } @@ -339,7 +339,7 @@ bool TiXmlNode::RemoveChild( TiXmlNode* removeThis ) } if ( removeThis->parent != this ) - { + { assert( 0 ); 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; for ( node = next; node; node = node->next ) @@ -515,7 +515,7 @@ const TiXmlDocument* TiXmlNode::GetDocument() const return 0; } -TiXmlElement::TiXmlElement( const std::string& _value ) +TiXmlElement::TiXmlElement( const std::string& _value ) : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) { firstChild = lastChild = 0; @@ -526,7 +526,7 @@ TiXmlElement::TiXmlElement( const TiXmlElement& copy) : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) { firstChild = lastChild = 0; - copy.CopyTo( this ); + copy.CopyTo( this ); } @@ -658,7 +658,7 @@ void TiXmlElement::CopyTo( TiXmlElement* target ) const // superclass: TiXmlNode::CopyTo( target ); - // Element class: + // Element class: // Clone the attributes, then clone the children. const TiXmlAttribute* attribute = 0; for( attribute = attributeSet.First(); @@ -677,7 +677,7 @@ void TiXmlElement::CopyTo( TiXmlElement* target ) 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() ) { @@ -771,7 +771,7 @@ bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding ) value = filename; // 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 ) { @@ -788,7 +788,7 @@ bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding ) bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding ) { - if ( !file ) + if ( !file ) { SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); return false; @@ -815,13 +815,13 @@ bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding ) // 2.11 End-of-Line Handling // // - // ...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 - // both the two-character sequence #xD #xA and any #xD that is not followed by #xA to + // ...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 + // both the two-character sequence #xD #xA and any #xD that is not followed by #xA to // a single #xA character. // // - // 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 // convention, and not work generally. @@ -846,7 +846,7 @@ bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding ) // a newline-carriage return is hit. // // 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)... // * 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 @@ -900,7 +900,7 @@ bool TiXmlDocument::SaveFile( const char * filename ) 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_1 = 0xbbU; @@ -930,7 +930,7 @@ void TiXmlDocument::CopyTo( TiXmlDocument* target ) const for ( node = firstChild; node; node = node->NextSibling() ) { target->LinkEndChild( node->Clone() ); - } + } } @@ -1053,7 +1053,7 @@ int TiXmlAttribute::QueryDoubleValue( double* dval ) const void TiXmlAttribute::SetIntValue( int _value ) { char buf [64]; - #if defined(TIXML_SNPRINTF) + #if defined(TIXML_SNPRINTF) TIXML_SNPRINTF(buf, sizeof(buf), "%d", _value); #else sprintf (buf, "%d", _value); @@ -1064,7 +1064,7 @@ void TiXmlAttribute::SetIntValue( int _value ) void TiXmlAttribute::SetDoubleValue( double _value ) { char buf [256]; - #if defined(TIXML_SNPRINTF) + #if defined(TIXML_SNPRINTF) TIXML_SNPRINTF( buf, sizeof(buf), "%g", _value); #else sprintf (buf, "%g", _value); @@ -1167,7 +1167,7 @@ bool TiXmlText::Accept( TiXmlVisitor* visitor ) const TiXmlNode* TiXmlText::Clone() const -{ +{ TiXmlText* clone = 0; clone = new TiXmlText( "" ); @@ -1206,7 +1206,7 @@ TiXmlDeclaration::TiXmlDeclaration( const std::string& _version, TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy ) : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) { - copy.CopyTo( this ); + copy.CopyTo( this ); } @@ -1257,7 +1257,7 @@ bool TiXmlDeclaration::Accept( TiXmlVisitor* visitor ) const TiXmlNode* TiXmlDeclaration::Clone() const -{ +{ TiXmlDeclaration* clone = new TiXmlDeclaration(); 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) { TIXML_STRING tag; @@ -1408,7 +1408,7 @@ std::istream& operator>> (std::istream & in, TiXmlNode & base) #endif -#ifdef TIXML_USE_STL +#ifdef TIXML_USE_STL std::ostream& operator<< (std::ostream & out, const TiXmlNode & base) { TiXmlPrinter printer; @@ -1578,12 +1578,12 @@ bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute attrib->Print( 0, 0, &buffer ); } - if ( !element.FirstChild() ) + if ( !element.FirstChild() ) { buffer += " />"; DoLineBreak(); } - else + else { buffer += ">"; if ( element.FirstChild()->ToText() @@ -1598,7 +1598,7 @@ bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute DoLineBreak(); } } - ++depth; + ++depth; return true; } @@ -1606,11 +1606,11 @@ bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute bool TiXmlPrinter::VisitExit( const TiXmlElement& element ) { --depth; - if ( !element.FirstChild() ) + if ( !element.FirstChild() ) { // nothing. } - else + else { if ( simpleTextPrint ) { diff --git a/src/framework/xml/tinyxmlerror.cpp b/src/framework/xml/tinyxmlerror.cpp index db099abb..12d90c2a 100644 --- a/src/framework/xml/tinyxmlerror.cpp +++ b/src/framework/xml/tinyxmlerror.cpp @@ -2,12 +2,12 @@ www.sourceforge.net/projects/tinyxml 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 -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 diff --git a/src/framework/xml/tinyxmlparser.cpp b/src/framework/xml/tinyxmlparser.cpp index 51b47fae..0366d14a 100644 --- a/src/framework/xml/tinyxmlparser.cpp +++ b/src/framework/xml/tinyxmlparser.cpp @@ -2,23 +2,23 @@ www.sourceforge.net/projects/tinyxml Original code by 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. */ @@ -39,8 +39,8 @@ distribution. // Note tha "PutString" hardcodes the same list. This // is less flexible than it appears. Changing the entries -// or order will break putstring. -TiXmlBase::Entity TiXmlBase::entity[ TiXmlBase::NUM_ENTITY ] = +// or order will break putstring. +TiXmlBase::Entity TiXmlBase::entity[ TiXmlBase::NUM_ENTITY ] = { { "&", 5, '&' }, { "<", 4, '<' }, @@ -54,16 +54,16 @@ TiXmlBase::Entity TiXmlBase::entity[ TiXmlBase::NUM_ENTITY ] = // Including the basic of this table, which determines the #bytes in the // sequence from the lead byte. 1 placed for invalid sequences -- // 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 bf be -// ef bf bf +// ef bf bf const unsigned char TIXML_UTF_LEAD_0 = 0xefU; const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; 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 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, // 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, 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 @@ -91,7 +91,7 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng const unsigned long BYTE_MARK = 0x80; const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; - if (input < 0x80) + if (input < 0x80) *length = 1; else if ( input < 0x800 ) *length = 2; @@ -105,22 +105,22 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng output += *length; // Scary scary fall throughs. - switch (*length) + switch (*length) { case 4: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); input >>= 6; case 3: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); input >>= 6; case 2: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); input >>= 6; case 1: - --output; + --output; *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 // 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. // 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 // 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. // if ( encoding == TIXML_ENCODING_UTF8 ) @@ -224,7 +224,7 @@ void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding ) case '\r': // bump down to the next line ++row; - col = 0; + col = 0; // Eat the character ++p; @@ -266,11 +266,11 @@ void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding ) // In these cases, don't advance the column. These are // 0-width spaces. 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 ) - p += 3; + p += 3; else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU ) - p += 3; + p += 3; else { p +=3; ++col; } // A normal character. } @@ -322,10 +322,10 @@ const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding ) while ( *p ) { const unsigned char* pU = (const unsigned char*)p; - + // Skip the stupid Microsoft UTF-8 Byte order marks 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 ) { 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, // hyphens, or colons. (Colons are valid ony for namespaces, // but tinyxml can't tell namespaces from names.) - if ( p && *p + if ( p && *p && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) ) { const char* start = p; while( p && *p - && ( IsAlphaNum( (unsigned char ) *p, encoding ) + && ( IsAlphaNum( (unsigned char ) *p, encoding ) || *p == '_' || *p == '-' || *p == '.' @@ -469,7 +469,7 @@ const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXml ucs += mult * (*q - 'a' + 10); else if ( *q >= 'A' && *q <= 'F' ) ucs += mult * (*q - 'A' + 10 ); - else + else return 0; mult *= 16; --q; @@ -492,7 +492,7 @@ const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXml { if ( *q >= '0' && *q <= '9' ) ucs += mult * (*q - '0'); - else + else return 0; mult *= 10; --q; @@ -571,10 +571,10 @@ bool TiXmlBase::StringEqual( const char* p, return false; } -const char* TiXmlBase::ReadText( const char* p, - TIXML_STRING * text, - bool trimWhiteSpace, - const char* endTag, +const char* TiXmlBase::ReadText( const char* p, + TIXML_STRING * text, + bool trimWhiteSpace, + const char* endTag, bool caseInsensitive, 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 // sub-tag can orient itself. - if ( !StreamTo( in, '<', tag ) ) + if ( !StreamTo( in, '<', tag ) ) { SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); return; @@ -669,7 +669,7 @@ void TiXmlDocument::StreamIn( std::istream * in, TIXML_STRING * tag ) 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 // continue streaming. 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; else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) ) encoding = TIXML_ENCODING_UTF8; // incorrect, but be nice - else + else 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 ) -{ +{ // The first error in a chain is more accurate - don't set again! if ( error ) return; @@ -832,7 +832,7 @@ TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding ) return 0; } - // What is this thing? + // What is this thing? // - Elements start with a letter or underscore, but xml is reserved. // - Comments: