From 92faee68bbfecf6a6b8cc852a2d3d7e5dee1cd77 Mon Sep 17 00:00:00 2001 From: mpv Date: Sun, 10 Jan 2021 12:53:55 +0300 Subject: [PATCH] # fixes for the compilation errors and warnings --- src/BinMNaming/BinMNaming_NamedShapeDriver.cxx | 12 ++++++++++-- src/BinTools/BinTools_IStream.cxx | 2 +- src/BinTools/BinTools_ShapeReader.hxx | 5 +++++ src/BinTools/BinTools_ShapeWriter.cxx | 5 +++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/BinMNaming/BinMNaming_NamedShapeDriver.cxx b/src/BinMNaming/BinMNaming_NamedShapeDriver.cxx index e2a8909153..4d705aaf31 100644 --- a/src/BinMNaming/BinMNaming_NamedShapeDriver.cxx +++ b/src/BinMNaming/BinMNaming_NamedShapeDriver.cxx @@ -147,8 +147,8 @@ BinMNaming_NamedShapeDriver::BinMNaming_NamedShapeDriver : BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TNaming_NamedShape)->Name()), myShapeSet (NULL), myFormatNb (BinTools_FormatVersion_VERSION_1), - myIsQuickPart (Standard_False), - myWithTriangles (Standard_False) + myWithTriangles (Standard_False), + myIsQuickPart (Standard_False) { } @@ -198,16 +198,20 @@ Standard_Boolean BinMNaming_NamedShapeDriver::Paste TopoDS_Shape anOldShape, aNewShape; if (anEvol != TNaming_PRIMITIVE) + { if (myIsQuickPart) aShapeSet->Read (*aDirectStream, anOldShape); else if (TranslateFrom (theSource, anOldShape, static_cast(aShapeSet))) return Standard_False; + } if (anEvol != TNaming_DELETE) + { if (myIsQuickPart) aShapeSet->Read (*aDirectStream, aNewShape); else if (TranslateFrom (theSource, aNewShape, static_cast(aShapeSet))) return Standard_False; + } // Here we add shapes in reverse order because TNaming_Builder also adds them in reverse order. anOldShapes.Prepend (anOldShape); @@ -362,13 +366,17 @@ void BinMNaming_NamedShapeDriver::ReadShapeSection (Standard_IStream& theIS, BinTools_ShapeSetBase* BinMNaming_NamedShapeDriver::ShapeSet (const Standard_Boolean theReading) { if (!myShapeSet) + { if (myIsQuickPart) + { if (theReading) myShapeSet = new BinTools_ShapeReader(); else myShapeSet = new BinTools_ShapeWriter (myWithTriangles); + } else myShapeSet = new BinTools_ShapeSet (myWithTriangles); + } return myShapeSet; } diff --git a/src/BinTools/BinTools_IStream.cxx b/src/BinTools/BinTools_IStream.cxx index fe684037ba..83402617d6 100644 --- a/src/BinTools/BinTools_IStream.cxx +++ b/src/BinTools/BinTools_IStream.cxx @@ -136,7 +136,7 @@ TopAbs_Orientation BinTools_IStream::ShapeOrientation() //======================================================================= BinTools_IStream::operator bool() const { - return myStream->operator bool(); + return *myStream ? Standard_True : Standard_False; } //======================================================================= diff --git a/src/BinTools/BinTools_ShapeReader.hxx b/src/BinTools/BinTools_ShapeReader.hxx index aab88614d9..1af5fcf45a 100644 --- a/src/BinTools/BinTools_ShapeReader.hxx +++ b/src/BinTools/BinTools_ShapeReader.hxx @@ -26,6 +26,11 @@ class Poly_Polygon3D; class Poly_PolygonOnTriangulation; class Poly_Triangulation; +//! Computes a hash code for the given value of the uint64_t type, in range [1, theUpperBound] +inline Standard_Integer HashCode (const uint64_t theValue, const Standard_Integer theUpperBound) +{ + return IntegerHashCode(theValue, 0xffffffffffffffff, theUpperBound); +} //! Reads topology from IStream in binary format without grouping of objects by types //! and using relative positions in a file as references. diff --git a/src/BinTools/BinTools_ShapeWriter.cxx b/src/BinTools/BinTools_ShapeWriter.cxx index 36222d9800..2d85d5804e 100644 --- a/src/BinTools/BinTools_ShapeWriter.cxx +++ b/src/BinTools/BinTools_ShapeWriter.cxx @@ -248,6 +248,11 @@ void BinTools_ShapeWriter::WriteShape (Standard_OStream& theStream, const TopoDS theStream << (Standard_Byte)0;//without triangulation } break; + default: + { + Standard_SStream aMsg; + aMsg << "Unexpected topology type = " << aShape.ShapeType() << std::endl; + } } } catch (Standard_Failure const& anException) -- 2.39.5