Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Windows 64 build #664

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,25 +91,45 @@ module.exports = function (grunt) {
"src" : "<%= icu.url %>/icu_<%= icu.version %>_macosx64.zip"
},
/* win */
"cef-win": {
"cef-win32": {
"dest" : "<%= downloads %>",
"src" : "<%= cef.url %>/cef_binary_<%= cef.version %>_windows32.zip"
},
"cef-win-symbols": {
"cef-win32-symbols": {
"src" : ["<%= cef.url %>/cef_binary_<%= cef.version %>_windows32_debug_symbols.zip", "<%= cef.url %>/cef_binary_<%= cef.version %>_windows32_release_symbols.zip"],
"dest" : "<%= downloads %>/cefsymbols"
},
"node-win": {
"node-win32": {
"dest" : "<%= downloads %>",
"src" : "http://nodejs.org/dist/v<%= node.version %>/win-x86/node.exe"
},
"icu-win": {
"icu-win32": {
"dest" : "<%= downloads %>",
"src" : "<%= icu.url %>/icu_<%= icu.version %>_windows32.zip"
},
"vs-crt-win": {
"vs-crt-win32": {
"dest" : "<%= downloads %>",
"src" : "<%= vsCrt.url %>/vs<%= vsCrt.version %>-crt-ia32.zip"
},
"cef-win64": {
"dest" : "<%= downloads %>",
"src" : "<%= cef.url %>/cef_binary_<%= cef.version %>_windows64.zip"
},
"cef-win64-symbols": {
"src" : ["<%= cef.url %>/cef_binary_<%= cef.version %>_windows64_debug_symbols.zip", "<%= cef.url %>/cef_binary_<%= cef.version %>_windows64_release_symbols.zip"],
"dest" : "<%= downloads %>/cefsymbols"
},
"node-win64": {
"dest" : "<%= downloads %>",
"src" : "http://nodejs.org/dist/v<%= node.version %>/win-x64/node.exe"
},
"icu-win64": {
"dest" : "<%= downloads %>",
"src" : "<%= icu.url %>/icu_<%= icu.version %>_windows64.zip"
},
"vs-crt-win64": {
"dest" : "<%= downloads %>",
"src" : "<%= vsCrt.url %>/vs<%= vsCrt.version %>-crt-x64.zip"
}
},
"clean": {
Expand Down
10 changes: 6 additions & 4 deletions appshell/appshell_extension_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ CefRefPtr<CefV8Value> ListValueToV8Value(CefRefPtr<CefListValue> value, int inde
switch (type) {
case VTYPE_LIST: {
CefRefPtr<CefListValue> list = value->GetList(index);
new_value = CefV8Value::CreateArray(list->GetSize());
std::make_signed<size_t>::type theSize = list->GetSize();
new_value = CefV8Value::CreateArray(theSize);
SetList(list, new_value);
} break;
case VTYPE_BOOL:
Expand Down Expand Up @@ -106,7 +107,8 @@ void SetListValue(CefRefPtr<CefV8Value> list, int index,
switch (type) {
case VTYPE_LIST: {
CefRefPtr<CefListValue> listValue = value->GetList(index);
new_value = CefV8Value::CreateArray(listValue->GetSize());
std::make_signed<size_t>::type theSize = listValue->GetSize();
new_value = CefV8Value::CreateArray(theSize);
SetList(listValue, new_value);
} break;
case VTYPE_BOOL:
Expand Down Expand Up @@ -136,11 +138,11 @@ void SetListValue(CefRefPtr<CefV8Value> list, int index,
void SetList(CefRefPtr<CefListValue> source, CefRefPtr<CefV8Value> target) {
DCHECK(target->IsArray());

int arg_length = source->GetSize();
std::make_signed<size_t>::type arg_length = source->GetSize();
if (arg_length == 0)
return;

for (int i = 0; i < arg_length; ++i)
for (decltype(arg_length) i = 0; i < arg_length; ++i)
SetListValue(target, i, source);
}

Expand Down
6 changes: 3 additions & 3 deletions appshell/appshell_extensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,8 +811,8 @@ class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate {
ReadDir(path, dirContents);

// Now we iterator through the contents of directoryContents.
size_t theSize = dirContents->GetSize();
for ( size_t iFileEntry = 0; iFileEntry < theSize ; ++iFileEntry) {
std::make_signed<size_t>::type theSize = dirContents->GetSize();
for (decltype(theSize) iFileEntry = 0; iFileEntry < theSize ; ++iFileEntry) {
CefRefPtr<CefListValue> fileStats = CefListValue::Create();

#ifdef OS_WIN
Expand All @@ -821,7 +821,7 @@ class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate {
ExtensionString theFile = path + "/";
#endif

ExtensionString fileName = dirContents->GetString(iFileEntry);
ExtensionString fileName = dirContents->GetString(iFileEntry).ToWString();
theFile = theFile + fileName;

ExtensionString realPath;
Expand Down
2 changes: 1 addition & 1 deletion appshell/appshell_extensions_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void CharSetDetect::operator()(const char* bufferData, size_t bufferLength, std:
const UCharsetMatch* charsetMatch_;

// send text
ucsdet_setText(m_charsetDetector_, bufferData, bufferLength, &error);
ucsdet_setText(m_charsetDetector_, bufferData, static_cast<int32_t>(bufferLength), &error);
if (U_FAILURE(error))
throw "Failed to set text";

Expand Down
59 changes: 34 additions & 25 deletions appshell/appshell_extensions_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include "appshell/appshell_helpers.h"
#include "native_menu_model.h"
#include "cef_window.h"

#include <algorithm>
#include <CommDlg.h>
Expand Down Expand Up @@ -278,7 +279,7 @@ void CALLBACK LiveBrowserMgrWin::CloseLiveBrowserAsyncCallback( HWND hwnd, UINT
}
else if(s_instance->m_closeLiveBrowserHeartbeatTimerId == 0){
//start a heartbeat timer to see if it closes after the message returned
s_instance->m_closeLiveBrowserHeartbeatTimerId = ::SetTimer(NULL, 0, 30, CloseLiveBrowserTimerCallback);
s_instance->m_closeLiveBrowserHeartbeatTimerId = ::SetTimer(NULL, 0, 30, from_cpp20::bit_cast<TIMERPROC>(&CloseLiveBrowserTimerCallback));
}
}

Expand Down Expand Up @@ -356,7 +357,7 @@ int32 OpenLiveBrowser(ExtensionString argURL, bool enableRemoteDebugging)
args += argURL;

// Args must be mutable
int argsBufSize = args.length() +1;
std::make_signed<size_t>::type argsBufSize = args.length(); ++argsBufSize;
std::vector<WCHAR> argsBuf;
argsBuf.resize(argsBufSize);
wcscpy(&argsBuf[0], args.c_str());
Expand Down Expand Up @@ -399,13 +400,13 @@ void CloseLiveBrowser(CefRefPtr<CefBrowser> browser, CefRefPtr<CefProcessMessage
liveBrowserMgr->CloseLiveBrowserFireCallback(NO_ERROR);
} else if (liveBrowserMgr->GetCloseCallback()) {
// set a timeout for up to 10 seconds to close the browser
liveBrowserMgr->SetCloseTimeoutTimerId( ::SetTimer(NULL, 0, 10 * 1000, LiveBrowserMgrWin::CloseLiveBrowserTimerCallback) );
liveBrowserMgr->SetCloseTimeoutTimerId( ::SetTimer(NULL, 0, 10 * 1000, from_cpp20::bit_cast<TIMERPROC>(&LiveBrowserMgrWin::CloseLiveBrowserTimerCallback)) );
}
}

int32 OpenURLInDefaultBrowser(ExtensionString url)
{
DWORD result = (DWORD)ShellExecute(NULL, L"open", url.c_str(), NULL, NULL, SW_SHOWNORMAL);
DWORD_PTR result = from_cpp20::bit_cast<DWORD_PTR>(ShellExecute(NULL, L"open", url.c_str(), NULL, NULL, SW_SHOWNORMAL));

// If the result > 32, the function suceeded. If the result is <= 32, it is an
// error code.
Expand Down Expand Up @@ -498,7 +499,8 @@ int32 ShowOpenDialog(bool allowMultipleSelection,
} else {
// Multiple files are selected
wchar_t fullPath[MAX_UNC_PATH];
for (int i = (dir.length() + 1), fileIndex = 0; ; fileIndex++) {
std::make_signed<size_t>::type dirLen = dir.length();
for (decltype(dirLen) i = dirLen + 1, fileIndex = 0; /* Infinite loop */ ; fileIndex++) {
// Get the next file name
std::wstring file(&szFile[i]);

Expand All @@ -515,7 +517,8 @@ int32 ShowOpenDialog(bool allowMultipleSelection,
}

// Go to the start of the next file name
i += file.length() + 1;
std::make_signed<size_t>::type fileLen = file.length();
i += fileLen + 1;
}
}

Expand Down Expand Up @@ -616,11 +619,17 @@ int32 ReadDir(ExtensionString path, CefRefPtr<CefListValue>& directoryContents)
}

// On Windows, list directories first, then files
size_t i, total = 0;
for (i = 0; i < resultDirs.size(); i++)
directoryContents->SetString(total++, resultDirs[i]);
for (i = 0; i < resultFiles.size(); i++)
directoryContents->SetString(total++, resultFiles[i]);
std::make_signed<size_t>::type total = 0;
{
std::make_signed<size_t>::type resultDirSize = resultDirs.size();
for (decltype(resultDirSize) i = 0; i < resultDirSize; ++i)
directoryContents->SetString(total++, resultDirs[i]);
}
{
std::make_signed<size_t>::type resultFileSize = resultFiles.size();
for (decltype(resultFileSize) i = 0; i < resultFileSize; ++i)
directoryContents->SetString(total++, resultFiles[i]);
}

return NO_ERROR;
}
Expand Down Expand Up @@ -885,7 +894,7 @@ static void CharSetToWide(const std::string &aString, long codePage, std::wstrin
int aUTF16Length = ::MultiByteToWideChar(codePage, // get destination buffer length
0,
aString.data(),
aString.size(),
static_cast<int>(aString.size()),
NULL,
NULL);

Expand All @@ -896,7 +905,7 @@ static void CharSetToWide(const std::string &aString, long codePage, std::wstrin
int wcharsWritten = ::MultiByteToWideChar(codePage,
0,
aString.data(),
aString.size(),
static_cast<int>(aString.size()),
buf.get(),
aUTF16Length);

Expand Down Expand Up @@ -1025,7 +1034,7 @@ static void WideToCharSet(const std::wstring &aUTF16string, long codePage, std::
int aUTF8Length = ::WideCharToMultiByte(codePage,
0,
aUTF16string.data(),
aUTF16string.size(),
static_cast<int>(aUTF16string.size()),
NULL,
0,
NULL,
Expand All @@ -1037,7 +1046,7 @@ static void WideToCharSet(const std::wstring &aUTF16string, long codePage, std::
int bytesWritten = ::WideCharToMultiByte(codePage,
0,
aUTF16string.data(),
aUTF16string.size(),
static_cast<int>(aUTF16string.size()),
buf.get(),
aUTF8Length,
NULL,
Expand Down Expand Up @@ -1084,7 +1093,7 @@ int32 WriteFile(ExtensionString filename, std::string contents, ExtensionString
return ConvertWinErrorCode(GetLastError(), false);

// TODO (issue 67) - Should write to temp file
if (!WriteFile(hFile, contents.c_str(), contents.length(), &dwBytesWritten, NULL)) {
if (!WriteFile(hFile, contents.c_str(), static_cast<DWORD>(contents.length()), &dwBytesWritten, NULL)) {
error = ConvertWinErrorCode(GetLastError(), false);
}

Expand Down Expand Up @@ -1208,8 +1217,8 @@ bool isSlash(ExtensionString::value_type wc) { return wc == '/' || wc == '\\'; }

void RemoveTrailingSlash(ExtensionString& filename)
{
int last = filename.length() - 1;
if ((last >= 0) && isSlash(filename.at(last))) {
std::make_signed<size_t>::type last = filename.length();
if ((--last >= 0) && isSlash(filename.at(last))) {
filename.erase(last);
}
}
Expand Down Expand Up @@ -1286,7 +1295,7 @@ int32 ShowFolderInOSWindow(ExtensionString pathname) {

} else {
// File: open its containing folder with this file selected
ITEMIDLIST *pidl = ILCreateFromPath(pathname.c_str());
auto pidl = ILCreateFromPath(pathname.c_str());
if (pidl) {
SHOpenFolderAndSelectItems(pidl,0,0,0);
ILFree(pidl);
Expand Down Expand Up @@ -1519,7 +1528,7 @@ int32 AddMenu(CefRefPtr<CefBrowser> browser, ExtensionString itemTitle, Extensio
menuInfo.fType = MFT_STRING;
#endif
menuInfo.dwTypeData = (LPWSTR)itemTitle.c_str();
menuInfo.cch = itemTitle.size();
menuInfo.cch = static_cast<decltype(menuInfo.cch)>(itemTitle.size());

if (positionIdx == kAppend) {
if (!InsertMenuItem(mainMenu, -1, TRUE, &menuInfo)) {
Expand Down Expand Up @@ -1552,7 +1561,7 @@ bool canBeUsedAsShortcutKey(int unicode)

bool UpdateAcceleratorTable(int32 tag, ExtensionString& keyStr)
{
int keyStrLen = keyStr.length();
int keyStrLen = static_cast<int>(keyStr.length());
if (keyStrLen) {
LPACCEL lpaccelNew; // pointer to new accelerator table
HACCEL haccelOld; // handle to old accelerator table
Expand Down Expand Up @@ -1827,7 +1836,7 @@ int32 AddMenuItem(CefRefPtr<CefBrowser> browser, ExtensionString parentCommand,
menuInfo.fType = MFT_SEPARATOR;
}
menuInfo.dwTypeData = (LPWSTR)title.c_str();
menuInfo.cch = itemTitle.size();
menuInfo.cch = static_cast<decltype(menuInfo.cch)>(itemTitle.size());
if (positionIdx >= 0) {
InsertMenuItem(submenu, positionIdx, TRUE, &menuInfo);
inserted = true;
Expand Down Expand Up @@ -2007,15 +2016,15 @@ int32 SetMenuTitle(CefRefPtr<CefBrowser> browser, ExtensionString command, Exten
#endif
menuInfo.dwTypeData = (LPWSTR)newTitle.c_str();
menuInfo.hSubMenu = itemInfo.hSubMenu;
menuInfo.cch = newTitle.size();
menuInfo.cch = static_cast<decltype(menuInfo.cch)>(newTitle.size());

InsertMenuItem(mainMenu, position, TRUE, &menuInfo);
}

} else {
itemInfo.fType = MFT_STRING; // just to make sure
itemInfo.dwTypeData = (LPWSTR)newTitle.c_str();
itemInfo.cch = newTitle.size();
itemInfo.cch = static_cast<decltype(itemInfo.cch)>(newTitle.size());
if (!SetMenuItemInfo(menu, tag, FALSE, &itemInfo)) {
return ConvertErrnoCode(GetLastError());
}
Expand Down Expand Up @@ -2115,7 +2124,7 @@ int32 SetMenuItemShortcut(CefRefPtr<CefBrowser> browser, ExtensionString command

itemInfo.fType = MFT_STRING; // just to make sure
itemInfo.dwTypeData = (LPWSTR)titleStr.c_str();
itemInfo.cch = titleStr.size();
itemInfo.cch = static_cast<decltype(itemInfo.cch)>(titleStr.size());

if (!SetMenuItemInfo(menu, tag, FALSE, &itemInfo)) {
return ConvertErrnoCode(GetLastError());
Expand Down
2 changes: 1 addition & 1 deletion appshell/appshell_node_process_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void sendData(const std::string &data) {
BOOL bSuccess = FALSE;
dwWaitResult = WaitForSingleObject(hNodeMutex, INFINITE);
if (dwWaitResult == WAIT_OBJECT_0) { // got the mutex
bSuccess = WriteFile(g_hChildStd_IN_Wr, data.c_str(), data.length(), &dwWritten, NULL);
bSuccess = WriteFile(g_hChildStd_IN_Wr, data.c_str(), static_cast<int>(data.length()), &dwWritten, NULL);
ReleaseMutex(hNodeMutex);
if (!bSuccess) {
// Failed to write, there's something wrong with this process.
Expand Down
10 changes: 5 additions & 5 deletions appshell/cef_dark_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,11 +509,11 @@ void cef_dark_window::DoDrawSystemMenuIcon(HDC hdc)

// Start with the small
if (!mWindowIcon)
mWindowIcon = reinterpret_cast<HICON>(GetClassLongPtr(GCLP_HICONSM));
mWindowIcon = from_cpp20::bit_cast<HICON>(GetClassLongPtr(GCLP_HICONSM));

// Then try to load the big icon
if (!mWindowIcon)
mWindowIcon = reinterpret_cast<HICON>(GetClassLongPtr(GCLP_HICON));
mWindowIcon = from_cpp20::bit_cast<HICON>(GetClassLongPtr(GCLP_HICON));

// Otherwise we need an icon, so just use the standard Windows default
// application Icon which may very between versions
Expand Down Expand Up @@ -554,7 +554,7 @@ void cef_dark_window::DoDrawTitlebarText(HDC hdc)
// Figure out how much space we need to draw ethe whole thing
RECT rectTemp;
::SetRectEmpty(&rectTemp);
::DrawText(hdc, szCaption, ::wcslen(szCaption), &rectTemp, DT_SINGLELINE|DT_CALCRECT|DT_NOPREFIX);
::DrawText(hdc, szCaption, static_cast<int>(::wcslen(szCaption)), &rectTemp, DT_SINGLELINE|DT_CALCRECT|DT_NOPREFIX);

// Can it be centered within the window?
if (((::RectWidth(windowRect) / 2) + (::RectWidth(rectTemp) / 2) + 1) < textRect.right) {
Expand Down Expand Up @@ -945,7 +945,7 @@ BOOL cef_dark_window::HandleMeasureItem(LPMEASUREITEMSTRUCT lpMIS)
SetRectEmpty(&rectTemp);

// Calc the size of this menu item
::DrawText(dc, szMenuString, ::wcslen(szMenuString), &rectTemp, DT_SINGLELINE|DT_CALCRECT);
::DrawText(dc, szMenuString, static_cast<int>(::wcslen(szMenuString)), &rectTemp, DT_SINGLELINE|DT_CALCRECT);

lpMIS->itemHeight = ::RectHeight(rectTemp);
lpMIS->itemWidth = ::RectWidth(rectTemp);
Expand Down Expand Up @@ -999,7 +999,7 @@ BOOL cef_dark_window::HandleDrawItem(LPDRAWITEMSTRUCT lpDIS)

int oldBkMode = ::SetBkMode(lpDIS->hDC, TRANSPARENT);

::DrawText(lpDIS->hDC, szMenuString, ::wcslen(szMenuString), &lpDIS->rcItem, format);
::DrawText(lpDIS->hDC, szMenuString, static_cast<int>(::wcslen(szMenuString)), &lpDIS->rcItem, format);

::SelectObject(lpDIS->hDC, fontOld);
::SetBkMode(lpDIS->hDC, oldBkMode);
Expand Down
2 changes: 1 addition & 1 deletion appshell/cef_host_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ BOOL cef_host_window::HandleSize(BOOL bMinimize)
if (GetProp(L"WasMinimized")) {
DoRepaintClientArea();
}
SetProp(L"WasMinimized", (HANDLE)bMinimize);
SetPropW(L"WasMinimized", from_cpp20::bit_cast<HANDLE>(&bMinimize));
#endif
NotifyWindowMovedOrResized();
return FALSE;
Expand Down
2 changes: 1 addition & 1 deletion appshell/cef_main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ BOOL cef_main_window::HandleClose()
CefWindowHandle hwnd = SafeGetCefBrowserHwnd();
if (hwnd)
{
BOOL closing = (BOOL)::GetProp(hwnd, ::kCefWindowClosingPropName);
DWORD_PTR closing = from_cpp20::bit_cast<DWORD_PTR>(::GetProp(hwnd, ::kCefWindowClosingPropName));
if (closing)
{
if (!g_handler->CanCloseBrowser(GetBrowser())) {
Expand Down
2 changes: 1 addition & 1 deletion appshell/cef_registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void EnsureTrailingSeparator(LPWSTR pRet)
if (!pRet)
return;

int len = wcslen(pRet);
std::make_signed<size_t>::type len = wcslen(pRet);
if (len > 0 && wcscmp(&(pRet[len-1]), L"\\") != 0)
{
wcscat(pRet, L"\\");
Expand Down
Loading