Browse Source

Fix compilation warnings introduced by VS 2015

Cheng Zhao 9 years ago
parent
commit
e77582baee

+ 3 - 1
atom/browser/native_window_views.cc

@@ -623,7 +623,9 @@ void NativeWindowViews::SetBackgroundColor(const std::string& color_name) {
   // Set the background color of native window.
   HBRUSH brush = CreateSolidBrush(skia::SkColorToCOLORREF(background_color));
   ULONG_PTR previous_brush = SetClassLongPtr(
-      GetAcceleratedWidget(), GCLP_HBRBACKGROUND, (LONG)brush);
+      GetAcceleratedWidget(),
+      GCLP_HBRBACKGROUND,
+      reinterpret_cast<LONG_PTR>(brush));
   if (previous_brush)
     DeleteObject((HBRUSH)previous_brush);
 #endif

+ 4 - 2
atom/browser/ui/message_box_win.cc

@@ -64,7 +64,8 @@ void MapToCommonID(const std::vector<base::string16>& buttons,
       (*button_flags) |= common.button;
     } else {
       // It is a custom button.
-      dialog_buttons->push_back({i + kIDStart, buttons[i].c_str()});
+      dialog_buttons->push_back(
+          {static_cast<int>(i + kIDStart), buttons[i].c_str()});
     }
   }
 }
@@ -135,7 +136,8 @@ int ShowMessageBoxUTF16(HWND parent,
   std::vector<TASKDIALOG_BUTTON> dialog_buttons;
   if (options & MESSAGE_BOX_NO_LINK) {
     for (size_t i = 0; i < buttons.size(); ++i)
-      dialog_buttons.push_back({i + kIDStart, buttons[i].c_str()});
+      dialog_buttons.push_back(
+          {static_cast<int>(i + kIDStart), buttons[i].c_str()});
   } else {
     MapToCommonID(buttons, &id_map, &config.dwCommonButtons, &dialog_buttons);
   }

+ 1 - 1
atom/common/crash_reporter/win/crash_service.cc

@@ -327,7 +327,7 @@ void CrashService::OnClientConnected(void* context,
 
 void CrashService::OnClientExited(void* context,
     const google_breakpad::ClientInfo* client_info) {
-  ProcessingLock lock;
+  ProcessingLock processing_lock;
   VLOG(1) << "client end. pid = " << client_info->pid();
   CrashService* self = static_cast<CrashService*>(context);
   ::InterlockedIncrement(&self->clients_terminated_);

+ 8 - 0
common.gypi

@@ -62,7 +62,12 @@
           4232,  # address of dllimport 'free' is not static, identity not guaranteed
           4291,  # no matching operator delete found
           4295,  # array is too small to include a terminating null character
+          4311,  # 'type cast': pointer truncation from 'void *const ' to 'unsigned long'
           4389,  # '==' : signed/unsigned mismatch
+          4456,  # declaration of 'm' hides previous local declaration
+          4457,  # declaration of 'message' hides function parameter
+          4459,  # declaration of 'wq' hides global declaration
+          4477,  # format string '%.*s' requires an argument of type 'int'
           4505,  # unreferenced local function has been removed
           4701,  # potentially uninitialized local variable 'sizew' used
           4703,  # potentially uninitialized local pointer variable 'req' used
@@ -234,9 +239,12 @@
       4189,  # local variable is initialized but not referenced
       4201,  # (uv.h) nameless struct/union
       4267,  # conversion from 'size_t' to 'int', possible loss of data
+      4302,  # (atldlgs.h) 'type cast': truncation from 'LPCTSTR' to 'WORD'
+      4458,  # (atldlgs.h) declaration of 'dwCommonButtons' hides class member
       4503,  # decorated name length exceeded, name was truncated
       4800,  # (v8.h) forcing value to bool 'true' or 'false'
       4819,  # The file contains a character that cannot be represented in the current code page
+      4838,  # (atlgdi.h) conversion from 'int' to 'UINT' requires a narrowing conversion
       4996,  # (atlapp.h) 'GetVersionExW': was declared deprecated
     ],
   },