1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
|
diff -rupN re2_orig/re2/compile.cc re2_new/re2/compile.cc
--- re2_orig/re2/compile.cc 2015-06-03 21:01:39.859724500 +0300
+++ re2_new/re2/compile.cc 2015-06-03 21:04:00.834589300 +0300
@@ -7,7 +7,10 @@
// Prog and Inst are defined in prog.h.
// This file's external interface is just Regexp::CompileToProg.
// The Compiler class defined in this file is private.
-
+#ifdef WIN32
+#include <stdio.h>
+#define snprintf _snprintf
+#endif
#include "re2/prog.h"
#include "re2/re2.h"
#include "re2/regexp.h"
@@ -503,7 +506,7 @@ int Compiler::RuneByteSuffix(uint8 lo, u
return UncachedRuneByteSuffix(lo, hi, foldcase, next);
}
- uint64 key = ((uint64)next << 17) | (lo<<9) | (hi<<1) | foldcase;
+ uint64 key = ((uint64)next << 17) | (lo<<9) | (hi<<1) | (foldcase ? 1ULL : 0ULL);
map<uint64, int>::iterator it = rune_cache_.find(key);
if (it != rune_cache_.end())
return it->second;
diff -rupN re2_orig/re2/prefilter_tree.cc re2_new/re2/prefilter_tree.cc
--- re2_orig/re2/prefilter_tree.cc 2015-06-03 21:01:39.941447500 +0300
+++ re2_new/re2/prefilter_tree.cc 2015-06-03 21:04:34.520203500 +0300
@@ -7,6 +7,10 @@
#include "re2/prefilter.h"
#include "re2/prefilter_tree.h"
#include "re2/re2.h"
+#ifdef WIN32
+#include <stdio.h>
+#define snprintf _snprintf
+#endif
DEFINE_int32(filtered_re2_min_atom_len,
3,
diff -rupN re2_orig/re2/re2.cc re2_new/re2/re2.cc
--- re2_orig/re2/re2.cc 2015-06-03 21:01:39.959349200 +0300
+++ re2_new/re2/re2.cc 2015-06-03 21:05:47.173725000 +0300
@@ -11,7 +11,13 @@
#include <stdio.h>
#include <string>
-#include <pthread.h>
+#ifdef WIN32
+#define strtoll _strtoi64
+#define strtoull _strtoui64
+#define strtof strtod
+#else
+ #include <pthread.h>
+#endif
#include <errno.h>
#include "util/atomicops.h"
#include "util/util.h"
@@ -35,7 +41,7 @@ const VariadicFunction2<bool, StringPiec
// This will trigger LNK2005 error in MSVC.
#ifndef COMPILER_MSVC
-const int RE2::Options::kDefaultMaxMem; // initialized in re2.h
+//const int RE2::Options::kDefaultMaxMem; // initialized in re2.h
#endif // COMPILER_MSVC
RE2::Options::Options(RE2::CannedOptions opt)
diff -rupN re2_orig/re2/re2.h re2_new/re2/re2.h
--- re2_orig/re2/re2.h 2015-06-03 21:01:39.963230400 +0300
+++ re2_new/re2/re2.h 2015-06-03 21:06:35.371015500 +0300
@@ -5,6 +5,7 @@
#ifndef RE2_RE2_H
#define RE2_RE2_H
+#define kDefaultMaxMem (8<<20)
// C++ interface to the re2 regular-expression library.
// RE2 supports Perl-style regular expressions (with extensions like
// \d, \w, \s, ...).
@@ -563,7 +564,6 @@ class RE2 {
// If this happens too often, RE2 falls back on the NFA implementation.
// For now, make the default budget something close to Code Search.
- static const int kDefaultMaxMem = 8<<20;
enum Encoding {
EncodingUTF8 = 1,
diff -rupN re2_orig/re2/stringpiece.h re2_new/re2/stringpiece.h
--- re2_orig/re2/stringpiece.h 2015-06-03 21:01:39.999380800 +0300
+++ re2_new/re2/stringpiece.h 2015-06-03 21:07:02.478501800 +0300
@@ -23,6 +23,9 @@
#include <cstddef>
#include <iosfwd>
#include <string>
+#ifdef WIN32
+#include <algorithm>
+#endif
namespace re2 {
diff -rupN re2_orig/util/logging.h re2_new/util/logging.h
--- re2_orig/util/logging.h 2015-06-03 21:01:40.236689900 +0300
+++ re2_new/util/logging.h 2015-06-03 21:07:48.737390800 +0300
@@ -7,7 +7,11 @@
#ifndef RE2_UTIL_LOGGING_H__
#define RE2_UTIL_LOGGING_H__
-#include <unistd.h> /* for write */
+#ifdef WIN32
+ #include <io.h>
+#else
+ #include <unistd.h> /* for write */
+#endif
#include <sstream>
// Debug-only checking.
diff -rupN re2_orig/util/mutex.h re2_new/util/mutex.h
--- re2_orig/util/mutex.h 2015-06-03 21:01:40.240105400 +0300
+++ re2_new/util/mutex.h 2015-06-03 21:08:41.660376900 +0300
@@ -14,7 +14,10 @@
namespace re2 {
-#define HAVE_PTHREAD 1
+#ifndef WIN32
+ #define HAVE_PTHREAD 1
+ #define HAVE_RWLOCK 1
+#endif
#define HAVE_RWLOCK 1
#if defined(NO_THREADS)
diff -rupN re2_orig/util/stringprintf.cc re2_new/util/stringprintf.cc
--- re2_orig/util/stringprintf.cc 2015-06-03 21:01:40.271834700 +0300
+++ re2_new/util/stringprintf.cc 2015-06-03 21:09:07.784384200 +0300
@@ -3,6 +3,9 @@
// license that can be found in the LICENSE file.
#include "util/util.h"
+#ifndef va_copy
+#define va_copy(d,s) ((d) = (s)) //KLUGE: for MS compilers
+#endif
namespace re2 {
diff -rupN re2_orig/util/util.h re2_new/util/util.h
--- re2_orig/util/util.h 2015-06-03 21:01:40.304059500 +0300
+++ re2_new/util/util.h 2015-06-04 14:27:55.625698100 +0300
@@ -64,12 +64,12 @@ using std::unordered_set;
#ifdef WIN32
#define snprintf _snprintf_s
-#define sprintf sprintf_s
+//#define sprintf sprintf_s
#define stricmp _stricmp
#define strtof strtod /* not really correct but best we can do */
#define strtoll _strtoi64
#define strtoull _strtoui64
-#define vsnprintf vsnprintf_s
+//#define vsnprintf vsnprintf_s
#pragma warning(disable: 4018) // signed/unsigned mismatch
#pragma warning(disable: 4244) // possible data loss in int conversion
diff -rupN re2_orig/util/valgrind.h re2_new/util/valgrind.h
--- re2_orig/util/valgrind.h 2015-06-03 21:01:40.315784200 +0300
+++ re2_new/util/valgrind.h 2015-06-03 21:11:07.508240700 +0300
@@ -126,6 +126,7 @@
#endif
+#ifndef WIN32
/* ------------------------------------------------------------------ */
/* ARCHITECTURE SPECIFICS for SPECIAL INSTRUCTIONS. There is nothing */
/* in here of use to end-users -- skip to the next section. */
@@ -4171,6 +4172,7 @@ typedef
_qzz_addr, _qzz_len, 0, 0, 0); \
}
+#endif
/* These requests are for getting Valgrind itself to print something.
Possibly with a backtrace. This is a really ugly hack. The return value
|