Wine-Devel
Threads by month
- ----- 2026 -----
- June
- 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
- 4 participants
- 84544 discussions
Oct. 8, 2020
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/mf/evr.c | 333 +++++++++++++++++++++++++++------------------
dlls/mf/tests/mf.c | 8 +-
2 files changed, 208 insertions(+), 133 deletions(-)
diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c
index c5b2ceecd67..e90cf686f26 100644
--- a/dlls/mf/evr.c
+++ b/dlls/mf/evr.c
@@ -854,12 +854,195 @@ static ULONG WINAPI video_renderer_Release(IMFVideoRenderer *iface)
return IMFMediaSink_Release(&renderer->IMFMediaSink_iface);
}
+static HRESULT video_renderer_create_mixer(IMFAttributes *attributes, IMFTransform **out)
+{
+ unsigned int flags = 0;
+ IMFActivate *activate;
+ CLSID clsid;
+ HRESULT hr;
+
+ if (attributes && SUCCEEDED(hr = IMFAttributes_GetUnknown(attributes, &MF_ACTIVATE_CUSTOM_VIDEO_MIXER_ACTIVATE,
+ &IID_IMFActivate, (void **)&activate)))
+ {
+ IMFAttributes_GetUINT32(attributes, &MF_ACTIVATE_CUSTOM_VIDEO_MIXER_FLAGS, &flags);
+ hr = IMFActivate_ActivateObject(activate, &IID_IMFTransform, (void **)out);
+ IMFActivate_Release(activate);
+ if (SUCCEEDED(hr) || !(flags & MF_ACTIVATE_CUSTOM_MIXER_ALLOWFAIL))
+ return hr;
+ }
+
+ if (!attributes || FAILED(IMFAttributes_GetGUID(attributes, &MF_ACTIVATE_CUSTOM_VIDEO_MIXER_CLSID, &clsid)))
+ memcpy(&clsid, &CLSID_MFVideoMixer9, sizeof(clsid));
+
+ return CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IMFTransform, (void **)out);
+}
+
+static HRESULT video_renderer_create_presenter(IMFAttributes *attributes, IMFVideoPresenter **out)
+{
+ unsigned int flags = 0;
+ IMFActivate *activate;
+ CLSID clsid;
+ HRESULT hr;
+
+ if (attributes && SUCCEEDED(IMFAttributes_GetUnknown(attributes, &MF_ACTIVATE_CUSTOM_VIDEO_PRESENTER_ACTIVATE,
+ &IID_IMFActivate, (void **)&activate)))
+ {
+ IMFAttributes_GetUINT32(attributes, &MF_ACTIVATE_CUSTOM_VIDEO_PRESENTER_FLAGS, &flags);
+ hr = IMFActivate_ActivateObject(activate, &IID_IMFVideoPresenter, (void **)out);
+ IMFActivate_Release(activate);
+ if (SUCCEEDED(hr) || !(flags & MF_ACTIVATE_CUSTOM_PRESENTER_ALLOWFAIL))
+ return hr;
+ }
+
+ if (!attributes || FAILED(IMFAttributes_GetGUID(attributes, &MF_ACTIVATE_CUSTOM_VIDEO_PRESENTER_CLSID, &clsid)))
+ memcpy(&clsid, &CLSID_MFVideoPresenter9, sizeof(clsid));
+
+ return CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IMFVideoPresenter, (void **)out);
+}
+
+static HRESULT video_renderer_configure_mixer(struct video_renderer *renderer)
+{
+ IMFTopologyServiceLookupClient *lookup_client;
+ HRESULT hr;
+
+ if (SUCCEEDED(hr = IMFTransform_QueryInterface(renderer->mixer, &IID_IMFTopologyServiceLookupClient,
+ (void **)&lookup_client)))
+ {
+ renderer->flags |= EVR_INIT_SERVICES;
+ if (SUCCEEDED(hr = IMFTopologyServiceLookupClient_InitServicePointers(lookup_client,
+ &renderer->IMFTopologyServiceLookup_iface)))
+ {
+ renderer->flags |= EVR_MIXER_INITED_SERVICES;
+ }
+ renderer->flags &= ~EVR_INIT_SERVICES;
+ IMFTopologyServiceLookupClient_Release(lookup_client);
+ }
+
+ if (SUCCEEDED(hr))
+ {
+ unsigned int input_count, output_count;
+ unsigned int *ids, *oids;
+ size_t i;
+
+ /* Create stream sinks for inputs that mixer already has by default. */
+ if (SUCCEEDED(IMFTransform_GetStreamCount(renderer->mixer, &input_count, &output_count)))
+ {
+ ids = heap_calloc(input_count, sizeof(*ids));
+ oids = heap_calloc(output_count, sizeof(*oids));
+
+ if (ids && oids)
+ {
+ if (SUCCEEDED(IMFTransform_GetStreamIDs(renderer->mixer, input_count, ids, output_count, oids)))
+ {
+ for (i = 0; i < input_count; ++i)
+ {
+ video_renderer_add_stream(renderer, ids[i], NULL);
+ }
+ }
+
+ }
+
+ heap_free(ids);
+ heap_free(oids);
+ }
+ }
+
+ return hr;
+}
+
+static HRESULT video_renderer_configure_presenter(struct video_renderer *renderer)
+{
+ IMFTopologyServiceLookupClient *lookup_client;
+ HRESULT hr;
+
+ if (SUCCEEDED(hr = IMFVideoPresenter_QueryInterface(renderer->presenter, &IID_IMFTopologyServiceLookupClient,
+ (void **)&lookup_client)))
+ {
+ renderer->flags |= EVR_INIT_SERVICES;
+ if (SUCCEEDED(hr = IMFTopologyServiceLookupClient_InitServicePointers(lookup_client,
+ &renderer->IMFTopologyServiceLookup_iface)))
+ {
+ renderer->flags |= EVR_PRESENTER_INITED_SERVICES;
+ }
+ renderer->flags &= ~EVR_INIT_SERVICES;
+ IMFTopologyServiceLookupClient_Release(lookup_client);
+ }
+
+ return hr;
+}
+
+static HRESULT video_renderer_initialize(struct video_renderer *renderer, IMFTransform *mixer,
+ IMFVideoPresenter *presenter)
+{
+ HRESULT hr;
+
+ if (renderer->mixer)
+ {
+ IMFTransform_Release(renderer->mixer);
+ renderer->mixer = NULL;
+ }
+
+ if (renderer->presenter)
+ {
+ IMFVideoPresenter_Release(renderer->presenter);
+ renderer->presenter = NULL;
+ }
+
+ renderer->mixer = mixer;
+ IMFTransform_AddRef(renderer->mixer);
+
+ renderer->presenter = presenter;
+ IMFVideoPresenter_AddRef(renderer->presenter);
+
+ if (SUCCEEDED(hr = video_renderer_configure_mixer(renderer)))
+ hr = video_renderer_configure_presenter(renderer);
+
+ return hr;
+}
+
static HRESULT WINAPI video_renderer_InitializeRenderer(IMFVideoRenderer *iface, IMFTransform *mixer,
IMFVideoPresenter *presenter)
{
- FIXME("%p, %p, %p.\n", iface, mixer, presenter);
+ struct video_renderer *renderer = impl_from_IMFVideoRenderer(iface);
+ HRESULT hr;
- return E_NOTIMPL;
+ TRACE("%p, %p, %p.\n", iface, mixer, presenter);
+
+ if (mixer)
+ IMFTransform_AddRef(mixer);
+ else if (FAILED(hr = video_renderer_create_mixer(NULL, &mixer)))
+ {
+ WARN("Failed to create default mixer object, hr %#x.\n", hr);
+ return hr;
+ }
+
+ if (presenter)
+ IMFVideoPresenter_AddRef(presenter);
+ else if (FAILED(hr = video_renderer_create_presenter(NULL, &presenter)))
+ {
+ WARN("Failed to create default presenter, hr %#x.\n", hr);
+ IMFTransform_Release(mixer);
+ return hr;
+ }
+
+ EnterCriticalSection(&renderer->cs);
+
+ if (renderer->flags & EVR_SHUT_DOWN)
+ hr = MF_E_SHUTDOWN;
+ else
+ {
+ /* FIXME: check clock state */
+ /* FIXME: check that streams are not initialized */
+
+ hr = video_renderer_initialize(renderer, mixer, presenter);
+ }
+
+ LeaveCriticalSection(&renderer->cs);
+
+ IMFTransform_Release(mixer);
+ IMFVideoPresenter_Release(presenter);
+
+ return hr;
}
static const IMFVideoRendererVtbl video_renderer_vtbl =
@@ -1191,128 +1374,11 @@ static const IMediaEventSinkVtbl media_event_sink_vtbl =
video_renderer_event_sink_Notify,
};
-static HRESULT video_renderer_create_mixer(struct video_renderer *renderer, IMFAttributes *attributes,
- IMFTransform **out)
-{
- IMFTopologyServiceLookupClient *lookup_client;
- unsigned int flags = 0;
- IMFActivate *activate;
- CLSID clsid;
- HRESULT hr;
-
- if (SUCCEEDED(hr = IMFAttributes_GetUnknown(attributes, &MF_ACTIVATE_CUSTOM_VIDEO_MIXER_ACTIVATE,
- &IID_IMFActivate, (void **)&activate)))
- {
- IMFAttributes_GetUINT32(attributes, &MF_ACTIVATE_CUSTOM_VIDEO_MIXER_FLAGS, &flags);
- hr = IMFActivate_ActivateObject(activate, &IID_IMFTransform, (void **)out);
- IMFActivate_Release(activate);
- if (FAILED(hr) && !(flags & MF_ACTIVATE_CUSTOM_MIXER_ALLOWFAIL))
- return hr;
- }
-
- /* Activation object failed, use class activation. */
- if (FAILED(hr))
- {
- if (FAILED(IMFAttributes_GetGUID(attributes, &MF_ACTIVATE_CUSTOM_VIDEO_MIXER_CLSID, &clsid)))
- memcpy(&clsid, &CLSID_MFVideoMixer9, sizeof(clsid));
- hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IMFTransform, (void **)out);
- }
-
- if (FAILED(hr))
- {
- WARN("Failed to create a mixer object, hr %#x.\n", hr);
- return hr;
- }
-
- if (SUCCEEDED(hr = IMFTransform_QueryInterface(*out, &IID_IMFTopologyServiceLookupClient,
- (void **)&lookup_client)))
- {
- renderer->flags |= EVR_INIT_SERVICES;
- if (SUCCEEDED(hr = IMFTopologyServiceLookupClient_InitServicePointers(lookup_client,
- &renderer->IMFTopologyServiceLookup_iface)))
- {
- renderer->flags |= EVR_MIXER_INITED_SERVICES;
- }
- renderer->flags &= ~EVR_INIT_SERVICES;
- IMFTopologyServiceLookupClient_Release(lookup_client);
- }
-
- if (SUCCEEDED(hr))
- {
- unsigned int input_count, output_count;
- unsigned int *ids, *oids;
- size_t i;
-
- /* Create stream sinks for inputs that mixer already has by default. */
- if (SUCCEEDED(IMFTransform_GetStreamCount(*out, &input_count, &output_count)))
- {
- ids = heap_calloc(input_count, sizeof(*ids));
- oids = heap_calloc(output_count, sizeof(*oids));
-
- if (ids && oids)
- {
- if (SUCCEEDED(IMFTransform_GetStreamIDs(*out, input_count, ids, output_count, oids)))
- {
- for (i = 0; i < input_count; ++i)
- {
- video_renderer_add_stream(renderer, ids[i], NULL);
- }
- }
-
- }
-
- heap_free(ids);
- heap_free(oids);
- }
- }
-
- return hr;
-}
-
-static HRESULT video_renderer_create_presenter(struct video_renderer *renderer, IMFAttributes *attributes,
- IMFVideoPresenter **out)
-{
- IMFTopologyServiceLookupClient *lookup_client;
- unsigned int flags = 0;
- IMFActivate *activate;
- CLSID clsid;
- HRESULT hr;
-
- if (SUCCEEDED(IMFAttributes_GetUnknown(attributes, &MF_ACTIVATE_CUSTOM_VIDEO_PRESENTER_ACTIVATE,
- &IID_IMFActivate, (void **)&activate)))
- {
- IMFAttributes_GetUINT32(attributes, &MF_ACTIVATE_CUSTOM_VIDEO_PRESENTER_FLAGS, &flags);
- hr = IMFActivate_ActivateObject(activate, &IID_IMFVideoPresenter, (void **)out);
- IMFActivate_Release(activate);
- if (FAILED(hr) && !(flags & MF_ACTIVATE_CUSTOM_PRESENTER_ALLOWFAIL))
- return hr;
- }
-
- if (FAILED(IMFAttributes_GetGUID(attributes, &MF_ACTIVATE_CUSTOM_VIDEO_PRESENTER_CLSID, &clsid)))
- memcpy(&clsid, &CLSID_MFVideoPresenter9, sizeof(clsid));
-
- if (SUCCEEDED(hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IMFVideoPresenter, (void **)out)))
- {
- if (SUCCEEDED(hr = IMFVideoPresenter_QueryInterface(*out, &IID_IMFTopologyServiceLookupClient,
- (void **)&lookup_client)))
- {
- renderer->flags |= EVR_INIT_SERVICES;
- if (SUCCEEDED(hr = IMFTopologyServiceLookupClient_InitServicePointers(lookup_client,
- &renderer->IMFTopologyServiceLookup_iface)))
- {
- renderer->flags |= EVR_PRESENTER_INITED_SERVICES;
- }
- renderer->flags &= ~EVR_INIT_SERVICES;
- IMFTopologyServiceLookupClient_Release(lookup_client);
- }
- }
-
- return hr;
-}
-
static HRESULT evr_create_object(IMFAttributes *attributes, void *user_context, IUnknown **obj)
{
struct video_renderer *object;
+ IMFVideoPresenter *presenter;
+ IMFTransform *mixer;
HRESULT hr;
TRACE("%p, %p, %p.\n", attributes, user_context, obj);
@@ -1335,18 +1401,30 @@ static HRESULT evr_create_object(IMFAttributes *attributes, void *user_context,
goto failed;
/* Create mixer and presenter. */
- if (FAILED(hr = video_renderer_create_mixer(object, attributes, &object->mixer)))
+ if (FAILED(hr = video_renderer_create_mixer(attributes, &mixer)))
+ goto failed;
+
+ if (FAILED(hr = video_renderer_create_presenter(attributes, &presenter)))
goto failed;
- if (FAILED(hr = video_renderer_create_presenter(object, attributes, &object->presenter)))
+ if (FAILED(hr = video_renderer_initialize(object, mixer, presenter)))
goto failed;
+ IMFTransform_Release(mixer);
+ IMFVideoPresenter_Release(presenter);
+
*obj = (IUnknown *)&object->IMFMediaSink_iface;
return S_OK;
failed:
+ if (mixer)
+ IMFTransform_Release(mixer);
+
+ if (presenter)
+ IMFVideoPresenter_Release(presenter);
+
video_renderer_release_services(object);
IMFMediaSink_Release(&object->IMFMediaSink_iface);
@@ -1394,7 +1472,6 @@ HRESULT WINAPI MFCreateVideoRendererActivate(HWND hwnd, IMFActivate **activate)
*/
HRESULT WINAPI MFCreateVideoRenderer(REFIID riid, void **renderer)
{
- IMFAttributes *attributes;
IUnknown *obj;
HRESULT hr;
@@ -1402,13 +1479,7 @@ HRESULT WINAPI MFCreateVideoRenderer(REFIID riid, void **renderer)
*renderer = NULL;
- if (FAILED(hr = MFCreateAttributes(&attributes, 0)))
- return hr;
-
- hr = evr_create_object(attributes, NULL, &obj);
- IMFAttributes_Release(attributes);
-
- if (SUCCEEDED(hr))
+ if (SUCCEEDED(hr = evr_create_object(NULL, NULL, &obj)))
{
hr = IUnknown_QueryInterface(obj, riid, renderer);
IUnknown_Release(obj);
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c
index 0bc297cc69c..88cfa8d7625 100644
--- a/dlls/mf/tests/mf.c
+++ b/dlls/mf/tests/mf.c
@@ -3253,9 +3253,13 @@ static void test_evr(void)
hr = CoInitialize(NULL);
ok(hr == S_OK, "Failed to initialize, hr %#x.\n", hr);
- hr = MFCreateVideoRenderer(&IID_IUnknown, (void **)&unk);
+ hr = MFCreateVideoRenderer(&IID_IMFVideoRenderer, (void **)&video_renderer);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
- IUnknown_Release(unk);
+
+ hr = IMFVideoRenderer_InitializeRenderer(video_renderer, NULL, NULL);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ IMFVideoRenderer_Release(video_renderer);
hr = MFCreateVideoRendererActivate(NULL, NULL);
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
--
2.28.0
1
5
Oct. 8, 2020
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/msvcp110/tests/msvcp110.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/dlls/msvcp110/tests/msvcp110.c b/dlls/msvcp110/tests/msvcp110.c
index 550246a7f23..8491e292d58 100644
--- a/dlls/msvcp110/tests/msvcp110.c
+++ b/dlls/msvcp110/tests/msvcp110.c
@@ -84,8 +84,6 @@ static void test_tr2_sys__Last_write_time(void)
HANDLE file;
int ret;
FILETIME lwt;
- static const WCHAR fileW[] = {'t','r','2','_','t','e','s','t','_','d','i','r','/','f','1',0};
- static const WCHAR not_existW[] = {'n','o','t','_','e','x','i','s','t',0};
__int64 last_write_time, newtime, margin_of_error = 10 * TICKSPERSEC;
ret = p_tr2_sys__Make_dir("tr2_test_dir");
ok(ret == 1, "test_tr2_sys__Make_dir(): expect 1 got %d\n", ret);
@@ -100,7 +98,7 @@ static void test_tr2_sys__Last_write_time(void)
ok(last_write_time != newtime, "last_write_time should have changed: %s\n",
wine_dbgstr_longlong(last_write_time));
- last_write_time = p_tr2_sys__Last_write_time_wchar(fileW);
+ last_write_time = p_tr2_sys__Last_write_time_wchar(L"tr2_test_dir/f1");
ok(last_write_time == newtime,
"last_write_time and last_write_time_wchar returned different times (%s != %s)\n",
wine_dbgstr_longlong(last_write_time), wine_dbgstr_longlong(newtime));
@@ -132,7 +130,7 @@ static void test_tr2_sys__Last_write_time(void)
"don't fit the formula, last_write_time is %s\n", wine_dbgstr_longlong(last_write_time));
newtime = 123456789;
- p_tr2_sys__Last_write_time_set_wchar(fileW, newtime);
+ p_tr2_sys__Last_write_time_set_wchar(L"tr2_test_dir/f1", newtime);
newtime = p_tr2_sys__Last_write_time("tr2_test_dir/f1");
file = CreateFileA("tr2_test_dir/f1", 0, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
@@ -149,7 +147,7 @@ static void test_tr2_sys__Last_write_time(void)
last_write_time = p_tr2_sys__Last_write_time("not_exist");
ok(errno == 0xdeadbeef, "tr2_sys__Last_write_time(): errno expect 0xdeadbeef, got %d\n", errno);
ok(last_write_time == 0, "expect 0 got %s\n", wine_dbgstr_longlong(last_write_time));
- last_write_time = p_tr2_sys__Last_write_time_wchar(not_existW);
+ last_write_time = p_tr2_sys__Last_write_time_wchar(L"not_exist");
ok(errno == 0xdeadbeef, "tr2_sys__Last_write_time_wchar(): errno expect 0xdeadbeef, got %d\n", errno);
ok(last_write_time == 0, "expect 0 got %s\n", wine_dbgstr_longlong(last_write_time));
last_write_time = p_tr2_sys__Last_write_time(NULL);
@@ -160,7 +158,7 @@ static void test_tr2_sys__Last_write_time(void)
errno = 0xdeadbeef;
p_tr2_sys__Last_write_time_set("not_exist", newtime);
ok(errno == 0xdeadbeef, "tr2_sys__Last_write_time(): errno expect 0xdeadbeef, got %d\n", errno);
- p_tr2_sys__Last_write_time_set_wchar(not_existW, newtime);
+ p_tr2_sys__Last_write_time_set_wchar(L"not_exist", newtime);
ok(errno == 0xdeadbeef, "tr2_sys__Last_write_time(): errno expect 0xdeadbeef, got %d\n", errno);
p_tr2_sys__Last_write_time_set(NULL, newtime);
ok(errno == 0xdeadbeef, "tr2_sys__Last_write_time(): errno expect 0xdeadbeef, got %d\n", errno);
--
2.26.2
2
1
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
v2: Fix a '\' getting lost in the search&replace of exe_name.
Thanks to Stefan for noticing it.
programs/regsvr32/regsvr32.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/programs/regsvr32/regsvr32.c b/programs/regsvr32/regsvr32.c
index 730f1fef3dd..885f0ff7833 100644
--- a/programs/regsvr32/regsvr32.c
+++ b/programs/regsvr32/regsvr32.c
@@ -114,9 +114,7 @@ static LPCWSTR find_arg_start(LPCWSTR cmdline)
static void reexec_self(void)
{
/* restart current process as 32-bit or 64-bit with same command line */
- static const WCHAR exe_name[] = {'\\','r','e','g','s','v','r','3','2','.','e','x','e',0};
#ifndef _WIN64
- static const WCHAR sysnative[] = {'\\','S','y','s','N','a','t','i','v','e',0};
BOOL wow64;
#endif
WCHAR systemdir[MAX_PATH];
@@ -138,16 +136,16 @@ static void reexec_self(void)
}
GetWindowsDirectoryW(systemdir, MAX_PATH);
- wcscat(systemdir, sysnative);
+ wcscat(systemdir, L"\\SysNative");
#endif
args = find_arg_start(GetCommandLineW());
cmdline = HeapAlloc(GetProcessHeap(), 0,
- (wcslen(systemdir)+wcslen(exe_name)+wcslen(args)+1)*sizeof(WCHAR));
+ (wcslen(systemdir)+wcslen(L"\\regsvr32.exe")+wcslen(args)+1)*sizeof(WCHAR));
wcscpy(cmdline, systemdir);
- wcscat(cmdline, exe_name);
+ wcscat(cmdline, L"\\regsvr32.exe");
wcscat(cmdline, args);
si.cb = sizeof(si);
--
2.25.4
1
0
Oct. 8, 2020
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/riched20/wrap.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c
index 48db31f4ff2..4853eefcabb 100644
--- a/dlls/riched20/wrap.c
+++ b/dlls/riched20/wrap.c
@@ -795,21 +795,17 @@ end:
}
-static HRESULT shape_para( ME_Context *c, ME_DisplayItem *p )
+static HRESULT shape_para( ME_Context *c, ME_Paragraph *para )
{
- ME_DisplayItem *di;
ME_Run *run;
HRESULT hr;
- for (di = p->next; di != p->member.para.next_para; di = di->next)
+ for (run = para_first_run( para ); run; run = run_next( run ))
{
- if (di->type != diRun) continue;
- run = &di->member.run;
-
hr = shape_run( c, run );
if (FAILED( hr ))
{
- run->para->nFlags &= ~MEPF_COMPLEX;
+ para->nFlags &= ~MEPF_COMPLEX;
return hr;
}
}
@@ -835,7 +831,7 @@ static void ME_WrapTextParagraph( ME_TextEditor *editor, ME_Context *c, ME_Parag
ScriptIsComplex( tp->member.para.text->szData, tp->member.para.text->nLen, SIC_COMPLEX ) == S_OK */)
{
if (SUCCEEDED( itemize_para( c, para ) ))
- shape_para( c, para_get_di( para ) );
+ shape_para( c, para );
}
wc.context = c;
--
2.23.0
1
0
Oct. 8, 2020
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/riched20/editor.h | 1 +
dlls/riched20/para.c | 13 +++++++++++++
dlls/riched20/wrap.c | 29 ++++++++---------------------
3 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index 922a1e5c6c2..47e822c2d34 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -211,6 +211,7 @@ int get_total_width(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void mark_para_rewrap(ME_TextEditor *editor, ME_DisplayItem *para) DECLSPEC_HIDDEN;
void add_marked_para(ME_TextEditor *editor, ME_DisplayItem *para) DECLSPEC_HIDDEN;
void remove_marked_para(ME_TextEditor *editor, ME_DisplayItem *para) DECLSPEC_HIDDEN;
+ME_Run *para_first_run( ME_Paragraph *para ) DECLSPEC_HIDDEN;
static inline ME_DisplayItem *para_get_di(ME_Paragraph *para)
{
return (ME_DisplayItem *)((ptrdiff_t)para - offsetof(ME_DisplayItem, member));
diff --git a/dlls/riched20/para.c b/dlls/riched20/para.c
index 7cef6ca9932..fb994506bea 100644
--- a/dlls/riched20/para.c
+++ b/dlls/riched20/para.c
@@ -143,6 +143,19 @@ void add_marked_para(ME_TextEditor *editor, ME_DisplayItem *di)
}
}
+ME_Run *para_first_run( ME_Paragraph *para )
+{
+ ME_DisplayItem *di;
+
+ for (di = para_get_di( para ); di != para->next_para; di = di->next )
+ {
+ if (di->type != diRun) continue;
+ return &di->member.run;
+ }
+ ERR( "failed to find run in paragraph\n" );
+ return NULL;
+}
+
void ME_MakeFirstParagraph(ME_TextEditor *editor)
{
static const WCHAR cr_lf[] = {'\r','\n',0};
diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c
index 13a54829b2b..48db31f4ff2 100644
--- a/dlls/riched20/wrap.c
+++ b/dlls/riched20/wrap.c
@@ -719,11 +719,9 @@ static void ME_PrepareParagraphForWrapping( ME_TextEditor *editor, ME_Context *c
}
}
-static HRESULT itemize_para( ME_Context *c, ME_DisplayItem *p )
+static HRESULT itemize_para( ME_Context *c, ME_Paragraph *para )
{
- ME_Paragraph *para = &p->member.para;
ME_Run *run;
- ME_DisplayItem *di;
SCRIPT_ITEM buf[16], *items = buf;
int items_passed = ARRAY_SIZE( buf ), num_items, cur_item;
SCRIPT_CONTROL control = { LANG_USER_DEFAULT, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
@@ -731,8 +729,6 @@ static HRESULT itemize_para( ME_Context *c, ME_DisplayItem *p )
SCRIPT_STATE state = { 0, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 0, 0 };
HRESULT hr;
- assert( p->type == diParagraph );
-
if (para->fmt.dwMask & PFM_RTLPARA && para->fmt.wEffects & PFE_RTLPARA)
state.uBidiLevel = 1;
@@ -763,19 +759,13 @@ static HRESULT itemize_para( ME_Context *c, ME_DisplayItem *p )
}
TRACE( "before splitting runs into ranges\n" );
- for (di = p->next; di != p->member.para.next_para; di = di->next)
- {
- if (di->type != diRun) continue;
- TRACE( "\t%d: %s\n", di->member.run.nCharOfs, debugstr_run( &di->member.run ) );
- }
+ for (run = para_first_run( para ); run; run = run_next( run ))
+ TRACE( "\t%d: %s\n", run->nCharOfs, debugstr_run( run ) );
}
/* split runs into ranges at item boundaries */
- for (di = p->next, cur_item = 0; di != p->member.para.next_para; di = di->next)
+ for (run = para_first_run( para ), cur_item = 0; run; run = run_next( run ))
{
- if (di->type != diRun) continue;
- run = &di->member.run;
-
if (run->nCharOfs == items[cur_item+1].iCharPos) cur_item++;
items[cur_item].a.fLogicalOrder = TRUE;
@@ -785,7 +775,7 @@ static HRESULT itemize_para( ME_Context *c, ME_DisplayItem *p )
if (run->nCharOfs + run->len > items[cur_item+1].iCharPos)
{
- ME_Cursor cursor = {p, di, items[cur_item+1].iCharPos - run->nCharOfs};
+ ME_Cursor cursor = {para_get_di( para ), run_get_di( run ), items[cur_item+1].iCharPos - run->nCharOfs};
ME_SplitRunSimple( c->editor, &cursor );
}
}
@@ -793,11 +783,8 @@ static HRESULT itemize_para( ME_Context *c, ME_DisplayItem *p )
if (TRACE_ON( richedit ))
{
TRACE( "after splitting into ranges\n" );
- for (di = p->next; di != p->member.para.next_para; di = di->next)
- {
- if (di->type != diRun) continue;
- TRACE( "\t%d: %s\n", di->member.run.nCharOfs, debugstr_run( &di->member.run ) );
- }
+ for (run = para_first_run( para ); run; run = run_next( run ))
+ TRACE( "\t%d: %s\n", run->nCharOfs, debugstr_run( run ) );
}
para->nFlags |= MEPF_COMPLEX;
@@ -847,7 +834,7 @@ static void ME_WrapTextParagraph( ME_TextEditor *editor, ME_Context *c, ME_Parag
if (!c->editor->cPasswordMask /* &&
ScriptIsComplex( tp->member.para.text->szData, tp->member.para.text->nLen, SIC_COMPLEX ) == S_OK */)
{
- if (SUCCEEDED( itemize_para( c, para_get_di( para ) ) ))
+ if (SUCCEEDED( itemize_para( c, para ) ))
shape_para( c, para_get_di( para ) );
}
--
2.23.0
1
0
Oct. 8, 2020
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/riched20/wrap.c | 150 +++++++++++++++++++++----------------------
1 file changed, 73 insertions(+), 77 deletions(-)
diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c
index c74931015a1..13a54829b2b 100644
--- a/dlls/riched20/wrap.c
+++ b/dlls/riched20/wrap.c
@@ -687,32 +687,36 @@ static int ME_GetParaLineSpace(ME_Context* c, ME_Paragraph* para)
return sp * c->editor->nZoomNumerator / c->editor->nZoomDenominator;
}
-static void ME_PrepareParagraphForWrapping(ME_TextEditor *editor, ME_Context *c, ME_DisplayItem *tp) {
- ME_DisplayItem *p;
-
- tp->member.para.nWidth = 0;
- /* remove row start items as they will be reinserted by the
- * paragraph wrapper anyway */
- editor->total_rows -= tp->member.para.nRows;
- tp->member.para.nRows = 0;
- for (p = tp->next; p != tp->member.para.next_para; p = p->next) {
- if (p->type == diStartRow) {
- ME_DisplayItem *pRow = p;
- p = p->prev;
- ME_Remove(pRow);
- ME_DestroyDisplayItem(pRow);
+static void ME_PrepareParagraphForWrapping( ME_TextEditor *editor, ME_Context *c, ME_Paragraph *para )
+{
+ ME_DisplayItem *p;
+
+ para->nWidth = 0;
+ /* remove row start items as they will be reinserted by the
+ * paragraph wrapper anyway */
+ editor->total_rows -= para->nRows;
+ para->nRows = 0;
+ for (p = para_get_di( para ); p != para->next_para; p = p->next)
+ {
+ if (p->type == diStartRow)
+ {
+ ME_DisplayItem *pRow = p;
+ p = p->prev;
+ ME_Remove( pRow );
+ ME_DestroyDisplayItem( pRow );
+ }
}
- }
- /* join runs that can be joined */
- for (p = tp->next; p != tp->member.para.next_para; p = p->next) {
- assert(p->type != diStartRow); /* should have been deleted above */
- if (p->type == diRun) {
- while (p->next->type == diRun && /* FIXME */
- ME_CanJoinRuns(&p->member.run, &p->next->member.run)) {
- ME_JoinRuns(c->editor, p);
- }
+
+ /* join runs that can be joined */
+ for (p = para_get_di( para )->next; p != para->next_para; p = p->next)
+ {
+ assert(p->type != diStartRow); /* should have been deleted above */
+ if (p->type == diRun)
+ {
+ while (p->next->type == diRun && ME_CanJoinRuns( &p->member.run, &p->next->member.run ))
+ ME_JoinRuns( c->editor, p );
+ }
}
- }
}
static HRESULT itemize_para( ME_Context *c, ME_DisplayItem *p )
@@ -825,103 +829,95 @@ static HRESULT shape_para( ME_Context *c, ME_DisplayItem *p )
return hr;
}
-static void ME_WrapTextParagraph( ME_TextEditor *editor, ME_Context *c, ME_DisplayItem *tp )
+static void ME_WrapTextParagraph( ME_TextEditor *editor, ME_Context *c, ME_Paragraph *para )
{
ME_Run *run;
ME_WrapContext wc;
int border = 0;
int linespace = 0;
- PARAFORMAT2 *pFmt;
- assert(tp->type == diParagraph);
- if (!(tp->member.para.nFlags & MEPF_REWRAP)) {
- return;
- }
- ME_PrepareParagraphForWrapping(editor, c, tp);
+ if (!(para->nFlags & MEPF_REWRAP)) return;
+
+ ME_PrepareParagraphForWrapping( editor, c, para );
/* Calculate paragraph numbering label */
- para_num_init( c, &tp->member.para );
+ para_num_init( c, para );
/* For now treating all non-password text as complex for better testing */
if (!c->editor->cPasswordMask /* &&
ScriptIsComplex( tp->member.para.text->szData, tp->member.para.text->nLen, SIC_COMPLEX ) == S_OK */)
{
- if (SUCCEEDED( itemize_para( c, tp ) ))
- shape_para( c, tp );
+ if (SUCCEEDED( itemize_para( c, para_get_di( para ) ) ))
+ shape_para( c, para_get_di( para ) );
}
- pFmt = &tp->member.para.fmt;
-
wc.context = c;
- wc.para = &tp->member.para;
-/* wc.para_style = tp->member.para.style; */
+ wc.para = para;
wc.style = NULL;
wc.nParaNumOffset = 0;
- if (tp->member.para.nFlags & MEPF_ROWEND) {
+ if (para->nFlags & MEPF_ROWEND)
wc.nFirstMargin = wc.nLeftMargin = wc.nRightMargin = 0;
- } else {
- int dxStartIndent = pFmt->dxStartIndent;
- if (tp->member.para.pCell) {
- dxStartIndent += ME_GetTableRowEnd(tp)->member.para.fmt.dxOffset;
- }
- wc.nLeftMargin = ME_twips2pointsX(c, dxStartIndent + pFmt->dxOffset);
- wc.nFirstMargin = ME_twips2pointsX(c, dxStartIndent);
- if (pFmt->wNumbering)
+ else
+ {
+ int dxStartIndent = para->fmt.dxStartIndent;
+ if (para->pCell)
+ dxStartIndent += ME_GetTableRowEnd( para_get_di( para ) )->member.para.fmt.dxOffset;
+
+ wc.nLeftMargin = ME_twips2pointsX( c, dxStartIndent + para->fmt.dxOffset );
+ wc.nFirstMargin = ME_twips2pointsX( c, dxStartIndent );
+ if (para->fmt.wNumbering)
{
wc.nParaNumOffset = wc.nFirstMargin;
- dxStartIndent = max( ME_twips2pointsX(c, pFmt->wNumberingTab),
- tp->member.para.para_num.width );
+ dxStartIndent = max( ME_twips2pointsX(c, para->fmt.wNumberingTab),
+ para->para_num.width );
wc.nFirstMargin += dxStartIndent;
}
- wc.nRightMargin = ME_twips2pointsX(c, pFmt->dxRightIndent);
+ wc.nRightMargin = ME_twips2pointsX( c, para->fmt.dxRightIndent );
- if (wc.nFirstMargin < 0)
- wc.nFirstMargin = 0;
- if (wc.nLeftMargin < 0)
- wc.nLeftMargin = 0;
+ if (wc.nFirstMargin < 0) wc.nFirstMargin = 0;
+ if (wc.nLeftMargin < 0) wc.nLeftMargin = 0;
}
if (c->editor->bEmulateVersion10 && /* v1.0 - 3.0 */
- pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE)
+ para->fmt.dwMask & PFM_TABLE && para->fmt.wEffects & PFE_TABLE)
{
- wc.nFirstMargin += ME_twips2pointsX(c, pFmt->dxOffset * 2);
+ wc.nFirstMargin += ME_twips2pointsX( c, para->fmt.dxOffset * 2 );
}
wc.nRow = 0;
wc.pt.y = 0;
- if (pFmt->dwMask & PFM_SPACEBEFORE)
- wc.pt.y += ME_twips2pointsY(c, pFmt->dySpaceBefore);
- if (!(pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE) &&
- pFmt->dwMask & PFM_BORDER)
+ if (para->fmt.dwMask & PFM_SPACEBEFORE)
+ wc.pt.y += ME_twips2pointsY( c, para->fmt.dySpaceBefore );
+ if (!(para->fmt.dwMask & PFM_TABLE && para->fmt.wEffects & PFE_TABLE) &&
+ para->fmt.dwMask & PFM_BORDER)
{
- border = ME_GetParaBorderWidth(c, tp->member.para.fmt.wBorders);
- if (pFmt->wBorders & 1) {
+ border = ME_GetParaBorderWidth( c, para->fmt.wBorders );
+ if (para->fmt.wBorders & 1)
+ {
wc.nFirstMargin += border;
wc.nLeftMargin += border;
}
- if (pFmt->wBorders & 2)
- wc.nRightMargin -= border;
- if (pFmt->wBorders & 4)
- wc.pt.y += border;
+ if (para->fmt.wBorders & 2) wc.nRightMargin -= border;
+ if (para->fmt.wBorders & 4) wc.pt.y += border;
}
- linespace = ME_GetParaLineSpace(c, &tp->member.para);
+ linespace = ME_GetParaLineSpace( c, para );
- ME_BeginRow(&wc);
- run = &ME_FindItemFwd( tp, diRun )->member.run;
+ ME_BeginRow( &wc );
+ run = &ME_FindItemFwd( para_get_di( para ), diRun )->member.run;
while (run)
{
run = ME_WrapHandleRun( &wc, run );
if (wc.nRow && run == wc.pRowStart) wc.pt.y += linespace;
}
ME_WrapEndParagraph( &wc );
- if (!(pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE) &&
- (pFmt->dwMask & PFM_BORDER) && (pFmt->wBorders & 8))
+ if (!(para->fmt.dwMask & PFM_TABLE && para->fmt.wEffects & PFE_TABLE) &&
+ (para->fmt.dwMask & PFM_BORDER) && (para->fmt.wBorders & 8))
wc.pt.y += border;
- if (tp->member.para.fmt.dwMask & PFM_SPACEAFTER)
- wc.pt.y += ME_twips2pointsY(c, pFmt->dySpaceAfter);
+ if (para->fmt.dwMask & PFM_SPACEAFTER)
+ wc.pt.y += ME_twips2pointsY( c, para->fmt.dySpaceAfter );
- tp->member.para.nFlags &= ~MEPF_REWRAP;
- tp->member.para.nHeight = wc.pt.y;
- tp->member.para.nRows = wc.nRow;
+ para->nFlags &= ~MEPF_REWRAP;
+ para->nHeight = wc.pt.y;
+ para->nRows = wc.nRow;
editor->total_rows += wc.nRow;
}
@@ -1068,7 +1064,7 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
assert(item->type == diParagraph);
prev_width = item->member.para.nWidth;
- ME_WrapTextParagraph(editor, &c, item);
+ ME_WrapTextParagraph( editor, &c, &item->member.para );
if (prev_width == totalWidth && item->member.para.nWidth < totalWidth)
totalWidth = get_total_width(editor);
else
--
2.23.0
1
0
Oct. 8, 2020
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/riched20/editor.h | 5 +++-
dlls/riched20/para.c | 9 ++----
dlls/riched20/run.c | 4 +--
dlls/riched20/wrap.c | 68 +++++++++++++++++++-----------------------
4 files changed, 39 insertions(+), 47 deletions(-)
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index c42d3bc5e7c..922a1e5c6c2 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -209,9 +209,12 @@ void para_num_init( ME_Context *c, ME_Paragraph *para ) DECLSPEC_HIDDEN;
void para_num_clear( struct para_num *pn ) DECLSPEC_HIDDEN;
int get_total_width(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void mark_para_rewrap(ME_TextEditor *editor, ME_DisplayItem *para) DECLSPEC_HIDDEN;
-ME_DisplayItem *get_di_from_para(ME_Paragraph *para) DECLSPEC_HIDDEN;
void add_marked_para(ME_TextEditor *editor, ME_DisplayItem *para) DECLSPEC_HIDDEN;
void remove_marked_para(ME_TextEditor *editor, ME_DisplayItem *para) DECLSPEC_HIDDEN;
+static inline ME_DisplayItem *para_get_di(ME_Paragraph *para)
+{
+ return (ME_DisplayItem *)((ptrdiff_t)para - offsetof(ME_DisplayItem, member));
+}
/* paint.c */
void ME_PaintContent(ME_TextEditor *editor, HDC hDC, const RECT *rcUpdate) DECLSPEC_HIDDEN;
diff --git a/dlls/riched20/para.c b/dlls/riched20/para.c
index bde0654b666..7cef6ca9932 100644
--- a/dlls/riched20/para.c
+++ b/dlls/riched20/para.c
@@ -29,11 +29,6 @@ void mark_para_rewrap(ME_TextEditor *editor, ME_DisplayItem *para)
add_marked_para(editor, para);
}
-ME_DisplayItem *get_di_from_para(ME_Paragraph *para)
-{
- return (ME_DisplayItem *)((ptrdiff_t)para - offsetof(ME_DisplayItem, member));
-}
-
static ME_DisplayItem *make_para(ME_TextEditor *editor)
{
ME_DisplayItem *item = ME_MakeDI(diParagraph);
@@ -454,7 +449,7 @@ static void para_num_clear_list( ME_TextEditor *editor, ME_Paragraph *para, cons
{
do
{
- mark_para_rewrap(editor, get_di_from_para(para));
+ mark_para_rewrap( editor, para_get_di( para ) );
para_num_clear( ¶->para_num );
if (para->next_para->type != diParagraph) break;
para = ¶->next_para->member.para;
@@ -529,7 +524,7 @@ static BOOL ME_SetParaFormat(ME_TextEditor *editor, ME_Paragraph *para, const PA
if (memcmp(©, ¶->fmt, sizeof(PARAFORMAT2)))
{
- mark_para_rewrap(editor, get_di_from_para(para));
+ mark_para_rewrap( editor, para_get_di( para ) );
if (((dwMask & PFM_NUMBERING) && (copy.wNumbering != para->fmt.wNumbering)) ||
((dwMask & PFM_NUMBERINGSTART) && (copy.wNumberingStart != para->fmt.wNumberingStart)) ||
((dwMask & PFM_NUMBERINGSTYLE) && (copy.wNumberingStyle != para->fmt.wNumberingStyle)))
diff --git a/dlls/riched20/run.c b/dlls/riched20/run.c
index 66925ca3434..f98288a94a2 100644
--- a/dlls/riched20/run.c
+++ b/dlls/riched20/run.c
@@ -367,7 +367,7 @@ ME_InsertRunAtCursor(ME_TextEditor *editor, ME_Cursor *cursor, ME_Style *style,
ME_InsertBefore( insert_before, pDI );
TRACE("Shift length:%d\n", len);
ME_PropagateCharOffset( insert_before, len );
- mark_para_rewrap(editor, get_di_from_para(insert_before->member.run.para));
+ mark_para_rewrap( editor, para_get_di( insert_before->member.run.para ) );
/* Move any cursors that were at the end of the previous run to the end of the inserted run */
prev = ME_FindItemBack( pDI, diRun );
@@ -787,7 +787,7 @@ void ME_SetCharFormat(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, C
ME_ReleaseStyle(para->para_num.style);
para->para_num.style = NULL;
}
- mark_para_rewrap(editor, get_di_from_para(para));
+ mark_para_rewrap( editor, para_get_di( para ) );
}
}
diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c
index cde46e2d7cf..c74931015a1 100644
--- a/dlls/riched20/wrap.c
+++ b/dlls/riched20/wrap.c
@@ -43,7 +43,7 @@ typedef struct tagME_WrapContext
int nRow;
POINT pt;
BOOL bOverflown, bWordWrap;
- ME_DisplayItem *pPara;
+ ME_Paragraph *para;
ME_Run *pRowStart;
ME_Run *pLastSplittableRun;
} ME_WrapContext;
@@ -131,8 +131,7 @@ static ME_Run *split_run_extents( ME_WrapContext *wc, ME_Run *run, int nVChar )
{
ME_TextEditor *editor = wc->context->editor;
ME_Run *run2;
- ME_Paragraph *para = &wc->pPara->member.para;
- ME_Cursor cursor = {wc->pPara, run_get_di( run ), nVChar};
+ ME_Cursor cursor = {para_get_di( wc->para ), run_get_di( run ), nVChar};
assert( run->nCharOfs != -1 );
ME_CheckCharOffsets(editor);
@@ -147,7 +146,7 @@ static ME_Run *split_run_extents( ME_WrapContext *wc, ME_Run *run, int nVChar )
shape_run( wc->context, run );
shape_run( wc->context, run2 );
- calc_run_extent(wc->context, para, wc->nRow ? wc->nLeftMargin : wc->nFirstMargin, run);
+ calc_run_extent(wc->context, wc->para, wc->nRow ? wc->nLeftMargin : wc->nFirstMargin, run);
run2->pt.x = run->pt.x + run->nWidth;
run2->pt.y = run->pt.y;
@@ -186,24 +185,23 @@ static ME_DisplayItem *ME_MakeRow(int height, int baseline, int width)
static void ME_BeginRow(ME_WrapContext *wc)
{
- PARAFORMAT2 *pFmt;
- ME_DisplayItem *para = wc->pPara;
-
- pFmt = ¶->member.para.fmt;
wc->pRowStart = NULL;
wc->bOverflown = FALSE;
wc->pLastSplittableRun = NULL;
wc->bWordWrap = wc->context->editor->bWordWrap;
- if (para->member.para.nFlags & (MEPF_ROWSTART|MEPF_ROWEND)) {
+ if (wc->para->nFlags & (MEPF_ROWSTART | MEPF_ROWEND))
+ {
wc->nAvailWidth = 0;
wc->bWordWrap = FALSE;
- if (para->member.para.nFlags & MEPF_ROWEND)
+ if (wc->para->nFlags & MEPF_ROWEND)
{
- ME_Cell *cell = &ME_FindItemBack(para, diCell)->member.cell;
+ ME_Cell *cell = &ME_FindItemBack( para_get_di( wc->para ), diCell)->member.cell;
cell->nWidth = 0;
}
- } else if (para->member.para.pCell) {
- ME_Cell *cell = ¶->member.para.pCell->member.cell;
+ }
+ else if (wc->para->pCell)
+ {
+ ME_Cell *cell = &wc->para->pCell->member.cell;
int width;
width = cell->nRightBoundary;
@@ -211,7 +209,7 @@ static void ME_BeginRow(ME_WrapContext *wc)
width -= cell->prev_cell->member.cell.nRightBoundary;
if (!cell->prev_cell)
{
- int rowIndent = ME_GetTableRowEnd(para)->member.para.fmt.dxStartIndent;
+ int rowIndent = ME_GetTableRowEnd( para_get_di( wc->para ) )->member.para.fmt.dxStartIndent;
width -= rowIndent;
}
cell->nWidth = max(ME_twips2pointsX(wc->context, width), 0);
@@ -225,7 +223,7 @@ static void ME_BeginRow(ME_WrapContext *wc)
}
wc->pt.x = wc->context->pt.x;
if (wc->context->editor->bEmulateVersion10 && /* v1.0 - 3.0 */
- pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE)
+ wc->para->fmt.dwMask & PFM_TABLE && wc->para->fmt.wEffects & PFE_TABLE)
/* Shift the text down because of the border. */
wc->pt.y++;
}
@@ -285,15 +283,14 @@ static void ME_InsertRowStart( ME_WrapContext *wc, ME_Run *last )
{
ME_Run *run;
ME_DisplayItem *row;
- ME_Paragraph *para = &wc->pPara->member.para;
BOOL bSkippingSpaces = TRUE;
int ascent = 0, descent = 0, width = 0, shift = 0, align = 0;
/* Include height of para numbering label */
- if (wc->nRow == 0 && para->fmt.wNumbering)
+ if (wc->nRow == 0 && wc->para->fmt.wNumbering)
{
- ascent = para->para_num.style->tm.tmAscent;
- descent = para->para_num.style->tm.tmDescent;
+ ascent = wc->para->para_num.style->tm.tmAscent;
+ descent = wc->para->para_num.style->tm.tmDescent;
}
for (run = last; run; run = run_prev( run ))
@@ -301,8 +298,8 @@ static void ME_InsertRowStart( ME_WrapContext *wc, ME_Run *last )
/* ENDPARA run shouldn't affect row height, except if it's the only run in the paragraph */
if (run == wc->pRowStart || !(run->nFlags & MERF_ENDPARA))
{
- if (run->nAscent>ascent) ascent = run->nAscent;
- if (run->nDescent>descent) descent = run->nDescent;
+ if (run->nAscent > ascent) ascent = run->nAscent;
+ if (run->nDescent > descent) descent = run->nDescent;
if (bSkippingSpaces)
{
/* Exclude space characters from run width.
@@ -328,10 +325,10 @@ static void ME_InsertRowStart( ME_WrapContext *wc, ME_Run *last )
if (run == wc->pRowStart) break;
}
- para->nWidth = max(para->nWidth, width);
+ wc->para->nWidth = max( wc->para->nWidth, width );
row = ME_MakeRow( ascent + descent, ascent, width );
if (wc->context->editor->bEmulateVersion10 && /* v1.0 - 3.0 */
- (para->fmt.dwMask & PFM_TABLE) && (para->fmt.wEffects & PFE_TABLE))
+ (wc->para->fmt.dwMask & PFM_TABLE) && (wc->para->fmt.wEffects & PFE_TABLE))
{
/* The text was shifted down in ME_BeginRow so move the wrap context
* back to where it should be. */
@@ -342,12 +339,12 @@ static void ME_InsertRowStart( ME_WrapContext *wc, ME_Run *last )
row->member.row.pt = wc->pt;
row->member.row.nLMargin = (!wc->nRow ? wc->nFirstMargin : wc->nLeftMargin);
row->member.row.nRMargin = wc->nRightMargin;
- assert(para->fmt.dwMask & PFM_ALIGNMENT);
- align = para->fmt.wAlignment;
+ assert(wc->para->fmt.dwMask & PFM_ALIGNMENT);
+ align = wc->para->fmt.wAlignment;
if (align == PFA_CENTER) shift = max((wc->nAvailWidth-width)/2, 0);
if (align == PFA_RIGHT) shift = max(wc->nAvailWidth-width, 0);
- if (para->nFlags & MEPF_COMPLEX) layout_row( wc->pRowStart, last );
+ if (wc->para->nFlags & MEPF_COMPLEX) layout_row( wc->pRowStart, last );
row->member.row.pt.x = row->member.row.nLMargin + shift;
@@ -357,10 +354,10 @@ static void ME_InsertRowStart( ME_WrapContext *wc, ME_Run *last )
if (run == last) break;
}
- if (wc->nRow == 0 && para->fmt.wNumbering)
+ if (wc->nRow == 0 && wc->para->fmt.wNumbering)
{
- para->para_num.pt.x = wc->nParaNumOffset + shift;
- para->para_num.pt.y = wc->pt.y + row->member.row.nBaseline;
+ wc->para->para_num.pt.x = wc->nParaNumOffset + shift;
+ wc->para->para_num.pt.y = wc->pt.y + row->member.row.nBaseline;
}
ME_InsertBefore( run_get_di( wc->pRowStart ), row );
@@ -371,13 +368,10 @@ static void ME_InsertRowStart( ME_WrapContext *wc, ME_Run *last )
static void ME_WrapEndParagraph( ME_WrapContext *wc )
{
- ME_DisplayItem *para = wc->pPara;
- PARAFORMAT2 *pFmt = ¶->member.para.fmt;
-
- if (wc->pRowStart) ME_InsertRowStart( wc, para->member.para.eop_run );
+ if (wc->pRowStart) ME_InsertRowStart( wc, wc->para->eop_run );
if (wc->context->editor->bEmulateVersion10 && /* v1.0 - 3.0 */
- pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE)
+ wc->para->fmt.dwMask & PFM_TABLE && wc->para->fmt.wEffects & PFE_TABLE)
{
/* ME_BeginRow was called an extra time for the paragraph, and it shifts the
* text down by one pixel for the border, so fix up the wrap context. */
@@ -391,7 +385,7 @@ static void ME_WrapSizeRun( ME_WrapContext *wc, ME_Run *run )
ME_UpdateRunFlags( wc->context->editor, run );
- calc_run_extent( wc->context, &wc->pPara->member.para,
+ calc_run_extent( wc->context, wc->para,
wc->nRow ? wc->nLeftMargin : wc->nFirstMargin, run );
}
@@ -576,7 +570,7 @@ static ME_Run *ME_WrapHandleRun( ME_WrapContext *wc, ME_Run *run )
ME_Run *new_run;
wc->bOverflown = FALSE;
new_run = split_run_extents( wc, run, black );
- calc_run_extent( wc->context, &wc->pPara->member.para,
+ calc_run_extent( wc->context, wc->para,
wc->nRow ? wc->nLeftMargin : wc->nFirstMargin, run );
ME_InsertRowStart( wc, run );
return new_run;
@@ -859,7 +853,7 @@ static void ME_WrapTextParagraph( ME_TextEditor *editor, ME_Context *c, ME_Displ
pFmt = &tp->member.para.fmt;
wc.context = c;
- wc.pPara = tp;
+ wc.para = &tp->member.para;
/* wc.para_style = tp->member.para.style; */
wc.style = NULL;
wc.nParaNumOffset = 0;
--
2.23.0
1
0
[PATCH 1/5] riched20: Move several of the wrapping functions to use ME_Run directly.
by Huw Davies Oct. 8, 2020
by Huw Davies Oct. 8, 2020
Oct. 8, 2020
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/riched20/editor.h | 6 +
dlls/riched20/run.c | 20 ++
dlls/riched20/wrap.c | 441 +++++++++++++++++++----------------------
3 files changed, 231 insertions(+), 236 deletions(-)
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index 02bff7ccebf..c42d3bc5e7c 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -76,6 +76,8 @@ ME_DisplayItem *ME_MakeDI(ME_DIType type) DECLSPEC_HIDDEN;
void ME_DestroyDisplayItem(ME_DisplayItem *item) DECLSPEC_HIDDEN;
void ME_DumpDocument(ME_TextBuffer *buffer) DECLSPEC_HIDDEN;
void destroy_para(ME_TextEditor *editor, ME_DisplayItem *item) DECLSPEC_HIDDEN;
+ME_Run *run_prev( ME_Run *run ) DECLSPEC_HIDDEN;
+ME_Run *run_next( ME_Run *run ) DECLSPEC_HIDDEN;
/* string.c */
ME_String *ME_MakeStringN(LPCWSTR szText, int nMaxChars) DECLSPEC_HIDDEN;
@@ -145,6 +147,10 @@ void ME_GetCharFormat(ME_TextEditor *editor, const ME_Cursor *from,
void ME_GetSelectionCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN;
void ME_GetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN;
void ME_SetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *mod) DECLSPEC_HIDDEN;
+static inline ME_DisplayItem *run_get_di( ME_Run *run )
+{
+ return (ME_DisplayItem *)((ptrdiff_t)run - offsetof(ME_DisplayItem, member));
+}
/* caret.c */
void ME_SetCursorToStart(ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN;
diff --git a/dlls/riched20/run.c b/dlls/riched20/run.c
index b5408320ca8..66925ca3434 100644
--- a/dlls/riched20/run.c
+++ b/dlls/riched20/run.c
@@ -27,6 +27,26 @@ WINE_DEFAULT_DEBUG_CHANNEL(richedit);
WINE_DECLARE_DEBUG_CHANNEL(richedit_check);
WINE_DECLARE_DEBUG_CHANNEL(richedit_lists);
+ME_Run *run_next( ME_Run *run )
+{
+ ME_DisplayItem *item = run_get_di( run );
+
+ if (ME_NextRun( NULL, &item, FALSE ))
+ return &item->member.run;
+
+ return NULL;
+}
+
+ME_Run *run_prev( ME_Run *run )
+{
+ ME_DisplayItem *item = run_get_di( run );
+
+ if (ME_PrevRun( NULL, &item, FALSE ))
+ return &item->member.run;
+
+ return NULL;
+}
+
/******************************************************************************
* ME_CanJoinRuns
*
diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c
index 499ba934a06..cde46e2d7cf 100644
--- a/dlls/riched20/wrap.c
+++ b/dlls/riched20/wrap.c
@@ -44,9 +44,8 @@ typedef struct tagME_WrapContext
POINT pt;
BOOL bOverflown, bWordWrap;
ME_DisplayItem *pPara;
- ME_DisplayItem *pRowStart;
-
- ME_DisplayItem *pLastSplittableRun;
+ ME_Run *pRowStart;
+ ME_Run *pLastSplittableRun;
} ME_WrapContext;
static BOOL get_run_glyph_buffers( ME_Run *run )
@@ -128,18 +127,16 @@ static void calc_run_extent(ME_Context *c, const ME_Paragraph *para, int startx,
* Splits a run into two in a given place. It also updates the screen position
* and size (extent) of the newly generated runs.
*/
-static ME_DisplayItem *split_run_extents(ME_WrapContext *wc, ME_DisplayItem *item, int nVChar)
+static ME_Run *split_run_extents( ME_WrapContext *wc, ME_Run *run, int nVChar )
{
ME_TextEditor *editor = wc->context->editor;
- ME_Run *run, *run2;
+ ME_Run *run2;
ME_Paragraph *para = &wc->pPara->member.para;
- ME_Cursor cursor = {wc->pPara, item, nVChar};
+ ME_Cursor cursor = {wc->pPara, run_get_di( run ), nVChar};
- assert(item->member.run.nCharOfs != -1);
+ assert( run->nCharOfs != -1 );
ME_CheckCharOffsets(editor);
- run = &item->member.run;
-
TRACE("Before split: %s(%d, %d)\n", debugstr_run( run ),
run->pt.x, run->pt.y);
@@ -152,7 +149,7 @@ static ME_DisplayItem *split_run_extents(ME_WrapContext *wc, ME_DisplayItem *ite
shape_run( wc->context, run2 );
calc_run_extent(wc->context, para, wc->nRow ? wc->nLeftMargin : wc->nFirstMargin, run);
- run2->pt.x = run->pt.x+run->nWidth;
+ run2->pt.x = run->pt.x + run->nWidth;
run2->pt.y = run->pt.y;
ME_CheckCharOffsets(editor);
@@ -161,7 +158,7 @@ static ME_DisplayItem *split_run_extents(ME_WrapContext *wc, ME_DisplayItem *ite
debugstr_run( run ), run->pt.x, run->pt.y,
debugstr_run( run2 ), run2->pt.x, run2->pt.y);
- return cursor.pRun;
+ return &cursor.pRun->member.run;
}
/******************************************************************************
@@ -233,22 +230,20 @@ static void ME_BeginRow(ME_WrapContext *wc)
wc->pt.y++;
}
-static void layout_row( ME_DisplayItem *start, const ME_DisplayItem *end )
+static void layout_row( ME_Run *start, ME_Run *last )
{
- ME_DisplayItem *p;
+ ME_Run *run;
int i, num_runs = 0;
int buf[16 * 5]; /* 5 arrays - 4 of int & 1 of BYTE, alloc space for 5 of ints */
int *vis_to_log = buf, *log_to_vis, *widths, *pos;
BYTE *levels;
BOOL found_black = FALSE;
- for (p = end->prev; p != start->prev; p = p->prev)
+ for (run = last; run; run = run_prev( run ))
{
- if (p->type == diRun)
- {
- if (!found_black) found_black = !(p->member.run.nFlags & (MERF_WHITESPACE | MERF_ENDPARA));
- if (found_black) num_runs++;
- }
+ if (!found_black) found_black = !(run->nFlags & (MERF_WHITESPACE | MERF_ENDPARA));
+ if (found_black) num_runs++;
+ if (run == start) break;
}
TRACE("%d runs\n", num_runs);
@@ -262,131 +257,125 @@ static void layout_row( ME_DisplayItem *start, const ME_DisplayItem *end )
pos = vis_to_log + 3 * num_runs;
levels = (BYTE*)(vis_to_log + 4 * num_runs);
- for (i = 0, p = start; i < num_runs; p = p->next)
+ for (i = 0, run = start; i < num_runs; run = run_next( run ))
{
- if (p->type == diRun)
- {
- levels[i] = p->member.run.script_analysis.s.uBidiLevel;
- widths[i] = p->member.run.nWidth;
- TRACE( "%d: level %d width %d\n", i, levels[i], widths[i] );
- i++;
- }
+ levels[i] = run->script_analysis.s.uBidiLevel;
+ widths[i] = run->nWidth;
+ TRACE( "%d: level %d width %d\n", i, levels[i], widths[i] );
+ i++;
}
ScriptLayout( num_runs, levels, vis_to_log, log_to_vis );
- pos[0] = start->member.run.para->pt.x;
+ pos[0] = run->para->pt.x;
for (i = 1; i < num_runs; i++)
pos[i] = pos[i - 1] + widths[ vis_to_log[ i - 1 ] ];
- for (i = 0, p = start; i < num_runs; p = p->next)
+ for (i = 0, run = start; i < num_runs; run = run_next( run ))
{
- if (p->type == diRun)
- {
- p->member.run.pt.x = pos[ log_to_vis[ i ] ];
- TRACE( "%d: x = %d\n", i, p->member.run.pt.x );
- i++;
- }
+ run->pt.x = pos[ log_to_vis[ i ] ];
+ TRACE( "%d: x = %d\n", i, run->pt.x );
+ i++;
}
if (vis_to_log != buf) heap_free( vis_to_log );
}
-static void ME_InsertRowStart(ME_WrapContext *wc, const ME_DisplayItem *pEnd)
+static void ME_InsertRowStart( ME_WrapContext *wc, ME_Run *last )
{
- ME_DisplayItem *p, *row;
- ME_Paragraph *para = &wc->pPara->member.para;
- BOOL bSkippingSpaces = TRUE;
- int ascent = 0, descent = 0, width=0, shift = 0, align = 0;
+ ME_Run *run;
+ ME_DisplayItem *row;
+ ME_Paragraph *para = &wc->pPara->member.para;
+ BOOL bSkippingSpaces = TRUE;
+ int ascent = 0, descent = 0, width = 0, shift = 0, align = 0;
- /* Include height of para numbering label */
- if (wc->nRow == 0 && para->fmt.wNumbering)
- {
- ascent = para->para_num.style->tm.tmAscent;
- descent = para->para_num.style->tm.tmDescent;
- }
+ /* Include height of para numbering label */
+ if (wc->nRow == 0 && para->fmt.wNumbering)
+ {
+ ascent = para->para_num.style->tm.tmAscent;
+ descent = para->para_num.style->tm.tmDescent;
+ }
- for (p = pEnd->prev; p!=wc->pRowStart->prev; p = p->prev)
- {
- /* ENDPARA run shouldn't affect row height, except if it's the only run in the paragraph */
- if (p->type==diRun && ((p==wc->pRowStart) || !(p->member.run.nFlags & MERF_ENDPARA))) { /* FIXME add more run types */
- if (p->member.run.nAscent>ascent)
- ascent = p->member.run.nAscent;
- if (p->member.run.nDescent>descent)
- descent = p->member.run.nDescent;
- if (bSkippingSpaces)
+ for (run = last; run; run = run_prev( run ))
+ {
+ /* ENDPARA run shouldn't affect row height, except if it's the only run in the paragraph */
+ if (run == wc->pRowStart || !(run->nFlags & MERF_ENDPARA))
{
- /* Exclude space characters from run width.
- * Other whitespace or delimiters are not treated this way. */
- int len = p->member.run.len;
- WCHAR *text = get_text( &p->member.run, len - 1 );
-
- assert (len);
- if (~p->member.run.nFlags & MERF_GRAPHICS)
- while (len && *(text--) == ' ')
- len--;
- if (len)
- {
- if (len == p->member.run.len)
- width += p->member.run.nWidth;
- else
- width += ME_PointFromCharContext( wc->context, &p->member.run, len, FALSE );
- }
- bSkippingSpaces = !len;
- } else if (!(p->member.run.nFlags & MERF_ENDPARA))
- width += p->member.run.nWidth;
- }
- }
+ if (run->nAscent>ascent) ascent = run->nAscent;
+ if (run->nDescent>descent) descent = run->nDescent;
+ if (bSkippingSpaces)
+ {
+ /* Exclude space characters from run width.
+ * Other whitespace or delimiters are not treated this way. */
+ int len = run->len;
+ WCHAR *text = get_text( run, len - 1 );
+
+ assert(len);
+ if (~run->nFlags & MERF_GRAPHICS)
+ while (len && *(text--) == ' ') len--;
+ if (len)
+ {
+ if (len == run->len)
+ width += run->nWidth;
+ else
+ width += ME_PointFromCharContext( wc->context, run, len, FALSE );
+ }
+ bSkippingSpaces = !len;
+ }
+ else if (!(run->nFlags & MERF_ENDPARA))
+ width += run->nWidth;
+ }
+ if (run == wc->pRowStart) break;
+ }
- para->nWidth = max(para->nWidth, width);
- row = ME_MakeRow(ascent+descent, ascent, width);
- if (wc->context->editor->bEmulateVersion10 && /* v1.0 - 3.0 */
- (para->fmt.dwMask & PFM_TABLE) && (para->fmt.wEffects & PFE_TABLE))
- {
- /* The text was shifted down in ME_BeginRow so move the wrap context
- * back to where it should be. */
- wc->pt.y--;
- /* The height of the row is increased by the borders. */
- row->member.row.nHeight += 2;
- }
- row->member.row.pt = wc->pt;
- row->member.row.nLMargin = (!wc->nRow ? wc->nFirstMargin : wc->nLeftMargin);
- row->member.row.nRMargin = wc->nRightMargin;
- assert(para->fmt.dwMask & PFM_ALIGNMENT);
- align = para->fmt.wAlignment;
- if (align == PFA_CENTER)
- shift = max((wc->nAvailWidth-width)/2, 0);
- if (align == PFA_RIGHT)
- shift = max(wc->nAvailWidth-width, 0);
-
- if (para->nFlags & MEPF_COMPLEX) layout_row( wc->pRowStart, pEnd );
-
- row->member.row.pt.x = row->member.row.nLMargin + shift;
- for (p = wc->pRowStart; p!=pEnd; p = p->next)
- {
- if (p->type==diRun) { /* FIXME add more run types */
- p->member.run.pt.x += row->member.row.nLMargin+shift;
+ para->nWidth = max(para->nWidth, width);
+ row = ME_MakeRow( ascent + descent, ascent, width );
+ if (wc->context->editor->bEmulateVersion10 && /* v1.0 - 3.0 */
+ (para->fmt.dwMask & PFM_TABLE) && (para->fmt.wEffects & PFE_TABLE))
+ {
+ /* The text was shifted down in ME_BeginRow so move the wrap context
+ * back to where it should be. */
+ wc->pt.y--;
+ /* The height of the row is increased by the borders. */
+ row->member.row.nHeight += 2;
}
- }
+ row->member.row.pt = wc->pt;
+ row->member.row.nLMargin = (!wc->nRow ? wc->nFirstMargin : wc->nLeftMargin);
+ row->member.row.nRMargin = wc->nRightMargin;
+ assert(para->fmt.dwMask & PFM_ALIGNMENT);
+ align = para->fmt.wAlignment;
+ if (align == PFA_CENTER) shift = max((wc->nAvailWidth-width)/2, 0);
+ if (align == PFA_RIGHT) shift = max(wc->nAvailWidth-width, 0);
- if (wc->nRow == 0 && para->fmt.wNumbering)
- {
- para->para_num.pt.x = wc->nParaNumOffset + shift;
- para->para_num.pt.y = wc->pt.y + row->member.row.nBaseline;
- }
+ if (para->nFlags & MEPF_COMPLEX) layout_row( wc->pRowStart, last );
+
+ row->member.row.pt.x = row->member.row.nLMargin + shift;
+
+ for (run = wc->pRowStart; run; run = run_next( run ))
+ {
+ run->pt.x += row->member.row.nLMargin+shift;
+ if (run == last) break;
+ }
+
+ if (wc->nRow == 0 && para->fmt.wNumbering)
+ {
+ para->para_num.pt.x = wc->nParaNumOffset + shift;
+ para->para_num.pt.y = wc->pt.y + row->member.row.nBaseline;
+ }
- ME_InsertBefore(wc->pRowStart, row);
- wc->nRow++;
- wc->pt.y += row->member.row.nHeight;
- ME_BeginRow(wc);
+ ME_InsertBefore( run_get_di( wc->pRowStart ), row );
+ wc->nRow++;
+ wc->pt.y += row->member.row.nHeight;
+ ME_BeginRow( wc );
}
-static void ME_WrapEndParagraph(ME_WrapContext *wc, ME_DisplayItem *p)
+static void ME_WrapEndParagraph( ME_WrapContext *wc )
{
ME_DisplayItem *para = wc->pPara;
PARAFORMAT2 *pFmt = ¶->member.para.fmt;
- if (wc->pRowStart)
- ME_InsertRowStart(wc, p);
+
+ if (wc->pRowStart) ME_InsertRowStart( wc, para->member.para.eop_run );
+
if (wc->context->editor->bEmulateVersion10 && /* v1.0 - 3.0 */
pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE)
{
@@ -394,30 +383,16 @@ static void ME_WrapEndParagraph(ME_WrapContext *wc, ME_DisplayItem *p)
* text down by one pixel for the border, so fix up the wrap context. */
wc->pt.y--;
}
-
- /*
- p = para->next;
- while(p) {
- if (p->type == diParagraph || p->type == diTextEnd)
- return;
- if (p->type == diRun)
- {
- ME_Run *run = &p->member.run;
- TRACE("%s - (%d, %d)\n", debugstr_run(run), run->pt.x, run->pt.y);
- }
- p = p->next;
- }
- */
}
-static void ME_WrapSizeRun(ME_WrapContext *wc, ME_DisplayItem *p)
+static void ME_WrapSizeRun( ME_WrapContext *wc, ME_Run *run )
{
/* FIXME compose style (out of character and paragraph styles) here */
- ME_UpdateRunFlags(wc->context->editor, &p->member.run);
+ ME_UpdateRunFlags( wc->context->editor, run );
- calc_run_extent(wc->context, &wc->pPara->member.para,
- wc->nRow ? wc->nLeftMargin : wc->nFirstMargin, &p->member.run);
+ calc_run_extent( wc->context, &wc->pPara->member.para,
+ wc->nRow ? wc->nLeftMargin : wc->nFirstMargin, run );
}
@@ -453,173 +428,169 @@ static int reverse_find_whitespace(const WCHAR *s, int start)
return i;
}
-static ME_DisplayItem *ME_MaximizeSplit(ME_WrapContext *wc, ME_DisplayItem *p, int i)
+static ME_Run *ME_MaximizeSplit( ME_WrapContext *wc, ME_Run *run, int i )
{
- ME_DisplayItem *pp, *piter = p;
+ ME_Run *new_run, *iter = run;
int j;
if (!i)
return NULL;
- j = reverse_find_non_whitespace( get_text( &p->member.run, 0 ), i);
- if (j>0) {
- pp = split_run_extents(wc, piter, j);
- wc->pt.x += piter->member.run.nWidth;
- return pp;
+ j = reverse_find_non_whitespace( get_text( run, 0 ), i );
+ if (j > 0)
+ {
+ new_run = split_run_extents( wc, iter, j );
+ wc->pt.x += iter->nWidth;
+ return new_run;
}
else
{
- pp = piter;
+ new_run = iter;
/* omit all spaces before split point */
- while(piter != wc->pRowStart)
+ while (iter != wc->pRowStart)
{
- piter = ME_FindItemBack(piter, diRun);
- if (piter->member.run.nFlags & MERF_WHITESPACE)
+ iter = run_prev( iter );
+ if (iter->nFlags & MERF_WHITESPACE)
{
- pp = piter;
+ new_run = iter;
continue;
}
- if (piter->member.run.nFlags & MERF_ENDWHITE)
+ if (iter->nFlags & MERF_ENDWHITE)
{
- i = reverse_find_non_whitespace( get_text( &piter->member.run, 0 ),
- piter->member.run.len );
- pp = split_run_extents(wc, piter, i);
- wc->pt = pp->member.run.pt;
- return pp;
+ i = reverse_find_non_whitespace( get_text( iter, 0 ), iter->len );
+ new_run = split_run_extents( wc, iter, i );
+ wc->pt = new_run->pt;
+ return new_run;
}
/* this run is the end of spaces, so the run edge is a good point to split */
- wc->pt = pp->member.run.pt;
+ wc->pt = new_run->pt;
wc->bOverflown = TRUE;
- TRACE("Split point is: %s|%s\n", debugstr_run( &piter->member.run ), debugstr_run( &pp->member.run ));
- return pp;
+ TRACE( "Split point is: %s|%s\n", debugstr_run( iter ), debugstr_run( new_run ) );
+ return new_run;
}
- wc->pt = piter->member.run.pt;
- return piter;
+ wc->pt = iter->pt;
+ return iter;
}
}
-static ME_DisplayItem *ME_SplitByBacktracking(ME_WrapContext *wc, ME_DisplayItem *p, int loc)
+static ME_Run *ME_SplitByBacktracking( ME_WrapContext *wc, ME_Run *run, int loc )
{
- ME_DisplayItem *new_run;
+ ME_Run *new_run;
int i, idesp, len;
- ME_Run *run = &p->member.run;
idesp = i = find_split_point( wc->context, loc, run );
len = run->len;
- assert(len>0);
- assert(i<len);
- if (i) {
+ assert( len > 0 );
+ assert( i < len );
+ if (i)
+ {
/* don't split words */
i = reverse_find_whitespace( get_text( run, 0 ), i );
- new_run = ME_MaximizeSplit(wc, p, i);
+ new_run = ME_MaximizeSplit(wc, run, i);
if (new_run) return new_run;
}
- TRACE("Must backtrack to split at: %s\n", debugstr_run( &p->member.run ));
+ TRACE("Must backtrack to split at: %s\n", debugstr_run( run ));
if (wc->pLastSplittableRun)
{
- if (wc->pLastSplittableRun->member.run.nFlags & (MERF_GRAPHICS|MERF_TAB))
+ if (wc->pLastSplittableRun->nFlags & (MERF_GRAPHICS|MERF_TAB))
{
- wc->pt = wc->pLastSplittableRun->member.run.pt;
+ wc->pt = wc->pLastSplittableRun->pt;
return wc->pLastSplittableRun;
}
- else if (wc->pLastSplittableRun->member.run.nFlags & MERF_SPLITTABLE)
+ else if (wc->pLastSplittableRun->nFlags & MERF_SPLITTABLE)
{
/* the following two lines are just to check if we forgot to call UpdateRunFlags earlier,
they serve no other purpose */
ME_UpdateRunFlags(wc->context->editor, run);
- assert((wc->pLastSplittableRun->member.run.nFlags & MERF_SPLITTABLE));
+ assert((wc->pLastSplittableRun->nFlags & MERF_SPLITTABLE));
- p = wc->pLastSplittableRun;
- run = &p->member.run;
+ run = wc->pLastSplittableRun;
len = run->len;
/* don't split words */
i = reverse_find_whitespace( get_text( run, 0 ), len );
if (i == len)
i = reverse_find_non_whitespace( get_text( run, 0 ), len );
- new_run = split_run_extents(wc, p, i);
- wc->pt = new_run->member.run.pt;
+ new_run = split_run_extents(wc, run, i);
+ wc->pt = new_run->pt;
return new_run;
}
else
{
/* restart from the first run beginning with spaces */
- wc->pt = wc->pLastSplittableRun->member.run.pt;
+ wc->pt = wc->pLastSplittableRun->pt;
return wc->pLastSplittableRun;
}
}
- TRACE("Backtracking failed, trying desperate: %s\n", debugstr_run( &p->member.run ));
+ TRACE("Backtracking failed, trying desperate: %s\n", debugstr_run( run ));
/* OK, no better idea, so assume we MAY split words if we can split at all*/
if (idesp)
- return split_run_extents(wc, p, idesp);
+ return split_run_extents(wc, run, idesp);
else
- if (wc->pRowStart && p != wc->pRowStart)
+ if (wc->pRowStart && run != wc->pRowStart)
{
/* don't need to break current run, because it's possible to split
before this run */
wc->bOverflown = TRUE;
- return p;
+ return run;
}
else
{
/* split point inside first character - no choice but split after that char */
- if (len != 1) {
+ if (len != 1)
/* the run is more than 1 char, so we may split */
- return split_run_extents(wc, p, 1);
- }
+ return split_run_extents( wc, run, 1 );
+
/* the run is one char, can't split it */
- return p;
+ return run;
}
}
-static ME_DisplayItem *ME_WrapHandleRun(ME_WrapContext *wc, ME_DisplayItem *p)
+static ME_Run *ME_WrapHandleRun( ME_WrapContext *wc, ME_Run *run )
{
- ME_DisplayItem *pp;
- ME_Run *run;
+ ME_Run *new_run;
int len;
- assert(p->type == diRun);
- if (!wc->pRowStart)
- wc->pRowStart = p;
- run = &p->member.run;
+ if (!wc->pRowStart) wc->pRowStart = run;
run->pt.x = wc->pt.x;
run->pt.y = wc->pt.y;
- ME_WrapSizeRun(wc, p);
+ ME_WrapSizeRun( wc, run );
len = run->len;
if (wc->bOverflown) /* just skipping final whitespaces */
{
/* End paragraph run can't overflow to the next line by itself. */
- if (run->nFlags & MERF_ENDPARA)
- return p->next;
+ if (run->nFlags & MERF_ENDPARA) return run_next( run );
- if (run->nFlags & MERF_WHITESPACE) {
+ if (run->nFlags & MERF_WHITESPACE)
+ {
wc->pt.x += run->nWidth;
/* skip runs consisting of only whitespaces */
- return p->next;
+ return run_next( run );
}
- if (run->nFlags & MERF_STARTWHITE) {
+ if (run->nFlags & MERF_STARTWHITE)
+ {
/* try to split the run at the first non-white char */
int black;
black = find_non_whitespace( get_text( run, 0 ), run->len, 0 );
- if (black) {
+ if (black)
+ {
+ ME_Run *new_run;
wc->bOverflown = FALSE;
- pp = split_run_extents(wc, p, black);
- calc_run_extent(wc->context, &wc->pPara->member.para,
- wc->nRow ? wc->nLeftMargin : wc->nFirstMargin,
- &pp->member.run);
- ME_InsertRowStart(wc, pp);
- return pp;
+ new_run = split_run_extents( wc, run, black );
+ calc_run_extent( wc->context, &wc->pPara->member.para,
+ wc->nRow ? wc->nLeftMargin : wc->nFirstMargin, run );
+ ME_InsertRowStart( wc, run );
+ return new_run;
}
}
/* black run: the row goes from pRowStart to the previous run */
- ME_InsertRowStart(wc, p);
- return p;
+ ME_InsertRowStart( wc, run_prev( run ) );
+ return run;
}
/* simply end the current row and move on to next one */
if (run->nFlags & MERF_ENDROW)
{
- p = p->next;
- ME_InsertRowStart(wc, p);
- return p;
+ ME_InsertRowStart( wc, run );
+ return run_next( run );
}
/* will current run fit? */
@@ -631,35 +602,35 @@ static ME_DisplayItem *ME_WrapHandleRun(ME_WrapContext *wc, ME_DisplayItem *p)
if (run->nFlags & (MERF_WHITESPACE | MERF_ENDPARA)) {
/* let the overflow logic handle it */
wc->bOverflown = TRUE;
- return p;
+ return run;
}
/* TAB: we can split before */
if (run->nFlags & MERF_TAB) {
wc->bOverflown = TRUE;
- if (wc->pRowStart == p)
+ if (wc->pRowStart == run)
/* Don't split before the start of the run, or we will get an
* endless loop. */
- return p->next;
+ return run_next( run );
else
- return p;
+ return run;
}
/* graphics: we can split before, if run's width is smaller than row's width */
if ((run->nFlags & MERF_GRAPHICS) && run->nWidth <= wc->nAvailWidth) {
wc->bOverflown = TRUE;
- return p;
+ return run;
}
/* can we separate out the last spaces ? (to use overflow logic later) */
if (run->nFlags & MERF_ENDWHITE)
{
/* we aren't sure if it's *really* necessary, it's a good start however */
int black = reverse_find_non_whitespace( get_text( run, 0 ), len );
- split_run_extents(wc, p, black);
+ split_run_extents( wc, run, black );
/* handle both parts again */
- return p;
+ return run;
}
/* determine the split point by backtracking */
- pp = ME_SplitByBacktracking(wc, p, loc);
- if (pp == wc->pRowStart)
+ new_run = ME_SplitByBacktracking( wc, run, loc );
+ if (new_run == wc->pRowStart)
{
if (run->nFlags & MERF_STARTWHITE)
{
@@ -671,32 +642,32 @@ static ME_DisplayItem *ME_WrapHandleRun(ME_WrapContext *wc, ME_DisplayItem *p)
/* The lines will only contain spaces, and the rest of the run will
* overflow onto the next line. */
wc->bOverflown = TRUE;
- return p;
+ return run;
}
/* Couldn't split the first run, possible because we have a large font
* with a single character that caused an overflow.
*/
wc->pt.x += run->nWidth;
- return p->next;
+ return run_next( run );
}
- if (p != pp) /* found a suitable split point */
+ if (run != new_run) /* found a suitable split point */
{
wc->bOverflown = TRUE;
- return pp;
+ return new_run;
}
/* we detected that it's best to split on start of this run */
if (wc->bOverflown)
- return pp;
+ return new_run;
ERR("failure!\n");
/* not found anything - writing over margins is the only option left */
}
if ((run->nFlags & (MERF_SPLITTABLE | MERF_STARTWHITE))
- || ((run->nFlags & (MERF_GRAPHICS|MERF_TAB)) && (p != wc->pRowStart)))
+ || ((run->nFlags & (MERF_GRAPHICS|MERF_TAB)) && (run != wc->pRowStart)))
{
- wc->pLastSplittableRun = p;
+ wc->pLastSplittableRun = run;
}
wc->pt.x += run->nWidth;
- return p->next;
+ return run_next( run );
}
static int ME_GetParaLineSpace(ME_Context* c, ME_Paragraph* para)
@@ -860,8 +831,9 @@ static HRESULT shape_para( ME_Context *c, ME_DisplayItem *p )
return hr;
}
-static void ME_WrapTextParagraph(ME_TextEditor *editor, ME_Context *c, ME_DisplayItem *tp) {
- ME_DisplayItem *p;
+static void ME_WrapTextParagraph( ME_TextEditor *editor, ME_Context *c, ME_DisplayItem *tp )
+{
+ ME_Run *run;
ME_WrapContext wc;
int border = 0;
int linespace = 0;
@@ -940,16 +912,13 @@ static void ME_WrapTextParagraph(ME_TextEditor *editor, ME_Context *c, ME_Displa
linespace = ME_GetParaLineSpace(c, &tp->member.para);
ME_BeginRow(&wc);
- for (p = tp->next; p!=tp->member.para.next_para; ) {
- assert(p->type != diStartRow);
- if (p->type == diRun) {
- p = ME_WrapHandleRun(&wc, p);
- }
- else p = p->next;
- if (wc.nRow && p == wc.pRowStart)
- wc.pt.y += linespace;
+ run = &ME_FindItemFwd( tp, diRun )->member.run;
+ while (run)
+ {
+ run = ME_WrapHandleRun( &wc, run );
+ if (wc.nRow && run == wc.pRowStart) wc.pt.y += linespace;
}
- ME_WrapEndParagraph(&wc, p);
+ ME_WrapEndParagraph( &wc );
if (!(pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE) &&
(pFmt->dwMask & PFM_BORDER) && (pFmt->wBorders & 8))
wc.pt.y += border;
--
2.23.0
1
0
Oct. 8, 2020
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/msado15/connection.c | 18 ++++++++++++++----
dlls/msado15/tests/msado15.c | 17 +++++++++++++++++
2 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/dlls/msado15/connection.c b/dlls/msado15/connection.c
index 8d69e019852..eb116fc30ed 100644
--- a/dlls/msado15/connection.c
+++ b/dlls/msado15/connection.c
@@ -54,6 +54,7 @@ struct connection
LONG timeout;
WCHAR *datasource;
WCHAR *provider;
+ ConnectModeEnum mode;
struct connection_point cp_connev;
};
@@ -336,14 +337,22 @@ static HRESULT WINAPI connection_put_CursorLocation( _Connection *iface, CursorL
static HRESULT WINAPI connection_get_Mode( _Connection *iface, ConnectModeEnum *mode )
{
- FIXME( "%p, %p\n", iface, mode );
- return E_NOTIMPL;
+ struct connection *connection = impl_from_Connection( iface );
+
+ TRACE( "%p, %p\n", iface, mode );
+
+ *mode = connection->mode;
+ return S_OK;
}
static HRESULT WINAPI connection_put_Mode( _Connection *iface, ConnectModeEnum mode )
{
- FIXME( "%p, %u\n", iface, mode );
- return E_NOTIMPL;
+ struct connection *connection = impl_from_Connection( iface );
+
+ TRACE( "%p, %u\n", iface, mode );
+
+ connection->mode = mode;
+ return S_OK;
}
static HRESULT WINAPI connection_get_Provider( _Connection *iface, BSTR *str )
@@ -665,6 +674,7 @@ HRESULT Connection_create( void **obj )
connection->timeout = 30;
connection->datasource = NULL;
connection->provider = SysAllocString(L"MSDASQL");
+ connection->mode = adModeUnknown;
connection->cp_connev.conn = connection;
connection->cp_connev.riid = &DIID_ConnectionEvents;
diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c
index 26c5c07a9d5..a532091fd7e 100644
--- a/dlls/msado15/tests/msado15.c
+++ b/dlls/msado15/tests/msado15.c
@@ -675,6 +675,7 @@ static void test_Connection(void)
IConnectionPointContainer *pointcontainer;
LONG state, timeout;
BSTR str, str2, str3;
+ ConnectModeEnum mode;
hr = CoCreateInstance(&CLSID_Connection, NULL, CLSCTX_INPROC_SERVER, &IID__Connection, (void**)&connection);
ok( hr == S_OK, "got %08x\n", hr );
@@ -718,6 +719,22 @@ if (0) /* Crashes on windows */
ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr);
ok(timeout == 300, "Unexpected timeout value %d\n", timeout);
+ mode = adModeUnknown;
+ hr = _Connection_get_Mode(connection, &mode);
+ ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr);
+ ok(mode == adModeUnknown, "Unexpected mode value %d\n", mode);
+
+ hr = _Connection_put_Mode(connection, adModeShareDenyNone);
+ ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr);
+
+ mode = adModeUnknown;
+ hr = _Connection_get_Mode(connection, &mode);
+ ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr);
+ ok(mode == adModeShareDenyNone, "Unexpected mode value %d\n", mode);
+
+ hr = _Connection_put_Mode(connection, adModeUnknown);
+ ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr);
+
/* Default */
str = (BSTR)0xdeadbeef;
hr = _Connection_get_Provider(connection, &str);
--
2.28.0
1
0
Oct. 8, 2020
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/msado15/connection.c | 27 +++++++++++++++++++++----
dlls/msado15/tests/msado15.c | 38 +++++++++++++++++++++++++++++++++++-
2 files changed, 60 insertions(+), 5 deletions(-)
diff --git a/dlls/msado15/connection.c b/dlls/msado15/connection.c
index 5d8f78f53e8..8d69e019852 100644
--- a/dlls/msado15/connection.c
+++ b/dlls/msado15/connection.c
@@ -53,6 +53,7 @@ struct connection
ObjectStateEnum state;
LONG timeout;
WCHAR *datasource;
+ WCHAR *provider;
struct connection_point cp_connev;
};
@@ -96,6 +97,7 @@ static ULONG WINAPI connection_Release( _Connection *iface )
IUnknown_Release( connection->cp_connev.sinks[i] );
}
heap_free( connection->cp_connev.sinks );
+ heap_free( connection->provider );
heap_free( connection->datasource );
heap_free( connection );
}
@@ -346,14 +348,30 @@ static HRESULT WINAPI connection_put_Mode( _Connection *iface, ConnectModeEnum m
static HRESULT WINAPI connection_get_Provider( _Connection *iface, BSTR *str )
{
- FIXME( "%p, %p\n", iface, str );
- return E_NOTIMPL;
+ struct connection *connection = impl_from_Connection( iface );
+ BSTR provider = NULL;
+
+ TRACE( "%p, %p\n", iface, str );
+
+ if (connection->provider && !(provider = SysAllocString( connection->provider ))) return E_OUTOFMEMORY;
+ *str = provider;
+ return S_OK;
}
static HRESULT WINAPI connection_put_Provider( _Connection *iface, BSTR str )
{
- FIXME( "%p, %s\n", iface, debugstr_w(str) );
- return E_NOTIMPL;
+ struct connection *connection = impl_from_Connection( iface );
+ WCHAR *provider = NULL;
+
+ TRACE( "%p, %s\n", iface, debugstr_w(str) );
+
+ if (!str)
+ return MAKE_ADO_HRESULT(adErrInvalidArgument);
+
+ if (str && !(provider = strdupW( str ))) return E_OUTOFMEMORY;
+ heap_free( connection->provider );
+ connection->provider = provider;
+ return S_OK;
}
static HRESULT WINAPI connection_get_State( _Connection *iface, LONG *state )
@@ -646,6 +664,7 @@ HRESULT Connection_create( void **obj )
connection->state = adStateClosed;
connection->timeout = 30;
connection->datasource = NULL;
+ connection->provider = SysAllocString(L"MSDASQL");
connection->cp_connev.conn = connection;
connection->cp_connev.riid = &DIID_ConnectionEvents;
diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c
index 1629fe15bed..26c5c07a9d5 100644
--- a/dlls/msado15/tests/msado15.c
+++ b/dlls/msado15/tests/msado15.c
@@ -718,15 +718,51 @@ if (0) /* Crashes on windows */
ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr);
ok(timeout == 300, "Unexpected timeout value %d\n", timeout);
+ /* Default */
str = (BSTR)0xdeadbeef;
- hr = _Connection_get_ConnectionString(connection, &str);
+ hr = _Connection_get_Provider(connection, &str);
+ ok(hr == S_OK, "Failed, hr 0x%08x\n", hr);
+ ok(!wcscmp(str, L"MSDASQL"), "wrong string %s\n", wine_dbgstr_w(str));
+ SysFreeString(str);
+
+ str = SysAllocString(L"MSDASQL.1");
+ hr = _Connection_put_Provider(connection, str);
+ ok(hr == S_OK, "Failed, hr 0x%08x\n", hr);
+ SysFreeString(str);
+
+ str = (BSTR)0xdeadbeef;
+ hr = _Connection_get_Provider(connection, &str);
+ ok(hr == S_OK, "Failed, hr 0x%08x\n", hr);
+ ok(!wcscmp(str, L"MSDASQL.1"), "wrong string %s\n", wine_dbgstr_w(str));
+
+ /* Restore default */
+ str = SysAllocString(L"MSDASQL");
+ hr = _Connection_put_Provider(connection, str);
ok(hr == S_OK, "Failed, hr 0x%08x\n", hr);
+ SysFreeString(str);
+
+ str = NULL;
+ hr = _Connection_put_Provider(connection, str);
+ ok(hr == MAKE_ADO_HRESULT(adErrInvalidArgument), "got 0x%08x\n", hr);
+ SysFreeString(str);
+
+ str = (BSTR)0xdeadbeef;
+ hr = _Connection_get_ConnectionString(connection, &str);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
ok(str == NULL, "got %p\n", str);
str = SysAllocString(L"Provider=MSDASQL.1;Persist Security Info=False;Data Source=wine_test");
hr = _Connection_put_ConnectionString(connection, str);
ok(hr == S_OK, "Failed, hr 0x%08x\n", hr);
+ /* Show put_ConnectionString effects Provider */
+ str3 = (BSTR)0xdeadbeef;
+ hr = _Connection_get_Provider(connection, &str3);
+ ok(hr == S_OK, "Failed, hr 0x%08x\n", hr);
+ ok(str3 != NULL, "Expected value got NULL\n");
+ todo_wine ok(!wcscmp(str3, L"MSDASQL.1"), "wrong string %s\n", wine_dbgstr_w(str3));
+ SysFreeString(str3);
+
if (0) /* Crashes on windows */
{
hr = _Connection_get_ConnectionString(connection, NULL);
--
2.28.0
1
0