mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 945245 - Fixed misc char16_t/wchar_t mismatches. r=ehsan
--HG-- extra : rebase_source : fcab74b295b513f4185cf9c12f31ebaddb7c8e0e
This commit is contained in:
parent
74601a78d4
commit
c6f4ebd28d
@ -20,7 +20,7 @@ using namespace mozilla::a11y;
|
||||
bool
|
||||
IsModuleVersionLessThan(HMODULE aModuleHandle, DWORD aMajor, DWORD aMinor)
|
||||
{
|
||||
PRUnichar fileName[MAX_PATH];
|
||||
wchar_t fileName[MAX_PATH];
|
||||
::GetModuleFileNameW(aModuleHandle, fileName, MAX_PATH);
|
||||
|
||||
DWORD dummy = 0;
|
||||
|
@ -22,7 +22,7 @@ using namespace mozilla::a11y;
|
||||
|
||||
// Window property used by ipc related code in identifying accessible
|
||||
// tab windows.
|
||||
const PRUnichar* kPropNameTabContent = L"AccessibleTabWindow";
|
||||
const wchar_t* kPropNameTabContent = L"AccessibleTabWindow";
|
||||
|
||||
/**
|
||||
* WindowProc to process WM_GETOBJECT messages, used in windows emulation mode.
|
||||
|
@ -185,7 +185,7 @@ sdnAccessible::get_attributesForNames(unsigned short aMaxAttribs,
|
||||
if (aAttribNames[index]) {
|
||||
nsAutoString attributeValue, nameSpaceURI;
|
||||
nsAutoString attributeName(nsDependentString(
|
||||
static_cast<PRUnichar*>(aAttribNames[index])));
|
||||
static_cast<const wchar_t*>(aAttribNames[index])));
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (aNameSpaceID[index]>0 &&
|
||||
@ -282,8 +282,7 @@ sdnAccessible::get_computedStyleForProperties(unsigned short aNumStyleProperties
|
||||
for (index = 0; index < aNumStyleProperties; index++) {
|
||||
nsAutoString value;
|
||||
if (aStyleProperties[index])
|
||||
cssDecl->GetPropertyValue(nsDependentString(static_cast<PRUnichar*>(
|
||||
aStyleProperties[index])), value); // Get property value
|
||||
cssDecl->GetPropertyValue(nsDependentString(aStyleProperties[index]), value); // Get property value
|
||||
aStyleValues[index] = ::SysAllocString(value.get());
|
||||
}
|
||||
|
||||
|
@ -410,7 +410,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
|
||||
// otherwise.
|
||||
*aIsDefaultBrowser = true;
|
||||
|
||||
PRUnichar exePath[MAX_BUF];
|
||||
wchar_t exePath[MAX_BUF];
|
||||
if (!::GetModuleFileNameW(0, exePath, MAX_BUF))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -424,7 +424,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
|
||||
HKEY theKey;
|
||||
DWORD res;
|
||||
nsresult rv;
|
||||
PRUnichar currValue[MAX_BUF];
|
||||
wchar_t currValue[MAX_BUF];
|
||||
|
||||
SETTING* settings = gSettings;
|
||||
if (!aForAllTypes && IsWin8OrLater()) {
|
||||
@ -611,7 +611,7 @@ DynSHOpenWithDialog(HWND hwndParent, const OPENASINFO *poainfo)
|
||||
|
||||
// shell32.dll is in the knownDLLs list so will always be loaded from the
|
||||
// system32 directory.
|
||||
static const PRUnichar kSehllLibraryName[] = L"shell32.dll";
|
||||
static const wchar_t kSehllLibraryName[] = L"shell32.dll";
|
||||
HMODULE shellDLL = ::LoadLibraryW(kSehllLibraryName);
|
||||
if (!shellDLL) {
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -967,7 +967,7 @@ nsWindowsShellService::OpenApplication(int32_t aApplication)
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
PRUnichar buf[MAX_BUF];
|
||||
wchar_t buf[MAX_BUF];
|
||||
DWORD type, len = sizeof buf;
|
||||
DWORD res = ::RegQueryValueExW(theKey, EmptyString().get(), 0,
|
||||
&type, (LPBYTE)&buf, &len);
|
||||
@ -1068,7 +1068,7 @@ nsWindowsShellService::SetDesktopBackgroundColor(uint32_t aColor)
|
||||
nsIWindowsRegKey::ACCESS_SET_VALUE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRUnichar rgb[12];
|
||||
wchar_t rgb[12];
|
||||
_snwprintf(rgb, 12, L"%u %u %u", r, g, b);
|
||||
|
||||
rv = regKey->WriteStringValue(NS_LITERAL_STRING("Background"),
|
||||
|
@ -11403,9 +11403,7 @@ nsIDocument::WrapObject(JSContext *aCx, JS::Handle<JSObject*> aScope)
|
||||
|
||||
NS_NAMED_LITERAL_STRING(doc_str, "document");
|
||||
|
||||
if (!JS_DefineUCProperty(aCx, JSVAL_TO_OBJECT(winVal),
|
||||
reinterpret_cast<const jschar *>
|
||||
(doc_str.get()),
|
||||
if (!JS_DefineUCProperty(aCx, JSVAL_TO_OBJECT(winVal), doc_str.get(),
|
||||
doc_str.Length(), JS::ObjectValue(*obj),
|
||||
JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JSPROP_READONLY | JSPROP_ENUMERATE)) {
|
||||
|
@ -304,9 +304,7 @@ nsXBLProtoImpl::ResolveAllFields(JSContext *cx, JS::Handle<JSObject*> obj) const
|
||||
// all.
|
||||
nsDependentString name(f->GetName());
|
||||
JS::Rooted<JS::Value> dummy(cx);
|
||||
if (!::JS_LookupUCProperty(cx, obj,
|
||||
reinterpret_cast<const jschar*>(name.get()),
|
||||
name.Length(), &dummy)) {
|
||||
if (!::JS_LookupUCProperty(cx, obj, name.get(), name.Length(), &dummy)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -321,7 +319,7 @@ nsXBLProtoImpl::UndefineFields(JSContext *cx, JS::Handle<JSObject*> obj) const
|
||||
for (nsXBLProtoImplField* f = mFields; f; f = f->GetNext()) {
|
||||
nsDependentString name(f->GetName());
|
||||
|
||||
const jschar* s = reinterpret_cast<const jschar*>(name.get());
|
||||
const jschar* s = name.get();
|
||||
bool hasProp;
|
||||
if (::JS_AlreadyHasOwnUCProperty(cx, obj, s, name.Length(), &hasProp) &&
|
||||
hasProp) {
|
||||
|
@ -494,5 +494,5 @@ nsXBLProtoImplField::Write(nsIObjectOutputStream* aStream)
|
||||
rv = aStream->Write32(mLineNumber);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return aStream->WriteWStringZ(mFieldText ? mFieldText : EmptyString().get());
|
||||
return aStream->WriteWStringZ(mFieldText ? mFieldText : MOZ_UTF16(""));
|
||||
}
|
||||
|
@ -1009,5 +1009,5 @@ nsXBLPrototypeHandler::Write(nsIObjectOutputStream* aStream)
|
||||
|
||||
rv = aStream->Write32(mLineNumber);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return aStream->WriteWStringZ(mHandlerText ? mHandlerText : EmptyString().get());
|
||||
return aStream->WriteWStringZ(mHandlerText ? mHandlerText : MOZ_UTF16(""));
|
||||
}
|
||||
|
@ -688,7 +688,7 @@ static HGLOBAL CreateGlobalDevModeAndInit(const nsXPIDLString& aPrintName, nsIPr
|
||||
|
||||
HANDLE hPrinter = nullptr;
|
||||
// const cast kludge for silly Win32 api's
|
||||
LPWSTR printName = const_cast<wchar_t*>(aPrintName.get());
|
||||
LPWSTR printName = const_cast<wchar_t*>(static_cast<const wchar_t*>(aPrintName.get()));
|
||||
BOOL status = ::OpenPrinterW(printName, &hPrinter, nullptr);
|
||||
if (status) {
|
||||
|
||||
@ -806,7 +806,7 @@ ShowNativePrintDialog(HWND aHWnd,
|
||||
GetDefaultPrinterNameFromGlobalPrinters(printerName);
|
||||
} else {
|
||||
HANDLE hPrinter = nullptr;
|
||||
if(!::OpenPrinterW(const_cast<wchar_t*>(printerName.get()), &hPrinter, nullptr)) {
|
||||
if(!::OpenPrinterW(const_cast<wchar_t*>(static_cast<const wchar_t*>(printerName.get())), &hPrinter, nullptr)) {
|
||||
// If the last used printer is not found, we should use default printer.
|
||||
GetDefaultPrinterNameFromGlobalPrinters(printerName);
|
||||
} else {
|
||||
@ -910,8 +910,8 @@ ShowNativePrintDialog(HWND aHWnd,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
wchar_t* device = &(((wchar_t *)devnames)[devnames->wDeviceOffset]);
|
||||
wchar_t* driver = &(((wchar_t *)devnames)[devnames->wDriverOffset]);
|
||||
char16_t* device = &(((char16_t *)devnames)[devnames->wDeviceOffset]);
|
||||
char16_t* driver = &(((char16_t *)devnames)[devnames->wDriverOffset]);
|
||||
|
||||
// Check to see if the "Print To File" control is checked
|
||||
// then take the name from devNames and set it in the PrintSettings
|
||||
@ -922,7 +922,7 @@ ShowNativePrintDialog(HWND aHWnd,
|
||||
// if the "Print To File" checkbox is checked it MUST be "FILE:"
|
||||
// We assert as an extra safety check.
|
||||
if (prntdlg.Flags & PD_PRINTTOFILE) {
|
||||
wchar_t* fileName = &(((wchar_t *)devnames)[devnames->wOutputOffset]);
|
||||
char16ptr_t fileName = &(((wchar_t *)devnames)[devnames->wOutputOffset]);
|
||||
NS_ASSERTION(wcscmp(fileName, L"FILE:") == 0, "FileName must be `FILE:`");
|
||||
aPrintSettings->SetToFileName(fileName);
|
||||
aPrintSettings->SetPrintToFile(true);
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static const PRUnichar *const pTypeName [] = {
|
||||
static const wchar_t *const pTypeName [] = {
|
||||
L"Kerberos",
|
||||
L"Negotiate",
|
||||
L"NTLM"
|
||||
|
@ -230,7 +230,7 @@ static DWORD GetSpecialFolderIcon(nsIFile* aFile, int aFolder, SHFILEINFOW* aSFI
|
||||
if (!aFile)
|
||||
return shellResult;
|
||||
|
||||
PRUnichar fileNativePath[MAX_PATH];
|
||||
wchar_t fileNativePath[MAX_PATH];
|
||||
nsAutoString fileNativePathStr;
|
||||
aFile->GetPath(fileNativePathStr);
|
||||
::GetShortPathNameW(fileNativePathStr.get(), fileNativePath, ArrayLength(fileNativePath));
|
||||
@ -238,7 +238,7 @@ static DWORD GetSpecialFolderIcon(nsIFile* aFile, int aFolder, SHFILEINFOW* aSFI
|
||||
LPITEMIDLIST idList;
|
||||
HRESULT hr = ::SHGetSpecialFolderLocation(nullptr, aFolder, &idList);
|
||||
if (SUCCEEDED(hr)) {
|
||||
PRUnichar specialNativePath[MAX_PATH];
|
||||
wchar_t specialNativePath[MAX_PATH];
|
||||
::SHGetPathFromIDListW(idList, specialNativePath);
|
||||
::GetShortPathNameW(specialNativePath, specialNativePath, ArrayLength(specialNativePath));
|
||||
|
||||
|
@ -237,8 +237,7 @@ int nsDateTimeFormatWin::nsGetTimeFormatW(DWORD dwFlags, const SYSTEMTIME *lpTim
|
||||
int len = 0;
|
||||
len = GetTimeFormatW(mLCID, dwFlags, lpTime,
|
||||
format ?
|
||||
const_cast<LPCWSTR>
|
||||
(NS_ConvertASCIItoUTF16(format).get()) :
|
||||
NS_ConvertASCIItoUTF16(format).get() :
|
||||
nullptr,
|
||||
(LPWSTR) timeStr, cchTime);
|
||||
return len;
|
||||
@ -249,10 +248,7 @@ int nsDateTimeFormatWin::nsGetDateFormatW(DWORD dwFlags, const SYSTEMTIME *lpDat
|
||||
{
|
||||
int len = 0;
|
||||
len = GetDateFormatW(mLCID, dwFlags, lpDate,
|
||||
format ?
|
||||
const_cast<LPCWSTR>
|
||||
(NS_ConvertASCIItoUTF16(format).get()) :
|
||||
nullptr,
|
||||
format ? NS_ConvertASCIItoUTF16(format).get() : nullptr,
|
||||
(LPWSTR) dateStr, cchDate);
|
||||
return len;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ nsPlatformCharset::GetDefaultCharsetForLocale(const nsAString& localeName, nsACS
|
||||
rv = nsWin32Locale::GetPlatformLocale(localeName, &localeAsLCID);
|
||||
if (NS_FAILED(rv)) { return rv; }
|
||||
|
||||
PRUnichar acp_name[6];
|
||||
wchar_t acp_name[6];
|
||||
if (GetLocaleInfoW(localeAsLCID, LOCALE_IDEFAULTANSICODEPAGE, acp_name,
|
||||
ArrayLength(acp_name))==0) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -22,6 +22,7 @@ NS_GetComplexLineBreaks(const PRUnichar* aText, uint32_t aLength,
|
||||
int outItems = 0;
|
||||
HRESULT result;
|
||||
nsAutoTArray<SCRIPT_ITEM, 64> items;
|
||||
char16ptr_t text = aText;
|
||||
|
||||
memset(aBreakBefore, false, aLength);
|
||||
|
||||
@ -29,7 +30,7 @@ NS_GetComplexLineBreaks(const PRUnichar* aText, uint32_t aLength,
|
||||
return;
|
||||
|
||||
do {
|
||||
result = ScriptItemize(aText, aLength, items.Length(), nullptr, nullptr,
|
||||
result = ScriptItemize(text, aLength, items.Length(), nullptr, nullptr,
|
||||
items.Elements(), &outItems);
|
||||
|
||||
if (result == E_OUTOFMEMORY) {
|
||||
@ -46,7 +47,7 @@ NS_GetComplexLineBreaks(const PRUnichar* aText, uint32_t aLength,
|
||||
if (!sla.AppendElements(endOffset - startOffset))
|
||||
return;
|
||||
|
||||
if (ScriptBreak(aText + startOffset, endOffset - startOffset,
|
||||
if (ScriptBreak(text + startOffset, endOffset - startOffset,
|
||||
&items[iItem].a, sla.Elements()) < 0)
|
||||
return;
|
||||
|
||||
|
@ -755,7 +755,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
|
||||
// See XRE_InitChildProcess in nsEmbedFunction.
|
||||
|
||||
// Win app model id
|
||||
cmdLine.AppendLooseValue(std::wstring(mGroupId.get()));
|
||||
cmdLine.AppendLooseValue(mGroupId.get());
|
||||
|
||||
// Process id
|
||||
cmdLine.AppendLooseValue(UTF8ToWide(pidstring));
|
||||
|
@ -70,7 +70,7 @@ using namespace mozilla::ipc::windows;
|
||||
|
||||
#if defined(ACCESSIBILITY)
|
||||
// pulled from accessibility's win utils
|
||||
extern const PRUnichar* kPropNameTabContent;
|
||||
extern const wchar_t* kPropNameTabContent;
|
||||
#endif
|
||||
|
||||
// widget related message id constants we need to defer
|
||||
|
@ -849,7 +849,7 @@ FileSystemDataSource::GetVolumeList(nsISimpleEnumerator** aResult)
|
||||
#ifdef XP_WIN
|
||||
|
||||
int32_t driveType;
|
||||
PRUnichar drive[32];
|
||||
wchar_t drive[32];
|
||||
int32_t volNum;
|
||||
|
||||
for (volNum = 0; volNum < 26; volNum++)
|
||||
|
@ -240,7 +240,7 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL)
|
||||
rv = textToSubURI->UnEscapeNonAsciiURI(urlCharset, urlSpec, utf16Spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
static const PRUnichar cmdVerb[] = L"open";
|
||||
static const wchar_t cmdVerb[] = L"open";
|
||||
SHELLEXECUTEINFOW sinfo;
|
||||
memset(&sinfo, 0, sizeof(sinfo));
|
||||
sinfo.cbSize = sizeof(sinfo);
|
||||
@ -426,7 +426,7 @@ bool nsMIMEInfoWin::GetDllLaunchInfo(nsIFile * aDll,
|
||||
if (bufLength == 0) // Error
|
||||
return false;
|
||||
|
||||
nsAutoArrayPtr<PRUnichar> destination(new PRUnichar[bufLength]);
|
||||
nsAutoArrayPtr<wchar_t> destination(new wchar_t[bufLength]);
|
||||
if (!destination)
|
||||
return false;
|
||||
if (!::ExpandEnvironmentStringsW(appFilesystemCommand.get(),
|
||||
@ -434,7 +434,7 @@ bool nsMIMEInfoWin::GetDllLaunchInfo(nsIFile * aDll,
|
||||
bufLength))
|
||||
return false;
|
||||
|
||||
appFilesystemCommand = destination;
|
||||
appFilesystemCommand = static_cast<const wchar_t*>(destination);
|
||||
|
||||
// C:\Windows\System32\rundll32.exe "C:\Program Files\Windows
|
||||
// Photo Gallery\PhotoViewer.dll", ImageView_Fullscreen %1
|
||||
|
@ -121,7 +121,7 @@ nsresult nsOSHelperAppService::OSProtocolHandlerExists(const char * aProtocolSch
|
||||
{
|
||||
// Vista: use new application association interface
|
||||
if (mAppAssoc) {
|
||||
PRUnichar * pResult = nullptr;
|
||||
wchar_t * pResult = nullptr;
|
||||
NS_ConvertASCIItoUTF16 scheme(aProtocolScheme);
|
||||
// We are responsible for freeing returned strings.
|
||||
HRESULT hr = mAppAssoc->QueryCurrentDefault(scheme.get(),
|
||||
@ -164,7 +164,7 @@ NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(const nsACString&
|
||||
|
||||
// Vista: use new application association interface
|
||||
if (mAppAssoc) {
|
||||
PRUnichar * pResult = nullptr;
|
||||
wchar_t * pResult = nullptr;
|
||||
// We are responsible for freeing returned strings.
|
||||
HRESULT hr = mAppAssoc->QueryCurrentDefault(buf.get(),
|
||||
AT_URLPROTOCOL, AL_EFFECTIVE,
|
||||
@ -352,14 +352,14 @@ static void StripRundll32(nsString& aCommandString)
|
||||
if (bufLength == 0) // Error
|
||||
return false;
|
||||
|
||||
nsAutoArrayPtr<PRUnichar> destination(new PRUnichar[bufLength]);
|
||||
nsAutoArrayPtr<wchar_t> destination(new wchar_t[bufLength]);
|
||||
if (!destination)
|
||||
return false;
|
||||
if (!::ExpandEnvironmentStringsW(handlerCommand.get(), destination,
|
||||
bufLength))
|
||||
return false;
|
||||
|
||||
handlerCommand = destination;
|
||||
handlerCommand = static_cast<const wchar_t*>(destination);
|
||||
|
||||
// Remove quotes around paths
|
||||
handlerCommand.StripChars("\"");
|
||||
@ -543,7 +543,7 @@ already_AddRefed<nsMIMEInfoWin> nsOSHelperAppService::GetByExtension(const nsAFl
|
||||
// Vista: use the new application association COM interfaces
|
||||
// for resolving helpers.
|
||||
nsString assocType(fileExtToUse);
|
||||
PRUnichar * pResult = nullptr;
|
||||
wchar_t * pResult = nullptr;
|
||||
HRESULT hr = mAppAssoc->QueryCurrentDefault(assocType.get(),
|
||||
AT_FILEEXTENSION, AL_EFFECTIVE,
|
||||
&pResult);
|
||||
|
@ -168,7 +168,7 @@ nsHTTPIndex::OnFTPControlLog(bool server, const char *msg)
|
||||
|
||||
nsString unicodeMsg;
|
||||
unicodeMsg.AssignWithConversion(msg);
|
||||
JSString* jsMsgStr = JS_NewUCStringCopyZ(cx, (jschar*) unicodeMsg.get());
|
||||
JSString* jsMsgStr = JS_NewUCStringCopyZ(cx, unicodeMsg.get());
|
||||
NS_ENSURE_TRUE(jsMsgStr, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
params[0] = BOOLEAN_TO_JSVAL(server);
|
||||
|
Loading…
Reference in New Issue
Block a user