2015-11-27 18:27:11 +08:00
|
|
|
/* Copyright 2013 Google Inc. All Rights Reserved.
|
|
|
|
|
2015-12-11 18:11:51 +08:00
|
|
|
Distributed under MIT license.
|
2015-11-27 18:27:11 +08:00
|
|
|
See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
|
|
|
|
*/
|
2015-10-01 21:10:42 +08:00
|
|
|
|
2016-06-03 17:19:23 +08:00
|
|
|
/* Heuristics for deciding about the UTF8-ness of strings. */
|
2015-10-01 21:10:42 +08:00
|
|
|
|
2015-11-27 18:27:11 +08:00
|
|
|
#ifndef BROTLI_ENC_UTF8_UTIL_H_
|
|
|
|
#define BROTLI_ENC_UTF8_UTIL_H_
|
|
|
|
|
2016-08-23 20:40:33 +08:00
|
|
|
#include <brotli/types.h>
|
2016-06-13 17:01:04 +08:00
|
|
|
#include "./port.h"
|
2015-10-01 21:10:42 +08:00
|
|
|
|
2016-06-13 17:01:04 +08:00
|
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2015-10-01 21:10:42 +08:00
|
|
|
|
|
|
|
static const double kMinUTF8Ratio = 0.75;
|
|
|
|
|
2016-06-03 17:19:23 +08: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-07-26 20:41:59 +08:00
|
|
|
BROTLI_INTERNAL BROTLI_BOOL BrotliIsMostlyUTF8(
|
2016-06-13 17:01:04 +08:00
|
|
|
const uint8_t* data, const size_t pos, const size_t mask,
|
|
|
|
const size_t length, const double min_fraction);
|
2015-10-01 21:10:42 +08:00
|
|
|
|
2016-06-13 17:01:04 +08:00
|
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|
2015-10-01 21:10:42 +08:00
|
|
|
|
2016-06-03 17:19:23 +08:00
|
|
|
#endif /* BROTLI_ENC_UTF8_UTIL_H_ */
|