DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (d38398e5144e)

VCS Links

Line Code
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 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423
--- a/toolkit/components/protobuf/src/google/protobuf/wire_format_lite.h
+++ b/toolkit/components/protobuf/src/google/protobuf/wire_format_lite.h
@@ -35,16 +35,17 @@
 //  Sanjay Ghemawat, Jeff Dean, and others.
 //
 // This header is logically internal, but is made public because it is used
 // from protocol-compiler-generated code, which may reside in other components.
 
 #ifndef GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_H__
 #define GOOGLE_PROTOBUF_WIRE_FORMAT_LITE_H__
 
+#include <algorithm>
 #include <string>
 #include <google/protobuf/stubs/common.h>
 #include <google/protobuf/message_lite.h>
 #include <google/protobuf/io/coded_stream.h>  // for CodedOutputStream::Varint32Size
 
 namespace google {
 
 namespace protobuf {
--- a/toolkit/components/protobuf/src/google/protobuf/wire_format.cc
+++ b/toolkit/components/protobuf/src/google/protobuf/wire_format.cc
@@ -819,30 +819,35 @@ void WireFormat::SerializeFieldWithCachedSizes(
       HANDLE_PRIMITIVE_TYPE(SFIXED64,  int64, SFixed64,  Int64)
 
       HANDLE_PRIMITIVE_TYPE(FLOAT , float , Float , Float )
       HANDLE_PRIMITIVE_TYPE(DOUBLE, double, Double, Double)
 
       HANDLE_PRIMITIVE_TYPE(BOOL, bool, Bool, Bool)
 #undef HANDLE_PRIMITIVE_TYPE
 
-#define HANDLE_TYPE(TYPE, TYPE_METHOD, CPPTYPE_METHOD)                       \
-      case FieldDescriptor::TYPE_##TYPE:                                     \
-        WireFormatLite::Write##TYPE_METHOD(                                  \
-              field->number(),                                               \
-              field->is_repeated() ?                                         \
-                message_reflection->GetRepeated##CPPTYPE_METHOD(             \
-                  message, field, j) :                                       \
-                message_reflection->Get##CPPTYPE_METHOD(message, field),     \
-              output);                                                       \
+      case FieldDescriptor::TYPE_GROUP:
+        WireFormatLite::WriteGroup(
+              field->number(),
+              field->is_repeated() ?
+                message_reflection->GetRepeatedMessage(
+                  message, field, j) :
+                message_reflection->GetMessage(message, field),
+              output);
         break;
 
-      HANDLE_TYPE(GROUP  , Group  , Message)
-      HANDLE_TYPE(MESSAGE, Message, Message)
-#undef HANDLE_TYPE
+      case FieldDescriptor::TYPE_MESSAGE:
+        WireFormatLite::WriteMessage(
+              field->number(),
+              field->is_repeated() ?
+                message_reflection->GetRepeatedMessage(
+                  message, field, j) :
+                message_reflection->GetMessage(message, field),
+              output);
+        break;
 
       case FieldDescriptor::TYPE_ENUM: {
         const EnumValueDescriptor* value = field->is_repeated() ?
           message_reflection->GetRepeatedEnum(message, field, j) :
           message_reflection->GetEnum(message, field);
         if (is_packed) {
           WireFormatLite::WriteEnumNoTag(value->number(), output);
         } else {
--- b/toolkit/components/protobuf/src/google/protobuf/io/gzip_stream.cc
+++ a/toolkit/components/protobuf/src/google/protobuf/io/gzip_stream.cc
@@ -28,17 +28,16 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 // Author: brianolson@google.com (Brian Olson)
 //
 // This file contains the implementation of classes GzipInputStream and
 // GzipOutputStream.
 
-#include "config.h"
 
 #if HAVE_ZLIB
 #include <google/protobuf/io/gzip_stream.h>
 
 #include <google/protobuf/stubs/common.h>
 
 namespace google {
 namespace protobuf {
--- b/toolkit/components/protobuf/src/google/protobuf/stubs/common.cc
+++ a/toolkit/components/protobuf/src/google/protobuf/stubs/common.cc
@@ -31,23 +31,22 @@
 // Author: kenton@google.com (Kenton Varda)
 
 #include <google/protobuf/stubs/common.h>
 #include <google/protobuf/stubs/once.h>
 #include <stdio.h>
 #include <errno.h>
 #include <vector>
 
-#include "config.h"
 
 #ifdef _WIN32
 #define WIN32_LEAN_AND_MEAN  // We only need minimal includes
 #include <windows.h>
 #define snprintf _snprintf    // see comment in strutil.cc
+#elif defined(HAVE_PTHREAD_H)
-#elif defined(HAVE_PTHREAD)
 #include <pthread.h>
 #else
 #error "No suitable threading library available."
 #endif
 
 namespace google {
 namespace protobuf {
 
--- b/toolkit/components/protobuf/src/google/protobuf/stubs/common.h
+++ a/toolkit/components/protobuf/src/google/protobuf/stubs/common.h
@@ -363,71 +363,20 @@
 // or to make sure a struct is smaller than a certain size:
 //
 //   COMPILE_ASSERT(sizeof(foo) < 128, foo_too_large);
 //
 // The second argument to the macro is the name of the variable. If
 // the expression is false, most compilers will issue a warning/error
 // containing the name of the variable.
 
+#define GOOGLE_COMPILE_ASSERT(expr, msg) static_assert(expr, #msg)
-namespace internal {
-
-template <bool>
-struct CompileAssert {
-};
-
-}  // namespace internal
 
-#undef GOOGLE_COMPILE_ASSERT
-#define GOOGLE_COMPILE_ASSERT(expr, msg) \
-  typedef ::google::protobuf::internal::CompileAssert<(bool(expr))> \
-          msg[bool(expr) ? 1 : -1]
 
 
-// Implementation details of COMPILE_ASSERT:
-//
-// - COMPILE_ASSERT works by defining an array type that has -1
-//   elements (and thus is invalid) when the expression is false.
-//
-// - The simpler definition
-//
-//     #define COMPILE_ASSERT(expr, msg) typedef char msg[(expr) ? 1 : -1]
-//
-//   does not work, as gcc supports variable-length arrays whose sizes
-//   are determined at run-time (this is gcc's extension and not part
-//   of the C++ standard).  As a result, gcc fails to reject the
-//   following code with the simple definition:
-//
-//     int foo;
-//     COMPILE_ASSERT(foo, msg); // not supposed to compile as foo is
-//                               // not a compile-time constant.
-//
-// - By using the type CompileAssert<(bool(expr))>, we ensures that
-//   expr is a compile-time constant.  (Template arguments must be
-//   determined at compile-time.)
-//
-// - The outter parentheses in CompileAssert<(bool(expr))> are necessary
-//   to work around a bug in gcc 3.4.4 and 4.0.1.  If we had written
-//
-//     CompileAssert<bool(expr)>
-//
-//   instead, these compilers will refuse to compile
-//
-//     COMPILE_ASSERT(5 > 0, some_message);
-//
-//   (They seem to think the ">" in "5 > 0" marks the end of the
-//   template argument list.)
-//
-// - The array size is (bool(expr) ? 1 : -1), instead of simply
-//
-//     ((expr) ? 1 : -1).
-//
-//   This is to avoid running into a bug in MS VC 7.1, which
-//   causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.
-
 // ===================================================================
 // from google3/base/scoped_ptr.h
 
 namespace internal {
 
 //  This is an implementation designed to match the anticipated future TR2
 //  implementation of the scoped_ptr class, and its closely-related brethren,
 //  scoped_array, scoped_ptr_malloc, and make_scoped_ptr.
@@ -582,16 +582,27 @@ enum LogLevel {
                      // in the code which calls the library, especially when
                      // compiled in debug mode.
 
 #ifdef NDEBUG
   LOGLEVEL_DFATAL = LOGLEVEL_ERROR
 #else
   LOGLEVEL_DFATAL = LOGLEVEL_FATAL
 #endif
+
+#ifdef ERROR
+  // ERROR is defined as 0 on some windows builds, so `GOOGLE_LOG(ERROR, ...)`
+  // expands into `GOOGLE_LOG(0, ...)` which then expands into
+  // `someGoogleLogging(LOGLEVEL_0, ...)`. This is not ideal, because the
+  // GOOGLE_LOG macro expects to expand itself into
+  // `someGoogleLogging(LOGLEVEL_ERROR, ...)` instead. The workaround to get
+  // everything building is to simply define LOGLEVEL_0 as LOGLEVEL_ERROR and
+  // move on with our lives.
+  , LOGLEVEL_0 = LOGLEVEL_ERROR
+#endif
 };
 
 namespace internal {
 
 class LogFinisher;
 
 class LIBPROTOBUF_EXPORT LogMessage {
  public:
--- b/toolkit/components/protobuf/src/google/protobuf/stubs/hash.h
+++ a/toolkit/components/protobuf/src/google/protobuf/stubs/hash.h
@@ -32,17 +32,16 @@
 //
 // Deals with the fact that hash_map is not defined everywhere.
 
 #ifndef GOOGLE_PROTOBUF_STUBS_HASH_H__
 #define GOOGLE_PROTOBUF_STUBS_HASH_H__
 
 #include <string.h>
 #include <google/protobuf/stubs/common.h>
-#include "config.h"
 
 #if defined(HAVE_HASH_MAP) && defined(HAVE_HASH_SET)
 #include HASH_MAP_H
 #include HASH_SET_H
 #else
 #define MISSING_HASH
 #include <map>
 #include <set>
--- b/toolkit/components/protobuf/src/google/protobuf/stubs/stringprintf.cc
+++ a/toolkit/components/protobuf/src/google/protobuf/stubs/stringprintf.cc
@@ -32,17 +32,16 @@
 
 #include <google/protobuf/stubs/stringprintf.h>
 
 #include <errno.h>
 #include <stdarg.h> // For va_list and related operations
 #include <stdio.h> // MSVC requires this for _vsnprintf
 #include <vector>
 #include <google/protobuf/stubs/common.h>
-#include <google/protobuf/testing/googletest.h>
 
 namespace google {
 namespace protobuf {
 
 #ifdef _MSC_VER
 enum { IS_COMPILER_MSVC = 1 };
 #ifndef va_copy
 // Define va_copy for MSVC. This is a hack, assuming va_list is simply a
--- b/toolkit/components/protobuf/src/google/protobuf/stubs/strutil.h
+++ a/toolkit/components/protobuf/src/google/protobuf/stubs/strutil.h
@@ -332,16 +332,17 @@
     return strtoul(nptr, endptr, base);
   else
     return strtou32_adaptor(nptr, endptr, base);
 }
 
 // For now, long long is 64-bit on all the platforms we care about, so these
 // functions can simply pass the call to strto[u]ll.
 inline int64 strto64(const char *nptr, char **endptr, int base) {
+  static_assert(sizeof(int64) == sizeof(long long), "Protobuf needs sizeof(int64) == sizeof(long long)");
   GOOGLE_COMPILE_ASSERT(sizeof(int64) == sizeof(long long),
                         sizeof_int64_is_not_sizeof_long_long);
   return strtoll(nptr, endptr, base);
 }
 
 inline uint64 strtou64(const char *nptr, char **endptr, int base) {
   GOOGLE_COMPILE_ASSERT(sizeof(uint64) == sizeof(unsigned long long),
                         sizeof_uint64_is_not_sizeof_long_long);
--- a/toolkit/components/protobuf/src/google/protobuf/stubs/strutil.cc
+++ b/toolkit/components/protobuf/src/google/protobuf/stubs/strutil.cc
@@ -33,16 +33,18 @@
 #include <google/protobuf/stubs/strutil.h>
 #include <errno.h>
 #include <float.h>    // FLT_DIG and DBL_DIG
 #include <limits>
 #include <limits.h>
 #include <stdio.h>
 #include <iterator>
 
+#include "mozilla/FloatingPoint.h"
+
 #ifdef _WIN32
 // MSVC has only _snprintf, not snprintf.
 //
 // MinGW has both snprintf and _snprintf, but they appear to be different
 // functions.  The former is buggy.  When invoked like so:
 //   char buffer[32];
 //   snprintf(buffer, 32, "%.*g\n", FLT_DIG, 1.23e10f);
 // it prints "1.23000e+10".  This is plainly wrong:  %g should never print
@@ -51,18 +53,17 @@
 // right thing, so we use it.
 #define snprintf _snprintf
 #endif
 
 namespace google {
 namespace protobuf {
 
 inline bool IsNaN(double value) {
-  // NaN is never equal to anything, even itself.
-  return value != value;
+  return ::mozilla::IsNaN(value);
 }
 
 // These are defined as macros on some platforms.  #undef them so that we can
 // redefine them.
 #undef isxdigit
 #undef isprint
 
 // The definitions of these in ctype.h change based on locale.  Since our
--- b/toolkit/components/protobuf/src/google/protobuf/stubs/type_traits.h
+++ a/toolkit/components/protobuf/src/google/protobuf/stubs/type_traits.h
@@ -107,20 +107,18 @@
 template<> struct is_integral<wchar_t> : true_type { };
 #endif
 template<> struct is_integral<short> : true_type { };
 template<> struct is_integral<unsigned short> : true_type { };
 template<> struct is_integral<int> : true_type { };
 template<> struct is_integral<unsigned int> : true_type { };
 template<> struct is_integral<long> : true_type { };
 template<> struct is_integral<unsigned long> : true_type { };
-#ifdef HAVE_LONG_LONG
 template<> struct is_integral<long long> : true_type { };
 template<> struct is_integral<unsigned long long> : true_type { };
-#endif
 template <class T> struct is_integral<const T> : is_integral<T> { };
 template <class T> struct is_integral<volatile T> : is_integral<T> { };
 template <class T> struct is_integral<const volatile T> : is_integral<T> { };
 
 // is_floating_point is false except for the built-in floating-point types.
 // A cv-qualified type is integral if and only if the underlying type is.
 template <class T> struct is_floating_point : false_type { };
 template<> struct is_floating_point<float> : true_type { };
--- a/toolkit/components/protobuf/src/google/protobuf/wire_format_lite_inl.h
+++ b/toolkit/components/protobuf/src/google/protobuf/wire_format_lite_inl.h
@@ -375,17 +375,17 @@ inline bool WireFormatLite::ReadPackedFixedSizePrimitive(
     void* dest = reinterpret_cast<void*>(values->mutable_data() + old_entries);
     if (!input->ReadRaw(dest, new_bytes)) {
       values->Truncate(old_entries);
       return false;
     }
 #else
     values->Reserve(old_entries + new_entries);
     CType value;
-    for (int i = 0; i < new_entries; ++i) {
+    for (uint32 i = 0; i < new_entries; ++i) {
       if (!ReadPrimitive<CType, DeclaredType>(input, &value)) return false;
       values->AddAlreadyReserved(value);
     }
 #endif
   } else {
     // This is the slow-path case where "length" may be too large to
     // safely allocate.  We read as much as we can into *values
     // without pre-allocating "length" bytes.
--- a/toolkit/components/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h
+++ b/toolkit/components/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h
@@ -39,16 +39,17 @@
 // streams.  Of course, many users will probably want to write their own
 // implementations of these interfaces specific to the particular I/O
 // abstractions they prefer to use, but these should cover the most common
 // cases.
 
 #ifndef GOOGLE_PROTOBUF_IO_ZERO_COPY_STREAM_IMPL_LITE_H__
 #define GOOGLE_PROTOBUF_IO_ZERO_COPY_STREAM_IMPL_LITE_H__
 
+#include <vector> /* See Bug 1186561 */
 #include <string>
 #include <iosfwd>
 #include <google/protobuf/io/zero_copy_stream.h>
 #include <google/protobuf/stubs/common.h>
 #include <google/protobuf/stubs/stl_util.h>
 
 
 namespace google {
diff --git a/toolkit/components/protobuf/src/google/protobuf/stubs/atomicops.h b/toolkit/components/protobuf/src/google/protobuf/stubs/atomicops.h
--- a/toolkit/components/protobuf/src/google/protobuf/stubs/atomicops.h
+++ b/toolkit/components/protobuf/src/google/protobuf/stubs/atomicops.h
@@ -73,17 +73,21 @@ typedef int32 Atomic32;
 typedef int64 Atomic64;
 #else
 typedef intptr_t Atomic64;
 #endif
 #endif
 
 // Use AtomicWord for a machine-sized pointer.  It will use the Atomic32 or
 // Atomic64 routines below, depending on your architecture.
+#if defined(__OpenBSD__) && !defined(GOOGLE_PROTOBUF_ARCH_64_BIT)
+typedef Atomic32 AtomicWord;
+#else
 typedef intptr_t AtomicWord;
+#endif
 
 // Atomically execute:
 //      result = *ptr;
 //      if (*ptr == old_value)
 //        *ptr = new_value;
 //      return result;
 //
 // I.e., replace "*ptr" with "new_value" if "*ptr" used to be "old_value".
diff --git a/toolkit/components/protobuf/src/google/protobuf/stubs/platform_macros.h b/toolkit/components/protobuf/src/google/protobuf/stubs/platform_macros.h
index 7956d076dcd5..1bd67d436331 100644
--- a/toolkit/components/protobuf/src/google/protobuf/stubs/platform_macros.h
+++ b/toolkit/components/protobuf/src/google/protobuf/stubs/platform_macros.h
@@ -67,7 +67,7 @@
 #define GOOGLE_PROTOBUF_ARCH_32_BIT 1
 #elif defined(sparc)
 #define GOOGLE_PROTOBUF_ARCH_SPARC 1
-#ifdef SOLARIS_64BIT_ENABLED
+#if defined(__sparc_v9__) || defined(__sparcv9) || defined(__arch64__)
 #define GOOGLE_PROTOBUF_ARCH_64_BIT 1
 #else
 #define GOOGLE_PROTOBUF_ARCH_32_BIT 1