diff options
author | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-15 08:52:31 +0000 |
---|---|---|
committer | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-15 08:52:31 +0000 |
commit | 1a7f42769b898d79643c817cd741d872377fc364 (patch) | |
tree | 0a811d466ba247e8205a9d6c063f112461b536e8 /ui | |
parent | a48610cce51c396e5667b70bce05a5ad80fbc83c (diff) | |
download | chromium_src-1a7f42769b898d79643c817cd741d872377fc364.zip chromium_src-1a7f42769b898d79643c817cd741d872377fc364.tar.gz chromium_src-1a7f42769b898d79643c817cd741d872377fc364.tar.bz2 |
some fixes and warning disables in ui/ for building on win x64
- Some |int|s that should be |ptrdiff_t|s.
- Icon structures are packing to known size (same signs).
- GetWindowLong needs to be GetWindowLongPtr to work on 32 & 64.
R=ben@chromium.org, jschuh@chromium.org
BUG=167187, 166496
Review URL: https://chromiumcodereview.appspot.com/11889017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176860 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/base/dragdrop/os_exchange_data_provider_win.cc | 6 | ||||
-rw-r--r-- | ui/base/range/range.h | 2 | ||||
-rw-r--r-- | ui/base/range/range_win.cc | 8 | ||||
-rw-r--r-- | ui/base/win/dpi.cc | 3 | ||||
-rw-r--r-- | ui/base/win/hwnd_subclass.cc | 2 | ||||
-rw-r--r-- | ui/gfx/icon_util.cc | 10 | ||||
-rw-r--r-- | ui/gfx/text_utils.cc | 2 | ||||
-rw-r--r-- | ui/ui.gyp | 4 |
8 files changed, 20 insertions, 17 deletions
diff --git a/ui/base/dragdrop/os_exchange_data_provider_win.cc b/ui/base/dragdrop/os_exchange_data_provider_win.cc index 800f81a..5601121 100644 --- a/ui/base/dragdrop/os_exchange_data_provider_win.cc +++ b/ui/base/dragdrop/os_exchange_data_provider_win.cc @@ -964,10 +964,8 @@ static STGMEDIUM* GetStorageForFileDescriptor( FILEGROUPDESCRIPTOR* descriptor = locked_mem.get(); descriptor->cItems = 1; descriptor->fgd[0].dwFlags = FD_LINKUI; - wcsncpy_s(descriptor->fgd[0].cFileName, - MAX_PATH, - file_name.c_str(), - std::min(file_name.size(), MAX_PATH - 1u)); + wcsncpy_s(descriptor->fgd[0].cFileName, MAX_PATH, file_name.c_str(), + std::min(file_name.size(), static_cast<size_t>(MAX_PATH - 1u))); STGMEDIUM* storage = new STGMEDIUM; storage->tymed = TYMED_HGLOBAL; diff --git a/ui/base/range/range.h b/ui/base/range/range.h index dac8d15..b8bf4786 100644 --- a/ui/base/range/range.h +++ b/ui/base/range/range.h @@ -65,7 +65,7 @@ class UI_EXPORT Range { // Returns the absolute value of the length. size_t length() const { - int length = end() - start(); + ptrdiff_t length = end() - start(); return length >= 0 ? length : -length; } diff --git a/ui/base/range/range_win.cc b/ui/base/range/range_win.cc index 0a34958..29178b3 100644 --- a/ui/base/range/range_win.cc +++ b/ui/base/range/range_win.cc @@ -35,10 +35,10 @@ CHARRANGE Range::ToCHARRANGE() const { return r; const LONG kLONGMax = std::numeric_limits<LONG>::max(); - DCHECK_LE(static_cast<LONG>(start()), kLONGMax); - DCHECK_LE(static_cast<LONG>(end()), kLONGMax); - r.cpMin = start(); - r.cpMax = end(); + CHECK_LE(static_cast<LONG>(start()), kLONGMax); + CHECK_LE(static_cast<LONG>(end()), kLONGMax); + r.cpMin = static_cast<LONG>(start()); + r.cpMax = static_cast<LONG>(end()); return r; } diff --git a/ui/base/win/dpi.cc b/ui/base/win/dpi.cc index c998292..9c56af0 100644 --- a/ui/base/win/dpi.cc +++ b/ui/base/win/dpi.cc @@ -47,7 +47,8 @@ bool IsInHighDPIMode() { void EnableHighDPISupport() { typedef BOOL(WINAPI *SetProcessDPIAwarePtr)(VOID); SetProcessDPIAwarePtr set_process_dpi_aware_func = - GetProcAddress(GetModuleHandleA("user32.dll"), "SetProcessDPIAware"); + reinterpret_cast<SetProcessDPIAwarePtr>( + GetProcAddress(GetModuleHandleA("user32.dll"), "SetProcessDPIAware")); if (set_process_dpi_aware_func) set_process_dpi_aware_func(); } diff --git a/ui/base/win/hwnd_subclass.cc b/ui/base/win/hwnd_subclass.cc index 5241d46..94ab44c 100644 --- a/ui/base/win/hwnd_subclass.cc +++ b/ui/base/win/hwnd_subclass.cc @@ -29,7 +29,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, } WNDPROC GetCurrentWndProc(HWND target) { - return reinterpret_cast<WNDPROC>(GetWindowLong(target, GWL_WNDPROC)); + return reinterpret_cast<WNDPROC>(GetWindowLongPtr(target, GWLP_WNDPROC)); } } // namespace diff --git a/ui/gfx/icon_util.cc b/ui/gfx/icon_util.cc index 5cce7e3..a2f02fb 100644 --- a/ui/gfx/icon_util.cc +++ b/ui/gfx/icon_util.cc @@ -357,8 +357,8 @@ bool IconUtil::CreateIconFileFromSkBitmap(const SkBitmap& bitmap, // If |large_bitmap| was specified, validate its dimension and convert to PNG. scoped_refptr<base::RefCountedMemory> png_bytes; if (!large_bitmap.empty()) { - DCHECK_EQ(256, large_bitmap.width()); - DCHECK_EQ(256, large_bitmap.height()); + CHECK_EQ(256, large_bitmap.width()); + CHECK_EQ(256, large_bitmap.height()); png_bytes = gfx::Image(large_bitmap).As1xPNGBytes(); } @@ -391,7 +391,7 @@ bool IconUtil::CreateIconFileFromSkBitmap(const SkBitmap& bitmap, std::vector<uint8> buffer(buffer_size); ICONDIR* icon_dir = reinterpret_cast<ICONDIR*>(&buffer[0]); icon_dir->idType = kResourceTypeIcon; - icon_dir->idCount = bitmap_count; + icon_dir->idCount = static_cast<WORD>(bitmap_count); size_t icon_dir_count = bitmap_count - 1; // Note DCHECK(!bitmaps.empty())! // Increment counts if a PNG entry will be added. @@ -418,8 +418,8 @@ bool IconUtil::CreateIconFileFromSkBitmap(const SkBitmap& bitmap, entry->bHeight = 0; entry->wPlanes = 1; entry->wBitCount = 32; - entry->dwBytesInRes = png_bytes->size(); - entry->dwImageOffset = offset; + entry->dwBytesInRes = static_cast<DWORD>(png_bytes->size()); + entry->dwImageOffset = static_cast<DWORD>(offset); memcpy(&buffer[offset], png_bytes->front(), png_bytes->size()); offset += png_bytes->size(); } diff --git a/ui/gfx/text_utils.cc b/ui/gfx/text_utils.cc index a5a1b79..8a2658c 100644 --- a/ui/gfx/text_utils.cc +++ b/ui/gfx/text_utils.cc @@ -13,7 +13,7 @@ string16 RemoveAcceleratorChar(const string16& s, int* accelerated_char_pos, int* accelerated_char_span) { bool escaped = false; - int last_char_pos = -1; + ptrdiff_t last_char_pos = -1; int last_char_span = 0; base::i18n::UTF16CharIterator chars(&s); string16 accelerator_removed; @@ -714,6 +714,10 @@ '../', '../third_party/wtl/include', ], + # TODO(jschuh): C4267: http://crbug.com/167187 size_t -> int + # C4324 is structure was padded due to __declspec(align()), which is + # uninteresting. + 'msvs_disabled_warnings': [ 4267, 4324 ], 'msvs_settings': { 'VCLinkerTool': { 'DelayLoadDLLs': [ |