Merge pull request #2959 from groni/master

qt5-webengine change actions.py and delete patches
This commit is contained in:
groni
2017-02-24 00:37:00 +01:00
committed by GitHub
6 changed files with 1145 additions and 6 deletions
+5 -3
View File
@@ -11,10 +11,12 @@ from pisi.actionsapi import qt5
from pisi.actionsapi import get
def setup():
shelltools.export("QT5LINK", "/usr/lib/qt5/bin")
shelltools.export("QT5DIR", "/usr/lib/qt5")
shelltools.export("CFLAGS", "%s -I/usr/lib/sqlite3.16.2" % get.CFLAGS())
#shelltools.export("QT5LINK", "/usr/lib/qt5/bin")
#shelltools.export("QT5DIR", "/usr/lib/qt5")
#shelltools.export("CFLAGS", "%s -I/usr/lib/sqlite3.16.2" % get.CFLAGS())
shelltools.system("qmake-qt5 WEBENGINE_CONFIG+=use_proprietary_codecs WEBENGINE_CONFIG+=use_system_icu WEBENGINE_CONFIG+=use_system_ffmpeg qtwebengine.pro")
#pisitools.ldflags.add("-Wl,--no-keep-memory ")
qt5.configure()
def build():
qt5.make()
@@ -0,0 +1,55 @@
From e70b59112104b72e794c20f7c715482809780d32 Mon Sep 17 00:00:00 2001
From: Michal Klocek <michal.klocek@theqtcompany.com>
Date: Thu, 20 Oct 2016 13:09:01 +0200
Subject: [PATCH] Add out of source builds for ninja bootstrap
Instead of coping the src ninja files to shadow dir,
do out of source build.
Change-Id: I00c577e5def66c0415681deab63b7c7947a39200
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
---
tools/qmake/mkspecs/features/functions.prf | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)
diff --git a/tools/qmake/mkspecs/features/functions.prf b/tools/qmake/mkspecs/features/functions.prf
index 94aa617..3741529 100644
--- a/tools/qmake/mkspecs/features/functions.prf
+++ b/tools/qmake/mkspecs/features/functions.prf
@@ -264,28 +264,17 @@ defineReplace(findOrBuildNinja) {
!exists($$out) {
src_3rd_party_dir = $$absolute_path("$${getChromiumSrcDir()}/../", "$$QTWEBENGINE_ROOT")
- out = $$shadowed($$absolute_path("ninja/ninja", "$$src_3rd_party_dir"))
+ out = $$shadowed($$absolute_path(ninja/ninja, $$src_3rd_party_dir))
win32: out = $${out}.exe
- out = $$system_path($$out)
# If we did not find ninja, then we bootstrap it.
!exists($$out) {
- # If we are making a shadow build, copy the ninja sources to the build directory.
- !equals(PWD, $${OUT_PWD}) {
- log("Build directory is different from source directory - copying ninja sources to the build tree...")
- shadow_3rd_party_path = $$system_path($$shadowed($$src_3rd_party_dir))
-
- !exists($$dirname(out)): mkpath($$dirname(out))
- copy_dir_files {
- system("$$QMAKE_COPY_DIR $$system_quote($$system_path($$absolute_path("ninja", "$$src_3rd_party_dir"))) $$system_quote($$dirname(out))")
- } else {
- system("$$QMAKE_COPY_DIR $$system_quote($$system_path($$absolute_path("ninja", "$$src_3rd_party_dir"))) $$system_quote($$shadow_3rd_party_path)")
- }
- }
- system("cd $$system_quote($$dirname(out)) && python configure.py --bootstrap")
+ mkpath($$dirname(out))
+ ninja_configure = $$absolute_path(ninja/configure.py, $$src_3rd_party_dir)
+ system("cd $$system_quote($$system_path($$dirname(out))) && python $$system_quote($$system_path($$ninja_configure)) --bootstrap")
}
}
- return($$out)
+ return($$system_path($$out))
}
defineTest(skipBuild) {
--
2.7.4
@@ -0,0 +1,40 @@
From e3941dcdfcea6838243fa6cfdff2433867e502d6 Mon Sep 17 00:00:00 2001
From: Allan Sandfeld Jensen <allan.jensen@qt.io>
Date: Thu, 1 Dec 2016 11:11:10 +0100
Subject: [PATCH] Update Chromium
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Change-Id: I1c046e16722e0e2dadb431ff0d3f5b7f69edd86f
Reviewed-by: Michael Brüning <michael.bruning@qt.io>
---
dist/changes-5.8.0 | 4 ++++
src/3rdparty | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/dist/changes-5.8.0 b/dist/changes-5.8.0
index abead3c..292e52c 100644
--- a/dist/changes-5.8.0
+++ b/dist/changes-5.8.0
@@ -29,6 +29,10 @@ information about a particular change.
- Chromium Snapshot:
* The Chromium version has been updated to 53.0.2785.148.
+ * Security fixes from Chromium up to version 54.0.2840.101
+ Including: CVE-2016-5181, CVE-2016-5182, CVE-2016-5183, CVE-2016-5185,
+ CVE-2016-5186, CVE-2016-5187, CVE-2016-5189, CVE-2016-5192,
+ CVE-2016-5199, CVE-2016-5201.
- General:
* Spellchecking support has been introduced.
diff --git a/src/3rdparty b/src/3rdparty
index 93b3786..52e8806 160000
--- a/src/3rdparty
+++ b/src/3rdparty
@@ -1 +1 @@
-Subproject commit 93b3786290ac16c95f15c95e2c2f3d8254171ab6
+Subproject commit 52e8806fb0b4e441603dd5885ab80447cfc66a63
--
2.7.4
@@ -0,0 +1,55 @@
From c845b8438b65e6735c8beb0927ad0527cb1b0611 Mon Sep 17 00:00:00 2001
From: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Date: Fri, 7 Mar 2014 14:44:03 +0100
Subject: [PATCH] Do not use the system ninja
Always bootstrap and use the bundled ninja to avoid incompatibilities
between our bundled gyp and the system ninja, which might be quite
old.
This patch also removes the ninja location caching, as updating the
cache would trigger a re-run of qmake and gyp on all the project,
while the benefit of using the cache in this case are low.
Change-Id: I843cbe20e1153caecbda00ab3d45a34d560b2423
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Reviewed-by: Zoltan Arvai <zarvai@inf.u-szeged.hu>
---
tools/qmake/mkspecs/features/functions.prf | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/tools/qmake/mkspecs/features/functions.prf b/tools/qmake/mkspecs/features/functions.prf
index 0814e8b..4dcd8ed 100644
--- a/tools/qmake/mkspecs/features/functions.prf
+++ b/tools/qmake/mkspecs/features/functions.prf
@@ -84,23 +84,16 @@ defineReplace(which) {
}
defineReplace(findOrBuildNinja) {
- !isEmpty(CACHED_NINJA_EXECUTABLE):exists($$CACHED_NINJA_EXECUTABLE): return($$CACHED_NINJA_EXECUTABLE)
- out = $$which(ninja)
- # Try to be smart about it if we know where the chromium sources are located
- !exists($$out) {
git_chromium_src_dir = $$system("git config qtwebengine.chromiumsrcdir")
# Fall back to the snapshot path if git does not know about chromium sources (i.e. init-repository.py has not been used)
isEmpty(git_chromium_src_dir): git_chromium_src_dir = "src/3rdparty/chromium"
- win32: out = $$system_path($$absolute_path("$$git_chromium_src_dir/../ninja/ninja.exe", "$$QTWEBENGINE_ROOT"))
- else: out = $$absolute_path("$$git_chromium_src_dir/../ninja/ninja", "$$QTWEBENGINE_ROOT")
- # If we still did not find ninja, then we bootstrap it.
+
+ out = $$absolute_path("$$git_chromium_src_dir/../ninja/ninja", "$$QTWEBENGINE_ROOT")
+ win32: out = $$system_path($${out}.exe)
+
+ # If we did not find ninja, then we bootstrap it.
!exists($$out) {
- message("bootstrapping ninja...")
- ninjadir = $$dirname(out)
- system("python $$ninjadir/bootstrap.py")
+ system("python $$dirname(out)/bootstrap.py")
}
- }
- message("using $$out")
- cache(CACHED_NINJA_EXECUTABLE, set, out)
- return($$out)
+ return($$out)
}
@@ -0,0 +1,985 @@
--- a/src/3rdparty/chromium/third_party/re2/src/re2/re2.h
+++ b/src/3rdparty/chromium/third_party/re2/src/re2/re2.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-#ifndef RE2_RE2_H
-#define RE2_RE2_H
+#ifndef RE2_RE2_H_
+#define RE2_RE2_H_
// C++ interface to the re2 regular-expression library.
// RE2 supports Perl-style regular expressions (with extensions like
@@ -179,38 +179,25 @@
// RE2::Octal(&a), RE2::Hex(&b), RE2::CRadix(&c), RE2::CRadix(&d));
// will leave 64 in a, b, c, and d.
+#include <stddef.h>
#include <stdint.h>
+#include <sys/types.h>
+#include <algorithm>
#include <map>
+#include <mutex>
#include <string>
-#include "re2/stringpiece.h"
-#include "re2/variadic_function.h"
-#ifndef RE2_HAVE_LONGLONG
-#define RE2_HAVE_LONGLONG 1
-#endif
+#include "re2/stringpiece.h"
namespace re2 {
-
-using std::string;
-using std::map;
-class Mutex;
class Prog;
class Regexp;
+} // namespace re2
+
+namespace re2 {
-// The following enum should be used only as a constructor argument to indicate
-// that the variable has static storage class, and that the constructor should
-// do nothing to its state. It indicates to the reader that it is legal to
-// declare a static instance of the class, provided the constructor is given
-// the LINKER_INITIALIZED argument. Normally, it is unsafe to declare a
-// static variable that has a constructor or a destructor because invocation
-// order is undefined. However, IF the type can be initialized by filling with
-// zeroes (which the loader does for static variables), AND the type's
-// destructor does nothing to the storage, then a constructor for static
-// initialization can be declared as
-// explicit MyClass(LinkerInitialized x) {}
-// and invoked as
-// static MyClass my_variable_name(LINKER_INITIALIZED);
-enum LinkerInitialized { LINKER_INITIALIZED };
+// TODO(junyer): Get rid of this.
+using std::string;
// Interface for regular expression matching. Also corresponds to a
// pre-compiled regular expression. An "RE2" object is safe for
@@ -266,7 +253,7 @@ class RE2 {
RE2(const string& pattern);
#endif
RE2(const StringPiece& pattern);
- RE2(const StringPiece& pattern, const Options& option);
+ RE2(const StringPiece& pattern, const Options& options);
~RE2();
// Returns whether RE2 was created properly.
@@ -296,7 +283,7 @@ class RE2 {
// EXPERIMENTAL! SUBJECT TO CHANGE!
// Outputs the program fanout as a histogram bucketed by powers of 2.
// Returns the number of the largest non-empty bucket.
- int ProgramFanout(map<int, int>* histogram) const;
+ int ProgramFanout(std::map<int, int>* histogram) const;
// Returns the underlying Regexp; not for general use.
// Returns entire_regexp_ so that callers don't need
@@ -305,21 +292,21 @@ class RE2 {
/***** The useful part: the matching interface *****/
- // Matches "text" against "pattern". If pointer arguments are
+ // Matches "text" against "re". If pointer arguments are
// supplied, copies matched sub-patterns into them.
//
// You can pass in a "const char*" or a "string" for "text".
- // You can pass in a "const char*" or a "string" or a "RE2" for "pattern".
+ // You can pass in a "const char*" or a "string" or a "RE2" for "re".
//
// The provided pointer arguments can be pointers to any scalar numeric
// type, or one of:
// string (matched piece is copied to string)
// StringPiece (StringPiece is mutated to point to matched piece)
- // T (where "bool T::ParseFrom(const char*, int)" exists)
+ // T (where "bool T::ParseFrom(const char*, size_t)" exists)
// (void*)NULL (the corresponding matched sub-pattern is not copied)
//
// Returns true iff all of the following conditions are satisfied:
- // a. "text" matches "pattern" exactly
+ // a. "text" matches "re" exactly
// b. The number of matched sub-patterns is >= number of supplied pointers
// c. The "i"th argument has a suitable type for holding the
// string captured as the "i"th sub-pattern. If you pass in
@@ -335,32 +322,65 @@ class RE2 {
// RE2::FullMatch("abc", "[a-z]+(\\d+)?", &number);
static bool FullMatchN(const StringPiece& text, const RE2& re,
const Arg* const args[], int argc);
- static const VariadicFunction2<
- bool, const StringPiece&, const RE2&, Arg, RE2::FullMatchN> FullMatch;
- // Exactly like FullMatch(), except that "pattern" is allowed to match
+ // Exactly like FullMatch(), except that "re" is allowed to match
// a substring of "text".
- static bool PartialMatchN(const StringPiece& text, const RE2& re, // 3..16 args
+ static bool PartialMatchN(const StringPiece& text, const RE2& re,
const Arg* const args[], int argc);
- static const VariadicFunction2<
- bool, const StringPiece&, const RE2&, Arg, RE2::PartialMatchN> PartialMatch;
- // Like FullMatch() and PartialMatch(), except that pattern has to
- // match a prefix of "text", and "input" is advanced past the matched
+ // Like FullMatch() and PartialMatch(), except that "re" has to match
+ // a prefix of the text, and "input" is advanced past the matched
// text. Note: "input" is modified iff this routine returns true.
- static bool ConsumeN(StringPiece* input, const RE2& pattern, // 3..16 args
+ static bool ConsumeN(StringPiece* input, const RE2& re,
const Arg* const args[], int argc);
- static const VariadicFunction2<
- bool, StringPiece*, const RE2&, Arg, RE2::ConsumeN> Consume;
- // Like Consume(..), but does not anchor the match at the beginning of the
- // string. That is, "pattern" need not start its match at the beginning of
- // "input". For example, "FindAndConsume(s, "(\\w+)", &word)" finds the next
- // word in "s" and stores it in "word".
- static bool FindAndConsumeN(StringPiece* input, const RE2& pattern,
- const Arg* const args[], int argc);
- static const VariadicFunction2<
- bool, StringPiece*, const RE2&, Arg, RE2::FindAndConsumeN> FindAndConsume;
+ // Like Consume(), but does not anchor the match at the beginning of
+ // the text. That is, "re" need not start its match at the beginning
+ // of "input". For example, "FindAndConsume(s, "(\\w+)", &word)" finds
+ // the next word in "s" and stores it in "word".
+ static bool FindAndConsumeN(StringPiece* input, const RE2& re,
+ const Arg* const args[], int argc);
+
+#ifndef SWIG
+ private:
+ template <typename F, typename SP>
+ static inline bool Apply(F f, SP sp, const RE2& re) {
+ return f(sp, re, NULL, 0);
+ }
+
+ template <typename F, typename SP, typename... A>
+ static inline bool Apply(F f, SP sp, const RE2& re, const A&... a) {
+ const Arg* const args[] = {&a...};
+ const int argc = sizeof...(a);
+ return f(sp, re, args, argc);
+ }
+
+ public:
+ // In order to allow FullMatch() et al. to be called with a varying number
+ // of arguments of varying types, we use two layers of variadic templates.
+ // The first layer constructs the temporary Arg objects. The second layer
+ // (above) constructs the array of pointers to the temporary Arg objects.
+
+ template <typename... A>
+ static bool FullMatch(const StringPiece& text, const RE2& re, A&&... a) {
+ return Apply(FullMatchN, text, re, Arg(std::forward<A>(a))...);
+ }
+
+ template <typename... A>
+ static bool PartialMatch(const StringPiece& text, const RE2& re, A&&... a) {
+ return Apply(PartialMatchN, text, re, Arg(std::forward<A>(a))...);
+ }
+
+ template <typename... A>
+ static bool Consume(StringPiece* input, const RE2& re, A&&... a) {
+ return Apply(ConsumeN, input, re, Arg(std::forward<A>(a))...);
+ }
+
+ template <typename... A>
+ static bool FindAndConsume(StringPiece* input, const RE2& re, A&&... a) {
+ return Apply(FindAndConsumeN, input, re, Arg(std::forward<A>(a))...);
+ }
+#endif
// Replace the first match of "pattern" in "str" with "rewrite".
// Within "rewrite", backslash-escaped digits (\1 to \9) can be
@@ -451,12 +471,12 @@ class RE2 {
// The map records the index of the leftmost group
// with the given name.
// Only valid until the re is deleted.
- const map<string, int>& NamedCapturingGroups() const;
+ const std::map<string, int>& NamedCapturingGroups() const;
// Return a map from capturing indices to names.
// The map has no entries for unnamed groups.
// Only valid until the re is deleted.
- const map<int, string>& CapturingGroupNames() const;
+ const std::map<int, string>& CapturingGroupNames() const;
// General matching routine.
// Match against text starting at offset startpos
@@ -465,8 +485,8 @@ class RE2 {
// On a successful match, fills in match[] (up to nmatch entries)
// with information about submatches.
// I.e. matching RE2("(foo)|(bar)baz") on "barbazbla" will return true,
- // setting match[0] = "barbaz", match[1] = NULL, match[2] = "bar",
- // match[3] = NULL, ..., up to match[nmatch-1] = NULL.
+ // setting match[0] = "barbaz", match[1].data() = NULL, match[2] = "bar",
+ // match[3].data() = NULL, ..., up to match[nmatch-1].data() = NULL.
//
// Don't ask for more match information than you will use:
// runs much faster with nmatch == 1 than nmatch > 1, and
@@ -477,10 +497,10 @@ class RE2 {
// Passing text == StringPiece(NULL, 0) will be handled like any other
// empty string, but note that on return, it will not be possible to tell
// whether submatch i matched the empty string or did not match:
- // either way, match[i] == NULL.
+ // either way, match[i].data() == NULL.
bool Match(const StringPiece& text,
- int startpos,
- int endpos,
+ size_t startpos,
+ size_t endpos,
Anchor anchor,
StringPiece *match,
int nmatch) const;
@@ -638,19 +658,7 @@ class RE2 {
void set_one_line(bool b) { one_line_ = b; }
void Copy(const Options& src) {
- encoding_ = src.encoding_;
- posix_syntax_ = src.posix_syntax_;
- longest_match_ = src.longest_match_;
- log_errors_ = src.log_errors_;
- max_mem_ = src.max_mem_;
- literal_ = src.literal_;
- never_nl_ = src.never_nl_;
- dot_nl_ = src.dot_nl_;
- never_capture_ = src.never_capture_;
- case_sensitive_ = src.case_sensitive_;
- perl_classes_ = src.perl_classes_;
- word_boundary_ = src.word_boundary_;
- one_line_ = src.one_line_;
+ *this = src;
}
int ParseFlags() const;
@@ -669,10 +677,6 @@ class RE2 {
bool perl_classes_;
bool word_boundary_;
bool one_line_;
-
- //DISALLOW_COPY_AND_ASSIGN(Options);
- Options(const Options&);
- void operator=(const Options&);
};
// Returns the options set in the constructor.
@@ -685,10 +689,8 @@ class RE2 {
static inline Arg CRadix(unsigned int* x);
static inline Arg CRadix(long* x);
static inline Arg CRadix(unsigned long* x);
- #if RE2_HAVE_LONGLONG
static inline Arg CRadix(long long* x);
static inline Arg CRadix(unsigned long long* x);
- #endif
static inline Arg Hex(short* x);
static inline Arg Hex(unsigned short* x);
@@ -696,10 +698,8 @@ class RE2 {
static inline Arg Hex(unsigned int* x);
static inline Arg Hex(long* x);
static inline Arg Hex(unsigned long* x);
- #if RE2_HAVE_LONGLONG
static inline Arg Hex(long long* x);
static inline Arg Hex(unsigned long long* x);
- #endif
static inline Arg Octal(short* x);
static inline Arg Octal(unsigned short* x);
@@ -707,47 +707,50 @@ class RE2 {
static inline Arg Octal(unsigned int* x);
static inline Arg Octal(long* x);
static inline Arg Octal(unsigned long* x);
- #if RE2_HAVE_LONGLONG
static inline Arg Octal(long long* x);
static inline Arg Octal(unsigned long long* x);
- #endif
private:
void Init(const StringPiece& pattern, const Options& options);
bool DoMatch(const StringPiece& text,
- Anchor anchor,
- int* consumed,
- const Arg* const args[],
- int n) const;
+ Anchor anchor,
+ size_t* consumed,
+ const Arg* const args[],
+ int n) const;
re2::Prog* ReverseProg() const;
- mutable Mutex* mutex_;
- string pattern_; // string regular expression
- Options options_; // option flags
+ string pattern_; // string regular expression
+ Options options_; // option flags
string prefix_; // required prefix (before regexp_)
bool prefix_foldcase_; // prefix is ASCII case-insensitive
re2::Regexp* entire_regexp_; // parsed regular expression
re2::Regexp* suffix_regexp_; // parsed regular expression, prefix removed
re2::Prog* prog_; // compiled program for regexp
- mutable re2::Prog* rprog_; // reverse program for regexp
- bool is_one_pass_; // can use prog_->SearchOnePass?
- mutable const string* error_; // Error indicator
- // (or points to empty string)
- mutable ErrorCode error_code_; // Error code
- mutable string error_arg_; // Fragment of regexp showing error
- mutable int num_captures_; // Number of capturing groups
+ bool is_one_pass_; // can use prog_->SearchOnePass?
+
+ mutable re2::Prog* rprog_; // reverse program for regexp
+ mutable const string* error_; // Error indicator
+ // (or points to empty string)
+ mutable ErrorCode error_code_; // Error code
+ mutable string error_arg_; // Fragment of regexp showing error
+ mutable int num_captures_; // Number of capturing groups
// Map from capture names to indices
- mutable const map<string, int>* named_groups_;
+ mutable const std::map<string, int>* named_groups_;
// Map from capture indices to names
- mutable const map<int, string>* group_names_;
+ mutable const std::map<int, string>* group_names_;
+
+ // Onces for lazy computations.
+ mutable std::once_flag rprog_once_;
+ mutable std::once_flag num_captures_once_;
+ mutable std::once_flag named_groups_once_;
+ mutable std::once_flag group_names_once_;
- //DISALLOW_COPY_AND_ASSIGN(RE2);
- RE2(const RE2&);
- void operator=(const RE2&);
+ RE2(const RE2&) = delete;
+ RE2& operator=(const RE2&) = delete;
};
/***** Implementation details *****/
@@ -758,7 +761,7 @@ class RE2 {
template <class T>
class _RE2_MatchObject {
public:
- static inline bool Parse(const char* str, int n, void* dest) {
+ static inline bool Parse(const char* str, size_t n, void* dest) {
if (dest == NULL) return true;
T* object = reinterpret_cast<T*>(dest);
return object->ParseFrom(str, n);
@@ -773,31 +776,29 @@ class RE2::Arg {
// Constructor specially designed for NULL arguments
Arg(void*);
- typedef bool (*Parser)(const char* str, int n, void* dest);
+ typedef bool (*Parser)(const char* str, size_t n, void* dest);
// Type-specific parsers
-#define MAKE_PARSER(type,name) \
- Arg(type* p) : arg_(p), parser_(name) { } \
- Arg(type* p, Parser parser) : arg_(p), parser_(parser) { } \
-
+#define MAKE_PARSER(type, name) \
+ Arg(type* p) : arg_(p), parser_(name) {} \
+ Arg(type* p, Parser parser) : arg_(p), parser_(parser) {}
MAKE_PARSER(char, parse_char);
- MAKE_PARSER(signed char, parse_char);
+ MAKE_PARSER(signed char, parse_schar);
MAKE_PARSER(unsigned char, parse_uchar);
+ MAKE_PARSER(float, parse_float);
+ MAKE_PARSER(double, parse_double);
+ MAKE_PARSER(string, parse_string);
+ MAKE_PARSER(StringPiece, parse_stringpiece);
+
MAKE_PARSER(short, parse_short);
MAKE_PARSER(unsigned short, parse_ushort);
MAKE_PARSER(int, parse_int);
MAKE_PARSER(unsigned int, parse_uint);
MAKE_PARSER(long, parse_long);
MAKE_PARSER(unsigned long, parse_ulong);
- #if RE2_HAVE_LONGLONG
MAKE_PARSER(long long, parse_longlong);
MAKE_PARSER(unsigned long long, parse_ulonglong);
- #endif
- MAKE_PARSER(float, parse_float);
- MAKE_PARSER(double, parse_double);
- MAKE_PARSER(string, parse_string);
- MAKE_PARSER(StringPiece, parse_stringpiece);
#undef MAKE_PARSER
@@ -808,29 +809,31 @@ class RE2::Arg {
: arg_(p), parser_(parser) { }
// Parse the data
- bool Parse(const char* str, int n) const;
+ bool Parse(const char* str, size_t n) const;
private:
void* arg_;
Parser parser_;
- static bool parse_null (const char* str, int n, void* dest);
- static bool parse_char (const char* str, int n, void* dest);
- static bool parse_uchar (const char* str, int n, void* dest);
- static bool parse_float (const char* str, int n, void* dest);
- static bool parse_double (const char* str, int n, void* dest);
- static bool parse_string (const char* str, int n, void* dest);
- static bool parse_stringpiece (const char* str, int n, void* dest);
-
-#define DECLARE_INTEGER_PARSER(name) \
- private: \
- static bool parse_ ## name(const char* str, int n, void* dest); \
- static bool parse_ ## name ## _radix( \
- const char* str, int n, void* dest, int radix); \
- public: \
- static bool parse_ ## name ## _hex(const char* str, int n, void* dest); \
- static bool parse_ ## name ## _octal(const char* str, int n, void* dest); \
- static bool parse_ ## name ## _cradix(const char* str, int n, void* dest)
+ static bool parse_null (const char* str, size_t n, void* dest);
+ static bool parse_char (const char* str, size_t n, void* dest);
+ static bool parse_schar (const char* str, size_t n, void* dest);
+ static bool parse_uchar (const char* str, size_t n, void* dest);
+ static bool parse_float (const char* str, size_t n, void* dest);
+ static bool parse_double (const char* str, size_t n, void* dest);
+ static bool parse_string (const char* str, size_t n, void* dest);
+ static bool parse_stringpiece (const char* str, size_t n, void* dest);
+
+#define DECLARE_INTEGER_PARSER(name) \
+ private: \
+ static bool parse_##name(const char* str, size_t n, void* dest); \
+ static bool parse_##name##_radix(const char* str, size_t n, void* dest, \
+ int radix); \
+ \
+ public: \
+ static bool parse_##name##_hex(const char* str, size_t n, void* dest); \
+ static bool parse_##name##_octal(const char* str, size_t n, void* dest); \
+ static bool parse_##name##_cradix(const char* str, size_t n, void* dest)
DECLARE_INTEGER_PARSER(short);
DECLARE_INTEGER_PARSER(ushort);
@@ -838,29 +841,31 @@ class RE2::Arg {
DECLARE_INTEGER_PARSER(uint);
DECLARE_INTEGER_PARSER(long);
DECLARE_INTEGER_PARSER(ulong);
- #if RE2_HAVE_LONGLONG
DECLARE_INTEGER_PARSER(longlong);
DECLARE_INTEGER_PARSER(ulonglong);
- #endif
#undef DECLARE_INTEGER_PARSER
+
};
inline RE2::Arg::Arg() : arg_(NULL), parser_(parse_null) { }
inline RE2::Arg::Arg(void* p) : arg_(p), parser_(parse_null) { }
-inline bool RE2::Arg::Parse(const char* str, int n) const {
+inline bool RE2::Arg::Parse(const char* str, size_t n) const {
return (*parser_)(str, n, arg_);
}
// This part of the parser, appropriate only for ints, deals with bases
-#define MAKE_INTEGER_PARSER(type, name) \
- inline RE2::Arg RE2::Hex(type* ptr) { \
- return RE2::Arg(ptr, RE2::Arg::parse_ ## name ## _hex); } \
- inline RE2::Arg RE2::Octal(type* ptr) { \
- return RE2::Arg(ptr, RE2::Arg::parse_ ## name ## _octal); } \
- inline RE2::Arg RE2::CRadix(type* ptr) { \
- return RE2::Arg(ptr, RE2::Arg::parse_ ## name ## _cradix); }
+#define MAKE_INTEGER_PARSER(type, name) \
+ inline RE2::Arg RE2::Hex(type* ptr) { \
+ return RE2::Arg(ptr, RE2::Arg::parse_##name##_hex); \
+ } \
+ inline RE2::Arg RE2::Octal(type* ptr) { \
+ return RE2::Arg(ptr, RE2::Arg::parse_##name##_octal); \
+ } \
+ inline RE2::Arg RE2::CRadix(type* ptr) { \
+ return RE2::Arg(ptr, RE2::Arg::parse_##name##_cradix); \
+ }
MAKE_INTEGER_PARSER(short, short)
MAKE_INTEGER_PARSER(unsigned short, ushort)
@@ -868,15 +873,62 @@ MAKE_INTEGER_PARSER(int,
MAKE_INTEGER_PARSER(unsigned int, uint)
MAKE_INTEGER_PARSER(long, long)
MAKE_INTEGER_PARSER(unsigned long, ulong)
-#if RE2_HAVE_LONGLONG
MAKE_INTEGER_PARSER(long long, longlong)
MAKE_INTEGER_PARSER(unsigned long long, ulonglong)
-#endif
#undef MAKE_INTEGER_PARSER
+#ifndef SWIG
+// Helper for writing global or static RE2s safely.
+// Write
+// static LazyRE2 re = {".*"};
+// and then use *re instead of writing
+// static RE2 re(".*");
+// The former is more careful about multithreaded
+// situations than the latter.
+//
+// N.B. This class never deletes the RE2 object that
+// it constructs: that's a feature, so that it can be used
+// for global and function static variables.
+class LazyRE2 {
+ private:
+ struct NoArg {};
+
+ public:
+ typedef RE2 element_type; // support std::pointer_traits
+
+ // Constructor omitted to preserve braced initialization in C++98.
+
+ // Pretend to be a pointer to Type (never NULL due to on-demand creation):
+ RE2& operator*() const { return *get(); }
+ RE2* operator->() const { return get(); }
+
+ // Named accessor/initializer:
+ RE2* get() const {
+ std::call_once(once_, &LazyRE2::Init, this);
+ return ptr_;
+ }
+
+ // All data fields must be public to support {"foo"} initialization.
+ const char* pattern_;
+ RE2::CannedOptions options_;
+ NoArg barrier_against_excess_initializers_;
+
+ mutable RE2* ptr_;
+ mutable std::once_flag once_;
+
+ private:
+ static void Init(const LazyRE2* lazy_re2) {
+ lazy_re2->ptr_ = new RE2(lazy_re2->pattern_, lazy_re2->options_);
+ }
+
+ void operator=(const LazyRE2&); // disallowed
+};
+#endif // SWIG
+
} // namespace re2
using re2::RE2;
+using re2::LazyRE2;
-#endif /* RE2_RE2_H */
+#endif // RE2_RE2_H_
--- a/src/3rdparty/chromium/third_party/re2/src/re2/filtered_re2.h
+++ b/src/3rdparty/chromium/third_party/re2/src/re2/filtered_re2.h
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+#ifndef RE2_FILTERED_RE2_H_
+#define RE2_FILTERED_RE2_H_
+
// The class FilteredRE2 is used as a wrapper to multiple RE2 regexps.
// It provides a prefilter mechanism that helps in cutting down the
// number of regexps that need to be actually searched.
@@ -18,20 +21,19 @@
// indices of strings that were found in the text to get the actual
// regexp matches.
-#ifndef RE2_FILTERED_RE2_H_
-#define RE2_FILTERED_RE2_H_
-
+#include <string>
#include <vector>
+
#include "re2/re2.h"
namespace re2 {
-using std::vector;
class PrefilterTree;
class FilteredRE2 {
public:
FilteredRE2();
+ explicit FilteredRE2(int min_atom_len);
~FilteredRE2();
// Uses RE2 constructor to create a RE2 object (re). Returns
@@ -47,7 +49,7 @@ class FilteredRE2 {
// the search text should be lowercased first to find matching
// strings from the set of strings returned by Compile. Call after
// all Add calls are done.
- void Compile(vector<string>* strings_to_match);
+ void Compile(std::vector<string>* strings_to_match);
// Returns the index of the first matching regexp.
// Returns -1 on no match. Can be called prior to Compile.
@@ -59,21 +61,21 @@ class FilteredRE2 {
// Returns -1 on no match. Compile has to be called before
// calling this.
int FirstMatch(const StringPiece& text,
- const vector<int>& atoms) const;
+ const std::vector<int>& atoms) const;
// Returns the indices of all matching regexps, after first clearing
// matched_regexps.
bool AllMatches(const StringPiece& text,
- const vector<int>& atoms,
- vector<int>* matching_regexps) const;
+ const std::vector<int>& atoms,
+ std::vector<int>* matching_regexps) const;
// Returns the indices of all potentially matching regexps after first
// clearing potential_regexps.
// A regexp is potentially matching if it passes the filter.
// If a regexp passes the filter it may still not match.
// A regexp that does not pass the filter is guaranteed to not match.
- void AllPotentials(const vector<int>& atoms,
- vector<int>* potential_regexps) const;
+ void AllPotentials(const std::vector<int>& atoms,
+ std::vector<int>* potential_regexps) const;
// The number of regexps added.
int NumRegexps() const { return static_cast<int>(re2_vec_.size()); }
@@ -87,11 +89,11 @@ class FilteredRE2 {
void PrintPrefilter(int regexpid);
// Useful for testing and debugging.
- void RegexpsGivenStrings(const vector<int>& matched_atoms,
- vector<int>* passed_regexps);
+ void RegexpsGivenStrings(const std::vector<int>& matched_atoms,
+ std::vector<int>* passed_regexps);
// All the regexps in the FilteredRE2.
- vector<RE2*> re2_vec_;
+ std::vector<RE2*> re2_vec_;
// Has the FilteredRE2 been compiled using Compile()
bool compiled_;
@@ -99,9 +101,8 @@ class FilteredRE2 {
// An AND-OR tree of string atoms used for filtering regexps.
PrefilterTree* prefilter_tree_;
- //DISALLOW_COPY_AND_ASSIGN(FilteredRE2);
- FilteredRE2(const FilteredRE2&);
- void operator=(const FilteredRE2&);
+ FilteredRE2(const FilteredRE2&) = delete;
+ FilteredRE2& operator=(const FilteredRE2&) = delete;
};
} // namespace re2
--- a/src/3rdparty/chromium/third_party/re2/src/re2/set.h
+++ b/src/3rdparty/chromium/third_party/re2/src/re2/set.h
@@ -2,16 +2,20 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-#ifndef RE2_SET_H
-#define RE2_SET_H
+#ifndef RE2_SET_H_
+#define RE2_SET_H_
-#include <utility>
+#include <string>
#include <vector>
#include "re2/re2.h"
namespace re2 {
-using std::vector;
+class Prog;
+class Regexp;
+} // namespace re2
+
+namespace re2 {
// An RE2::Set represents a collection of regexps that can
// be searched for simultaneously.
@@ -31,25 +35,25 @@ class RE2::Set {
// Compile prepares the Set for matching.
// Add must not be called again after Compile.
- // Compile must be called before FullMatch or PartialMatch.
+ // Compile must be called before Match.
// Compile may return false if it runs out of memory.
bool Compile();
// Match returns true if text matches any of the regexps in the set.
- // If so, it fills v with the indices of the matching regexps.
- bool Match(const StringPiece& text, vector<int>* v) const;
+ // If so, it fills v (if not NULL) with the indices of the matching regexps.
+ bool Match(const StringPiece& text, std::vector<int>* v) const;
private:
RE2::Options options_;
RE2::Anchor anchor_;
- vector<re2::Regexp*> re_;
+ std::vector<re2::Regexp*> re_;
re2::Prog* prog_;
bool compiled_;
- //DISALLOW_COPY_AND_ASSIGN(Set);
- Set(const Set&);
- void operator=(const Set&);
+
+ Set(const Set&) = delete;
+ Set& operator=(const Set&) = delete;
};
} // namespace re2
-#endif // RE2_SET_H
+#endif // RE2_SET_H_
--- a/src/3rdparty/chromium/third_party/re2/src/re2/stringpiece.h
+++ b/src/3rdparty/chromium/third_party/re2/src/re2/stringpiece.h
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+#ifndef RE2_STRINGPIECE_H_
+#define RE2_STRINGPIECE_H_
+
// A string-like object that points to a sized piece of memory.
//
// Functions or methods may use const StringPiece& parameters to accept either
@@ -16,143 +19,139 @@
//
// Arghh! I wish C++ literals were "string".
-#ifndef STRINGS_STRINGPIECE_H__
-#define STRINGS_STRINGPIECE_H__
-
+#include <stddef.h>
#include <string.h>
#include <algorithm>
-#include <cstddef>
#include <iosfwd>
+#include <iterator>
#include <string>
namespace re2 {
class StringPiece {
- private:
- const char* ptr_;
- int length_;
-
public:
+ typedef char value_type;
+ typedef char* pointer;
+ typedef const char* const_pointer;
+ typedef char& reference;
+ typedef const char& const_reference;
+ typedef const char* const_iterator;
+ typedef const_iterator iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef const_reverse_iterator reverse_iterator;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ static const size_type npos = static_cast<size_type>(-1);
+
// We provide non-explicit singleton constructors so users can pass
// in a "const char*" or a "string" wherever a "StringPiece" is
// expected.
- StringPiece() : ptr_(NULL), length_(0) { }
- StringPiece(const char* str)
- : ptr_(str), length_((str == NULL) ? 0 : static_cast<int>(strlen(str))) { }
+ StringPiece()
+ : data_(NULL), size_(0) {}
StringPiece(const std::string& str)
- : ptr_(str.data()), length_(static_cast<int>(str.size())) { }
- StringPiece(const char* offset, int len) : ptr_(offset), length_(len) { }
-
- // data() may return a pointer to a buffer with embedded NULs, and the
- // returned buffer may or may not be null terminated. Therefore it is
- // typically a mistake to pass data() to a routine that expects a NUL
- // terminated string.
- const char* data() const { return ptr_; }
- int size() const { return length_; }
- int length() const { return length_; }
- bool empty() const { return length_ == 0; }
+ : data_(str.data()), size_(str.size()) {}
+ StringPiece(const char* str)
+ : data_(str), size_(str == NULL ? 0 : strlen(str)) {}
+ StringPiece(const char* str, size_type len)
+ : data_(str), size_(len) {}
- void clear() { ptr_ = NULL; length_ = 0; }
- void set(const char* data, int len) { ptr_ = data; length_ = len; }
- void set(const char* str) {
- ptr_ = str;
- if (str != NULL)
- length_ = static_cast<int>(strlen(str));
- else
- length_ = 0;
+ const_iterator begin() const { return data_; }
+ const_iterator end() const { return data_ + size_; }
+ const_reverse_iterator rbegin() const {
+ return const_reverse_iterator(data_ + size_);
}
- void set(const void* data, int len) {
- ptr_ = reinterpret_cast<const char*>(data);
- length_ = len;
+ const_reverse_iterator rend() const {
+ return const_reverse_iterator(data_);
}
- char operator[](int i) const { return ptr_[i]; }
+ size_type size() const { return size_; }
+ size_type length() const { return size_; }
+ bool empty() const { return size_ == 0; }
- void remove_prefix(int n) {
- ptr_ += n;
- length_ -= n;
+ const_reference operator[](size_type i) const { return data_[i]; }
+ const_pointer data() const { return data_; }
+
+ void remove_prefix(size_type n) {
+ data_ += n;
+ size_ -= n;
}
- void remove_suffix(int n) {
- length_ -= n;
+ void remove_suffix(size_type n) {
+ size_ -= n;
}
- int compare(const StringPiece& x) const {
- int r = memcmp(ptr_, x.ptr_, std::min(length_, x.length_));
- if (r == 0) {
- if (length_ < x.length_) r = -1;
- else if (length_ > x.length_) r = +1;
- }
- return r;
+ void set(const char* str) {
+ data_ = str;
+ size_ = str == NULL ? 0 : strlen(str);
+ }
+
+ void set(const char* str, size_type len) {
+ data_ = str;
+ size_ = len;
}
std::string as_string() const {
- return std::string(data(), size());
+ return std::string(data_, size_);
}
+
// We also define ToString() here, since many other string-like
// interfaces name the routine that converts to a C++ string
// "ToString", and it's confusing to have the method that does that
// for a StringPiece be called "as_string()". We also leave the
// "as_string()" method defined here for existing code.
std::string ToString() const {
- return std::string(data(), size());
+ return std::string(data_, size_);
}
- void CopyToString(std::string* target) const;
- void AppendToString(std::string* target) const;
-
- // Does "this" start with "x"
- bool starts_with(const StringPiece& x) const {
- return ((length_ >= x.length_) &&
- (memcmp(ptr_, x.ptr_, x.length_) == 0));
+ void CopyToString(std::string* target) const {
+ target->assign(data_, size_);
}
- // Does "this" end with "x"
- bool ends_with(const StringPiece& x) const {
- return ((length_ >= x.length_) &&
- (memcmp(ptr_ + (length_-x.length_), x.ptr_, x.length_) == 0));
+ void AppendToString(std::string* target) const {
+ target->append(data_, size_);
}
- // standard STL container boilerplate
- typedef char value_type;
- typedef const char* pointer;
- typedef const char& reference;
- typedef const char& const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- static const size_type npos;
- typedef const char* const_iterator;
- typedef const char* iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- iterator begin() const { return ptr_; }
- iterator end() const { return ptr_ + length_; }
- const_reverse_iterator rbegin() const {
- return const_reverse_iterator(ptr_ + length_);
+ size_type copy(char* buf, size_type n, size_type pos = 0) const;
+ StringPiece substr(size_type pos = 0, size_type n = npos) const;
+
+ int compare(const StringPiece& x) const {
+ int r = memcmp(data_, x.data_, std::min(size_, x.size_));
+ if (r == 0) {
+ if (size_ < x.size_) r = -1;
+ else if (size_ > x.size_) r = +1;
+ }
+ return r;
}
- const_reverse_iterator rend() const {
- return const_reverse_iterator(ptr_);
+
+ // Does "this" start with "x"?
+ bool starts_with(const StringPiece& x) const {
+ return size_ >= x.size_ &&
+ memcmp(data_, x.data_, x.size_) == 0;
}
- // STLS says return size_type, but Google says return int
- int max_size() const { return length_; }
- int capacity() const { return length_; }
- size_type copy(char* buf, size_type n, size_type pos = 0) const;
+ // Does "this" end with "x"?
+ bool ends_with(const StringPiece& x) const {
+ return size_ >= x.size_ &&
+ memcmp(data_ + size_ - x.size_, x.data_, x.size_) == 0;
+ }
- bool contains(StringPiece s) const;
+ bool contains(const StringPiece& s) const {
+ return find(s) != npos;
+ }
size_type find(const StringPiece& s, size_type pos = 0) const;
size_type find(char c, size_type pos = 0) const;
size_type rfind(const StringPiece& s, size_type pos = npos) const;
size_type rfind(char c, size_type pos = npos) const;
- StringPiece substr(size_type pos, size_type n = npos) const;
-
- static bool _equal(const StringPiece&, const StringPiece&);
+ private:
+ const_pointer data_;
+ size_type size_;
};
inline bool operator==(const StringPiece& x, const StringPiece& y) {
- return StringPiece::_equal(x, y);
+ return x.size() == y.size() &&
+ memcmp(x.data(), y.data(), x.size()) == 0;
}
inline bool operator!=(const StringPiece& x, const StringPiece& y) {
@@ -160,8 +159,7 @@ inline bool operator!=(const StringPiece
}
inline bool operator<(const StringPiece& x, const StringPiece& y) {
- const int r = memcmp(x.data(), y.data(),
- std::min(x.size(), y.size()));
+ int r = memcmp(x.data(), y.data(), std::min(x.size(), y.size()));
return ((r < 0) || ((r == 0) && (x.size() < y.size())));
}
@@ -179,7 +177,7 @@ inline bool operator>=(const StringPiece
} // namespace re2
-// allow StringPiece to be logged
-extern std::ostream& operator<<(std::ostream& o, const re2::StringPiece& piece);
+// Allow StringPiece to be logged.
+std::ostream& operator<<(std::ostream& o, const re2::StringPiece& p);
-#endif // STRINGS_STRINGPIECE_H__
+#endif // RE2_STRINGPIECE_H_
+5 -3
View File
@@ -20,7 +20,8 @@
<Dependency versionFrom="5.7.1">qt5-sensors-devel</Dependency>
<Dependency versionFrom="5.7.1">qt5-webchannel-devel</Dependency>
<Dependency>bison</Dependency>
<Dependency versionFrom="1.7.1">ninja</Dependency>
<Dependency>re2c</Dependency>
<Dependency versionFrom="1.7.2">ninja</Dependency>
<Dependency>gperf</Dependency>
<Dependency>snappy-devel</Dependency>
<Dependency>gobject-introspection-devel</Dependency>
@@ -69,8 +70,9 @@
<Dependency>git</Dependency>
</BuildDependencies>
<Patches>
<Patch level="1">qt5-webengine-nss.patch</Patch>
<!--<Patch level="1">qt5-webengine-fno-delete-null-pointer-checks.patch</Patch>-->
<!--<Patch level="1">qt5-webengine-nss.patch</Patch>
<Patch level="1">use_system_re2.patch</Patch>-->
<!--<Patch level="1">do-not-use-system-ninja.patch</Patch>-->
</Patches>
</Source>