winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
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
List overview
wine-commits
July 2024
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
519 discussions
Start a n
N
ew thread
Jacek Caban : mshtml: Factor out dispex_prop_put.
by Alexandre Julliard
08 Jul '24
08 Jul '24
Module: wine Branch: master Commit: 36dbff58cd91592ee1d478d04b104d8593e7e120 URL:
https://gitlab.winehq.org/wine/wine/-/commit/36dbff58cd91592ee1d478d04b104d…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Jun 28 12:01:08 2024 +0200 mshtml: Factor out dispex_prop_put. --- dlls/mshtml/dispex.c | 69 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 54 insertions(+), 15 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index c40b63cb980..efdbbf3da81 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -1894,6 +1894,49 @@ static HRESULT WINAPI DispatchEx_GetDispID(IWineJSDispatchHost *iface, BSTR bstr return S_OK; } +static HRESULT dispex_prop_put(DispatchEx *dispex, DISPID id, LCID lcid, VARIANT *v, EXCEPINFO *ei, IServiceProvider *caller) +{ + static DISPID propput_dispid = DISPID_PROPERTYPUT; + + switch(get_dispid_type(id)) { + case DISPEXPROP_CUSTOM: { + DISPPARAMS dp = { .cArgs = 1, .rgvarg = v, .cNamedArgs = 1, .rgdispidNamedArgs = &propput_dispid }; + if(!dispex->info->desc->vtbl->invoke) + return DISP_E_MEMBERNOTFOUND; + return dispex->info->desc->vtbl->invoke(dispex, id, lcid, DISPATCH_PROPERTYPUT, &dp, NULL, ei, caller); + } + + case DISPEXPROP_DYNAMIC: { + DWORD idx = id - DISPID_DYNPROP_0; + dynamic_prop_t *prop; + HRESULT hres; + + if(!get_dynamic_data(dispex) || dispex->dynamic_data->prop_cnt <= idx) + return DISP_E_MEMBERNOTFOUND; + + prop = dispex->dynamic_data->props + idx; + + TRACE("put %s\n", debugstr_variant(v)); + VariantClear(&prop->var); + hres = variant_copy(&prop->var, v); + if(FAILED(hres)) + return hres; + + prop->flags &= ~DYNPROP_DELETED; + return S_OK; + } + + case DISPEXPROP_BUILTIN: { + DISPPARAMS dp = { .cArgs = 1, .rgvarg = v, .cNamedArgs = 1, .rgdispidNamedArgs = &propput_dispid }; + return invoke_builtin_prop(dispex, id, lcid, DISPATCH_PROPERTYPUT, &dp, NULL, ei, caller); + } + + default: + assert(0); + return E_FAIL; + } +} + static HRESULT WINAPI DispatchEx_InvokeEx(IWineJSDispatchHost *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) { @@ -1914,6 +1957,17 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IWineJSDispatchHost *iface, DISPID id, return hres; } + switch(wFlags) { + case DISPATCH_PROPERTYPUT: { + if(pdp->cArgs != 1 || (pdp->cNamedArgs == 1 && *pdp->rgdispidNamedArgs != DISPID_PROPERTYPUT) + || pdp->cNamedArgs > 1) { + FIXME("invalid args\n"); + return E_INVALIDARG; + } + return dispex_prop_put(This, id, lcid, pdp->rgvarg, pei, pspCaller); + } + } + switch(get_dispid_type(id)) { case DISPEXPROP_CUSTOM: if(!This->info->desc->vtbl->invoke) @@ -1946,21 +2000,6 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IWineJSDispatchHost *iface, DISPID id, return DISP_E_MEMBERNOTFOUND; V_VT(pvarRes) = VT_EMPTY; return variant_copy(pvarRes, &prop->var); - case DISPATCH_PROPERTYPUT: - if(pdp->cArgs != 1 || (pdp->cNamedArgs == 1 && *pdp->rgdispidNamedArgs != DISPID_PROPERTYPUT) - || pdp->cNamedArgs > 1) { - FIXME("invalid args\n"); - return E_INVALIDARG; - } - - TRACE("put %s\n", debugstr_variant(pdp->rgvarg)); - VariantClear(&prop->var); - hres = variant_copy(&prop->var, pdp->rgvarg); - if(FAILED(hres)) - return hres; - - prop->flags &= ~DYNPROP_DELETED; - return S_OK; default: FIXME("unhandled wFlags %x\n", wFlags); return E_NOTIMPL;
1
0
0
0
Rémi Bernon : win32u: Simplify the logic for driver messages polling.
by Alexandre Julliard
08 Jul '24
08 Jul '24
Module: wine Branch: master Commit: 54ca1ab607d3ff22a1f57a9561430f64c75f0916 URL:
https://gitlab.winehq.org/wine/wine/-/commit/54ca1ab607d3ff22a1f57a9561430f…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed Jun 26 14:25:56 2024 +0200 win32u: Simplify the logic for driver messages polling. As we don't need to make a server request to check for the queue status anymore, we can stop relying on ProcessEvent return status, and only call it often enough, before and after checking for messages. We keep a throttle here though, as now that PeekMessage returns very quickly when no message is found, calling it in a tight loop triggers a large number of calls into the drivers instead. --- dlls/win32u/message.c | 41 +++++++++++++++++------------------------ dlls/win32u/ntuser_private.h | 2 +- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 5f8cb95d731..ba348cd3782 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -3038,19 +3038,14 @@ static HANDLE get_server_queue_handle(void) } /* check for driver events if we detect that the app is not properly consuming messages */ -static inline void check_for_driver_events( UINT msg ) +static inline void check_for_driver_events(void) { - if (get_user_thread_info()->message_count > 200) + if (get_user_thread_info()->last_driver_time != NtGetTickCount()) { flush_window_surfaces( FALSE ); user_driver->pProcessEvents( QS_ALLINPUT ); + get_user_thread_info()->last_driver_time = NtGetTickCount(); } - else if (msg == WM_TIMER || msg == WM_SYSTIMER) - { - /* driver events should have priority over timers, so make sure we'll check for them soon */ - get_user_thread_info()->message_count += 100; - } - else get_user_thread_info()->message_count++; } /* helper for kernel32->ntdll timeout format conversion */ @@ -3075,8 +3070,8 @@ static DWORD wait_message( DWORD count, const HANDLE *handles, DWORD timeout, DW lock = *(DWORD *)ret_ptr; } - if (user_driver->pProcessEvents( mask )) ret = count ? count - 1 : 0; - else if (count) + if (user_driver->pProcessEvents( mask )) ret = count - 1; + else { ret = NtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL), !!(flags & MWMO_ALERTABLE), get_nt_timeout( &time, timeout )); @@ -3087,10 +3082,9 @@ static DWORD wait_message( DWORD count, const HANDLE *handles, DWORD timeout, DW ret = WAIT_FAILED; } } - else ret = WAIT_TIMEOUT; if (ret == WAIT_TIMEOUT && !count && !timeout) NtYieldExecution(); - if ((mask & QS_INPUT) == QS_INPUT) get_user_thread_info()->message_count = 0; + if (ret == count - 1) get_user_thread_info()->last_driver_time = NtGetTickCount(); if (enable_thunk_lock) KeUserModeCallback( NtUserThunkLock, &lock, sizeof(lock), &ret_ptr, &ret_len ); @@ -3247,20 +3241,19 @@ BOOL WINAPI NtUserPeekMessage( MSG *msg_out, HWND hwnd, UINT first, UINT last, U int ret; user_check_not_lock(); - check_for_driver_events( 0 ); - - ret = peek_message( &msg, &filter ); - if (ret < 0) return FALSE; + check_for_driver_events(); - if (!ret) + if ((ret = peek_message( &msg, &filter )) <= 0) { - flush_window_surfaces( TRUE ); - ret = wait_message( 0, NULL, 0, QS_ALLINPUT, 0 ); - /* if we received driver events, check again for a pending message */ - if (ret == WAIT_TIMEOUT || peek_message( &msg, &filter ) <= 0) return FALSE; + if (!ret) + { + flush_window_surfaces( TRUE ); + NtYieldExecution(); + } + return FALSE; } - check_for_driver_events( msg.message ); + check_for_driver_events(); /* copy back our internal safe copy of message data to msg_out. * msg_out is a variable from the *program*, so it can't be used @@ -3286,7 +3279,7 @@ BOOL WINAPI NtUserGetMessage( MSG *msg, HWND hwnd, UINT first, UINT last ) int ret; user_check_not_lock(); - check_for_driver_events( 0 ); + check_for_driver_events(); if (first || last) { @@ -3307,7 +3300,7 @@ BOOL WINAPI NtUserGetMessage( MSG *msg, HWND hwnd, UINT first, UINT last ) } if (ret < 0) return -1; - check_for_driver_events( msg->message ); + check_for_driver_events(); return msg->message != WM_QUIT; } diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index a6e61e1751b..a361e1d73a5 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -109,7 +109,7 @@ struct user_thread_info struct ntuser_thread_info client_info; /* Data shared with client */ HANDLE server_queue; /* Handle to server-side queue */ DWORD last_getmsg_time; /* Get/PeekMessage last request time */ - WORD message_count; /* Get/PeekMessage loop counter */ + DWORD last_driver_time; /* Get/PeekMessage driver event time */ WORD hook_call_depth; /* Number of recursively called hook procs */ WORD hook_unicode; /* Is current hook unicode? */ HHOOK hook; /* Current hook */
1
0
0
0
Rémi Bernon : win32u: Allocate heap in peek_message only when necessary.
by Alexandre Julliard
08 Jul '24
08 Jul '24
Module: wine Branch: master Commit: 235138fc28dea4cfc5631d6cf5fa443dedf8aa63 URL:
https://gitlab.winehq.org/wine/wine/-/commit/235138fc28dea4cfc5631d6cf5fa44…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Jun 25 16:43:28 2024 +0200 win32u: Allocate heap in peek_message only when necessary. --- dlls/win32u/message.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 88222c815da..cadf390eaed 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2713,10 +2713,9 @@ int peek_message( MSG *msg, const struct peek_message_filter *filter ) INPUT_MESSAGE_SOURCE prev_source = thread_info->client_info.msg_source; struct received_message_info info; unsigned int hw_id = 0; /* id of previous hardware message */ - void *buffer; - size_t buffer_size = 1024; - - if (!(buffer = malloc( buffer_size ))) return -1; + unsigned char buffer_init[1024]; + size_t buffer_size = sizeof(buffer_init); + void *buffer = buffer_init; if (!first && !last) last = ~0; if (hwnd == HWND_BROADCAST) hwnd = HWND_TOPMOST; @@ -2759,11 +2758,8 @@ int peek_message( MSG *msg, const struct peek_message_filter *filter ) if (res) { - free( buffer ); - if (res == STATUS_PENDING) - { - return 0; - } + if (buffer != buffer_init) free( buffer ); + if (res == STATUS_PENDING) return 0; if (res != STATUS_BUFFER_OVERFLOW) { RtlSetLastWin32Error( RtlNtStatusToDosError(res) ); @@ -2786,6 +2782,12 @@ int peek_message( MSG *msg, const struct peek_message_filter *filter ) break; case MSG_NOTIFY: info.flags = ISMEX_NOTIFY; + /* unpack_message may have to reallocate */ + if (buffer == buffer_init) + { + buffer = malloc( buffer_size ); + memcpy( buffer, buffer_init, buffer_size ); + } if (!unpack_message( info.msg.hwnd, info.msg.message, &info.msg.wParam, &info.msg.lParam, &buffer, size, &buffer_size )) continue; @@ -2864,6 +2866,12 @@ int peek_message( MSG *msg, const struct peek_message_filter *filter ) continue; case MSG_OTHER_PROCESS: info.flags = ISMEX_SEND; + /* unpack_message may have to reallocate */ + if (buffer == buffer_init) + { + buffer = malloc( buffer_size ); + memcpy( buffer, buffer_init, buffer_size ); + } if (!unpack_message( info.msg.hwnd, info.msg.message, &info.msg.wParam, &info.msg.lParam, &buffer, size, &buffer_size )) { @@ -2886,7 +2894,7 @@ int peek_message( MSG *msg, const struct peek_message_filter *filter ) thread_info->client_info.message_pos = MAKELONG( info.msg.pt.x, info.msg.pt.y ); thread_info->client_info.message_time = info.msg.time; thread_info->client_info.message_extra = msg_data->hardware.info; - free( buffer ); + if (buffer != buffer_init) free( buffer ); call_hooks( WH_GETMESSAGE, HC_ACTION, flags & PM_REMOVE, (LPARAM)msg, sizeof(*msg) ); return 1; } @@ -2901,7 +2909,7 @@ int peek_message( MSG *msg, const struct peek_message_filter *filter ) /* if this is a nested call return right away */ if (first == info.msg.message && last == info.msg.message) { - free( buffer ); + if (buffer != buffer_init) free( buffer ); return 0; } } @@ -2950,7 +2958,7 @@ int peek_message( MSG *msg, const struct peek_message_filter *filter ) thread_info->client_info.message_time = info.msg.time; thread_info->client_info.message_extra = 0; thread_info->client_info.msg_source = msg_source_unavailable; - free( buffer ); + if (buffer != buffer_init) free( buffer ); call_hooks( WH_GETMESSAGE, HC_ACTION, flags & PM_REMOVE, (LPARAM)msg, sizeof(*msg) ); return 1; }
1
0
0
0
Rémi Bernon : mf/tests: Remove static specifier on variables referencing other variables.
by Alexandre Julliard
08 Jul '24
08 Jul '24
Module: wine Branch: master Commit: c784fb4bad3519b692e71ff4a46b1263af27c0d8 URL:
https://gitlab.winehq.org/wine/wine/-/commit/c784fb4bad3519b692e71ff4a46b12…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Jul 8 14:38:30 2024 +0200 mf/tests: Remove static specifier on variables referencing other variables. --- dlls/mf/tests/transform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index 4313d7e3241..ef0bec60ed5 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -3857,7 +3857,7 @@ static void test_h264_encoder(void) ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), {0}, }; - static const struct attribute_desc expect_available_input_attributes[] = + const struct attribute_desc expect_available_input_attributes[] = { ATTR_RATIO(MF_MT_FRAME_SIZE, actual_width, actual_height), ATTR_RATIO(MF_MT_FRAME_RATE, 30000, 1001), @@ -9244,7 +9244,7 @@ static void test_video_processor_with_dxgi_manager(void) ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), }; - static const MFVideoArea aperture = {.Area={set_width, set_height}}; + const MFVideoArea aperture = {.Area={set_width, set_height}}; const struct attribute_desc nv12_with_aperture[] = { ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video),
1
0
0
0
Rémi Bernon : winex11: Reset window shape whenever window surface is created.
by Alexandre Julliard
08 Jul '24
08 Jul '24
Module: wine Branch: master Commit: 956710cd7f7bd2c2dbb0e1f3db03cf58f646a742 URL:
https://gitlab.winehq.org/wine/wine/-/commit/956710cd7f7bd2c2dbb0e1f3db03cf…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Jul 8 19:04:25 2024 +0200 winex11: Reset window shape whenever window surface is created. When the window was empty, it may have been set an empty shape, we need to reset it or the window may stay invisible if the window shape isn't changed. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=56945
--- dlls/user32/tests/win.c | 7 +++++-- dlls/winex11.drv/bitblt.c | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 0429211c5a3..775164e3e9f 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -4034,8 +4034,11 @@ static void test_SetForegroundWindow(HWND hwnd) while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); if (0) check_wnd_state(hwnd2, hwnd2, hwnd2, 0); - ok(GetActiveWindow() == hwnd2, "Expected active window %p, got %p.\n", hwnd2, GetActiveWindow()); - ok(GetFocus() == hwnd2, "Expected focus window %p, got %p.\n", hwnd2, GetFocus()); + /* FIXME: these tests are failing because of a race condition + * between internal focus state applied immediately and X11 focus + * message coming late */ + todo_wine ok(GetActiveWindow() == hwnd2, "Expected active window %p, got %p.\n", hwnd2, GetActiveWindow()); + todo_wine ok(GetFocus() == hwnd2, "Expected focus window %p, got %p.\n", hwnd2, GetFocus()); SetForegroundWindow(hwnd); check_wnd_state(hwnd, hwnd, hwnd, 0); diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c index de233bfb679..5c08c1a2120 100644 --- a/dlls/winex11.drv/bitblt.c +++ b/dlls/winex11.drv/bitblt.c @@ -1946,6 +1946,9 @@ static struct window_surface *create_surface( HWND hwnd, Window window, const XV surface->window = window; surface->gc = XCreateGC( gdi_display, window, 0, NULL ); XSetSubwindowMode( gdi_display, surface->gc, IncludeInferiors ); +#ifdef HAVE_LIBXSHAPE + XShapeCombineMask( gdi_display, surface->window, ShapeBounding, 0, 0, None, ShapeSet ); +#endif TRACE( "created %p for %lx %s image %p\n", surface, window, wine_dbgstr_rect(rect), surface->image->ximage->data );
1
0
0
0
Jacek Caban : jscript: Use to_disp in a few more places.
by Alexandre Julliard
08 Jul '24
08 Jul '24
Module: wine Branch: master Commit: a2c59f6d152061d4063494129142df5accb4e0ff URL:
https://gitlab.winehq.org/wine/wine/-/commit/a2c59f6d152061d4063494129142df…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Sun Jul 7 23:21:56 2024 +0200 jscript: Use to_disp in a few more places. --- dlls/jscript/dispex.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index e45e22f3a44..8813f6bb71a 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -608,7 +608,7 @@ static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t case PROP_BUILTIN: return JS_E_FUNCTION_EXPECTED; case PROP_PROTREF: - return invoke_prop_func(This->prototype, jsthis ? jsthis : (IDispatch *)&This->IDispatchEx_iface, + return invoke_prop_func(This->prototype, jsthis ? jsthis : to_disp(This), This->prototype->props+prop->u.ref, flags, argc, argv, r, caller); case PROP_JSVAL: { if(!is_object_instance(prop->u.val)) { @@ -619,20 +619,20 @@ static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t TRACE("call %s %p\n", debugstr_w(prop->name), get_object(prop->u.val)); return disp_call_value_with_caller(This->ctx, get_object(prop->u.val), - jsval_disp(jsthis ? jsthis : (IDispatch*)&This->IDispatchEx_iface), + jsval_disp(jsthis ? jsthis : to_disp(This)), flags, argc, argv, r, caller); } case PROP_ACCESSOR: case PROP_EXTERN: { jsval_t val; - hres = prop_get(This, jsthis ? jsthis : (IDispatch *)&This->IDispatchEx_iface, prop, &val); + hres = prop_get(This, jsthis ? jsthis : to_disp(This), prop, &val); if(FAILED(hres)) return hres; if(is_object_instance(val)) { hres = disp_call_value_with_caller(This->ctx, get_object(val), - jsval_disp(jsthis ? jsthis : (IDispatch*)&This->IDispatchEx_iface), + jsval_disp(jsthis ? jsthis : to_disp(This)), flags, argc, argv, r, caller); }else { FIXME("invoke %s\n", debugstr_jsval(val));
1
0
0
0
Jacek Caban : jscript: Factor out handle_dispatch_exception.
by Alexandre Julliard
08 Jul '24
08 Jul '24
Module: wine Branch: master Commit: b0e57e0cb51497a3f867c533e6dee7f5d9fa5962 URL:
https://gitlab.winehq.org/wine/wine/-/commit/b0e57e0cb51497a3f867c533e6dee7…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Sun Jul 7 19:21:59 2024 +0200 jscript: Factor out handle_dispatch_exception. Based on patch by Gabriel Ivăncescu. --- dlls/jscript/dispex.c | 15 ++------------- dlls/jscript/error.c | 15 +++++++++++++++ dlls/jscript/jscript.h | 1 + 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 81fdc3d4799..e45e22f3a44 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -2496,19 +2496,8 @@ static HRESULT disp_invoke(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD f hres = IDispatch_Invoke(disp, id, &IID_NULL, ctx->lcid, flags, params, r, &ei, &err); } - if(hres == DISP_E_EXCEPTION) { - TRACE("DISP_E_EXCEPTION: %08lx %s %s\n", ei.scode, debugstr_w(ei.bstrSource), debugstr_w(ei.bstrDescription)); - reset_ei(ctx->ei); - ctx->ei->error = (SUCCEEDED(ei.scode) || ei.scode == DISP_E_EXCEPTION) ? E_FAIL : ei.scode; - if(ei.bstrSource) - ctx->ei->source = jsstr_alloc_len(ei.bstrSource, SysStringLen(ei.bstrSource)); - if(ei.bstrDescription) - ctx->ei->message = jsstr_alloc_len(ei.bstrDescription, SysStringLen(ei.bstrDescription)); - SysFreeString(ei.bstrSource); - SysFreeString(ei.bstrDescription); - SysFreeString(ei.bstrHelpFile); - } - + if(hres == DISP_E_EXCEPTION) + handle_dispatch_exception(ctx, &ei); return hres; } diff --git a/dlls/jscript/error.c b/dlls/jscript/error.c index e1f04aef38c..a3388ee9a27 100644 --- a/dlls/jscript/error.c +++ b/dlls/jscript/error.c @@ -402,6 +402,21 @@ HRESULT throw_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str) return DISP_E_EXCEPTION; } +void handle_dispatch_exception(script_ctx_t *ctx, EXCEPINFO *ei) +{ + TRACE("%08lx %s %s\n", ei->scode, debugstr_w(ei->bstrSource), debugstr_w(ei->bstrDescription)); + + reset_ei(ctx->ei); + ctx->ei->error = (SUCCEEDED(ei->scode) || ei->scode == DISP_E_EXCEPTION) ? E_FAIL : ei->scode; + if(ei->bstrSource) + ctx->ei->source = jsstr_alloc_len(ei->bstrSource, SysStringLen(ei->bstrSource)); + if(ei->bstrDescription) + ctx->ei->message = jsstr_alloc_len(ei->bstrDescription, SysStringLen(ei->bstrDescription)); + SysFreeString(ei->bstrSource); + SysFreeString(ei->bstrDescription); + SysFreeString(ei->bstrHelpFile); +} + void set_error_location(jsexcept_t *ei, bytecode_t *code, unsigned loc, unsigned source_id, jsstr_t *line) { if(is_jscript_error(ei->error)) { diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 5adf2a2590a..e091e7acd90 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -312,6 +312,7 @@ struct _function_code_t *Function_get_code(jsdisp_t*); HRESULT throw_error(script_ctx_t*,HRESULT,const WCHAR*); jsdisp_t *create_builtin_error(script_ctx_t *ctx); +void handle_dispatch_exception(script_ctx_t *ctx, EXCEPINFO *ei); HRESULT create_object(script_ctx_t*,jsdisp_t*,jsdisp_t**); HRESULT create_math(script_ctx_t*,jsdisp_t**);
1
0
0
0
Jacek Caban : jscript: Introduce next_property callback.
by Alexandre Julliard
08 Jul '24
08 Jul '24
Module: wine Branch: master Commit: 9e7f0e96a7bbc04dd9a2bebaf36d639bb236d229 URL:
https://gitlab.winehq.org/wine/wine/-/commit/9e7f0e96a7bbc04dd9a2bebaf36d63…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Sun Jul 7 17:31:13 2024 +0200 jscript: Introduce next_property callback. And use it instead of idx_length. --- dlls/jscript/dispex.c | 34 +++++++++++++++++++++++++++++----- dlls/jscript/engine.c | 8 -------- dlls/jscript/function.c | 6 +++--- dlls/jscript/jscript.h | 3 ++- dlls/jscript/string.c | 16 ++++++---------- 5 files changed, 40 insertions(+), 27 deletions(-) diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index ae81accb1b2..81fdc3d4799 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -427,6 +427,17 @@ HRESULT jsdisp_index_lookup(jsdisp_t *obj, const WCHAR *name, unsigned length, s return S_OK; } +HRESULT jsdisp_next_index(jsdisp_t *obj, unsigned length, unsigned id, struct property_info *desc) +{ + if(id + 1 == length) + return S_FALSE; + desc->id = id + 1; + desc->flags = PROPF_ENUMERABLE; + if(obj->builtin_info->prop_put) + desc->flags |= PROPF_WRITABLE; + return S_OK; +} + static IDispatch *get_this(DISPPARAMS *dp) { DWORD i; @@ -650,15 +661,28 @@ static HRESULT fill_props(jsdisp_t *obj) dispex_prop_t *prop; HRESULT hres; - if(obj->builtin_info->idx_length) { - unsigned i = 0, len = obj->builtin_info->idx_length(obj); + if(obj->builtin_info->next_prop) { + struct property_info desc; + unsigned id = ~0; WCHAR name[12]; - for(i = 0; i < len; i++) { - swprintf(name, ARRAY_SIZE(name), L"%u", i); - hres = find_prop_name(obj, string_hash(name), name, FALSE, &prop); + for(;;) { + hres = obj->builtin_info->next_prop(obj, id, &desc); if(FAILED(hres)) return hres; + if(hres == S_FALSE) + break; + + swprintf(name, ARRAYSIZE(name), L"%u", desc.id); + + prop = lookup_dispex_prop(obj, string_hash(name), name, FALSE); + if(!prop) { + prop = alloc_prop(obj, name, PROP_EXTERN, desc.flags); + if(!prop) + return E_OUTOFMEMORY; + prop->u.id = desc.id; + } + id = desc.id; } } diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index d20939785fe..e84d2f9b2d8 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -485,13 +485,6 @@ static HRESULT scope_lookup_prop(jsdisp_t *jsdisp, const WCHAR *name, struct pro return jsdisp_index_lookup(&scope->dispex, name, scope->detached_vars->argc, desc); } -static unsigned scope_idx_length(jsdisp_t *dispex) -{ - scope_chain_t *scope = scope_from_dispex(dispex); - - return scope->detached_vars->argc; -} - static HRESULT scope_prop_get(jsdisp_t *dispex, unsigned idx, jsval_t *r) { scope_chain_t *scope = scope_from_dispex(dispex); @@ -554,7 +547,6 @@ static const builtin_info_t scope_info = { JSCLASS_NONE, .destructor = scope_destructor, .lookup_prop = scope_lookup_prop, - .idx_length = scope_idx_length, .prop_get = scope_prop_get, .prop_put = scope_prop_put, .gc_traverse = scope_gc_traverse diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index 5af834769ff..654bf12c7e9 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -123,10 +123,10 @@ static HRESULT Arguments_lookup_prop(jsdisp_t *jsdisp, const WCHAR *name, struct return jsdisp_index_lookup(&arguments->jsdisp, name, arguments->argc, desc); } -static unsigned Arguments_idx_length(jsdisp_t *jsdisp) +static HRESULT Arguments_next_prop(jsdisp_t *jsdisp, unsigned id, struct property_info *desc) { ArgumentsInstance *arguments = arguments_from_jsdisp(jsdisp); - return arguments->argc; + return jsdisp_next_index(&arguments->jsdisp, arguments->argc, id, desc); } static jsval_t *get_argument_ref(ArgumentsInstance *arguments, unsigned idx) @@ -193,7 +193,7 @@ static const builtin_info_t Arguments_info = { .call = Arguments_value, .destructor = Arguments_destructor, .lookup_prop = Arguments_lookup_prop, - .idx_length = Arguments_idx_length, + .next_prop = Arguments_next_prop, .prop_get = Arguments_prop_get, .prop_put = Arguments_prop_put, .gc_traverse = Arguments_gc_traverse diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index a7a9f8cf6d4..5adf2a2590a 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -191,8 +191,8 @@ typedef struct { const builtin_prop_t *props; void (*destructor)(jsdisp_t*); void (*on_put)(jsdisp_t*,const WCHAR*); - unsigned (*idx_length)(jsdisp_t*); HRESULT (*lookup_prop)(jsdisp_t*,const WCHAR*,struct property_info*); + HRESULT (*next_prop)(jsdisp_t*,unsigned,struct property_info*); HRESULT (*prop_get)(jsdisp_t*,unsigned,jsval_t*); HRESULT (*prop_put)(jsdisp_t*,unsigned,jsval_t); HRESULT (*gc_traverse)(struct gc_ctx*,enum gc_traverse_op,jsdisp_t*); @@ -289,6 +289,7 @@ HRESULT jsdisp_get_idx_id(jsdisp_t*,DWORD,DISPID*); HRESULT disp_delete(IDispatch*,DISPID,BOOL*); HRESULT disp_delete_name(script_ctx_t*,IDispatch*,jsstr_t*,BOOL*); HRESULT jsdisp_index_lookup(jsdisp_t*,const WCHAR*,unsigned,struct property_info*); +HRESULT jsdisp_next_index(jsdisp_t*,unsigned,unsigned,struct property_info*); HRESULT jsdisp_delete_idx(jsdisp_t*,DWORD); HRESULT jsdisp_get_own_property(jsdisp_t*,const WCHAR*,BOOL,property_desc_t*); HRESULT jsdisp_define_property(jsdisp_t*,const WCHAR*,property_desc_t*); diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c index f5f01adf871..3cad5c55a79 100644 --- a/dlls/jscript/string.c +++ b/dlls/jscript/string.c @@ -1517,18 +1517,14 @@ static HRESULT String_lookup_prop(jsdisp_t *jsdisp, const WCHAR *name, struct pr return jsdisp_index_lookup(&string->dispex, name, jsstr_length(string->str), desc); } -static unsigned String_idx_length(jsdisp_t *jsdisp) +static HRESULT String_next_prop(jsdisp_t *jsdisp, unsigned id, struct property_info *desc) { StringInstance *string = string_from_jsdisp(jsdisp); - /* - * NOTE: For invoke version < 2, indexed array is not implemented at all. - * Newer jscript.dll versions implement it on string type, not class, - * which is not how it should work according to spec. IE9 implements it - * properly, but it uses its own JavaScript engine inside MSHTML. We - * implement it here, but in the way IE9 and spec work. - */ - return string->dispex.ctx->version < 2 ? 0 : jsstr_length(string->str); + if(string->dispex.ctx->version < 2) + return S_FALSE; + + return jsdisp_next_index(&string->dispex, jsstr_length(string->str), id, desc); } static HRESULT String_prop_get(jsdisp_t *jsdisp, unsigned idx, jsval_t *r) @@ -1600,7 +1596,7 @@ static const builtin_info_t StringInst_info = { .props = StringInst_props, .destructor = String_destructor, .lookup_prop = String_lookup_prop, - .idx_length = String_idx_length, + .next_prop = String_next_prop, .prop_get = String_prop_get, };
1
0
0
0
Jacek Caban : jscript: Introduce lookup_prop callback.
by Alexandre Julliard
08 Jul '24
08 Jul '24
Module: wine Branch: master Commit: 78654e3890a0b1bb12a5e1fea2371789878c6a43 URL:
https://gitlab.winehq.org/wine/wine/-/commit/78654e3890a0b1bb12a5e1fea23717…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Sun Jul 7 14:23:10 2024 +0200 jscript: Introduce lookup_prop callback. And use it in find_external_prop. --- dlls/jscript/dispex.c | 42 ++++++++++++++++++++++++++++++------------ dlls/jscript/engine.c | 8 ++++++++ dlls/jscript/function.c | 7 +++++++ dlls/jscript/jscript.h | 8 ++++++++ dlls/jscript/string.c | 29 +++++++++++++++++++++++------ 5 files changed, 76 insertions(+), 18 deletions(-) diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index ed1cf397927..0cb2c650407 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -248,21 +248,20 @@ static HRESULT find_external_prop(jsdisp_t *This, const WCHAR *name, BOOL case_i { dispex_prop_t *prop; - if(This->builtin_info->idx_length) { - const WCHAR *ptr; - unsigned idx = 0; - - for(ptr = name; is_digit(*ptr) && idx < 0x10000; ptr++) - idx = idx*10 + (*ptr-'0'); - if(!*ptr && idx < This->builtin_info->idx_length(This)) { - unsigned flags = PROPF_ENUMERABLE; - if(This->builtin_info->prop_put) - flags |= PROPF_WRITABLE; - prop = alloc_prop(This, name, PROP_EXTERN, flags); + if(This->builtin_info->lookup_prop) { + struct property_info desc; + HRESULT hres; + + hres = This->builtin_info->lookup_prop(This, name, &desc); + if(hres != DISP_E_UNKNOWNNAME) { + if(FAILED(hres)) + return hres; + + prop = alloc_prop(This, name, PROP_EXTERN, desc.flags); if(!prop) return E_OUTOFMEMORY; - prop->u.id = idx; + prop->u.id = desc.id; *ret = prop; return S_OK; } @@ -398,6 +397,25 @@ static HRESULT ensure_prop_name(jsdisp_t *This, const WCHAR *name, DWORD create_ return hres; } +HRESULT jsdisp_index_lookup(jsdisp_t *obj, const WCHAR *name, unsigned length, struct property_info *desc) +{ + const WCHAR *ptr; + unsigned idx = 0; + + for(ptr = name; is_digit(*ptr); ptr++) { + idx = idx * 10 + (*ptr - '0'); + if (idx >= length) + return DISP_E_UNKNOWNNAME; + } + if(*ptr) + return DISP_E_UNKNOWNNAME; + desc->id = idx; + desc->flags = PROPF_ENUMERABLE; + if(obj->builtin_info->prop_put) + desc->flags |= PROPF_WRITABLE; + return S_OK; +} + static IDispatch *get_this(DISPPARAMS *dp) { DWORD i; diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index 2e52bb5ed2f..d20939785fe 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -478,6 +478,13 @@ static void scope_destructor(jsdisp_t *dispex) IDispatch_Release(scope->obj); } +static HRESULT scope_lookup_prop(jsdisp_t *jsdisp, const WCHAR *name, struct property_info *desc) +{ + scope_chain_t *scope = scope_from_dispex(jsdisp); + + return jsdisp_index_lookup(&scope->dispex, name, scope->detached_vars->argc, desc); +} + static unsigned scope_idx_length(jsdisp_t *dispex) { scope_chain_t *scope = scope_from_dispex(dispex); @@ -546,6 +553,7 @@ static HRESULT scope_gc_traverse(struct gc_ctx *gc_ctx, enum gc_traverse_op op, static const builtin_info_t scope_info = { JSCLASS_NONE, .destructor = scope_destructor, + .lookup_prop = scope_lookup_prop, .idx_length = scope_idx_length, .prop_get = scope_prop_get, .prop_put = scope_prop_put, diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index 7f0779c2aff..5af834769ff 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -117,6 +117,12 @@ static void Arguments_destructor(jsdisp_t *jsdisp) scope_release(arguments->scope); } +static HRESULT Arguments_lookup_prop(jsdisp_t *jsdisp, const WCHAR *name, struct property_info *desc) +{ + ArgumentsInstance *arguments = arguments_from_jsdisp(jsdisp); + return jsdisp_index_lookup(&arguments->jsdisp, name, arguments->argc, desc); +} + static unsigned Arguments_idx_length(jsdisp_t *jsdisp) { ArgumentsInstance *arguments = arguments_from_jsdisp(jsdisp); @@ -186,6 +192,7 @@ static const builtin_info_t Arguments_info = { .class = JSCLASS_ARGUMENTS, .call = Arguments_value, .destructor = Arguments_destructor, + .lookup_prop = Arguments_lookup_prop, .idx_length = Arguments_idx_length, .prop_get = Arguments_prop_get, .prop_put = Arguments_prop_put, diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 7ee6949bdea..a7a9f8cf6d4 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -178,6 +178,12 @@ typedef struct { builtin_setter_t setter; } builtin_prop_t; +struct property_info +{ + UINT32 id; + UINT32 flags; +}; + typedef struct { jsclass_t class; builtin_invoke_t call; @@ -186,6 +192,7 @@ typedef struct { void (*destructor)(jsdisp_t*); void (*on_put)(jsdisp_t*,const WCHAR*); unsigned (*idx_length)(jsdisp_t*); + HRESULT (*lookup_prop)(jsdisp_t*,const WCHAR*,struct property_info*); HRESULT (*prop_get)(jsdisp_t*,unsigned,jsval_t*); HRESULT (*prop_put)(jsdisp_t*,unsigned,jsval_t); HRESULT (*gc_traverse)(struct gc_ctx*,enum gc_traverse_op,jsdisp_t*); @@ -281,6 +288,7 @@ HRESULT jsdisp_get_id(jsdisp_t*,const WCHAR*,DWORD,DISPID*); HRESULT jsdisp_get_idx_id(jsdisp_t*,DWORD,DISPID*); HRESULT disp_delete(IDispatch*,DISPID,BOOL*); HRESULT disp_delete_name(script_ctx_t*,IDispatch*,jsstr_t*,BOOL*); +HRESULT jsdisp_index_lookup(jsdisp_t*,const WCHAR*,unsigned,struct property_info*); HRESULT jsdisp_delete_idx(jsdisp_t*,DWORD); HRESULT jsdisp_get_own_property(jsdisp_t*,const WCHAR*,BOOL,property_desc_t*); HRESULT jsdisp_define_property(jsdisp_t*,const WCHAR*,property_desc_t*); diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c index 9e1b7aff11c..f5f01adf871 100644 --- a/dlls/jscript/string.c +++ b/dlls/jscript/string.c @@ -1501,6 +1501,22 @@ static void String_destructor(jsdisp_t *dispex) jsstr_release(This->str); } +static HRESULT String_lookup_prop(jsdisp_t *jsdisp, const WCHAR *name, struct property_info *desc) +{ + StringInstance *string = string_from_jsdisp(jsdisp); + + /* + * NOTE: For invoke version < 2, indexed array is not implemented at all. + * Newer jscript.dll versions implement it on string type, not class, + * which is not how it should work according to spec. IE9+ implements it + * properly. + */ + if(string->dispex.ctx->version < 2) + return DISP_E_UNKNOWNNAME; + + return jsdisp_index_lookup(&string->dispex, name, jsstr_length(string->str), desc); +} + static unsigned String_idx_length(jsdisp_t *jsdisp) { StringInstance *string = string_from_jsdisp(jsdisp); @@ -1579,12 +1595,13 @@ static const builtin_prop_t StringInst_props[] = { }; static const builtin_info_t StringInst_info = { - .class = JSCLASS_STRING, - .props_cnt = ARRAY_SIZE(StringInst_props), - .props = StringInst_props, - .destructor = String_destructor, - .idx_length = String_idx_length, - .prop_get = String_prop_get, + .class = JSCLASS_STRING, + .props_cnt = ARRAY_SIZE(StringInst_props), + .props = StringInst_props, + .destructor = String_destructor, + .lookup_prop = String_lookup_prop, + .idx_length = String_idx_length, + .prop_get = String_prop_get, }; /* ECMA-262 3rd Edition 15.5.3.2 */
1
0
0
0
Jacek Caban : jscript: Factor out lookup_dispex_prop.
by Alexandre Julliard
08 Jul '24
08 Jul '24
Module: wine Branch: master Commit: df76e66940739c57d434303eba379bd8dcece0e3 URL:
https://gitlab.winehq.org/wine/wine/-/commit/df76e66940739c57d434303eba379b…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Sun Jul 7 16:16:30 2024 +0200 jscript: Factor out lookup_dispex_prop. --- dlls/jscript/dispex.c | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 0cb2c650407..ae81accb1b2 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -244,6 +244,30 @@ static dispex_prop_t *alloc_protref(jsdisp_t *This, const WCHAR *name, DWORD ref return ret; } +static dispex_prop_t *lookup_dispex_prop(jsdisp_t *obj, unsigned hash, const WCHAR *name, BOOL case_insens) +{ + unsigned bucket, pos, prev = ~0; + + bucket = get_props_idx(obj, hash); + pos = obj->props[bucket].bucket_head; + while(pos != ~0) { + if(case_insens ? !wcsicmp(name, obj->props[pos].name) : !wcscmp(name, obj->props[pos].name)) { + if(prev != ~0) { + obj->props[prev].bucket_next = obj->props[pos].bucket_next; + obj->props[pos].bucket_next = obj->props[bucket].bucket_head; + obj->props[bucket].bucket_head = pos; + } + + return &obj->props[pos]; + } + + prev = pos; + pos = obj->props[pos].bucket_next; + } + + return NULL; +} + static HRESULT find_external_prop(jsdisp_t *This, const WCHAR *name, BOOL case_insens, dispex_prop_t **ret) { dispex_prop_t *prop; @@ -274,26 +298,13 @@ static HRESULT find_external_prop(jsdisp_t *This, const WCHAR *name, BOOL case_i static HRESULT find_prop_name(jsdisp_t *This, unsigned hash, const WCHAR *name, BOOL case_insens, dispex_prop_t **ret) { const builtin_prop_t *builtin; - unsigned bucket, pos, prev = ~0; dispex_prop_t *prop; HRESULT hres; - bucket = get_props_idx(This, hash); - pos = This->props[bucket].bucket_head; - while(pos != ~0) { - if(case_insens ? !wcsicmp(name, This->props[pos].name) : !wcscmp(name, This->props[pos].name)) { - if(prev != ~0) { - This->props[prev].bucket_next = This->props[pos].bucket_next; - This->props[pos].bucket_next = This->props[bucket].bucket_head; - This->props[bucket].bucket_head = pos; - } - - *ret = &This->props[pos]; - return S_OK; - } - - prev = pos; - pos = This->props[pos].bucket_next; + prop = lookup_dispex_prop(This, hash, name, case_insens); + if(prop) { + *ret = prop; + return S_OK; } builtin = find_builtin_prop(This, name, case_insens);
1
0
0
0
← Newer
1
...
29
30
31
32
33
34
35
...
52
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Results per page:
10
25
50
100
200