فهرست منبع

Fixes MSVC compiler warning C4800 "Forcing value to bool 'true' or 'false'" (#4350)

Alexey Malov 7 سال پیش
والد
کامیت
379b7ff42a
2فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 1 1
      src/google/protobuf/generated_message_util.h
  2. 1 1
      src/google/protobuf/io/coded_stream.h

+ 1 - 1
src/google/protobuf/generated_message_util.h

@@ -175,7 +175,7 @@ struct LIBPROTOBUF_EXPORT FieldMetadata {
 
 
 inline bool IsPresent(const void* base, uint32 hasbit) {
 inline bool IsPresent(const void* base, uint32 hasbit) {
   const uint32* has_bits_array = static_cast<const uint32*>(base);
   const uint32* has_bits_array = static_cast<const uint32*>(base);
-  return has_bits_array[hasbit / 32] & (1u << (hasbit & 31));
+  return (has_bits_array[hasbit / 32] & (1u << (hasbit & 31))) != 0;
 }
 }
 
 
 inline bool IsOneofPresent(const void* base, uint32 offset, uint32 tag) {
 inline bool IsOneofPresent(const void* base, uint32 offset, uint32 tag) {

+ 1 - 1
src/google/protobuf/io/coded_stream.h

@@ -851,7 +851,7 @@ class LIBPROTOBUF_EXPORT CodedOutputStream {
   }
   }
 
 
   static bool IsDefaultSerializationDeterministic() {
   static bool IsDefaultSerializationDeterministic() {
-    return default_serialization_deterministic_.load(std::memory_order_relaxed);
+    return default_serialization_deterministic_.load(std::memory_order_relaxed) != 0;
   }
   }
 
 
  private:
  private: