~alinuxninja/nginx-edge/trunk

« back to all changes in this revision

Viewing changes to debian/modules/ngx_pagespeed/psol/include/third_party/google-sparsehash/src/windows/port.h

  • Committer: Vivian
  • Date: 2015-12-04 18:20:11 UTC
  • Revision ID: git-v1:a36f2bc32e884f7473b3a47040e5411306144d7d
* Do not extract psol.tar.gz

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2007, Google Inc.
2
 
 * All rights reserved.
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
 
 * ---
31
 
 * Author: Craig Silverstein
32
 
 *
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.
36
 
 *
37
 
 * Several of these are taken from glib:
38
 
 *    http://developer.gnome.org/doc/API/glib/glib-windows-compatability-functions.html
39
 
 */
40
 
 
41
 
#ifndef SPARSEHASH_WINDOWS_PORT_H_
42
 
#define SPARSEHASH_WINDOWS_PORT_H_
43
 
 
44
 
#include "config.h"
45
 
 
46
 
#ifdef WIN32
47
 
 
48
 
#define WIN32_LEAN_AND_MEAN  /* We always want minimal includes */
49
 
#include <windows.h>
50
 
#include <io.h>              /* because we so often use open/close/etc */
51
 
#include <string>
52
 
 
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)
56
 
 
57
 
 
58
 
// file I/O
59
 
#define PATH_MAX 1024
60
 
#define access  _access
61
 
#define getcwd  _getcwd
62
 
#define open    _open
63
 
#define read    _read
64
 
#define write   _write
65
 
#define lseek   _lseek
66
 
#define close   _close
67
 
#define unlink  _unlink
68
 
#define popen   _popen
69
 
#define pclose  _pclose
70
 
 
71
 
#define strdup  _strdup
72
 
 
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, ...);
76
 
 
77
 
extern std::string TmpFile(const char* basename); // used in hashtable_unittest
78
 
 
79
 
#endif  /* WIN32 */
80
 
 
81
 
#endif  /* SPARSEHASH_WINDOWS_PORT_H_ */