rename variables to cut OCLint warnings

This commit is contained in:
Dennis Luxen 2014-06-23 12:11:56 +02:00
parent 60d70a9f4c
commit eac7d07ef6
2 changed files with 28 additions and 28 deletions

View File

@ -40,8 +40,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <osrm/Coordinate.h> #include <osrm/Coordinate.h>
XMLParser::XMLParser(const char *filename, ExtractorCallbacks *ec, ScriptingEnvironment &se) XMLParser::XMLParser(const char *filename, ExtractorCallbacks *extractor_callbacks, ScriptingEnvironment &scripting_environment)
: BaseParser(ec, se) : BaseParser(extractor_callbacks, scripting_environment)
{ {
inputReader = inputReaderFactory(filename); inputReader = inputReaderFactory(filename);
} }
@ -67,9 +67,9 @@ bool XMLParser::Parse()
if (xmlStrEqual(currentName, (const xmlChar *)"node") == 1) if (xmlStrEqual(currentName, (const xmlChar *)"node") == 1)
{ {
ImportNode n = ReadXMLNode(); ImportNode current_node = ReadXMLNode();
ParseNodeInLua(n, lua_state); ParseNodeInLua(current_node, lua_state);
extractor_callbacks->ProcessNode(n); extractor_callbacks->ProcessNode(current_node);
} }
if (xmlStrEqual(currentName, (const xmlChar *)"way") == 1) if (xmlStrEqual(currentName, (const xmlChar *)"way") == 1)
@ -80,8 +80,8 @@ bool XMLParser::Parse()
} }
if (use_turn_restrictions && xmlStrEqual(currentName, (const xmlChar *)"relation") == 1) if (use_turn_restrictions && xmlStrEqual(currentName, (const xmlChar *)"relation") == 1)
{ {
InputRestrictionContainer r = ReadXMLRestriction(); InputRestrictionContainer current_restriction = ReadXMLRestriction();
if ((UINT_MAX != r.fromWay) && !extractor_callbacks->ProcessRestriction(r)) if ((UINT_MAX != current_restriction.fromWay) && !extractor_callbacks->ProcessRestriction(current_restriction))
{ {
std::cerr << "[XMLParser] restriction not parsed" << std::endl; std::cerr << "[XMLParser] restriction not parsed" << std::endl;
} }
@ -130,24 +130,24 @@ InputRestrictionContainer XMLParser::ReadXMLRestriction()
if (xmlStrEqual(child_name, (const xmlChar *)"tag") == 1) if (xmlStrEqual(child_name, (const xmlChar *)"tag") == 1)
{ {
xmlChar *k = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"k"); xmlChar *key = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"k");
xmlChar *value = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"v"); xmlChar *value = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"v");
if (k != NULL && value != NULL) if (key != NULL && value != NULL)
{ {
if (xmlStrEqual(k, (const xmlChar *)"restriction") && if (xmlStrEqual(key, (const xmlChar *)"restriction") &&
(0 == std::string((const char *)value).find("only_"))) StringStartsWith((const char*)value, "only_") )
{ {
restriction.restriction.flags.isOnly = true; restriction.restriction.flags.isOnly = true;
} }
if (xmlStrEqual(k, (const xmlChar *)"except")) if (xmlStrEqual(key, (const xmlChar *)"except"))
{ {
except_tag_string = (const char *)value; except_tag_string = (const char *)value;
} }
} }
if (k != NULL) if (key != NULL)
{ {
xmlFree(k); xmlFree(key);
} }
if (value != NULL) if (value != NULL)
{ {
@ -228,9 +228,9 @@ ExtractionWay XMLParser::ReadXMLWay()
if (depth == child_depth && child_type == 15 && if (depth == child_depth && child_type == 15 &&
xmlStrEqual(child_name, (const xmlChar *)"way") == 1) xmlStrEqual(child_name, (const xmlChar *)"way") == 1)
{ {
xmlChar *id = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"id"); xmlChar *node_id = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"id");
way.id = StringToUint((char *)id); way.id = StringToUint((char *)node_id);
xmlFree(id); xmlFree(node_id);
xmlFree(child_name); xmlFree(child_name);
break; break;
} }
@ -242,16 +242,16 @@ ExtractionWay XMLParser::ReadXMLWay()
if (xmlStrEqual(child_name, (const xmlChar *)"tag") == 1) if (xmlStrEqual(child_name, (const xmlChar *)"tag") == 1)
{ {
xmlChar *k = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"k"); xmlChar *key = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"k");
xmlChar *value = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"v"); xmlChar *value = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"v");
if (k != NULL && value != NULL) if (key != NULL && value != NULL)
{ {
way.keyVals.Add(std::string((char *)k), std::string((char *)value)); way.keyVals.Add(std::string((char *)key), std::string((char *)value));
} }
if (k != NULL) if (key != NULL)
{ {
xmlFree(k); xmlFree(key);
} }
if (value != NULL) if (value != NULL)
{ {
@ -329,15 +329,15 @@ ImportNode XMLParser::ReadXMLNode()
if (xmlStrEqual(child_name, (const xmlChar *)"tag") == 1) if (xmlStrEqual(child_name, (const xmlChar *)"tag") == 1)
{ {
xmlChar *k = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"k"); xmlChar *key = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"k");
xmlChar *value = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"v"); xmlChar *value = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"v");
if (k != NULL && value != NULL) if (key != NULL && value != NULL)
{ {
node.keyVals.emplace(std::string((char *)(k)), std::string((char *)(value))); node.keyVals.Add(std::string((char *)(key)), std::string((char *)(value)));
} }
if (k != NULL) if (key != NULL)
{ {
xmlFree(k); xmlFree(key);
} }
if (value != NULL) if (value != NULL)
{ {

View File

@ -38,7 +38,7 @@ class ExtractorCallbacks;
class XMLParser : public BaseParser class XMLParser : public BaseParser
{ {
public: public:
XMLParser(const char *filename, ExtractorCallbacks *ec, ScriptingEnvironment &se); XMLParser(const char *filename, ExtractorCallbacks *extractor_callbacks, ScriptingEnvironment &scripting_environment);
bool ReadHeader(); bool ReadHeader();
bool Parse(); bool Parse();