Open sambler opened 6 years ago
FreeBSD promotes NULL
to nullptr
for C++11, turning the following warning into an error. Maybe drop explicit initialization of mOpenAnimations
.
Clang:
COLLADAStreamWriter/src/COLLADASWLibraryAnimations.cpp:65:97: warning:
implicit conversion of NULL constant to 'std::__1::vector<COLLADASW::Animation *,
std::__1::allocator<COLLADASW::Animation *> >::size_type' (aka 'unsigned long')
[-Wnull-conversion]
...: Library ( streamWriter, CSWC::CSW_ELEMENT_LIBRARY_ANIMATIONS ), mOpenAnimations ( NULL )
~~~~~~~~~~~~~~~ ^~~~
0
GCC:
COLLADAStreamWriter/src/COLLADASWLibraryAnimations.cpp: In constructor 'COLLADASW::LibraryAnimations::LibraryAnimations(COLLADASW::StreamWriter*)':
COLLADAStreamWriter/src/COLLADASWLibraryAnimations.cpp:65:102: warning: passing NULL to non-pointer argument 1 of 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = COLLADASW::Animation*; _Alloc = std::allocator<COLLADASW::Animation*>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<COLLADASW::Animation*>]' [-Wconversion-null]
: Library ( streamWriter, CSWC::CSW_ELEMENT_LIBRARY_ANIMATIONS ), mOpenAnimations ( NULL )
^
Something like this?
--- COLLADAStreamWriter/src/COLLADASWLibraryAnimations.cpp.orig 2017-05-10 01:36:49 UTC
+++ COLLADAStreamWriter/src/COLLADASWLibraryAnimations.cpp
@@ -62,7 +62,7 @@ namespace COLLADASW
//---------------------------------------------------------------
LibraryAnimations::LibraryAnimations ( COLLADASW::StreamWriter * streamWriter )
- : Library ( streamWriter, CSWC::CSW_ELEMENT_LIBRARY_ANIMATIONS ), mOpenAnimations ( NULL )
+ : Library ( streamWriter, CSWC::CSW_ELEMENT_LIBRARY_ANIMATIONS )
{}
//---------------------------------------------------------------
Removing mOpenAnimations ( NULL )
also fixes the build for me.
On FreeBSD using clang++ v5.0 with -std=c++11 I am getting a build error -
error: no matching constructor for initialization of 'std::vector<Animation *>'
I am actually test building with pre-releases of clang v6.0 which has defaults set to using -std=c++14 but I'm getting the same error with clang 5.0 using -std=c++11 and -std=c++0x
Changing
NULL
to0
compiles, but ismOpenAnimations ( 0 )
a reasonable change? or is there a better option.