Bug 944427 - Fixed char16_t/wchar_t mismatch in dom/ r=bsmedberg

This commit is contained in:
Jacek Caban 2013-12-04 13:19:38 +01:00
parent e2cd5ba18b
commit 0159728ca5
9 changed files with 20 additions and 28 deletions

View File

@ -4497,9 +4497,7 @@ nsStorage2SH::NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
if (enum_op == JSENUMERATE_NEXT && keys->Length() != 0) {
nsString& key = keys->ElementAt(0);
JSString *str =
JS_NewUCStringCopyN(cx, reinterpret_cast<const jschar *>
(key.get()),
key.Length());
JS_NewUCStringCopyN(cx, key.get(), key.Length());
NS_ENSURE_TRUE(str, NS_ERROR_OUT_OF_MEMORY);
JS_ValueToId(cx, STRING_TO_JSVAL(str), idp);

View File

@ -1330,9 +1330,7 @@ nsJSContext::AddSupportsPrimitiveTojsvals(nsISupports *aArg, JS::Value *aArgv)
// cast is probably safe since wchar_t and jschar are expected
// to be equivalent; both unsigned 16-bit entities
JSString *str =
::JS_NewUCStringCopyN(cx,
reinterpret_cast<const jschar *>(data.get()),
data.Length());
::JS_NewUCStringCopyN(cx, data.get(), data.Length());
NS_ENSURE_TRUE(str, NS_ERROR_OUT_OF_MEMORY);
*aArgv = STRING_TO_JSVAL(str);

View File

@ -344,9 +344,7 @@ NPVariantToJSVal(NPP npp, JSContext *cx, const NPVariant *variant)
NS_ConvertUTF8toUTF16 utf16String(s->UTF8Characters, s->UTF8Length);
JSString *str =
::JS_NewUCStringCopyN(cx, reinterpret_cast<const jschar*>
(utf16String.get()),
utf16String.Length());
::JS_NewUCStringCopyN(cx, utf16String.get(), utf16String.Length());
if (str) {
return STRING_TO_JSVAL(str);
@ -471,8 +469,7 @@ ThrowJSException(JSContext *cx, const char *message)
AppendASCIItoUTF16("].", ucex);
}
JSString *str = ::JS_NewUCStringCopyN(cx, (jschar *)ucex.get(),
ucex.Length());
JSString *str = ::JS_NewUCStringCopyN(cx, ucex.get(), ucex.Length());
if (str) {
JS::Rooted<JS::Value> exn(cx, JS::StringValue(str));

View File

@ -685,8 +685,7 @@ doGetIdentifier(JSContext *cx, const NPUTF8* name)
{
NS_ConvertUTF8toUTF16 utf16name(name);
JSString *str = ::JS_InternUCStringN(cx, (jschar *)utf16name.get(),
utf16name.Length());
JSString *str = ::JS_InternUCStringN(cx, utf16name.get(), utf16name.Length());
if (!str)
return nullptr;

View File

@ -36,7 +36,7 @@
* @return true if SetDllDirectory can be called for the plugin
*/
bool
ShouldProtectPluginCurrentDirectory(LPCWSTR pluginFilePath)
ShouldProtectPluginCurrentDirectory(char16ptr_t pluginFilePath)
{
LPCWSTR passedInFilename = PathFindFileName(pluginFilePath);
if (!passedInFilename) {
@ -178,7 +178,7 @@ static void FreeStringArray(uint32_t variants, char ** array)
PR_Free(array);
}
static bool CanLoadPlugin(const PRUnichar* aBinaryPath)
static bool CanLoadPlugin(char16ptr_t aBinaryPath)
{
#if defined(_M_IX86) || defined(_M_X64) || defined(_M_IA64)
bool canLoad = false;

View File

@ -20,7 +20,7 @@
#ifdef XP_WIN
#include "mozilla/gfx/SharedDIBSurface.h"
#include "nsCrashOnException.h"
extern const PRUnichar* kFlashFullscreenClass;
extern const wchar_t* kFlashFullscreenClass;
using mozilla::gfx::SharedDIBSurface;
#endif
#include "gfxSharedImageSurface.h"
@ -1476,7 +1476,7 @@ PluginInstanceChild::PluginWindowProcInternal(HWND hWnd,
// on the window.
if (message == WM_LBUTTONDOWN &&
self->GetQuirks() & PluginModuleChild::QUIRK_FLASH_FIXUP_MOUSE_CAPTURE) {
PRUnichar szClass[26];
wchar_t szClass[26];
HWND hwnd = GetForegroundWindow();
if (hwnd && GetClassNameW(hwnd, szClass,
sizeof(szClass)/sizeof(PRUnichar)) &&
@ -1675,7 +1675,7 @@ PluginInstanceChild::TrackPopupHookProc(HMENU hMenu,
// Only change the parent when we know this is a context on the plugin
// surface within the browser. Prevents resetting the parent on child ui
// displayed by plugins that have working parent-child relationships.
PRUnichar szClass[21];
wchar_t szClass[21];
bool haveClass = GetClassNameW(hWnd, szClass, ArrayLength(szClass));
if (!haveClass ||
(wcscmp(szClass, L"MozillaWindowClass") &&
@ -2061,7 +2061,7 @@ PluginInstanceChild::EnumThreadWindowsCallback(HWND hWnd,
return FALSE;
}
PRUnichar className[64];
wchar_t className[64];
if (!GetClassNameW(hWnd, className, sizeof(className)/sizeof(PRUnichar)))
return TRUE;

View File

@ -42,10 +42,10 @@
#include "mozilla/plugins/PluginSurfaceParent.h"
// Plugin focus event for widget.
extern const PRUnichar* kOOPPPluginFocusEventId;
extern const wchar_t* kOOPPPluginFocusEventId;
UINT gOOPPPluginFocusEvent =
RegisterWindowMessage(kOOPPPluginFocusEventId);
extern const PRUnichar* kFlashFullscreenClass;
extern const wchar_t* kFlashFullscreenClass;
#elif defined(MOZ_WIDGET_GTK)
#include <gdk/gdk.h>
#elif defined(XP_MACOSX)
@ -1213,7 +1213,7 @@ PluginInstanceParent::NPP_HandleEvent(void* event)
// which fires WM_KILLFOCUS. Delayed delivery causes Flash to
// misinterpret the event, dropping back out of fullscreen. Trap
// this event and drop it.
PRUnichar szClass[26];
wchar_t szClass[26];
HWND hwnd = GetForegroundWindow();
if (hwnd && hwnd != mPluginHWND &&
GetClassNameW(hwnd, szClass,
@ -1801,7 +1801,7 @@ PluginInstanceParent::RecvReleaseDXGISharedSurface(const DXGISharedSurfaceHandle
which fires off a gui event letting the browser know.
*/
static const PRUnichar kPluginInstanceParentProperty[] =
static const wchar_t kPluginInstanceParentProperty[] =
L"PluginInstanceParentProperty";
// static

View File

@ -64,8 +64,8 @@ using mozilla::dom::CrashReporterChild;
using mozilla::dom::PCrashReporterChild;
#if defined(XP_WIN)
const PRUnichar * kFlashFullscreenClass = L"ShockwaveFlashFullScreen";
const PRUnichar * kMozillaWindowClass = L"MozillaWindowClass";
const wchar_t * kFlashFullscreenClass = L"ShockwaveFlashFullScreen";
const wchar_t * kMozillaWindowClass = L"MozillaWindowClass";
#endif
namespace {
@ -1910,7 +1910,7 @@ PMCGetWindowInfoHook(HWND hWnd, PWINDOWINFO pwi)
}
if (!sBrowserHwnd) {
PRUnichar szClass[20];
wchar_t szClass[20];
if (GetClassNameW(hWnd, szClass, ArrayLength(szClass)) &&
!wcscmp(szClass, kMozillaWindowClass)) {
sBrowserHwnd = hWnd;
@ -2331,7 +2331,7 @@ PluginModuleChild::CallWindowProcHook(int nCode, WPARAM wParam, LPARAM lParam)
// core systems, sync killfocus events need to be handled
// after the flash fullscreen window procedure processes this
// message, otherwise fullscreen focus will not work correctly.
PRUnichar szClass[26];
wchar_t szClass[26];
if (GetClassNameW(pCwp->hwnd, szClass,
sizeof(szClass)/sizeof(PRUnichar)) &&
!wcscmp(szClass, kFlashFullscreenClass)) {

View File

@ -15,7 +15,7 @@
#ifdef XP_WIN
#include <objbase.h>
bool ShouldProtectPluginCurrentDirectory(LPCWSTR pluginFilePath);
bool ShouldProtectPluginCurrentDirectory(char16ptr_t pluginFilePath);
#endif
using mozilla::ipc::IOThreadChild;