aboutsummaryrefslogtreecommitdiffstats
path: root/archivers
diff options
context:
space:
mode:
authorsunpoet <sunpoet@FreeBSD.org>2015-10-05 02:00:05 +0800
committersunpoet <sunpoet@FreeBSD.org>2015-10-05 02:00:05 +0800
commit4e52506519214ba134e807151ad0838e59791d67 (patch)
tree667e20734238d4c555fb13e50c09086d0ad93170 /archivers
parent2e7360b0e9547f2774ee506e93613a7670182ea7 (diff)
downloadfreebsd-ports-gnome-4e52506519214ba134e807151ad0838e59791d67.tar.gz
freebsd-ports-gnome-4e52506519214ba134e807151ad0838e59791d67.tar.zst
freebsd-ports-gnome-4e52506519214ba134e807151ad0838e59791d67.zip
- Fix build on 9.x
- Remove unnecessary USE_CXXSTD - Bump PORTREVISION for package change Obtained from: https://github.com/google/brotli/commit/4a7024dcde1aaf30d824ade299e70711a30f4399 MFH: 2015Q4
Diffstat (limited to 'archivers')
-rw-r--r--archivers/brotli/Makefile2
-rw-r--r--archivers/brotli/files/patch-freebsd9879
2 files changed, 880 insertions, 1 deletions
diff --git a/archivers/brotli/Makefile b/archivers/brotli/Makefile
index d1258145b7bb..c741606f2f0c 100644
--- a/archivers/brotli/Makefile
+++ b/archivers/brotli/Makefile
@@ -3,6 +3,7 @@
PORTNAME= brotli
PORTVERSION= 0.2.0
+PORTREVISION= 1
DISTVERSIONPREFIX= v
CATEGORIES= archivers
@@ -12,7 +13,6 @@ COMMENT= Generic-purpose lossless compression algorithm
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/LICENSE
-USE_CXXSTD= c++0x
USE_PYTHON= autoplist distutils
USES= compiler:c++0x python
diff --git a/archivers/brotli/files/patch-freebsd9 b/archivers/brotli/files/patch-freebsd9
new file mode 100644
index 000000000000..3574e32df421
--- /dev/null
+++ b/archivers/brotli/files/patch-freebsd9
@@ -0,0 +1,879 @@
+Obtained from: https://github.com/google/brotli/commit/4a7024dcde1aaf30d824ade299e70711a30f4399
+
+--- enc/backward_references.cc.orig 2015-09-01 13:04:54 UTC
++++ enc/backward_references.cc
+@@ -636,7 +636,7 @@ void CreateBackwardReferences(size_t num
+ int* num_literals) {
+ bool zopflify = quality > 9;
+ if (zopflify) {
+- Hashers::H9* hasher = hashers->hash_h9.get();
++ Hashers::H9* hasher = hashers->hash_h9;
+ if (num_bytes >= 3 && position >= 3) {
+ // Prepare the hashes for three last bytes of the last write.
+ // These could not be calculated before, since they require knowledge
+@@ -710,55 +710,55 @@ void CreateBackwardReferences(size_t num
+ case 1:
+ CreateBackwardReferences<Hashers::H1>(
+ num_bytes, position, ringbuffer, ringbuffer_mask, max_backward_limit,
+- quality, hashers->hash_h1.get(), dist_cache, last_insert_len,
++ quality, hashers->hash_h1, dist_cache, last_insert_len,
+ commands, num_commands, num_literals);
+ break;
+ case 2:
+ CreateBackwardReferences<Hashers::H2>(
+ num_bytes, position, ringbuffer, ringbuffer_mask, max_backward_limit,
+- quality, hashers->hash_h2.get(), dist_cache, last_insert_len,
++ quality, hashers->hash_h2, dist_cache, last_insert_len,
+ commands, num_commands, num_literals);
+ break;
+ case 3:
+ CreateBackwardReferences<Hashers::H3>(
+ num_bytes, position, ringbuffer, ringbuffer_mask, max_backward_limit,
+- quality, hashers->hash_h3.get(), dist_cache, last_insert_len,
++ quality, hashers->hash_h3, dist_cache, last_insert_len,
+ commands, num_commands, num_literals);
+ break;
+ case 4:
+ CreateBackwardReferences<Hashers::H4>(
+ num_bytes, position, ringbuffer, ringbuffer_mask, max_backward_limit,
+- quality, hashers->hash_h4.get(), dist_cache, last_insert_len,
++ quality, hashers->hash_h4, dist_cache, last_insert_len,
+ commands, num_commands, num_literals);
+ break;
+ case 5:
+ CreateBackwardReferences<Hashers::H5>(
+ num_bytes, position, ringbuffer, ringbuffer_mask, max_backward_limit,
+- quality, hashers->hash_h5.get(), dist_cache, last_insert_len,
++ quality, hashers->hash_h5, dist_cache, last_insert_len,
+ commands, num_commands, num_literals);
+ break;
+ case 6:
+ CreateBackwardReferences<Hashers::H6>(
+ num_bytes, position, ringbuffer, ringbuffer_mask, max_backward_limit,
+- quality, hashers->hash_h6.get(), dist_cache, last_insert_len,
++ quality, hashers->hash_h6, dist_cache, last_insert_len,
+ commands, num_commands, num_literals);
+ break;
+ case 7:
+ CreateBackwardReferences<Hashers::H7>(
+ num_bytes, position, ringbuffer, ringbuffer_mask, max_backward_limit,
+- quality, hashers->hash_h7.get(), dist_cache, last_insert_len,
++ quality, hashers->hash_h7, dist_cache, last_insert_len,
+ commands, num_commands, num_literals);
+ break;
+ case 8:
+ CreateBackwardReferences<Hashers::H8>(
+ num_bytes, position, ringbuffer, ringbuffer_mask, max_backward_limit,
+- quality, hashers->hash_h8.get(), dist_cache, last_insert_len,
++ quality, hashers->hash_h8, dist_cache, last_insert_len,
+ commands, num_commands, num_literals);
+ break;
+ case 9:
+ CreateBackwardReferences<Hashers::H9>(
+ num_bytes, position, ringbuffer, ringbuffer_mask, max_backward_limit,
+- quality, hashers->hash_h9.get(), dist_cache, last_insert_len,
++ quality, hashers->hash_h9, dist_cache, last_insert_len,
+ commands, num_commands, num_literals);
+ break;
+ default:
+--- enc/backward_references.h.orig 2015-09-01 13:04:54 UTC
++++ enc/backward_references.h
+@@ -17,11 +17,11 @@
+ #ifndef BROTLI_ENC_BACKWARD_REFERENCES_H_
+ #define BROTLI_ENC_BACKWARD_REFERENCES_H_
+
+-#include <stdint.h>
+ #include <vector>
+
+ #include "./hash.h"
+ #include "./command.h"
++#include "./types.h"
+
+ namespace brotli {
+
+--- enc/bit_cost.h.orig 2015-09-01 13:04:54 UTC
++++ enc/bit_cost.h
+@@ -18,10 +18,10 @@
+ #define BROTLI_ENC_BIT_COST_H_
+
+
+-#include <stdint.h>
+
+ #include "./entropy_encode.h"
+ #include "./fast_log.h"
++#include "./types.h"
+
+ namespace brotli {
+
+--- enc/block_splitter.h.orig 2015-09-01 13:04:54 UTC
++++ enc/block_splitter.h
+@@ -17,14 +17,13 @@
+ #ifndef BROTLI_ENC_BLOCK_SPLITTER_H_
+ #define BROTLI_ENC_BLOCK_SPLITTER_H_
+
+-#include <stddef.h>
+-#include <stdint.h>
+ #include <string.h>
+ #include <vector>
+ #include <utility>
+
+ #include "./command.h"
+ #include "./metablock.h"
++#include "./types.h"
+
+ namespace brotli {
+
+--- enc/brotli_bit_stream.cc.orig 2015-09-01 13:04:54 UTC
++++ enc/brotli_bit_stream.cc
+@@ -28,7 +28,6 @@
+ #include "./fast_log.h"
+ #include "./prefix.h"
+ #include "./write_bits.h"
+-
+ namespace brotli {
+
+ // returns false if fail
+@@ -275,6 +274,7 @@ void StoreHuffmanTree(const uint8_t* dep
+ storage_ix, storage);
+ }
+
++
+ void BuildAndStoreHuffmanTree(const int *histogram,
+ const int length,
+ uint8_t* depth,
+--- enc/brotli_bit_stream.h.orig 2015-09-01 13:04:54 UTC
++++ enc/brotli_bit_stream.h
+@@ -24,11 +24,10 @@
+ #ifndef BROTLI_ENC_BROTLI_BIT_STREAM_H_
+ #define BROTLI_ENC_BROTLI_BIT_STREAM_H_
+
+-#include <stddef.h>
+-#include <stdint.h>
+ #include <vector>
+
+ #include "./metablock.h"
++#include "./types.h"
+
+ namespace brotli {
+
+--- enc/cluster.h.orig 2015-09-01 13:04:54 UTC
++++ enc/cluster.h
+@@ -18,7 +18,6 @@
+ #define BROTLI_ENC_CLUSTER_H_
+
+ #include <math.h>
+-#include <stdint.h>
+ #include <stdio.h>
+ #include <algorithm>
+ #include <complex>
+@@ -31,6 +30,7 @@
+ #include "./entropy_encode.h"
+ #include "./fast_log.h"
+ #include "./histogram.h"
++#include "./types.h"
+
+ namespace brotli {
+
+@@ -264,6 +264,7 @@ void ClusterHistograms(const std::vector
+ (*histogram_symbols)[i] = i;
+ }
+
++
+ const int max_input_histograms = 64;
+ for (int i = 0; i < in_size; i += max_input_histograms) {
+ int num_to_combine = std::min(in_size - i, max_input_histograms);
+@@ -282,6 +283,7 @@ void ClusterHistograms(const std::vector
+
+ // Convert the context map to a canonical form.
+ HistogramReindex(out, histogram_symbols);
++
+ }
+
+
+--- enc/command.h.orig 2015-09-01 13:04:54 UTC
++++ enc/command.h
+@@ -17,9 +17,9 @@
+ #ifndef BROTLI_ENC_COMMAND_H_
+ #define BROTLI_ENC_COMMAND_H_
+
+-#include <stdint.h>
+ #include "./fast_log.h"
+ #include "./prefix.h"
++#include "./types.h"
+
+ namespace brotli {
+
+--- enc/context.h.orig 2015-09-01 13:04:54 UTC
++++ enc/context.h
+@@ -17,7 +17,7 @@
+ #ifndef BROTLI_ENC_CONTEXT_H_
+ #define BROTLI_ENC_CONTEXT_H_
+
+-#include <stdint.h>
++#include "./types.h"
+
+ namespace brotli {
+
+--- enc/dictionary.h.orig 2015-09-01 13:04:54 UTC
++++ enc/dictionary.h
+@@ -17,7 +17,7 @@
+ #ifndef BROTLI_ENC_DICTIONARY_H_
+ #define BROTLI_ENC_DICTIONARY_H_
+
+-#include <stdint.h>
++#include "./types.h"
+
+ static const uint8_t kBrotliDictionary[] = {
+ 0x74, 0x69, 0x6d, 0x65, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x69, 0x66, 0x65, 0x6c,
+--- enc/dictionary_hash.h.orig 2015-09-01 13:04:54 UTC
++++ enc/dictionary_hash.h
+@@ -17,7 +17,7 @@
+ #ifndef BROTLI_ENC_DICTIONARY_HASH_H_
+ #define BROTLI_ENC_DICTIONARY_HASH_H_
+
+-#include <stdint.h>
++#include "./types.h"
+
+ namespace brotli {
+
+--- enc/encode.cc.orig 2015-09-01 13:04:54 UTC
++++ enc/encode.cc
+@@ -125,16 +125,18 @@ void RecomputeDistancePrefixes(Command*
+
+ uint8_t* BrotliCompressor::GetBrotliStorage(size_t size) {
+ if (storage_size_ < size) {
+- storage_.reset(new uint8_t[size]);
++ delete[] storage_;
++ storage_ = new uint8_t[size];
+ storage_size_ = size;
+ }
+- return &storage_[0];
++ return storage_;
+ }
+
+ BrotliCompressor::BrotliCompressor(BrotliParams params)
+ : params_(params),
+ hashers_(new Hashers()),
+ input_pos_(0),
++ literal_cost_(0),
+ num_commands_(0),
+ num_literals_(0),
+ last_insert_len_(0),
+@@ -142,7 +144,8 @@ BrotliCompressor::BrotliCompressor(Brotl
+ last_processed_pos_(0),
+ prev_byte_(0),
+ prev_byte2_(0),
+- storage_size_(0) {
++ storage_size_(0),
++ storage_(0) {
+ // Sanitize params.
+ params_.quality = std::max(1, params_.quality);
+ if (params_.lgwin < kMinWindowBits) {
+@@ -169,15 +172,15 @@ BrotliCompressor::BrotliCompressor(Brotl
+ // read_block_size_bits + 1 bits because the copy tail length needs to be
+ // smaller than ringbuffer size.
+ int ringbuffer_bits = std::max(params_.lgwin + 1, params_.lgblock + 1);
+- ringbuffer_.reset(new RingBuffer(ringbuffer_bits, params_.lgblock));
++ ringbuffer_ = new RingBuffer(ringbuffer_bits, params_.lgblock);
+ if (params_.quality > 9) {
+ literal_cost_mask_ = (1 << params_.lgblock) - 1;
+- literal_cost_.reset(new float[literal_cost_mask_ + 1]);
++ literal_cost_ = new float[literal_cost_mask_ + 1];
+ }
+
+ // Allocate command buffer.
+ cmd_buffer_size_ = std::max(1 << 18, 1 << params_.lgblock);
+- commands_.reset(new brotli::Command[cmd_buffer_size_]);
++ commands_ = new brotli::Command[cmd_buffer_size_];
+
+ // Initialize last byte with stream header.
+ if (params_.lgwin == 16) {
+@@ -209,6 +212,11 @@ BrotliCompressor::BrotliCompressor(Brotl
+ }
+
+ BrotliCompressor::~BrotliCompressor() {
++ delete[] storage_;
++ delete[] literal_cost_;
++ delete[] commands_;
++ delete ringbuffer_;
++ delete hashers_;
+ }
+
+ void BrotliCompressor::CopyInputToRingBuffer(const size_t input_size,
+@@ -292,23 +300,23 @@ bool BrotliCompressor::WriteBrotliData(c
+ params_.quality >= 9 &&
+ IsMostlyUTF8(&data[last_processed_pos_ & mask], bytes, kMinUTF8Ratio);
+
+- if (literal_cost_.get()) {
++ if (literal_cost_) {
+ if (utf8_mode) {
+ EstimateBitCostsForLiteralsUTF8(last_processed_pos_, bytes, mask,
+ literal_cost_mask_, data,
+- literal_cost_.get());
++ literal_cost_);
+ } else {
+ EstimateBitCostsForLiterals(last_processed_pos_, bytes, mask,
+ literal_cost_mask_,
+- data, literal_cost_.get());
++ data, literal_cost_);
+ }
+ }
+ CreateBackwardReferences(bytes, last_processed_pos_, data, mask,
+- literal_cost_.get(),
++ literal_cost_,
+ literal_cost_mask_,
+ max_backward_distance_,
+ params_.quality,
+- hashers_.get(),
++ hashers_,
+ hash_type_,
+ dist_cache_,
+ &last_insert_len_,
+@@ -487,14 +495,14 @@ bool BrotliCompressor::WriteMetaBlockInt
+ if (params_.quality > 9 && params_.mode == BrotliParams::MODE_FONT) {
+ num_direct_distance_codes = 12;
+ distance_postfix_bits = 1;
+- RecomputeDistancePrefixes(commands_.get(),
++ RecomputeDistancePrefixes(commands_,
+ num_commands_,
+ num_direct_distance_codes,
+ distance_postfix_bits);
+ }
+ if (params_.quality < kMinQualityForBlockSplit) {
+ if (!StoreMetaBlockTrivial(data, last_flush_pos_, bytes, mask, is_last,
+- commands_.get(), num_commands_,
++ commands_, num_commands_,
+ &storage_ix,
+ &storage[0])) {
+ return false;
+@@ -512,7 +520,7 @@ bool BrotliCompressor::WriteMetaBlockInt
+ &literal_context_map);
+ if (literal_context_map == NULL) {
+ BuildMetaBlockGreedy(data, last_flush_pos_, mask,
+- commands_.get(), num_commands_,
++ commands_, num_commands_,
+ &mb);
+ } else {
+ BuildMetaBlockGreedyWithContexts(data, last_flush_pos_, mask,
+@@ -520,13 +528,13 @@ bool BrotliCompressor::WriteMetaBlockInt
+ literal_context_mode,
+ num_literal_contexts,
+ literal_context_map,
+- commands_.get(), num_commands_,
++ commands_, num_commands_,
+ &mb);
+ }
+ } else {
+ BuildMetaBlock(data, last_flush_pos_, mask,
+ prev_byte_, prev_byte2_,
+- commands_.get(), num_commands_,
++ commands_, num_commands_,
+ literal_context_mode,
+ &mb);
+ }
+@@ -541,7 +549,7 @@ bool BrotliCompressor::WriteMetaBlockInt
+ num_direct_distance_codes,
+ distance_postfix_bits,
+ literal_context_mode,
+- commands_.get(), num_commands_,
++ commands_, num_commands_,
+ mb,
+ &storage_ix,
+ &storage[0])) {
+@@ -684,7 +692,7 @@ bool BrotliInIsFinished(BrotliIn* r) {
+ }
+
+ int BrotliCompress(BrotliParams params, BrotliIn* in, BrotliOut* out) {
+- return BrotliCompressWithCustomDictionary(0, nullptr, params, in, out);
++ return BrotliCompressWithCustomDictionary(0, 0, params, in, out);
+ }
+
+ int BrotliCompressWithCustomDictionary(size_t dictsize, const uint8_t* dict,
+--- enc/encode.h.orig 2015-09-01 13:04:54 UTC
++++ enc/encode.h
+@@ -17,8 +17,6 @@
+ #ifndef BROTLI_ENC_ENCODE_H_
+ #define BROTLI_ENC_ENCODE_H_
+
+-#include <stddef.h>
+-#include <stdint.h>
+ #include <string>
+ #include <vector>
+ #include "./command.h"
+@@ -26,6 +24,7 @@
+ #include "./ringbuffer.h"
+ #include "./static_dict.h"
+ #include "./streams.h"
++#include "./types.h"
+
+ namespace brotli {
+
+@@ -149,14 +148,14 @@ class BrotliCompressor {
+
+ BrotliParams params_;
+ int max_backward_distance_;
+- std::unique_ptr<Hashers> hashers_;
++ Hashers* hashers_;
+ int hash_type_;
+ size_t input_pos_;
+- std::unique_ptr<RingBuffer> ringbuffer_;
+- std::unique_ptr<float[]> literal_cost_;
++ RingBuffer* ringbuffer_;
++ float* literal_cost_;
+ size_t literal_cost_mask_;
+ size_t cmd_buffer_size_;
+- std::unique_ptr<Command[]> commands_;
++ Command* commands_;
+ int num_commands_;
+ int num_literals_;
+ int last_insert_len_;
+@@ -169,7 +168,7 @@ class BrotliCompressor {
+ uint8_t prev_byte_;
+ uint8_t prev_byte2_;
+ int storage_size_;
+- std::unique_ptr<uint8_t[]> storage_;
++ uint8_t* storage_;
+ };
+
+ // Compresses the data in input_buffer into encoded_buffer, and sets
+--- enc/encode_parallel.cc.orig 2015-09-01 13:04:54 UTC
++++ enc/encode_parallel.cc
+@@ -167,7 +167,7 @@ bool WriteMetaBlockParallel(const Brotli
+
+ // Initialize hashers.
+ int hash_type = std::min(9, params.quality);
+- std::unique_ptr<Hashers> hashers(new Hashers());
++ Hashers* hashers = new Hashers();
+ hashers->Init(hash_type);
+
+ // Compute backward references.
+@@ -183,13 +183,14 @@ bool WriteMetaBlockParallel(const Brotli
+ &literal_cost[0], mask,
+ max_backward_distance,
+ params.quality,
+- hashers.get(),
++ hashers,
+ hash_type,
+ dist_cache,
+ &last_insert_len,
+ &commands[0],
+ &num_commands,
+ &num_literals);
++ delete hashers;
+ commands.resize(num_commands);
+ if (last_insert_len > 0) {
+ commands.push_back(Command(last_insert_len));
+--- enc/encode_parallel.h.orig 2015-09-01 13:04:54 UTC
++++ enc/encode_parallel.h
+@@ -19,10 +19,9 @@
+ #ifndef BROTLI_ENC_ENCODE_PARALLEL_H_
+ #define BROTLI_ENC_ENCODE_PARALLEL_H_
+
+-#include <stddef.h>
+-#include <stdint.h>
+
+ #include "./encode.h"
++#include "./types.h"
+
+ namespace brotli {
+
+--- enc/entropy_encode.cc.orig 2015-09-01 13:04:54 UTC
++++ enc/entropy_encode.cc
+@@ -16,13 +16,13 @@
+
+ #include "./entropy_encode.h"
+
+-#include <stdint.h>
+ #include <algorithm>
+ #include <limits>
+ #include <vector>
+ #include <cstdlib>
+
+ #include "./histogram.h"
++#include "./types.h"
+
+ namespace brotli {
+
+--- enc/entropy_encode.h.orig 2015-09-01 13:04:54 UTC
++++ enc/entropy_encode.h
+@@ -17,11 +17,11 @@
+ #ifndef BROTLI_ENC_ENTROPY_ENCODE_H_
+ #define BROTLI_ENC_ENTROPY_ENCODE_H_
+
+-#include <stdint.h>
+ #include <string.h>
+ #include <vector>
+ #include "./histogram.h"
+ #include "./prefix.h"
++#include "./types.h"
+
+ namespace brotli {
+
+--- enc/fast_log.h.orig 2015-09-01 13:04:54 UTC
++++ enc/fast_log.h
+@@ -19,7 +19,8 @@
+
+ #include <assert.h>
+ #include <math.h>
+-#include <stdint.h>
++
++#include "./types.h"
+
+ namespace brotli {
+
+--- enc/find_match_length.h.orig 2015-09-01 13:04:54 UTC
++++ enc/find_match_length.h
+@@ -17,11 +17,9 @@
+ #ifndef BROTLI_ENC_FIND_MATCH_LENGTH_H_
+ #define BROTLI_ENC_FIND_MATCH_LENGTH_H_
+
+-#include <stdint.h>
+-
+-#include <stddef.h>
+
+ #include "./port.h"
++#include "./types.h"
+
+ namespace brotli {
+
+--- enc/hash.h.orig 2015-09-01 13:04:54 UTC
++++ enc/hash.h
+@@ -18,8 +18,6 @@
+ #ifndef BROTLI_ENC_HASH_H_
+ #define BROTLI_ENC_HASH_H_
+
+-#include <stddef.h>
+-#include <stdint.h>
+ #include <string.h>
+ #include <sys/types.h>
+ #include <algorithm>
+@@ -34,6 +32,7 @@
+ #include "./prefix.h"
+ #include "./static_dict.h"
+ #include "./transform.h"
++#include "./types.h"
+
+ namespace brotli {
+
+@@ -631,17 +630,32 @@ struct Hashers {
+ typedef HashLongestMatch<15, 7, 10> H8;
+ typedef HashLongestMatch<15, 8, 16> H9;
+
++ Hashers() : hash_h1(0), hash_h2(0), hash_h3(0), hash_h4(0), hash_h5(0),
++ hash_h6(0), hash_h7(0), hash_h8(0), hash_h9(0) {}
++
++ ~Hashers() {
++ delete hash_h1;
++ delete hash_h2;
++ delete hash_h3;
++ delete hash_h4;
++ delete hash_h5;
++ delete hash_h6;
++ delete hash_h7;
++ delete hash_h8;
++ delete hash_h9;
++ }
++
+ void Init(int type) {
+ switch (type) {
+- case 1: hash_h1.reset(new H1); break;
+- case 2: hash_h2.reset(new H2); break;
+- case 3: hash_h3.reset(new H3); break;
+- case 4: hash_h4.reset(new H4); break;
+- case 5: hash_h5.reset(new H5); break;
+- case 6: hash_h6.reset(new H6); break;
+- case 7: hash_h7.reset(new H7); break;
+- case 8: hash_h8.reset(new H8); break;
+- case 9: hash_h9.reset(new H9); break;
++ case 1: hash_h1 = new H1; break;
++ case 2: hash_h2 = new H2; break;
++ case 3: hash_h3 = new H3; break;
++ case 4: hash_h4 = new H4; break;
++ case 5: hash_h5 = new H5; break;
++ case 6: hash_h6 = new H6; break;
++ case 7: hash_h7 = new H7; break;
++ case 8: hash_h8 = new H8; break;
++ case 9: hash_h9 = new H9; break;
+ default: break;
+ }
+ }
+@@ -657,28 +671,28 @@ struct Hashers {
+ void PrependCustomDictionary(
+ int type, const size_t size, const uint8_t* dict) {
+ switch (type) {
+- case 1: WarmupHash(size, dict, hash_h1.get()); break;
+- case 2: WarmupHash(size, dict, hash_h2.get()); break;
+- case 3: WarmupHash(size, dict, hash_h3.get()); break;
+- case 4: WarmupHash(size, dict, hash_h4.get()); break;
+- case 5: WarmupHash(size, dict, hash_h5.get()); break;
+- case 6: WarmupHash(size, dict, hash_h6.get()); break;
+- case 7: WarmupHash(size, dict, hash_h7.get()); break;
+- case 8: WarmupHash(size, dict, hash_h8.get()); break;
+- case 9: WarmupHash(size, dict, hash_h9.get()); break;
++ case 1: WarmupHash(size, dict, hash_h1); break;
++ case 2: WarmupHash(size, dict, hash_h2); break;
++ case 3: WarmupHash(size, dict, hash_h3); break;
++ case 4: WarmupHash(size, dict, hash_h4); break;
++ case 5: WarmupHash(size, dict, hash_h5); break;
++ case 6: WarmupHash(size, dict, hash_h6); break;
++ case 7: WarmupHash(size, dict, hash_h7); break;
++ case 8: WarmupHash(size, dict, hash_h8); break;
++ case 9: WarmupHash(size, dict, hash_h9); break;
+ default: break;
+ }
+ }
+
+- std::unique_ptr<H1> hash_h1;
+- std::unique_ptr<H2> hash_h2;
+- std::unique_ptr<H3> hash_h3;
+- std::unique_ptr<H4> hash_h4;
+- std::unique_ptr<H5> hash_h5;
+- std::unique_ptr<H6> hash_h6;
+- std::unique_ptr<H7> hash_h7;
+- std::unique_ptr<H8> hash_h8;
+- std::unique_ptr<H9> hash_h9;
++ H1* hash_h1;
++ H2* hash_h2;
++ H3* hash_h3;
++ H4* hash_h4;
++ H5* hash_h5;
++ H6* hash_h6;
++ H7* hash_h7;
++ H8* hash_h8;
++ H9* hash_h9;
+ };
+
+ } // namespace brotli
+--- enc/histogram.cc.orig 2015-09-01 13:04:54 UTC
++++ enc/histogram.cc
+@@ -16,7 +16,6 @@
+
+ #include "./histogram.h"
+
+-#include <stdint.h>
+ #include <cmath>
+
+ #include "./block_splitter.h"
+--- enc/histogram.h.orig 2015-09-01 13:04:54 UTC
++++ enc/histogram.h
+@@ -17,13 +17,13 @@
+ #ifndef BROTLI_ENC_HISTOGRAM_H_
+ #define BROTLI_ENC_HISTOGRAM_H_
+
+-#include <stdint.h>
+ #include <string.h>
+ #include <vector>
+ #include <utility>
+ #include "./command.h"
+ #include "./fast_log.h"
+ #include "./prefix.h"
++#include "./types.h"
+
+ namespace brotli {
+
+--- enc/literal_cost.cc.orig 2015-09-01 13:04:54 UTC
++++ enc/literal_cost.cc
+@@ -17,10 +17,10 @@
+ #include "./literal_cost.h"
+
+ #include <math.h>
+-#include <stdint.h>
+ #include <algorithm>
+
+ #include "./fast_log.h"
++#include "./types.h"
+
+ namespace brotli {
+
+--- enc/literal_cost.h.orig 2015-09-01 13:04:54 UTC
++++ enc/literal_cost.h
+@@ -17,8 +17,7 @@
+ #ifndef BROTLI_ENC_LITERAL_COST_H_
+ #define BROTLI_ENC_LITERAL_COST_H_
+
+-#include <stddef.h>
+-#include <stdint.h>
++#include "./types.h"
+
+ namespace brotli {
+
+--- enc/port.h.orig 2015-09-01 13:04:54 UTC
++++ enc/port.h
+@@ -18,6 +18,7 @@
+ #define BROTLI_ENC_PORT_H_
+
+ #include <string.h>
++#include "./types.h"
+
+ #if defined OS_LINUX || defined OS_CYGWIN
+ #include <endian.h>
+--- enc/prefix.h.orig 2015-09-01 13:04:54 UTC
++++ enc/prefix.h
+@@ -18,8 +18,8 @@
+ #ifndef BROTLI_ENC_PREFIX_H_
+ #define BROTLI_ENC_PREFIX_H_
+
+-#include <stdint.h>
+ #include "./fast_log.h"
++#include "./types.h"
+
+ namespace brotli {
+
+--- enc/ringbuffer.h.orig 2015-09-01 13:04:54 UTC
++++ enc/ringbuffer.h
+@@ -17,10 +17,9 @@
+ #ifndef BROTLI_ENC_RINGBUFFER_H_
+ #define BROTLI_ENC_RINGBUFFER_H_
+
+-#include <stddef.h>
+-#include <stdint.h>
+
+ #include "./port.h"
++#include "./types.h"
+
+ namespace brotli {
+
+--- enc/static_dict.h.orig 2015-09-01 13:04:54 UTC
++++ enc/static_dict.h
+@@ -17,7 +17,7 @@
+ #ifndef BROTLI_ENC_STATIC_DICT_H_
+ #define BROTLI_ENC_STATIC_DICT_H_
+
+-#include <stdint.h>
++#include "./types.h"
+
+ namespace brotli {
+
+--- enc/static_dict_lut.h.orig 2015-09-01 13:04:54 UTC
++++ enc/static_dict_lut.h
+@@ -17,7 +17,7 @@
+ #ifndef BROTLI_ENC_DICTIONARY_LUT_H_
+ #define BROTLI_ENC_DICTIONARY_LUT_H_
+
+-#include <stdint.h>
++#include "./types.h"
+
+ namespace brotli {
+
+--- enc/streams.h.orig 2015-09-01 13:04:54 UTC
++++ enc/streams.h
+@@ -17,9 +17,10 @@
+ #ifndef BROTLI_ENC_STREAMS_H_
+ #define BROTLI_ENC_STREAMS_H_
+
+-#include <stddef.h>
+ #include <stdio.h>
+ #include <string>
++#include "./port.h"
++#include "./types.h"
+
+ namespace brotli {
+
+@@ -56,7 +57,7 @@ class BrotliMemIn : public BrotliIn {
+ // returns the amount of data consumed
+ int position() const { return pos_; }
+
+- const void* Read(size_t n, size_t* OUTPUT) override;
++ const void* Read(size_t n, size_t* OUTPUT);
+
+ private:
+ const void* buf_; // start of input buffer
+@@ -74,7 +75,7 @@ class BrotliMemOut : public BrotliOut {
+ // returns the amount of data written
+ int position() const { return pos_; }
+
+- bool Write(const void* buf, size_t n) override;
++ bool Write(const void* buf, size_t n);
+
+ private:
+ void* buf_; // start of output buffer
+@@ -92,7 +93,7 @@ class BrotliStringOut : public BrotliOut
+
+ void Reset(std::string* buf, int max_len);
+
+- bool Write(const void* buf, size_t n) override;
++ bool Write(const void* buf, size_t n);
+
+ private:
+ std::string* buf_; // start of output buffer
+@@ -105,7 +106,7 @@ class BrotliFileIn : public BrotliIn {
+ BrotliFileIn(FILE* f, size_t max_read_size);
+ ~BrotliFileIn();
+
+- const void* Read(size_t n, size_t* bytes_read) override;
++ const void* Read(size_t n, size_t* bytes_read);
+
+ private:
+ FILE* f_;
+@@ -118,7 +119,7 @@ class BrotliFileOut : public BrotliOut {
+ public:
+ explicit BrotliFileOut(FILE* f);
+
+- bool Write(const void* buf, size_t n) override;
++ bool Write(const void* buf, size_t n);
+ private:
+ FILE* f_;
+ };
+--- enc/types.h.orig 2015-10-04 15:45:23 UTC
++++ enc/types.h
+@@ -0,0 +1,36 @@
++/* Copyright 2013 Google Inc. All Rights Reserved.
++
++ Licensed under the Apache License, Version 2.0 (the "License");
++ you may not use this file except in compliance with the License.
++ You may obtain a copy of the License at
++
++ http://www.apache.org/licenses/LICENSE-2.0
++
++ Unless required by applicable law or agreed to in writing, software
++ distributed under the License is distributed on an "AS IS" BASIS,
++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ See the License for the specific language governing permissions and
++ limitations under the License.
++*/
++
++/* Common types */
++
++#ifndef BROTLI_ENC_TYPES_H_
++#define BROTLI_ENC_TYPES_H_
++
++#include <stddef.h> /* for size_t */
++
++#if defined(_MSC_VER) && (_MSC_VER < 1600)
++typedef signed char int8_t;
++typedef unsigned char uint8_t;
++typedef signed short int16_t;
++typedef unsigned short uint16_t;
++typedef signed int int32_t;
++typedef unsigned int uint32_t;
++typedef unsigned long long int uint64_t;
++typedef long long int int64_t;
++#else
++#include <stdint.h>
++#endif /* defined(_MSC_VER) && (_MSC_VER < 1600) */
++
++#endif /* BROTLI_ENC_TYPES_H_ */
+--- enc/write_bits.h.orig 2015-09-01 13:04:54 UTC
++++ enc/write_bits.h
+@@ -18,10 +18,10 @@
+ #define BROTLI_ENC_WRITE_BITS_H_
+
+ #include <assert.h>
+-#include <stdint.h>
+ #include <stdio.h>
+
+ #include "./port.h"
++#include "./types.h"
+
+ namespace brotli {
+
+--- setup.py.orig 2015-09-01 13:04:54 UTC
++++ setup.py
+@@ -175,6 +175,7 @@ brotli = Extension("brotli",
+ "enc/static_dict_lut.h",
+ "enc/streams.h",
+ "enc/transform.h",
++ "enc/types.h",
+ "enc/write_bits.h",
+ "dec/bit_reader.h",
+ "dec/context.h",