3 * ====================================================================
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
20 * ====================================================================
23 * @file svn_utf_private.h
24 * @brief UTF validation routines
27 #ifndef SVN_UTF_PRIVATE_H
28 #define SVN_UTF_PRIVATE_H
31 #include <apr_pools.h>
33 #include "svn_types.h"
37 #endif /* __cplusplus */
40 /* Return TRUE if the string SRC of length LEN is a valid UTF-8 encoding
41 * according to the rules laid down by the Unicode 4.0 standard, FALSE
42 * otherwise. This function is faster than svn_utf__last_valid().
45 svn_utf__is_valid(const char *src, apr_size_t len);
47 /* As for svn_utf__is_valid but SRC is NULL terminated. */
49 svn_utf__cstring_is_valid(const char *src);
51 /* Return a pointer to the first character after the last valid UTF-8
52 * potentially multi-byte character in the string SRC of length LEN.
53 * Validity of bytes from SRC to SRC+LEN-1, inclusively, is checked.
54 * If SRC is a valid UTF-8, the return value will point to the byte SRC+LEN,
55 * otherwise it will point to the start of the first invalid character.
56 * In either case all the characters between SRC and the return pointer - 1,
57 * inclusively, are valid UTF-8.
59 * See also svn_utf__is_valid().
62 svn_utf__last_valid(const char *src, apr_size_t len);
64 /* As for svn_utf__last_valid but uses a different implementation without
65 lookup tables. It avoids the table memory use (about 400 bytes) but the
66 function is longer (about 200 bytes extra) and likely to be slower when
67 the string is valid. If the string is invalid this function may be
68 faster since it returns immediately rather than continuing to the end of
69 the string. The main reason this function exists is to test the table
70 driven implementation. */
72 svn_utf__last_valid2(const char *src, apr_size_t len);
75 svn_utf__cstring_from_utf8_fuzzy(const char *src,
77 svn_error_t *(*convert_from_utf8)
85 #endif /* __cplusplus */
87 #endif /* SVN_UTF_PRIVATE_H */