summaryrefslogtreecommitdiffstats
path: root/Utilities/cmliblzma/liblzma/lz
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-07-24 14:51:21 (GMT)
committerBrad King <brad.king@kitware.com>2014-07-29 12:45:36 (GMT)
commit73eab246fbfad22bcc1b0bb5599f8e0cffb79c0d (patch)
treed3358ae784286a14a0bafb60e6c413f7f204c4eb /Utilities/cmliblzma/liblzma/lz
parent90e7a4d41f588d87415381fdb507735e6438992c (diff)
downloadCMake-73eab246fbfad22bcc1b0bb5599f8e0cffb79c0d.zip
CMake-73eab246fbfad22bcc1b0bb5599f8e0cffb79c0d.tar.gz
CMake-73eab246fbfad22bcc1b0bb5599f8e0cffb79c0d.tar.bz2
liblzma: Avoid defining a 'restrict' macro
Any "#define restrict ..." line may conflict with MSVC header files that use "__declspec(restrict)". Define our own LZMA_RESTRICT macro in "Utilities/cmliblzma/config.h.in" and transform liblzma code to use it: git grep -lE '\<restrict\>' Utilities/cmliblzma/liblzma | xargs sed -i 's/\<restrict\>/LZMA_RESTRICT/g'
Diffstat (limited to 'Utilities/cmliblzma/liblzma/lz')
-rw-r--r--Utilities/cmliblzma/liblzma/lz/lz_decoder.c12
-rw-r--r--Utilities/cmliblzma/liblzma/lz/lz_decoder.h12
-rw-r--r--Utilities/cmliblzma/liblzma/lz/lz_encoder.c4
-rw-r--r--Utilities/cmliblzma/liblzma/lz/lz_encoder.h6
4 files changed, 17 insertions, 17 deletions
diff --git a/Utilities/cmliblzma/liblzma/lz/lz_decoder.c b/Utilities/cmliblzma/liblzma/lz/lz_decoder.c
index f45984e..9fa1bdc 100644
--- a/Utilities/cmliblzma/liblzma/lz/lz_decoder.c
+++ b/Utilities/cmliblzma/liblzma/lz/lz_decoder.c
@@ -64,9 +64,9 @@ lz_decoder_reset(lzma_coder *coder)
static lzma_ret
decode_buffer(lzma_coder *coder,
- const uint8_t *restrict in, size_t *restrict in_pos,
- size_t in_size, uint8_t *restrict out,
- size_t *restrict out_pos, size_t out_size)
+ const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
+ size_t in_size, uint8_t *LZMA_RESTRICT out,
+ size_t *LZMA_RESTRICT out_pos, size_t out_size)
{
while (true) {
size_t copy_size;
@@ -131,9 +131,9 @@ decode_buffer(lzma_coder *coder,
static lzma_ret
lz_decode(lzma_coder *coder,
lzma_allocator *allocator lzma_attribute((__unused__)),
- const uint8_t *restrict in, size_t *restrict in_pos,
- size_t in_size, uint8_t *restrict out,
- size_t *restrict out_pos, size_t out_size,
+ const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
+ size_t in_size, uint8_t *LZMA_RESTRICT out,
+ size_t *LZMA_RESTRICT out_pos, size_t out_size,
lzma_action action)
{
if (coder->next.code == NULL)
diff --git a/Utilities/cmliblzma/liblzma/lz/lz_decoder.h b/Utilities/cmliblzma/liblzma/lz/lz_decoder.h
index 2d19cac..76011f2 100644
--- a/Utilities/cmliblzma/liblzma/lz/lz_decoder.h
+++ b/Utilities/cmliblzma/liblzma/lz/lz_decoder.h
@@ -56,9 +56,9 @@ typedef struct {
lzma_coder *coder;
/// Function to decode from in[] to *dict
- lzma_ret (*code)(lzma_coder *restrict coder,
- lzma_dict *restrict dict, const uint8_t *restrict in,
- size_t *restrict in_pos, size_t in_size);
+ lzma_ret (*code)(lzma_coder *LZMA_RESTRICT coder,
+ lzma_dict *LZMA_RESTRICT dict, const uint8_t *LZMA_RESTRICT in,
+ size_t *LZMA_RESTRICT in_pos, size_t in_size);
void (*reset)(lzma_coder *coder, const void *options);
@@ -202,9 +202,9 @@ dict_put(lzma_dict *dict, uint8_t byte)
/// Copies arbitrary amount of data into the dictionary.
static inline void
-dict_write(lzma_dict *restrict dict, const uint8_t *restrict in,
- size_t *restrict in_pos, size_t in_size,
- size_t *restrict left)
+dict_write(lzma_dict *LZMA_RESTRICT dict, const uint8_t *LZMA_RESTRICT in,
+ size_t *LZMA_RESTRICT in_pos, size_t in_size,
+ size_t *LZMA_RESTRICT left)
{
// NOTE: If we are being given more data than the size of the
// dictionary, it could be possible to optimize the LZ decoder
diff --git a/Utilities/cmliblzma/liblzma/lz/lz_encoder.c b/Utilities/cmliblzma/liblzma/lz/lz_encoder.c
index a735c21..1dae924 100644
--- a/Utilities/cmliblzma/liblzma/lz/lz_encoder.c
+++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder.c
@@ -153,9 +153,9 @@ fill_window(lzma_coder *coder, lzma_allocator *allocator, const uint8_t *in,
static lzma_ret
lz_encode(lzma_coder *coder, lzma_allocator *allocator,
- const uint8_t *restrict in, size_t *restrict in_pos,
+ const uint8_t *LZMA_RESTRICT in, size_t *LZMA_RESTRICT in_pos,
size_t in_size,
- uint8_t *restrict out, size_t *restrict out_pos,
+ uint8_t *LZMA_RESTRICT out, size_t *LZMA_RESTRICT out_pos,
size_t out_size, lzma_action action)
{
while (*out_pos < out_size
diff --git a/Utilities/cmliblzma/liblzma/lz/lz_encoder.h b/Utilities/cmliblzma/liblzma/lz/lz_encoder.h
index 647f5e2..dcb4b2c 100644
--- a/Utilities/cmliblzma/liblzma/lz/lz_encoder.h
+++ b/Utilities/cmliblzma/liblzma/lz/lz_encoder.h
@@ -194,9 +194,9 @@ typedef struct {
lzma_coder *coder;
/// Function to encode from *dict to out[]
- lzma_ret (*code)(lzma_coder *restrict coder,
- lzma_mf *restrict mf, uint8_t *restrict out,
- size_t *restrict out_pos, size_t out_size);
+ lzma_ret (*code)(lzma_coder *LZMA_RESTRICT coder,
+ lzma_mf *LZMA_RESTRICT mf, uint8_t *LZMA_RESTRICT out,
+ size_t *LZMA_RESTRICT out_pos, size_t out_size);
/// Free allocated resources
void (*end)(lzma_coder *coder, lzma_allocator *allocator);