Fixed: shared_ptr vs. unique_ptr behavior in VS2013

This commit is contained in:
jaynus 2015-05-14 07:42:21 -07:00
parent cac70762f5
commit 99c04d0ed3
2 changed files with 10 additions and 1 deletions

View File

@ -41,7 +41,12 @@ namespace ace {
if (in.eof()) {
in.clear();
}
_data = std::unique_ptr<uint8_t[]>(new uint8_t[expected_size + (expected_size % 8)]);
#if _MSC_VER == 1800
_data = std::make_shared<uint8_t[]>(expected_size + (expected_size % 8));
#else
_data = std::make_unique<uint8_t[]>(expected_size + (expected_size % 8));
#endif
result = _mikero_lzo1x_decompress_safe(buffer, _data.get(), expected_size);
if (result < 0) {
LOG(ERROR) << "Decompression failed";

View File

@ -12,7 +12,11 @@ namespace ace {
protected:
int _mikero_lzo1x_decompress_safe(const uint8_t*, uint8_t*, uint32_t);
int _decompress_safe(std::istream &, uint32_t);
#if _MSC_VER == 1800
std::shared_ptr<uint8_t[]> _data;
#else
std::unique_ptr<uint8_t[]> _data;
#endif
};
template<typename T>
class compressed_base : public _compressed_base {