[8ebc79b] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
---|
| 2 | // Author: [email protected] (Steinar H. Gunderson) |
---|
| 3 | // |
---|
| 4 | // Redistribution and use in source and binary forms, with or without |
---|
| 5 | // modification, are permitted provided that the following conditions are |
---|
| 6 | // met: |
---|
| 7 | // |
---|
| 8 | // * Redistributions of source code must retain the above copyright |
---|
| 9 | // notice, this list of conditions and the following disclaimer. |
---|
| 10 | // * Redistributions in binary form must reproduce the above |
---|
| 11 | // copyright notice, this list of conditions and the following disclaimer |
---|
| 12 | // in the documentation and/or other materials provided with the |
---|
| 13 | // distribution. |
---|
| 14 | // * Neither the name of Google Inc. nor the names of its |
---|
| 15 | // contributors may be used to endorse or promote products derived from |
---|
| 16 | // this software without specific prior written permission. |
---|
| 17 | // |
---|
| 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
| 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
| 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
| 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
---|
| 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
| 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
---|
| 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
---|
| 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
---|
| 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
---|
| 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
---|
| 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 29 | // |
---|
| 30 | // Various type stubs for the open-source version of Snappy. |
---|
| 31 | // |
---|
| 32 | // This file cannot include config.h, as it is included from snappy.h, |
---|
| 33 | // which is a public header. Instead, snappy-stubs-public.h is generated by |
---|
| 34 | // from snappy-stubs-public.h.in at configure time. |
---|
| 35 | |
---|
| 36 | #ifndef UTIL_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_ |
---|
| 37 | #define UTIL_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_ |
---|
| 38 | |
---|
| 39 | // MSVC 2008 does not include stdint.h. This is a workaround by Mark W. |
---|
| 40 | // Please note that this is only defined in the Blosc sources of Snappy. |
---|
| 41 | #if !defined(_MSC_VER) || _MSC_VER >= 1600 |
---|
| 42 | #include <stdint.h> |
---|
| 43 | #else |
---|
| 44 | typedef signed char int8_t; |
---|
| 45 | typedef short int16_t; |
---|
| 46 | typedef int int32_t; |
---|
| 47 | typedef __int64 int64_t; |
---|
| 48 | typedef ptrdiff_t intptr_t; |
---|
| 49 | typedef unsigned char uint8_t; |
---|
| 50 | typedef unsigned short uint16_t; |
---|
| 51 | typedef unsigned int uint32_t; |
---|
| 52 | typedef unsigned __int64 uint64_t; |
---|
| 53 | typedef size_t uintptr_t; |
---|
| 54 | #endif |
---|
| 55 | |
---|
| 56 | #if 1 |
---|
| 57 | #include <stddef.h> |
---|
| 58 | #endif |
---|
| 59 | |
---|
| 60 | #if 0 |
---|
| 61 | #include <sys/uio.h> |
---|
| 62 | #endif |
---|
| 63 | |
---|
| 64 | #define SNAPPY_MAJOR 1 |
---|
| 65 | #define SNAPPY_MINOR 1 |
---|
| 66 | #define SNAPPY_PATCHLEVEL 1 |
---|
| 67 | #define SNAPPY_VERSION \ |
---|
| 68 | ((SNAPPY_MAJOR << 16) | (SNAPPY_MINOR << 8) | SNAPPY_PATCHLEVEL) |
---|
| 69 | |
---|
| 70 | #include <string> |
---|
| 71 | |
---|
| 72 | namespace snappy { |
---|
| 73 | |
---|
| 74 | #if 1 |
---|
| 75 | typedef int8_t int8; |
---|
| 76 | typedef uint8_t uint8; |
---|
| 77 | typedef int16_t int16; |
---|
| 78 | typedef uint16_t uint16; |
---|
| 79 | typedef int32_t int32; |
---|
| 80 | typedef uint32_t uint32; |
---|
| 81 | typedef int64_t int64; |
---|
| 82 | typedef uint64_t uint64; |
---|
| 83 | #else |
---|
| 84 | typedef signed char int8; |
---|
| 85 | typedef unsigned char uint8; |
---|
| 86 | typedef short int16; |
---|
| 87 | typedef unsigned short uint16; |
---|
| 88 | typedef int int32; |
---|
| 89 | typedef unsigned int uint32; |
---|
| 90 | typedef long long int64; |
---|
| 91 | typedef unsigned long long uint64; |
---|
| 92 | #endif |
---|
| 93 | |
---|
| 94 | typedef std::string string; |
---|
| 95 | |
---|
| 96 | #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ |
---|
| 97 | TypeName(const TypeName&); \ |
---|
| 98 | void operator=(const TypeName&) |
---|
| 99 | |
---|
| 100 | #if !0 |
---|
| 101 | // Windows does not have an iovec type, yet the concept is universally useful. |
---|
| 102 | // It is simple to define it ourselves, so we put it inside our own namespace. |
---|
| 103 | struct iovec { |
---|
| 104 | void* iov_base; |
---|
| 105 | size_t iov_len; |
---|
| 106 | }; |
---|
| 107 | #endif |
---|
| 108 | |
---|
| 109 | } // namespace snappy |
---|
| 110 | |
---|
| 111 | #endif // UTIL_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_ |
---|