Const fixes.
This commit is contained in:
		| @@ -76,7 +76,7 @@ namespace PolyVox | ||||
| 		 * \param uDstLength The length of the destination buffer (compression will fail if this isn't big enough). | ||||
| 		 * \return The size of the resulting compressed data. | ||||
| 		 */ | ||||
| 		virtual uint32_t compress(void* pSrcData, uint32_t uSrcLength, void* pDstData, uint32_t uDstLength) = 0; | ||||
| 		virtual uint32_t compress(const void* pSrcData, uint32_t uSrcLength, void* pDstData, uint32_t uDstLength) = 0; | ||||
|  | ||||
| 		/** | ||||
| 		 * Decompresses the data. | ||||
| @@ -93,7 +93,7 @@ namespace PolyVox | ||||
| 		 * \param uDstLength The length of the destination buffer (decompression will fail if this isn't big enough). | ||||
| 		 * \return The size of the resulting uncompressed data. | ||||
| 		 */ | ||||
| 		virtual uint32_t decompress(void* pSrcData, uint32_t uSrcLength, void* pDstData, uint32_t uDstLength) = 0; | ||||
| 		virtual uint32_t decompress(const void* pSrcData, uint32_t uSrcLength, void* pDstData, uint32_t uDstLength) = 0; | ||||
| 	}; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -56,6 +56,7 @@ namespace PolyVox | ||||
| 	{ | ||||
| 	public: | ||||
| 		CompressedBlock(); | ||||
| 		~CompressedBlock(); | ||||
|  | ||||
| 		const uint8_t* getData(void) const; | ||||
| 		uint32_t getDataSizeInBytes(void) const; | ||||
| @@ -64,7 +65,7 @@ namespace PolyVox | ||||
|  | ||||
| 		uint32_t calculateSizeInBytes(void); | ||||
|  | ||||
| 	public: | ||||
| 	private: | ||||
| 		uint8_t* m_pData; | ||||
| 		uint32_t m_uDataSizeInBytes; | ||||
| 	}; | ||||
|   | ||||
| @@ -44,6 +44,13 @@ namespace PolyVox | ||||
| 	{ | ||||
| 	} | ||||
|  | ||||
| 	template <typename VoxelType> | ||||
| 	CompressedBlock<VoxelType>::~CompressedBlock() | ||||
| 	{ | ||||
| 		delete[] m_pData; | ||||
| 		m_pData = 0; | ||||
| 	} | ||||
|  | ||||
| 	template <typename VoxelType> | ||||
| 	const uint8_t* CompressedBlock<VoxelType>::getData(void) const | ||||
| 	{ | ||||
| @@ -71,6 +78,9 @@ namespace PolyVox | ||||
|  | ||||
| 		// Copy the data across | ||||
| 		memcpy(m_pData, pData, uDataSizeInBytes); | ||||
|  | ||||
| 		// Flag as modified | ||||
| 		m_bDataModified = true; | ||||
| 	} | ||||
|  | ||||
| 	template <typename VoxelType> | ||||
|   | ||||
| @@ -641,9 +641,9 @@ namespace PolyVox | ||||
| 		{ | ||||
| 			UncompressedBlock<VoxelType>* pUncompressedBlock = new UncompressedBlock<VoxelType>(m_uBlockSideLength); | ||||
|  | ||||
| 			void* pSrcData = reinterpret_cast<void*>(block->m_pData); | ||||
| 			const void* pSrcData = reinterpret_cast<const void*>(block->getData()); | ||||
| 			void* pDstData = reinterpret_cast<void*>(pUncompressedBlock->m_tUncompressedData); | ||||
| 			uint32_t uSrcLength = block->m_uDataSizeInBytes; | ||||
| 			uint32_t uSrcLength = block->getDataSizeInBytes(); | ||||
| 			uint32_t uDstLength = m_uBlockSideLength * m_uBlockSideLength * m_uBlockSideLength * sizeof(VoxelType); | ||||
|  | ||||
| 			//MinizCompressor compressor; | ||||
|   | ||||
| @@ -25,8 +25,8 @@ namespace PolyVox | ||||
| 		 | ||||
| 		// API documentation is in base class and gets inherited by Doxygen. | ||||
| 		uint32_t getMaxCompressedSize(uint32_t uUncompressedInputSize); | ||||
| 		uint32_t compress(void* pSrcData, uint32_t uSrcLength, void* pDstData, uint32_t uDstLength); | ||||
| 		uint32_t decompress(void* pSrcData, uint32_t uSrcLength, void* pDstData, uint32_t uDstLength); | ||||
| 		uint32_t compress(const void* pSrcData, uint32_t uSrcLength, void* pDstData, uint32_t uDstLength); | ||||
| 		uint32_t decompress(const void* pSrcData, uint32_t uSrcLength, void* pDstData, uint32_t uDstLength); | ||||
| 	 | ||||
| 	private: | ||||
| 		unsigned int m_uCompressionFlags; | ||||
|   | ||||
| @@ -30,8 +30,8 @@ namespace PolyVox | ||||
|  | ||||
| 		// API documentation is in base class and gets inherited by Doxygen. | ||||
| 		uint32_t getMaxCompressedSize(uint32_t uUncompressedInputSize); | ||||
| 		uint32_t compress(void* pSrcData, uint32_t uSrcLength, void* pDstData, uint32_t uDstLength); | ||||
| 		uint32_t decompress(void* pSrcData, uint32_t uSrcLength, void* pDstData, uint32_t uDstLength); | ||||
| 		uint32_t compress(const void* pSrcData, uint32_t uSrcLength, void* pDstData, uint32_t uDstLength); | ||||
| 		uint32_t decompress(const void* pSrcData, uint32_t uSrcLength, void* pDstData, uint32_t uDstLength); | ||||
| 	}; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -22,7 +22,7 @@ namespace PolyVox | ||||
| 	} | ||||
|  | ||||
| 	template<typename ValueType, typename LengthType> | ||||
| 	uint32_t RLECompressor<ValueType, LengthType>::compress(void* pSrcData, uint32_t uSrcLength, void* pDstData, uint32_t uDstLength) | ||||
| 	uint32_t RLECompressor<ValueType, LengthType>::compress(const void* pSrcData, uint32_t uSrcLength, void* pDstData, uint32_t uDstLength) | ||||
| 	{ | ||||
| 		if(uSrcLength % sizeof(ValueType) != 0) | ||||
| 		{ | ||||
| @@ -34,11 +34,11 @@ namespace PolyVox | ||||
| 		uDstLength /= sizeof(Run); | ||||
|  | ||||
| 		// Get data pointers in the appropriate type | ||||
| 		ValueType* pSrcDataAsType = reinterpret_cast<ValueType*>(pSrcData); | ||||
| 		const ValueType* pSrcDataAsType = reinterpret_cast<const ValueType*>(pSrcData); | ||||
| 		Run* pDstDataAsRun = reinterpret_cast<Run*>(pDstData); | ||||
|  | ||||
| 		// Pointers to just past the end of the data | ||||
| 		ValueType* pSrcDataEnd = pSrcDataAsType + uSrcLength; | ||||
| 		const ValueType* pSrcDataEnd = pSrcDataAsType + uSrcLength; | ||||
| 		Run* pDstDataEnd = pDstDataAsRun + uDstLength; | ||||
|  | ||||
| 		//Counter for the output length | ||||
| @@ -83,7 +83,7 @@ namespace PolyVox | ||||
| 	} | ||||
|  | ||||
| 	template<typename ValueType, typename LengthType> | ||||
| 	uint32_t RLECompressor<ValueType, LengthType>::decompress(void* pSrcData, uint32_t uSrcLength, void* pDstData, uint32_t uDstLength) | ||||
| 	uint32_t RLECompressor<ValueType, LengthType>::decompress(const void* pSrcData, uint32_t uSrcLength, void* pDstData, uint32_t uDstLength) | ||||
| 	{ | ||||
| 		if(uSrcLength % sizeof(Run) != 0) | ||||
| 		{ | ||||
| @@ -95,11 +95,11 @@ namespace PolyVox | ||||
| 		uDstLength /= sizeof(ValueType); | ||||
|  | ||||
| 		// Get data pointers in the appropriate type | ||||
| 		Run* pSrcDataAsRun = reinterpret_cast<Run*>(pSrcData); | ||||
| 		const Run* pSrcDataAsRun = reinterpret_cast<const Run*>(pSrcData); | ||||
| 		ValueType* pDstDataAsType = reinterpret_cast<ValueType*>(pDstData); | ||||
|  | ||||
| 		// Pointers to just past the end of the data | ||||
| 		Run* pSrcDataEnd = pSrcDataAsRun + uSrcLength; | ||||
| 		const Run* pSrcDataEnd = pSrcDataAsRun + uSrcLength; | ||||
| 		ValueType* pDstDataEnd = pDstDataAsType + uDstLength; | ||||
|  | ||||
| 		//Counter for the output length | ||||
|   | ||||
		Reference in New Issue
	
	Block a user