Wine-Devel
Threads by month
- ----- 2026 -----
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- 5 participants
- 84534 discussions
[PATCH] ntdll/unix: do not access nonexistent IMAGE_FILE_IMPORT_DIRECTORY
by Kevin Puetz Nov. 24, 2020
by Kevin Puetz Nov. 24, 2020
Nov. 24, 2020
If there are no imports at all, winebuild will omit __wine_spec_imports,
so both VirtualAddress and Size will be 0. However, get_rva(module, 0)
does not point to a valid IMAGE_IMPORT_DESCRIPTOR.
Signed-off-by: Kevin Puetz <PuetzKevinA(a)JohnDeere.com>
---
My aarch64 builds would "work" on real hardware, but crash in wineboot
(or pretty much anything else non-trivial) if run in qemu-user 5.1.0.
The first crash would occur while loading gdi32.dll.so/gdi32.so.
wine 5.0.x worked, so it seems like there was enough hope to keep digging
and this seems to be the culprit.
I see desc->Name == 0xffff (actually reinterpreted bytes from the ELF header)
and on real aarch64 hardware the resulting bad pointer seems to avoid disaster,
(char*)get_rva(module,0xFFFF) == '\0'. I assume something just zero filled
betwen the ELF header and the __wine_spec_nt_header.
It does, however, hit the ERR trace with it's, printing:
"err:module:fixup_ntdll_imports module "/usr/lib/wine/gdi32.so" is importing "
(note empty %s)
In qemu-user, get_rva(module,0xFFFF) is unmapped so it just segfaults.
(probably just finer-grained tracking of sections and less zero-filling,
since qemu needs to move things around for the dynamic recompilation).
I fixed it to check DataDirectory[IMAGE_FILE_IMPORT_DIRECTORY].Size
before dereferencing the table, as map_so_dll does, so it doesn't access
a nonexistant imports section. This seems right, but I certainly won't
claim to understand all the machinery in here...
---
Patch below is mostly just indentation changing, diff -w looks like:
static NTSTATUS fixup_ntdll_imports( const char *name, HMODULE module )
{
const IMAGE_NT_HEADERS *nt;
- const IMAGE_IMPORT_DESCRIPTOR *descr;
+ const IMAGE_DATA_DIRECTORY *dir;
const IMAGE_THUNK_DATA *import_list;
IMAGE_THUNK_DATA *thunk_list;
nt = get_rva( module, ((IMAGE_DOS_HEADER *)module)->e_lfanew );
- descr = get_rva( module, nt->OptionalHeader.DataDirectory[IMAGE_FILE_IMPORT_DIRECTORY].VirtualAddress );
+
+ dir = &nt->OptionalHeader.DataDirectory[IMAGE_FILE_IMPORT_DIRECTORY];
+ if (dir->Size)
+ {
+ const IMAGE_IMPORT_DESCRIPTOR *descr= get_rva( module, dir->VirtualAddress );
+
for (; descr->Name && descr->FirstThunk; descr++)
{ ... }
+ }
return STATUS_SUCCESS;
}
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
index c2b6ea603e3..5d81e26cc5b 100644
--- a/dlls/ntdll/unix/loader.c
+++ b/dlls/ntdll/unix/loader.c
@@ -809,43 +809,49 @@ static inline void *get_rva( void *module, ULONG_PTR addr )
static NTSTATUS fixup_ntdll_imports( const char *name, HMODULE module )
{
const IMAGE_NT_HEADERS *nt;
- const IMAGE_IMPORT_DESCRIPTOR *descr;
+ const IMAGE_DATA_DIRECTORY *dir;
const IMAGE_THUNK_DATA *import_list;
IMAGE_THUNK_DATA *thunk_list;
nt = get_rva( module, ((IMAGE_DOS_HEADER *)module)->e_lfanew );
- descr = get_rva( module, nt->OptionalHeader.DataDirectory[IMAGE_FILE_IMPORT_DIRECTORY].VirtualAddress );
- for (; descr->Name && descr->FirstThunk; descr++)
+
+ dir = &nt->OptionalHeader.DataDirectory[IMAGE_FILE_IMPORT_DIRECTORY];
+ if (dir->Size)
{
- thunk_list = get_rva( module, descr->FirstThunk );
+ const IMAGE_IMPORT_DESCRIPTOR *descr= get_rva( module, dir->VirtualAddress );
- /* ntdll must be the only import */
- if (strcmp( get_rva( module, descr->Name ), "ntdll.dll" ))
+ for (; descr->Name && descr->FirstThunk; descr++)
{
- ERR( "module %s is importing %s\n", debugstr_a(name), (char *)get_rva( module, descr->Name ));
- return STATUS_PROCEDURE_NOT_FOUND;
- }
- if (descr->u.OriginalFirstThunk)
- import_list = get_rva( module, descr->u.OriginalFirstThunk );
- else
- import_list = thunk_list;
+ thunk_list = get_rva( module, descr->FirstThunk );
- while (import_list->u1.Ordinal)
- {
- if (IMAGE_SNAP_BY_ORDINAL( import_list->u1.Ordinal ))
+ /* ntdll must be the only import */
+ if (strcmp( get_rva( module, descr->Name ), "ntdll.dll" ))
{
- int ordinal = IMAGE_ORDINAL( import_list->u1.Ordinal ) - ntdll_exports->Base;
- thunk_list->u1.Function = find_ordinal_export( ntdll_module, ntdll_exports, ordinal );
- if (!thunk_list->u1.Function) ERR( "%s: ntdll.%u not found\n", debugstr_a(name), ordinal );
+ ERR( "module %s is importing %s\n", debugstr_a(name), (char *)get_rva( module, descr->Name ));
+ return STATUS_PROCEDURE_NOT_FOUND;
}
- else /* import by name */
+ if (descr->u.OriginalFirstThunk)
+ import_list = get_rva( module, descr->u.OriginalFirstThunk );
+ else
+ import_list = thunk_list;
+
+ while (import_list->u1.Ordinal)
{
- IMAGE_IMPORT_BY_NAME *pe_name = get_rva( module, import_list->u1.AddressOfData );
- thunk_list->u1.Function = find_pe_export( ntdll_module, ntdll_exports, pe_name );
- if (!thunk_list->u1.Function) ERR( "%s: ntdll.%s not found\n", debugstr_a(name), pe_name->Name );
+ if (IMAGE_SNAP_BY_ORDINAL( import_list->u1.Ordinal ))
+ {
+ int ordinal = IMAGE_ORDINAL( import_list->u1.Ordinal ) - ntdll_exports->Base;
+ thunk_list->u1.Function = find_ordinal_export( ntdll_module, ntdll_exports, ordinal );
+ if (!thunk_list->u1.Function) ERR( "%s: ntdll.%u not found\n", debugstr_a(name), ordinal );
+ }
+ else /* import by name */
+ {
+ IMAGE_IMPORT_BY_NAME *pe_name = get_rva( module, import_list->u1.AddressOfData );
+ thunk_list->u1.Function = find_pe_export( ntdll_module, ntdll_exports, pe_name );
+ if (!thunk_list->u1.Function) ERR( "%s: ntdll.%s not found\n", debugstr_a(name), pe_name->Name );
+ }
+ import_list++;
+ thunk_list++;
}
- import_list++;
- thunk_list++;
}
}
return STATUS_SUCCESS;
2
2
Nov. 24, 2020
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50037
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
programs/conhost/conhost.c | 7 ++++++-
programs/conhost/conhost.h | 1 +
2 files changed, 7 insertions(+), 1 deletion(-)
1
0
[PATCH] mfreadwrite/reader: Implement GetServiceForStream() for stream objects.
by Nikolay Sivov Nov. 24, 2020
by Nikolay Sivov Nov. 24, 2020
Nov. 24, 2020
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/mfreadwrite/reader.c | 52 ++++++++++++++++++++++++++++-----------
1 file changed, 38 insertions(+), 14 deletions(-)
diff --git a/dlls/mfreadwrite/reader.c b/dlls/mfreadwrite/reader.c
index 7aa8f65df7a..85aec9aaedc 100644
--- a/dlls/mfreadwrite/reader.c
+++ b/dlls/mfreadwrite/reader.c
@@ -1906,36 +1906,60 @@ static HRESULT WINAPI src_reader_GetServiceForStream(IMFSourceReader *iface, DWO
{
struct source_reader *reader = impl_from_IMFSourceReader(iface);
IUnknown *obj = NULL;
- HRESULT hr;
+ HRESULT hr = S_OK;
TRACE("%p, %#x, %s, %s, %p\n", iface, index, debugstr_guid(service), debugstr_guid(riid), object);
+ EnterCriticalSection(&reader->cs);
+
switch (index)
{
case MF_SOURCE_READER_MEDIASOURCE:
obj = (IUnknown *)reader->source;
break;
default:
- FIXME("Unsupported index %#x.\n", index);
- return E_NOTIMPL;
- }
+ if (index == MF_SOURCE_READER_FIRST_VIDEO_STREAM)
+ index = reader->first_video_stream_index;
+ else if (index == MF_SOURCE_READER_FIRST_AUDIO_STREAM)
+ index = reader->first_audio_stream_index;
- if (IsEqualGUID(service, &GUID_NULL))
- {
- hr = IUnknown_QueryInterface(obj, riid, object);
+ if (index >= reader->stream_count)
+ hr = MF_E_INVALIDSTREAMNUMBER;
+ else
+ {
+ obj = (IUnknown *)reader->streams[index].decoder;
+ if (!obj) hr = E_NOINTERFACE;
+ }
+ break;
}
- else
- {
- IMFGetService *gs;
- hr = IUnknown_QueryInterface(obj, &IID_IMFGetService, (void **)&gs);
- if (SUCCEEDED(hr))
+ if (obj)
+ IUnknown_AddRef(obj);
+
+ LeaveCriticalSection(&reader->cs);
+
+ if (obj)
+ {
+ if (IsEqualGUID(service, &GUID_NULL))
{
- hr = IMFGetService_GetService(gs, service, riid, object);
- IMFGetService_Release(gs);
+ hr = IUnknown_QueryInterface(obj, riid, object);
+ }
+ else
+ {
+ IMFGetService *gs;
+
+ hr = IUnknown_QueryInterface(obj, &IID_IMFGetService, (void **)&gs);
+ if (SUCCEEDED(hr))
+ {
+ hr = IMFGetService_GetService(gs, service, riid, object);
+ IMFGetService_Release(gs);
+ }
}
}
+ if (obj)
+ IUnknown_Release(obj);
+
return hr;
}
--
2.29.2
1
0
[PATCH 1/2] evr/presenter: Set frame size and aperture attributes for mixer output type.
by Nikolay Sivov Nov. 24, 2020
by Nikolay Sivov Nov. 24, 2020
Nov. 24, 2020
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/evr/presenter.c | 36 ++++++++++--
dlls/evr/tests/evr.c | 132 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 163 insertions(+), 5 deletions(-)
diff --git a/dlls/evr/presenter.c b/dlls/evr/presenter.c
index f0733f6f060..5701eb17bd3 100644
--- a/dlls/evr/presenter.c
+++ b/dlls/evr/presenter.c
@@ -306,17 +306,43 @@ static HRESULT video_presenter_set_media_type(struct video_presenter *presenter,
static HRESULT video_presenter_invalidate_media_type(struct video_presenter *presenter)
{
- IMFMediaType *media_type;
+ IMFMediaType *media_type, *candidate_type;
unsigned int idx = 0;
+ UINT64 frame_size;
+ MFVideoArea aperture;
+ RECT rect;
HRESULT hr;
+ if (FAILED(hr = MFCreateMediaType(&media_type)))
+ return hr;
+
video_presenter_get_native_video_size(presenter);
- while (SUCCEEDED(hr = IMFTransform_GetOutputAvailableType(presenter->mixer, 0, idx++, &media_type)))
+ rect = presenter->dst_rect;
+ if (rect.left == 0 && rect.right == 0 && rect.bottom == 0 && rect.top == 0)
+ {
+ rect.right = presenter->native_size.cx;
+ rect.bottom = presenter->native_size.cy;
+ }
+
+ aperture.Area.cx = rect.right - rect.left;
+ aperture.Area.cy = rect.bottom - rect.top;
+ aperture.OffsetX.value = 0;
+ aperture.OffsetX.fract = 0;
+ aperture.OffsetY.value = 0;
+ aperture.OffsetY.fract = 0;
+ frame_size = (UINT64)aperture.Area.cx << 32 | aperture.Area.cy;
+
+ while (SUCCEEDED(hr = IMFTransform_GetOutputAvailableType(presenter->mixer, 0, idx++, &candidate_type)))
{
/* FIXME: check that d3d device supports this format */
- /* FIXME: potentially adjust frame size */
+ if (FAILED(hr = IMFMediaType_CopyAllItems(candidate_type, (IMFAttributes *)media_type)))
+ WARN("Failed to clone a media type, hr %#x.\n", hr);
+ IMFMediaType_Release(candidate_type);
+
+ IMFMediaType_SetUINT64(media_type, &MF_MT_FRAME_SIZE, frame_size);
+ IMFMediaType_SetBlob(media_type, &MF_MT_GEOMETRIC_APERTURE, (UINT8 *)&aperture, sizeof(aperture));
hr = IMFTransform_SetOutputType(presenter->mixer, 0, media_type, MFT_SET_TYPE_TEST_ONLY);
@@ -326,12 +352,12 @@ static HRESULT video_presenter_invalidate_media_type(struct video_presenter *pre
if (SUCCEEDED(hr))
hr = IMFTransform_SetOutputType(presenter->mixer, 0, media_type, 0);
- IMFMediaType_Release(media_type);
-
if (SUCCEEDED(hr))
break;
}
+ IMFMediaType_Release(media_type);
+
return hr;
}
diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c
index 2740f2263f0..31434bde43a 100644
--- a/dlls/evr/tests/evr.c
+++ b/dlls/evr/tests/evr.c
@@ -2072,6 +2072,137 @@ todo_wine {
IMFVideoPresenter_Release(presenter);
}
+static void get_output_aperture(IMFTransform *mixer, SIZE *frame_size, MFVideoArea *aperture)
+{
+ IMFMediaType *media_type;
+ UINT64 size;
+ HRESULT hr;
+
+ memset(frame_size, 0xcc, sizeof(*frame_size));
+ memset(aperture, 0xcc, sizeof(*aperture));
+
+ hr = IMFTransform_GetOutputCurrentType(mixer, 0, &media_type);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ hr = IMFMediaType_GetUINT64(media_type, &MF_MT_FRAME_SIZE, &size);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ frame_size->cx = size >> 32;
+ frame_size->cy = size;
+
+ hr = IMFMediaType_GetBlob(media_type, &MF_MT_GEOMETRIC_APERTURE, (UINT8 *)aperture, sizeof(*aperture), NULL);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ IMFMediaType_Release(media_type);
+}
+
+static void test_presenter_media_type(void)
+{
+ IMFTopologyServiceLookupClient *lookup_client;
+ IMFVideoPresenter *presenter;
+ struct test_host host;
+ IMFMediaType *input_type;
+ IDirect3DDeviceManager9 *manager;
+ HRESULT hr;
+ IMFTransform *mixer;
+ IDirect3D9 *d3d;
+ IDirect3DDevice9 *device;
+ unsigned int token;
+ SIZE frame_size;
+ HWND window;
+ MFVideoArea aperture;
+ IMFVideoDisplayControl *display_control;
+ RECT dst;
+
+ window = create_window();
+ d3d = Direct3DCreate9(D3D_SDK_VERSION);
+ ok(!!d3d, "Failed to create a D3D object.\n");
+ if (!(device = create_device(d3d, window)))
+ {
+ skip("Failed to create a D3D device, skipping tests.\n");
+ goto done;
+ }
+
+ hr = DXVA2CreateDirect3DDeviceManager9(&token, &manager);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ hr = IDirect3DDeviceManager9_ResetDevice(manager, device, token);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ hr = MFCreateVideoPresenter(NULL, &IID_IDirect3DDevice9, &IID_IMFVideoPresenter, (void **)&presenter);
+ ok(hr == S_OK, "Failed to create default presenter, hr %#x.\n", hr);
+
+ hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFVideoDisplayControl, (void **)&display_control);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ hr = MFCreateVideoMixer(NULL, &IID_IDirect3DDevice9, &IID_IMFTransform, (void **)&mixer);
+ ok(hr == S_OK, "Failed to create a mixer, hr %#x.\n", hr);
+
+ input_type = create_video_type(&MFVideoFormat_RGB32);
+
+ hr = IMFMediaType_SetUINT64(input_type, &MF_MT_FRAME_SIZE, (UINT64)100 << 32 | 50);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ hr = IMFMediaType_SetUINT32(input_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ hr = IMFTransform_ProcessMessage(mixer, MFT_MESSAGE_SET_D3D_MANAGER, (ULONG_PTR)manager);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ hr = IMFTransform_SetInputType(mixer, 0, input_type, 0);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFTopologyServiceLookupClient, (void **)&lookup_client);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ init_test_host(&host, mixer, presenter);
+
+ hr = IMFTopologyServiceLookupClient_InitServicePointers(lookup_client, &host.IMFTopologyServiceLookup_iface);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ hr = IMFVideoDisplayControl_SetVideoWindow(display_control, window);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ hr = IMFVideoPresenter_ProcessMessage(presenter, MFVP_MESSAGE_INVALIDATEMEDIATYPE, 0);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ get_output_aperture(mixer, &frame_size, &aperture);
+ ok(frame_size.cx == 100 && frame_size.cy == 50, "Unexpected frame size %u x %u.\n", frame_size.cx, frame_size.cy);
+ ok(aperture.Area.cx == 100 && aperture.Area.cy == 50, "Unexpected size %u x %u.\n", aperture.Area.cx, aperture.Area.cy);
+ ok(!aperture.OffsetX.value && !aperture.OffsetX.fract && !aperture.OffsetY.value && !aperture.OffsetY.fract,
+ "Unexpected offset %u x %u.\n", aperture.OffsetX.value, aperture.OffsetY.value);
+
+ SetRect(&dst, 1, 2, 200, 300);
+ hr = IMFVideoDisplayControl_SetVideoPosition(display_control, NULL, &dst);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ get_output_aperture(mixer, &frame_size, &aperture);
+todo_wine {
+ ok(frame_size.cx == 199 && frame_size.cy == 298, "Unexpected frame size %u x %u.\n", frame_size.cx, frame_size.cy);
+ ok(aperture.Area.cx == 199 && aperture.Area.cy == 298, "Unexpected size %u x %u.\n", aperture.Area.cx, aperture.Area.cy);
+}
+ ok(!aperture.OffsetX.value && !aperture.OffsetX.fract && !aperture.OffsetY.value && !aperture.OffsetY.fract,
+ "Unexpected offset %u x %u.\n", aperture.OffsetX.value, aperture.OffsetY.value);
+
+ hr = IMFVideoDisplayControl_SetAspectRatioMode(display_control, MFVideoARMode_None);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ get_output_aperture(mixer, &frame_size, &aperture);
+todo_wine {
+ ok(frame_size.cx == 199 && frame_size.cy == 298, "Unexpected frame size %u x %u.\n", frame_size.cx, frame_size.cy);
+ ok(aperture.Area.cx == 199 && aperture.Area.cy == 298, "Unexpected size %u x %u.\n", aperture.Area.cx, aperture.Area.cy);
+}
+ ok(!aperture.OffsetX.value && !aperture.OffsetX.fract && !aperture.OffsetY.value && !aperture.OffsetY.fract,
+ "Unexpected offset %u x %u.\n", aperture.OffsetX.value, aperture.OffsetY.value);
+
+ IMFVideoDisplayControl_Release(display_control);
+ IMFVideoPresenter_Release(presenter);
+ IMFTransform_Release(mixer);
+
+done:
+ IDirect3D9_Release(d3d);
+ DestroyWindow(window);
+}
+
static void test_mixer_output_rectangle(void)
{
IMFVideoMixerControl *mixer_control;
@@ -2574,6 +2705,7 @@ START_TEST(evr)
test_presenter_ar_mode();
test_presenter_video_window();
test_presenter_quality_control();
+ test_presenter_media_type();
test_mixer_output_rectangle();
test_mixer_zorder();
test_mixer_samples();
--
2.29.2
1
1
[PATCH] wininet: Use wide-char string literals in struct initialization.
by Michael Stefaniuc Nov. 24, 2020
by Michael Stefaniuc Nov. 24, 2020
Nov. 24, 2020
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
I know the months name to number is not in a struct but it fit in
visualy.
dlls/wininet/http.c | 249 ++++++++++++++++------------------------
dlls/wininet/internet.c | 10 +-
dlls/wininet/urlcache.c | 9 +-
3 files changed, 105 insertions(+), 163 deletions(-)
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 97e6ffaabc1..8701e32067b 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -72,58 +72,16 @@ static const WCHAR szGET[] = { 'G','E','T', 0 };
static const WCHAR szHEAD[] = { 'H','E','A','D', 0 };
static const WCHAR szAccept[] = { 'A','c','c','e','p','t',0 };
-static const WCHAR szAccept_Charset[] = { 'A','c','c','e','p','t','-','C','h','a','r','s','e','t', 0 };
-static const WCHAR szAccept_Encoding[] = { 'A','c','c','e','p','t','-','E','n','c','o','d','i','n','g',0 };
-static const WCHAR szAccept_Language[] = { 'A','c','c','e','p','t','-','L','a','n','g','u','a','g','e',0 };
-static const WCHAR szAccept_Ranges[] = { 'A','c','c','e','p','t','-','R','a','n','g','e','s',0 };
-static const WCHAR szAge[] = { 'A','g','e',0 };
-static const WCHAR szAllow[] = { 'A','l','l','o','w',0 };
static const WCHAR szCache_Control[] = { 'C','a','c','h','e','-','C','o','n','t','r','o','l',0 };
static const WCHAR szConnection[] = { 'C','o','n','n','e','c','t','i','o','n',0 };
-static const WCHAR szContent_Base[] = { 'C','o','n','t','e','n','t','-','B','a','s','e',0 };
-static const WCHAR szContent_Disposition[] = { 'C','o','n','t','e','n','t','-','D','i','s','p','o','s','i','t','i','o','n',0 };
static const WCHAR szContent_Encoding[] = { 'C','o','n','t','e','n','t','-','E','n','c','o','d','i','n','g',0 };
-static const WCHAR szContent_ID[] = { 'C','o','n','t','e','n','t','-','I','D',0 };
-static const WCHAR szContent_Language[] = { 'C','o','n','t','e','n','t','-','L','a','n','g','u','a','g','e',0 };
static const WCHAR szContent_Length[] = { 'C','o','n','t','e','n','t','-','L','e','n','g','t','h',0 };
-static const WCHAR szContent_Location[] = { 'C','o','n','t','e','n','t','-','L','o','c','a','t','i','o','n',0 };
-static const WCHAR szContent_MD5[] = { 'C','o','n','t','e','n','t','-','M','D','5',0 };
-static const WCHAR szContent_Range[] = { 'C','o','n','t','e','n','t','-','R','a','n','g','e',0 };
-static const WCHAR szContent_Transfer_Encoding[] = { 'C','o','n','t','e','n','t','-','T','r','a','n','s','f','e','r','-','E','n','c','o','d','i','n','g',0 };
static const WCHAR szContent_Type[] = { 'C','o','n','t','e','n','t','-','T','y','p','e',0 };
-static const WCHAR szCookie[] = { 'C','o','o','k','i','e',0 };
-static const WCHAR szDate[] = { 'D','a','t','e',0 };
-static const WCHAR szFrom[] = { 'F','r','o','m',0 };
-static const WCHAR szETag[] = { 'E','T','a','g',0 };
-static const WCHAR szExpect[] = { 'E','x','p','e','c','t',0 };
static const WCHAR szExpires[] = { 'E','x','p','i','r','e','s',0 };
-static const WCHAR szIf_Match[] = { 'I','f','-','M','a','t','c','h',0 };
-static const WCHAR szIf_Modified_Since[] = { 'I','f','-','M','o','d','i','f','i','e','d','-','S','i','n','c','e',0 };
-static const WCHAR szIf_None_Match[] = { 'I','f','-','N','o','n','e','-','M','a','t','c','h',0 };
-static const WCHAR szIf_Range[] = { 'I','f','-','R','a','n','g','e',0 };
-static const WCHAR szIf_Unmodified_Since[] = { 'I','f','-','U','n','m','o','d','i','f','i','e','d','-','S','i','n','c','e',0 };
static const WCHAR szLast_Modified[] = { 'L','a','s','t','-','M','o','d','i','f','i','e','d',0 };
-static const WCHAR szLocation[] = { 'L','o','c','a','t','i','o','n',0 };
-static const WCHAR szMax_Forwards[] = { 'M','a','x','-','F','o','r','w','a','r','d','s',0 };
-static const WCHAR szMime_Version[] = { 'M','i','m','e','-','V','e','r','s','i','o','n',0 };
-static const WCHAR szPragma[] = { 'P','r','a','g','m','a',0 };
-static const WCHAR szProxy_Authenticate[] = { 'P','r','o','x','y','-','A','u','t','h','e','n','t','i','c','a','t','e',0 };
static const WCHAR szProxy_Connection[] = { 'P','r','o','x','y','-','C','o','n','n','e','c','t','i','o','n',0 };
-static const WCHAR szPublic[] = { 'P','u','b','l','i','c',0 };
-static const WCHAR szRange[] = { 'R','a','n','g','e',0 };
static const WCHAR szReferer[] = { 'R','e','f','e','r','e','r',0 };
-static const WCHAR szRetry_After[] = { 'R','e','t','r','y','-','A','f','t','e','r',0 };
-static const WCHAR szServer[] = { 'S','e','r','v','e','r',0 };
static const WCHAR szSet_Cookie[] = { 'S','e','t','-','C','o','o','k','i','e',0 };
-static const WCHAR szTransfer_Encoding[] = { 'T','r','a','n','s','f','e','r','-','E','n','c','o','d','i','n','g',0 };
-static const WCHAR szUnless_Modified_Since[] = { 'U','n','l','e','s','s','-','M','o','d','i','f','i','e','d','-','S','i','n','c','e',0 };
-static const WCHAR szUpgrade[] = { 'U','p','g','r','a','d','e',0 };
-static const WCHAR szURI[] = { 'U','R','I',0 };
-static const WCHAR szUser_Agent[] = { 'U','s','e','r','-','A','g','e','n','t',0 };
-static const WCHAR szVary[] = { 'V','a','r','y',0 };
-static const WCHAR szVia[] = { 'V','i','a',0 };
-static const WCHAR szWarning[] = { 'W','a','r','n','i','n','g',0 };
-static const WCHAR szWWW_Authenticate[] = { 'W','W','W','-','A','u','t','h','e','n','t','i','c','a','t','e',0 };
static const WCHAR emptyW[] = {0};
@@ -3588,77 +3546,77 @@ lend:
}
static const LPCWSTR header_lookup[] = {
- szMime_Version, /* HTTP_QUERY_MIME_VERSION = 0 */
- szContent_Type, /* HTTP_QUERY_CONTENT_TYPE = 1 */
- szContent_Transfer_Encoding,/* HTTP_QUERY_CONTENT_TRANSFER_ENCODING = 2 */
- szContent_ID, /* HTTP_QUERY_CONTENT_ID = 3 */
- NULL, /* HTTP_QUERY_CONTENT_DESCRIPTION = 4 */
- szContent_Length, /* HTTP_QUERY_CONTENT_LENGTH = 5 */
- szContent_Language, /* HTTP_QUERY_CONTENT_LANGUAGE = 6 */
- szAllow, /* HTTP_QUERY_ALLOW = 7 */
- szPublic, /* HTTP_QUERY_PUBLIC = 8 */
- szDate, /* HTTP_QUERY_DATE = 9 */
- szExpires, /* HTTP_QUERY_EXPIRES = 10 */
- szLast_Modified, /* HTTP_QUERY_LAST_MODIFIED = 11 */
- NULL, /* HTTP_QUERY_MESSAGE_ID = 12 */
- szURI, /* HTTP_QUERY_URI = 13 */
- szFrom, /* HTTP_QUERY_DERIVED_FROM = 14 */
- NULL, /* HTTP_QUERY_COST = 15 */
- NULL, /* HTTP_QUERY_LINK = 16 */
- szPragma, /* HTTP_QUERY_PRAGMA = 17 */
- NULL, /* HTTP_QUERY_VERSION = 18 */
- szStatus, /* HTTP_QUERY_STATUS_CODE = 19 */
- NULL, /* HTTP_QUERY_STATUS_TEXT = 20 */
- NULL, /* HTTP_QUERY_RAW_HEADERS = 21 */
- NULL, /* HTTP_QUERY_RAW_HEADERS_CRLF = 22 */
- szConnection, /* HTTP_QUERY_CONNECTION = 23 */
- szAccept, /* HTTP_QUERY_ACCEPT = 24 */
- szAccept_Charset, /* HTTP_QUERY_ACCEPT_CHARSET = 25 */
- szAccept_Encoding, /* HTTP_QUERY_ACCEPT_ENCODING = 26 */
- szAccept_Language, /* HTTP_QUERY_ACCEPT_LANGUAGE = 27 */
- szAuthorization, /* HTTP_QUERY_AUTHORIZATION = 28 */
- szContent_Encoding, /* HTTP_QUERY_CONTENT_ENCODING = 29 */
- NULL, /* HTTP_QUERY_FORWARDED = 30 */
- NULL, /* HTTP_QUERY_FROM = 31 */
- szIf_Modified_Since, /* HTTP_QUERY_IF_MODIFIED_SINCE = 32 */
- szLocation, /* HTTP_QUERY_LOCATION = 33 */
- NULL, /* HTTP_QUERY_ORIG_URI = 34 */
- szReferer, /* HTTP_QUERY_REFERER = 35 */
- szRetry_After, /* HTTP_QUERY_RETRY_AFTER = 36 */
- szServer, /* HTTP_QUERY_SERVER = 37 */
- NULL, /* HTTP_TITLE = 38 */
- szUser_Agent, /* HTTP_QUERY_USER_AGENT = 39 */
- szWWW_Authenticate, /* HTTP_QUERY_WWW_AUTHENTICATE = 40 */
- szProxy_Authenticate, /* HTTP_QUERY_PROXY_AUTHENTICATE = 41 */
- szAccept_Ranges, /* HTTP_QUERY_ACCEPT_RANGES = 42 */
- szSet_Cookie, /* HTTP_QUERY_SET_COOKIE = 43 */
- szCookie, /* HTTP_QUERY_COOKIE = 44 */
- NULL, /* HTTP_QUERY_REQUEST_METHOD = 45 */
- NULL, /* HTTP_QUERY_REFRESH = 46 */
- szContent_Disposition, /* HTTP_QUERY_CONTENT_DISPOSITION = 47 */
- szAge, /* HTTP_QUERY_AGE = 48 */
- szCache_Control, /* HTTP_QUERY_CACHE_CONTROL = 49 */
- szContent_Base, /* HTTP_QUERY_CONTENT_BASE = 50 */
- szContent_Location, /* HTTP_QUERY_CONTENT_LOCATION = 51 */
- szContent_MD5, /* HTTP_QUERY_CONTENT_MD5 = 52 */
- szContent_Range, /* HTTP_QUERY_CONTENT_RANGE = 53 */
- szETag, /* HTTP_QUERY_ETAG = 54 */
- hostW, /* HTTP_QUERY_HOST = 55 */
- szIf_Match, /* HTTP_QUERY_IF_MATCH = 56 */
- szIf_None_Match, /* HTTP_QUERY_IF_NONE_MATCH = 57 */
- szIf_Range, /* HTTP_QUERY_IF_RANGE = 58 */
- szIf_Unmodified_Since, /* HTTP_QUERY_IF_UNMODIFIED_SINCE = 59 */
- szMax_Forwards, /* HTTP_QUERY_MAX_FORWARDS = 60 */
- szProxy_Authorization, /* HTTP_QUERY_PROXY_AUTHORIZATION = 61 */
- szRange, /* HTTP_QUERY_RANGE = 62 */
- szTransfer_Encoding, /* HTTP_QUERY_TRANSFER_ENCODING = 63 */
- szUpgrade, /* HTTP_QUERY_UPGRADE = 64 */
- szVary, /* HTTP_QUERY_VARY = 65 */
- szVia, /* HTTP_QUERY_VIA = 66 */
- szWarning, /* HTTP_QUERY_WARNING = 67 */
- szExpect, /* HTTP_QUERY_EXPECT = 68 */
- szProxy_Connection, /* HTTP_QUERY_PROXY_CONNECTION = 69 */
- szUnless_Modified_Since, /* HTTP_QUERY_UNLESS_MODIFIED_SINCE = 70 */
+ L"Mime-Version", /* HTTP_QUERY_MIME_VERSION = 0 */
+ L"Content-Type", /* HTTP_QUERY_CONTENT_TYPE = 1 */
+ L"Content-Transfer-Encoding", /* HTTP_QUERY_CONTENT_TRANSFER_ENCODING = 2 */
+ L"Content-ID", /* HTTP_QUERY_CONTENT_ID = 3 */
+ NULL, /* HTTP_QUERY_CONTENT_DESCRIPTION = 4 */
+ L"Content-Length", /* HTTP_QUERY_CONTENT_LENGTH = 5 */
+ L"Content-Language", /* HTTP_QUERY_CONTENT_LANGUAGE = 6 */
+ L"Allow", /* HTTP_QUERY_ALLOW = 7 */
+ L"Public", /* HTTP_QUERY_PUBLIC = 8 */
+ L"Date", /* HTTP_QUERY_DATE = 9 */
+ L"Expires", /* HTTP_QUERY_EXPIRES = 10 */
+ L"Last-Modified", /* HTTP_QUERY_LAST_MODIFIED = 11 */
+ NULL, /* HTTP_QUERY_MESSAGE_ID = 12 */
+ L"URI", /* HTTP_QUERY_URI = 13 */
+ L"From", /* HTTP_QUERY_DERIVED_FROM = 14 */
+ NULL, /* HTTP_QUERY_COST = 15 */
+ NULL, /* HTTP_QUERY_LINK = 16 */
+ L"Pragma", /* HTTP_QUERY_PRAGMA = 17 */
+ NULL, /* HTTP_QUERY_VERSION = 18 */
+ L"Status", /* HTTP_QUERY_STATUS_CODE = 19 */
+ NULL, /* HTTP_QUERY_STATUS_TEXT = 20 */
+ NULL, /* HTTP_QUERY_RAW_HEADERS = 21 */
+ NULL, /* HTTP_QUERY_RAW_HEADERS_CRLF = 22 */
+ L"Connection", /* HTTP_QUERY_CONNECTION = 23 */
+ L"Accept", /* HTTP_QUERY_ACCEPT = 24 */
+ L"Accept-Charset", /* HTTP_QUERY_ACCEPT_CHARSET = 25 */
+ L"Accept-Encoding", /* HTTP_QUERY_ACCEPT_ENCODING = 26 */
+ L"Accept-Language", /* HTTP_QUERY_ACCEPT_LANGUAGE = 27 */
+ L"Authorization", /* HTTP_QUERY_AUTHORIZATION = 28 */
+ L"Content-Encoding", /* HTTP_QUERY_CONTENT_ENCODING = 29 */
+ NULL, /* HTTP_QUERY_FORWARDED = 30 */
+ NULL, /* HTTP_QUERY_FROM = 31 */
+ L"If-Modified-Since", /* HTTP_QUERY_IF_MODIFIED_SINCE = 32 */
+ L"Location", /* HTTP_QUERY_LOCATION = 33 */
+ NULL, /* HTTP_QUERY_ORIG_URI = 34 */
+ L"Referer", /* HTTP_QUERY_REFERER = 35 */
+ L"Retry-After", /* HTTP_QUERY_RETRY_AFTER = 36 */
+ L"Server", /* HTTP_QUERY_SERVER = 37 */
+ NULL, /* HTTP_TITLE = 38 */
+ L"User-Agent", /* HTTP_QUERY_USER_AGENT = 39 */
+ L"WWW-Authenticate", /* HTTP_QUERY_WWW_AUTHENTICATE = 40 */
+ L"Proxy-Authenticate", /* HTTP_QUERY_PROXY_AUTHENTICATE = 41 */
+ L"Accept-Ranges", /* HTTP_QUERY_ACCEPT_RANGES = 42 */
+ L"Set-Cookie", /* HTTP_QUERY_SET_COOKIE = 43 */
+ L"Cookie", /* HTTP_QUERY_COOKIE = 44 */
+ NULL, /* HTTP_QUERY_REQUEST_METHOD = 45 */
+ NULL, /* HTTP_QUERY_REFRESH = 46 */
+ L"Content-Disposition", /* HTTP_QUERY_CONTENT_DISPOSITION = 47 */
+ L"Age", /* HTTP_QUERY_AGE = 48 */
+ L"Cache-Control", /* HTTP_QUERY_CACHE_CONTROL = 49 */
+ L"Content-Base", /* HTTP_QUERY_CONTENT_BASE = 50 */
+ L"Content-Location", /* HTTP_QUERY_CONTENT_LOCATION = 51 */
+ L"Content-MD5", /* HTTP_QUERY_CONTENT_MD5 = 52 */
+ L"Content-Range", /* HTTP_QUERY_CONTENT_RANGE = 53 */
+ L"ETag", /* HTTP_QUERY_ETAG = 54 */
+ L"Host", /* HTTP_QUERY_HOST = 55 */
+ L"If-Match", /* HTTP_QUERY_IF_MATCH = 56 */
+ L"If-None-Match", /* HTTP_QUERY_IF_NONE_MATCH = 57 */
+ L"If-Range", /* HTTP_QUERY_IF_RANGE = 58 */
+ L"If-Unmodified-Since", /* HTTP_QUERY_IF_UNMODIFIED_SINCE = 59 */
+ L"Max-Forwards", /* HTTP_QUERY_MAX_FORWARDS = 60 */
+ L"Proxy-Authorization", /* HTTP_QUERY_PROXY_AUTHORIZATION = 61 */
+ L"Range", /* HTTP_QUERY_RANGE = 62 */
+ L"Transfer-Encoding", /* HTTP_QUERY_TRANSFER_ENCODING = 63 */
+ L"Upgrade", /* HTTP_QUERY_UPGRADE = 64 */
+ L"Vary", /* HTTP_QUERY_VARY = 65 */
+ L"Via", /* HTTP_QUERY_VIA = 66 */
+ L"Warning", /* HTTP_QUERY_WARNING = 67 */
+ L"Expect", /* HTTP_QUERY_EXPECT = 68 */
+ L"Proxy-Connection", /* HTTP_QUERY_PROXY_CONNECTION = 69 */
+ L"Unless-Modified-Since", /* HTTP_QUERY_UNLESS_MODIFIED_SINCE = 70 */
};
/***********************************************************************
@@ -4364,13 +4322,13 @@ static void HTTP_InsertCookies(http_request_t *request)
static WORD HTTP_ParseWkday(LPCWSTR day)
{
- static const WCHAR days[7][4] = {{ 's','u','n',0 },
- { 'm','o','n',0 },
- { 't','u','e',0 },
- { 'w','e','d',0 },
- { 't','h','u',0 },
- { 'f','r','i',0 },
- { 's','a','t',0 }};
+ static const WCHAR days[7][4] = {L"sun",
+ L"mon",
+ L"tue",
+ L"wed",
+ L"thu",
+ L"fri",
+ L"sat"};
unsigned int i;
for (i = 0; i < ARRAY_SIZE(days); i++)
if (!wcsicmp(day, days[i]))
@@ -4382,31 +4340,18 @@ static WORD HTTP_ParseWkday(LPCWSTR day)
static WORD HTTP_ParseMonth(LPCWSTR month)
{
- static const WCHAR jan[] = { 'j','a','n',0 };
- static const WCHAR feb[] = { 'f','e','b',0 };
- static const WCHAR mar[] = { 'm','a','r',0 };
- static const WCHAR apr[] = { 'a','p','r',0 };
- static const WCHAR may[] = { 'm','a','y',0 };
- static const WCHAR jun[] = { 'j','u','n',0 };
- static const WCHAR jul[] = { 'j','u','l',0 };
- static const WCHAR aug[] = { 'a','u','g',0 };
- static const WCHAR sep[] = { 's','e','p',0 };
- static const WCHAR oct[] = { 'o','c','t',0 };
- static const WCHAR nov[] = { 'n','o','v',0 };
- static const WCHAR dec[] = { 'd','e','c',0 };
-
- if (!wcsicmp(month, jan)) return 1;
- if (!wcsicmp(month, feb)) return 2;
- if (!wcsicmp(month, mar)) return 3;
- if (!wcsicmp(month, apr)) return 4;
- if (!wcsicmp(month, may)) return 5;
- if (!wcsicmp(month, jun)) return 6;
- if (!wcsicmp(month, jul)) return 7;
- if (!wcsicmp(month, aug)) return 8;
- if (!wcsicmp(month, sep)) return 9;
- if (!wcsicmp(month, oct)) return 10;
- if (!wcsicmp(month, nov)) return 11;
- if (!wcsicmp(month, dec)) return 12;
+ if (!wcsicmp(month, L"jan")) return 1;
+ if (!wcsicmp(month, L"feb")) return 2;
+ if (!wcsicmp(month, L"mar")) return 3;
+ if (!wcsicmp(month, L"apr")) return 4;
+ if (!wcsicmp(month, L"may")) return 5;
+ if (!wcsicmp(month, L"jun")) return 6;
+ if (!wcsicmp(month, L"jul")) return 7;
+ if (!wcsicmp(month, L"aug")) return 8;
+ if (!wcsicmp(month, L"sep")) return 9;
+ if (!wcsicmp(month, L"oct")) return 10;
+ if (!wcsicmp(month, L"nov")) return 11;
+ if (!wcsicmp(month, L"dec")) return 12;
/* Invalid */
return 0;
}
@@ -4624,13 +4569,13 @@ static BOOL HTTP_ParseRfc1123Date(LPCWSTR value, FILETIME *ft)
static WORD HTTP_ParseWeekday(LPCWSTR day)
{
- static const WCHAR days[7][10] = {{ 's','u','n','d','a','y',0 },
- { 'm','o','n','d','a','y',0 },
- { 't','u','e','s','d','a','y',0 },
- { 'w','e','d','n','e','s','d','a','y',0 },
- { 't','h','u','r','s','d','a','y',0 },
- { 'f','r','i','d','a','y',0 },
- { 's','a','t','u','r','d','a','y',0 }};
+ static const WCHAR days[7][10] = {L"sunday",
+ L"monday",
+ L"tuesday",
+ L"wednesday",
+ L"thursday",
+ L"friday",
+ L"saturday"};
unsigned int i;
for (i = 0; i < ARRAY_SIZE(days); i++)
if (!wcsicmp(day, days[i]))
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index 91bff2ece93..b26a1b912ee 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -3279,12 +3279,12 @@ BOOL WINAPI InternetSetOptionExW(HINTERNET hInternet, DWORD dwOption,
}
static const WCHAR WININET_wkday[7][4] =
- { { 'S','u','n', 0 }, { 'M','o','n', 0 }, { 'T','u','e', 0 }, { 'W','e','d', 0 },
- { 'T','h','u', 0 }, { 'F','r','i', 0 }, { 'S','a','t', 0 } };
+ { L"Sun", L"Mon", L"Tue", L"Wed",
+ L"Thu", L"Fri", L"Sat"};
static const WCHAR WININET_month[12][4] =
- { { 'J','a','n', 0 }, { 'F','e','b', 0 }, { 'M','a','r', 0 }, { 'A','p','r', 0 },
- { 'M','a','y', 0 }, { 'J','u','n', 0 }, { 'J','u','l', 0 }, { 'A','u','g', 0 },
- { 'S','e','p', 0 }, { 'O','c','t', 0 }, { 'N','o','v', 0 }, { 'D','e','c', 0 } };
+ { L"Jan", L"Feb", L"Mar", L"Apr",
+ L"May", L"Jun", L"Jul", L"Aug",
+ L"Sep", L"Oct", L"Nov", L"Dec"};
/***********************************************************************
* InternetTimeFromSystemTimeA (WININET.@)
diff --git a/dlls/wininet/urlcache.c b/dlls/wininet/urlcache.c
index 4a397b6b4de..cc12ef9e76e 100644
--- a/dlls/wininet/urlcache.c
+++ b/dlls/wininet/urlcache.c
@@ -748,9 +748,6 @@ static void cache_container_delete_container(cache_container *pContainer)
static void cache_containers_init(void)
{
- static const WCHAR UrlSuffix[] = {'C','o','n','t','e','n','t','.','I','E','5',0};
- static const WCHAR HistorySuffix[] = {'H','i','s','t','o','r','y','.','I','E','5',0};
- static const WCHAR CookieSuffix[] = {0};
static const struct
{
int nFolder; /* CSIDL_* constant */
@@ -759,9 +756,9 @@ static void cache_containers_init(void)
DWORD default_entry_type;
} DefaultContainerData[] =
{
- { CSIDL_INTERNET_CACHE, UrlSuffix, "", NORMAL_CACHE_ENTRY },
- { CSIDL_HISTORY, HistorySuffix, "Visited:", URLHISTORY_CACHE_ENTRY },
- { CSIDL_COOKIES, CookieSuffix, "Cookie:", COOKIE_CACHE_ENTRY },
+ { CSIDL_INTERNET_CACHE, L"Content.IE5", "", NORMAL_CACHE_ENTRY },
+ { CSIDL_HISTORY, L"History.IE5", "Visited:", URLHISTORY_CACHE_ENTRY },
+ { CSIDL_COOKIES, L"", "Cookie:", COOKIE_CACHE_ENTRY },
};
DWORD i;
--
2.26.2
2
1
[PATCH 2/2] mshtml: Use wide-char string literals for PRUnichar strings.
by Michael Stefaniuc Nov. 24, 2020
by Michael Stefaniuc Nov. 24, 2020
Nov. 24, 2020
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/mshtml/editor.c | 7 ++-----
dlls/mshtml/htmldoc.c | 4 +---
dlls/mshtml/htmlelemcol.c | 4 +---
dlls/mshtml/htmlform.c | 8 ++------
dlls/mshtml/htmlhead.c | 9 +++------
dlls/mshtml/htmlimg.c | 4 +---
dlls/mshtml/htmlselect.c | 4 +---
dlls/mshtml/nsevents.c | 21 ++++++++-------------
dlls/mshtml/nsservice.c | 8 +++-----
dlls/mshtml/olecmd.c | 14 ++++++--------
dlls/mshtml/pluginhost.c | 18 +++++-------------
dlls/mshtml/range.c | 7 ++-----
dlls/mshtml/script.c | 8 ++------
13 files changed, 37 insertions(+), 79 deletions(-)
diff --git a/dlls/mshtml/editor.c b/dlls/mshtml/editor.c
index 0a1b4879bde..28c4eceff8e 100644
--- a/dlls/mshtml/editor.c
+++ b/dlls/mshtml/editor.c
@@ -657,13 +657,10 @@ static HRESULT exec_italic(HTMLDocumentNode *doc, DWORD cmdexecopt, VARIANT *in,
static HRESULT query_justify(HTMLDocumentNode *doc, OLECMD *cmd)
{
- static const PRUnichar justifycenterW[] = {'j','u','s','t','i','f','y','c','e','n','t','e','r',0};
- static const PRUnichar justifyrightW[] = {'j','u','s','t','i','f','y','r','i','g','h','t',0};
-
switch(cmd->cmdID) {
case IDM_JUSTIFYCENTER:
TRACE("(%p) IDM_JUSTIFYCENTER\n", doc);
- cmd->cmdf = query_align_status(doc, justifycenterW);
+ cmd->cmdf = query_align_status(doc, L"justifycenter");
break;
case IDM_JUSTIFYLEFT:
TRACE("(%p) IDM_JUSTIFYLEFT\n", doc);
@@ -675,7 +672,7 @@ static HRESULT query_justify(HTMLDocumentNode *doc, OLECMD *cmd)
break;
case IDM_JUSTIFYRIGHT:
TRACE("(%p) IDM_JUSTIFYRIGHT\n", doc);
- cmd->cmdf = query_align_status(doc, justifyrightW);
+ cmd->cmdf = query_align_status(doc, L"justifyright");
break;
}
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 767b46a7050..344079ba36e 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -5720,9 +5720,7 @@ HRESULT create_document_node(nsIDOMHTMLDocument *nsdoc, GeckoBrowser *browser, H
nsAString mode_str;
nsresult nsres;
- static const PRUnichar onW[] = {'o','n',0};
-
- nsAString_InitDepend(&mode_str, onW);
+ nsAString_InitDepend(&mode_str, L"on");
nsres = nsIDOMHTMLDocument_SetDesignMode(doc->nsdoc, &mode_str);
nsAString_Finish(&mode_str);
if(NS_FAILED(nsres))
diff --git a/dlls/mshtml/htmlelemcol.c b/dlls/mshtml/htmlelemcol.c
index 51cc90110f6..67bef804fbc 100644
--- a/dlls/mshtml/htmlelemcol.c
+++ b/dlls/mshtml/htmlelemcol.c
@@ -375,8 +375,6 @@ static BOOL is_elem_name(HTMLElement *elem, LPCWSTR name)
BOOL ret = FALSE;
nsresult nsres;
- static const PRUnichar nameW[] = {'n','a','m','e',0};
-
if(!elem->dom_element)
return FALSE;
@@ -388,7 +386,7 @@ static BOOL is_elem_name(HTMLElement *elem, LPCWSTR name)
return TRUE;
}
- nsres = get_elem_attr_value(elem->dom_element, nameW, &nsstr, &str);
+ nsres = get_elem_attr_value(elem->dom_element, L"name", &nsstr, &str);
if(NS_SUCCEEDED(nsres)) {
ret = !wcsicmp(str, name);
nsAString_Finish(&nsstr);
diff --git a/dlls/mshtml/htmlform.c b/dlls/mshtml/htmlform.c
index b4715298a1b..5906202f1c7 100644
--- a/dlls/mshtml/htmlform.c
+++ b/dlls/mshtml/htmlform.c
@@ -456,11 +456,9 @@ static HRESULT WINAPI HTMLFormElement_submit(IHTMLFormElement *iface)
if(NS_SUCCEEDED(nsres)) {
const PRUnichar *method;
- static const PRUnichar postW[] = {'p','o','s','t',0};
-
nsAString_GetData(&method_str, &method);
TRACE("method is %s\n", debugstr_w(method));
- is_post_submit = !wcsicmp(method, postW);
+ is_post_submit = !wcsicmp(method, L"post");
}
nsAString_Finish(&method_str);
@@ -661,8 +659,6 @@ static HRESULT HTMLFormElement_get_dispid(HTMLDOMNode *iface,
nsresult nsres;
HRESULT hres = DISP_E_UNKNOWNNAME;
- static const PRUnichar nameW[] = {'n','a','m','e',0};
-
TRACE("(%p)->(%s %x %p)\n", This, wine_dbgstr_w(name), grfdex, pid);
nsres = nsIDOMHTMLFormElement_GetElements(This->nsform, &elements);
@@ -731,7 +727,7 @@ static HRESULT HTMLFormElement_get_dispid(HTMLDOMNode *iface,
}
/* compare by name attr */
- nsres = get_elem_attr_value(elem, nameW, &name_str, &str);
+ nsres = get_elem_attr_value(elem, L"name", &name_str, &str);
nsIDOMElement_Release(elem);
if(NS_SUCCEEDED(nsres)) {
if(!wcsicmp(str, name)) {
diff --git a/dlls/mshtml/htmlhead.c b/dlls/mshtml/htmlhead.c
index 92eda92fbad..879eca424ae 100644
--- a/dlls/mshtml/htmlhead.c
+++ b/dlls/mshtml/htmlhead.c
@@ -448,11 +448,10 @@ static HRESULT WINAPI HTMLMetaElement_put_httpEquiv(IHTMLMetaElement *iface, BST
static HRESULT WINAPI HTMLMetaElement_get_httpEquiv(IHTMLMetaElement *iface, BSTR *p)
{
HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
- static const PRUnichar httpEquivW[] = {'h','t','t','p','-','e','q','u','i','v',0};
TRACE("(%p)->(%p)\n", This, p);
- return elem_string_attr_getter(&This->element, httpEquivW, TRUE, p);
+ return elem_string_attr_getter(&This->element, L"http-equiv", TRUE, p);
}
static HRESULT WINAPI HTMLMetaElement_put_content(IHTMLMetaElement *iface, BSTR v)
@@ -465,11 +464,10 @@ static HRESULT WINAPI HTMLMetaElement_put_content(IHTMLMetaElement *iface, BSTR
static HRESULT WINAPI HTMLMetaElement_get_content(IHTMLMetaElement *iface, BSTR *p)
{
HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
- static const PRUnichar contentW[] = {'c','o','n','t','e','n','t',0};
TRACE("(%p)->(%p)\n", This, p);
- return elem_string_attr_getter(&This->element, contentW, TRUE, p);
+ return elem_string_attr_getter(&This->element, L"content", TRUE, p);
}
static HRESULT WINAPI HTMLMetaElement_put_name(IHTMLMetaElement *iface, BSTR v)
@@ -482,11 +480,10 @@ static HRESULT WINAPI HTMLMetaElement_put_name(IHTMLMetaElement *iface, BSTR v)
static HRESULT WINAPI HTMLMetaElement_get_name(IHTMLMetaElement *iface, BSTR *p)
{
HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
- static const PRUnichar nameW[] = {'n','a','m','e',0};
TRACE("(%p)->(%p)\n", This, p);
- return elem_string_attr_getter(&This->element, nameW, TRUE, p);
+ return elem_string_attr_getter(&This->element, L"name", TRUE, p);
}
static HRESULT WINAPI HTMLMetaElement_put_url(IHTMLMetaElement *iface, BSTR v)
diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c
index 7dc32cd654d..aa4129e760e 100644
--- a/dlls/mshtml/htmlimg.c
+++ b/dlls/mshtml/htmlimg.c
@@ -876,8 +876,6 @@ static HRESULT WINAPI HTMLImageElementFactory_create(IHTMLImageElementFactory *i
LONG l;
HRESULT hres;
- static const PRUnichar imgW[] = {'I','M','G',0};
-
TRACE("(%p)->(%s %s %p)\n", This, debugstr_variant(&width),
debugstr_variant(&height), img_elem);
@@ -890,7 +888,7 @@ static HRESULT WINAPI HTMLImageElementFactory_create(IHTMLImageElementFactory *i
*img_elem = NULL;
- hres = create_nselem(doc, imgW, &nselem);
+ hres = create_nselem(doc, L"IMG", &nselem);
if(FAILED(hres))
return hres;
diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c
index 739da9bf0ff..13a2f8b3f6a 100644
--- a/dlls/mshtml/htmlselect.c
+++ b/dlls/mshtml/htmlselect.c
@@ -538,8 +538,6 @@ static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory
HTMLDOMNode *node;
HRESULT hres;
- static const PRUnichar optionW[] = {'O','P','T','I','O','N',0};
-
TRACE("(%p)->(%s %s %s %s %p)\n", This, debugstr_variant(&text), debugstr_variant(&value),
debugstr_variant(&defaultselected), debugstr_variant(&selected), optelem);
@@ -550,7 +548,7 @@ static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory
*optelem = NULL;
- hres = create_nselem(This->window->doc, optionW, &nselem);
+ hres = create_nselem(This->window->doc, L"OPTION", &nselem);
if(FAILED(hres))
return hres;
diff --git a/dlls/mshtml/nsevents.c b/dlls/mshtml/nsevents.c
index f232a25ba33..21b59cf6e1d 100644
--- a/dlls/mshtml/nsevents.c
+++ b/dlls/mshtml/nsevents.c
@@ -38,11 +38,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
-static const PRUnichar blurW[] = {'b','l','u','r',0};
-static const PRUnichar focusW[] = {'f','o','c','u','s',0};
-static const PRUnichar keypressW[] = {'k','e','y','p','r','e','s','s',0};
-static const PRUnichar loadW[] = {'l','o','a','d',0};
-
typedef struct {
nsIDOMEventListener nsIDOMEventListener_iface;
nsDocumentEventListener *This;
@@ -446,10 +441,10 @@ void release_nsevents(HTMLDocumentNode *doc)
if(!listener)
return;
- detach_nslistener(doc, blurW, &listener->blur_listener, TRUE);
- detach_nslistener(doc, focusW, &listener->focus_listener, TRUE);
- detach_nslistener(doc, keypressW, &listener->keypress_listener, FALSE);
- detach_nslistener(doc, loadW, &listener->load_listener, TRUE);
+ detach_nslistener(doc, L"blur", &listener->blur_listener, TRUE);
+ detach_nslistener(doc, L"focus", &listener->focus_listener, TRUE);
+ detach_nslistener(doc, L"keypress", &listener->keypress_listener, FALSE);
+ detach_nslistener(doc, L"load", &listener->load_listener, TRUE);
listener->doc = NULL;
release_listener(listener);
@@ -482,10 +477,10 @@ void init_nsevents(HTMLDocumentNode *doc)
if(!target)
return;
- init_event(target, blurW, &listener->blur_listener.nsIDOMEventListener_iface, TRUE);
- init_event(target, focusW, &listener->focus_listener.nsIDOMEventListener_iface, TRUE);
- init_event(target, keypressW, &listener->keypress_listener.nsIDOMEventListener_iface, FALSE);
- init_event(target, loadW, &listener->load_listener.nsIDOMEventListener_iface, TRUE);
+ init_event(target, L"blur", &listener->blur_listener.nsIDOMEventListener_iface, TRUE);
+ init_event(target, L"focus", &listener->focus_listener.nsIDOMEventListener_iface, TRUE);
+ init_event(target, L"keypress", &listener->keypress_listener.nsIDOMEventListener_iface, FALSE);
+ init_event(target, L"load", &listener->load_listener.nsIDOMEventListener_iface, TRUE);
nsIDOMEventTarget_Release(target);
}
diff --git a/dlls/mshtml/nsservice.c b/dlls/mshtml/nsservice.c
index 2eb838b2f54..55a65cfeae6 100644
--- a/dlls/mshtml/nsservice.c
+++ b/dlls/mshtml/nsservice.c
@@ -126,8 +126,6 @@ static nsresult NSAPI nsPromptService_ConfirmEx(nsIPromptService *iface,
const PRUnichar *aButton1Title, const PRUnichar *aButton2Title,
const PRUnichar *aCheckMsg, cpp_bool *aCheckState, LONG *_retval)
{
- static const PRUnichar wszContinue[] = {'C','o','n','t','i','n','u','e',0};
-
FIXME("(%p %s %s %08x %s %s %s %s %p %p) hack!\n", aParent, debugstr_w(aDialogTitle),
debugstr_w(aText), aButtonFlags, debugstr_w(aButton0Title),
debugstr_w(aButton1Title), debugstr_w(aButton2Title), debugstr_w(aCheckMsg),
@@ -138,11 +136,11 @@ static nsresult NSAPI nsPromptService_ConfirmEx(nsIPromptService *iface,
* This is really very very ugly hack!!!
*/
- if(aButton0Title && !memcmp(aButton0Title, wszContinue, sizeof(wszContinue)))
+ if(aButton0Title && !memcmp(aButton0Title, L"Continue", sizeof(L"Continue")))
*_retval = 0;
- else if(aButton1Title && !memcmp(aButton1Title, wszContinue, sizeof(wszContinue)))
+ else if(aButton1Title && !memcmp(aButton1Title, L"Continue", sizeof(L"Continue")))
*_retval = 1;
- else if(aButton2Title && !memcmp(aButton2Title, wszContinue, sizeof(wszContinue)))
+ else if(aButton2Title && !memcmp(aButton2Title, L"Continue", sizeof(L"Continue")))
*_retval = 2;
/* else
* let's hope that _retval is set to the default value */
diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c
index a79f2d000ef..22d350bedd8 100644
--- a/dlls/mshtml/olecmd.c
+++ b/dlls/mshtml/olecmd.c
@@ -219,14 +219,12 @@ static void set_default_templates(nsIPrintSettings *settings)
{
WCHAR buf[64];
- static const PRUnichar empty[] = {0};
-
- nsIPrintSettings_SetHeaderStrLeft(settings, empty);
- nsIPrintSettings_SetHeaderStrRight(settings, empty);
- nsIPrintSettings_SetHeaderStrCenter(settings, empty);
- nsIPrintSettings_SetFooterStrLeft(settings, empty);
- nsIPrintSettings_SetFooterStrRight(settings, empty);
- nsIPrintSettings_SetFooterStrCenter(settings, empty);
+ nsIPrintSettings_SetHeaderStrLeft(settings, L"");
+ nsIPrintSettings_SetHeaderStrRight(settings, L"");
+ nsIPrintSettings_SetHeaderStrCenter(settings, L"");
+ nsIPrintSettings_SetFooterStrLeft(settings, L"");
+ nsIPrintSettings_SetFooterStrRight(settings, L"");
+ nsIPrintSettings_SetFooterStrCenter(settings, L"");
if(LoadStringW(get_shdoclc(), IDS_PRINT_HEADER_TEMPLATE, buf, ARRAY_SIZE(buf)))
set_print_template(settings, buf, TRUE);
diff --git a/dlls/mshtml/pluginhost.c b/dlls/mshtml/pluginhost.c
index b47d06f1d5b..d880cc89a9d 100644
--- a/dlls/mshtml/pluginhost.c
+++ b/dlls/mshtml/pluginhost.c
@@ -279,11 +279,7 @@ static HRESULT fill_props(nsIDOMElement *nselem, PropertyBag *prop_bag)
nsresult nsres;
HRESULT hres = S_OK;
- static const PRUnichar nameW[] = {'n','a','m','e',0};
- static const PRUnichar paramW[] = {'p','a','r','a','m',0};
- static const PRUnichar valueW[] = {'v','a','l','u','e',0};
-
- nsAString_InitDepend(&name_str, paramW);
+ nsAString_InitDepend(&name_str, L"param");
nsres = nsIDOMElement_GetElementsByTagName(nselem, &name_str, ¶ms);
nsAString_Finish(&name_str);
if(NS_FAILED(nsres))
@@ -307,9 +303,9 @@ static HRESULT fill_props(nsIDOMElement *nselem, PropertyBag *prop_bag)
break;
}
- nsres = get_elem_attr_value(param_elem, nameW, &name_str, &name);
+ nsres = get_elem_attr_value(param_elem, L"name", &name_str, &name);
if(NS_SUCCEEDED(nsres)) {
- nsres = get_elem_attr_value(param_elem, valueW, &value_str, &value);
+ nsres = get_elem_attr_value(param_elem, L"value", &value_str, &value);
if(NS_SUCCEEDED(nsres)) {
hres = add_prop(prop_bag, name, value);
nsAString_Finish(&value_str);
@@ -2297,9 +2293,7 @@ static BOOL get_elem_clsid(nsIDOMElement *elem, CLSID *clsid)
nsresult nsres;
BOOL ret = FALSE;
- static const PRUnichar classidW[] = {'c','l','a','s','s','i','d',0};
-
- nsres = get_elem_attr_value(elem, classidW, &val_str, &val);
+ nsres = get_elem_attr_value(elem, L"classid", &val_str, &val);
if(NS_SUCCEEDED(nsres)) {
if(*val)
ret = parse_classid(val, clsid);
@@ -2535,9 +2529,7 @@ static void check_codebase(HTMLInnerWindow *window, nsIDOMElement *nselem)
nsresult nsres;
HRESULT hres;
- static const PRUnichar codebaseW[] = {'c','o','d','e','b','a','s','e',0};
-
- nsres = get_elem_attr_value(nselem, codebaseW, &val_str, &val);
+ nsres = get_elem_attr_value(nselem, L"codebase", &val_str, &val);
if(NS_SUCCEEDED(nsres)) {
if(*val) {
hres = CoInternetCombineUrlEx(window->base.outer_window->uri, val, 0, &uri, 0);
diff --git a/dlls/mshtml/range.c b/dlls/mshtml/range.c
index 7db62f49a12..d38d64b4151 100644
--- a/dlls/mshtml/range.c
+++ b/dlls/mshtml/range.c
@@ -1674,9 +1674,6 @@ static HRESULT exec_indent(HTMLTxtRange *This, VARIANT *in, VARIANT *out)
nsIDOMDocumentFragment *fragment;
nsIDOMNode *tmp;
- static const PRUnichar blockquoteW[] = {'B','L','O','C','K','Q','U','O','T','E',0};
- static const PRUnichar pW[] = {'P',0};
-
TRACE("(%p)->(%p %p)\n", This, in, out);
if(!This->doc->nsdoc) {
@@ -1684,8 +1681,8 @@ static HRESULT exec_indent(HTMLTxtRange *This, VARIANT *in, VARIANT *out)
return E_NOTIMPL;
}
- create_nselem(This->doc, blockquoteW, &blockquote_elem);
- create_nselem(This->doc, pW, &p_elem);
+ create_nselem(This->doc, L"BLOCKQUOTE", &blockquote_elem);
+ create_nselem(This->doc, L"P", &p_elem);
nsIDOMRange_ExtractContents(This->nsrange, &fragment);
nsIDOMElement_AppendChild(p_elem, (nsIDOMNode*)fragment, &tmp);
diff --git a/dlls/mshtml/script.c b/dlls/mshtml/script.c
index 6f06d3b0919..bb097081c5e 100644
--- a/dlls/mshtml/script.c
+++ b/dlls/mshtml/script.c
@@ -1210,8 +1210,6 @@ static BOOL get_script_guid(HTMLInnerWindow *window, nsIDOMHTMLScriptElement *ns
BOOL ret = FALSE;
nsresult nsres;
- static const PRUnichar languageW[] = {'l','a','n','g','u','a','g','e',0};
-
nsAString_Init(&val_str, NULL);
nsres = nsIDOMHTMLScriptElement_GetType(nsscript, &val_str);
@@ -1231,7 +1229,7 @@ static BOOL get_script_guid(HTMLInnerWindow *window, nsIDOMHTMLScriptElement *ns
nsres = nsIDOMHTMLScriptElement_QueryInterface(nsscript, &IID_nsIDOMElement, (void**)&nselem);
assert(nsres == NS_OK);
- nsres = get_elem_attr_value(nselem, languageW, &val_str, &language);
+ nsres = get_elem_attr_value(nselem, L"language", &val_str, &language);
nsIDOMElement_Release(nselem);
if(NS_SUCCEEDED(nsres)) {
if(*language) {
@@ -1554,14 +1552,12 @@ void bind_event_scripts(HTMLDocumentNode *doc)
nsresult nsres;
HRESULT hres;
- static const PRUnichar selectorW[] = {'s','c','r','i','p','t','[','e','v','e','n','t',']',0};
-
TRACE("%p\n", doc);
if(!doc->nsdoc)
return;
- nsAString_InitDepend(&selector_str, selectorW);
+ nsAString_InitDepend(&selector_str, L"script[event]");
nsres = nsIDOMHTMLDocument_QuerySelectorAll(doc->nsdoc, &selector_str, &node_list);
nsAString_Finish(&selector_str);
if(NS_FAILED(nsres)) {
--
2.26.2
2
1
Nov. 24, 2020
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/mshtml/htmlanchor.c | 10 ++--
dlls/mshtml/htmlbody.c | 38 ++++++---------
dlls/mshtml/htmldoc.c | 32 ++++---------
dlls/mshtml/htmlelem.c | 49 ++++++--------------
dlls/mshtml/htmlform.c | 14 ++----
dlls/mshtml/htmlframe.c | 13 ++----
dlls/mshtml/htmlhead.c | 6 +--
dlls/mshtml/htmlimg.c | 6 +--
dlls/mshtml/htmlinput.c | 21 ++-------
dlls/mshtml/htmllocation.c | 6 +--
dlls/mshtml/htmlobject.c | 10 ++--
dlls/mshtml/htmlstyle.c | 94 +++++++++++++-------------------------
dlls/mshtml/htmltable.c | 3 +-
dlls/mshtml/htmltextarea.c | 4 +-
dlls/mshtml/htmlwindow.c | 8 +---
15 files changed, 97 insertions(+), 217 deletions(-)
diff --git a/dlls/mshtml/htmlanchor.c b/dlls/mshtml/htmlanchor.c
index 64cc6db8755..a0e96af822e 100644
--- a/dlls/mshtml/htmlanchor.c
+++ b/dlls/mshtml/htmlanchor.c
@@ -65,27 +65,23 @@ HTMLOuterWindow *get_target_window(HTMLOuterWindow *window, nsAString *target_st
const PRUnichar *target;
HRESULT hres;
- static const WCHAR _parentW[] = {'_','p','a','r','e','n','t',0};
- static const WCHAR _selfW[] = {'_','s','e','l','f',0};
- static const WCHAR _topW[] = {'_','t','o','p',0};
-
*use_new_window = FALSE;
nsAString_GetData(target_str, &target);
TRACE("%s\n", debugstr_w(target));
- if(!*target || !wcsicmp(target, _selfW)) {
+ if(!*target || !wcsicmp(target, L"_self")) {
IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface);
return window;
}
- if(!wcsicmp(target, _topW)) {
+ if(!wcsicmp(target, L"_top")) {
get_top_window(window, &top_window);
IHTMLWindow2_AddRef(&top_window->base.IHTMLWindow2_iface);
return top_window;
}
- if(!wcsicmp(target, _parentW)) {
+ if(!wcsicmp(target, L"_parent")) {
if(!window->parent) {
WARN("Window has no parent, treat as self\n");
IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface);
diff --git a/dlls/mshtml/htmlbody.c b/dlls/mshtml/htmlbody.c
index 4209fd2cc2e..9955a8e6498 100644
--- a/dlls/mshtml/htmlbody.c
+++ b/dlls/mshtml/htmlbody.c
@@ -115,8 +115,6 @@ HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret)
unsigned int i;
int rgb = -1;
- static const WCHAR formatW[] = {'#','%','0','2','x','%','0','2','x','%','0','2','x',0};
-
if(!color || !*color) {
*ret = NULL;
return S_OK;
@@ -135,7 +133,7 @@ HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret)
if(!*ret)
return E_OUTOFMEMORY;
- swprintf(*ret, 8, formatW, rgb>>16, (rgb>>8)&0xff, rgb&0xff);
+ swprintf(*ret, 8, L"#%02x%02x%02x", rgb>>16, (rgb>>8)&0xff, rgb&0xff);
TRACE("%s -> %s\n", debugstr_w(color), debugstr_w(*ret));
return S_OK;
@@ -150,9 +148,8 @@ BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr)
case VT_I4: {
PRUnichar buf[10];
- static const WCHAR formatW[] = {'#','%','x',0};
- wsprintfW(buf, formatW, V_I4(v));
+ wsprintfW(buf, L"#%x", V_I4(v));
nsAString_Init(nsstr, buf);
return TRUE;
}
@@ -576,13 +573,6 @@ static HRESULT WINAPI HTMLBodyElement_get_onunload(IHTMLBodyElement *iface, VARI
return E_NOTIMPL;
}
-static const WCHAR autoW[] = {'a','u','t','o',0};
-static const WCHAR hiddenW[] = {'h','i','d','d','e','n',0};
-static const WCHAR scrollW[] = {'s','c','r','o','l','l',0};
-static const WCHAR visibleW[] = {'v','i','s','i','b','l','e',0};
-static const WCHAR yesW[] = {'y','e','s',0};
-static const WCHAR noW[] = {'n','o',0};
-
static HRESULT WINAPI HTMLBodyElement_put_scroll(IHTMLBodyElement *iface, BSTR v)
{
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
@@ -591,12 +581,12 @@ static HRESULT WINAPI HTMLBodyElement_put_scroll(IHTMLBodyElement *iface, BSTR v
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
/* Emulate with CSS visibility attribute */
- if(!wcscmp(v, yesW)) {
- val = scrollW;
- }else if(!wcscmp(v, autoW)) {
- val = visibleW;
- }else if(!wcscmp(v, noW)) {
- val = hiddenW;
+ if(!wcscmp(v, L"yes")) {
+ val = L"scroll";
+ }else if(!wcscmp(v, L"auto")) {
+ val = L"visible";
+ }else if(!wcscmp(v, L"no")) {
+ val = L"hidden";
}else {
WARN("Invalid argument %s\n", debugstr_w(v));
return E_INVALIDARG;
@@ -622,12 +612,12 @@ static HRESULT WINAPI HTMLBodyElement_get_scroll(IHTMLBodyElement *iface, BSTR *
if(!overflow || !*overflow) {
*p = NULL;
hres = S_OK;
- }else if(!wcscmp(overflow, visibleW) || !wcscmp(overflow, autoW)) {
- ret = autoW;
- }else if(!wcscmp(overflow, scrollW)) {
- ret = yesW;
- }else if(!wcscmp(overflow, hiddenW)) {
- ret = noW;
+ }else if(!wcscmp(overflow, L"visible") || !wcscmp(overflow, L"auto")) {
+ ret = L"auto";
+ }else if(!wcscmp(overflow, L"scroll")) {
+ ret = L"yes";
+ }else if(!wcscmp(overflow, L"hidden")) {
+ ret = L"no";
}else {
TRACE("Defaulting %s to NULL\n", debugstr_w(overflow));
*p = NULL;
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 5644d92dbe5..767b46a7050 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -577,11 +577,9 @@ static HRESULT WINAPI HTMLDocument_put_designMode(IHTMLDocument2 *iface, BSTR v)
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
HRESULT hres;
- static const WCHAR onW[] = {'o','n',0};
-
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
- if(wcsicmp(v, onW)) {
+ if(wcsicmp(v, L"on")) {
FIXME("Unsupported arg %s\n", debugstr_w(v));
return E_NOTIMPL;
}
@@ -597,13 +595,12 @@ static HRESULT WINAPI HTMLDocument_put_designMode(IHTMLDocument2 *iface, BSTR v)
static HRESULT WINAPI HTMLDocument_get_designMode(IHTMLDocument2 *iface, BSTR *p)
{
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
- static const WCHAR szOff[] = {'O','f','f',0};
FIXME("(%p)->(%p) always returning Off\n", This, p);
if(!p)
return E_INVALIDARG;
- *p = SysAllocString(szOff);
+ *p = SysAllocString(L"Off");
return S_OK;
}
@@ -824,12 +821,9 @@ static HRESULT WINAPI HTMLDocument_get_URL(IHTMLDocument2 *iface, BSTR *p)
{
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
- static const WCHAR about_blank_url[] =
- {'a','b','o','u','t',':','b','l','a','n','k',0};
-
TRACE("(%p)->(%p)\n", iface, p);
- *p = SysAllocString(This->window->url ? This->window->url : about_blank_url);
+ *p = SysAllocString(This->window->url ? This->window->url : L"about:blank");
return *p ? S_OK : E_OUTOFMEMORY;
}
@@ -1119,8 +1113,6 @@ static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT
nsISupports *tmp;
nsresult nsres;
- static const WCHAR text_htmlW[] = {'t','e','x','t','/','h','t','m','l',0};
-
TRACE("(%p)->(%s %s %s %s %p)\n", This, debugstr_w(url), debugstr_variant(&name),
debugstr_variant(&features), debugstr_variant(&replace), pomWindowResult);
@@ -1129,7 +1121,7 @@ static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT
return E_NOTIMPL;
}
- if(!url || wcscmp(url, text_htmlW) || V_VT(&name) != VT_ERROR
+ if(!url || wcscmp(url, L"text/html") || V_VT(&name) != VT_ERROR
|| V_VT(&features) != VT_ERROR || V_VT(&replace) != VT_ERROR)
FIXME("unsupported args\n");
@@ -1709,14 +1701,12 @@ static HRESULT WINAPI HTMLDocument_toString(IHTMLDocument2 *iface, BSTR *String)
{
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
- static const WCHAR objectW[] = {'[','o','b','j','e','c','t',']',0};
-
TRACE("(%p)->(%p)\n", This, String);
if(!String)
return E_INVALIDARG;
- *String = SysAllocString(objectW);
+ *String = SysAllocString(L"[object]");
return *String ? S_OK : E_OUTOFMEMORY;
}
@@ -1731,8 +1721,6 @@ static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR
nsresult nsres;
HRESULT hres;
- static const WCHAR styleW[] = {'s','t','y','l','e',0};
-
TRACE("(%p)->(%s %d %p)\n", This, debugstr_w(bstrHref), lIndex, ppnewStyleSheet);
if(!This->doc_node->nsdoc) {
@@ -1749,7 +1737,7 @@ static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR
return S_OK;
}
- hres = create_element(This->doc_node, styleW, &elem);
+ hres = create_element(This->doc_node, L"style", &elem);
if(FAILED(hres))
return hres;
@@ -2362,8 +2350,7 @@ static HRESULT WINAPI HTMLDocument3_getElementsByName(IHTMLDocument3 *iface, BST
nsAString selector_str;
WCHAR *selector;
nsresult nsres;
-
- static const WCHAR formatW[] = {'*','[','i','d','=','%','s',']',',','*','[','n','a','m','e','=','%','s',']',0};
+ static const WCHAR formatW[] = L"*[id=%s],*[name=%s]";
TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), ppelColl);
@@ -3006,12 +2993,9 @@ static HRESULT WINAPI HTMLDocument5_get_compatMode(IHTMLDocument5 *iface, BSTR *
{
HTMLDocument *This = impl_from_IHTMLDocument5(iface);
- static const WCHAR BackCompatW[] = {'B','a','c','k','C','o','m','p','a','t',0};
- static const WCHAR CSS1CompatW[] = {'C','S','S','1','C','o','m','p','a','t',0};
-
TRACE("(%p)->(%p)\n", This, p);
- *p = SysAllocString(This->doc_node->document_mode <= COMPAT_MODE_IE5 ? BackCompatW : CSS1CompatW);
+ *p = SysAllocString(This->doc_node->document_mode <= COMPAT_MODE_IE5 ? L"BackCompat" : L"CSS1Compat");
return *p ? S_OK : E_OUTOFMEMORY;
}
diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index 1dcddbaa672..732db50a78c 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -860,13 +860,11 @@ HRESULT attr_value_to_string(VARIANT *v)
{
HRESULT hres;
- static const WCHAR nullW[] = {'n','u','l','l',0};
-
switch(V_VT(v)) {
case VT_BSTR:
break;
case VT_NULL:
- V_BSTR(v) = SysAllocString(nullW);
+ V_BSTR(v) = SysAllocString(L"null");
if(!V_BSTR(v))
return E_OUTOFMEMORY;
V_VT(v) = VT_BSTR;
@@ -1043,10 +1041,8 @@ static HRESULT WINAPI HTMLElement_get_tagName(IHTMLElement *iface, BSTR *p)
TRACE("(%p)->(%p)\n", This, p);
if(!This->dom_element) {
- static const WCHAR comment_tagW[] = {'!',0};
-
TRACE("comment element\n");
- *p = SysAllocString(comment_tagW);
+ *p = SysAllocString(L"!");
return *p ? S_OK : E_OUTOFMEMORY;
}
@@ -1314,8 +1310,6 @@ static HRESULT WINAPI HTMLElement_get_document(IHTMLElement *iface, IDispatch **
return S_OK;
}
-static const WCHAR titleW[] = {'t','i','t','l','e',0};
-
static HRESULT WINAPI HTMLElement_put_title(IHTMLElement *iface, BSTR v)
{
HTMLElement *This = impl_from_IHTMLElement(iface);
@@ -1328,7 +1322,7 @@ static HRESULT WINAPI HTMLElement_put_title(IHTMLElement *iface, BSTR v)
VARIANT *var;
HRESULT hres;
- hres = dispex_get_dprop_ref(&This->node.event_target.dispex, titleW, TRUE, &var);
+ hres = dispex_get_dprop_ref(&This->node.event_target.dispex, L"title", TRUE, &var);
if(FAILED(hres))
return hres;
@@ -1359,7 +1353,7 @@ static HRESULT WINAPI HTMLElement_get_title(IHTMLElement *iface, BSTR *p)
VARIANT *var;
HRESULT hres;
- hres = dispex_get_dprop_ref(&This->node.event_target.dispex, titleW, FALSE, &var);
+ hres = dispex_get_dprop_ref(&This->node.event_target.dispex, L"title", FALSE, &var);
if(hres == DISP_E_UNKNOWNNAME) {
*p = NULL;
}else if(V_VT(var) != VT_BSTR) {
@@ -1377,15 +1371,13 @@ static HRESULT WINAPI HTMLElement_get_title(IHTMLElement *iface, BSTR *p)
return return_nsstr(nsres, &title_str, p);
}
-static const WCHAR languageW[] = {'l','a','n','g','u','a','g','e',0};
-
static HRESULT WINAPI HTMLElement_put_language(IHTMLElement *iface, BSTR v)
{
HTMLElement *This = impl_from_IHTMLElement(iface);
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
- return elem_string_attr_setter(This, languageW, v);
+ return elem_string_attr_setter(This, L"language", v);
}
static HRESULT WINAPI HTMLElement_get_language(IHTMLElement *iface, BSTR *p)
@@ -1394,7 +1386,7 @@ static HRESULT WINAPI HTMLElement_get_language(IHTMLElement *iface, BSTR *p)
TRACE("(%p)->(%p)\n", This, p);
- return elem_string_attr_getter(This, languageW, TRUE, p);
+ return elem_string_attr_getter(This, L"language", TRUE, p);
}
static HRESULT WINAPI HTMLElement_put_onselectstart(IHTMLElement *iface, VARIANT v)
@@ -1845,12 +1837,7 @@ static HRESULT insert_adjacent_node(HTMLElement *This, const WCHAR *where, nsIDO
nsresult nsres;
HRESULT hres = S_OK;
- static const WCHAR beforebeginW[] = {'b','e','f','o','r','e','b','e','g','i','n',0};
- static const WCHAR afterbeginW[] = {'a','f','t','e','r','b','e','g','i','n',0};
- static const WCHAR beforeendW[] = {'b','e','f','o','r','e','e','n','d',0};
- static const WCHAR afterendW[] = {'a','f','t','e','r','e','n','d',0};
-
- if (!wcsicmp(where, beforebeginW)) {
+ if (!wcsicmp(where, L"beforebegin")) {
nsIDOMNode *parent;
nsres = nsIDOMNode_GetParentNode(This->node.nsnode, &parent);
@@ -1862,7 +1849,7 @@ static HRESULT insert_adjacent_node(HTMLElement *This, const WCHAR *where, nsIDO
nsres = nsIDOMNode_InsertBefore(parent, nsnode, This->node.nsnode, &ret_nsnode);
nsIDOMNode_Release(parent);
- }else if(!wcsicmp(where, afterbeginW)) {
+ }else if(!wcsicmp(where, L"afterbegin")) {
nsIDOMNode *first_child;
nsres = nsIDOMNode_GetFirstChild(This->node.nsnode, &first_child);
@@ -1875,9 +1862,9 @@ static HRESULT insert_adjacent_node(HTMLElement *This, const WCHAR *where, nsIDO
if (first_child)
nsIDOMNode_Release(first_child);
- }else if (!wcsicmp(where, beforeendW)) {
+ }else if (!wcsicmp(where, L"beforeend")) {
nsres = nsIDOMNode_AppendChild(This->node.nsnode, nsnode, &ret_nsnode);
- }else if (!wcsicmp(where, afterendW)) {
+ }else if (!wcsicmp(where, L"afterend")) {
nsIDOMNode *next_sibling, *parent;
nsres = nsIDOMNode_GetParentNode(This->node.nsnode, &parent);
@@ -2806,7 +2793,7 @@ static HRESULT WINAPI HTMLElement2_put_accessKey(IHTMLElement2 *iface, BSTR v)
HTMLElement *This = impl_from_IHTMLElement2(iface);
VARIANT var;
- static WCHAR accessKeyW[] = {'a','c','c','e','s','s','K','e','y',0};
+ static WCHAR accessKeyW[] = L"accessKey";
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
@@ -3016,9 +3003,7 @@ static HRESULT WINAPI HTMLElement2_get_readyState(IHTMLElement2 *iface, VARIANT
if(FAILED(hres))
return hres;
}else {
- static const WCHAR completeW[] = {'c','o','m','p','l','e','t','e',0};
-
- str = SysAllocString(completeW);
+ str = SysAllocString(L"complete");
if(!str)
return E_OUTOFMEMORY;
}
@@ -3750,8 +3735,6 @@ static HRESULT WINAPI HTMLElement3_get_hideFocus(IHTMLElement3 *iface, VARIANT_B
return E_NOTIMPL;
}
-static const WCHAR disabledW[] = {'d','i','s','a','b','l','e','d',0};
-
static HRESULT WINAPI HTMLElement3_put_disabled(IHTMLElement3 *iface, VARIANT_BOOL v)
{
HTMLElement *This = impl_from_IHTMLElement3(iface);
@@ -3763,7 +3746,7 @@ static HRESULT WINAPI HTMLElement3_put_disabled(IHTMLElement3 *iface, VARIANT_BO
if(This->node.vtbl->put_disabled)
return This->node.vtbl->put_disabled(&This->node, v);
- hres = dispex_get_dprop_ref(&This->node.event_target.dispex, disabledW, TRUE, &var);
+ hres = dispex_get_dprop_ref(&This->node.event_target.dispex, L"disabled", TRUE, &var);
if(FAILED(hres))
return hres;
@@ -3784,7 +3767,7 @@ static HRESULT WINAPI HTMLElement3_get_disabled(IHTMLElement3 *iface, VARIANT_BO
if(This->node.vtbl->get_disabled)
return This->node.vtbl->get_disabled(&This->node, p);
- hres = dispex_get_dprop_ref(&This->node.event_target.dispex, disabledW, FALSE, &var);
+ hres = dispex_get_dprop_ref(&This->node.event_target.dispex, L"disabled", FALSE, &var);
if(hres == DISP_E_UNKNOWNNAME) {
*p = VARIANT_FALSE;
return S_OK;
@@ -5095,9 +5078,7 @@ HRESULT elem_unique_id(unsigned id, BSTR *p)
{
WCHAR buf[32];
- static const WCHAR formatW[] = {'m','s','_','_','i','d','%','u',0};
-
- swprintf(buf, ARRAY_SIZE(buf), formatW, id);
+ swprintf(buf, ARRAY_SIZE(buf), L"ms__id%u", id);
*p = SysAllocString(buf);
return *p ? S_OK : E_OUTOFMEMORY;
}
diff --git a/dlls/mshtml/htmlform.c b/dlls/mshtml/htmlform.c
index 63e8f1bb2d0..b4715298a1b 100644
--- a/dlls/mshtml/htmlform.c
+++ b/dlls/mshtml/htmlform.c
@@ -227,19 +227,14 @@ static HRESULT WINAPI HTMLFormElement_get_dir(IHTMLFormElement *iface, BSTR *p)
static HRESULT WINAPI HTMLFormElement_put_encoding(IHTMLFormElement *iface, BSTR v)
{
- static const WCHAR urlencodedW[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
- 'x','-','w','w','w','-','f','o','r','m','-','u','r','l','e','n','c','o','d','e','d',0};
- static const WCHAR dataW[] = {'m','u','l','t','i','p','a','r','t','/',
- 'f','o','r','m','-','d','a','t','a',0};
- static const WCHAR plainW[] = {'t','e','x','t','/','p','l','a','i','n',0};
-
HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
nsAString encoding_str;
nsresult nsres;
TRACE("(%p)->(%s)\n", This, wine_dbgstr_w(v));
- if(lstrcmpiW(v, urlencodedW) && lstrcmpiW(v, dataW) && lstrcmpiW(v, plainW)) {
+ if(lstrcmpiW(v, L"application/x-www-form-urlencoded") && lstrcmpiW(v, L"multipart/form-data")
+ && lstrcmpiW(v, L"text/plain")) {
WARN("incorrect enctype\n");
return E_INVALIDARG;
}
@@ -268,16 +263,13 @@ static HRESULT WINAPI HTMLFormElement_get_encoding(IHTMLFormElement *iface, BSTR
static HRESULT WINAPI HTMLFormElement_put_method(IHTMLFormElement *iface, BSTR v)
{
- static const WCHAR postW[] = {'P','O','S','T',0};
- static const WCHAR getW[] = {'G','E','T',0};
-
HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
nsAString method_str;
nsresult nsres;
TRACE("(%p)->(%s)\n", This, wine_dbgstr_w(v));
- if(lstrcmpiW(v, postW) && lstrcmpiW(v, getW)) {
+ if(lstrcmpiW(v, L"POST") && lstrcmpiW(v, L"GET")) {
WARN("unrecognized method\n");
return E_INVALIDARG;
}
diff --git a/dlls/mshtml/htmlframe.c b/dlls/mshtml/htmlframe.c
index e451f030453..972ddc80a50 100644
--- a/dlls/mshtml/htmlframe.c
+++ b/dlls/mshtml/htmlframe.c
@@ -34,11 +34,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
-static const WCHAR autoW[] = {'a','u','t','o',0};
-static const WCHAR yesW[] = {'y','e','s',0};
-static const WCHAR noW[] = {'n','o',0};
-static const WCHAR pxW[] = {'p','x',0};
-
static HRESULT set_frame_doc(HTMLFrameBase *frame, nsIDOMDocument *nsdoc)
{
mozIDOMWindowProxy *mozwindow;
@@ -343,7 +338,7 @@ static HRESULT WINAPI HTMLFrameBase_get_marginWidth(IHTMLFrameBase *iface, VARIA
if(*str) {
BSTR ret;
- end = wcsstr(str, pxW);
+ end = wcsstr(str, L"px");
if(!end)
end = str+lstrlenW(str);
ret = SysAllocStringLen(str, end-str);
@@ -410,7 +405,7 @@ static HRESULT WINAPI HTMLFrameBase_get_marginHeight(IHTMLFrameBase *iface, VARI
if(*str) {
BSTR ret;
- end = wcsstr(str, pxW);
+ end = wcsstr(str, L"px");
if(!end)
end = str+lstrlenW(str);
ret = SysAllocStringLen(str, end-str);
@@ -455,7 +450,7 @@ static HRESULT WINAPI HTMLFrameBase_put_scrolling(IHTMLFrameBase *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
- if(!(!wcsicmp(v, yesW) || !wcsicmp(v, noW) || !wcsicmp(v, autoW)))
+ if(!(!wcsicmp(v, L"yes") || !wcsicmp(v, L"no") || !wcsicmp(v, L"auto")))
return E_INVALIDARG;
if(This->nsframe) {
@@ -509,7 +504,7 @@ static HRESULT WINAPI HTMLFrameBase_get_scrolling(IHTMLFrameBase *iface, BSTR *p
if(*strdata)
*p = SysAllocString(strdata);
else
- *p = SysAllocString(autoW);
+ *p = SysAllocString(L"auto");
nsAString_Finish(&nsstr);
diff --git a/dlls/mshtml/htmlhead.c b/dlls/mshtml/htmlhead.c
index 57bd0e6f968..92eda92fbad 100644
--- a/dlls/mshtml/htmlhead.c
+++ b/dlls/mshtml/htmlhead.c
@@ -503,15 +503,13 @@ static HRESULT WINAPI HTMLMetaElement_get_url(IHTMLMetaElement *iface, BSTR *p)
return E_NOTIMPL;
}
-static const WCHAR charsetW[] = {'c','h','a','r','s','e','t',0};
-
static HRESULT WINAPI HTMLMetaElement_put_charset(IHTMLMetaElement *iface, BSTR v)
{
HTMLMetaElement *This = impl_from_IHTMLMetaElement(iface);
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
- return elem_string_attr_setter(&This->element, charsetW, v);
+ return elem_string_attr_setter(&This->element, L"charset", v);
}
static HRESULT WINAPI HTMLMetaElement_get_charset(IHTMLMetaElement *iface, BSTR *p)
@@ -520,7 +518,7 @@ static HRESULT WINAPI HTMLMetaElement_get_charset(IHTMLMetaElement *iface, BSTR
TRACE("(%p)->(%p)\n", This, p);
- return elem_string_attr_getter(&This->element, charsetW, TRUE, p);
+ return elem_string_attr_getter(&This->element, L"charset", TRUE, p);
}
static const IHTMLMetaElementVtbl HTMLMetaElementVtbl = {
diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c
index 7f1ecd038b0..7dc32cd654d 100644
--- a/dlls/mshtml/htmlimg.c
+++ b/dlls/mshtml/htmlimg.c
@@ -303,8 +303,6 @@ static HRESULT WINAPI HTMLImgElement_get_src(IHTMLImgElement *iface, BSTR *p)
nsresult nsres;
HRESULT hres = S_OK;
- static const WCHAR blockedW[] = {'B','L','O','C','K','E','D',':',':',0};
-
TRACE("(%p)->(%p)\n", This, p);
nsAString_Init(&src_str, NULL);
@@ -312,9 +310,9 @@ static HRESULT WINAPI HTMLImgElement_get_src(IHTMLImgElement *iface, BSTR *p)
if(NS_SUCCEEDED(nsres)) {
nsAString_GetData(&src_str, &src);
- if(!wcsnicmp(src, blockedW, ARRAY_SIZE(blockedW)-1)) {
+ if(!wcsnicmp(src, L"BLOCKED::", ARRAY_SIZE(L"BLOCKED::")-1)) {
TRACE("returning BLOCKED::\n");
- *p = SysAllocString(blockedW);
+ *p = SysAllocString(L"BLOCKED::");
if(!*p)
hres = E_OUTOFMEMORY;
}else {
diff --git a/dlls/mshtml/htmlinput.c b/dlls/mshtml/htmlinput.c
index 765ae79c2b7..2ba5833f3c0 100644
--- a/dlls/mshtml/htmlinput.c
+++ b/dlls/mshtml/htmlinput.c
@@ -44,8 +44,6 @@ struct HTMLInputElement {
nsIDOMHTMLInputElement *nsinput;
};
-static const WCHAR forW[] = {'f','o','r',0};
-
static inline HTMLInputElement *impl_from_IHTMLInputElement(IHTMLInputElement *iface)
{
return CONTAINING_RECORD(iface, HTMLInputElement, IHTMLInputElement_iface);
@@ -1302,11 +1300,9 @@ static HRESULT WINAPI HTMLInputTextElement2_setSelectionRange(IHTMLInputTextElem
nsAString none_str;
nsresult nsres;
- static const WCHAR noneW[] = {'n','o','n','e',0};
-
TRACE("(%p)->(%d %d)\n", This, start, end);
- nsAString_InitDepend(&none_str, noneW);
+ nsAString_InitDepend(&none_str, L"none");
nsres = nsIDOMHTMLInputElement_SetSelectionRange(This->nsinput, start, end, &none_str);
nsAString_Finish(&none_str);
if(NS_FAILED(nsres)) {
@@ -1387,19 +1383,12 @@ static BOOL HTMLInputElement_is_text_edit(HTMLDOMNode *iface)
nsresult nsres;
BOOL ret = FALSE;
- static const WCHAR buttonW[] = {'b','u','t','t','o','n',0};
- static const WCHAR hiddenW[] = {'h','i','d','d','e','n',0};
- static const WCHAR passwordW[] = {'p','a','s','s','w','o','r','d',0};
- static const WCHAR resetW[] = {'r','e','s','e','t',0};
- static const WCHAR submitW[] = {'s','u','b','m','i','t',0};
- static const WCHAR textW[] = {'t','e','x','t',0};
-
nsAString_Init(&nsstr, NULL);
nsres = nsIDOMHTMLInputElement_GetType(This->nsinput, &nsstr);
if(NS_SUCCEEDED(nsres)) {
nsAString_GetData(&nsstr, &type);
- ret = !wcscmp(type, buttonW) || !wcscmp(type, hiddenW) || !wcscmp(type, passwordW)
- || !wcscmp(type, resetW) || !wcscmp(type, submitW) || !wcscmp(type, textW);
+ ret = !wcscmp(type, L"button") || !wcscmp(type, L"hidden") || !wcscmp(type, L"password")
+ || !wcscmp(type, L"reset") || !wcscmp(type, L"submit") || !wcscmp(type, L"text");
}
nsAString_Finish(&nsstr);
return ret;
@@ -1557,7 +1546,7 @@ static HRESULT WINAPI HTMLLabelElement_put_htmlFor(IHTMLLabelElement *iface, BST
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
- nsAString_InitDepend(&for_str, forW);
+ nsAString_InitDepend(&for_str, L"for");
nsAString_InitDepend(&val_str, v);
nsres = nsIDOMElement_SetAttribute(This->element.dom_element, &for_str, &val_str);
nsAString_Finish(&for_str);
@@ -1576,7 +1565,7 @@ static HRESULT WINAPI HTMLLabelElement_get_htmlFor(IHTMLLabelElement *iface, BST
TRACE("(%p)->(%p)\n", This, p);
- return elem_string_attr_getter(&This->element, forW, FALSE, p);
+ return elem_string_attr_getter(&This->element, L"for", FALSE, p);
}
static HRESULT WINAPI HTMLLabelElement_put_accessKey(IHTMLLabelElement *iface, BSTR v)
diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c
index 7d102044cc2..4e15fb45242 100644
--- a/dlls/mshtml/htmllocation.c
+++ b/dlls/mshtml/htmllocation.c
@@ -350,12 +350,11 @@ static HRESULT WINAPI HTMLLocation_get_host(IHTMLLocation *iface, BSTR *p)
if(url.nPort) {
/* <hostname>:<port> */
- static const WCHAR format[] = {'%','u',0};
DWORD len, port_len;
WCHAR portW[6];
WCHAR *buf;
- port_len = swprintf(portW, ARRAY_SIZE(portW), format, url.nPort);
+ port_len = swprintf(portW, ARRAY_SIZE(portW), L"%u", url.nPort);
len = url.dwHostNameLength + 1 /* ':' */ + port_len;
buf = *p = SysAllocStringLen(NULL, len);
memcpy(buf, url.lpszHostName, url.dwHostNameLength * sizeof(WCHAR));
@@ -435,10 +434,9 @@ static HRESULT WINAPI HTMLLocation_get_port(IHTMLLocation *iface, BSTR *p)
return hres;
if(hres == S_OK) {
- static const WCHAR formatW[] = {'%','u',0};
WCHAR buf[12];
- swprintf(buf, ARRAY_SIZE(buf), formatW, port);
+ swprintf(buf, ARRAY_SIZE(buf), L"%u", port);
*p = SysAllocString(buf);
}else {
*p = SysAllocStringLen(NULL, 0);
diff --git a/dlls/mshtml/htmlobject.c b/dlls/mshtml/htmlobject.c
index 9505820583f..b71b0e7db6f 100644
--- a/dlls/mshtml/htmlobject.c
+++ b/dlls/mshtml/htmlobject.c
@@ -267,8 +267,7 @@ static HRESULT WINAPI HTMLObjectElement_put_width(IHTMLObjectElement *iface, VAR
switch(V_VT(&v)) {
case VT_I4: {
- static const WCHAR formatW[] = {'%','d',0};
- swprintf(buf, ARRAY_SIZE(buf), formatW, V_I4(&v));
+ swprintf(buf, ARRAY_SIZE(buf), L"%d", V_I4(&v));
break;
}
default:
@@ -326,8 +325,7 @@ static HRESULT WINAPI HTMLObjectElement_put_height(IHTMLObjectElement *iface, VA
switch(V_VT(&v)) {
case VT_I4: {
- static const WCHAR formatW[] = {'%','d',0};
- swprintf(buf, ARRAY_SIZE(buf), formatW, V_I4(&v));
+ swprintf(buf, ARRAY_SIZE(buf), L"%d", V_I4(&v));
break;
}
default:
@@ -577,11 +575,9 @@ static HRESULT WINAPI HTMLObjectElement2_put_classid(IHTMLObjectElement2 *iface,
HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface);
HRESULT hres;
- static const WCHAR classidW[] = {'c','l','a','s','s','i','d',0};
-
FIXME("(%p)->(%s) semi-stub\n", This, debugstr_w(v));
- hres = elem_string_attr_setter(&This->plugin_container.element, classidW, v);
+ hres = elem_string_attr_setter(&This->plugin_container.element, L"classid", v);
if(FAILED(hres))
return hres;
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index ae21c1f7299..43a71d6286c 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -35,20 +35,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
-static const WCHAR blinkW[] = {'b','l','i','n','k',0};
-static const WCHAR dashedW[] = {'d','a','s','h','e','d',0};
-static const WCHAR dottedW[] = {'d','o','t','t','e','d',0};
-static const WCHAR doubleW[] = {'d','o','u','b','l','e',0};
-static const WCHAR grooveW[] = {'g','r','o','o','v','e',0};
-static const WCHAR insetW[] = {'i','n','s','e','t',0};
-static const WCHAR line_throughW[] = {'l','i','n','e','-','t','h','r','o','u','g','h',0};
-static const WCHAR noneW[] = {'n','o','n','e',0};
-static const WCHAR outsetW[] = {'o','u','t','s','e','t',0};
-static const WCHAR overlineW[] = {'o','v','e','r','l','i','n','e',0};
-static const WCHAR ridgeW[] = {'r','i','d','g','e',0};
-static const WCHAR solidW[] = {'s','o','l','i','d',0};
-static const WCHAR underlineW[] = {'u','n','d','e','r','l','i','n','e',0};
-
static const WCHAR *font_style_values[] = {
L"italic",
L"normal",
@@ -125,8 +111,6 @@ static const WCHAR *overflow_values[] = {
#define ATTR_NO_NULL 0x0020
#define ATTR_COMPAT_IE10 0x0040
-static const WCHAR pxW[] = {'p','x',0};
-
typedef struct {
const WCHAR *name;
DISPID dispid;
@@ -708,9 +692,6 @@ static const style_tbl_entry_t style_tbl[] = {
C_ASSERT(ARRAY_SIZE(style_tbl) == STYLEID_MAX_VALUE);
-static const WCHAR px_formatW[] = {'%','d','p','x',0};
-static const WCHAR emptyW[] = {0};
-
static const style_tbl_entry_t *lookup_style_tbl(CSSStyle *style, const WCHAR *name)
{
int c, i, min = 0, max = ARRAY_SIZE(style_tbl)-1;
@@ -798,7 +779,7 @@ static HRESULT set_nsstyle_property(nsIDOMCSSStyleDeclaration *nsstyle, styleid_
nsresult nsres;
nsAString_InitDepend(&str_name, style_tbl[sid].name);
- nsAString_InitDepend(&str_empty, emptyW);
+ nsAString_InitDepend(&str_empty, L"");
nsres = nsIDOMCSSStyleDeclaration_SetProperty(nsstyle, &str_name, value, &str_empty);
nsAString_Finish(&str_name);
nsAString_Finish(&str_empty);
@@ -837,7 +818,7 @@ static inline HRESULT set_style_property(CSSStyle *style, styleid_t sid, const W
}
if(!*iter) {
WARN("invalid value %s\n", debugstr_w(value));
- nsAString_InitDepend(&value_str, emptyW);
+ nsAString_InitDepend(&value_str, L"");
set_nsstyle_property(style->nsstyle, sid, &value_str);
nsAString_Finish(&value_str);
return E_INVALIDARG;
@@ -1027,12 +1008,11 @@ static HRESULT check_style_attr_value(HTMLStyle *This, styleid_t sid, LPCWSTR ex
static inline HRESULT set_style_pos(HTMLStyle *This, styleid_t sid, float value)
{
- static const WCHAR szFormat[] = {'%','.','0','f','p','x',0};
WCHAR szValue[25];
value = floor(value);
- swprintf(szValue, ARRAY_SIZE(szValue), szFormat, value);
+ swprintf(szValue, ARRAY_SIZE(szValue), L"%.0fpx", value);
return set_style_property(&This->css_style, sid, szValue);
}
@@ -1041,7 +1021,7 @@ static HRESULT set_style_pxattr(HTMLStyle *style, styleid_t sid, LONG value)
{
WCHAR value_str[16];
- swprintf(value_str, ARRAY_SIZE(value_str), px_formatW, value);
+ swprintf(value_str, ARRAY_SIZE(value_str), L"%dpx", value);
return set_style_property(&style->css_style, sid, value_str);
}
@@ -1068,7 +1048,7 @@ static HRESULT get_nsstyle_pos(HTMLStyle *This, styleid_t sid, float *p)
{
*p = wcstol(value, &ptr, 10);
- if(*ptr && wcscmp(ptr, pxW))
+ if(*ptr && wcscmp(ptr, L"px"))
{
nsAString_Finish(&str_value);
FIXME("only px values are currently supported\n");
@@ -1108,7 +1088,7 @@ static HRESULT get_nsstyle_pixel_val(HTMLStyle *This, styleid_t sid, LONG *p)
}
}
- if(!ptr || (*ptr && wcscmp(ptr, pxW)))
+ if(!ptr || (*ptr && wcscmp(ptr, L"px")))
*p = 0;
}
@@ -1118,11 +1098,11 @@ static HRESULT get_nsstyle_pixel_val(HTMLStyle *This, styleid_t sid, LONG *p)
static BOOL is_valid_border_style(BSTR v)
{
- return !v || wcsicmp(v, noneW) == 0 || wcsicmp(v, dottedW) == 0 ||
- wcsicmp(v, dashedW) == 0 || wcsicmp(v, solidW) == 0 ||
- wcsicmp(v, doubleW) == 0 || wcsicmp(v, grooveW) == 0 ||
- wcsicmp(v, ridgeW) == 0 || wcsicmp(v, insetW) == 0 ||
- wcsicmp(v, outsetW) == 0;
+ return !v || wcsicmp(v, L"none") == 0 || wcsicmp(v, L"dotted") == 0 ||
+ wcsicmp(v, L"dashed") == 0 || wcsicmp(v, L"solid") == 0 ||
+ wcsicmp(v, L"double") == 0 || wcsicmp(v, L"groove") == 0 ||
+ wcsicmp(v, L"ridge") == 0 || wcsicmp(v, L"inset") == 0 ||
+ wcsicmp(v, L"outset") == 0;
}
static void *HTMLStyle_QI(CSSStyle *css_style, REFIID riid)
@@ -1514,7 +1494,7 @@ static HRESULT WINAPI HTMLStyle_put_textDecorationNone(IHTMLStyle *iface, VARIAN
TRACE("(%p)->(%x)\n", This, v);
- return set_style_property(&This->css_style, STYLEID_TEXT_DECORATION, v ? noneW : emptyW);
+ return set_style_property(&This->css_style, STYLEID_TEXT_DECORATION, v ? L"none" : L"");
}
static HRESULT WINAPI HTMLStyle_get_textDecorationNone(IHTMLStyle *iface, VARIANT_BOOL *p)
@@ -1523,7 +1503,7 @@ static HRESULT WINAPI HTMLStyle_get_textDecorationNone(IHTMLStyle *iface, VARIAN
TRACE("(%p)->(%p)\n", This, p);
- return check_style_attr_value(This, STYLEID_TEXT_DECORATION, noneW, p);
+ return check_style_attr_value(This, STYLEID_TEXT_DECORATION, L"none", p);
}
static HRESULT WINAPI HTMLStyle_put_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL v)
@@ -1532,7 +1512,7 @@ static HRESULT WINAPI HTMLStyle_put_textDecorationUnderline(IHTMLStyle *iface, V
TRACE("(%p)->(%x)\n", This, v);
- return set_style_property(&This->css_style, STYLEID_TEXT_DECORATION, v ? underlineW : emptyW);
+ return set_style_property(&This->css_style, STYLEID_TEXT_DECORATION, v ? L"underline" : L"");
}
static HRESULT WINAPI HTMLStyle_get_textDecorationUnderline(IHTMLStyle *iface, VARIANT_BOOL *p)
@@ -1541,7 +1521,7 @@ static HRESULT WINAPI HTMLStyle_get_textDecorationUnderline(IHTMLStyle *iface, V
TRACE("(%p)->(%p)\n", This, p);
- return check_style_attr_value(This, STYLEID_TEXT_DECORATION, underlineW, p);
+ return check_style_attr_value(This, STYLEID_TEXT_DECORATION, L"underline", p);
}
static HRESULT WINAPI HTMLStyle_put_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL v)
@@ -1550,7 +1530,7 @@ static HRESULT WINAPI HTMLStyle_put_textDecorationOverline(IHTMLStyle *iface, VA
TRACE("(%p)->(%x)\n", This, v);
- return set_style_property(&This->css_style, STYLEID_TEXT_DECORATION, v ? overlineW : emptyW);
+ return set_style_property(&This->css_style, STYLEID_TEXT_DECORATION, v ? L"overline" : L"");
}
static HRESULT WINAPI HTMLStyle_get_textDecorationOverline(IHTMLStyle *iface, VARIANT_BOOL *p)
@@ -1559,7 +1539,7 @@ static HRESULT WINAPI HTMLStyle_get_textDecorationOverline(IHTMLStyle *iface, VA
TRACE("(%p)->(%p)\n", This, p);
- return check_style_attr_value(This, STYLEID_TEXT_DECORATION, overlineW, p);
+ return check_style_attr_value(This, STYLEID_TEXT_DECORATION, L"overline", p);
}
static HRESULT WINAPI HTMLStyle_put_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL v)
@@ -1568,7 +1548,7 @@ static HRESULT WINAPI HTMLStyle_put_textDecorationLineThrough(IHTMLStyle *iface,
TRACE("(%p)->(%x)\n", This, v);
- return set_style_property(&This->css_style, STYLEID_TEXT_DECORATION, v ? line_throughW : emptyW);
+ return set_style_property(&This->css_style, STYLEID_TEXT_DECORATION, v ? L"line-through" : L"");
}
static HRESULT WINAPI HTMLStyle_get_textDecorationLineThrough(IHTMLStyle *iface, VARIANT_BOOL *p)
@@ -1577,7 +1557,7 @@ static HRESULT WINAPI HTMLStyle_get_textDecorationLineThrough(IHTMLStyle *iface,
TRACE("(%p)->(%p)\n", This, p);
- return check_style_attr_value(This, STYLEID_TEXT_DECORATION, line_throughW, p);
+ return check_style_attr_value(This, STYLEID_TEXT_DECORATION, L"line-through", p);
}
static HRESULT WINAPI HTMLStyle_put_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL v)
@@ -1586,7 +1566,7 @@ static HRESULT WINAPI HTMLStyle_put_textDecorationBlink(IHTMLStyle *iface, VARIA
TRACE("(%p)->(%x)\n", This, v);
- return set_style_property(&This->css_style, STYLEID_TEXT_DECORATION, v ? blinkW : emptyW);
+ return set_style_property(&This->css_style, STYLEID_TEXT_DECORATION, v ? L"blink" : L"");
}
static HRESULT WINAPI HTMLStyle_get_textDecorationBlink(IHTMLStyle *iface, VARIANT_BOOL *p)
@@ -1595,7 +1575,7 @@ static HRESULT WINAPI HTMLStyle_get_textDecorationBlink(IHTMLStyle *iface, VARIA
TRACE("(%p)->(%p)\n", This, p);
- return check_style_attr_value(This, STYLEID_TEXT_DECORATION, blinkW, p);
+ return check_style_attr_value(This, STYLEID_TEXT_DECORATION, L"blink", p);
}
static HRESULT WINAPI HTMLStyle_put_verticalAlign(IHTMLStyle *iface, VARIANT v)
@@ -2117,7 +2097,6 @@ static HRESULT WINAPI HTMLStyle_get_borderLeftWidth(IHTMLStyle *iface, VARIANT *
static HRESULT WINAPI HTMLStyle_put_borderStyle(IHTMLStyle *iface, BSTR v)
{
HTMLStyle *This = impl_from_IHTMLStyle(iface);
- static const WCHAR styleWindowInset[] = {'w','i','n','d','o','w','-','i','n','s','e','t',0};
HRESULT hres = S_OK;
BSTR pstyle;
int i=0;
@@ -2130,7 +2109,7 @@ static HRESULT WINAPI HTMLStyle_put_borderStyle(IHTMLStyle *iface, BSTR v)
if(v[i] == (WCHAR)' ')
{
pstyle = SysAllocStringLen(&v[last], (i-last));
- if( !(is_valid_border_style(pstyle) || wcsicmp(styleWindowInset, pstyle) == 0))
+ if( !(is_valid_border_style(pstyle) || wcsicmp(L"window-inset", pstyle) == 0))
{
TRACE("1. Invalid style (%s)\n", debugstr_w(pstyle));
hres = E_INVALIDARG;
@@ -2144,7 +2123,7 @@ static HRESULT WINAPI HTMLStyle_put_borderStyle(IHTMLStyle *iface, BSTR v)
if(hres == S_OK)
{
pstyle = SysAllocStringLen(&v[last], i-last);
- if( !(is_valid_border_style(pstyle) || wcsicmp(styleWindowInset, pstyle) == 0))
+ if( !(is_valid_border_style(pstyle) || wcsicmp(L"window-inset", pstyle) == 0))
{
TRACE("2. Invalid style (%s)\n", debugstr_w(pstyle));
hres = E_INVALIDARG;
@@ -2755,13 +2734,11 @@ static void set_opacity(HTMLStyle *This, const WCHAR *val)
nsAString name_str, val_str, empty_str;
nsresult nsres;
- static const WCHAR opacityW[] = {'o','p','a','c','i','t','y',0};
-
TRACE("%s\n", debugstr_w(val));
- nsAString_InitDepend(&name_str, opacityW);
+ nsAString_InitDepend(&name_str, L"opacity");
nsAString_InitDepend(&val_str, val);
- nsAString_InitDepend(&empty_str, emptyW);
+ nsAString_InitDepend(&empty_str, L"");
nsres = nsIDOMCSSStyleDeclaration_SetProperty(This->css_style.nsstyle, &name_str, &val_str, &empty_str);
if(NS_FAILED(nsres))
@@ -2784,7 +2761,7 @@ static void update_filter(HTMLStyle *This)
ptr = This->elem->filter;
TRACE("%s\n", debugstr_w(ptr));
if(!ptr) {
- set_opacity(This, emptyW);
+ set_opacity(This, L"");
return;
}
@@ -2807,7 +2784,6 @@ static void update_filter(HTMLStyle *This)
}
if(ptr2 + ARRAY_SIZE(alphaW) == ptr && !memcmp(ptr2, alphaW, sizeof(alphaW))) {
- static const WCHAR formatW[] = {'%','f',0};
static const WCHAR opacityW[] = {'o','p','a','c','i','t','y','='};
ptr++;
@@ -2839,7 +2815,7 @@ static void update_filter(HTMLStyle *This)
}
}
- swprintf(buf, ARRAY_SIZE(buf), formatW, fval * 0.01f);
+ swprintf(buf, ARRAY_SIZE(buf), L"%f", fval * 0.01f);
set_opacity(This, buf);
}else {
FIXME("unknown param %s\n", debugstr_wn(ptr2, ptr-ptr2));
@@ -5137,10 +5113,8 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_put_backgroundPositionX(IHTMLCSSSt
nsAString_GetData(&pos_str, &pos);
posy = wcschr(pos, ' ');
if(!posy) {
- static const WCHAR zero_pxW[] = {' ','0','p','x',0};
-
TRACE("no space in %s\n", debugstr_w(pos));
- posy = zero_pxW;
+ posy = L" 0px";
}
posy_len = lstrlenW(posy);
@@ -5234,11 +5208,9 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_put_backgroundPositionY(IHTMLCSSSt
if(space) {
space++;
}else {
- static const WCHAR zero_pxW[] = {'0','p','x',' ',0};
-
TRACE("no space in %s\n", debugstr_w(pos));
- pos = zero_pxW;
- space = pos + ARRAY_SIZE(zero_pxW)-1;
+ pos = L"0px ";
+ space = pos + ARRAY_SIZE(L"0px ")-1;
}
posx_len = space-pos;
@@ -6521,8 +6493,6 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_get_layoutFlow(IHTMLCSSStyleDeclar
return E_NOTIMPL;
}
-static const WCHAR zoomW[] = {'z','o','o','m',0};
-
static HRESULT WINAPI HTMLCSSStyleDeclaration_put_zoom(IHTMLCSSStyleDeclaration *iface, VARIANT v)
{
CSSStyle *This = impl_from_IHTMLCSSStyleDeclaration(iface);
@@ -6536,7 +6506,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_put_zoom(IHTMLCSSStyleDeclaration
if(V_VT(&v) != VT_I4 || V_I4(&v) != 1)
WARN("stub for %s\n", debugstr_variant(&v));
- hres = dispex_get_dprop_ref(&This->dispex, zoomW, TRUE, &var);
+ hres = dispex_get_dprop_ref(&This->dispex, L"zoom", TRUE, &var);
if(FAILED(hres))
return hres;
@@ -6551,7 +6521,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_get_zoom(IHTMLCSSStyleDeclaration
TRACE("(%p)->(%p)\n", This, p);
- hres = dispex_get_dprop_ref(&This->dispex, zoomW, FALSE, &var);
+ hres = dispex_get_dprop_ref(&This->dispex, L"zoom", FALSE, &var);
if(hres == DISP_E_UNKNOWNNAME) {
V_VT(p) = VT_BSTR;
V_BSTR(p) = NULL;
diff --git a/dlls/mshtml/htmltable.c b/dlls/mshtml/htmltable.c
index 43a4f6ba08a..ad74ad30966 100644
--- a/dlls/mshtml/htmltable.c
+++ b/dlls/mshtml/htmltable.c
@@ -1191,8 +1191,7 @@ static HRESULT WINAPI HTMLTable_put_cellSpacing(IHTMLTable *iface, VARIANT v)
nsAString_InitDepend(&nsstr, V_BSTR(&v));
break;
case VT_I4: {
- static const WCHAR formatW[] = {'%','d',0};
- swprintf(buf, ARRAY_SIZE(buf), formatW, V_I4(&v));
+ swprintf(buf, ARRAY_SIZE(buf), L"%d", V_I4(&v));
nsAString_InitDepend(&nsstr, buf);
break;
}
diff --git a/dlls/mshtml/htmltextarea.c b/dlls/mshtml/htmltextarea.c
index caf5d85f749..fb8c3830862 100644
--- a/dlls/mshtml/htmltextarea.c
+++ b/dlls/mshtml/htmltextarea.c
@@ -101,13 +101,11 @@ static HRESULT WINAPI HTMLTextAreaElement_Invoke(IHTMLTextAreaElement *iface, DI
static HRESULT WINAPI HTMLTextAreaElement_get_type(IHTMLTextAreaElement *iface, BSTR *p)
{
- static const WCHAR textareaW[] = {'t','e','x','t','a','r','e','a',0};
-
HTMLTextAreaElement *This = impl_from_IHTMLTextAreaElement(iface);
TRACE("(%p)->(%p)\n", This, p);
- *p = SysAllocString(textareaW);
+ *p = SysAllocString(L"textarea");
if(!*p)
return E_OUTOFMEMORY;
return S_OK;
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index a49cd4bd59d..69717ff7848 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -978,8 +978,6 @@ static HRESULT WINAPI HTMLWindow2_open(IHTMLWindow2 *iface, BSTR url, BSTR name,
IUri *uri;
HRESULT hres;
- static const WCHAR _selfW[] = {'_','s','e','l','f',0};
-
TRACE("(%p)->(%s %s %s %x %p)\n", This, debugstr_w(url), debugstr_w(name),
debugstr_w(features), replace, pomWindowResult);
if(features)
@@ -991,7 +989,7 @@ static HRESULT WINAPI HTMLWindow2_open(IHTMLWindow2 *iface, BSTR url, BSTR name,
return E_UNEXPECTED;
if(name && *name == '_') {
- if(!wcscmp(name, _selfW)) {
+ if(!wcscmp(name, L"_self")) {
if((features && *features) || replace)
FIXME("Unsupported arguments for _self target\n");
@@ -1440,14 +1438,12 @@ static HRESULT WINAPI HTMLWindow2_toString(IHTMLWindow2 *iface, BSTR *String)
{
HTMLWindow *This = impl_from_IHTMLWindow2(iface);
- static const WCHAR objectW[] = {'[','o','b','j','e','c','t',']',0};
-
TRACE("(%p)->(%p)\n", This, String);
if(!String)
return E_INVALIDARG;
- *String = SysAllocString(objectW);
+ *String = SysAllocString(L"[object]");
return *String ? S_OK : E_OUTOFMEMORY;
}
--
2.26.2
2
1
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/jscript/activex.c | 4 +-
dlls/jscript/bool.c | 9 +--
dlls/jscript/compile.c | 4 +-
dlls/jscript/date.c | 65 +++++-----------
dlls/jscript/dispex.c | 15 +---
dlls/jscript/engine.c | 35 +++------
dlls/jscript/enumerator.c | 6 +-
dlls/jscript/error.c | 35 +++------
dlls/jscript/function.c | 44 ++++-------
dlls/jscript/global.c | 78 ++++++-------------
dlls/jscript/json.c | 27 +++----
dlls/jscript/jsregexp.c | 27 ++-----
dlls/jscript/jsstr.c | 6 +-
dlls/jscript/jsutils.c | 19 ++---
dlls/jscript/lex.c | 4 +-
dlls/jscript/number.c | 7 +-
dlls/jscript/string.c | 159 ++++++++++++--------------------------
dlls/jscript/vbarray.c | 4 +-
18 files changed, 167 insertions(+), 381 deletions(-)
diff --git a/dlls/jscript/activex.c b/dlls/jscript/activex.c
index 9c8c681b5e7..80a89b5ae89 100644
--- a/dlls/jscript/activex.c
+++ b/dlls/jscript/activex.c
@@ -190,13 +190,11 @@ HRESULT create_activex_constr(script_ctx_t *ctx, jsdisp_t **ret)
jsdisp_t *prototype;
HRESULT hres;
- static const WCHAR ActiveXObjectW[] = {'A','c','t','i','v','e','X','O','b','j','e','c','t',0};
-
hres = create_object(ctx, NULL, &prototype);
if(FAILED(hres))
return hres;
- hres = create_builtin_function(ctx, ActiveXObject_value, ActiveXObjectW, NULL,
+ hres = create_builtin_function(ctx, ActiveXObject_value, L"ActiveXObject", NULL,
PROPF_CONSTR|1, prototype, ret);
jsdisp_release(prototype);
diff --git a/dlls/jscript/bool.c b/dlls/jscript/bool.c
index f31117e2141..44a8b7262de 100644
--- a/dlls/jscript/bool.c
+++ b/dlls/jscript/bool.c
@@ -57,9 +57,6 @@ static HRESULT Bool_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
{
BoolInstance *bool;
- static const WCHAR trueW[] = {'t','r','u','e',0};
- static const WCHAR falseW[] = {'f','a','l','s','e',0};
-
TRACE("\n");
if(!(bool = bool_this(jsthis)))
@@ -68,7 +65,7 @@ static HRESULT Bool_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
if(r) {
jsstr_t *val;
- val = jsstr_alloc(bool->val ? trueW : falseW);
+ val = jsstr_alloc(bool->val ? L"true" : L"false");
if(!val)
return E_OUTOFMEMORY;
@@ -197,13 +194,11 @@ HRESULT create_bool_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdisp
BoolInstance *bool;
HRESULT hres;
- static const WCHAR BooleanW[] = {'B','o','o','l','e','a','n',0};
-
hres = alloc_bool(ctx, object_prototype, &bool);
if(FAILED(hres))
return hres;
- hres = create_builtin_constructor(ctx, BoolConstr_value, BooleanW, NULL,
+ hres = create_builtin_constructor(ctx, BoolConstr_value, L"Boolean", NULL,
PROPF_CONSTR|1, &bool->dispex, ret);
jsdisp_release(&bool->dispex);
diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c
index 5ac93c9f2ff..a1d1171e2ec 100644
--- a/dlls/jscript/compile.c
+++ b/dlls/jscript/compile.c
@@ -719,15 +719,13 @@ static HRESULT compile_delete_expression(compiler_ctx_t *ctx, unary_expression_t
case EXPR_IDENT:
return push_instr_bstr(ctx, OP_delete_ident, ((identifier_expression_t*)expr->expression)->identifier);
default: {
- static const WCHAR fixmeW[] = {'F','I','X','M','E',0};
-
WARN("invalid delete, unimplemented exception message\n");
hres = compile_expression(ctx, expr->expression, TRUE);
if(FAILED(hres))
return hres;
- return push_instr_uint_str(ctx, OP_throw_type, JS_E_INVALID_DELETE, fixmeW);
+ return push_instr_uint_str(ctx, OP_throw_type, JS_E_INVALID_DELETE, L"FIXME");
}
}
diff --git a/dlls/jscript/date.c b/dlls/jscript/date.c
index 4809cc976d8..5ca23f199f3 100644
--- a/dlls/jscript/date.c
+++ b/dlls/jscript/date.c
@@ -431,18 +431,6 @@ static SYSTEMTIME create_systemtime(DOUBLE time)
static inline HRESULT date_to_string(DOUBLE time, BOOL show_offset, int offset, jsval_t *r)
{
- static const WCHAR formatW[] = { '%','s',' ','%','s',' ','%','d',' ',
- '%','0','2','d',':','%','0','2','d',':','%','0','2','d',' ',
- 'U','T','C','%','c','%','0','2','d','%','0','2','d',' ','%','d','%','s',0 };
- static const WCHAR formatUTCW[] = { '%','s',' ','%','s',' ','%','d',' ',
- '%','0','2','d',':','%','0','2','d',':','%','0','2','d',' ',
- 'U','T','C',' ','%','d','%','s',0 };
- static const WCHAR formatNoOffsetW[] = { '%','s',' ','%','s',' ',
- '%','d',' ','%','0','2','d',':','%','0','2','d',':',
- '%','0','2','d',' ','%','d','%','s',0 };
- static const WCHAR ADW[] = { 0 };
- static const WCHAR BCW[] = { ' ','B','.','C','.',0 };
-
static const DWORD week_ids[] = { LOCALE_SABBREVDAYNAME7, LOCALE_SABBREVDAYNAME1,
LOCALE_SABBREVDAYNAME2, LOCALE_SABBREVDAYNAME3, LOCALE_SABBREVDAYNAME4,
LOCALE_SABBREVDAYNAME5, LOCALE_SABBREVDAYNAME6 };
@@ -490,18 +478,18 @@ static inline HRESULT date_to_string(DOUBLE time, BOOL show_offset, int offset,
}
if(!show_offset)
- swprintf(buf, ARRAY_SIZE(buf), formatNoOffsetW, week, month, day,
+ swprintf(buf, ARRAY_SIZE(buf), L"%s %s %d %02d:%02d:%02d %d%s", week, month, day,
(int)hour_from_time(time), (int)min_from_time(time),
- (int)sec_from_time(time), year, formatAD?ADW:BCW);
+ (int)sec_from_time(time), year, formatAD?L"":L" B.C.");
else if(offset)
- swprintf(buf, ARRAY_SIZE(buf), formatW, week, month, day,
+ swprintf(buf, ARRAY_SIZE(buf), L"%s %s %d %02d:%02d:%02d UTC%c%02d%02d %d%s", week, month, day,
(int)hour_from_time(time), (int)min_from_time(time),
(int)sec_from_time(time), sign, offset/60, offset%60,
- year, formatAD?ADW:BCW);
+ year, formatAD?L"":L" B.C.");
else
- swprintf(buf, ARRAY_SIZE(buf), formatUTCW, week, month, day,
+ swprintf(buf, ARRAY_SIZE(buf), L"%s %s %d %02d:%02d:%02d UTC %d%s", week, month, day,
(int)hour_from_time(time), (int)min_from_time(time),
- (int)sec_from_time(time), year, formatAD?ADW:BCW);
+ (int)sec_from_time(time), year, formatAD?L"":L" B.C.");
date_jsstr = jsstr_alloc(buf);
if(!date_jsstr)
@@ -588,11 +576,6 @@ static HRESULT Date_toISOString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
WCHAR buf[64], *p = buf;
double year;
- static const WCHAR short_year_formatW[] = {'%','0','4','d',0};
- static const WCHAR long_year_formatW[] = {'%','0','6','d',0};
- static const WCHAR formatW[] = {'-','%','0','2','d','-','%','0','2','d',
- 'T','%','0','2','d',':','%','0','2','d',':','%','0','2','d','.','%','0','3','d','Z',0};
-
TRACE("\n");
if(!(date = date_this(jsthis)))
@@ -606,15 +589,15 @@ static HRESULT Date_toISOString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
if(year < 0) {
*p++ = '-';
- p += swprintf(p, ARRAY_SIZE(buf) - 1, long_year_formatW, -(int)year);
+ p += swprintf(p, ARRAY_SIZE(buf) - 1, L"%06d", -(int)year);
}else if(year > 9999) {
*p++ = '+';
- p += swprintf(p, ARRAY_SIZE(buf) - 1, long_year_formatW, (int)year);
+ p += swprintf(p, ARRAY_SIZE(buf) - 1, L"%06d", (int)year);
}else {
- p += swprintf(p, ARRAY_SIZE(buf), short_year_formatW, (int)year);
+ p += swprintf(p, ARRAY_SIZE(buf), L"%04d", (int)year);
}
- swprintf(p, ARRAY_SIZE(buf) - (p - buf), formatW,
+ swprintf(p, ARRAY_SIZE(buf) - (p - buf), L"-%02d-%02dT%02d:%02d:%02d.%03dZ",
(int)month_from_time(date->time) + 1, (int)date_from_time(date->time),
(int)hour_from_time(date->time), (int)min_from_time(date->time),
(int)sec_from_time(date->time), (int)ms_from_time(date->time));
@@ -645,11 +628,6 @@ static HRESULT Date_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
static inline HRESULT create_utc_string(script_ctx_t *ctx, vdisp_t *jsthis, jsval_t *r)
{
- static const WCHAR formatADW[] = { '%','s',',',' ','%','d',' ','%','s',' ','%','d',' ',
- '%','0','2','d',':','%','0','2','d',':','%','0','2','d',' ','U','T','C',0 };
- static const WCHAR formatBCW[] = { '%','s',',',' ','%','d',' ','%','s',' ','%','d',' ','B','.','C','.',' ',
- '%','0','2','d',':','%','0','2','d',':','%','0','2','d',' ','U','T','C',0 };
-
static const DWORD week_ids[] = { LOCALE_SABBREVDAYNAME7, LOCALE_SABBREVDAYNAME1,
LOCALE_SABBREVDAYNAME2, LOCALE_SABBREVDAYNAME3, LOCALE_SABBREVDAYNAME4,
LOCALE_SABBREVDAYNAME5, LOCALE_SABBREVDAYNAME6 };
@@ -694,8 +672,9 @@ static inline HRESULT create_utc_string(script_ctx_t *ctx, vdisp_t *jsthis, jsva
day = date_from_time(date->time);
- swprintf(buf, ARRAY_SIZE(buf), formatAD ? formatADW : formatBCW, week, day, month, year,
- (int)hour_from_time(date->time), (int)min_from_time(date->time),
+ swprintf(buf, ARRAY_SIZE(buf),
+ formatAD ? L"%s, %d %s %d %02d:%02d:%02d UTC" : L"%s, %d %s %d B.C. %02d:%02d:%02d UTC",
+ week, day, month, year, (int)hour_from_time(date->time), (int)min_from_time(date->time),
(int)sec_from_time(date->time));
date_str = jsstr_alloc(buf);
@@ -725,9 +704,6 @@ static HRESULT Date_toGMTString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
/* ECMA-262 3rd Edition 15.9.5.3 */
static HRESULT dateobj_to_date_string(DateInstance *date, jsval_t *r)
{
- static const WCHAR formatADW[] = { '%','s',' ','%','s',' ','%','d',' ','%','d',0 };
- static const WCHAR formatBCW[] = { '%','s',' ','%','s',' ','%','d',' ','%','d',' ','B','.','C','.',0 };
-
static const DWORD week_ids[] = { LOCALE_SABBREVDAYNAME7, LOCALE_SABBREVDAYNAME1,
LOCALE_SABBREVDAYNAME2, LOCALE_SABBREVDAYNAME3, LOCALE_SABBREVDAYNAME4,
LOCALE_SABBREVDAYNAME5, LOCALE_SABBREVDAYNAME6 };
@@ -771,7 +747,8 @@ static HRESULT dateobj_to_date_string(DateInstance *date, jsval_t *r)
day = date_from_time(time);
- swprintf(buf, ARRAY_SIZE(buf), formatAD ? formatADW : formatBCW, week, month, day, year);
+ swprintf(buf, ARRAY_SIZE(buf), formatAD ? L"%s %s %d %d" : L"%s %s %d %d B.C.", week, month,
+ day, year);
date_str = jsstr_alloc(buf);
if(!date_str)
@@ -797,10 +774,6 @@ static HRESULT Date_toDateString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
static HRESULT Date_toTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
- static const WCHAR formatW[] = { '%','0','2','d',':','%','0','2','d',':','%','0','2','d',
- ' ','U','T','C','%','c','%','0','2','d','%','0','2','d',0 };
- static const WCHAR formatUTCW[] = { '%','0','2','d',':','%','0','2','d',
- ':','%','0','2','d',' ','U','T','C',0 };
DateInstance *date;
jsstr_t *date_str;
WCHAR buf[32];
@@ -832,11 +805,11 @@ static HRESULT Date_toTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
else sign = '-';
if(offset)
- swprintf(buf, ARRAY_SIZE(buf), formatW, (int)hour_from_time(time),
+ swprintf(buf, ARRAY_SIZE(buf), L"%02d:%02d:%02d UTC%c%02d%02d", (int)hour_from_time(time),
(int)min_from_time(time), (int)sec_from_time(time),
sign, offset/60, offset%60);
else
- swprintf(buf, ARRAY_SIZE(buf), formatUTCW, (int)hour_from_time(time),
+ swprintf(buf, ARRAY_SIZE(buf), L"%02d:%02d:%02d UTC", (int)hour_from_time(time),
(int)min_from_time(time), (int)sec_from_time(time));
date_str = jsstr_alloc(buf);
@@ -2482,13 +2455,11 @@ HRESULT create_date_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdisp
jsdisp_t *date;
HRESULT hres;
- static const WCHAR DateW[] = {'D','a','t','e',0};
-
hres = create_date(ctx, object_prototype, 0.0, &date);
if(FAILED(hres))
return hres;
- hres = create_builtin_constructor(ctx, DateConstr_value, DateW, &DateConstr_info,
+ hres = create_builtin_constructor(ctx, DateConstr_value, L"Date", &DateConstr_info,
PROPF_CONSTR|7, date, ret);
jsdisp_release(date);
diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c
index f49d5da9719..5829cebe55b 100644
--- a/dlls/jscript/dispex.c
+++ b/dlls/jscript/dispex.c
@@ -1843,9 +1843,7 @@ HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const built
dispex_prop_t *prop;
HRESULT hres;
- static const WCHAR prototypeW[] = {'p','r','o','t','o','t','y','p','e',0};
-
- hres = find_prop_name_prot(constr, string_hash(prototypeW), prototypeW, &prop);
+ hres = find_prop_name_prot(constr, string_hash(L"prototype"), L"prototype", &prop);
if(SUCCEEDED(hres) && prop && prop->type!=PROP_DELETED) {
jsval_t val;
@@ -2148,9 +2146,7 @@ HRESULT jsdisp_propput_idx(jsdisp_t *obj, DWORD idx, jsval_t val)
{
WCHAR buf[12];
- static const WCHAR formatW[] = {'%','d',0};
-
- swprintf(buf, ARRAY_SIZE(buf), formatW, idx);
+ swprintf(buf, ARRAY_SIZE(buf), L"%d", idx);
return jsdisp_propput_name(obj, buf, val);
}
@@ -2213,9 +2209,7 @@ HRESULT jsdisp_get_idx(jsdisp_t *obj, DWORD idx, jsval_t *r)
dispex_prop_t *prop;
HRESULT hres;
- static const WCHAR formatW[] = {'%','d',0};
-
- swprintf(name, ARRAY_SIZE(name), formatW, idx);
+ swprintf(name, ARRAY_SIZE(name), L"%d", idx);
hres = find_prop_name_prot(obj, string_hash(name), name, &prop);
if(FAILED(hres))
@@ -2265,13 +2259,12 @@ HRESULT disp_propget(script_ctx_t *ctx, IDispatch *disp, DISPID id, jsval_t *val
HRESULT jsdisp_delete_idx(jsdisp_t *obj, DWORD idx)
{
- static const WCHAR formatW[] = {'%','d',0};
WCHAR buf[12];
dispex_prop_t *prop;
BOOL b;
HRESULT hres;
- swprintf(buf, ARRAY_SIZE(buf), formatW, idx);
+ swprintf(buf, ARRAY_SIZE(buf), L"%d", idx);
hres = find_prop_name(obj, string_hash(buf), buf, &prop);
if(FAILED(hres) || !prop)
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index bca632129bc..5635e3aa996 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -27,14 +27,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
-static const WCHAR booleanW[] = {'b','o','o','l','e','a','n',0};
-static const WCHAR functionW[] = {'f','u','n','c','t','i','o','n',0};
-static const WCHAR numberW[] = {'n','u','m','b','e','r',0};
-static const WCHAR objectW[] = {'o','b','j','e','c','t',0};
-static const WCHAR stringW[] = {'s','t','r','i','n','g',0};
-static const WCHAR undefinedW[] = {'u','n','d','e','f','i','n','e','d',0};
-static const WCHAR unknownW[] = {'u','n','k','n','o','w','n',0};
-
struct _except_frame_t {
unsigned stack_top;
scope_chain_t *scope;
@@ -632,7 +624,6 @@ static HRESULT identifier_eval(script_ctx_t *ctx, BSTR identifier, exprval_t *re
if(scope->frame) {
function_code_t *func = scope->frame->function;
local_ref_t *ref = lookup_local(func, identifier);
- static const WCHAR argumentsW[] = {'a','r','g','u','m','e','n','t','s',0};
if(ref) {
ret->type = EXPRVAL_STACK_REF;
@@ -641,7 +632,7 @@ static HRESULT identifier_eval(script_ctx_t *ctx, BSTR identifier, exprval_t *re
return S_OK;
}
- if(!wcscmp(identifier, argumentsW)) {
+ if(!wcscmp(identifier, L"arguments")) {
hres = detach_variable_object(ctx, scope->frame, FALSE);
if(FAILED(hres))
return hres;
@@ -1631,8 +1622,6 @@ static HRESULT interp_instanceof(script_ctx_t *ctx)
BOOL ret = FALSE;
HRESULT hres;
- static const WCHAR prototypeW[] = {'p','r','o','t','o','t', 'y', 'p','e',0};
-
v = stack_pop(ctx);
if(!is_object_instance(v) || !get_object(v)) {
jsval_release(v);
@@ -1647,7 +1636,7 @@ static HRESULT interp_instanceof(script_ctx_t *ctx)
}
if(is_class(obj, JSCLASS_FUNCTION)) {
- hres = jsdisp_propget_name(obj, prototypeW, &prot);
+ hres = jsdisp_propget_name(obj, L"prototype", &prot);
}else {
hres = JS_E_FUNCTION_EXPECTED;
}
@@ -1945,30 +1934,30 @@ static HRESULT typeof_string(jsval_t v, const WCHAR **ret)
{
switch(jsval_type(v)) {
case JSV_UNDEFINED:
- *ret = undefinedW;
+ *ret = L"undefined";
break;
case JSV_NULL:
- *ret = objectW;
+ *ret = L"object";
break;
case JSV_OBJECT: {
jsdisp_t *dispex;
if(get_object(v) && (dispex = iface_to_jsdisp(get_object(v)))) {
- *ret = is_class(dispex, JSCLASS_FUNCTION) ? functionW : objectW;
+ *ret = is_class(dispex, JSCLASS_FUNCTION) ? L"function" : L"object";
jsdisp_release(dispex);
}else {
- *ret = objectW;
+ *ret = L"object";
}
break;
}
case JSV_STRING:
- *ret = stringW;
+ *ret = L"string";
break;
case JSV_NUMBER:
- *ret = numberW;
+ *ret = L"number";
break;
case JSV_BOOL:
- *ret = booleanW;
+ *ret = L"boolean";
break;
case JSV_VARIANT:
FIXME("unhandled variant %s\n", debugstr_variant(get_variant(v)));
@@ -1994,7 +1983,7 @@ static HRESULT interp_typeofid(script_ctx_t *ctx)
hres = exprval_propget(ctx, &ref, &v);
exprval_release(&ref);
if(FAILED(hres))
- return stack_push_string(ctx, unknownW);
+ return stack_push_string(ctx, L"unknown");
hres = typeof_string(v, &ret);
jsval_release(v);
@@ -2756,13 +2745,11 @@ static HRESULT unwind_exception(script_ctx_t *ctx, HRESULT exception_hres)
jsdisp_t *error_obj;
jsval_t msg;
- static const WCHAR messageW[] = {'m','e','s','s','a','g','e',0};
-
WARN("Exception %08x %s", exception_hres, debugstr_jsval(ei->valid_value ? ei->value : jsval_undefined()));
if(ei->valid_value && jsval_type(ei->value) == JSV_OBJECT) {
error_obj = to_jsdisp(get_object(ei->value));
if(error_obj) {
- hres = jsdisp_propget_name(error_obj, messageW, &msg);
+ hres = jsdisp_propget_name(error_obj, L"message", &msg);
if(SUCCEEDED(hres)) {
WARN(" (message %s)", debugstr_jsval(msg));
jsval_release(msg);
diff --git a/dlls/jscript/enumerator.c b/dlls/jscript/enumerator.c
index 6971150bbb4..dea19406695 100644
--- a/dlls/jscript/enumerator.c
+++ b/dlls/jscript/enumerator.c
@@ -328,15 +328,13 @@ HRESULT create_enumerator_constr(script_ctx_t *ctx, jsdisp_t *object_prototype,
{
EnumeratorInstance *enumerator;
HRESULT hres;
- static const WCHAR EnumeratorW[] = {'E','n','u','m','e','r','a','t','o','r',0};
hres = alloc_enumerator(ctx, object_prototype, &enumerator);
if(FAILED(hres))
return hres;
- hres = create_builtin_constructor(ctx, EnumeratorConstr_value,
- EnumeratorW, &EnumeratorConstr_info,
- PROPF_CONSTR|7, &enumerator->dispex, ret);
+ hres = create_builtin_constructor(ctx, EnumeratorConstr_value, L"Enumerator",
+ &EnumeratorConstr_info, PROPF_CONSTR|7, &enumerator->dispex, ret);
jsdisp_release(&enumerator->dispex);
return hres;
diff --git a/dlls/jscript/error.c b/dlls/jscript/error.c
index 07ebc1144eb..38a2485c858 100644
--- a/dlls/jscript/error.c
+++ b/dlls/jscript/error.c
@@ -28,11 +28,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
-static const WCHAR descriptionW[] = {'d','e','s','c','r','i','p','t','i','o','n',0};
-static const WCHAR messageW[] = {'m','e','s','s','a','g','e',0};
-static const WCHAR nameW[] = {'n','a','m','e',0};
-static const WCHAR numberW[] = {'n','u','m','b','e','r',0};
-
/* ECMA-262 3rd Edition 15.11.4.4 */
static HRESULT Error_toString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
unsigned argc, jsval_t *argv, jsval_t *r)
@@ -42,8 +37,6 @@ static HRESULT Error_toString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
jsval_t v;
HRESULT hres;
- static const WCHAR object_errorW[] = {'[','o','b','j','e','c','t',' ','E','r','r','o','r',']',0};
-
TRACE("\n");
jsthis = get_jsdisp(vthis);
@@ -51,7 +44,7 @@ static HRESULT Error_toString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
if(r) {
jsstr_t *str;
- str = jsstr_alloc(object_errorW);
+ str = jsstr_alloc(L"[object Error]");
if(!str)
return E_OUTOFMEMORY;
*r = jsval_string(str);
@@ -59,7 +52,7 @@ static HRESULT Error_toString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
return S_OK;
}
- hres = jsdisp_propget_name(jsthis, nameW, &v);
+ hres = jsdisp_propget_name(jsthis, L"name", &v);
if(FAILED(hres))
return hres;
@@ -70,7 +63,7 @@ static HRESULT Error_toString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
return hres;
}
- hres = jsdisp_propget_name(jsthis, messageW, &v);
+ hres = jsdisp_propget_name(jsthis, L"message", &v);
if(SUCCEEDED(hres)) {
if(!is_undefined(v)) {
hres = to_string(ctx, v, &msg);
@@ -101,7 +94,7 @@ static HRESULT Error_toString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
ret = msg;
msg = NULL;
}else {
- ret = jsstr_alloc(object_errorW);
+ ret = jsstr_alloc(L"[object Error]");
}
}
@@ -193,18 +186,18 @@ static HRESULT create_error(script_ctx_t *ctx, jsdisp_t *constr,
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(err, numberW, PROPF_WRITABLE | PROPF_CONFIGURABLE,
+ hres = jsdisp_define_data_property(err, L"number", PROPF_WRITABLE | PROPF_CONFIGURABLE,
jsval_number((INT)number));
if(FAILED(hres)) {
jsdisp_release(err);
return hres;
}
- hres = jsdisp_define_data_property(err, messageW,
+ hres = jsdisp_define_data_property(err, L"message",
PROPF_WRITABLE | PROPF_ENUMERABLE | PROPF_CONFIGURABLE,
jsval_string(msg));
if(SUCCEEDED(hres))
- hres = jsdisp_define_data_property(err, descriptionW, PROPF_WRITABLE | PROPF_CONFIGURABLE,
+ hres = jsdisp_define_data_property(err, L"description", PROPF_WRITABLE | PROPF_CONFIGURABLE,
jsval_string(msg));
if(FAILED(hres)) {
jsdisp_release(err);
@@ -325,16 +318,8 @@ static HRESULT URIErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
HRESULT init_error_constr(script_ctx_t *ctx, jsdisp_t *object_prototype)
{
- static const WCHAR ErrorW[] = {'E','r','r','o','r',0};
- static const WCHAR EvalErrorW[] = {'E','v','a','l','E','r','r','o','r',0};
- static const WCHAR RangeErrorW[] = {'R','a','n','g','e','E','r','r','o','r',0};
- static const WCHAR ReferenceErrorW[] = {'R','e','f','e','r','e','n','c','e','E','r','r','o','r',0};
- static const WCHAR RegExpErrorW[] = {'R','e','g','E','x','p','E','r','r','o','r',0};
- static const WCHAR SyntaxErrorW[] = {'S','y','n','t','a','x','E','r','r','o','r',0};
- static const WCHAR TypeErrorW[] = {'T','y','p','e','E','r','r','o','r',0};
- static const WCHAR URIErrorW[] = {'U','R','I','E','r','r','o','r',0};
- static const WCHAR *names[] = {ErrorW, EvalErrorW, RangeErrorW,
- ReferenceErrorW, RegExpErrorW, SyntaxErrorW, TypeErrorW, URIErrorW};
+ static const WCHAR *names[] = {L"Error", L"EvalError", L"RangeError",
+ L"ReferenceError", L"RegExpError", L"SyntaxError", L"TypeError", L"URIError"};
jsdisp_t **constr_addr[] = {&ctx->error_constr, &ctx->eval_error_constr,
&ctx->range_error_constr, &ctx->reference_error_constr, &ctx->regexp_error_constr,
&ctx->syntax_error_constr, &ctx->type_error_constr,
@@ -359,7 +344,7 @@ HRESULT init_error_constr(script_ctx_t *ctx, jsdisp_t *object_prototype)
return E_OUTOFMEMORY;
}
- hres = jsdisp_define_data_property(err, nameW, PROPF_WRITABLE | PROPF_CONFIGURABLE,
+ hres = jsdisp_define_data_property(err, L"name", PROPF_WRITABLE | PROPF_CONFIGURABLE,
jsval_string(str));
jsstr_release(str);
if(SUCCEEDED(hres))
diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c
index f0bd20d75a2..9f6aa4b4ec6 100644
--- a/dlls/jscript/function.c
+++ b/dlls/jscript/function.c
@@ -92,11 +92,6 @@ static inline ArgumentsInstance *arguments_from_jsdisp(jsdisp_t *jsdisp)
return CONTAINING_RECORD(jsdisp, ArgumentsInstance, jsdisp);
}
-static const WCHAR prototypeW[] = {'p','r','o','t','o','t', 'y', 'p','e',0};
-
-static const WCHAR lengthW[] = {'l','e','n','g','t','h',0};
-static const WCHAR argumentsW[] = {'a','r','g','u','m','e','n','t','s',0};
-
static HRESULT Arguments_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
@@ -191,8 +186,6 @@ HRESULT setup_arguments_object(script_ctx_t *ctx, call_frame_t *frame)
ArgumentsInstance *args;
HRESULT hres;
- static const WCHAR caleeW[] = {'c','a','l','l','e','e',0};
-
args = heap_alloc_zero(sizeof(*args));
if(!args)
return E_OUTOFMEMORY;
@@ -207,13 +200,13 @@ HRESULT setup_arguments_object(script_ctx_t *ctx, call_frame_t *frame)
args->argc = frame->argc;
args->frame = frame;
- hres = jsdisp_define_data_property(&args->jsdisp, lengthW, PROPF_WRITABLE | PROPF_CONFIGURABLE,
+ hres = jsdisp_define_data_property(&args->jsdisp, L"length", PROPF_WRITABLE | PROPF_CONFIGURABLE,
jsval_number(args->argc));
if(SUCCEEDED(hres))
- hres = jsdisp_define_data_property(&args->jsdisp, caleeW, PROPF_WRITABLE | PROPF_CONFIGURABLE,
+ hres = jsdisp_define_data_property(&args->jsdisp, L"callee", PROPF_WRITABLE | PROPF_CONFIGURABLE,
jsval_obj(&args->function->function.dispex));
if(SUCCEEDED(hres))
- hres = jsdisp_propput(frame->base_scope->jsobj, argumentsW, PROPF_WRITABLE, jsval_obj(&args->jsdisp));
+ hres = jsdisp_propput(frame->base_scope->jsobj, L"arguments", PROPF_WRITABLE, jsval_obj(&args->jsdisp));
if(FAILED(hres)) {
jsdisp_release(&args->jsdisp);
return hres;
@@ -232,7 +225,7 @@ void detach_arguments_object(jsdisp_t *args_disp)
/* Reset arguments value to cut the reference cycle. Note that since all activation contexts have
* their own arguments property, it's impossible to use prototype's one during name lookup */
- jsdisp_propput_name(frame->base_scope->jsobj, argumentsW, jsval_undefined());
+ jsdisp_propput_name(frame->base_scope->jsobj, L"arguments", jsval_undefined());
arguments->frame = NULL;
/* Don't bother coppying arguments if call frame holds the last reference. */
@@ -307,7 +300,7 @@ static HRESULT array_to_args(script_ctx_t *ctx, jsdisp_t *arg_array, unsigned *a
DWORD length, i;
HRESULT hres;
- hres = jsdisp_propget_name(arg_array, lengthW, &val);
+ hres = jsdisp_propget_name(arg_array, L"length", &val);
if(FAILED(hres))
return hres;
@@ -673,10 +666,10 @@ HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc,
return hres;
if(builtin_info)
- hres = jsdisp_define_data_property(&function->function.dispex, lengthW, 0,
+ hres = jsdisp_define_data_property(&function->function.dispex, L"length", 0,
jsval_number(function->function.length));
if(SUCCEEDED(hres))
- hres = jsdisp_define_data_property(&function->function.dispex, prototypeW, 0, jsval_obj(prototype));
+ hres = jsdisp_define_data_property(&function->function.dispex, L"prototype", 0, jsval_obj(prototype));
if(FAILED(hres)) {
jsdisp_release(&function->function.dispex);
return hres;
@@ -691,9 +684,7 @@ HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc,
static HRESULT set_constructor_prop(script_ctx_t *ctx, jsdisp_t *constr, jsdisp_t *prot)
{
- static const WCHAR constructorW[] = {'c','o','n','s','t','r','u','c','t','o','r',0};
-
- return jsdisp_define_data_property(prot, constructorW, PROPF_WRITABLE | PROPF_CONFIGURABLE,
+ return jsdisp_define_data_property(prot, L"constructor", PROPF_WRITABLE | PROPF_CONFIGURABLE,
jsval_obj(constr));
}
@@ -795,7 +786,7 @@ HRESULT create_source_function(script_ctx_t *ctx, bytecode_t *code, function_cod
hres = create_function(ctx, NULL, &InterpretedFunctionVtbl, sizeof(InterpretedFunction), PROPF_CONSTR,
FALSE, NULL, (void**)&function);
if(SUCCEEDED(hres)) {
- hres = jsdisp_define_data_property(&function->function.dispex, prototypeW, PROPF_WRITABLE,
+ hres = jsdisp_define_data_property(&function->function.dispex, L"prototype", PROPF_WRITABLE,
jsval_obj(prototype));
if(SUCCEEDED(hres))
hres = set_constructor_prop(ctx, &function->function.dispex, prototype);
@@ -850,12 +841,7 @@ static HRESULT BindFunction_call(script_ctx_t *ctx, FunctionInstance *func, IDis
static HRESULT BindFunction_toString(FunctionInstance *function, jsstr_t **ret)
{
- static const WCHAR native_functionW[] =
- {'\n','f','u','n','c','t','i','o','n','(',')',' ','{','\n',
- ' ',' ',' ',' ','[','n','a','t','i','v','e',' ','c','o','d','e',']','\n',
- '}','\n',0};
-
- *ret = jsstr_alloc(native_functionW);
+ *ret = jsstr_alloc(L"\nfunction() {\n [native code]\n}\n");
return *ret ? S_OK : E_OUTOFMEMORY;
}
@@ -928,7 +914,7 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *arg
static const WCHAR function_anonymousW[] = {'f','u','n','c','t','i','o','n',' ','a','n','o','n','y','m','o','u','s','('};
static const WCHAR function_beginW[] = {')',' ','{','\n'};
- static const WCHAR function_endW[] = {'\n','}',0};
+ static const WCHAR function_endW[] = L"\n}";
if(argc) {
params = heap_alloc(argc*sizeof(*params));
@@ -1038,22 +1024,20 @@ HRESULT init_function_constr(script_ctx_t *ctx, jsdisp_t *object_prototype)
NativeFunction *prot, *constr;
HRESULT hres;
- static const WCHAR FunctionW[] = {'F','u','n','c','t','i','o','n',0};
-
hres = create_function(ctx, &Function_info, &NativeFunctionVtbl, sizeof(NativeFunction), PROPF_CONSTR,
TRUE, object_prototype, (void**)&prot);
if(FAILED(hres))
return hres;
prot->proc = FunctionProt_value;
- prot->name = prototypeW;
+ prot->name = L"prototype";
hres = create_function(ctx, &FunctionInst_info, &NativeFunctionVtbl, sizeof(NativeFunction), PROPF_CONSTR|1,
TRUE, &prot->function.dispex, (void**)&constr);
if(SUCCEEDED(hres)) {
constr->proc = FunctionConstr_value;
- constr->name = FunctionW;
- hres = jsdisp_define_data_property(&constr->function.dispex, prototypeW, 0, jsval_obj(&prot->function.dispex));
+ constr->name = L"Function";
+ hres = jsdisp_define_data_property(&constr->function.dispex, L"prototype", 0, jsval_obj(&prot->function.dispex));
if(SUCCEEDED(hres))
hres = set_constructor_prop(ctx, &constr->function.dispex, &prot->function.dispex);
if(FAILED(hres))
diff --git a/dlls/jscript/global.c b/dlls/jscript/global.c
index d5aafe65037..735e188e1bd 100644
--- a/dlls/jscript/global.c
+++ b/dlls/jscript/global.c
@@ -27,32 +27,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
-static const WCHAR NaNW[] = {'N','a','N',0};
-static const WCHAR InfinityW[] = {'I','n','f','i','n','i','t','y',0};
-static const WCHAR ArrayW[] = {'A','r','r','a','y',0};
-static const WCHAR BooleanW[] = {'B','o','o','l','e','a','n',0};
-static const WCHAR DateW[] = {'D','a','t','e',0};
-static const WCHAR ErrorW[] = {'E','r','r','o','r',0};
-static const WCHAR EvalErrorW[] = {'E','v','a','l','E','r','r','o','r',0};
-static const WCHAR RangeErrorW[] = {'R','a','n','g','e','E','r','r','o','r',0};
-static const WCHAR ReferenceErrorW[] = {'R','e','f','e','r','e','n','c','e','E','r','r','o','r',0};
-static const WCHAR SyntaxErrorW[] = {'S','y','n','t','a','x','E','r','r','o','r',0};
-static const WCHAR TypeErrorW[] = {'T','y','p','e','E','r','r','o','r',0};
-static const WCHAR URIErrorW[] = {'U','R','I','E','r','r','o','r',0};
-static const WCHAR FunctionW[] = {'F','u','n','c','t','i','o','n',0};
-static const WCHAR NumberW[] = {'N','u','m','b','e','r',0};
-static const WCHAR ObjectW[] = {'O','b','j','e','c','t',0};
-static const WCHAR StringW[] = {'S','t','r','i','n','g',0};
-static const WCHAR RegExpW[] = {'R','e','g','E','x','p',0};
-static const WCHAR RegExpErrorW[] = {'R','e','g','E','x','p','E','r','r','o','r',0};
-static const WCHAR ActiveXObjectW[] = {'A','c','t','i','v','e','X','O','b','j','e','c','t',0};
-static const WCHAR VBArrayW[] = {'V','B','A','r','r','a','y',0};
-static const WCHAR EnumeratorW[] = {'E','n','u','m','e','r','a','t','o','r',0};
-static const WCHAR MathW[] = {'M','a','t','h',0};
-static const WCHAR JSONW[] = {'J','S','O','N',0};
-
-static const WCHAR undefinedW[] = {'u','n','d','e','f','i','n','e','d',0};
-
static int uri_char_table[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 00-0f */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 10-1f */
@@ -527,14 +501,12 @@ static HRESULT JSGlobal_GetObject(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
static HRESULT JSGlobal_ScriptEngine(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
- static const WCHAR JScriptW[] = {'J','S','c','r','i','p','t',0};
-
TRACE("\n");
if(r) {
jsstr_t *ret;
- ret = jsstr_alloc(JScriptW);
+ ret = jsstr_alloc(L"JScript");
if(!ret)
return E_OUTOFMEMORY;
@@ -947,7 +919,7 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, FunctionW, PROPF_WRITABLE,
+ hres = jsdisp_define_data_property(ctx->global, L"Function", PROPF_WRITABLE,
jsval_obj(ctx->function_constr));
if(FAILED(hres))
return hres;
@@ -956,7 +928,7 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, ObjectW, PROPF_WRITABLE,
+ hres = jsdisp_define_data_property(ctx->global, L"Object", PROPF_WRITABLE,
jsval_obj(ctx->object_constr));
if(FAILED(hres))
return hres;
@@ -965,7 +937,7 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, ArrayW, PROPF_WRITABLE,
+ hres = jsdisp_define_data_property(ctx->global, L"Array", PROPF_WRITABLE,
jsval_obj(ctx->array_constr));
if(FAILED(hres))
return hres;
@@ -974,7 +946,7 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, BooleanW, PROPF_WRITABLE,
+ hres = jsdisp_define_data_property(ctx->global, L"Boolean", PROPF_WRITABLE,
jsval_obj(ctx->bool_constr));
if(FAILED(hres))
return hres;
@@ -983,7 +955,7 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, DateW, PROPF_WRITABLE,
+ hres = jsdisp_define_data_property(ctx->global, L"Date", PROPF_WRITABLE,
jsval_obj(ctx->date_constr));
if(FAILED(hres))
return hres;
@@ -992,7 +964,7 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, EnumeratorW, PROPF_WRITABLE,
+ hres = jsdisp_define_data_property(ctx->global, L"Enumerator", PROPF_WRITABLE,
jsval_obj(ctx->enumerator_constr));
if(FAILED(hres))
return hres;
@@ -1001,42 +973,42 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, ErrorW, PROPF_WRITABLE,
+ hres = jsdisp_define_data_property(ctx->global, L"Error", PROPF_WRITABLE,
jsval_obj(ctx->error_constr));
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, EvalErrorW, PROPF_WRITABLE,
+ hres = jsdisp_define_data_property(ctx->global, L"EvalError", PROPF_WRITABLE,
jsval_obj(ctx->eval_error_constr));
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, RangeErrorW, PROPF_WRITABLE,
+ hres = jsdisp_define_data_property(ctx->global, L"RangeError", PROPF_WRITABLE,
jsval_obj(ctx->range_error_constr));
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, ReferenceErrorW, PROPF_WRITABLE,
+ hres = jsdisp_define_data_property(ctx->global, L"ReferenceError", PROPF_WRITABLE,
jsval_obj(ctx->reference_error_constr));
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, RegExpErrorW, PROPF_WRITABLE,
+ hres = jsdisp_define_data_property(ctx->global, L"RegExpError", PROPF_WRITABLE,
jsval_obj(ctx->regexp_error_constr));
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, SyntaxErrorW, PROPF_WRITABLE,
+ hres = jsdisp_define_data_property(ctx->global, L"SyntaxError", PROPF_WRITABLE,
jsval_obj(ctx->syntax_error_constr));
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, TypeErrorW, PROPF_WRITABLE,
+ hres = jsdisp_define_data_property(ctx->global, L"TypeError", PROPF_WRITABLE,
jsval_obj(ctx->type_error_constr));
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, URIErrorW, PROPF_WRITABLE,
+ hres = jsdisp_define_data_property(ctx->global, L"URIError", PROPF_WRITABLE,
jsval_obj(ctx->uri_error_constr));
if(FAILED(hres))
return hres;
@@ -1045,7 +1017,7 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, NumberW, PROPF_WRITABLE,
+ hres = jsdisp_define_data_property(ctx->global, L"Number", PROPF_WRITABLE,
jsval_obj(ctx->number_constr));
if(FAILED(hres))
return hres;
@@ -1054,7 +1026,7 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, RegExpW, PROPF_WRITABLE,
+ hres = jsdisp_define_data_property(ctx->global, L"RegExp", PROPF_WRITABLE,
jsval_obj(ctx->regexp_constr));
if(FAILED(hres))
return hres;
@@ -1063,7 +1035,7 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, StringW, PROPF_WRITABLE,
+ hres = jsdisp_define_data_property(ctx->global, L"String", PROPF_WRITABLE,
jsval_obj(ctx->string_constr));
if(FAILED(hres))
return hres;
@@ -1072,7 +1044,7 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, VBArrayW, PROPF_WRITABLE,
+ hres = jsdisp_define_data_property(ctx->global, L"VBArray", PROPF_WRITABLE,
jsval_obj(ctx->vbarray_constr));
if(FAILED(hres))
return hres;
@@ -1106,7 +1078,7 @@ HRESULT init_global(script_ctx_t *ctx)
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, MathW, PROPF_WRITABLE, jsval_obj(math));
+ hres = jsdisp_define_data_property(ctx->global, L"Math", PROPF_WRITABLE, jsval_obj(math));
jsdisp_release(math);
if(FAILED(hres))
return hres;
@@ -1118,7 +1090,7 @@ HRESULT init_global(script_ctx_t *ctx)
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, JSONW, PROPF_WRITABLE, jsval_obj(json));
+ hres = jsdisp_define_data_property(ctx->global, L"JSON", PROPF_WRITABLE, jsval_obj(json));
jsdisp_release(json);
if(FAILED(hres))
return hres;
@@ -1128,20 +1100,20 @@ HRESULT init_global(script_ctx_t *ctx)
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, ActiveXObjectW, PROPF_WRITABLE,
+ hres = jsdisp_define_data_property(ctx->global, L"ActiveXObject", PROPF_WRITABLE,
jsval_obj(constr));
jsdisp_release(constr);
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, undefinedW, const_flags, jsval_undefined());
+ hres = jsdisp_define_data_property(ctx->global, L"undefined", const_flags, jsval_undefined());
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, NaNW, const_flags, jsval_number(NAN));
+ hres = jsdisp_define_data_property(ctx->global, L"NaN", const_flags, jsval_number(NAN));
if(FAILED(hres))
return hres;
- hres = jsdisp_define_data_property(ctx->global, InfinityW, const_flags, jsval_number(INFINITY));
+ hres = jsdisp_define_data_property(ctx->global, L"Infinity", const_flags, jsval_number(INFINITY));
return hres;
}
diff --git a/dlls/jscript/json.c b/dlls/jscript/json.c
index de10ceadd11..8f16ba22885 100644
--- a/dlls/jscript/json.c
+++ b/dlls/jscript/json.c
@@ -26,12 +26,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
-static const WCHAR nullW[] = {'n','u','l','l',0};
-static const WCHAR trueW[] = {'t','r','u','e',0};
-static const WCHAR falseW[] = {'f','a','l','s','e',0};
-
-static const WCHAR toJSONW[] = {'t','o','J','S','O','N',0};
-
typedef struct {
const WCHAR *ptr;
const WCHAR *end;
@@ -107,19 +101,19 @@ static HRESULT parse_json_value(json_parse_ctx_t *ctx, jsval_t *r)
/* JSONNullLiteral */
case 'n':
- if(!is_keyword(ctx, nullW))
+ if(!is_keyword(ctx, L"null"))
break;
*r = jsval_null();
return S_OK;
/* JSONBooleanLiteral */
case 't':
- if(!is_keyword(ctx, trueW))
+ if(!is_keyword(ctx, L"true"))
break;
*r = jsval_bool(TRUE);
return S_OK;
case 'f':
- if(!is_keyword(ctx, falseW))
+ if(!is_keyword(ctx, L"false"))
break;
*r = jsval_bool(FALSE);
return S_OK;
@@ -476,9 +470,8 @@ static HRESULT json_quote(stringify_ctx_t *ctx, const WCHAR *ptr, size_t len)
break;
default:
if(*ptr < ' ') {
- static const WCHAR formatW[] = {'\\','u','%','0','4','x',0};
WCHAR buf[7];
- swprintf(buf, ARRAY_SIZE(buf), formatW, *ptr);
+ swprintf(buf, ARRAY_SIZE(buf), L"\\u%04x", *ptr);
if(!append_string(ctx, buf))
return E_OUTOFMEMORY;
}else {
@@ -538,10 +531,10 @@ static HRESULT stringify_array(stringify_ctx_t *ctx, jsdisp_t *obj)
hres = stringify(ctx, val);
if(FAILED(hres))
return hres;
- if(hres == S_FALSE && !append_string(ctx, nullW))
+ if(hres == S_FALSE && !append_string(ctx, L"null"))
return E_OUTOFMEMORY;
}else if(hres == DISP_E_UNKNOWNNAME) {
- if(!append_string(ctx, nullW))
+ if(!append_string(ctx, L"null"))
return E_OUTOFMEMORY;
}else {
return hres;
@@ -668,7 +661,7 @@ static HRESULT stringify(stringify_ctx_t *ctx, jsval_t val)
if(!obj)
return S_FALSE;
- hres = jsdisp_get_id(obj, toJSONW, 0, &id);
+ hres = jsdisp_get_id(obj, L"toJSON", 0, &id);
jsdisp_release(obj);
if(hres == S_OK)
FIXME("Use toJSON.\n");
@@ -682,11 +675,11 @@ static HRESULT stringify(stringify_ctx_t *ctx, jsval_t val)
switch(jsval_type(value)) {
case JSV_NULL:
- if(!append_string(ctx, nullW))
+ if(!append_string(ctx, L"null"))
hres = E_OUTOFMEMORY;
break;
case JSV_BOOL:
- if(!append_string(ctx, get_bool(value) ? trueW : falseW))
+ if(!append_string(ctx, get_bool(value) ? L"true" : L"false"))
hres = E_OUTOFMEMORY;
break;
case JSV_STRING: {
@@ -714,7 +707,7 @@ static HRESULT stringify(stringify_ctx_t *ctx, jsval_t val)
hres = ptr && !append_string_len(ctx, ptr, jsstr_length(str)) ? E_OUTOFMEMORY : S_OK;
jsstr_release(str);
}else {
- if(!append_string(ctx, nullW))
+ if(!append_string(ctx, L"null"))
hres = E_OUTOFMEMORY;
}
break;
diff --git a/dlls/jscript/jsregexp.c b/dlls/jscript/jsregexp.c
index 709f00fa160..f80452d0c0b 100644
--- a/dlls/jscript/jsregexp.c
+++ b/dlls/jscript/jsregexp.c
@@ -352,11 +352,6 @@ static HRESULT create_match_array(script_ctx_t *ctx, jsstr_t *input_str,
DWORD i;
HRESULT hres = S_OK;
- static const WCHAR indexW[] = {'i','n','d','e','x',0};
- static const WCHAR inputW[] = {'i','n','p','u','t',0};
- static const WCHAR lastIndexW[] = {'l','a','s','t','I','n','d','e','x',0};
- static const WCHAR zeroW[] = {'0',0};
-
input = jsstr_flatten(input_str);
if(!input)
return E_OUTOFMEMORY;
@@ -382,15 +377,15 @@ static HRESULT create_match_array(script_ctx_t *ctx, jsstr_t *input_str,
}
while(SUCCEEDED(hres)) {
- hres = jsdisp_propput_name(array, indexW, jsval_number(result->cp-input-result->match_len));
+ hres = jsdisp_propput_name(array, L"index", jsval_number(result->cp-input-result->match_len));
if(FAILED(hres))
break;
- hres = jsdisp_propput_name(array, lastIndexW, jsval_number(result->cp-input));
+ hres = jsdisp_propput_name(array, L"lastIndex", jsval_number(result->cp-input));
if(FAILED(hres))
break;
- hres = jsdisp_propput_name(array, inputW, jsval_string(jsstr_addref(input_str)));
+ hres = jsdisp_propput_name(array, L"input", jsval_string(jsstr_addref(input_str)));
if(FAILED(hres))
break;
@@ -399,7 +394,7 @@ static HRESULT create_match_array(script_ctx_t *ctx, jsstr_t *input_str,
hres = E_OUTOFMEMORY;
break;
}
- hres = jsdisp_propput_name(array, zeroW, jsval_string(str));
+ hres = jsdisp_propput_name(array, L"0", jsval_string(str));
jsstr_release(str);
break;
}
@@ -698,10 +693,6 @@ HRESULT create_regexp_var(script_ctx_t *ctx, jsval_t src_arg, jsval_t *flags_arg
HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, jsstr_t *jsstr, jsval_t *r)
{
- static const WCHAR indexW[] = {'i','n','d','e','x',0};
- static const WCHAR inputW[] = {'i','n','p','u','t',0};
- static const WCHAR lastIndexW[] = {'l','a','s','t','I','n','d','e','x',0};
-
RegExpInstance *regexp = regexp_from_jsdisp(re);
match_result_t *match_result;
unsigned match_cnt, i;
@@ -778,16 +769,16 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, jsstr_t *jsstr, jsv
}
while(SUCCEEDED(hres)) {
- hres = jsdisp_propput_name(array, indexW, jsval_number(match_result[match_cnt-1].index));
+ hres = jsdisp_propput_name(array, L"index", jsval_number(match_result[match_cnt-1].index));
if(FAILED(hres))
break;
- hres = jsdisp_propput_name(array, lastIndexW,
+ hres = jsdisp_propput_name(array, L"lastIndex",
jsval_number(match_result[match_cnt-1].index + match_result[match_cnt-1].length));
if(FAILED(hres))
break;
- hres = jsdisp_propput_name(array, inputW, jsval_string(jsstr));
+ hres = jsdisp_propput_name(array, L"input", jsval_string(jsstr));
break;
}
@@ -973,13 +964,11 @@ HRESULT create_regexp_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdi
RegExpInstance *regexp;
HRESULT hres;
- static const WCHAR RegExpW[] = {'R','e','g','E','x','p',0};
-
hres = alloc_regexp(ctx, object_prototype, ®exp);
if(FAILED(hres))
return hres;
- hres = create_builtin_constructor(ctx, RegExpConstr_value, RegExpW, &RegExpConstr_info,
+ hres = create_builtin_constructor(ctx, RegExpConstr_value, L"RegExp", &RegExpConstr_info,
PROPF_CONSTR|2, ®exp->dispex, ret);
jsdisp_release(®exp->dispex);
diff --git a/dlls/jscript/jsstr.c b/dlls/jscript/jsstr.c
index abd960a8a02..0d73f4be13a 100644
--- a/dlls/jscript/jsstr.c
+++ b/dlls/jscript/jsstr.c
@@ -315,15 +315,13 @@ HRESULT jsstr_to_bstr(jsstr_t *str, BSTR *r)
BOOL init_strings(void)
{
- static const WCHAR NaNW[] = { 'N','a','N',0 };
- static const WCHAR undefinedW[] = {'u','n','d','e','f','i','n','e','d',0};
WCHAR *ptr;
if(!(empty_str = jsstr_alloc_buf(0, &ptr)))
return FALSE;
- if(!(nan_str = jsstr_alloc(NaNW)))
+ if(!(nan_str = jsstr_alloc(L"NaN")))
return FALSE;
- if(!(undefined_str = jsstr_alloc(undefinedW)))
+ if(!(undefined_str = jsstr_alloc(L"undefined")))
return FALSE;
if(!(null_bstr_str = jsstr_alloc_buf(0, &ptr)))
return FALSE;
diff --git a/dlls/jscript/jsutils.c b/dlls/jscript/jsutils.c
index b12addda794..b71a99e372a 100644
--- a/dlls/jscript/jsutils.c
+++ b/dlls/jscript/jsutils.c
@@ -388,9 +388,6 @@ HRESULT to_primitive(script_ctx_t *ctx, jsval_t val, jsval_t *ret, hint_t hint)
DISPID id;
HRESULT hres;
- static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0};
- static const WCHAR valueOfW[] = {'v','a','l','u','e','O','f',0};
-
if(!get_object(val)) {
*ret = jsval_null();
return S_OK;
@@ -405,7 +402,7 @@ HRESULT to_primitive(script_ctx_t *ctx, jsval_t val, jsval_t *ret, hint_t hint)
/* Native implementation doesn't throw TypeErrors, returns strange values */
- hres = jsdisp_get_id(jsdisp, hint == HINT_STRING ? toStringW : valueOfW, 0, &id);
+ hres = jsdisp_get_id(jsdisp, hint == HINT_STRING ? L"toString" : L"valueOf", 0, &id);
if(SUCCEEDED(hres)) {
hres = jsdisp_call(jsdisp, id, DISPATCH_METHOD, 0, NULL, &prim);
if(FAILED(hres)) {
@@ -421,7 +418,7 @@ HRESULT to_primitive(script_ctx_t *ctx, jsval_t val, jsval_t *ret, hint_t hint)
}
}
- hres = jsdisp_get_id(jsdisp, hint == HINT_STRING ? valueOfW : toStringW, 0, &id);
+ hres = jsdisp_get_id(jsdisp, hint == HINT_STRING ? L"valueOf" : L"toString", 0, &id);
if(SUCCEEDED(hres)) {
hres = jsdisp_call(jsdisp, id, DISPATCH_METHOD, 0, NULL, &prim);
if(FAILED(hres)) {
@@ -712,12 +709,10 @@ HRESULT to_uint32(script_ctx_t *ctx, jsval_t val, UINT32 *ret)
HRESULT double_to_string(double n, jsstr_t **str)
{
- static const WCHAR InfinityW[] = {'-','I','n','f','i','n','i','t','y',0};
-
if(isnan(n)) {
*str = jsstr_nan();
}else if(isinf(n)) {
- *str = jsstr_alloc(n<0 ? InfinityW : InfinityW+1);
+ *str = jsstr_alloc(n<0 ? L"-Infinity" : L"-Infinity"+1);
}else if(is_int32(n)) {
WCHAR buf[12];
_ltow_s(n, buf, ARRAY_SIZE(buf), 10);
@@ -744,16 +739,12 @@ HRESULT double_to_string(double n, jsstr_t **str)
/* ECMA-262 3rd Edition 9.8 */
HRESULT to_string(script_ctx_t *ctx, jsval_t val, jsstr_t **str)
{
- static const WCHAR nullW[] = {'n','u','l','l',0};
- static const WCHAR trueW[] = {'t','r','u','e',0};
- static const WCHAR falseW[] = {'f','a','l','s','e',0};
-
switch(jsval_type(val)) {
case JSV_UNDEFINED:
*str = jsstr_undefined();
return S_OK;
case JSV_NULL:
- *str = jsstr_alloc(nullW);
+ *str = jsstr_alloc(L"null");
break;
case JSV_NUMBER:
return double_to_string(get_number(val), str);
@@ -773,7 +764,7 @@ HRESULT to_string(script_ctx_t *ctx, jsval_t val, jsstr_t **str)
return hres;
}
case JSV_BOOL:
- *str = jsstr_alloc(get_bool(val) ? trueW : falseW);
+ *str = jsstr_alloc(get_bool(val) ? L"true" : L"false");
break;
default:
FIXME("unsupported %s\n", debugstr_jsval(val));
diff --git a/dlls/jscript/lex.c b/dlls/jscript/lex.c
index 9a583e33393..efed1038a95 100644
--- a/dlls/jscript/lex.c
+++ b/dlls/jscript/lex.c
@@ -159,10 +159,8 @@ static int check_keywords(parser_ctx_t *ctx, const WCHAR **lval)
static BOOL skip_html_comment(parser_ctx_t *ctx)
{
- const WCHAR html_commentW[] = {'<','!','-','-',0};
-
if(!ctx->is_html || ctx->ptr+3 >= ctx->end ||
- memcmp(ctx->ptr, html_commentW, sizeof(WCHAR)*4))
+ memcmp(ctx->ptr, L"<!--", sizeof(WCHAR)*4))
return FALSE;
ctx->nl = TRUE;
diff --git a/dlls/jscript/number.c b/dlls/jscript/number.c
index fc6bfe10cc9..3c965323d02 100644
--- a/dlls/jscript/number.c
+++ b/dlls/jscript/number.c
@@ -317,7 +317,6 @@ static HRESULT Number_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
if(log_radix==0)
buf[idx] = 0;
else {
- static const WCHAR formatW[] = {'(','e','%','c','%','d',')',0};
WCHAR ch;
if(log_radix<0) {
@@ -325,7 +324,7 @@ static HRESULT Number_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
ch = '-';
}
else ch = '+';
- swprintf(&buf[idx], ARRAY_SIZE(buf) - idx, formatW, ch, (int)log_radix);
+ swprintf(&buf[idx], ARRAY_SIZE(buf) - idx, L"(e%c%d)", ch, (int)log_radix);
}
}
else buf[idx] = '\0';
@@ -608,14 +607,12 @@ HRESULT create_number_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdi
NumberInstance *number;
HRESULT hres;
- static const WCHAR NumberW[] = {'N','u','m','b','e','r',0};
-
hres = alloc_number(ctx, object_prototype, &number);
if(FAILED(hres))
return hres;
number->value = 0;
- hres = create_builtin_constructor(ctx, NumberConstr_value, NumberW, NULL,
+ hres = create_builtin_constructor(ctx, NumberConstr_value, L"Number", NULL,
PROPF_CONSTR|1, &number->dispex, ret);
jsdisp_release(&number->dispex);
diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c
index 7c8fc36934a..3dd40e6744f 100644
--- a/dlls/jscript/string.c
+++ b/dlls/jscript/string.c
@@ -31,42 +31,6 @@ typedef struct {
jsstr_t *str;
} StringInstance;
-static const WCHAR lengthW[] = {'l','e','n','g','t','h',0};
-static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0};
-static const WCHAR valueOfW[] = {'v','a','l','u','e','O','f',0};
-static const WCHAR anchorW[] = {'a','n','c','h','o','r',0};
-static const WCHAR bigW[] = {'b','i','g',0};
-static const WCHAR blinkW[] = {'b','l','i','n','k',0};
-static const WCHAR boldW[] = {'b','o','l','d',0};
-static const WCHAR charAtW[] = {'c','h','a','r','A','t',0};
-static const WCHAR charCodeAtW[] = {'c','h','a','r','C','o','d','e','A','t',0};
-static const WCHAR concatW[] = {'c','o','n','c','a','t',0};
-static const WCHAR fixedW[] = {'f','i','x','e','d',0};
-static const WCHAR fontcolorW[] = {'f','o','n','t','c','o','l','o','r',0};
-static const WCHAR fontsizeW[] = {'f','o','n','t','s','i','z','e',0};
-static const WCHAR indexOfW[] = {'i','n','d','e','x','O','f',0};
-static const WCHAR italicsW[] = {'i','t','a','l','i','c','s',0};
-static const WCHAR lastIndexOfW[] = {'l','a','s','t','I','n','d','e','x','O','f',0};
-static const WCHAR linkW[] = {'l','i','n','k',0};
-static const WCHAR matchW[] = {'m','a','t','c','h',0};
-static const WCHAR replaceW[] = {'r','e','p','l','a','c','e',0};
-static const WCHAR searchW[] = {'s','e','a','r','c','h',0};
-static const WCHAR sliceW[] = {'s','l','i','c','e',0};
-static const WCHAR smallW[] = {'s','m','a','l','l',0};
-static const WCHAR splitW[] = {'s','p','l','i','t',0};
-static const WCHAR strikeW[] = {'s','t','r','i','k','e',0};
-static const WCHAR subW[] = {'s','u','b',0};
-static const WCHAR substringW[] = {'s','u','b','s','t','r','i','n','g',0};
-static const WCHAR substrW[] = {'s','u','b','s','t','r',0};
-static const WCHAR supW[] = {'s','u','p',0};
-static const WCHAR toLowerCaseW[] = {'t','o','L','o','w','e','r','C','a','s','e',0};
-static const WCHAR toUpperCaseW[] = {'t','o','U','p','p','e','r','C','a','s','e',0};
-static const WCHAR toLocaleLowerCaseW[] = {'t','o','L','o','c','a','l','e','L','o','w','e','r','C','a','s','e',0};
-static const WCHAR toLocaleUpperCaseW[] = {'t','o','L','o','c','a','l','e','U','p','p','e','r','C','a','s','e',0};
-static const WCHAR trimW[] = {'t','r','i','m',0};
-static const WCHAR localeCompareW[] = {'l','o','c','a','l','e','C','o','m','p','a','r','e',0};
-static const WCHAR fromCharCodeW[] = {'f','r','o','m','C','h','a','r','C','o','d','e',0};
-
static inline StringInstance *string_from_jsdisp(jsdisp_t *jsdisp)
{
return CONTAINING_RECORD(jsdisp, StringInstance, dispex);
@@ -255,31 +219,25 @@ static HRESULT do_attribute_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, unsig
static HRESULT String_anchor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
- static const WCHAR fontW[] = {'A',0};
- static const WCHAR colorW[] = {'N','A','M','E',0};
-
- return do_attribute_tag_format(ctx, jsthis, argc, argv, r, fontW, colorW);
+ return do_attribute_tag_format(ctx, jsthis, argc, argv, r, L"A", L"NAME");
}
static HRESULT String_big(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
- static const WCHAR bigtagW[] = {'B','I','G',0};
- return do_attributeless_tag_format(ctx, jsthis, r, bigtagW);
+ return do_attributeless_tag_format(ctx, jsthis, r, L"BIG");
}
static HRESULT String_blink(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
- static const WCHAR blinktagW[] = {'B','L','I','N','K',0};
- return do_attributeless_tag_format(ctx, jsthis, r, blinktagW);
+ return do_attributeless_tag_format(ctx, jsthis, r, L"BLINK");
}
static HRESULT String_bold(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
- static const WCHAR boldtagW[] = {'B',0};
- return do_attributeless_tag_format(ctx, jsthis, r, boldtagW);
+ return do_attributeless_tag_format(ctx, jsthis, r, L"B");
}
/* ECMA-262 3rd Edition 15.5.4.5 */
@@ -456,26 +414,19 @@ static HRESULT String_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
static HRESULT String_fixed(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
- static const WCHAR fixedtagW[] = {'T','T',0};
- return do_attributeless_tag_format(ctx, jsthis, r, fixedtagW);
+ return do_attributeless_tag_format(ctx, jsthis, r, L"TT");
}
static HRESULT String_fontcolor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
- static const WCHAR fontW[] = {'F','O','N','T',0};
- static const WCHAR colorW[] = {'C','O','L','O','R',0};
-
- return do_attribute_tag_format(ctx, jsthis, argc, argv, r, fontW, colorW);
+ return do_attribute_tag_format(ctx, jsthis, argc, argv, r, L"FONT", L"COLOR");
}
static HRESULT String_fontsize(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
- static const WCHAR fontW[] = {'F','O','N','T',0};
- static const WCHAR colorW[] = {'S','I','Z','E',0};
-
- return do_attribute_tag_format(ctx, jsthis, argc, argv, r, fontW, colorW);
+ return do_attribute_tag_format(ctx, jsthis, argc, argv, r, L"FONT", L"SIZE");
}
static HRESULT String_indexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
@@ -542,8 +493,7 @@ static HRESULT String_indexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
static HRESULT String_italics(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
- static const WCHAR italicstagW[] = {'I',0};
- return do_attributeless_tag_format(ctx, jsthis, r, italicstagW);
+ return do_attributeless_tag_format(ctx, jsthis, r, L"I");
}
/* ECMA-262 3rd Edition 15.5.4.8 */
@@ -612,10 +562,7 @@ static HRESULT String_lastIndexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
static HRESULT String_link(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
- static const WCHAR fontW[] = {'A',0};
- static const WCHAR colorW[] = {'H','R','E','F',0};
-
- return do_attribute_tag_format(ctx, jsthis, argc, argv, r, fontW, colorW);
+ return do_attribute_tag_format(ctx, jsthis, argc, argv, r, L"A", L"HREF");
}
/* ECMA-262 3rd Edition 15.5.4.10 */
@@ -1123,8 +1070,7 @@ static HRESULT String_slice(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
static HRESULT String_small(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
- static const WCHAR smalltagW[] = {'S','M','A','L','L',0};
- return do_attributeless_tag_format(ctx, jsthis, r, smalltagW);
+ return do_attributeless_tag_format(ctx, jsthis, r, L"SMALL");
}
static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
@@ -1290,15 +1236,13 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
static HRESULT String_strike(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
- static const WCHAR striketagW[] = {'S','T','R','I','K','E',0};
- return do_attributeless_tag_format(ctx, jsthis, r, striketagW);
+ return do_attributeless_tag_format(ctx, jsthis, r, L"STRIKE");
}
static HRESULT String_sub(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
- static const WCHAR subtagW[] = {'S','U','B',0};
- return do_attributeless_tag_format(ctx, jsthis, r, subtagW);
+ return do_attributeless_tag_format(ctx, jsthis, r, L"SUB");
}
/* ECMA-262 3rd Edition 15.5.4.15 */
@@ -1418,8 +1362,7 @@ static HRESULT String_substr(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
static HRESULT String_sup(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
- static const WCHAR suptagW[] = {'S','U','P',0};
- return do_attributeless_tag_format(ctx, jsthis, r, suptagW);
+ return do_attributeless_tag_format(ctx, jsthis, r, L"SUP");
}
static HRESULT String_toLowerCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
@@ -1590,40 +1533,40 @@ static HRESULT String_idx_get(jsdisp_t *jsdisp, unsigned idx, jsval_t *r)
}
static const builtin_prop_t String_props[] = {
- {anchorW, String_anchor, PROPF_METHOD|1},
- {bigW, String_big, PROPF_METHOD},
- {blinkW, String_blink, PROPF_METHOD},
- {boldW, String_bold, PROPF_METHOD},
- {charAtW, String_charAt, PROPF_METHOD|1},
- {charCodeAtW, String_charCodeAt, PROPF_METHOD|1},
- {concatW, String_concat, PROPF_METHOD|1},
- {fixedW, String_fixed, PROPF_METHOD},
- {fontcolorW, String_fontcolor, PROPF_METHOD|1},
- {fontsizeW, String_fontsize, PROPF_METHOD|1},
- {indexOfW, String_indexOf, PROPF_METHOD|2},
- {italicsW, String_italics, PROPF_METHOD},
- {lastIndexOfW, String_lastIndexOf, PROPF_METHOD|2},
- {lengthW, NULL,0, String_get_length},
- {linkW, String_link, PROPF_METHOD|1},
- {localeCompareW, String_localeCompare, PROPF_METHOD|1},
- {matchW, String_match, PROPF_METHOD|1},
- {replaceW, String_replace, PROPF_METHOD|1},
- {searchW, String_search, PROPF_METHOD},
- {sliceW, String_slice, PROPF_METHOD},
- {smallW, String_small, PROPF_METHOD},
- {splitW, String_split, PROPF_METHOD|2},
- {strikeW, String_strike, PROPF_METHOD},
- {subW, String_sub, PROPF_METHOD},
- {substrW, String_substr, PROPF_METHOD|2},
- {substringW, String_substring, PROPF_METHOD|2},
- {supW, String_sup, PROPF_METHOD},
- {toLocaleLowerCaseW, String_toLocaleLowerCase, PROPF_METHOD},
- {toLocaleUpperCaseW, String_toLocaleUpperCase, PROPF_METHOD},
- {toLowerCaseW, String_toLowerCase, PROPF_METHOD},
- {toStringW, String_toString, PROPF_METHOD},
- {toUpperCaseW, String_toUpperCase, PROPF_METHOD},
- {trimW, String_trim, PROPF_ES5|PROPF_METHOD},
- {valueOfW, String_valueOf, PROPF_METHOD}
+ {L"anchor", String_anchor, PROPF_METHOD|1},
+ {L"big", String_big, PROPF_METHOD},
+ {L"blink", String_blink, PROPF_METHOD},
+ {L"bold", String_bold, PROPF_METHOD},
+ {L"charAt", String_charAt, PROPF_METHOD|1},
+ {L"charCodeAt", String_charCodeAt, PROPF_METHOD|1},
+ {L"concat", String_concat, PROPF_METHOD|1},
+ {L"fixed", String_fixed, PROPF_METHOD},
+ {L"fontcolor", String_fontcolor, PROPF_METHOD|1},
+ {L"fontsize", String_fontsize, PROPF_METHOD|1},
+ {L"indexOf", String_indexOf, PROPF_METHOD|2},
+ {L"italics", String_italics, PROPF_METHOD},
+ {L"lastIndexOf", String_lastIndexOf, PROPF_METHOD|2},
+ {L"length", NULL,0, String_get_length},
+ {L"link", String_link, PROPF_METHOD|1},
+ {L"localeCompare", String_localeCompare, PROPF_METHOD|1},
+ {L"match", String_match, PROPF_METHOD|1},
+ {L"replace", String_replace, PROPF_METHOD|1},
+ {L"search", String_search, PROPF_METHOD},
+ {L"slice", String_slice, PROPF_METHOD},
+ {L"small", String_small, PROPF_METHOD},
+ {L"split", String_split, PROPF_METHOD|2},
+ {L"strike", String_strike, PROPF_METHOD},
+ {L"sub", String_sub, PROPF_METHOD},
+ {L"substr", String_substr, PROPF_METHOD|2},
+ {L"substring", String_substring, PROPF_METHOD|2},
+ {L"sup", String_sup, PROPF_METHOD},
+ {L"toLocaleLowerCase", String_toLocaleLowerCase, PROPF_METHOD},
+ {L"toLocaleUpperCase", String_toLocaleUpperCase, PROPF_METHOD},
+ {L"toLowerCase", String_toLowerCase, PROPF_METHOD},
+ {L"toString", String_toString, PROPF_METHOD},
+ {L"toUpperCase", String_toUpperCase, PROPF_METHOD},
+ {L"trim", String_trim, PROPF_ES5|PROPF_METHOD},
+ {L"valueOf", String_valueOf, PROPF_METHOD}
};
static const builtin_info_t String_info = {
@@ -1636,7 +1579,7 @@ static const builtin_info_t String_info = {
};
static const builtin_prop_t StringInst_props[] = {
- {lengthW, NULL,0, String_get_length}
+ {L"length", NULL,0, String_get_length}
};
static const builtin_info_t StringInst_info = {
@@ -1754,7 +1697,7 @@ static HRESULT string_alloc(script_ctx_t *ctx, jsdisp_t *object_prototype, jsstr
}
static const builtin_prop_t StringConstr_props[] = {
- {fromCharCodeW, StringConstr_fromCharCode, PROPF_METHOD},
+ {L"fromCharCode", StringConstr_fromCharCode, PROPF_METHOD},
};
static const builtin_info_t StringConstr_info = {
@@ -1771,13 +1714,11 @@ HRESULT create_string_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdi
StringInstance *string;
HRESULT hres;
- static const WCHAR StringW[] = {'S','t','r','i','n','g',0};
-
hres = string_alloc(ctx, object_prototype, jsstr_empty(), &string);
if(FAILED(hres))
return hres;
- hres = create_builtin_constructor(ctx, StringConstr_value, StringW, &StringConstr_info,
+ hres = create_builtin_constructor(ctx, StringConstr_value, L"String", &StringConstr_info,
PROPF_CONSTR|1, &string->dispex, ret);
jsdisp_release(&string->dispex);
diff --git a/dlls/jscript/vbarray.c b/dlls/jscript/vbarray.c
index b2678443d2c..69a77f1e56a 100644
--- a/dlls/jscript/vbarray.c
+++ b/dlls/jscript/vbarray.c
@@ -326,13 +326,11 @@ HRESULT create_vbarray_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsd
VBArrayInstance *vbarray;
HRESULT hres;
- static const WCHAR VBArrayW[] = {'V','B','A','r','r','a','y',0};
-
hres = alloc_vbarray(ctx, object_prototype, &vbarray);
if(FAILED(hres))
return hres;
- hres = create_builtin_constructor(ctx, VBArrayConstr_value, VBArrayW, NULL, PROPF_CONSTR|1, &vbarray->dispex, ret);
+ hres = create_builtin_constructor(ctx, VBArrayConstr_value, L"VBArray", NULL, PROPF_CONSTR|1, &vbarray->dispex, ret);
jsdisp_release(&vbarray->dispex);
return hres;
--
2.26.2
2
1
Nov. 24, 2020
If the call pFcStrListNext returns NULL the loop is never entered and
the variable font_set never gets written, leading to a crash cleaning
up font_set by pFcFontSetDestroy.
Maybe caused by dir_list being empty.
Signed-off-by: Bernhard Übelacker <bernhardu(a)mailbox.org>
C:\windows\system32\winemenubuilder.exe -a -r
0034:err:module:LdrInitializeThunk "gdi32.dll" failed to initialize, aborting
0034:err:module:LdrInitializeThunk Initializing dlls for L"C:\\windows\\system32\\winemenubuilder.exe" failed, status c0000005
(rr) bt
#0 0x7edfea16 in IA__FcFontSetDestroy (s=0x7ee0bbec <IA__FcStrSetDestroy+12>) at fcfs.c:48
#1 0x7f114d9d in fontconfig_add_fonts_from_dir_list (config=0x7d81d740, dir_list=0x7d822c60, done_set=0x7d822c30, flags=5) at .../wine-git/dlls/gdi32/freetype.c:1509
#2 0x7f114d4a in fontconfig_add_fonts_from_dir_list (config=0x7d81d740, dir_list=0x7d822b70, done_set=0x7d822c30, flags=5) at .../wine-git/dlls/gdi32/freetype.c:1503
#3 0x7f114d4a in fontconfig_add_fonts_from_dir_list (config=0x7d81d740, dir_list=0x7d82a910, done_set=0x7d822c30, flags=5) at .../wine-git/dlls/gdi32/freetype.c:1503
#4 0x7f114d4a in fontconfig_add_fonts_from_dir_list (config=0x7d81d740, dir_list=0x7d82a570, done_set=0x7d822c30, flags=5) at .../wine-git/dlls/gdi32/freetype.c:1503
#5 0x7f114e52 in load_fontconfig_fonts () at .../wine-git/dlls/gdi32/freetype.c:1526
#6 0x7f115d46 in freetype_load_fonts () at .../wine-git/dlls/gdi32/freetype.c:1749
#7 0x6ca35fcc in font_init () at .../wine-git/dlls/gdi32/font.c:7944
#8 0x6ca37698 in DllMain(a)12 (inst=0x6c9c0000, reason=1, reserved=0x31fd24) at .../wine-git/dlls/gdi32/gdiobj.c:629
#9 0x7bc2c266 in call_dll_entry_point ()
#10 0x7bc2f6e6 in MODULE_InitDLL (wm=<optimized out>, reason=<optimized out>, lpReserved=<optimized out>) at .../wine-git/dlls/ntdll/loader.c:1332
#11 0x7bc2fafc in process_attach (wm=0x110f10, lpReserved=0x31fd24) at .../wine-git/dlls/ntdll/loader.c:1426
#12 0x7bc2fa4a in process_attach (wm=0x1109a8, lpReserved=0x31fd24) at .../wine-git/dlls/ntdll/loader.c:1397
#13 0x7bc2fa4a in process_attach (wm=0x1107d8, lpReserved=0x31fd24) at .../wine-git/dlls/ntdll/loader.c:1397
#14 0x7bc32f58 in LdrInitializeThunk(a)16 (context=0x31fd24, unknown2=268427264, unknown3=1, unknown4=0) at .../wine-git/dlls/ntdll/loader.c:1397
#15 0x00000000 in ?? ()
(rr)
(rr) print/x *dir_list
$14 = {set = 0x7d820190, n = 0x0}
Two frames up shows dir="/usr/share/fonts/X11/100dpi".
libfontconfig1:i386 in version 2.13.1-4.2.
Might be related to:
a51d68e35c53
gdi32: Load font list directly from fontconfig cache.
---
dlls/gdi32/freetype.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 993110e6fe0..e7684728c9c 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -1468,7 +1468,7 @@ static void init_fontconfig(void)
static void fontconfig_add_fonts_from_dir_list( FcConfig *config, FcStrList *dir_list, FcStrSet *done_set, DWORD flags )
{
const FcChar8 *dir;
- FcFontSet *font_set;
+ FcFontSet *font_set = NULL;
FcStrList *subdir_list = NULL;
FcStrSet *subdir_set = NULL;
FcCache *cache = NULL;
--
2.29.2
3
2
[PATCH] winex11.drv: Add a taskbar button for a minimized owned window.
by Dmitry Timoshkov Nov. 24, 2020
by Dmitry Timoshkov Nov. 24, 2020
Nov. 24, 2020
Otherwise minimizing an owned window without WS_EX_APPWINDOW style (common
for Delphi applications) leads to a window completely disappearing after being
minimized.
Before this patch: no taskbar window for a normal or minimized owned window.
After this patch: no taskbar window for normal owned window, after a window
being minimized a taskbar button appears, after a window being restored a taskbar
button gets removed.
Essentially this patch fixes a regression caused by
commit 61e50e15ba45ad54655f98619f5ef33917033165
Author: Alexandre Julliard <julliard(a)winehq.org>
Date: Fri May 28 12:14:43 2010 +0200
winex11: Map zero-size windows and set an empty window region for them.
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/winex11.drv/window.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 457173964e..f0a3f07f37 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -987,7 +987,7 @@ void update_net_wm_states( struct x11drv_win_data *data )
new_state |= (1 << NET_WM_STATE_ABOVE);
if (ex_style & (WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE))
new_state |= (1 << NET_WM_STATE_SKIP_TASKBAR) | (1 << NET_WM_STATE_SKIP_PAGER);
- if (!(ex_style & WS_EX_APPWINDOW) && GetWindow( data->hwnd, GW_OWNER ))
+ if (!(ex_style & WS_EX_APPWINDOW) && !(style & WS_MINIMIZE) && GetWindow( data->hwnd, GW_OWNER ))
new_state |= (1 << NET_WM_STATE_SKIP_TASKBAR);
if (!data->mapped) /* set the _NET_WM_STATE atom directly */
@@ -2499,7 +2499,8 @@ void CDECL X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags
else
{
if (swp_flags & (SWP_FRAMECHANGED|SWP_STATECHANGED)) set_wm_hints( data );
- if (!event_type) update_net_wm_states( data );
+ if (!event_type || event_type == PropertyNotify)
+ update_net_wm_states( data );
}
}
--
2.29.2
1
0