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

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

Issue 11449051: Fix 64-bit conversion errors (Closed)
Patch Set: Created Aug. 16, 2013, 2:56 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/engine/UpdateInstallDialog.cpp ('k') | src/plugin/PluginUserSettings.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginClass.h" 3 #include "PluginClass.h"
4 #include "PluginSettings.h" 4 #include "PluginSettings.h"
5 #include "PluginSystem.h" 5 #include "PluginSystem.h"
6 #ifdef SUPPORT_FILTER 6 #ifdef SUPPORT_FILTER
7 #include "PluginFilter.h" 7 #include "PluginFilter.h"
8 #endif 8 #endif
9 #include "PluginMimeFilterClient.h" 9 #include "PluginMimeFilterClient.h"
10 #include "PluginClient.h" 10 #include "PluginClient.h"
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 m_hTabWnd = hTabWnd; 982 m_hTabWnd = hTabWnd;
983 m_hStatusBarWnd = hWndStatusBar; 983 m_hStatusBarWnd = hWndStatusBar;
984 m_hPaneWnd = hWndNewPane; 984 m_hPaneWnd = hWndNewPane;
985 985
986 UpdateTheme(); 986 UpdateTheme();
987 987
988 // Subclass status bar 988 // Subclass status bar
989 m_pWndProcStatus = (WNDPROC)SetWindowLongPtr(hWndStatusBar, GWLP_WNDPROC, (LPA RAM)(WNDPROC)NewStatusProc); 989 m_pWndProcStatus = (WNDPROC)SetWindowLongPtr(hWndStatusBar, GWLP_WNDPROC, (LPA RAM)(WNDPROC)NewStatusProc);
990 990
991 // Adjust pane 991 // Adjust pane
992 UINT nPartCount = ::SendMessage(m_hStatusBarWnd, SB_GETPARTS, 0, 0); 992 LRESULT nPartCount = ::SendMessage(m_hStatusBarWnd, SB_GETPARTS, 0, 0);
993 993
994 if (nPartCount > 1) 994 if (nPartCount > 1)
995 { 995 {
996 INT *pData = new INT[nPartCount]; 996 INT *pData = new INT[nPartCount];
997 997
998 ::SendMessage(m_hStatusBarWnd, SB_GETPARTS, nPartCount, (LPARAM)pData); 998 ::SendMessage(m_hStatusBarWnd, SB_GETPARTS, nPartCount, (LPARAM)pData);
999 ::SendMessage(m_hStatusBarWnd, SB_SETPARTS, nPartCount, (LPARAM)pData); 999 ::SendMessage(m_hStatusBarWnd, SB_SETPARTS, nPartCount, (LPARAM)pData);
1000 1000
1001 delete[] pData; 1001 delete[] pData;
1002 } 1002 }
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 if (client->IsWhitelistedUrl(std::wstring(GetTab()->GetDocumentUrl()))) 1383 if (client->IsWhitelistedUrl(std::wstring(GetTab()->GetDocumentUrl())))
1384 { 1384 {
1385 fmii.fState = MFS_CHECKED | MFS_ENABLED; 1385 fmii.fState = MFS_CHECKED | MFS_ENABLED;
1386 } 1386 }
1387 else 1387 else
1388 { 1388 {
1389 fmii.fState = MFS_UNCHECKED | MFS_ENABLED; 1389 fmii.fState = MFS_UNCHECKED | MFS_ENABLED;
1390 } 1390 }
1391 fmii.fMask = MIIM_STRING | MIIM_STATE; 1391 fmii.fMask = MIIM_STRING | MIIM_STATE;
1392 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str()); 1392 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str());
1393 fmii.cch = ctext.size(); 1393 fmii.cch = static_cast<UINT>(ctext.size());
1394 1394
1395 ::SetMenuItemInfoW(hMenu, ID_MENU_DISABLE_ON_SITE, FALSE, &fmii); 1395 ::SetMenuItemInfoW(hMenu, ID_MENU_DISABLE_ON_SITE, FALSE, &fmii);
1396 } 1396 }
1397 #else 1397 #else
1398 { 1398 {
1399 ::DeleteMenu(hMenu, ID_MENU_DISABLE_ON_SITE, FALSE); 1399 ::DeleteMenu(hMenu, ID_MENU_DISABLE_ON_SITE, FALSE);
1400 } 1400 }
1401 #endif // SUPPORT_WHITELIST 1401 #endif // SUPPORT_WHITELIST
1402 1402
1403 // Plugin update 1403 // Plugin update
1404 ctext = dictionary->Lookup("menu", "menu-update"); 1404 ctext = dictionary->Lookup("menu", "menu-update");
1405 fmii.fMask = MIIM_STATE | MIIM_STRING; 1405 fmii.fMask = MIIM_STATE | MIIM_STRING;
1406 fmii.fState = client ? MFS_ENABLED : MFS_DISABLED; 1406 fmii.fState = client ? MFS_ENABLED : MFS_DISABLED;
1407 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str()); 1407 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str());
1408 fmii.cch = ctext.size(); 1408 fmii.cch = static_cast<UINT>(ctext.size());
1409 ::SetMenuItemInfoW(hMenu, ID_MENU_UPDATE, FALSE, &fmii); 1409 ::SetMenuItemInfoW(hMenu, ID_MENU_UPDATE, FALSE, &fmii);
1410 1410
1411 1411
1412 // Plugin enable 1412 // Plugin enable
1413 ctext = dictionary->Lookup("menu", "menu-disable"); 1413 ctext = dictionary->Lookup("menu", "menu-disable");
1414 if (settings->GetPluginEnabled()) 1414 if (settings->GetPluginEnabled())
1415 { 1415 {
1416 fmii.fState = MFS_UNCHECKED | MFS_ENABLED; 1416 fmii.fState = MFS_UNCHECKED | MFS_ENABLED;
1417 } 1417 }
1418 else 1418 else
1419 { 1419 {
1420 fmii.fState = MFS_CHECKED | MFS_ENABLED; 1420 fmii.fState = MFS_CHECKED | MFS_ENABLED;
1421 } 1421 }
1422 fmii.fMask = MIIM_STATE | MIIM_STRING; 1422 fmii.fMask = MIIM_STATE | MIIM_STRING;
1423 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str()); 1423 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str());
1424 fmii.cch = ctext.size(); 1424 fmii.cch = static_cast<UINT>(ctext.size());
1425 ::SetMenuItemInfoW(hMenu, ID_MENU_DISABLE, FALSE, &fmii); 1425 ::SetMenuItemInfoW(hMenu, ID_MENU_DISABLE, FALSE, &fmii);
1426 1426
1427 // Settings 1427 // Settings
1428 ctext = dictionary->Lookup("menu", "menu-settings"); 1428 ctext = dictionary->Lookup("menu", "menu-settings");
1429 fmii.fMask = MIIM_STATE | MIIM_STRING; 1429 fmii.fMask = MIIM_STATE | MIIM_STRING;
1430 fmii.fState = MFS_ENABLED; 1430 fmii.fState = MFS_ENABLED;
1431 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str()); 1431 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str());
1432 fmii.cch = ctext.size(); 1432 fmii.cch = static_cast<UINT>(ctext.size());
1433 ::SetMenuItemInfoW(hMenu, ID_MENU_SETTINGS, FALSE, &fmii); 1433 ::SetMenuItemInfoW(hMenu, ID_MENU_SETTINGS, FALSE, &fmii);
1434 1434
1435 return true; 1435 return true;
1436 } 1436 }
1437 1437
1438 1438
1439 STDMETHODIMP CPluginClass::Exec(const GUID*, DWORD nCmdID, DWORD, VARIANTARG*, V ARIANTARG*) 1439 STDMETHODIMP CPluginClass::Exec(const GUID*, DWORD nCmdID, DWORD, VARIANTARG*, V ARIANTARG*)
1440 { 1440 {
1441 HWND hBrowserWnd = GetBrowserHWND(); 1441 HWND hBrowserWnd = GetBrowserHWND();
1442 if (!hBrowserWnd) 1442 if (!hBrowserWnd)
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 break; 1545 break;
1546 } 1546 }
1547 1547
1548 case SB_SETPARTS: 1548 case SB_SETPARTS:
1549 { 1549 {
1550 if (!lParam || !wParam || wParam > 30 || !IsWindow(pClass->m_hPaneWnd)) 1550 if (!lParam || !wParam || wParam > 30 || !IsWindow(pClass->m_hPaneWnd))
1551 { 1551 {
1552 return CallWindowProc(pClass->m_pWndProcStatus, hWnd, message, wParam, l Param); 1552 return CallWindowProc(pClass->m_pWndProcStatus, hWnd, message, wParam, l Param);
1553 } 1553 }
1554 1554
1555 int nParts = wParam; 1555 int nParts = static_cast<int>(wParam);
Wladimir Palant 2013/08/17 09:10:07 Do we need a cast here? From the look of it, using
Felix Dahlke 2013/08/17 09:23:29 It's not necessary, we can do numerical comparison
Felix Dahlke 2013/08/17 09:23:29 Yes, the cast is not strictly speaking necessary,
Wladimir Palant 2013/08/17 09:43:04 Well, WPARAM is still a number type even though it
1556 if (STATUSBAR_PANE_NUMBER >= nParts) 1556 if (STATUSBAR_PANE_NUMBER >= nParts)
1557 { 1557 {
1558 return CallWindowProc(pClass->m_pWndProcStatus, hWnd, message, wParam, l Param); 1558 return CallWindowProc(pClass->m_pWndProcStatus, hWnd, message, wParam, l Param);
1559 } 1559 }
1560 1560
1561 HLOCAL hLocal = LocalAlloc(LHND, sizeof(int) * (nParts+1)); 1561 HLOCAL hLocal = LocalAlloc(LHND, sizeof(int) * (nParts+1));
1562 LPINT lpParts = (LPINT)LocalLock(hLocal); 1562 LPINT lpParts = (LPINT)LocalLock(hLocal);
1563 memcpy(lpParts, (void*)lParam, wParam*sizeof(int)); 1563 memcpy(lpParts, (void*)lParam, wParam*sizeof(int));
1564 1564
1565 for (unsigned i = 0; i < STATUSBAR_PANE_NUMBER; i++) 1565 for (unsigned i = 0; i < STATUSBAR_PANE_NUMBER; i++)
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1917 } 1917 }
1918 } 1918 }
1919 } 1919 }
1920 1920
1921 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); 1921 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT);
1922 } 1922 }
1923 1923
1924 return hTabWnd; 1924 return hTabWnd;
1925 1925
1926 } 1926 }
OLDNEW
« no previous file with comments | « src/engine/UpdateInstallDialog.cpp ('k') | src/plugin/PluginUserSettings.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld