1
/* Copyright (c) 2007, Google Inc.
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions are
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
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.
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.
31
* Author: Craig Silverstein
33
* These are some portability typedefs and defines to make it a bit
34
* easier to compile this code -- in particular, unittests -- under VC++.
35
* Other portability code is found in windows/google/sparsehash/sparseconfig.h.
37
* Several of these are taken from glib:
38
* http://developer.gnome.org/doc/API/glib/glib-windows-compatability-functions.html
41
#ifndef SPARSEHASH_WINDOWS_PORT_H_
42
#define SPARSEHASH_WINDOWS_PORT_H_
48
#define WIN32_LEAN_AND_MEAN /* We always want minimal includes */
50
#include <io.h> /* because we so often use open/close/etc */
53
// 4996: Yes, we're ok using the "unsafe" functions like _vsnprintf and fopen
54
// 4127: We use "while (1)" sometimes: yes, we know it's a constant
55
#pragma warning(disable:4996 4127)
60
#define access _access
61
#define getcwd _getcwd
67
#define unlink _unlink
69
#define pclose _pclose
71
#define strdup _strdup
73
// We can't just use _snprintf as a drop-in replacement, because it
74
// doesn't always NUL-terminate. :-(
75
extern int snprintf(char *str, size_t size, const char *format, ...);
77
extern std::string TmpFile(const char* basename); // used in hashtable_unittest
81
#endif /* SPARSEHASH_WINDOWS_PORT_H_ */