| OLD | NEW |
| 1 diff --git a/AUTHORS b/AUTHORS | 1 diff --git a/AUTHORS b/AUTHORS |
| 2 index 3c0f928..e17d9bf 100644 | 2 index 3c0f928..e17d9bf 100644 |
| 3 --- a/AUTHORS | 3 --- a/AUTHORS |
| 4 +++ b/AUTHORS | 4 +++ b/AUTHORS |
| 5 @@ -8,5 +8,6 @@ | 5 @@ -8,5 +8,6 @@ |
| 6 | 6 |
| 7 # Please keep the list sorted. | 7 # Please keep the list sorted. |
| 8 | 8 |
| 9 +Brian Gunlogson <unixman83@gmail.com> | 9 +Brian Gunlogson <unixman83@gmail.com> |
| 10 Google Inc. | 10 Google Inc. |
| 11 Stefano Rivera <stefano.rivera@gmail.com> | 11 Stefano Rivera <stefano.rivera@gmail.com> |
| 12 diff --git a/CONTRIBUTORS b/CONTRIBUTORS | 12 diff --git a/CONTRIBUTORS b/CONTRIBUTORS |
| 13 index 7b44e04..7f6a93d 100644 | 13 index 7b44e04..7f6a93d 100644 |
| 14 --- a/CONTRIBUTORS | 14 --- a/CONTRIBUTORS |
| 15 +++ b/CONTRIBUTORS | 15 +++ b/CONTRIBUTORS |
| 16 @@ -26,6 +26,7 @@ | 16 @@ -26,6 +26,7 @@ |
| 17 | 17 |
| 18 # Please keep the list sorted. | 18 # Please keep the list sorted. |
| 19 | 19 |
| 20 +Brian Gunlogson <unixman83@gmail.com> | 20 +Brian Gunlogson <unixman83@gmail.com> |
| 21 Dominic Battré <battre@chromium.org> | 21 Dominic Battré <battre@chromium.org> |
| 22 John Millikin <jmillikin@gmail.com> | 22 John Millikin <jmillikin@gmail.com> |
| 23 Rob Pike <r@google.com> | 23 Rob Pike <r@google.com> |
| 24 diff --git a/mswin/stdint.h b/mswin/stdint.h | |
| 25 new file mode 100644 | |
| 26 index 0000000..d02608a | |
| 27 --- /dev/null | |
| 28 +++ b/mswin/stdint.h | |
| 29 @@ -0,0 +1,247 @@ | |
| 30 +// ISO C9x compliant stdint.h for Microsoft Visual Studio | |
| 31 +// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 | |
| 32 +// | |
| 33 +// Copyright (c) 2006-2008 Alexander Chemeris | |
| 34 +// | |
| 35 +// Redistribution and use in source and binary forms, with or without | |
| 36 +// modification, are permitted provided that the following conditions are met: | |
| 37 +// | |
| 38 +// 1. Redistributions of source code must retain the above copyright notice, | |
| 39 +// this list of conditions and the following disclaimer. | |
| 40 +// | |
| 41 +// 2. Redistributions in binary form must reproduce the above copyright | |
| 42 +// notice, this list of conditions and the following disclaimer in the | |
| 43 +// documentation and/or other materials provided with the distribution. | |
| 44 +// | |
| 45 +// 3. The name of the author may be used to endorse or promote products | |
| 46 +// derived from this software without specific prior written permission. | |
| 47 +// | |
| 48 +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | |
| 49 +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
| 50 +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | |
| 51 +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 52 +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 53 +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 54 +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 55 +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 56 +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 57 +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 58 +// | |
| 59 +/////////////////////////////////////////////////////////////////////////////// | |
| 60 + | |
| 61 +#ifndef _MSC_VER // [ | |
| 62 +#error "Use this header only with Microsoft Visual C++ compilers!" | |
| 63 +#endif // _MSC_VER ] | |
| 64 + | |
| 65 +#ifndef _MSC_STDINT_H_ // [ | |
| 66 +#define _MSC_STDINT_H_ | |
| 67 + | |
| 68 +#if _MSC_VER > 1000 | |
| 69 +#pragma once | |
| 70 +#endif | |
| 71 + | |
| 72 +#include <limits.h> | |
| 73 + | |
| 74 +// For Visual Studio 6 in C++ mode and for many Visual Studio versions when | |
| 75 +// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}' | |
| 76 +// or compiler give many errors like this: | |
| 77 +// error C2733: second C linkage of overloaded function 'wmemchr' not allowed | |
| 78 +#ifdef __cplusplus | |
| 79 +extern "C" { | |
| 80 +#endif | |
| 81 +# include <wchar.h> | |
| 82 +#ifdef __cplusplus | |
| 83 +} | |
| 84 +#endif | |
| 85 + | |
| 86 +// Define _W64 macros to mark types changing their size, like intptr_t. | |
| 87 +#ifndef _W64 | |
| 88 +# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1
300 | |
| 89 +# define _W64 __w64 | |
| 90 +# else | |
| 91 +# define _W64 | |
| 92 +# endif | |
| 93 +#endif | |
| 94 + | |
| 95 + | |
| 96 +// 7.18.1 Integer types | |
| 97 + | |
| 98 +// 7.18.1.1 Exact-width integer types | |
| 99 + | |
| 100 +// Visual Studio 6 and Embedded Visual C++ 4 doesn't | |
| 101 +// realize that, e.g. char has the same size as __int8 | |
| 102 +// so we give up on __intX for them. | |
| 103 +#if (_MSC_VER < 1300) | |
| 104 + typedef signed char int8_t; | |
| 105 + typedef signed short int16_t; | |
| 106 + typedef signed int int32_t; | |
| 107 + typedef unsigned char uint8_t; | |
| 108 + typedef unsigned short uint16_t; | |
| 109 + typedef unsigned int uint32_t; | |
| 110 +#else | |
| 111 + typedef signed __int8 int8_t; | |
| 112 + typedef signed __int16 int16_t; | |
| 113 + typedef signed __int32 int32_t; | |
| 114 + typedef unsigned __int8 uint8_t; | |
| 115 + typedef unsigned __int16 uint16_t; | |
| 116 + typedef unsigned __int32 uint32_t; | |
| 117 +#endif | |
| 118 +typedef signed __int64 int64_t; | |
| 119 +typedef unsigned __int64 uint64_t; | |
| 120 + | |
| 121 + | |
| 122 +// 7.18.1.2 Minimum-width integer types | |
| 123 +typedef int8_t int_least8_t; | |
| 124 +typedef int16_t int_least16_t; | |
| 125 +typedef int32_t int_least32_t; | |
| 126 +typedef int64_t int_least64_t; | |
| 127 +typedef uint8_t uint_least8_t; | |
| 128 +typedef uint16_t uint_least16_t; | |
| 129 +typedef uint32_t uint_least32_t; | |
| 130 +typedef uint64_t uint_least64_t; | |
| 131 + | |
| 132 +// 7.18.1.3 Fastest minimum-width integer types | |
| 133 +typedef int8_t int_fast8_t; | |
| 134 +typedef int16_t int_fast16_t; | |
| 135 +typedef int32_t int_fast32_t; | |
| 136 +typedef int64_t int_fast64_t; | |
| 137 +typedef uint8_t uint_fast8_t; | |
| 138 +typedef uint16_t uint_fast16_t; | |
| 139 +typedef uint32_t uint_fast32_t; | |
| 140 +typedef uint64_t uint_fast64_t; | |
| 141 + | |
| 142 +// 7.18.1.4 Integer types capable of holding object pointers | |
| 143 +#ifdef _WIN64 // [ | |
| 144 + typedef signed __int64 intptr_t; | |
| 145 + typedef unsigned __int64 uintptr_t; | |
| 146 +#else // _WIN64 ][ | |
| 147 + typedef _W64 signed int intptr_t; | |
| 148 + typedef _W64 unsigned int uintptr_t; | |
| 149 +#endif // _WIN64 ] | |
| 150 + | |
| 151 +// 7.18.1.5 Greatest-width integer types | |
| 152 +typedef int64_t intmax_t; | |
| 153 +typedef uint64_t uintmax_t; | |
| 154 + | |
| 155 + | |
| 156 +// 7.18.2 Limits of specified-width integer types | |
| 157 + | |
| 158 +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 2
20 at page 257 and footnote 221 at page 259 | |
| 159 + | |
| 160 +// 7.18.2.1 Limits of exact-width integer types | |
| 161 +#define INT8_MIN ((int8_t)_I8_MIN) | |
| 162 +#define INT8_MAX _I8_MAX | |
| 163 +#define INT16_MIN ((int16_t)_I16_MIN) | |
| 164 +#define INT16_MAX _I16_MAX | |
| 165 +#define INT32_MIN ((int32_t)_I32_MIN) | |
| 166 +#define INT32_MAX _I32_MAX | |
| 167 +#define INT64_MIN ((int64_t)_I64_MIN) | |
| 168 +#define INT64_MAX _I64_MAX | |
| 169 +#define UINT8_MAX _UI8_MAX | |
| 170 +#define UINT16_MAX _UI16_MAX | |
| 171 +#define UINT32_MAX _UI32_MAX | |
| 172 +#define UINT64_MAX _UI64_MAX | |
| 173 + | |
| 174 +// 7.18.2.2 Limits of minimum-width integer types | |
| 175 +#define INT_LEAST8_MIN INT8_MIN | |
| 176 +#define INT_LEAST8_MAX INT8_MAX | |
| 177 +#define INT_LEAST16_MIN INT16_MIN | |
| 178 +#define INT_LEAST16_MAX INT16_MAX | |
| 179 +#define INT_LEAST32_MIN INT32_MIN | |
| 180 +#define INT_LEAST32_MAX INT32_MAX | |
| 181 +#define INT_LEAST64_MIN INT64_MIN | |
| 182 +#define INT_LEAST64_MAX INT64_MAX | |
| 183 +#define UINT_LEAST8_MAX UINT8_MAX | |
| 184 +#define UINT_LEAST16_MAX UINT16_MAX | |
| 185 +#define UINT_LEAST32_MAX UINT32_MAX | |
| 186 +#define UINT_LEAST64_MAX UINT64_MAX | |
| 187 + | |
| 188 +// 7.18.2.3 Limits of fastest minimum-width integer types | |
| 189 +#define INT_FAST8_MIN INT8_MIN | |
| 190 +#define INT_FAST8_MAX INT8_MAX | |
| 191 +#define INT_FAST16_MIN INT16_MIN | |
| 192 +#define INT_FAST16_MAX INT16_MAX | |
| 193 +#define INT_FAST32_MIN INT32_MIN | |
| 194 +#define INT_FAST32_MAX INT32_MAX | |
| 195 +#define INT_FAST64_MIN INT64_MIN | |
| 196 +#define INT_FAST64_MAX INT64_MAX | |
| 197 +#define UINT_FAST8_MAX UINT8_MAX | |
| 198 +#define UINT_FAST16_MAX UINT16_MAX | |
| 199 +#define UINT_FAST32_MAX UINT32_MAX | |
| 200 +#define UINT_FAST64_MAX UINT64_MAX | |
| 201 + | |
| 202 +// 7.18.2.4 Limits of integer types capable of holding object pointers | |
| 203 +#ifdef _WIN64 // [ | |
| 204 +# define INTPTR_MIN INT64_MIN | |
| 205 +# define INTPTR_MAX INT64_MAX | |
| 206 +# define UINTPTR_MAX UINT64_MAX | |
| 207 +#else // _WIN64 ][ | |
| 208 +# define INTPTR_MIN INT32_MIN | |
| 209 +# define INTPTR_MAX INT32_MAX | |
| 210 +# define UINTPTR_MAX UINT32_MAX | |
| 211 +#endif // _WIN64 ] | |
| 212 + | |
| 213 +// 7.18.2.5 Limits of greatest-width integer types | |
| 214 +#define INTMAX_MIN INT64_MIN | |
| 215 +#define INTMAX_MAX INT64_MAX | |
| 216 +#define UINTMAX_MAX UINT64_MAX | |
| 217 + | |
| 218 +// 7.18.3 Limits of other integer types | |
| 219 + | |
| 220 +#ifdef _WIN64 // [ | |
| 221 +# define PTRDIFF_MIN _I64_MIN | |
| 222 +# define PTRDIFF_MAX _I64_MAX | |
| 223 +#else // _WIN64 ][ | |
| 224 +# define PTRDIFF_MIN _I32_MIN | |
| 225 +# define PTRDIFF_MAX _I32_MAX | |
| 226 +#endif // _WIN64 ] | |
| 227 + | |
| 228 +#define SIG_ATOMIC_MIN INT_MIN | |
| 229 +#define SIG_ATOMIC_MAX INT_MAX | |
| 230 + | |
| 231 +#ifndef SIZE_MAX // [ | |
| 232 +# ifdef _WIN64 // [ | |
| 233 +# define SIZE_MAX _UI64_MAX | |
| 234 +# else // _WIN64 ][ | |
| 235 +# define SIZE_MAX _UI32_MAX | |
| 236 +# endif // _WIN64 ] | |
| 237 +#endif // SIZE_MAX ] | |
| 238 + | |
| 239 +// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h> | |
| 240 +#ifndef WCHAR_MIN // [ | |
| 241 +# define WCHAR_MIN 0 | |
| 242 +#endif // WCHAR_MIN ] | |
| 243 +#ifndef WCHAR_MAX // [ | |
| 244 +# define WCHAR_MAX _UI16_MAX | |
| 245 +#endif // WCHAR_MAX ] | |
| 246 + | |
| 247 +#define WINT_MIN 0 | |
| 248 +#define WINT_MAX _UI16_MAX | |
| 249 + | |
| 250 +#endif // __STDC_LIMIT_MACROS ] | |
| 251 + | |
| 252 + | |
| 253 +// 7.18.4 Limits of other integer types | |
| 254 + | |
| 255 +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnot
e 224 at page 260 | |
| 256 + | |
| 257 +// 7.18.4.1 Macros for minimum-width integer constants | |
| 258 + | |
| 259 +#define INT8_C(val) val##i8 | |
| 260 +#define INT16_C(val) val##i16 | |
| 261 +#define INT32_C(val) val##i32 | |
| 262 +#define INT64_C(val) val##i64 | |
| 263 + | |
| 264 +#define UINT8_C(val) val##ui8 | |
| 265 +#define UINT16_C(val) val##ui16 | |
| 266 +#define UINT32_C(val) val##ui32 | |
| 267 +#define UINT64_C(val) val##ui64 | |
| 268 + | |
| 269 +// 7.18.4.2 Macros for greatest-width integer constants | |
| 270 +#define INTMAX_C INT64_C | |
| 271 +#define UINTMAX_C UINT64_C | |
| 272 + | |
| 273 +#endif // __STDC_CONSTANT_MACROS ] | |
| 274 + | |
| 275 + | |
| 276 +#endif // _MSC_STDINT_H_ ] | |
| 277 diff --git a/re2/compile.cc b/re2/compile.cc | 24 diff --git a/re2/compile.cc b/re2/compile.cc |
| 278 index 9cddb71..adb45fd 100644 | 25 index 9cddb71..adb45fd 100644 |
| 279 --- a/re2/compile.cc | 26 --- a/re2/compile.cc |
| 280 +++ b/re2/compile.cc | 27 +++ b/re2/compile.cc |
| 281 @@ -502,7 +502,7 @@ int Compiler::RuneByteSuffix(uint8 lo, uint8 hi, bool foldca
se, int next) { | 28 @@ -502,7 +502,7 @@ int Compiler::RuneByteSuffix(uint8 lo, uint8 hi, bool foldca
se, int next) { |
| 282 return UncachedRuneByteSuffix(lo, hi, foldcase, next); | 29 return UncachedRuneByteSuffix(lo, hi, foldcase, next); |
| 283 } | 30 } |
| 284 | 31 |
| 285 - uint64 key = ((uint64)next << 17) | (lo<<9) | (hi<<1) | foldcase; | 32 - uint64 key = ((uint64)next << 17) | (lo<<9) | (hi<<1) | foldcase; |
| 286 + uint64 key = ((uint64)next << 17) | (lo<<9) | (hi<<1) | (foldcase ? 1ULL : 0U
LL); | 33 + uint64 key = ((uint64)next << 17) | (lo<<9) | (hi<<1) | (foldcase ? 1ULL : 0U
LL); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 #define pcre_exec(a, b, c, d, e, f, g, h) ({ (void)(a); (void)(b); (void)(c); (
void)(d); (void)(e); (void)(f); (void)(g); (void)(h); 0; }) | 260 #define pcre_exec(a, b, c, d, e, f, g, h) ({ (void)(a); (void)(b); (void)(c); (
void)(d); (void)(e); (void)(f); (void)(g); (void)(h); 0; }) |
| 514 #define pcre_fullinfo(a, b, c, d) ({ (void)(a); (void)(b); (void)(c); *(d) = 0;
0; }) | 261 #define pcre_fullinfo(a, b, c, d) ({ (void)(a); (void)(b); (void)(c); *(d) = 0;
0; }) |
| 515 +#else | 262 +#else |
| 516 +#define pcre_compile(a,b,c,d,e) NULL | 263 +#define pcre_compile(a,b,c,d,e) NULL |
| 517 +#define pcre_exec(a, b, c, d, e, f, g, h) NULL | 264 +#define pcre_exec(a, b, c, d, e, f, g, h) NULL |
| 518 +#define pcre_fullinfo(a, b, c, d) NULL | 265 +#define pcre_fullinfo(a, b, c, d) NULL |
| 519 +#endif | 266 +#endif |
| 520 } // namespace re2 | 267 } // namespace re2 |
| 521 #endif | 268 #endif |
| 522 | 269 |
| 523 diff --git a/util/stringprintf.cc b/util/stringprintf.cc | |
| 524 index c908181..d4691d1 100644 | |
| 525 --- a/util/stringprintf.cc | |
| 526 +++ b/util/stringprintf.cc | |
| 527 @@ -4,6 +4,10 @@ | |
| 528 | |
| 529 #include "util/util.h" | |
| 530 | |
| 531 +#ifndef va_copy | |
| 532 +#define va_copy(d,s) ((d) = (s)) //KLUGE: for MS compilers | |
| 533 +#endif | |
| 534 + | |
| 535 namespace re2 { | |
| 536 | |
| 537 static void StringAppendV(string* dst, const char* format, va_list ap) { | |
| 538 diff --git a/util/test.cc b/util/test.cc | 270 diff --git a/util/test.cc b/util/test.cc |
| 539 index 0644829..2fe1bfa 100644 | 271 index 0644829..2fe1bfa 100644 |
| 540 --- a/util/test.cc | 272 --- a/util/test.cc |
| 541 +++ b/util/test.cc | 273 +++ b/util/test.cc |
| 542 @@ -3,7 +3,9 @@ | 274 @@ -3,7 +3,9 @@ |
| 543 // license that can be found in the LICENSE file. | 275 // license that can be found in the LICENSE file. |
| 544 | 276 |
| 545 #include <stdio.h> | 277 #include <stdio.h> |
| 546 +#ifndef WIN32 | 278 +#ifndef WIN32 |
| 547 #include <sys/resource.h> | 279 #include <sys/resource.h> |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 /* */ | 335 /* */ |
| 604 @@ -4170,7 +4171,7 @@ typedef | 336 @@ -4170,7 +4171,7 @@ typedef |
| 605 VG_USERREQ__DISCARD_TRANSLATIONS, \ | 337 VG_USERREQ__DISCARD_TRANSLATIONS, \ |
| 606 _qzz_addr, _qzz_len, 0, 0, 0); \ | 338 _qzz_addr, _qzz_len, 0, 0, 0); \ |
| 607 } | 339 } |
| 608 - | 340 - |
| 609 +#endif | 341 +#endif |
| 610 | 342 |
| 611 /* These requests are for getting Valgrind itself to print something. | 343 /* These requests are for getting Valgrind itself to print something. |
| 612 Possibly with a backtrace. This is a really ugly hack. The return value | 344 Possibly with a backtrace. This is a really ugly hack. The return value |
| OLD | NEW |