From: <sag...@us...> - 2012-05-20 16:39:35
|
Revision: 1276 http://modplug.svn.sourceforge.net/modplug/?rev=1276&view=rev Author: saga-games Date: 2012-05-20 16:39:28 +0000 (Sun, 20 May 2012) Log Message: ----------- [Fix] ChunkReader class apparently didn't compile on VC2008. Modified Paths: -------------- trunk/OpenMPT/common/misc_util.h trunk/OpenMPT/soundlib/ChunkReader.h Modified: trunk/OpenMPT/common/misc_util.h =================================================================== --- trunk/OpenMPT/common/misc_util.h 2012-05-19 19:44:58 UTC (rev 1275) +++ trunk/OpenMPT/common/misc_util.h 2012-05-20 16:39:28 UTC (rev 1276) @@ -63,14 +63,14 @@ // Copy given object to other location. template <class T> -inline void MemCopy(T &destination, const T &source) -//-------------------------------------------------- +inline T &MemCopy(T &destination, const T &source) +//------------------------------------------------ { #if _HAS_TR1 static_assert(std::tr1::is_pointer<T>::value == false, "Won't copy pointers."); static_assert(std::tr1::is_pod<T>::value == true, "Won't copy non-pods."); #endif - memcpy(&destination, &source, sizeof(T)); + return *static_cast<T *>(memcpy(&destination, &source, sizeof(T))); } Modified: trunk/OpenMPT/soundlib/ChunkReader.h =================================================================== --- trunk/OpenMPT/soundlib/ChunkReader.h 2012-05-19 19:44:58 UTC (rev 1275) +++ trunk/OpenMPT/soundlib/ChunkReader.h 2012-05-20 16:39:28 UTC (rev 1276) @@ -34,6 +34,12 @@ public: ChunkListItem(const T &header, const FileReader &data) : chunkHeader(header), chunkData(data) { } + // VC2008 needs operator=, VC2010 doesn't... + ChunkListItem<T>& operator= (const ChunkListItem<T> &other) + { + return MemCopy(*this, other); + } + const T &GetHeader() const { return chunkHeader; } FileReader &GetData() { return chunkData; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |