diff --git a/code/ByteSwap.h b/code/ByteSwap.h index 75877bc9a..7aab793cf 100644 --- a/code/ByteSwap.h +++ b/code/ByteSwap.h @@ -198,8 +198,6 @@ template struct ByteSwap::_swapper { } }; -} // Namespace Assimp - // -------------------------------------------------------------------------------------- // ByteSwap macros for BigEndian/LittleEndian support @@ -241,5 +239,47 @@ template struct ByteSwap::_swapper { #endif +namespace Intern { + +// -------------------------------------------------------------------------------------------- +template +struct ByteSwapper { + void operator() (T* inout) { + ByteSwap::Swap(inout); + } +}; + +template +struct ByteSwapper { + void operator() (T*) { + } +}; + +// -------------------------------------------------------------------------------------------- +template +struct Getter { + void operator() (T* inout, bool le) { +#ifdef AI_BUILD_BIG_ENDIAN + le = le; +#else + le = !le; +#endif + if (le) { + ByteSwapper1?true:false)> () (inout); + } + else ByteSwapper () (inout); + } +}; + +template +struct Getter { + void operator() (T* inout, bool le) { + + // static branch + ByteSwapper1)> () (inout); + } +}; +} // end Intern +} // end Assimp #endif //!! AI_BYTESWAP_H_INC diff --git a/code/StreamReader.h b/code/StreamReader.h index 5d9d8a30b..ec5b87ffc 100644 --- a/code/StreamReader.h +++ b/code/StreamReader.h @@ -46,48 +46,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_STREAMREADER_H_INCLUDED #include "ByteSwap.h" -namespace Assimp { - namespace Intern { -// -------------------------------------------------------------------------------------------- -template -struct ByteSwapper { - void operator() (T* inout) { - ByteSwap::Swap(inout); - } -}; - -template -struct ByteSwapper { - void operator() (T*) { - } -}; - -// -------------------------------------------------------------------------------------------- -template -struct Getter { - void operator() (T* inout, bool le) { -#ifdef AI_BUILD_BIG_ENDIAN - le = le; -#else - le = !le; -#endif - if (le) { - ByteSwapper1?true:false)> () (inout); - } - else ByteSwapper () (inout); - } -}; - -template -struct Getter { - void operator() (T* inout, bool le) { - - // static branch - ByteSwapper1)> () (inout); - } -}; -} // end Intern +namespace Assimp { // -------------------------------------------------------------------------------------------- /** Wrapper class around IOStream to allow for consistent reading of binary data in both @@ -130,6 +90,7 @@ public: : stream(stream) , le(le) { + ai_assert(stream); _Begin(); } @@ -138,6 +99,7 @@ public: : stream(boost::shared_ptr(stream)) , le(le) { + ai_assert(stream); _Begin(); }