From 1a81c5fedfa345e8e0dd9bd4770da017ab2c9fb1 Mon Sep 17 00:00:00 2001 From: Tarun Prabhu Date: Thu, 5 Aug 2010 07:32:41 -0600 Subject: [PATCH] Fixed minor type mismatches which were giving out warnings during make. I don't think any were particularly harmful. --- assign/parse_request_rspec.cc | 15 +++++++++------ assign/rspec_parser_v2.cc | 11 +++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/assign/parse_request_rspec.cc b/assign/parse_request_rspec.cc index a4c72637a..9451b3157 100644 --- a/assign/parse_request_rspec.cc +++ b/assign/parse_request_rspec.cc @@ -710,7 +710,10 @@ bool populate_link (DOMElement* elt, /* * Pull the links from the vtop file, and populate assign's own data sturctures */ -bool populate_links(DOMElement *root, tb_vgraph &vg, map< pair, pair >* fixed_interfaces) { +bool +populate_links(DOMElement *root, + tb_vgraph &vg, + map< pair, pair >*fixed_interfaces) { bool is_ok = true; /* @@ -720,7 +723,7 @@ bool populate_links(DOMElement *root, tb_vgraph &vg, map< pair, DOMNodeList *links = root->getElementsByTagName(XStr("link").x()); int linkCount = links->getLength(); XMLDEBUG("Found " << links->getLength() << " links in rspec" << endl); - for (size_t i = 0; i < linkCount; i++) { + for (int i = 0; i < linkCount; i++) { DOMNode *link = links->item(i); DOMElement *elt = dynamic_cast(link); is_ok &= populate_link(elt, vg, fixed_interfaces); @@ -742,7 +745,7 @@ bool populate_vclass (struct vclass vclass, tb_vgraph& vg) vclass_map[name] = v; } - for (int i = 0; i < vclass.physicalTypes.size(); i++) { + for (unsigned int i = 0; i < vclass.physicalTypes.size(); i++) { fstring physType = XStr(vclass.physicalTypes[i].c_str()).f(); v->add_type(physType); vclasses[name].push_back(physType); @@ -758,7 +761,7 @@ bool populate_vclasses (DOMElement* root, tb_vgraph& vg) bool isOk = true; vector vclasses = rspecParser->readVClasses(root); cerr << "Found " << vclasses.size() << " vclasses." << endl; - for (int i = 0; i < vclasses.size(); i++) { + for (unsigned int i = 0; i < vclasses.size(); i++) { isOk &= populate_vclass(vclasses[i], vg); } return isOk; @@ -777,7 +780,7 @@ DOMElement* appendChildTagWithData (DOMElement* parent, string generate_virtualNodeId (string virtual_id) { - std:ostringstream oss; + std::ostringstream oss; struct timeval tv; struct timezone tz; gettimeofday(&tv, &tz); @@ -787,7 +790,7 @@ string generate_virtualNodeId (string virtual_id) string generate_virtualIfaceId (string lan_name, int interface_number) { - std:ostringstream oss; + std::ostringstream oss; oss << lan_name << ":" << interface_number; return oss.str(); } diff --git a/assign/rspec_parser_v2.cc b/assign/rspec_parser_v2.cc index f1be40e98..19dd2adaf 100644 --- a/assign/rspec_parser_v2.cc +++ b/assign/rspec_parser_v2.cc @@ -99,12 +99,11 @@ rspec_parser_v2 :: readLinkCharacteristics (const DOMElement* link, bool hasBandwidth, hasLatency, hasPacketLoss; count = properties->getLength(); - // if (count == 1) { - DOMElement* property = dynamic_cast(properties->item(0)); - strBw = this->getAttribute(property, "capacity", hasBandwidth); - strLat = this->getAttribute(property, "latency", hasLatency); - strLoss = this->getAttribute(property, "packet_loss", hasPacketLoss); - // } + // Read only from the first property and ignore the rest + DOMElement* property = dynamic_cast(properties->item(0)); + strBw = this->getAttribute(property, "capacity", hasBandwidth); + strLat = this->getAttribute(property, "latency", hasLatency); + strLoss = this->getAttribute(property, "packet_loss", hasPacketLoss); int bandwidth = 0, latency = 0; float packetLoss = 0.0; -- GitLab