Blender  V2.93
BLI_mmap.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2020 Blender Foundation.
17  * All rights reserved.
18  */
19 
20 #pragma once
21 
26 #include "BLI_compiler_attrs.h"
27 #include "BLI_utildefines.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 /* Memory-mapped file IO that implements all the OS-specific details and error handling. */
34 
35 struct BLI_mmap_file;
36 
37 typedef struct BLI_mmap_file BLI_mmap_file;
38 
39 /* Prepares an opened file for memory-mapped IO.
40  * May return NULL if the operation fails.
41  * Note that this seeks to the end of the file to determine its length. */
43 
44 /* Reads length bytes from file at the given offset into dest.
45  * Returns whether the operation was successful (may fail when reading beyond the file
46  * end or when IO errors occur). */
47 bool BLI_mmap_read(BLI_mmap_file *file, void *dest, size_t offset, size_t length)
49 
51 
53 
54 #ifdef __cplusplus
55 }
56 #endif
#define ATTR_MALLOC
#define ATTR_NONNULL(...)
void BLI_kdtree_nd_() int BLI_kdtree_nd_() int BLI_kdtree_nd_() int BLI_kdtree_nd_() ATTR_WARN_UNUSED_RESULT
bool BLI_mmap_read(BLI_mmap_file *file, void *dest, size_t offset, size_t length) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition: BLI_mmap.c:194
BLI_mmap_file * BLI_mmap_open(int fd) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
Definition: BLI_mmap.c:147
void BLI_mmap_free(BLI_mmap_file *file) ATTR_NONNULL(1)
Definition: BLI_mmap.c:226
void * BLI_mmap_get_pointer(BLI_mmap_file *file) ATTR_WARN_UNUSED_RESULT
Definition: BLI_mmap.c:221
SIMD_FORCE_INLINE btScalar length(const btQuaternion &q)
Return the length of a quaternion.
Definition: btQuaternion.h:895
FILE * file