]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/subversion/subversion/include/private/svn_magic.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / subversion / subversion / include / private / svn_magic.h
1 /**
2  * @copyright
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
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
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
19  *    under the License.
20  * ====================================================================
21  * @endcopyright
22  *
23  * @file svn_magic.h
24  * @brief Subversion interface to libmagic.
25  */
26
27 #ifndef SVN_MAGIC_H
28 #define SVN_MAGIC_H
29
30 /* An opaque struct that wraps a libmagic cookie. */
31 typedef struct svn_magic__cookie_t svn_magic__cookie_t;
32
33 /* This routine initialises libmagic.
34  * Upon success a new *MAGIC_COOKIE is allocated in RESULT_POOL.
35  * On failure *MAGIC_COOKIE is set to NULL.
36  * All resources used by libmagic are freed by a cleanup handler
37  * installed on RESULT_POOL, i.e. *MAGIC_COOKIE becomes invalid when
38  * the pool is cleared! */
39 void
40 svn_magic__init(svn_magic__cookie_t **magic_cookie,
41                 apr_pool_t *result_pool);
42
43 /* Detect the mime-type of the file at LOCAL_ABSPATH using MAGIC_COOKIE.
44  * If the mime-type is binary return the result in *MIMETYPE.
45  * If the file is not a binary file or if its mime-type cannot be determined
46  * set *MIMETYPE to NULL. Allocate *MIMETYPE in RESULT_POOL.
47  * Use SCRATCH_POOL for temporary allocations. */
48 svn_error_t *
49 svn_magic__detect_binary_mimetype(const char **mimetype,
50                                   const char *local_abspath,
51                                   svn_magic__cookie_t *magic_cookie,
52                                   apr_pool_t *result_pool,
53                                   apr_pool_t *scratch_pool);
54
55 #endif /* SVN_MAGIC_H */