| 1 |
.TH "types.h" 3 "August 2021" "Brotli" \" -*- nroff -*- |
| 2 |
.ad l |
| 3 |
.nh |
| 4 |
.SH NAME |
| 5 |
types.h \- Common types used in decoder and encoder API\&. |
| 6 |
|
| 7 |
.SH SYNOPSIS |
| 8 |
.br |
| 9 |
.PP |
| 10 |
.SS "Macros" |
| 11 |
|
| 12 |
.in +1c |
| 13 |
.ti -1c |
| 14 |
.RI "#define \fBBROTLI_BOOL\fP int" |
| 15 |
.br |
| 16 |
.RI "\fIA portable \fCbool\fP replacement\&. \fP" |
| 17 |
.ti -1c |
| 18 |
.RI "#define \fBBROTLI_FALSE\fP 0" |
| 19 |
.br |
| 20 |
.RI "\fIPortable \fCfalse\fP replacement\&. \fP" |
| 21 |
.ti -1c |
| 22 |
.RI "#define \fBBROTLI_TRUE\fP 1" |
| 23 |
.br |
| 24 |
.RI "\fIPortable \fCtrue\fP replacement\&. \fP" |
| 25 |
.ti -1c |
| 26 |
.RI "#define \fBTO_BROTLI_BOOL\fP(X) (!!(X) ? \fBBROTLI_TRUE\fP : \fBBROTLI_FALSE\fP)" |
| 27 |
.br |
| 28 |
.RI "\fI\fCbool\fP to \fBBROTLI_BOOL\fP conversion macros\&. \fP" |
| 29 |
.in -1c |
| 30 |
.SS "Typedefs" |
| 31 |
|
| 32 |
.in +1c |
| 33 |
.ti -1c |
| 34 |
.RI "typedef void *(* \fBbrotli_alloc_func\fP) (void *opaque, size_t size)" |
| 35 |
.br |
| 36 |
.RI "\fIAllocating function pointer type\&. \fP" |
| 37 |
.ti -1c |
| 38 |
.RI "typedef void(* \fBbrotli_free_func\fP) (void *opaque, void *address)" |
| 39 |
.br |
| 40 |
.RI "\fIDeallocating function pointer type\&. \fP" |
| 41 |
.in -1c |
| 42 |
.SH "Detailed Description" |
| 43 |
.PP |
| 44 |
Common types used in decoder and encoder API\&. |
| 45 |
|
| 46 |
|
| 47 |
.SH "Macro Definition Documentation" |
| 48 |
.PP |
| 49 |
.SS "#define BROTLI_BOOL int" |
| 50 |
|
| 51 |
.PP |
| 52 |
A portable \fCbool\fP replacement\&. \fBBROTLI_BOOL\fP is a 'documentation' type: actually it is \fCint\fP, but in API it denotes a type, whose only values are \fBBROTLI_TRUE\fP and \fBBROTLI_FALSE\fP\&. |
| 53 |
.PP |
| 54 |
\fBBROTLI_BOOL\fP values passed to Brotli should either be \fBBROTLI_TRUE\fP or \fBBROTLI_FALSE\fP, or be a result of \fBTO_BROTLI_BOOL\fP macros\&. |
| 55 |
.PP |
| 56 |
\fBBROTLI_BOOL\fP values returned by Brotli should not be tested for equality with \fCtrue\fP, \fCfalse\fP, \fBBROTLI_TRUE\fP, \fBBROTLI_FALSE\fP, but rather should be evaluated, for example: |
| 57 |
.PP |
| 58 |
.nf |
| 59 |
if (SomeBrotliFunction(encoder, BROTLI_TRUE) && |
| 60 |
!OtherBrotliFunction(decoder, BROTLI_FALSE)) { |
| 61 |
bool x = !!YetAnotherBrotliFunction(encoder, TO_BROLTI_BOOL(2 * 2 == 4)); |
| 62 |
DoSomething(x); |
| 63 |
} |
| 64 |
|
| 65 |
.fi |
| 66 |
.PP |
| 67 |
|
| 68 |
.SS "#define BROTLI_FALSE 0" |
| 69 |
|
| 70 |
.PP |
| 71 |
Portable \fCfalse\fP replacement\&. |
| 72 |
.SS "#define BROTLI_TRUE 1" |
| 73 |
|
| 74 |
.PP |
| 75 |
Portable \fCtrue\fP replacement\&. |
| 76 |
.SS "#define TO_BROTLI_BOOL(X) (!!(X) ? \fBBROTLI_TRUE\fP : \fBBROTLI_FALSE\fP)" |
| 77 |
|
| 78 |
.PP |
| 79 |
\fCbool\fP to \fBBROTLI_BOOL\fP conversion macros\&. |
| 80 |
.SH "Typedef Documentation" |
| 81 |
.PP |
| 82 |
.SS "typedef void*(* brotli_alloc_func) (void *opaque, size_t size)" |
| 83 |
|
| 84 |
.PP |
| 85 |
Allocating function pointer type\&. |
| 86 |
.PP |
| 87 |
\fBParameters:\fP |
| 88 |
.RS 4 |
| 89 |
\fIopaque\fP custom memory manager handle provided by client |
| 90 |
.br |
| 91 |
\fIsize\fP requested memory region size; can not be \fC0\fP |
| 92 |
.RE |
| 93 |
.PP |
| 94 |
\fBReturns:\fP |
| 95 |
.RS 4 |
| 96 |
\fC0\fP in the case of failure |
| 97 |
.PP |
| 98 |
a valid pointer to a memory region of at least \fCsize\fP bytes long otherwise |
| 99 |
.RE |
| 100 |
.PP |
| 101 |
|
| 102 |
.SS "typedef void(* brotli_free_func) (void *opaque, void *address)" |
| 103 |
|
| 104 |
.PP |
| 105 |
Deallocating function pointer type\&. This function \fBSHOULD\fP do nothing if \fCaddress\fP is \fC0\fP\&. |
| 106 |
.PP |
| 107 |
\fBParameters:\fP |
| 108 |
.RS 4 |
| 109 |
\fIopaque\fP custom memory manager handle provided by client |
| 110 |
.br |
| 111 |
\fIaddress\fP memory region pointer returned by \fBbrotli_alloc_func\fP, or \fC0\fP |
| 112 |
.RE |
| 113 |
.PP |
| 114 |
|
| 115 |
.SH "Author" |
| 116 |
.PP |
| 117 |
Generated automatically by Doxygen for Brotli from the source code\&. |