Skip to content

Commit

Permalink
Merge pull request assimp#561 from LegalizeAdulthood/warnings
Browse files Browse the repository at this point in the history
Fix compiler warnings
  • Loading branch information
kimkulling committed May 18, 2015
2 parents 93579ca + 9cbef8c commit 4bdf23a
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 135 deletions.
7 changes: 4 additions & 3 deletions code/3DSExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SceneCombiner.h"
#include "SplitLargeMeshes.h"
#include "StringComparison.h"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/Exporter.hpp"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/Exporter.hpp"
#include <memory>

using namespace Assimp;
Expand Down Expand Up @@ -324,6 +324,7 @@ void Discreet3DSExporter::WriteMaterials()
break;

default:
shading_mode_out = Discreet3DS::Flat;
ai_assert(false);
};
writer.PutU2(static_cast<uint16_t>(shading_mode_out));
Expand Down
21 changes: 0 additions & 21 deletions code/FBXParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,6 @@ namespace {
}


// ------------------------------------------------------------------------------------------------
// print warning, do return
void ParseWarning(const std::string& message, const Token& token)
{
if(DefaultLogger::get()) {
DefaultLogger::get()->warn(Util::AddTokenText("FBX-Parser",message,&token));
}
}

// ------------------------------------------------------------------------------------------------
/* void ParseWarning(const std::string& message, const Element* element = NULL)
{
if(element) {
ParseWarning(message,element->KeyToken());
return;
}
if(DefaultLogger::get()) {
DefaultLogger::get()->warn("FBX-Parser: " + message);
}
}
*/
// ------------------------------------------------------------------------------------------------
void ParseError(const std::string& message, TokenPtr token)
{
Expand Down
10 changes: 0 additions & 10 deletions code/IFCCurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ class Line : public Curve
// --------------------------------------------------
Line(const IfcLine& entity, ConversionData& conv)
: Curve(entity,conv)
, entity(entity)
{
ConvertCartesianPoint(p,entity.Pnt);
ConvertVector(v,entity.Dir);
Expand Down Expand Up @@ -221,7 +220,6 @@ class Line : public Curve
}

private:
const IfcLine& entity;
IfcVector3 p,v;
};

Expand All @@ -238,7 +236,6 @@ class CompositeCurve : public BoundedCurve
// --------------------------------------------------
CompositeCurve(const IfcCompositeCurve& entity, ConversionData& conv)
: BoundedCurve(entity,conv)
, entity(entity)
, total()
{
curves.reserve(entity.Segments.size());
Expand Down Expand Up @@ -331,7 +328,6 @@ class CompositeCurve : public BoundedCurve
}

private:
const IfcCompositeCurve& entity;
std::vector< CurveEntry > curves;

IfcFloat total;
Expand All @@ -349,8 +345,6 @@ class TrimmedCurve : public BoundedCurve
// --------------------------------------------------
TrimmedCurve(const IfcTrimmedCurve& entity, ConversionData& conv)
: BoundedCurve(entity,conv)
, entity(entity)
, ok()
{
base = boost::shared_ptr<const Curve>(Curve::Convert(entity.BasisCurve,conv));

Expand Down Expand Up @@ -448,11 +442,9 @@ class TrimmedCurve : public BoundedCurve


private:
const IfcTrimmedCurve& entity;
ParamRange range;
IfcFloat maxval;
bool agree_sense;
bool ok;

boost::shared_ptr<const Curve> base;
};
Expand All @@ -469,7 +461,6 @@ class PolyLine : public BoundedCurve
// --------------------------------------------------
PolyLine(const IfcPolyline& entity, ConversionData& conv)
: BoundedCurve(entity,conv)
, entity(entity)
{
points.reserve(entity.Points.size());

Expand Down Expand Up @@ -507,7 +498,6 @@ class PolyLine : public BoundedCurve
}

private:
const IfcPolyline& entity;
std::vector<IfcVector3> points;
};

Expand Down
24 changes: 6 additions & 18 deletions code/IFCLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "StreamReader.h"
#include "MemoryIOWrapper.h"
#include "../include/assimp/scene.h"
#include "../include/assimp/Importer.hpp"

#include "../include/assimp/scene.h"
#include "../include/assimp/Importer.hpp"


namespace Assimp {
template<> const std::string LogFunctions<IFCImporter>::log_prefix = "IFC: ";
Expand Down Expand Up @@ -93,8 +93,6 @@ namespace {
void SetUnits(ConversionData& conv);
void SetCoordinateSpace(ConversionData& conv);
void ProcessSpatialStructures(ConversionData& conv);
aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el ,ConversionData& conv);
void ProcessProductRepresentation(const IfcProduct& el, aiNode* nd, ConversionData& conv);
void MakeTreeRelative(ConversionData& conv);
void ConvertUnit(const EXPRESS::DataType& dt,ConversionData& conv);

Expand Down Expand Up @@ -421,16 +419,6 @@ void ResolveObjectPlacement(aiMatrix4x4& m, const IfcObjectPlacement& place, Con
}
}

// ------------------------------------------------------------------------------------------------
void GetAbsTransform(aiMatrix4x4& out, const aiNode* nd, ConversionData& conv)
{
aiMatrix4x4 t;
if (nd->mParent) {
GetAbsTransform(t,nd->mParent,conv);
}
out = t*nd->mTransformation;
}

// ------------------------------------------------------------------------------------------------
bool ProcessMappedItem(const IfcMappedItem& mapped, aiNode* nd_src, std::vector< aiNode* >& subnodes_src, unsigned int matid, ConversionData& conv)
{
Expand Down Expand Up @@ -682,14 +670,14 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
// skip over space and annotation nodes - usually, these have no meaning in Assimp's context
bool skipGeometry = false;
if(conv.settings.skipSpaceRepresentations) {
if(const IfcSpace* const space = el.ToPtr<IfcSpace>()) {
if(el.ToPtr<IfcSpace>()) {
IFCImporter::LogDebug("skipping IfcSpace entity due to importer settings");
skipGeometry = true;
}
}

if(conv.settings.skipAnnotations) {
if(const IfcAnnotation* const ann = el.ToPtr<IfcAnnotation>()) {
if(el.ToPtr<IfcAnnotation>()) {
IFCImporter::LogDebug("skipping IfcAnnotation entity due to importer settings");
return NULL;
}
Expand Down Expand Up @@ -764,7 +752,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
continue;
}
BOOST_FOREACH(const IfcProduct& pro, cont->RelatedElements) {
if(const IfcOpeningElement* const open = pro.ToPtr<IfcOpeningElement>()) {
if(pro.ToPtr<IfcOpeningElement>()) {
// IfcOpeningElement is handled below. Sadly we can't use it here as is:
// The docs say that opening elements are USUALLY attached to building storey,
// but we want them for the building elements to which they belong.
Expand Down
2 changes: 1 addition & 1 deletion code/IFCProfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void ProcessParametrizedProfile(const IfcParameterizedProfileDef& def, TempMesh&
meshout.vertcnt.push_back(4);
}
else if( const IfcCircleProfileDef* const circle = def.ToPtr<IfcCircleProfileDef>()) {
if( const IfcCircleHollowProfileDef* const hollow = def.ToPtr<IfcCircleHollowProfileDef>()) {
if(def.ToPtr<IfcCircleHollowProfileDef>()) {
// TODO
}
const size_t segments = 32;
Expand Down
17 changes: 8 additions & 9 deletions code/OpenGEXImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/scene.h>
#include <assimp/ai_assert.h>

#include <algorithm>
#include <vector>

static const aiImporterDesc desc = {
Expand Down Expand Up @@ -183,12 +184,11 @@ USE_ODDLPARSER_NS
//------------------------------------------------------------------------------------------------
OpenGEXImporter::VertexContainer::VertexContainer()
: m_numVerts( 0 )
, m_vertices()
, m_vertices(NULL)
, m_numNormals( 0 )
, m_normals()
, m_textureCoords()
, m_numUVComps() {
// empty
, m_normals(NULL) {
std::fill(&m_numUVComps[0], &m_numUVComps[AI_MAX_NUMBER_OF_TEXTURECOORDS], 0U);
std::fill(&m_textureCoords[0], &m_textureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS], static_cast<aiVector3D *>(NULL));
}

//------------------------------------------------------------------------------------------------
Expand All @@ -215,9 +215,9 @@ OpenGEXImporter::RefInfo::~RefInfo() {

//------------------------------------------------------------------------------------------------
OpenGEXImporter::OpenGEXImporter()
: m_meshCache()
, m_root( NULL )
: m_root( NULL )
, m_nodeChildMap()
, m_meshCache()
, m_mesh2refMap()
, m_ctx( NULL )
, m_currentNode( NULL )
Expand All @@ -226,7 +226,7 @@ OpenGEXImporter::OpenGEXImporter()
, m_tokenType( Grammar::NoneType )
, m_nodeStack()
, m_unresolvedRefStack() {
// empty
std::fill(&m_metrics[0], &m_metrics[MetricInfo::Max], MetricInfo());
}

//------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -665,7 +665,6 @@ void OpenGEXImporter::handleVertexArrayNode( ODDLParser::DDLNode *node, aiScene
}

const size_t numItems( countDataArrayListItems( vaList ) );
Value *next( vaList->m_dataList );
if( Position == attribType ) {
m_currentVertices.m_numVerts = numItems;
m_currentVertices.m_vertices = new aiVector3D[ numItems ];
Expand Down
3 changes: 0 additions & 3 deletions code/OptimizeMeshes.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,6 @@ class OptimizeMeshesProcess : public BaseProcess
//! Per mesh info
std::vector<MeshInfo> meshes;

//! Next output mesh
aiMesh* mesh;

//! Output meshes
std::vector<aiMesh*> output;

Expand Down
15 changes: 7 additions & 8 deletions code/PlyExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#if !defined(ASSIMP_BUILD_NO_EXPORT) && !defined(ASSIMP_BUILD_NO_PLY_EXPORTER)

#include "PlyExporter.h"
#include <boost/scoped_ptr.hpp>
#include <boost/scoped_ptr.hpp>
#include <cmath>
#include "Exceptional.h"
#include "../include/assimp/scene.h"
#include "../include/assimp/version.h"
#include "../include/assimp/IOSystem.hpp"
#include "Exceptional.h"
#include "../include/assimp/scene.h"
#include "../include/assimp/version.h"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/Exporter.hpp"
#include "qnan.h"
#include "qnan.h"


using namespace Assimp;
Expand Down Expand Up @@ -96,8 +96,7 @@ void ExportScenePlyBinary(const char* pFile, IOSystem* pIOSystem, const aiScene*
// ------------------------------------------------------------------------------------------------
PlyExporter::PlyExporter(const char* _filename, const aiScene* pScene, bool binary)
: filename(_filename)
, pScene(pScene)
, endl("\n")
, endl("\n")
{
// make sure that all formatting happens using the standard, C locale and not the user's current locale
const std::locale& l = std::locale("C");
Expand Down
1 change: 0 additions & 1 deletion code/PlyExporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ class PlyExporter
private:

const std::string filename;
const aiScene* const pScene;

// obviously, this endl() doesn't flush() the stream
const std::string endl;
Expand Down
24 changes: 1 addition & 23 deletions code/STEPFileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "STEPFileReader.h"
#include "STEPFileEncoding.h"
#include "TinyFormatter.h"
#include "fast_atof.h"
#include "fast_atof.h"
#include <boost/make_shared.hpp>


Expand All @@ -55,28 +55,6 @@ namespace EXPRESS = STEP::EXPRESS;

#include <functional>

// ------------------------------------------------------------------------------------------------
// From http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring

// trim from start
static inline std::string &ltrim(std::string &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1( std::ptr_fun(Assimp::IsSpace<char>))));
return s;
}

// trim from end
static inline std::string &rtrim(std::string &s) {
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1( std::ptr_fun(Assimp::IsSpace<char>))).base(),s.end());
return s;
}
// trim from both ends
static inline std::string &trim(std::string &s) {
return ltrim(rtrim(s));
}




// ------------------------------------------------------------------------------------------------
std::string AddLineNumber(const std::string& s,uint64_t line /*= LINE_NOT_SPECIFIED*/, const std::string& prefix = "")
{
Expand Down
17 changes: 8 additions & 9 deletions code/STLExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#if !defined(ASSIMP_BUILD_NO_EXPORT) && !defined(ASSIMP_BUILD_NO_STL_EXPORTER)

#include "STLExporter.h"
#include "../include/assimp/version.h"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/scene.h"
#include "../include/assimp/Exporter.hpp"
#include <boost/scoped_ptr.hpp>
#include "Exceptional.h"
#include "ByteSwapper.h"
#include "../include/assimp/version.h"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/scene.h"
#include "../include/assimp/Exporter.hpp"
#include <boost/scoped_ptr.hpp>
#include "Exceptional.h"
#include "ByteSwapper.h"

using namespace Assimp;
namespace Assimp {
Expand Down Expand Up @@ -89,8 +89,7 @@ void ExportSceneSTLBinary(const char* pFile,IOSystem* pIOSystem, const aiScene*
// ------------------------------------------------------------------------------------------------
STLExporter :: STLExporter(const char* _filename, const aiScene* pScene, bool binary)
: filename(_filename)
, pScene(pScene)
, endl("\n")
, endl("\n")
{
// make sure that all formatting happens using the standard, C locale and not the user's current locale
const std::locale& l = std::locale("C");
Expand Down
1 change: 0 additions & 1 deletion code/STLExporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class STLExporter
private:

const std::string filename;
const aiScene* const pScene;

// this endl() doesn't flush() the stream
const std::string endl;
Expand Down
Loading

0 comments on commit 4bdf23a

Please sign in to comment.