2015-11-27 10:27:11 +00:00
|
|
|
/* Copyright 2013 Google Inc. All Rights Reserved.
|
|
|
|
|
2015-12-11 10:11:51 +00:00
|
|
|
Distributed under MIT license.
|
2015-11-27 10:27:11 +00:00
|
|
|
See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
|
|
|
|
*/
|
2015-10-01 13:10:42 +00:00
|
|
|
|
2016-06-03 09:19:23 +00:00
|
|
|
/* Heuristics for deciding about the UTF8-ness of strings. */
|
2015-10-01 13:10:42 +00:00
|
|
|
|
2015-11-27 10:27:11 +00:00
|
|
|
#ifndef BROTLI_ENC_UTF8_UTIL_H_
|
|
|
|
#define BROTLI_ENC_UTF8_UTIL_H_
|
|
|
|
|
2016-06-03 08:51:04 +00:00
|
|
|
#include "../common/types.h"
|
2016-06-13 09:01:04 +00:00
|
|
|
#include "./port.h"
|
2015-10-01 13:10:42 +00:00
|
|
|
|
2016-06-13 09:01:04 +00:00
|
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2015-10-01 13:10:42 +00:00
|
|
|
|
|
|
|
static const double kMinUTF8Ratio = 0.75;
|
|
|
|
|
2016-06-03 09:19:23 +00:00
|
|
|
/* Returns 1 if at least min_fraction of the bytes between pos and
|
|
|
|
pos + length in the (data, mask) ringbuffer is UTF8-encoded, otherwise
|
|
|
|
returns 0. */
|
2016-06-13 09:01:04 +00:00
|
|
|
BROTLI_INTERNAL int BrotliIsMostlyUTF8(
|
|
|
|
const uint8_t* data, const size_t pos, const size_t mask,
|
|
|
|
const size_t length, const double min_fraction);
|
2015-10-01 13:10:42 +00:00
|
|
|
|
2016-06-13 09:01:04 +00:00
|
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|
2015-10-01 13:10:42 +00:00
|
|
|
|
2016-06-03 09:19:23 +00:00
|
|
|
#endif /* BROTLI_ENC_UTF8_UTIL_H_ */
|