mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Fix/suppress plethora of integer conversion warnings on x64 Visual Studio build.
This commit is contained in:
@@ -39,8 +39,8 @@ void ColladaSerializer::ColladaExporter::ColladaGeometries::addFloatSource(const
|
||||
COLLADASW::FloatSource source(mSW);
|
||||
source.setId(mesh_id + suffix);
|
||||
source.setArrayId(mesh_id + suffix + COLLADASW::LibraryGeometries::ARRAY_ID_SUFFIX);
|
||||
source.setAccessorStride(strlen(coords));
|
||||
source.setAccessorCount(floats.size() / 3);
|
||||
source.setAccessorStride((unsigned long)strlen(coords));
|
||||
source.setAccessorCount((unsigned long)floats.size() / 3);
|
||||
for (unsigned int i = 0; i < source.getAccessorStride(); ++i) {
|
||||
source.getParameterNameList().push_back(std::string(1, coords[i]));
|
||||
}
|
||||
@@ -73,7 +73,7 @@ void ColladaSerializer::ColladaExporter::ColladaGeometries::write(const std::str
|
||||
int previous_material_id = -1;
|
||||
for (std::vector<int>::const_iterator it = faces.begin(); !faces.empty(); it += 3) {
|
||||
const int current_material_id = *(material_it++);
|
||||
const int num_triangles = std::distance(index_range_start, it) / 3;
|
||||
const unsigned long num_triangles = (unsigned long)std::distance(index_range_start, it) / 3;
|
||||
if ((previous_material_id != current_material_id && num_triangles > 0) || (it == faces.end())) {
|
||||
COLLADASW::Triangles triangles(mSW);
|
||||
triangles.setMaterial(materials[previous_material_id].name());
|
||||
@@ -126,7 +126,7 @@ void ColladaSerializer::ColladaExporter::ColladaGeometries::write(const std::str
|
||||
for (linelist_t::const_iterator it = linelist.begin(); it != linelist.end(); ++it) {
|
||||
COLLADASW::Lines lines(mSW);
|
||||
lines.setMaterial(materials[it->first].name());
|
||||
lines.setCount(it->second.size());
|
||||
lines.setCount((unsigned long)it->second.size());
|
||||
int offset = 0;
|
||||
lines.getInputList().push_back(COLLADASW::Input(COLLADASW::InputSemantic::VERTEX, "#" + mesh_id + COLLADASW::LibraryGeometries::VERTICES_ID_SUFFIX, 0));
|
||||
lines.prepareToAppendValues();
|
||||
|
||||
@@ -72,7 +72,7 @@ void WaveFrontOBJSerializer::write(const IfcGeom::TriangulationElement<double>*
|
||||
|
||||
const IfcGeom::Representation::Triangulation<double>& mesh = o->geometry();
|
||||
|
||||
const int vcount = mesh.verts().size() / 3;
|
||||
const int vcount = (int)mesh.verts().size() / 3;
|
||||
for ( std::vector<double>::const_iterator it = mesh.verts().begin(); it != mesh.verts().end(); ) {
|
||||
const double x = *(it++);
|
||||
const double y = *(it++);
|
||||
|
||||
@@ -123,10 +123,10 @@ namespace IfcGeom {
|
||||
Material adapter(&it->Style());
|
||||
std::vector<Material>::const_iterator jt = std::find(_materials.begin(), _materials.end(), adapter);
|
||||
if (jt == _materials.end()) {
|
||||
surface_style_id = _materials.size();
|
||||
surface_style_id = (int)_materials.size();
|
||||
_materials.push_back(adapter);
|
||||
} else {
|
||||
surface_style_id = jt - _materials.begin();
|
||||
surface_style_id = (int)(jt - _materials.begin());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,10 +134,10 @@ namespace IfcGeom {
|
||||
Material material(IfcGeom::get_default_style(settings().element_type()));
|
||||
std::vector<Material>::const_iterator it = std::find(_materials.begin(), _materials.end(), material);
|
||||
if (it == _materials.end()) {
|
||||
surface_style_id = _materials.size();
|
||||
surface_style_id = (int)_materials.size();
|
||||
_materials.push_back(material);
|
||||
} else {
|
||||
surface_style_id = it - _materials.begin();
|
||||
surface_style_id = (int)(it - _materials.begin());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ namespace IfcGeom {
|
||||
BRepAdaptor_Curve crv(TopoDS::Edge(exp.Current()));
|
||||
GCPnts_QuasiUniformDeflection tessellater(crv, settings().deflection_tolerance());
|
||||
int n = tessellater.NbPoints();
|
||||
int start = _verts.size() / 3;
|
||||
int start = (int)_verts.size() / 3;
|
||||
for (int i = 1; i <= n; ++i) {
|
||||
gp_XYZ p = tessellater.Value(i).XYZ();
|
||||
trsf.Transforms(p);
|
||||
|
||||
@@ -69,7 +69,7 @@ void swrite(std::ostream& s, T t) {
|
||||
|
||||
template <>
|
||||
void swrite(std::ostream& s, std::string t) {
|
||||
int32_t len = t.size();
|
||||
int32_t len = (int32_t)t.size();
|
||||
swrite(s, len);
|
||||
s.write(t.c_str(), len);
|
||||
while (len++ % 4) s.put(0);
|
||||
@@ -323,7 +323,7 @@ int main (int argc, char** argv) {
|
||||
settings.convert_back_units() = true;
|
||||
settings.include_curves() = true;
|
||||
|
||||
iterator = new IfcGeom::Iterator<float>(settings, data, len);
|
||||
iterator = new IfcGeom::Iterator<float>(settings, data, (int)len);
|
||||
has_more = iterator->initialize();
|
||||
|
||||
More(has_more).write(std::cout);
|
||||
|
||||
@@ -135,7 +135,7 @@ IfcCharacterDecoder::operator std::string() {
|
||||
#ifdef HAVE_ICU
|
||||
if ( previous_codepage != codepage ) {
|
||||
if ( converter ) ucnv_close(converter);
|
||||
char encoder[11] = {'i','s','o','-','8','8','5','9','-',codepage + 0x30};
|
||||
char encoder[11] = {'i','s','o','-','8','8','5','9','-', (char)codepage + 0x30};
|
||||
converter = ucnv_open(encoder, &status);
|
||||
}
|
||||
const char characters[2] = { current_char + 0x80 };
|
||||
@@ -188,7 +188,7 @@ IfcCharacterDecoder::operator std::string() {
|
||||
if (old_hex == 0) {
|
||||
old_hex = hex;
|
||||
} else {
|
||||
char characters[3] = { old_hex, hex };
|
||||
char characters[3] = { (char)old_hex, (char)hex };
|
||||
const char* char_array = &characters[0];
|
||||
UChar32 ch = ucnv_getNextUChar(compatibility_converter,&char_array,char_array+2,&status);
|
||||
addChar(s,ch);
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace IfcUtil {
|
||||
std::pair<const char*, int> getIndex(const std::string& value) const {
|
||||
std::vector<std::string>::const_iterator it = std::find(values.begin(), values.end(), value);
|
||||
if (it != values.end()) {
|
||||
return std::make_pair(it->c_str(), std::distance(it, values.begin()));
|
||||
return std::make_pair(it->c_str(), (int)std::distance(it, values.begin()));
|
||||
} else {
|
||||
throw IfcParse::IfcException("Invalid enumeration value");
|
||||
}
|
||||
@@ -91,7 +91,7 @@ namespace IfcUtil {
|
||||
arguments.push_back(IfcArgumentDescriptor(name, optional, argument_type, data_type));
|
||||
}
|
||||
unsigned getArgumentCount() const {
|
||||
return (parent ? parent->getArgumentCount() : 0) + arguments.size();
|
||||
return (parent ? parent->getArgumentCount() : 0) + (unsigned)arguments.size();
|
||||
}
|
||||
const std::string& getArgumentName(unsigned i) const {
|
||||
const unsigned a = argument_start();
|
||||
|
||||
@@ -52,7 +52,7 @@ unsigned from_base64(const std::string& s) {
|
||||
r *= 64;
|
||||
const char* c = strchr(chars,*i);
|
||||
if ( !c ) throw IfcParse::IfcException("Failed to decode GlobalId");
|
||||
r += (c-chars);
|
||||
r += (unsigned)(c-chars);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -467,7 +467,7 @@ boost::dynamic_bitset<> TokenFunc::asBinary(const Token& t) {
|
||||
}
|
||||
|
||||
++it;
|
||||
unsigned i = (str.size()-1) * 4 - n;
|
||||
unsigned i = ((unsigned)str.size()-1) * 4 - n;
|
||||
boost::dynamic_bitset<> bitset(i);
|
||||
|
||||
for(; it != str.end(); ++it) {
|
||||
|
||||
@@ -187,11 +187,11 @@ public:
|
||||
}
|
||||
outer_it begin() const { return ls.begin(); }
|
||||
outer_it end() const { return ls.end(); }
|
||||
int size() const { return ls.size(); }
|
||||
int size() const { return (int)ls.size(); }
|
||||
int totalSize() const {
|
||||
int accum = 0;
|
||||
for (outer_it it = begin(); it != end(); ++it) {
|
||||
accum += it->size();
|
||||
accum += (int)it->size();
|
||||
}
|
||||
return accum;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ Argument* IfcWritableEntity::getArgument (unsigned int i) {
|
||||
}
|
||||
return args[i];
|
||||
}
|
||||
unsigned int IfcWritableEntity::getArgumentCount() const {return args.size(); }
|
||||
unsigned int IfcWritableEntity::getArgumentCount() const { return (unsigned)args.size(); }
|
||||
IfcSchema::Type::Enum IfcWritableEntity::type() const { return _type; }
|
||||
bool IfcWritableEntity::is(IfcSchema::Type::Enum v) const { return _type == v; }
|
||||
std::string IfcWritableEntity::toString(bool upper) const {
|
||||
@@ -298,12 +298,12 @@ public:
|
||||
int operator()(const double& i) const { return -1; }
|
||||
int operator()(const std::string& i) const { return -1; }
|
||||
int operator()(const boost::dynamic_bitset<>& i) const { return -1; }
|
||||
int operator()(const std::vector<int>& i) const { return i.size(); }
|
||||
int operator()(const std::vector<double>& i) const { return i.size(); }
|
||||
int operator()(const std::vector< std::vector<int> >& i) const { return i.size(); }
|
||||
int operator()(const std::vector< std::vector<double> >& i) const { return i.size(); }
|
||||
int operator()(const std::vector<std::string>& i) const { return i.size(); }
|
||||
int operator()(const std::vector< boost::dynamic_bitset<> >& i) const { return i.size(); }
|
||||
int operator()(const std::vector<int>& i) const { return (int)i.size(); }
|
||||
int operator()(const std::vector<double>& i) const { return (int)i.size(); }
|
||||
int operator()(const std::vector< std::vector<int> >& i) const { return (int)i.size(); }
|
||||
int operator()(const std::vector< std::vector<double> >& i) const { return (int)i.size(); }
|
||||
int operator()(const std::vector<std::string>& i) const { return (int)i.size(); }
|
||||
int operator()(const std::vector< boost::dynamic_bitset<> >& i) const { return (int)i.size(); }
|
||||
int operator()(const IfcWriteArgument::EnumerationReference& i) const { return -1; }
|
||||
int operator()(const IfcUtil::IfcBaseClass* const& i) const { return -1; }
|
||||
int operator()(const IfcEntityList::ptr& i) const { return i->size(); }
|
||||
@@ -351,7 +351,7 @@ private:
|
||||
oss.imbue(std::locale::classic());
|
||||
oss.put('"');
|
||||
oss << std::hex << std::setw(1);
|
||||
unsigned c = b.size();
|
||||
unsigned c = (unsigned)b.size();
|
||||
unsigned n = (4 - (c % 4)) & 3;
|
||||
oss << n;
|
||||
for (unsigned i = 0; i < c + n;) {
|
||||
|
||||
@@ -132,9 +132,9 @@
|
||||
|
||||
template <typename T>
|
||||
PyObject* pythonize_vector(const std::vector<T>& v) {
|
||||
const unsigned size = v.size();
|
||||
const size_t size = v.size();
|
||||
PyObject* pyobj = PyTuple_New(size);
|
||||
for (unsigned int i = 0; i < size; ++i) {
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
PyTuple_SetItem(pyobj, i, pythonize(v[i]));
|
||||
}
|
||||
return pyobj;
|
||||
@@ -142,9 +142,9 @@
|
||||
|
||||
template <typename T>
|
||||
PyObject* pythonize_vector2(const std::vector< std::vector<T> >& v) {
|
||||
const unsigned size = v.size();
|
||||
const size_t size = v.size();
|
||||
PyObject* pyobj = PyTuple_New(size);
|
||||
for (unsigned int i = 0; i < size; ++i) {
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
PyTuple_SetItem(pyobj, i, pythonize_vector(v[i]));
|
||||
}
|
||||
return pyobj;
|
||||
|
||||
Reference in New Issue
Block a user