Commit 746a8572 authored by Jacob Becker's avatar Jacob Becker

fix a lot of size_t to int warnings

parent 6400e0ff
......@@ -167,7 +167,7 @@ void Definition::buildAttribute(Attribute *att) const
j = att->numberOfItems();
for (i = 0; i < n; i++, j++)
{
comp = this->m_itemDefs[i]->buildItem(att, j);
comp = this->m_itemDefs[i]->buildItem(att, static_cast<int>(j));
comp->setDefinition(this->m_itemDefs[i]);
att->addItem(comp);
}
......@@ -193,7 +193,7 @@ bool Definition::addItemDefinition(smtk::attribute::ItemDefinitionPtr cdef)
}
std::size_t n = this->m_itemDefs.size();
this->m_itemDefs.push_back(cdef);
this->m_itemDefPositions[cdef->name()] = n;
this->m_itemDefPositions[cdef->name()] = static_cast<int>(n);
return true;
}
//----------------------------------------------------------------------------
......@@ -207,7 +207,7 @@ void Definition::setCategories()
{
this->m_categories.clear();
}
int i, n = this->m_itemDefs.size();
std::size_t i, n = this->m_itemDefs.size();
for (i = 0; i < n; i++)
{
this->m_itemDefs[i]->updateCategories();
......
......@@ -202,7 +202,7 @@ namespace smtk
std::size_t n = this->m_itemDefs.size();
item = SharedTypes::RawPointerType::New(name);
this->m_itemDefs.push_back(item);
this->m_itemDefPositions[name] = n;
this->m_itemDefPositions[name] = static_cast<int>(n);
}
return item;
}
......
......@@ -90,7 +90,7 @@ GroupItem::setDefinition(smtk::attribute::ConstItemDefinitionPtr gdef)
this->m_items.resize(n);
for (i = 0; i < n; i++)
{
def->buildGroup(this, i);
def->buildGroup(this, static_cast<int>(i));
}
}
return true;
......@@ -146,7 +146,7 @@ bool GroupItem::appendGroup()
}
n = this->m_items.size();
this->m_items.resize(n+1);
def->buildGroup(this, n);
def->buildGroup(this, static_cast<int>(n));
return true;
}
//----------------------------------------------------------------------------
......@@ -205,7 +205,7 @@ bool GroupItem::setNumberOfGroups(std::size_t newSize)
this->m_items.resize(newSize);
for (i = n; i < newSize; i++)
{
def->buildGroup(this, i);
def->buildGroup(this, static_cast<int>(i));
}
}
return true;
......
......@@ -72,7 +72,7 @@ addItemDefinition(smtk::attribute::ItemDefinitionPtr cdef)
}
std::size_t n = this->m_itemDefs.size();
this->m_itemDefs.push_back(cdef);
this->m_itemDefPositions[cdef->name()] = n;
this->m_itemDefPositions[cdef->name()] = static_cast<int>(n);
return true;
}
//----------------------------------------------------------------------------
......@@ -84,7 +84,9 @@ buildGroup(GroupItem *groupItem, int subGroupPosition) const
items.resize(n);
for (i = 0; i < n; i++)
{
items[i] = this->m_itemDefs[i]->buildItem(groupItem, i, subGroupPosition);
items[i] = this->m_itemDefs[i]->buildItem(groupItem,
static_cast<int>(i),
subGroupPosition);
items[i]->setDefinition(this->m_itemDefs[i]);
}
}
......@@ -92,7 +94,7 @@ buildGroup(GroupItem *groupItem, int subGroupPosition) const
void GroupItemDefinition::updateCategories()
{
this->m_categories.clear();
int i, n = this->m_itemDefs.size();
std::size_t i, n = this->m_itemDefs.size();
for (i = 0; i < n; i++)
{
this->m_itemDefs[i]->updateCategories();
......
......@@ -68,7 +68,7 @@ namespace smtk
std::size_t n = this->m_itemDefs.size();
item = SharedTypes::RawPointerType::New(name);
this->m_itemDefs.push_back(item);
this->m_itemDefPositions[name] = n;
this->m_itemDefPositions[name] = static_cast<int>(n);
}
return item;
}
......
......@@ -425,7 +425,7 @@ derivedDefinitions(smtk::attribute::DefinitionPtr def,
{
return;
}
int i, n = it->second.size();
std::size_t i, n = it->second.size();
result.resize(n);
smtk::attribute::WeakDefinitionPtrSet::const_iterator dit;
for (i = 0, dit = it->second.begin(); i < n; dit++, i++)
......
......@@ -155,7 +155,7 @@ RefItem::appendValue(smtk::attribute::AttributePtr val)
if (def->isValueValid(val))
{
this->m_values.push_back(val);
val->addReference(this, this->m_values.size() - 1);
val->addReference(this, static_cast<int>(this->m_values.size() - 1));
return true;
}
return false;
......@@ -208,7 +208,7 @@ RefItem::setNumberOfValues(std::size_t newSize)
att = this->m_values[i].lock().get();
if (att != NULL)
{
att->removeReference(this, i);
att->removeReference(this, static_cast<int>(i));
}
}
}
......
......@@ -82,7 +82,7 @@ int main()
smtk::attribute::ValueItemPtr vcomp;
smtk::attribute::ItemPtr comp;
int i, n = att->numberOfItems();
int i, n = static_cast<int>(att->numberOfItems());
std::cout << "Items of testAtt:\n";
for (i = 0; i < n; i++)
{
......
......@@ -152,7 +152,7 @@ int main()
status = -1;
}
int i, n = att->numberOfItems();
int i, n = static_cast<int>(att->numberOfItems());
std::cout << "Items of testAtt:\n";
for (i = 0; i < n; i++)
{
......
......@@ -111,7 +111,7 @@ int main()
status = -1;
}
int i, n = att->numberOfItems();
int i, n = static_cast<int>(att->numberOfItems());
std::cout << "Items of testAtt:\n";
for (i = 0; i < n; i++)
{
......
......@@ -108,7 +108,7 @@ int main()
status = -1;
}
int i, n = att->numberOfItems();
int i, n = static_cast<int>(att->numberOfItems());
std::cout << "Items of testAtt:\n";
for (i = 0; i < n; i++)
{
......
......@@ -171,7 +171,7 @@ bool ValueItem::appendExpression(smtk::attribute::AttributePtr exp)
{
return false; // Attribute is of the proper type
}
n = m_expressions.size();
n = static_cast<int>(m_expressions.size());
this->m_expressions.resize(n+1);
def->buildExpressionItem(this, n);
this->m_expressions[n]->setValue(exp);
......
......@@ -167,7 +167,7 @@ namespace smtk
{
return -1;
}
int i, n = this->m_discreteValues.size();
int i, n = static_cast<int>(this->m_discreteValues.size());
for (i = 0; i < n; i++)
{
if (this->m_discreteValues[i] == val)
......
......@@ -198,9 +198,9 @@ namespace smtk
this->m_isSet.push_back(true);
if (def->allowsExpressions())
{
int nextPos = this->m_expressions.size();
std::size_t nextPos = this->m_expressions.size();
this->m_expressions.resize(nextPos+1);
def->buildExpressionItem(this, nextPos);
def->buildExpressionItem(this, static_cast<int>(nextPos));
}
return true;
}
......@@ -210,9 +210,9 @@ namespace smtk
{
if (def->allowsExpressions())
{
int nextPos = this->m_expressions.size();
std::size_t nextPos = this->m_expressions.size();
this->m_expressions.resize(nextPos+1);
def->buildExpressionItem(this, nextPos);
def->buildExpressionItem(this, static_cast<int>(nextPos));
}
this->m_values.push_back(val);
this->m_isSet.push_back(true);
......@@ -278,7 +278,7 @@ namespace smtk
this->m_expressions.resize(newSize);
for (i = n; i < newSize; i++)
{
def->buildExpressionItem(this, i);
def->buildExpressionItem(this, static_cast<int>(i));
}
}
return true;
......@@ -344,7 +344,7 @@ namespace smtk
this->m_discreteIndices.clear();
if (def->allowsExpressions())
{
int j, m = this->m_expressions.size();
std::size_t j, m = this->m_expressions.size();
for (j = 0; j < m; j++)
{
this->m_expressions[j]->detachOwningItem();
......
......@@ -143,7 +143,7 @@ int ExportJSON::forStorageEntity(
cJSON_AddItemToObject(cellRec, "r",
cJSON_CreateUUIDArray(
&entry->second.relations()[0],
entry->second.relations().size()));
static_cast<int>(entry->second.relations().size())));
}
return 1;
}
......@@ -171,7 +171,7 @@ int ExportJSON::forStorageArrangement(
if (!ait->details().empty())
{
cJSON_AddItemToArray(kindNode,
cJSON_CreateIntArray(&(ait->details()[0]), ait->details().size()));
cJSON_CreateIntArray(&(ait->details()[0]), static_cast<int>(ait->details().size())));
}
}
}
......@@ -206,10 +206,10 @@ int ExportJSON::forStorageTessellation(
cJSON_AddItemToObject(tess, "metadata", fmt);
cJSON_AddItemToObject(tess, "vertices", cJSON_CreateDoubleArray(
&tessIt->second.coords()[0],
tessIt->second.coords().size()));
static_cast<int>(tessIt->second.coords().size())));
cJSON_AddItemToObject(tess, "faces", cJSON_CreateIntArray(
tessIt->second.conn().empty() ? NULL : &tessIt->second.conn()[0],
tessIt->second.conn().size()));
static_cast<int>(tessIt->second.conn().size())));
cJSON_AddItemToObject(dict, "t", tess);
return 1;
}
......@@ -233,7 +233,7 @@ int ExportJSON::forStorageFloatProperties(const smtk::util::UUID& uid, cJSON* di
}
cJSON_AddItemToObject(pdict, entry->first.c_str(),
cJSON_CreateDoubleArray(
&entry->second[0], entry->second.size()));
&entry->second[0], static_cast<int>(entry->second.size())));
}
return status;
}
......@@ -257,7 +257,7 @@ int ExportJSON::forStorageStringProperties(const smtk::util::UUID& uid, cJSON* d
}
cJSON_AddItemToObject(pdict, entry->first.c_str(),
cJSON_CreateStringArray(
&entry->second[0], entry->second.size()));
&entry->second[0], static_cast<int>(entry->second.size())));
}
return status;
}
......@@ -281,7 +281,7 @@ int ExportJSON::forStorageIntegerProperties(const smtk::util::UUID& uid, cJSON*
}
cJSON_AddItemToObject(pdict, entry->first.c_str(),
cJSON_CreateLongArray(
&entry->second[0], entry->second.size()));
&entry->second[0], static_cast<int>(entry->second.size())));
}
return status;
}
......
......@@ -290,10 +290,10 @@ smtk::util::UUID Storage::findOrCreateCellUseOfSense(
this->arrangeEntity(
cell, HAS_USE,
Arrangement::CellHasUseWithIndexAndSense(useIdx, sense));
Arrangement::CellHasUseWithIndexAndSense(static_cast<int>(useIdx), sense));
this->arrangeEntity(
use->first, HAS_CELL,
Arrangement::UseHasCellWithIndexAndSense(cellIdx, sense));
Arrangement::UseHasCellWithIndexAndSense(static_cast<int>(cellIdx), sense));
return use->first;
}
......
......@@ -65,7 +65,7 @@ std::string Logger::severityAsString(Severity s)
//----------------------------------------------------------------------------
std::string Logger::convertToString() const
{
int i, n = this->m_records.size();
std::size_t i, n = this->m_records.size();
std::stringstream ss;
for (i = 0; i < n; i++)
{
......
......@@ -34,7 +34,7 @@ int main()
smtkWarningMacro(logger, "this is a warning no = " << 10.1234 << " WARNING!");
smtkDebugMacro(logger, "this is a Debug no = " << 1 << " DEBUG!");
logger.addRecord(smtk::util::Logger::INFO, "Sample Info String\n");
int i, n = logger.numberOfRecords();
std::size_t i, n = logger.numberOfRecords();
if (n != 4)
{
std::cerr << "Wrong number of records! Got " << n << " Should be 4!\n";
......
......@@ -17,7 +17,7 @@ public:
{
// This is a poor technique for seeding or
// we would initialize this way all the time.
this->m_mtseed.seed(time(NULL));
this->m_mtseed.seed(static_cast<boost::uin32_t>(time(NULL)));
this->m_randomGenerator =
new boost::uuids::basic_random_generator<boost::mt19937>(&this->m_mtseed);
}
......
......@@ -1048,7 +1048,7 @@ void XmlDocV1Parser::processAttribute(xml_node &attNode)
attribute::AttributePtr att;
attribute::DefinitionPtr def;
unsigned long id, maxId = 0;
std::size_t i, n;
int i, n;
xatt = attNode.attribute("Name");
if (!xatt)
......@@ -1133,7 +1133,7 @@ void XmlDocV1Parser::processAttribute(xml_node &attNode)
// NOTE That the writer processes the items in order - lets assume
// that for speed and if that fails we can try to search for the correct
// xml node
n = att->numberOfItems();
n = static_cast<int>(att->numberOfItems());
for (i = 0, iNode = itemsNode.first_child(); (i < n) && iNode;
i++, iNode = iNode.next_sibling())
{
......@@ -1275,7 +1275,7 @@ void XmlDocV1Parser::processValueItem(pugi::xml_node &node,
continue;
}
index = val.text().as_int();
if (!item->setDiscreteIndex(i, index))
if (!item->setDiscreteIndex(static_cast<int>(i), index))
{
smtkErrorMacro(this->m_logger,
"Discrete Index " << index
......@@ -1353,12 +1353,12 @@ void XmlDocV1Parser::processRefItem(pugi::xml_node &node,
att = this->m_manager.findAttribute(attName);
if (!att)
{
info.item = item; info.pos = i; info.attName = attName;
info.item = item; info.pos = static_cast<int>(i); info.attName = attName;
this->m_attRefInfo.push_back(info);
}
else
{
item->setValue(i, att);
item->setValue(static_cast<int>(i), att);
}
}
}
......@@ -1433,7 +1433,7 @@ void XmlDocV1Parser::processDirectoryItem(pugi::xml_node &node,
<< " is out of range for Item: " << item->name());
continue;
}
item->setValue(i, val.text().get());
item->setValue(static_cast<int>(i), val.text().get());
}
}
else if (numRequiredVals == 1)
......@@ -1516,7 +1516,7 @@ void XmlDocV1Parser::processDoubleItem(pugi::xml_node &node,
}
if (nodeName == "Val")
{
item->setValue(i, val.text().as_double());
item->setValue(static_cast<int>(i), val.text().as_double());
}
else if (allowsExpressions && (nodeName == "Expression"))
{
......@@ -1524,12 +1524,12 @@ void XmlDocV1Parser::processDoubleItem(pugi::xml_node &node,
expAtt = this->m_manager.findAttribute(expName);
if (!expAtt)
{
info.item = item; info.pos = i; info.expName = expName;
info.item = item; info.pos = static_cast<int>(i); info.expName = expName;
this->m_itemExpressionInfo.push_back(info);
}
else
{
item->setExpression(i, expAtt);
item->setExpression(static_cast<int>(i), expAtt);
}
}
else
......@@ -1619,7 +1619,7 @@ void XmlDocV1Parser::processFileItem(pugi::xml_node &node,
<< " is out of range for Item: " << item->name());
continue;
}
item->setValue(i, val.text().get());
item->setValue(static_cast<int>(i), val.text().get());
}
}
else if (numRequiredVals == 1)
......@@ -1689,7 +1689,7 @@ void XmlDocV1Parser::processGroupItem(pugi::xml_node &node,
<< " for Group Item: " << item->name());
continue;
}
this->processItem(itemNode, item->item(i,j));
this->processItem(itemNode, item->item(static_cast<int>(i),static_cast<int>(j)));
}
}
}
......@@ -1705,7 +1705,7 @@ void XmlDocV1Parser::processGroupItem(pugi::xml_node &node,
<< " for Group Item: " << item->name());
continue;
}
this->processItem(itemNode, item->item(j));
this->processItem(itemNode, item->item(static_cast<int>(j)));
}
}
else
......@@ -1779,7 +1779,7 @@ void XmlDocV1Parser::processIntItem(pugi::xml_node &node,
}
if (nodeName == "Val")
{
item->setValue(i, val.text().as_int());
item->setValue(static_cast<int>(i), val.text().as_int());
}
else if (allowsExpressions && (nodeName == "Expression"))
{
......@@ -1787,12 +1787,12 @@ void XmlDocV1Parser::processIntItem(pugi::xml_node &node,
expAtt = this->m_manager.findAttribute(expName);
if (!expAtt)
{
info.item = item; info.pos = i; info.expName = expName;
info.item = item; info.pos = static_cast<int>(i); info.expName = expName;
this->m_itemExpressionInfo.push_back(info);
}
else
{
item->setExpression(i, expAtt);
item->setExpression(static_cast<int>(i), expAtt);
}
}
else
......@@ -1900,7 +1900,7 @@ void XmlDocV1Parser::processStringItem(pugi::xml_node &node,
}
if (nodeName == "Val")
{
item->setValue(i, val.text().get());
item->setValue(static_cast<int>(i), val.text().get());
}
else if (allowsExpressions && (nodeName == "Expression"))
{
......@@ -1908,12 +1908,12 @@ void XmlDocV1Parser::processStringItem(pugi::xml_node &node,
expAtt = this->m_manager.findAttribute(expName);
if (!expAtt)
{
info.item = item; info.pos = i; info.expName = expName;
info.item = item; info.pos = static_cast<int>(i); info.expName = expName;
this->m_itemExpressionInfo.push_back(info);
}
else
{
item->setExpression(i, expAtt);
item->setExpression(static_cast<int>(i), expAtt);
}
}
else
......
......@@ -205,9 +205,9 @@ void XmlV1StringWriter::processDefinition(xml_node &definitions,
for (i = 0; i < n; i++)
{
itemDefNode = itemDefNodes.append_child();
itemDefNode.set_name(Item::type2String(def->itemDefinition(i)->type()).c_str());
itemDefNode.set_name(Item::type2String(def->itemDefinition(static_cast<int>(i))->type()).c_str());
this->processItemDefinition(itemDefNode,
def->itemDefinition(i));
def->itemDefinition(static_cast<int>(i)));
}
}
// Process all attributes based on this class
......@@ -309,7 +309,7 @@ void XmlV1StringWriter::processDoubleDef(pugi::xml_node &node,
if (idef->isDiscrete())
{
xml_node dnodes = node.append_child("DiscreteInfo");
int i, n = idef->numberOfDiscreteValues();
int i, n = static_cast<int>(idef->numberOfDiscreteValues());
xml_node dnode;
for (i = 0; i < n; i++)
{
......@@ -364,7 +364,7 @@ void XmlV1StringWriter::processIntDef(pugi::xml_node &node,
if (idef->isDiscrete())
{
xml_node dnodes = node.append_child("DiscreteInfo");
int i, n = idef->numberOfDiscreteValues();
int i, n = static_cast<int>(idef->numberOfDiscreteValues());
xml_node dnode;
for (i = 0; i < n; i++)
{
......@@ -423,7 +423,7 @@ void XmlV1StringWriter::processStringDef(pugi::xml_node &node,
if (idef->isDiscrete())
{
xml_node dnodes = node.append_child("DiscreteInfo");
int i, n = idef->numberOfDiscreteValues();
int i, n = static_cast<int>(idef->numberOfDiscreteValues());
xml_node dnode;
for (i = 0; i < n; i++)
{
......@@ -638,7 +638,7 @@ void XmlV1StringWriter::processGroupDef(pugi::xml_node &node,
}
}
// Now lets process its items
std::size_t i, n = idef->numberOfItemDefinitions();
int i, n = static_cast<int>(idef->numberOfItemDefinitions());
if (n != 0)
{
itemDefNodes = node.append_child("ItemDefinitions");
......@@ -674,7 +674,7 @@ void XmlV1StringWriter::processAttribute(xml_node &attributes,
s = this->encodeColor(att->color());
node.append_child("Color").text().set(s.c_str());
}
std::size_t i, n = att->numberOfItems();
int i, n = static_cast<int>(att->numberOfItems());
if (n)
{
xml_node itemNode, items = node.append_child("Items");
......@@ -732,7 +732,7 @@ void XmlV1StringWriter::processValueItem(pugi::xml_node &node,
attribute::ValueItemPtr item)
{
std::size_t numRequiredVals = item->numberOfRequiredValues();
std::size_t i, n = item->numberOfValues();
int i, n = static_cast<int>(item->numberOfValues());
if (!n)
{
return;
......@@ -779,7 +779,7 @@ void XmlV1StringWriter::processValueItem(pugi::xml_node &node,
void XmlV1StringWriter::processRefItem(pugi::xml_node &node,
attribute::RefItemPtr item)
{
std::size_t i=0, n = item->numberOfValues();
int i=0, n = static_cast<int>(item->numberOfValues());
std::size_t numRequiredVals = item->numberOfRequiredValues();
xml_node val;
......@@ -822,7 +822,7 @@ void XmlV1StringWriter::processRefItem(pugi::xml_node &node,
void XmlV1StringWriter::processDirectoryItem(pugi::xml_node &node,
attribute::DirectoryItemPtr item)
{
std::size_t i, n = item->numberOfValues();
int i, n = static_cast<int>(item->numberOfValues());
std::size_t numRequiredVals = item->numberOfRequiredValues();
if (!n)
{
......@@ -871,7 +871,7 @@ void XmlV1StringWriter::processDoubleItem(pugi::xml_node &node,
{
return; // nothing left to do
}
std::size_t i, n = item->numberOfValues();
int i, n = static_cast<int>(item->numberOfValues());
if (!n)
{
return;
......@@ -907,7 +907,7 @@ void XmlV1StringWriter::processDoubleItem(pugi::xml_node &node,
{
val = values.append_child("Val");
val.append_attribute("Ith").set_value((unsigned int) i);
val.text().set(item->value(i));
val.text().set(item->value(static_cast<int>(i)));
}
}
else
......@@ -922,7 +922,7 @@ void XmlV1StringWriter::processFileItem(pugi::xml_node &node,
attribute::FileItemPtr item)
{
std::size_t numRequiredVals = item->numberOfRequiredValues();
std::size_t i, n = item->numberOfValues();
int i, n = static_cast<int>(item->numberOfValues());
if (!n)
{
return;
......@@ -963,11 +963,11 @@ void XmlV1StringWriter::processFileItem(pugi::xml_node &node,
void XmlV1StringWriter::processGroupItem(pugi::xml_node &node,
attribute::GroupItemPtr item)
{
std::size_t i, j, m, n;
int i, j, m, n;
std::size_t numRequiredGroups = item->numberOfRequiredGroups();
xml_node itemNode;
n = item->numberOfGroups();
m = item->numberOfItemsPerGroup();
n = static_cast<int>(item->numberOfGroups());
m = static_cast<int>(item->numberOfItemsPerGroup());
if (!n)
{
return;
......@@ -1014,7 +1014,7 @@ void XmlV1StringWriter::processIntItem(pugi::xml_node &node,
{
return; // nothing left to do
}
std::size_t i, n = item->numberOfValues();
int i, n = static_cast<int>(item->numberOfValues());
if (!n)
{
return;
......@@ -1070,7 +1070,7 @@ void XmlV1StringWriter::processStringItem(pugi::xml_node &node,
{
return; // nothing left to do
}
std::size_t i, n = item->numberOfValues();
int i, n = static_cast<int>(item->numberOfValues());
if (!n)
{
return;
......@@ -1151,7 +1151,7 @@ void XmlV1StringWriter::processAttributeView(xml_node &node,
node.append_attribute("CreateEntities").set_value(true);
}
}
std::size_t i, n = v->numberOfDefinitions();
int i, n = static_cast<int>(v->numberOfDefinitions());
if (n)
{
xml_node atypes = node.append_child("AttributeTypes");
......@@ -1167,7 +1167,7 @@ void XmlV1StringWriter::processInstancedView(xml_node &node,
{
this->processBasicView(node,
smtk::dynamic_pointer_cast<smtk::view::Base>(v));
std::size_t i, n = v->numberOfInstances();
int i, n = static_cast<int>(v->numberOfInstances());
xml_node child;
if (n)
{
......@@ -1219,7 +1219,7 @@ void XmlV1StringWriter::processGroupView(xml_node &node,
node.append_attribute("Style").set_value("Tiled");
}
std::size_t i, n = group->numberOfSubViews();
int i, n = static_cast<int>(group->numberOfSubViews());
xml_node child;
view::BasePtr bview;
for (i = 0; i < n; i++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment