Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/PluginClass.cpp

Issue 29333356: Noissue - Eliminate compile warnings in the plugin (Closed)
Patch Set: Created Jan. 11, 2016, 3:46 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/plugin/NotificationMessage.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 */ 70 */
71 namespace AdblockPlus 71 namespace AdblockPlus
72 { 72 {
73 /** 73 /**
74 * Replacement for ATL type CRect. 74 * Replacement for ATL type CRect.
75 */ 75 */
76 class Rectangle 76 class Rectangle
77 : public RECT 77 : public RECT
78 { 78 {
79 public: 79 public:
80 int Height() const 80 unsigned long Height() const
81 { 81 {
82 return bottom - top; 82 if (bottom < top)
83 {
84 throw std::runtime_error("invariant violation: rectangle bottom < top");
85 }
86 return static_cast<unsigned long>(bottom - top);
83 } 87 }
84 88
85 int Width() const 89 unsigned long Width() const
86 { 90 {
87 return right - left; 91 if (right < left)
92 {
93 throw std::runtime_error("invariant violation: rectangle right < left");
94 }
95 return static_cast<unsigned long>(right - left);
88 } 96 }
89 }; 97 };
90 } 98 }
91 99
92 CPluginClass::CPluginClass() 100 CPluginClass::CPluginClass()
93 : m_webBrowser2(nullptr) 101 : m_webBrowser2(nullptr)
94 { 102 {
95 DEBUG_GENERAL([this]() -> std::wstring 103 DEBUG_GENERAL([this]() -> std::wstring
96 { 104 {
97 std::wstring s = L"CPluginClass::<constructor>, this = "; 105 std::wstring s = L"CPluginClass::<constructor>, this = ";
(...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 break; 1577 break;
1570 1578
1571 case WM_UPDATEUISTATE: 1579 case WM_UPDATEUISTATE:
1572 { 1580 {
1573 CPluginTab* tab = GetTab(::GetCurrentThreadId()); 1581 CPluginTab* tab = GetTab(::GetCurrentThreadId());
1574 if (tab) 1582 if (tab)
1575 { 1583 {
1576 tab->OnActivate(); 1584 tab->OnActivate();
1577 RECT rect; 1585 RECT rect;
1578 GetWindowRect(pClass->m_hPaneWnd, &rect); 1586 GetWindowRect(pClass->m_hPaneWnd, &rect);
1579 pClass->notificationMessage.Move(rect.left + (rect.right - rect.left) / 2, rect.top + (rect.bottom - rect.top) / 2); 1587 pClass->notificationMessage.MoveToCenter(rect);
1580 } 1588 }
1581 if (LOWORD(wParam) == UIS_CLEAR) 1589 if (LOWORD(wParam) == UIS_CLEAR)
1582 { 1590 {
1583 pClass->notificationMessage.Hide(); 1591 pClass->notificationMessage.Hide();
1584 } 1592 }
1585 break; 1593 break;
1586 } 1594 }
1587 case WM_WINDOWPOSCHANGING: 1595 case WM_WINDOWPOSCHANGING:
1588 { 1596 {
1589 RECT rect; 1597 RECT rect;
1590 GetWindowRect(pClass->m_hPaneWnd, &rect); 1598 GetWindowRect(pClass->m_hPaneWnd, &rect);
1591 if (pClass->notificationMessage.IsVisible()) 1599 if (pClass->notificationMessage.IsVisible())
1592 { 1600 {
1593 pClass->notificationMessage.Move(rect.left + (rect.right - rect.left) / 2, rect.top + (rect.bottom - rect.top) / 2); 1601 pClass->notificationMessage.MoveToCenter(rect);
1594 } 1602 }
1595 break; 1603 break;
1596 } 1604 }
1597 case WM_WINDOWPOSCHANGED: 1605 case WM_WINDOWPOSCHANGED:
1598 { 1606 {
1599 WINDOWPOS* wndPos = reinterpret_cast<WINDOWPOS*>(lParam); 1607 WINDOWPOS* wndPos = reinterpret_cast<WINDOWPOS*>(lParam);
1600 if (wndPos->flags & SWP_HIDEWINDOW) 1608 if (wndPos->flags & SWP_HIDEWINDOW)
1601 { 1609 {
1602 pClass->notificationMessage.Hide(); 1610 pClass->notificationMessage.Hide();
1603 } 1611 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 s_criticalSectionLocal.Unlock(); 1704 s_criticalSectionLocal.Unlock();
1697 1705
1698 return icon; 1706 return icon;
1699 } 1707 }
1700 1708
1701 ATOM CPluginClass::GetAtomPaneClass() 1709 ATOM CPluginClass::GetAtomPaneClass()
1702 { 1710 {
1703 return s_atomPaneClass; 1711 return s_atomPaneClass;
1704 } 1712 }
1705 1713
OLDNEW
« no previous file with comments | « src/plugin/NotificationMessage.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld