[geos-commits] r2520 - branches/3.1/tests/xmltester/markup
svn_geos at osgeo.org
svn_geos at osgeo.org
Wed May 27 14:11:47 EDT 2009
Author: pramsey
Date: 2009-05-27 14:11:47 -0400 (Wed, 27 May 2009)
New Revision: 2520
Modified:
branches/3.1/tests/xmltester/markup/MarkupSTL.cpp
Log:
Backport r2483 from trunk
Modified: branches/3.1/tests/xmltester/markup/MarkupSTL.cpp
===================================================================
--- branches/3.1/tests/xmltester/markup/MarkupSTL.cpp 2009-05-27 18:11:14 UTC (rev 2519)
+++ branches/3.1/tests/xmltester/markup/MarkupSTL.cpp 2009-05-27 18:11:47 UTC (rev 2520)
@@ -9,7 +9,9 @@
// This software is provided "as is", with no warranty.
#include "MarkupSTL.h"
-#include <stdio.h>
+#include <cassert>
+#include <cstdio>
+#include <string>
using namespace std;
@@ -873,24 +875,27 @@
string CMarkupSTL::x_GetData( int iPos ) const
{
+ std::string::size_type const pos(iPos);
+ assert(std::string::npos != pos);
+
// Return a string representing data between start and end tag
// Return empty string if there are any children elements
- if ( ! m_aPos[iPos].iElemChild && ! m_aPos[iPos].IsEmptyElement() )
+ if ( ! m_aPos[pos].iElemChild && ! m_aPos[pos].IsEmptyElement() )
{
// See if it is a CDATA section
TokenPos token( m_strDoc.c_str() );
- token.nNext = m_aPos[iPos].nStartR+1;
+ token.nNext = m_aPos[pos].nStartR+1;
if ( x_FindToken( token ) && m_strDoc[token.nL] == '<'
- && token.nL + 11 < m_aPos[iPos].nEndL
+ && token.nL + 11 < m_aPos[pos].nEndL
&& strncmp( &token.szDoc[token.nL+1], "![CDATA[", 8 ) == 0 )
{
- int nEndCDATA = m_strDoc.find( "]]>", token.nNext );
- if ( (unsigned int)nEndCDATA != string::npos && nEndCDATA < m_aPos[iPos].nEndL )
+ std::string::size_type const nEndCDATA = m_strDoc.find( "]]>", token.nNext );
+ if ( nEndCDATA != string::npos && nEndCDATA < std::string::size_type(m_aPos[pos].nEndL) )
{
return m_strDoc.substr( token.nL+9, nEndCDATA-token.nL-9 );
}
}
- return x_TextFromDoc( m_aPos[iPos].nStartR+1, m_aPos[iPos].nEndL-1 );
+ return x_TextFromDoc( m_aPos[pos].nStartR+1, m_aPos[pos].nEndL-1 );
}
return "";
}
@@ -907,7 +912,7 @@
// ' apostrophe or single quote
// " double quote
//
- static char* szaReplace[] = { "<","&",">","'",""" };
+ static char const* const szaReplace[] = { "<","&",">","'",""" };
const char* pFind = bAttrib?"<&>\'\"":"<&>";
const char* pSource = szText;
string strResult;
@@ -936,9 +941,9 @@
//
// Conveniently the result is always the same or shorter in length
//
- static char* szaCode[] = { "lt;","amp;","gt;","apos;","quot;" };
+ static char const* const szaCode[] = { "lt;","amp;","gt;","apos;","quot;" };
static int anCodeLen[] = { 3,4,3,5,5 };
- static char* szSymbol = "<&>\'\"";
+ static char const* const szSymbol = "<&>\'\"";
string strResult;
strResult.reserve( nRight - nLeft + 1 );
const char* pSource = m_strDoc.c_str();
More information about the geos-commits
mailing list