15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright 2011 Google Inc. All Rights Reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Author: sesse@google.com (Steinar H. Gunderson) 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Redistribution and use in source and binary forms, with or without 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// modification, are permitted provided that the following conditions are 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// met: 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// * Redistributions of source code must retain the above copyright 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// notice, this list of conditions and the following disclaimer. 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// * Redistributions in binary form must reproduce the above 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// copyright notice, this list of conditions and the following disclaimer 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// in the documentation and/or other materials provided with the 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// distribution. 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// * Neither the name of Google Inc. nor the names of its 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// contributors may be used to endorse or promote products derived from 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// this software without specific prior written permission. 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Various type stubs for the open-source version of Snappy. 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This file cannot include config.h, as it is included from snappy.h, 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// which is a public header. Instead, snappy-stubs-public.h is generated by 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// from snappy-stubs-public.h.in at configure time. 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef UTIL_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_ 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define UTIL_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_ 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if 1 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <stdint.h> 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if 1 445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <stddef.h> 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 47424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)#if 1 48424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)#include <sys/uio.h> 49424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)#endif 50424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define SNAPPY_MAJOR 1 52424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)#define SNAPPY_MINOR 1 53424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)#define SNAPPY_PATCHLEVEL 0 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define SNAPPY_VERSION \ 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ((SNAPPY_MAJOR << 16) | (SNAPPY_MINOR << 8) | SNAPPY_PATCHLEVEL) 565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string> 585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace snappy { 605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if 1 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef int8_t int8; 635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef uint8_t uint8; 645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef int16_t int16; 655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef uint16_t uint16; 665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef int32_t int32; 675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef uint32_t uint32; 685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef int64_t int64; 695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef uint64_t uint64; 705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#else 715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef signed char int8; 725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef unsigned char uint8; 735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef short int16; 745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef unsigned short uint16; 755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef int int32; 765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef unsigned int uint32; 775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef long long int64; 785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef unsigned long long uint64; 795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif 805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef std::string string; 825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ 845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) TypeName(const TypeName&); \ 855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void operator=(const TypeName&) 865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 87424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)#if 0 88424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)// Windows does not have an iovec type, yet the concept is universally useful. 89424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)// It is simple to define it ourselves, so we put it inside our own namespace. 90424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)struct iovec { 91424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) void* iov_base; 92424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) size_t iov_len; 93424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)}; 94424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)#endif 95424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace snappy 975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // UTIL_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_ 99