CLzmaEncProps encoder_props;
chd_lzma_compressor::configure_properties(encoder_props, hunkbytes);
- // convert to decoder properties
- CLzmaProps decoder_props;
- decoder_props.lc = encoder_props.lc;
- decoder_props.lp = encoder_props.lp;
- decoder_props.pb = encoder_props.pb;
- decoder_props.dicSize = encoder_props.dictSize;
+ CLzmaEncHandle encoder = LzmaEnc_Create(&m_allocator);
+ if (!encoder)
+ throw CHDERR_DECOMPRESSION_ERROR;
+ if (LzmaEnc_SetProps(encoder, &encoder_props) != SZ_OK)
+ {
+ LzmaEnc_Destroy(encoder, &m_allocator, &m_allocator);
+ throw CHDERR_DECOMPRESSION_ERROR;
+ }
+ Byte decoder_props[LZMA_PROPS_SIZE];
+ SizeT props_size = sizeof(decoder_props);
+ if (LzmaEnc_WriteProperties(encoder, decoder_props, &props_size) != SZ_OK)
+ {
+ LzmaEnc_Destroy(encoder, &m_allocator, &m_allocator);
+ throw CHDERR_DECOMPRESSION_ERROR;
+ }
+ LzmaEnc_Destroy(encoder, &m_allocator, &m_allocator);
// do memory allocations
- SRes res = LzmaDec_Allocate_MAME(&m_decoder, &decoder_props, &m_allocator);
+ SRes res = LzmaDec_Allocate(&m_decoder, decoder_props, LZMA_PROPS_SIZE, &m_allocator);
if (res != SZ_OK)
throw CHDERR_DECOMPRESSION_ERROR;
}
#define CLIB_DECL __cdecl
#define FLAC_API_EXPORTS
+#if defined(CPU_64_BIT) && !defined(PTR64)
+#define PTR64 1
+#endif
+
/* Macros for normalizing data into big or little endian formats */
#define FLIPENDIAN_INT16(x) (((((UINT16) (x)) >> 8) | ((x) << 8)) & 0xffff)
#define FLIPENDIAN_INT32(x) ((((UINT32) (x)) << 24) | (((UINT32) (x)) >> 24) | \
#define ATTR_MALLOC __attribute__((malloc))
#define ATTR_PURE __attribute__((pure))
#define ATTR_CONST __attribute__((const))
-#define ATTR_FORCE_INLINE __attribute__((always_inline))
+#define ATTR_FORCE_INLINE inline __attribute__((always_inline))
#define ATTR_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
#define ATTR_DEPRECATED __attribute__((deprecated))
/* not supported in GCC prior to 4.4.x */