Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- 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
December 2019
- 73 participants
- 1394 messages
Re: [PATCH v3 2/7] wined3d: Add functions to support device local and non-local memory info management.
by Conor McCarthy
November 27, 2019 6:01 AM, "Henri Verbeet" <hverbeet(a)gmail.com> wrote:
>
> That looks like something that should use a free-list and
> wined3d_array_reserve().
I've modified it to use wined3d_array_reserve(), but I didn't think a free-list was necessary. There are unlikely to be many registered event handles -- in most cases only one. The patch favours simplicity over performance.
Conor
Dec. 3, 2019
[PATCH v2 4/4] winegstreamer: Use strmbase state change methods.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/winegstreamer/gstdemux.c | 255 ++++++++++++++++------------------
1 file changed, 122 insertions(+), 133 deletions(-)
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c
index 93d63106f7..a00480c318 100644
--- a/dlls/winegstreamer/gstdemux.c
+++ b/dlls/winegstreamer/gstdemux.c
@@ -88,11 +88,6 @@ struct gstdemux_source
SourceSeeking seek;
};
-static inline struct gstdemux *impl_from_IBaseFilter(IBaseFilter *iface)
-{
- return CONTAINING_RECORD(iface, struct gstdemux, filter.IBaseFilter_iface);
-}
-
static inline struct gstdemux *impl_from_strmbase_filter(struct strmbase_filter *iface)
{
return CONTAINING_RECORD(iface, struct gstdemux, filter);
@@ -1246,10 +1241,123 @@ static void gstdemux_destroy(struct strmbase_filter *iface)
heap_free(filter);
}
+static HRESULT gstdemux_init_stream(struct strmbase_filter *iface)
+{
+ struct gstdemux *filter = impl_from_strmbase_filter(iface);
+ HRESULT hr = VFW_E_NOT_CONNECTED, pin_hr;
+ GstStateChangeReturn ret;
+ unsigned int i;
+
+ if (!filter->container)
+ return VFW_E_NOT_CONNECTED;
+
+ if (filter->no_more_pads_event)
+ ResetEvent(filter->no_more_pads_event);
+
+ if ((ret = gst_element_set_state(filter->container, GST_STATE_PAUSED)) == GST_STATE_CHANGE_FAILURE)
+ {
+ ERR("Failed to pause stream.\n");
+ return E_FAIL;
+ }
+
+ /* Make sure that all of our pads are connected before returning, lest we
+ * e.g. try to seek and fail. */
+ if (filter->no_more_pads_event)
+ WaitForSingleObject(filter->no_more_pads_event, INFINITE);
+
+ for (i = 0; i < filter->cStreams; ++i)
+ {
+ if (SUCCEEDED(pin_hr = BaseOutputPinImpl_Active(&filter->ppPins[i]->pin)))
+ hr = pin_hr;
+ }
+ return hr;
+}
+
+static HRESULT gstdemux_start_stream(struct strmbase_filter *iface, REFERENCE_TIME time)
+{
+ struct gstdemux *filter = impl_from_strmbase_filter(iface);
+ GstStateChangeReturn ret;
+
+ if (!filter->container)
+ return VFW_E_NOT_CONNECTED;
+
+ if ((ret = gst_element_set_state(filter->container, GST_STATE_PLAYING)) == GST_STATE_CHANGE_FAILURE)
+ {
+ ERR("Failed to play stream.\n");
+ return E_FAIL;
+ }
+ else if (ret == GST_STATE_CHANGE_ASYNC)
+ return S_FALSE;
+ return S_OK;
+}
+
+static HRESULT gstdemux_stop_stream(struct strmbase_filter *iface)
+{
+ struct gstdemux *filter = impl_from_strmbase_filter(iface);
+ GstStateChangeReturn ret;
+
+ if (!filter->container)
+ return VFW_E_NOT_CONNECTED;
+
+ if ((ret = gst_element_set_state(filter->container, GST_STATE_PAUSED)) == GST_STATE_CHANGE_FAILURE)
+ {
+ ERR("Failed to pause stream.\n");
+ return E_FAIL;
+ }
+ else if (ret == GST_STATE_CHANGE_ASYNC)
+ return S_FALSE;
+ return S_OK;
+}
+
+static HRESULT gstdemux_cleanup_stream(struct strmbase_filter *iface)
+{
+ struct gstdemux *filter = impl_from_strmbase_filter(iface);
+ GstStateChangeReturn ret;
+
+ if (!filter->container)
+ return S_OK;
+
+ filter->ignore_flush = TRUE;
+ if ((ret = gst_element_set_state(filter->container, GST_STATE_READY)) == GST_STATE_CHANGE_FAILURE)
+ {
+ ERR("Failed to pause stream.\n");
+ return E_FAIL;
+ }
+ gst_element_get_state(filter->container, NULL, NULL, GST_CLOCK_TIME_NONE);
+ filter->ignore_flush = FALSE;
+
+ return S_OK;
+}
+
+static HRESULT gstdemux_wait_state(struct strmbase_filter *iface, DWORD timeout)
+{
+ struct gstdemux *filter = impl_from_strmbase_filter(iface);
+ GstStateChangeReturn ret;
+
+ if (!filter->container)
+ return S_OK;
+
+ ret = gst_element_get_state(filter->container, NULL, NULL,
+ timeout == INFINITE ? GST_CLOCK_TIME_NONE : timeout * 1000);
+ if (ret == GST_STATE_CHANGE_FAILURE)
+ {
+ ERR("Failed to get state.\n");
+ return E_FAIL;
+ }
+ else if (ret == GST_STATE_CHANGE_ASYNC)
+ return VFW_S_STATE_INTERMEDIATE;
+ return S_OK;
+}
+
static const struct strmbase_filter_ops filter_ops =
{
.filter_get_pin = gstdemux_get_pin,
.filter_destroy = gstdemux_destroy,
+ .filter_init_stream = gstdemux_init_stream,
+ .filter_start_stream = gstdemux_start_stream,
+ .filter_stop_stream = gstdemux_stop_stream,
+ .filter_cleanup_stream = gstdemux_cleanup_stream,
+ .filter_wait_state = gstdemux_wait_state,
};
static HRESULT sink_query_accept(struct strmbase_pin *iface, const AM_MEDIA_TYPE *mt)
@@ -1359,139 +1467,15 @@ IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *outer, HRESULT *phr)
return &object->filter.IUnknown_inner;
}
-static HRESULT WINAPI GST_Stop(IBaseFilter *iface)
-{
- struct gstdemux *This = impl_from_IBaseFilter(iface);
-
- TRACE("(%p)\n", This);
-
- mark_wine_thread();
-
- if (This->container) {
- This->ignore_flush = TRUE;
- gst_element_set_state(This->container, GST_STATE_READY);
- gst_element_get_state(This->container, NULL, NULL, -1);
- This->ignore_flush = FALSE;
- }
- return S_OK;
-}
-
-static HRESULT WINAPI GST_Pause(IBaseFilter *iface)
-{
- struct gstdemux *This = impl_from_IBaseFilter(iface);
- HRESULT hr = S_OK;
- GstState now;
- GstStateChangeReturn ret;
-
- TRACE("(%p)\n", This);
-
- if (!This->container)
- return VFW_E_NOT_CONNECTED;
-
- mark_wine_thread();
-
- gst_element_get_state(This->container, &now, NULL, -1);
- if (now == GST_STATE_PAUSED)
- return S_OK;
- if (now != GST_STATE_PLAYING)
- hr = IBaseFilter_Run(iface, -1);
- if (FAILED(hr))
- return hr;
- ret = gst_element_set_state(This->container, GST_STATE_PAUSED);
- if (ret == GST_STATE_CHANGE_ASYNC)
- hr = S_FALSE;
- return hr;
-}
-
-static HRESULT WINAPI GST_Run(IBaseFilter *iface, REFERENCE_TIME tStart)
-{
- struct gstdemux *This = impl_from_IBaseFilter(iface);
- HRESULT hr = S_OK;
- ULONG i;
- GstState now;
- HRESULT hr_any = VFW_E_NOT_CONNECTED;
-
- TRACE("(%p)->(%s)\n", This, wine_dbgstr_longlong(tStart));
-
- mark_wine_thread();
-
- if (!This->container)
- return VFW_E_NOT_CONNECTED;
-
- gst_element_get_state(This->container, &now, NULL, -1);
- if (now == GST_STATE_PLAYING)
- return S_OK;
- if (now == GST_STATE_PAUSED) {
- GstStateChangeReturn ret;
- ret = gst_element_set_state(This->container, GST_STATE_PLAYING);
- if (ret == GST_STATE_CHANGE_ASYNC)
- return S_FALSE;
- return S_OK;
- }
-
- EnterCriticalSection(&This->filter.csFilter);
-
- if (This->no_more_pads_event)
- ResetEvent(This->no_more_pads_event);
-
- gst_element_set_state(This->container, GST_STATE_PLAYING);
-
- /* Make sure that all of our pads are connected before returning, lest we
- * e.g. try to seek and fail. */
- if (This->no_more_pads_event)
- WaitForSingleObject(This->no_more_pads_event, INFINITE);
-
- for (i = 0; i < This->cStreams; i++) {
- hr = BaseOutputPinImpl_Active(&This->ppPins[i]->pin);
- if (SUCCEEDED(hr)) {
- hr_any = hr;
- }
- }
- hr = hr_any;
- LeaveCriticalSection(&This->filter.csFilter);
-
- return hr;
-}
-
-static HRESULT WINAPI GST_GetState(IBaseFilter *iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
-{
- struct gstdemux *This = impl_from_IBaseFilter(iface);
- HRESULT hr = S_OK;
- GstState now, pending;
- GstStateChangeReturn ret;
-
- TRACE("(%p)->(%d, %p)\n", This, dwMilliSecsTimeout, pState);
-
- mark_wine_thread();
-
- if (!This->container) {
- *pState = State_Stopped;
- return S_OK;
- }
-
- ret = gst_element_get_state(This->container, &now, &pending, dwMilliSecsTimeout == INFINITE ? -1 : dwMilliSecsTimeout * 1000);
-
- if (ret == GST_STATE_CHANGE_ASYNC)
- hr = VFW_S_STATE_INTERMEDIATE;
- else
- pending = now;
-
- switch (pending) {
- case GST_STATE_PAUSED: *pState = State_Paused; return hr;
- case GST_STATE_PLAYING: *pState = State_Running; return hr;
- default: *pState = State_Stopped; return hr;
- }
-}
-
static const IBaseFilterVtbl GST_Vtbl = {
BaseFilterImpl_QueryInterface,
BaseFilterImpl_AddRef,
BaseFilterImpl_Release,
BaseFilterImpl_GetClassID,
- GST_Stop,
- GST_Pause,
- GST_Run,
- GST_GetState,
+ BaseFilterImpl_Stop,
+ BaseFilterImpl_Pause,
+ BaseFilterImpl_Run,
+ BaseFilterImpl_GetState,
BaseFilterImpl_SetSyncSource,
BaseFilterImpl_GetSyncSource,
BaseFilterImpl_EnumPins,
@@ -2631,6 +2615,11 @@ static const struct strmbase_filter_ops mpeg_splitter_ops =
.filter_query_interface = mpeg_splitter_query_interface,
.filter_get_pin = gstdemux_get_pin,
.filter_destroy = gstdemux_destroy,
+ .filter_init_stream = gstdemux_init_stream,
+ .filter_start_stream = gstdemux_start_stream,
+ .filter_stop_stream = gstdemux_stop_stream,
+ .filter_cleanup_stream = gstdemux_cleanup_stream,
+ .filter_wait_state = gstdemux_wait_state,
};
IUnknown * CALLBACK mpeg_splitter_create(IUnknown *outer, HRESULT *phr)
--
2.24.0
Dec. 3, 2019
[PATCH v2 3/4] winegstreamer: Also wait for the no-more-pads signal when pausing the filter.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/winegstreamer/gstdemux.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c
index f5be9f6c10..93d63106f7 100644
--- a/dlls/winegstreamer/gstdemux.c
+++ b/dlls/winegstreamer/gstdemux.c
@@ -1430,8 +1430,17 @@ static HRESULT WINAPI GST_Run(IBaseFilter *iface, REFERENCE_TIME tStart)
}
EnterCriticalSection(&This->filter.csFilter);
+
+ if (This->no_more_pads_event)
+ ResetEvent(This->no_more_pads_event);
+
gst_element_set_state(This->container, GST_STATE_PLAYING);
+ /* Make sure that all of our pads are connected before returning, lest we
+ * e.g. try to seek and fail. */
+ if (This->no_more_pads_event)
+ WaitForSingleObject(This->no_more_pads_event, INFINITE);
+
for (i = 0; i < This->cStreams; i++) {
hr = BaseOutputPinImpl_Active(&This->ppPins[i]->pin);
if (SUCCEEDED(hr)) {
--
2.24.0
Dec. 3, 2019
[PATCH v2 2/4] winegstreamer: Don't hold the filter lock from the pad-added callback.
by Zebediah Figura
This may be called from the streaming thread, so it's not safe to do so.
Nor does it seem necessary. We expect that no streaming thread should ever
call methods on our pad or pin, and as long as we hold the filter lock and
wait for the no-more-pads signal when connecting or starting the stream, we
cannot race with application threads.
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/winegstreamer/gstdemux.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c
index 5fa9d66c93..f5be9f6c10 100644
--- a/dlls/winegstreamer/gstdemux.c
+++ b/dlls/winegstreamer/gstdemux.c
@@ -971,7 +971,6 @@ static void existing_new_pad(GstElement *bin, GstPad *pad, gpointer user)
return;
}
- EnterCriticalSection(&This->filter.csFilter);
for (x = 0; x < This->cStreams; ++x) {
struct gstdemux_source *pin = This->ppPins[x];
if (!pin->their_src) {
@@ -986,13 +985,11 @@ static void existing_new_pad(GstElement *bin, GstPad *pad, gpointer user)
pin->their_src = pad;
gst_object_ref(pin->their_src);
TRACE("Relinked\n");
- LeaveCriticalSection(&This->filter.csFilter);
return;
}
}
}
init_new_decoded_pad(bin, pad, This);
- LeaveCriticalSection(&This->filter.csFilter);
}
static gboolean query_function(GstPad *pad, GstObject *parent, GstQuery *query)
--
2.24.0
Dec. 3, 2019
[PATCH v2 1/4] strmbase: Use a separate critical section for the SourceSeeking structure.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/strmbase/seeking.c | 53 +++++++++++++++++++--------------
dlls/winegstreamer/gstdemux.c | 5 ++--
dlls/wineqtdecoder/qtsplitter.c | 3 +-
include/wine/strmbase.h | 7 +++--
4 files changed, 40 insertions(+), 28 deletions(-)
diff --git a/dlls/strmbase/seeking.c b/dlls/strmbase/seeking.c
index 8a773b51d5..d87e4f8516 100644
--- a/dlls/strmbase/seeking.c
+++ b/dlls/strmbase/seeking.c
@@ -18,7 +18,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-/* FIXME: critical sections */
#include "strmbase_private.h"
@@ -29,7 +28,9 @@ static inline SourceSeeking *impl_from_IMediaSeeking(IMediaSeeking *iface)
return CONTAINING_RECORD(iface, SourceSeeking, IMediaSeeking_iface);
}
-HRESULT SourceSeeking_Init(SourceSeeking *pSeeking, const IMediaSeekingVtbl *Vtbl, SourceSeeking_ChangeStop fnChangeStop, SourceSeeking_ChangeStart fnChangeStart, SourceSeeking_ChangeRate fnChangeRate, PCRITICAL_SECTION crit_sect)
+HRESULT strmbase_seeking_init(SourceSeeking *pSeeking, const IMediaSeekingVtbl *Vtbl,
+ SourceSeeking_ChangeStop fnChangeStop, SourceSeeking_ChangeStart fnChangeStart,
+ SourceSeeking_ChangeRate fnChangeRate)
{
assert(fnChangeStop && fnChangeStart && fnChangeRate);
@@ -48,10 +49,16 @@ HRESULT SourceSeeking_Init(SourceSeeking *pSeeking, const IMediaSeekingVtbl *Vtb
pSeeking->llDuration = pSeeking->llStop;
pSeeking->dRate = 1.0;
pSeeking->timeformat = TIME_FORMAT_MEDIA_TIME;
- pSeeking->crst = crit_sect;
+ InitializeCriticalSection(&pSeeking->cs);
+ pSeeking->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SourceSeeking.cs");
return S_OK;
}
+void strmbase_seeking_cleanup(SourceSeeking *seeking)
+{
+ DeleteCriticalSection(&seeking->cs);
+}
+
HRESULT WINAPI SourceSeekingImpl_GetCapabilities(IMediaSeeking * iface, DWORD * pCapabilities)
{
SourceSeeking *This = impl_from_IMediaSeeking(iface);
@@ -104,9 +111,9 @@ HRESULT WINAPI SourceSeekingImpl_GetTimeFormat(IMediaSeeking * iface, GUID * pFo
SourceSeeking *This = impl_from_IMediaSeeking(iface);
TRACE("(%s)\n", debugstr_guid(pFormat));
- EnterCriticalSection(This->crst);
+ EnterCriticalSection(&This->cs);
*pFormat = This->timeformat;
- LeaveCriticalSection(This->crst);
+ LeaveCriticalSection(&This->cs);
return S_OK;
}
@@ -118,10 +125,10 @@ HRESULT WINAPI SourceSeekingImpl_IsUsingTimeFormat(IMediaSeeking * iface, const
TRACE("(%s)\n", debugstr_guid(pFormat));
- EnterCriticalSection(This->crst);
+ EnterCriticalSection(&This->cs);
if (!IsEqualIID(pFormat, &This->timeformat))
hr = S_FALSE;
- LeaveCriticalSection(This->crst);
+ LeaveCriticalSection(&This->cs);
return hr;
}
@@ -140,9 +147,9 @@ HRESULT WINAPI SourceSeekingImpl_GetDuration(IMediaSeeking * iface, LONGLONG * p
TRACE("(%p)\n", pDuration);
- EnterCriticalSection(This->crst);
+ EnterCriticalSection(&This->cs);
*pDuration = This->llDuration;
- LeaveCriticalSection(This->crst);
+ LeaveCriticalSection(&This->cs);
return S_OK;
}
@@ -153,9 +160,9 @@ HRESULT WINAPI SourceSeekingImpl_GetStopPosition(IMediaSeeking * iface, LONGLONG
TRACE("(%p)\n", pStop);
- EnterCriticalSection(This->crst);
+ EnterCriticalSection(&This->cs);
*pStop = This->llStop;
- LeaveCriticalSection(This->crst);
+ LeaveCriticalSection(&This->cs);
return S_OK;
}
@@ -167,9 +174,9 @@ HRESULT WINAPI SourceSeekingImpl_GetCurrentPosition(IMediaSeeking * iface, LONGL
TRACE("(%p)\n", pCurrent);
- EnterCriticalSection(This->crst);
+ EnterCriticalSection(&This->cs);
*pCurrent = This->llCurrent;
- LeaveCriticalSection(This->crst);
+ LeaveCriticalSection(&This->cs);
return S_OK;
}
@@ -214,7 +221,7 @@ HRESULT WINAPI SourceSeekingImpl_SetPositions(IMediaSeeking * iface, LONGLONG *
LONGLONG llNewCurrent, llNewStop;
TRACE("(%p, %x, %p, %x)\n", pCurrent, dwCurrentFlags, pStop, dwStopFlags);
- EnterCriticalSection(This->crst);
+ EnterCriticalSection(&This->cs);
llNewCurrent = Adjust(This->llCurrent, pCurrent, dwCurrentFlags);
llNewStop = Adjust(This->llStop, pStop, dwStopFlags);
@@ -233,7 +240,7 @@ HRESULT WINAPI SourceSeekingImpl_SetPositions(IMediaSeeking * iface, LONGLONG *
*pCurrent = llNewCurrent;
if (pStop && (dwStopFlags & AM_SEEKING_ReturnTime))
*pStop = llNewStop;
- LeaveCriticalSection(This->crst);
+ LeaveCriticalSection(&This->cs);
if (bChangeCurrent)
This->fnChangeStart(iface);
@@ -249,10 +256,10 @@ HRESULT WINAPI SourceSeekingImpl_GetPositions(IMediaSeeking * iface, LONGLONG *
TRACE("(%p, %p)\n", pCurrent, pStop);
- EnterCriticalSection(This->crst);
+ EnterCriticalSection(&This->cs);
IMediaSeeking_GetCurrentPosition(iface, pCurrent);
IMediaSeeking_GetStopPosition(iface, pStop);
- LeaveCriticalSection(This->crst);
+ LeaveCriticalSection(&This->cs);
return S_OK;
}
@@ -263,10 +270,10 @@ HRESULT WINAPI SourceSeekingImpl_GetAvailable(IMediaSeeking * iface, LONGLONG *
TRACE("(%p, %p)\n", pEarliest, pLatest);
- EnterCriticalSection(This->crst);
+ EnterCriticalSection(&This->cs);
*pEarliest = 0;
*pLatest = This->llDuration;
- LeaveCriticalSection(This->crst);
+ LeaveCriticalSection(&This->cs);
return S_OK;
}
@@ -285,11 +292,11 @@ HRESULT WINAPI SourceSeekingImpl_SetRate(IMediaSeeking * iface, double dRate)
return VFW_E_UNSUPPORTED_AUDIO;
}
- EnterCriticalSection(This->crst);
+ EnterCriticalSection(&This->cs);
This->dRate = dRate;
if (bChangeRate)
hr = This->fnChangeRate(iface);
- LeaveCriticalSection(This->crst);
+ LeaveCriticalSection(&This->cs);
return hr;
}
@@ -300,10 +307,10 @@ HRESULT WINAPI SourceSeekingImpl_GetRate(IMediaSeeking * iface, double * dRate)
TRACE("(%p)\n", dRate);
- EnterCriticalSection(This->crst);
+ EnterCriticalSection(&This->cs);
/* Forward? */
*dRate = This->dRate;
- LeaveCriticalSection(This->crst);
+ LeaveCriticalSection(&This->cs);
return S_OK;
}
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c
index 479077b48f..5fa9d66c93 100644
--- a/dlls/winegstreamer/gstdemux.c
+++ b/dlls/winegstreamer/gstdemux.c
@@ -1884,6 +1884,7 @@ static void free_source_pin(struct gstdemux_source *pin)
FreeMediaType(&pin->mt);
gst_segment_free(pin->segment);
+ strmbase_seeking_cleanup(&pin->seek);
strmbase_source_cleanup(&pin->pin);
heap_free(pin);
}
@@ -1936,8 +1937,8 @@ static struct gstdemux_source *create_pin(struct gstdemux *filter, const WCHAR *
pin->segment = gst_segment_new();
gst_segment_init(pin->segment, GST_FORMAT_TIME);
pin->IQualityControl_iface.lpVtbl = &GSTOutPin_QualityControl_Vtbl;
- SourceSeeking_Init(&pin->seek, &GST_Seeking_Vtbl, GST_ChangeStop,
- GST_ChangeCurrent, GST_ChangeRate, &filter->filter.csFilter);
+ strmbase_seeking_init(&pin->seek, &GST_Seeking_Vtbl, GST_ChangeStop,
+ GST_ChangeCurrent, GST_ChangeRate);
BaseFilterImpl_IncrementPinVersion(&filter->filter);
sprintf(pad_name, "qz_sink_%u", filter->cStreams);
diff --git a/dlls/wineqtdecoder/qtsplitter.c b/dlls/wineqtdecoder/qtsplitter.c
index fbec10a912..81e18d3420 100644
--- a/dlls/wineqtdecoder/qtsplitter.c
+++ b/dlls/wineqtdecoder/qtsplitter.c
@@ -340,7 +340,8 @@ IUnknown * CALLBACK QTSplitter_create(IUnknown *outer, HRESULT *phr)
This->pInputPin.pin.peer = NULL;
This->pInputPin.pin.pFuncsTable = &sink_ops;
- SourceSeeking_Init(&This->sourceSeeking, &QT_Seeking_Vtbl, QTSplitter_ChangeStop, QTSplitter_ChangeStart, QTSplitter_ChangeRate, &This->filter.csFilter);
+ strmbase_seeking_init(&This->sourceSeeking, &QT_Seeking_Vtbl,
+ QTSplitter_ChangeStop, QTSplitter_ChangeStart, QTSplitter_ChangeRate);
*phr = S_OK;
return &This->filter.IUnknown_inner;
diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h
index b08303f93d..7949e6670a 100644
--- a/include/wine/strmbase.h
+++ b/include/wine/strmbase.h
@@ -272,10 +272,13 @@ typedef struct SourceSeeking
double dRate;
LONGLONG llCurrent, llStop, llDuration;
GUID timeformat;
- PCRITICAL_SECTION crst;
+ CRITICAL_SECTION cs;
} SourceSeeking;
-HRESULT SourceSeeking_Init(SourceSeeking *pSeeking, const IMediaSeekingVtbl *Vtbl, SourceSeeking_ChangeStop fnChangeStop, SourceSeeking_ChangeStart fnChangeStart, SourceSeeking_ChangeRate fnChangeRate, PCRITICAL_SECTION crit_sect);
+HRESULT strmbase_seeking_init(SourceSeeking *seeking, const IMediaSeekingVtbl *vtbl,
+ SourceSeeking_ChangeStop fnChangeStop, SourceSeeking_ChangeStart fnChangeStart,
+ SourceSeeking_ChangeRate fnChangeRate);
+void strmbase_seeking_cleanup(SourceSeeking *seeking);
HRESULT WINAPI SourceSeekingImpl_GetCapabilities(IMediaSeeking * iface, DWORD * pCapabilities);
HRESULT WINAPI SourceSeekingImpl_CheckCapabilities(IMediaSeeking * iface, DWORD * pCapabilities);
--
2.24.0
Dec. 3, 2019
[PATCH resend] shell32: Symlink the Downloads and Templates folders too
by Alex Henrie
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
---
I recently wanted to try out the Windows version of Avidemux on a file
I had just downloaded from the web, and Avidemux's Open dialog defaulted
to C:\Users\alex, but when I double-clicked Downloads it was empty.
---
dlls/shell32/shellpath.c | 52 ++++++++++++++++++++++++++--------------
1 file changed, 34 insertions(+), 18 deletions(-)
diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c
index d9d65cbaed..06be794812 100644
--- a/dlls/shell32/shellpath.c
+++ b/dlls/shell32/shellpath.c
@@ -4366,6 +4366,12 @@ static inline BOOL _SHAppendToUnixPath(char *szBasePath, LPCWSTR pwszSubPath) {
case IDS_MYVIDEOS:
lstrcpyW(wszSubPath, My_VideosW);
break;
+ case IDS_DOWNLOADS:
+ lstrcpyW(wszSubPath, DownloadsW);
+ break;
+ case IDS_TEMPLATES:
+ lstrcpyW(wszSubPath, TemplatesW);
+ break;
default:
ERR("LoadString(%d) failed!\n", LOWORD(pwszSubPath));
return FALSE;
@@ -4392,21 +4398,21 @@ static inline BOOL _SHAppendToUnixPath(char *szBasePath, LPCWSTR pwszSubPath) {
/******************************************************************************
* _SHCreateSymbolicLinks [Internal]
*
- * Sets up symbol links for various shell folders to point into the users home
+ * Sets up symbol links for various shell folders to point into the user's home
* directory. We do an educated guess about what the user would probably want:
* - If there is a 'My Documents' directory in $HOME, the user probably wants
- * wine's 'My Documents' to point there. Furthermore, we imply that the user
- * is a Windows lover and has no problem with wine creating 'My Pictures',
- * 'My Music' and 'My Videos' subfolders under '$HOME/My Documents', if those
- * do not already exits. We put appropriate symbolic links in place for those,
- * too.
+ * wine's 'My Documents' to point there. Furthermore, we infer that the user
+ * is a Windows lover and has no problem with wine creating subfolders for
+ * 'My Pictures', 'My Music', 'My Videos' etc. under '$HOME/My Documents', if
+ * those do not already exist. We put appropriate symbolic links in place for
+ * those, too.
* - If there is no 'My Documents' directory in $HOME, we let 'My Documents'
* point directly to $HOME. We assume the user to be a unix hacker who does not
* want wine to create anything anywhere besides the .wine directory. So, if
* there already is a 'My Music' directory in $HOME, we symlink the 'My Music'
* shell folder to it. But if not, then we check XDG_MUSIC_DIR - "well known"
* directory, and try to link to that. If that fails, then we symlink to
- * $HOME directly. The same holds fo 'My Pictures' and 'My Videos'.
+ * $HOME directly. The same holds for 'My Pictures', 'My Videos' etc.
* - The Desktop shell folder is symlinked to XDG_DESKTOP_DIR. If that does not
* exist, then we try '$HOME/Desktop'. If that does not exist, then we leave
* it alone.
@@ -4414,10 +4420,18 @@ static inline BOOL _SHAppendToUnixPath(char *szBasePath, LPCWSTR pwszSubPath) {
*/
static void _SHCreateSymbolicLinks(void)
{
- UINT aidsMyStuff[] = { IDS_MYPICTURES, IDS_MYVIDEOS, IDS_MYMUSIC }, i;
- const WCHAR* MyOSXStuffW[] = { PicturesW, MoviesW, MusicW };
- int acsidlMyStuff[] = { CSIDL_MYPICTURES, CSIDL_MYVIDEO, CSIDL_MYMUSIC };
- static const char * const xdg_dirs[] = { "PICTURES", "VIDEOS", "MUSIC", "DOCUMENTS", "DESKTOP" };
+ static const UINT aidsMyStuff[] = {
+ IDS_MYPICTURES, IDS_MYVIDEOS, IDS_MYMUSIC, IDS_DOWNLOADS, IDS_TEMPLATES
+ };
+ static const WCHAR * const MyOSXStuffW[] = {
+ PicturesW, MoviesW, MusicW, DownloadsW, TemplatesW
+ };
+ static const int acsidlMyStuff[] = {
+ CSIDL_MYPICTURES, CSIDL_MYVIDEO, CSIDL_MYMUSIC, CSIDL_DOWNLOADS, CSIDL_TEMPLATES
+ };
+ static const char * const xdg_dirs[] = {
+ "PICTURES", "VIDEOS", "MUSIC", "DOWNLOAD", "TEMPLATES", "DOCUMENTS", "DESKTOP"
+ };
static const unsigned int num = ARRAY_SIZE(xdg_dirs);
WCHAR wszTempPath[MAX_PATH];
char szPersonalTarget[FILENAME_MAX], *pszPersonal;
@@ -4428,6 +4442,7 @@ static void _SHCreateSymbolicLinks(void)
HRESULT hr;
char ** xdg_results;
char * xdg_desktop_dir;
+ UINT i;
/* Create all necessary profile sub-dirs up to 'My Documents' and get the unix path. */
hr = SHGetFolderPathW(NULL, CSIDL_PERSONAL|CSIDL_FLAG_CREATE, NULL,
@@ -4449,9 +4464,9 @@ static void _SHCreateSymbolicLinks(void)
if (_SHAppendToUnixPath(szPersonalTarget, MAKEINTRESOURCEW(IDS_PERSONAL)) &&
!stat(szPersonalTarget, &statFolder) && S_ISDIR(statFolder.st_mode))
{
- /* '$HOME/My Documents' exists. Create 'My Pictures',
- * 'My Videos' and 'My Music' subfolders or fail silently if
- * they already exist.
+ /* '$HOME/My Documents' exists. Create subfolders for
+ * 'My Pictures', 'My Videos', 'My Music' etc. or fail silently
+ * if they already exist.
*/
for (i = 0; i < ARRAY_SIZE(aidsMyStuff); i++)
{
@@ -4489,8 +4504,9 @@ static void _SHCreateSymbolicLinks(void)
}
else
{
- /* '$HOME' doesn't exist. Create 'My Pictures', 'My Videos' and 'My Music' subdirs
- * in '%USERPROFILE%\\My Documents' or fail silently if they already exist. */
+ /* '$HOME' doesn't exist. Create subdirs for 'My Pictures', 'My Videos',
+ * 'My Music' etc. in '%USERPROFILE%\My Documents' or fail silently if
+ * they already exist. */
pszHome = NULL;
strcpy(szPersonalTarget, pszPersonal);
for (i = 0; i < ARRAY_SIZE(aidsMyStuff); i++) {
@@ -4500,7 +4516,7 @@ static void _SHCreateSymbolicLinks(void)
}
}
- /* Create symbolic links for 'My Pictures', 'My Videos' and 'My Music'. */
+ /* Create symbolic links for 'My Pictures', 'My Videos', 'My Music' etc. */
for (i=0; i < ARRAY_SIZE(aidsMyStuff); i++)
{
/* Create the current 'My Whatever' folder and get its unix path. */
@@ -6136,7 +6152,7 @@ HRESULT SHELL_RegisterShellFolders(void)
HRESULT hr;
/* Set up '$HOME' targeted symlinks for 'My Documents', 'My Pictures',
- * 'My Videos', 'My Music' and 'Desktop' in advance, so that the
+ * 'My Videos', 'My Music', 'Desktop' etc. in advance, so that the
* _SHRegister*ShellFolders() functions will find everything nice and clean
* and thus will not attempt to create them in the profile directory. */
_SHCreateSymbolicLinks();
--
2.24.0
Dec. 3, 2019
[PATCH] dmime: Remove the 'enabled' field from the Tempo track
by Michael Stefaniuc
The track GetParam/SetParam methods are enabled in the segment and that
information is stored in the segment state not in the track.
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/dmime/tempotrack.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/dlls/dmime/tempotrack.c b/dlls/dmime/tempotrack.c
index 7aff40dbfd..6038f7ce9f 100644
--- a/dlls/dmime/tempotrack.c
+++ b/dlls/dmime/tempotrack.c
@@ -33,7 +33,6 @@ typedef struct IDirectMusicTempoTrack {
IDirectMusicTrack8 IDirectMusicTrack8_iface;
struct dmobject dmobj; /* IPersistStream only */
LONG ref;
- BOOL enabled;
struct list Items;
} IDirectMusicTempoTrack;
@@ -174,9 +173,6 @@ static HRESULT WINAPI tempo_track_GetParam(IDirectMusicTrack8 *iface, REFGUID rg
if (FAILED(hr)) {
return hr;
}
- if (FALSE == This->enabled) {
- return DMUS_E_TYPE_DISABLED;
- }
if (NULL != pmtNext) *pmtNext = 0;
prm->mtTime = 0;
@@ -224,9 +220,6 @@ static HRESULT WINAPI tempo_track_IsParamSupported(IDirectMusicTrack8 *iface, RE
TRACE("param supported\n");
return S_OK;
}
- if (FALSE == This->enabled) {
- return DMUS_E_TYPE_DISABLED;
- }
TRACE("param unsupported\n");
return DMUS_E_TYPE_UNSUPPORTED;
}
@@ -405,7 +398,6 @@ HRESULT WINAPI create_dmtempotrack(REFIID lpcGUID, void **ppobj)
dmobject_init(&track->dmobj, &CLSID_DirectMusicTempoTrack,
(IUnknown *)&track->IDirectMusicTrack8_iface);
track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
- track->enabled = TRUE;
list_init(&track->Items);
DMIME_LockModule();
--
2.23.0
Dec. 3, 2019
Re: [PATCH] winemac.drv: Also stop dragging if we receive a mouse up event.
by Ken Thomases
Signed-off-by: Ken Thomases <ken(a)codeweavers.com>
Dec. 2, 2019
Re: [PATCH v2 3/3] kernelbase: Autoset GeoID on process launch.
by João Diogo Ferreira
Forgot the bug line.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46196
(Full fix: fixes the country flags in the UI and would mostly fix
the crashes, even without the previous patch.)
A segunda-feira, 2 de dezembro de 2019 21:39:54 WET João Diogo Ferreira escreveu:
> Wine-bug: https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.wine…
> Signed-off-by: João Diogo Craveiro Ferreira <devilj(a)outlook.pt>
> ---
> V2: Also set GeoID if it is currently unset regardless of LANG change.
> Supersedes: 174357
> ---
> dlls/kernelbase/locale.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c
> index 9bc3cfe80e..97f7a45b98 100644
> --- a/dlls/kernelbase/locale.c
> +++ b/dlls/kernelbase/locale.c
> @@ -238,6 +238,8 @@ void init_locale(void)
> UINT ansi_cp = 0, oem_cp = 0;
> USHORT *ansi_ptr, *oem_ptr, *casemap_ptr;
> LCID lcid = GetUserDefaultLCID();
> + GEOID geoid = GEOID_NOT_AVAILABLE;
> + GEOCLASS geoclass;
> WCHAR bufferW[80];
> DWORD count, i;
> SIZE_T size;
> @@ -268,6 +270,13 @@ void init_locale(void)
> RegCreateKeyExW( HKEY_CURRENT_USER, L"Control Panel\\International",
> 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &intl_key, NULL );
>
> + GetLocaleInfoW( LOCALE_USER_DEFAULT, LOCALE_IGEOID | LOCALE_RETURN_NUMBER,
> + (WCHAR *)&geoid, sizeof(geoid)/sizeof(WCHAR) );
> +
> + geoclass = GetGeoInfoW(geoid, GEO_NATION, NULL, 0, 0) ? GEOCLASS_NATION : GEOCLASS_REGION;
> + if (GetUserGeoID(geoclass) == 39070)
> + SetUserGeoID(geoid);
> +
> /* Update registry contents if the user locale has changed.
> * This simulates the action of the Windows control panel. */
>
> @@ -290,6 +299,8 @@ void init_locale(void)
> (BYTE *)bufferW, (lstrlenW(bufferW) + 1) * sizeof(WCHAR) );
> }
>
> + SetUserGeoID(geoid);
> +
> if (!RegCreateKeyExW( nls_key, L"Codepage",
> 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL ))
> {
> --
> 2.24.0
>
>
Dec. 2, 2019
Re: [PATCH v2 2/3] kernel32: Make GetUserGeoID() always succeed if geoclass is valid.
by João Diogo Ferreira
Forgot the bug line.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46196
(Partial fix: fixes the crashing, but not the country flag in the UI.)
A segunda-feira, 2 de dezembro de 2019 21:39:52 WET João Diogo Ferreira escreveu:
> When a GeoID for the requested class is not yet set, Windows 10 v1709+
> returns 39070 ("World") as default.
> This means that native Win32 applications can no longer be reliably
> tested against GEOID_NOT_AVAILABLE, leading to bugs when running them
> under Wine.
>
> While it's true that we're going to set the ID automatically anyway,
> we only set one of the classes depending on the locale.
> This patch makes sure every class returns a good GeoID in all cases.
>
> Signed-off-by: João Diogo Craveiro Ferreira <devilj(a)outlook.pt>
> ---
> This is for a single edge case and I don't know if it'll ever happen.
> ---
> dlls/kernel32/locale.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
> index 7d79cee0c3..52b9a53a80 100644
> --- a/dlls/kernel32/locale.c
> +++ b/dlls/kernel32/locale.c
> @@ -2812,7 +2812,7 @@ static const struct geoinfo_t *get_geoinfo_dataptr(GEOID geoid)
> */
> GEOID WINAPI GetUserGeoID(GEOCLASS geoclass)
> {
> - GEOID ret = GEOID_NOT_AVAILABLE;
> + GEOID ret = 39070;
> static const WCHAR geoW[] = {'G','e','o',0};
> static const WCHAR nationW[] = {'N','a','t','i','o','n',0};
> static const WCHAR regionW[] = {'R','e','g','i','o','n',0};
> @@ -2833,7 +2833,7 @@ GEOID WINAPI GetUserGeoID(GEOCLASS geoclass)
> break;
> default:
> WARN("Unknown geoclass %d\n", geoclass);
> - return ret;
> + return GEOID_NOT_AVAILABLE;
> }
>
> if (!(hkey = create_registry_key())) return ret;
> --
> 2.24.0
>
>
Dec. 2, 2019
[PATCH v2 3/3] kernelbase: Autoset GeoID on process launch.
by João Diogo Ferreira
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=46196
Signed-off-by: João Diogo Craveiro Ferreira <devilj(a)outlook.pt>
---
V2: Also set GeoID if it is currently unset regardless of LANG change.
Supersedes: 174357
---
dlls/kernelbase/locale.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c
index 9bc3cfe80e..97f7a45b98 100644
--- a/dlls/kernelbase/locale.c
+++ b/dlls/kernelbase/locale.c
@@ -238,6 +238,8 @@ void init_locale(void)
UINT ansi_cp = 0, oem_cp = 0;
USHORT *ansi_ptr, *oem_ptr, *casemap_ptr;
LCID lcid = GetUserDefaultLCID();
+ GEOID geoid = GEOID_NOT_AVAILABLE;
+ GEOCLASS geoclass;
WCHAR bufferW[80];
DWORD count, i;
SIZE_T size;
@@ -268,6 +270,13 @@ void init_locale(void)
RegCreateKeyExW( HKEY_CURRENT_USER, L"Control Panel\\International",
0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &intl_key, NULL );
+ GetLocaleInfoW( LOCALE_USER_DEFAULT, LOCALE_IGEOID | LOCALE_RETURN_NUMBER,
+ (WCHAR *)&geoid, sizeof(geoid)/sizeof(WCHAR) );
+
+ geoclass = GetGeoInfoW(geoid, GEO_NATION, NULL, 0, 0) ? GEOCLASS_NATION : GEOCLASS_REGION;
+ if (GetUserGeoID(geoclass) == 39070)
+ SetUserGeoID(geoid);
+
/* Update registry contents if the user locale has changed.
* This simulates the action of the Windows control panel. */
@@ -290,6 +299,8 @@ void init_locale(void)
(BYTE *)bufferW, (lstrlenW(bufferW) + 1) * sizeof(WCHAR) );
}
+ SetUserGeoID(geoid);
+
if (!RegCreateKeyExW( nls_key, L"Codepage",
0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL ))
{
--
2.24.0
Dec. 2, 2019
[PATCH v2 2/3] kernel32: Make GetUserGeoID() always succeed if geoclass is valid.
by João Diogo Ferreira
When a GeoID for the requested class is not yet set, Windows 10 v1709+
returns 39070 ("World") as default.
This means that native Win32 applications can no longer be reliably
tested against GEOID_NOT_AVAILABLE, leading to bugs when running them
under Wine.
While it's true that we're going to set the ID automatically anyway,
we only set one of the classes depending on the locale.
This patch makes sure every class returns a good GeoID in all cases.
Signed-off-by: João Diogo Craveiro Ferreira <devilj(a)outlook.pt>
---
This is for a single edge case and I don't know if it'll ever happen.
---
dlls/kernel32/locale.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
index 7d79cee0c3..52b9a53a80 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -2812,7 +2812,7 @@ static const struct geoinfo_t *get_geoinfo_dataptr(GEOID geoid)
*/
GEOID WINAPI GetUserGeoID(GEOCLASS geoclass)
{
- GEOID ret = GEOID_NOT_AVAILABLE;
+ GEOID ret = 39070;
static const WCHAR geoW[] = {'G','e','o',0};
static const WCHAR nationW[] = {'N','a','t','i','o','n',0};
static const WCHAR regionW[] = {'R','e','g','i','o','n',0};
@@ -2833,7 +2833,7 @@ GEOID WINAPI GetUserGeoID(GEOCLASS geoclass)
break;
default:
WARN("Unknown geoclass %d\n", geoclass);
- return ret;
+ return GEOID_NOT_AVAILABLE;
}
if (!(hkey = create_registry_key())) return ret;
--
2.24.0
Dec. 2, 2019
[PATCH v2 1/3] kernel32: Properly handle GEO_NATION in GetGeoInfoW(), handle GEO_ID.
by João Diogo Ferreira
GEO_NATION only returns positive if the location itself is of type
GEOCLASS_NATION. This seems to be true for every Windows version.
GEO_ID, which was added in Windows 10, does return positive for all
location types.
Signed-off-by: João Diogo Craveiro Ferreira <devilj(a)outlook.pt>
---
Supersedes: 174379
(This one's not as thorough, but it's the minimum necessary for now.)
How complicated and nuanced can one make an API comprised entirely of
four functions and two variables?
---
dlls/kernel32/locale.c | 31 ++++++++++++++++++++++++++++
dlls/kernel32/tests/locale.c | 40 ++++++++++++++++++++++++++++++++----
2 files changed, 67 insertions(+), 4 deletions(-)
diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
index b062d7ef73..7d79cee0c3 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -2910,6 +2910,34 @@ BOOL WINAPI SetUserGeoID(GEOID geoid)
/******************************************************************************
* GetGeoInfoW (KERNEL32.@)
+ *
+ * Retrieves information about a geographic location by its GeoID.
+ *
+ * PARAMS
+ * geoid [I] The GeoID of the location of interest.
+ * geotype [I] The type of information to be retrieved (SYSGEOTYPE enum from "winnls.h").
+ * data [O] The output buffer to store the information.
+ * data_len [I] The length of the buffer, measured in WCHARs and including the null terminator.
+ * lang [I] Language identifier. Must be 0 unless geotype is GEO_RFC1766 or GEO_LCID.
+ *
+ * RETURNS
+ * Success: The number of WCHARs (including null) written to the buffer -or-
+ * if no buffer was provided, the minimum length required to hold the full data.
+ * Failure: Zero. Call GetLastError() to determine the cause.
+ *
+ * NOTES
+ * On failure, GetLastError() will return one of the following values:
+ * - ERROR_INVALID_PARAMETER: the GeoID provided was invalid.
+ * - ERROR_INVALID_FLAGS: the specified geotype was invalid.
+ * - ERROR_INSUFFICIENT_BUFFER: the provided buffer was too small to hold the full data.
+ * - ERROR_CALL_NOT_IMPLEMENTED: (Wine implementation) we don't handle that geotype yet.
+ *
+ * The list of available GeoIDs can be retrieved with EnumSystemGeoID(),
+ * or call GetUserGeoID() to retrieve the user's current location.
+ *
+ * TODO
+ * Currently, we only handle the following geotypes: GEO_ID, GEO_ISO2, GEO_ISO3,
+ * GEO_ISO_UN_NUMBER, GEO_PARENT and GEO_NATION.
*/
INT WINAPI GetGeoInfoW(GEOID geoid, GEOTYPE geotype, LPWSTR data, int data_len, LANGID lang)
{
@@ -2928,6 +2956,9 @@ INT WINAPI GetGeoInfoW(GEOID geoid, GEOTYPE geotype, LPWSTR data, int data_len,
switch (geotype) {
case GEO_NATION:
+ if (ptr->kind != LOCATION_NATION) return 0;
+ /* fall through */
+ case GEO_ID:
sprintfW(buffW, fmtW, ptr->id);
break;
case GEO_ISO_UN_NUMBER:
diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c
index ee38dc36ac..de1d4fca22 100644
--- a/dlls/kernel32/tests/locale.c
+++ b/dlls/kernel32/tests/locale.c
@@ -4984,11 +4984,43 @@ static void test_GetGeoInfo(void)
ok(!strcmp(buffA, "RU"), "got %s\n", buffA);
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %d\n", GetLastError());
- /* GEO_NATION returns GEOID in a string form */
+ /* GEO_NATION returns GEOID in a string form, but only for GEOCLASS_NATION-type IDs */
+ ret = pGetGeoInfoA(203, GEO_NATION, buffA, 20, 0); /* GEOCLASS_NATION */
+ ok(ret == 4, "GEO_NATION of nation: expected 4, got %d\n", ret);
+ ok(!strcmp(buffA, "203"), "GEO_NATION of nation: expected 203, got %s\n", buffA);
+
buffA[0] = 0;
- ret = pGetGeoInfoA(203, GEO_NATION, buffA, 20, 0);
- ok(ret == 4, "got %d\n", ret);
- ok(!strcmp(buffA, "203"), "got %s\n", buffA);
+ ret = pGetGeoInfoA(39070, GEO_NATION, buffA, 20, 0); /* GEOCLASS_REGION */
+ ok(ret == 0, "GEO_NATION of region: expected 0, got %d\n", ret);
+ ok(*buffA == 0, "GEO_NATION of region: expected empty string, got %s\n", buffA);
+
+ buffA[0] = 0;
+ ret = pGetGeoInfoA(333, GEO_NATION, buffA, 20, 0); /* LOCATION_BOTH internal Wine type */
+ ok(ret == 0 ||
+ broken(ret == 4) /* Win7 and older */,
+ "GEO_NATION of LOCATION_BOTH: expected 0, got %d\n", ret);
+ ok(*buffA == 0 ||
+ broken(!strcmp(buffA, "333")) /* Win7 and older */,
+ "GEO_NATION of LOCATION_BOTH: expected empty string, got %s\n", buffA);
+
+ /* GEO_ID is like GEO_NATION but works for any ID */
+ buffA[0] = 0;
+ ret = pGetGeoInfoA(203, GEO_ID, buffA, 20, 0); /* GEOCLASS_NATION */
+ if (ret == 0)
+ win_skip("GEO_ID not supported.\n");
+ else
+ {
+ ok(ret == 4, "GEO_ID: expected 4, got %d\n", ret);
+ ok(!strcmp(buffA, "203"), "GEO_ID: expected 203, got %s\n", buffA);
+
+ ret = pGetGeoInfoA(47610, GEO_ID, buffA, 20, 0); /* GEOCLASS_REGION */
+ ok(ret == 6, "got %d\n", ret);
+ ok(!strcmp(buffA, "47610"), "got %s\n", buffA);
+
+ ret = pGetGeoInfoA(333, GEO_ID, buffA, 20, 0); /* LOCATION_BOTH internal Wine type */
+ ok(ret == 4, "got %d\n", ret);
+ ok(!strcmp(buffA, "333"), "got %s\n", buffA);
+ }
/* GEO_PARENT */
buffA[0] = 0;
--
2.24.0
Dec. 2, 2019
Re: [PATCH 1/4] wusa: Add support for extracting MSU files.
by Alistair Leslie-Hughes
Hi Hans,
________________________________
From: wine-devel <wine-devel-bounces(a)winehq.org> on behalf of Hans Leidekker <hans(a)codeweavers.com>
Sent: Monday, 2 December 2019 8:11 PM
To: wine-devel(a)winehq.org <wine-devel(a)winehq.org>
Subject: [PATCH 1/4] wusa: Add support for extracting MSU files.
....
diff --git a/programs/wusa/wusa.h b/programs/wusa/wusa.h
new file mode 100644
index 0000000000..c6bf7eda11
+
+static void *heap_alloc(size_t len) __WINE_ALLOC_SIZE(1);
+static inline void *heap_alloc(size_t len)
+{
+ return HeapAlloc(GetProcessHeap(), 0, len);
+}
+
+static inline BOOL heap_free(void *mem)
Is there a reason why your not using the wine/heap.h ones?
Regards
Alistair.
Dec. 2, 2019
[PATCH 5/5] ucrtbase: Correct behavior of strftime formats %c %r.
by Jeff Smith
Signed-off-by: Jeff Smith <whydoubt(a)gmail.com>
---
dlls/msvcrt/time.c | 14 +++++++++++++-
dlls/ucrtbase/tests/misc.c | 8 ++++----
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c
index ef4f228554..885166e638 100644
--- a/dlls/msvcrt/time.c
+++ b/dlls/msvcrt/time.c
@@ -1234,6 +1234,18 @@ static MSVCRT_size_t strftime_impl(STRFTIME_CHAR *str, MSVCRT_size_t max,
switch(*format) {
case 'c':
+#if _MSVCR_VER>=140
+ if(time_data == MSVCRT_time_curr && !alternate)
+ {
+ static const WCHAR datetime_format[] =
+ { '%','a',' ','%','b',' ','%','e',' ','%','T',' ','%','Y',0 };
+ tmp = strftime_impl(str+ret, max-ret, datetime_format, mstm, time_data, loc);
+ if(!tmp)
+ return 0;
+ ret += tmp;
+ break;
+ }
+#endif
if(!strftime_format(str, &ret, max, mstm, time_data,
alternate ? STRFTIME_TD(time_data, date) : STRFTIME_TD(time_data, short_date)))
return 0;
@@ -1387,7 +1399,7 @@ static MSVCRT_size_t strftime_impl(STRFTIME_CHAR *str, MSVCRT_size_t max,
break;
#if _MSVCR_VER>=140
case 'r':
- if(time_data == MSVCRT_locale->locinfo->lc_time_curr)
+ if(time_data == MSVCRT_time_curr)
{
if(!MSVCRT_CHECK_PMT(mstm->tm_hour>=0 && mstm->tm_hour<=23))
goto einval_error;
diff --git a/dlls/ucrtbase/tests/misc.c b/dlls/ucrtbase/tests/misc.c
index 606e74b524..51620dd0f2 100644
--- a/dlls/ucrtbase/tests/misc.c
+++ b/dlls/ucrtbase/tests/misc.c
@@ -1004,8 +1004,8 @@ static void test_strftime(void)
{"%y", "00", { 0, 0, 0, 0, 0, -1900, 0, 0, 0 }},
{"%y", "99", { 0, 0, 0, 0, 0, 8099, 0, 0, 0 }},
{"%y", "", { 0, 0, 0, 0, 0, 8100, 0, 0, 0 }},
- {"%c", "Thu Jan 1 00:00:00 1970", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }, TRUE, TRUE},
- {"%c", "Thu Feb 30 00:00:00 1970", { 0, 0, 0, 30, 1, 70, 4, 0, 0 }, TRUE, TRUE},
+ {"%c", "Thu Jan 1 00:00:00 1970", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
+ {"%c", "Thu Feb 30 00:00:00 1970", { 0, 0, 0, 30, 1, 70, 4, 0, 0 }},
{"%#c", "Thursday, January 01, 1970 00:00:00", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%#c", "Thursday, February 30, 1970 00:00:00", { 0, 0, 0, 30, 1, 70, 4, 0, 0 }},
{"%x", "01/01/70", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
@@ -1197,8 +1197,8 @@ static void test_strftime(void)
ok(ret == strlen(expected), "ret = %d\n", ret);
ok(!strcmp(buf, expected), "buf = \"%s\", expected \"%s\"\n", buf, expected);
ret = p_strftime(buf, sizeof(buf), "%x %r", &epoch);
- todo_wine ok(ret == strlen(expected), "ret = %d\n", ret);
- todo_wine ok(!strcmp(buf, expected), "buf = \"%s\", expected \"%s\"\n", buf, expected);
+ ok(ret == strlen(expected), "ret = %d\n", ret);
+ ok(!strcmp(buf, expected), "buf = \"%s\", expected \"%s\"\n", buf, expected);
p_setlocale(LC_ALL, locale);
}
--
2.23.0
Dec. 2, 2019
[PATCH 4/5] msvcrt: Create global lc_time_curr and use when possible.
by Jeff Smith
Signed-off-by: Jeff Smith <whydoubt(a)gmail.com>
---
dlls/msvcrt/locale.c | 23 +++++++++++++----------
dlls/msvcrt/msvcrt.h | 1 +
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c
index 5a8d99493e..277e7802af 100644
--- a/dlls/msvcrt/locale.c
+++ b/dlls/msvcrt/locale.c
@@ -42,6 +42,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
#define MAX_ELEM_LEN 64 /* Max length of country/language/CP string */
#define MAX_LOCALE_LENGTH 256
MSVCRT__locale_t MSVCRT_locale = NULL;
+MSVCRT___lc_time_data *MSVCRT_time_curr = NULL;
unsigned short *MSVCRT__pctype = NULL;
unsigned int MSVCRT___lc_codepage = 0;
int MSVCRT___lc_collate_cp = 0;
@@ -829,7 +830,8 @@ void free_locinfo(MSVCRT_pthreadlocinfo locinfo)
MSVCRT_free(locinfo->pclmap);
MSVCRT_free(locinfo->pcumap);
- MSVCRT_free(locinfo->lc_time_curr);
+ if(locinfo->lc_time_curr != MSVCRT_time_curr)
+ MSVCRT_free(locinfo->lc_time_curr);
MSVCRT_free(locinfo);
}
@@ -1567,20 +1569,20 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
lcid[MSVCRT_LC_TIME], cp[MSVCRT_LC_TIME])) {
locinfo->lc_handle[MSVCRT_LC_TIME] = old_locinfo->lc_handle[MSVCRT_LC_TIME];
locinfo->lc_id[MSVCRT_LC_TIME].wCodePage = old_locinfo->lc_id[MSVCRT_LC_TIME].wCodePage;
- } else {
- if(lcid[MSVCRT_LC_TIME] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_TIME)) {
- if(!update_threadlocinfo_category(lcid[MSVCRT_LC_TIME],
- cp[MSVCRT_LC_TIME], locinfo, MSVCRT_LC_TIME))
- goto failed;
+ } else if(lcid[MSVCRT_LC_TIME] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_TIME)) {
+ if(!update_threadlocinfo_category(lcid[MSVCRT_LC_TIME],
+ cp[MSVCRT_LC_TIME], locinfo, MSVCRT_LC_TIME))
+ goto failed;
- if(!set_lc_locale_name(locinfo, MSVCRT_LC_TIME))
- goto failed;
- } else
- locinfo->lc_category[MSVCRT_LC_TIME].locale = MSVCRT__strdup("C");
+ if(!set_lc_locale_name(locinfo, MSVCRT_LC_TIME))
+ goto failed;
locinfo->lc_time_curr = create_time_data(lcid[MSVCRT_LC_TIME]);
if(!locinfo->lc_time_curr)
goto failed;
+ } else {
+ locinfo->lc_category[MSVCRT_LC_TIME].locale = MSVCRT__strdup("C");
+ locinfo->lc_time_curr = MSVCRT_time_curr;
}
return locinfo;
@@ -1962,6 +1964,7 @@ BOOL msvcrt_init_locale(void)
{
int i;
+ MSVCRT_time_curr = create_time_data(0);
_lock_locales();
MSVCRT_locale = MSVCRT__create_locale(0, "C");
_unlock_locales();
diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h
index 4a7e6f4219..445c28178a 100644
--- a/dlls/msvcrt/msvcrt.h
+++ b/dlls/msvcrt/msvcrt.h
@@ -305,6 +305,7 @@ extern thread_data_t *msvcrt_get_thread_data(void) DECLSPEC_HIDDEN;
LCID MSVCRT_locale_to_LCID(const char*, unsigned short*, BOOL*) DECLSPEC_HIDDEN;
extern MSVCRT__locale_t MSVCRT_locale DECLSPEC_HIDDEN;
+extern MSVCRT___lc_time_data *MSVCRT_time_curr DECLSPEC_HIDDEN;
extern unsigned int MSVCRT___lc_codepage;
extern int MSVCRT___lc_collate_cp;
extern WORD MSVCRT__ctype [257];
--
2.23.0
Dec. 2, 2019
[PATCH 3/5] msvcrt: Factor out code for creating lc_time_data structure.
by Jeff Smith
Signed-off-by: Jeff Smith <whydoubt(a)gmail.com>
---
dlls/msvcrt/locale.c | 164 +++++++++++++++++++++++--------------------
1 file changed, 88 insertions(+), 76 deletions(-)
diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c
index f472432144..5a8d99493e 100644
--- a/dlls/msvcrt/locale.c
+++ b/dlls/msvcrt/locale.c
@@ -910,8 +910,7 @@ static inline BOOL category_needs_update(int cat, int user_cat,
return lcid!=locinfo->lc_handle[cat] || cp!=locinfo->lc_id[cat].wCodePage;
}
-static MSVCRT_pthreadlocinfo create_locinfo(int category,
- const char *locale, MSVCRT_pthreadlocinfo old_locinfo)
+static MSVCRT___lc_time_data* create_time_data(LCID lcid)
{
static const DWORD time_data[] = {
LOCALE_SABBREVDAYNAME7, LOCALE_SABBREVDAYNAME1, LOCALE_SABBREVDAYNAME2,
@@ -930,11 +929,6 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
LOCALE_SSHORTDATE, LOCALE_SLONGDATE,
LOCALE_STIMEFORMAT
};
- static const char collate[] = "COLLATE=";
- static const char ctype[] = "CTYPE=";
- static const char monetary[] = "MONETARY=";
- static const char numeric[] = "NUMERIC=";
- static const char time[] = "TIME=";
static const char cloc_short_date[] = "MM/dd/yy";
static const MSVCRT_wchar_t cloc_short_dateW[] = {'M','M','/','d','d','/','y','y',0};
static const char cloc_long_date[] = "dddd, MMMM dd, yyyy";
@@ -942,8 +936,92 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
static const char cloc_time[] = "HH:mm:ss";
static const MSVCRT_wchar_t cloc_timeW[] = {'H','H',':','m','m',':','s','s',0};
+ MSVCRT___lc_time_data *cur;
+ const DWORD flags = lcid ? 0 : LOCALE_NOUSEROVERRIDE;
+ const LCID lcid_tmp = lcid ? lcid : MAKELCID(LANG_ENGLISH, SORT_DEFAULT);
+ int i, ret, size;
+
+ size = sizeof(MSVCRT___lc_time_data);
+ for(i=0; i<ARRAY_SIZE(time_data); i++) {
+ if(time_data[i]==LOCALE_SSHORTDATE && !lcid) {
+ size += sizeof(cloc_short_date) + sizeof(cloc_short_dateW);
+ }else if(time_data[i]==LOCALE_SLONGDATE && !lcid) {
+ size += sizeof(cloc_long_date) + sizeof(cloc_long_dateW);
+ }else {
+ ret = GetLocaleInfoA(lcid_tmp, time_data[i]|flags, NULL, 0);
+ if(!ret)
+ return NULL;
+ size += ret;
+
+ ret = GetLocaleInfoW(lcid_tmp, time_data[i]|flags, NULL, 0);
+ if(!ret)
+ return NULL;
+ size += ret*sizeof(MSVCRT_wchar_t);
+ }
+ }
+#if _MSVCR_VER >= 110
+ size += LCIDToLocaleName(lcid, NULL, 0, 0)*sizeof(MSVCRT_wchar_t);
+#endif
+
+ cur = MSVCRT_malloc(size);
+ if(!cur)
+ return NULL;
+
+ ret = 0;
+ for(i=0; i<ARRAY_SIZE(time_data); i++) {
+ cur->str.str[i] = &cur->data[ret];
+ if(time_data[i]==LOCALE_SSHORTDATE && !lcid) {
+ memcpy(&cur->data[ret], cloc_short_date, sizeof(cloc_short_date));
+ ret += sizeof(cloc_short_date);
+ }else if(time_data[i]==LOCALE_SLONGDATE && !lcid) {
+ memcpy(&cur->data[ret], cloc_long_date, sizeof(cloc_long_date));
+ ret += sizeof(cloc_long_date);
+ }else if(time_data[i]==LOCALE_STIMEFORMAT && !lcid) {
+ memcpy(&cur->data[ret], cloc_time, sizeof(cloc_time));
+ ret += sizeof(cloc_time);
+ }else {
+ ret += GetLocaleInfoA(lcid_tmp, time_data[i]|flags,
+ &cur->data[ret], size-ret);
+ }
+ }
+ for(i=0; i<ARRAY_SIZE(time_data); i++) {
+ cur->wstr.wstr[i] = (MSVCRT_wchar_t*)&cur->data[ret];
+ if(time_data[i]==LOCALE_SSHORTDATE && !lcid) {
+ memcpy(&cur->data[ret], cloc_short_dateW, sizeof(cloc_short_dateW));
+ ret += sizeof(cloc_short_dateW);
+ }else if(time_data[i]==LOCALE_SLONGDATE && !lcid) {
+ memcpy(&cur->data[ret], cloc_long_dateW, sizeof(cloc_long_dateW));
+ ret += sizeof(cloc_long_dateW);
+ }else if(time_data[i]==LOCALE_STIMEFORMAT && !lcid) {
+ memcpy(&cur->data[ret], cloc_timeW, sizeof(cloc_timeW));
+ ret += sizeof(cloc_timeW);
+ }else {
+ ret += GetLocaleInfoW(lcid_tmp, time_data[i]|flags,
+ (MSVCRT_wchar_t*)&cur->data[ret], size-ret)*sizeof(MSVCRT_wchar_t);
+ }
+ }
+#if _MSVCR_VER >= 110
+ cur->locname = (MSVCRT_wchar_t*)&cur->data[ret];
+ LCIDToLocaleName(lcid, cur->locname,
+ (size-ret)/sizeof(MSVCRT_wchar_t), 0);
+#else
+ cur->lcid = lcid;
+#endif
+
+ return cur;
+}
+
+static MSVCRT_pthreadlocinfo create_locinfo(int category,
+ const char *locale, MSVCRT_pthreadlocinfo old_locinfo)
+{
+ static const char collate[] = "COLLATE=";
+ static const char ctype[] = "CTYPE=";
+ static const char monetary[] = "MONETARY=";
+ static const char numeric[] = "NUMERIC=";
+ static const char time[] = "TIME=";
+
MSVCRT_pthreadlocinfo locinfo;
- LCID lcid[6] = { 0 }, lcid_tmp;
+ LCID lcid[6] = { 0 };
unsigned short cp[6] = { 0 };
const char *locale_name[6] = { 0 };
int locale_len[6] = { 0 };
@@ -952,7 +1030,7 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
#if _MSVCR_VER >= 100
MSVCRT_wchar_t wbuf[256];
#endif
- int i, ret, size;
+ int i;
TRACE("(%d %s)\n", category, locale);
@@ -1490,8 +1568,6 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
locinfo->lc_handle[MSVCRT_LC_TIME] = old_locinfo->lc_handle[MSVCRT_LC_TIME];
locinfo->lc_id[MSVCRT_LC_TIME].wCodePage = old_locinfo->lc_id[MSVCRT_LC_TIME].wCodePage;
} else {
- DWORD flags = lcid[MSVCRT_LC_TIME] ? 0 : LOCALE_NOUSEROVERRIDE;
-
if(lcid[MSVCRT_LC_TIME] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_TIME)) {
if(!update_threadlocinfo_category(lcid[MSVCRT_LC_TIME],
cp[MSVCRT_LC_TIME], locinfo, MSVCRT_LC_TIME))
@@ -1502,73 +1578,9 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
} else
locinfo->lc_category[MSVCRT_LC_TIME].locale = MSVCRT__strdup("C");
- size = sizeof(MSVCRT___lc_time_data);
- lcid_tmp = lcid[MSVCRT_LC_TIME] ? lcid[MSVCRT_LC_TIME] : MAKELCID(LANG_ENGLISH, SORT_DEFAULT);
- for(i=0; i<ARRAY_SIZE(time_data); i++) {
- if(time_data[i]==LOCALE_SSHORTDATE && !lcid[MSVCRT_LC_TIME]) {
- size += sizeof(cloc_short_date) + sizeof(cloc_short_dateW);
- }else if(time_data[i]==LOCALE_SLONGDATE && !lcid[MSVCRT_LC_TIME]) {
- size += sizeof(cloc_long_date) + sizeof(cloc_long_dateW);
- }else {
- ret = GetLocaleInfoA(lcid_tmp, time_data[i]|flags, NULL, 0);
- if(!ret)
- goto failed;
- size += ret;
-
- ret = GetLocaleInfoW(lcid_tmp, time_data[i]|flags, NULL, 0);
- if(!ret)
- goto failed;
- size += ret*sizeof(MSVCRT_wchar_t);
- }
- }
-#if _MSVCR_VER >= 110
- size += LCIDToLocaleName(lcid[MSVCRT_LC_TIME], NULL, 0, 0)*sizeof(MSVCRT_wchar_t);
-#endif
-
- locinfo->lc_time_curr = MSVCRT_malloc(size);
+ locinfo->lc_time_curr = create_time_data(lcid[MSVCRT_LC_TIME]);
if(!locinfo->lc_time_curr)
goto failed;
-
- ret = 0;
- for(i=0; i<ARRAY_SIZE(time_data); i++) {
- locinfo->lc_time_curr->str.str[i] = &locinfo->lc_time_curr->data[ret];
- if(time_data[i]==LOCALE_SSHORTDATE && !lcid[MSVCRT_LC_TIME]) {
- memcpy(&locinfo->lc_time_curr->data[ret], cloc_short_date, sizeof(cloc_short_date));
- ret += sizeof(cloc_short_date);
- }else if(time_data[i]==LOCALE_SLONGDATE && !lcid[MSVCRT_LC_TIME]) {
- memcpy(&locinfo->lc_time_curr->data[ret], cloc_long_date, sizeof(cloc_long_date));
- ret += sizeof(cloc_long_date);
- }else if(time_data[i]==LOCALE_STIMEFORMAT && !lcid[MSVCRT_LC_TIME]) {
- memcpy(&locinfo->lc_time_curr->data[ret], cloc_time, sizeof(cloc_time));
- ret += sizeof(cloc_time);
- }else {
- ret += GetLocaleInfoA(lcid_tmp, time_data[i]|flags,
- &locinfo->lc_time_curr->data[ret], size-ret);
- }
- }
- for(i=0; i<ARRAY_SIZE(time_data); i++) {
- locinfo->lc_time_curr->wstr.wstr[i] = (MSVCRT_wchar_t*)&locinfo->lc_time_curr->data[ret];
- if(time_data[i]==LOCALE_SSHORTDATE && !lcid[MSVCRT_LC_TIME]) {
- memcpy(&locinfo->lc_time_curr->data[ret], cloc_short_dateW, sizeof(cloc_short_dateW));
- ret += sizeof(cloc_short_dateW);
- }else if(time_data[i]==LOCALE_SLONGDATE && !lcid[MSVCRT_LC_TIME]) {
- memcpy(&locinfo->lc_time_curr->data[ret], cloc_long_dateW, sizeof(cloc_long_dateW));
- ret += sizeof(cloc_long_dateW);
- }else if(time_data[i]==LOCALE_STIMEFORMAT && !lcid[MSVCRT_LC_TIME]) {
- memcpy(&locinfo->lc_time_curr->data[ret], cloc_timeW, sizeof(cloc_timeW));
- ret += sizeof(cloc_timeW);
- }else {
- ret += GetLocaleInfoW(lcid_tmp, time_data[i]|flags,
- (MSVCRT_wchar_t*)&locinfo->lc_time_curr->data[ret], size-ret)*sizeof(MSVCRT_wchar_t);
- }
- }
-#if _MSVCR_VER >= 110
- locinfo->lc_time_curr->locname = (MSVCRT_wchar_t*)&locinfo->lc_time_curr->data[ret];
- LCIDToLocaleName(lcid[MSVCRT_LC_TIME], locinfo->lc_time_curr->locname,
- (size-ret)/sizeof(MSVCRT_wchar_t), 0);
-#else
- locinfo->lc_time_curr->lcid = lcid[MSVCRT_LC_TIME];
-#endif
}
return locinfo;
--
2.23.0
Dec. 2, 2019
[PATCH 2/5] msvcrt: Refactor failure code for create_locinfo.
by Jeff Smith
Signed-off-by: Jeff Smith <whydoubt(a)gmail.com>
---
dlls/msvcrt/locale.c | 328 +++++++++++++++----------------------------
1 file changed, 112 insertions(+), 216 deletions(-)
diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c
index fc41f05da2..f472432144 100644
--- a/dlls/msvcrt/locale.c
+++ b/dlls/msvcrt/locale.c
@@ -1048,25 +1048,19 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
locinfo->refcount = 1;
locinfo->lconv = MSVCRT_malloc(sizeof(struct MSVCRT_lconv));
- if(!locinfo->lconv) {
- free_locinfo(locinfo);
- return NULL;
- }
+ if(!locinfo->lconv)
+ goto failed;
memset(locinfo->lconv, 0, sizeof(struct MSVCRT_lconv));
locinfo->pclmap = MSVCRT_malloc(sizeof(char[256]));
locinfo->pcumap = MSVCRT_malloc(sizeof(char[256]));
- if(!locinfo->pclmap || !locinfo->pcumap) {
- free_locinfo(locinfo);
- return NULL;
- }
+ if(!locinfo->pclmap || !locinfo->pcumap)
+ goto failed;
if(locale_name[MSVCRT_LC_COLLATE] &&
!init_category_name(locale_name[MSVCRT_LC_COLLATE],
- locale_len[MSVCRT_LC_COLLATE], locinfo, MSVCRT_LC_COLLATE)) {
- free_locinfo(locinfo);
- return NULL;
- }
+ locale_len[MSVCRT_LC_COLLATE], locinfo, MSVCRT_LC_COLLATE))
+ goto failed;
if(!category_needs_update(MSVCRT_LC_COLLATE, category, old_locinfo,
lcid[MSVCRT_LC_COLLATE], cp[MSVCRT_LC_COLLATE])) {
@@ -1074,26 +1068,20 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
locinfo->lc_id[MSVCRT_LC_COLLATE].wCodePage = old_locinfo->lc_id[MSVCRT_LC_COLLATE].wCodePage;
} else if(lcid[MSVCRT_LC_COLLATE] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_COLLATE)) {
if(!update_threadlocinfo_category(lcid[MSVCRT_LC_COLLATE],
- cp[MSVCRT_LC_COLLATE], locinfo, MSVCRT_LC_COLLATE)) {
- free_locinfo(locinfo);
- return NULL;
- }
+ cp[MSVCRT_LC_COLLATE], locinfo, MSVCRT_LC_COLLATE))
+ goto failed;
locinfo->lc_collate_cp = locinfo->lc_id[MSVCRT_LC_COLLATE].wCodePage;
- if(!set_lc_locale_name(locinfo, MSVCRT_LC_COLLATE)) {
- free_locinfo(locinfo);
- return NULL;
- }
+ if(!set_lc_locale_name(locinfo, MSVCRT_LC_COLLATE))
+ goto failed;
} else
locinfo->lc_category[MSVCRT_LC_COLLATE].locale = MSVCRT__strdup("C");
if(locale_name[MSVCRT_LC_CTYPE] &&
!init_category_name(locale_name[MSVCRT_LC_CTYPE],
- locale_len[MSVCRT_LC_CTYPE], locinfo, MSVCRT_LC_CTYPE)) {
- free_locinfo(locinfo);
- return NULL;
- }
+ locale_len[MSVCRT_LC_CTYPE], locinfo, MSVCRT_LC_CTYPE))
+ goto failed;
if(!category_needs_update(MSVCRT_LC_CTYPE, category, old_locinfo,
lcid[MSVCRT_LC_CTYPE], cp[MSVCRT_LC_CTYPE])) {
@@ -1104,25 +1092,19 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
int j;
if(!update_threadlocinfo_category(lcid[MSVCRT_LC_CTYPE],
- cp[MSVCRT_LC_CTYPE], locinfo, MSVCRT_LC_CTYPE)) {
- free_locinfo(locinfo);
- return NULL;
- }
+ cp[MSVCRT_LC_CTYPE], locinfo, MSVCRT_LC_CTYPE))
+ goto failed;
locinfo->lc_codepage = locinfo->lc_id[MSVCRT_LC_CTYPE].wCodePage;
locinfo->lc_clike = 1;
- if(!GetCPInfo(locinfo->lc_codepage, &cp_info)) {
- free_locinfo(locinfo);
- return NULL;
- }
+ if(!GetCPInfo(locinfo->lc_codepage, &cp_info))
+ goto failed;
locinfo->mb_cur_max = cp_info.MaxCharSize;
locinfo->ctype1_refcount = MSVCRT_malloc(sizeof(int));
locinfo->ctype1 = MSVCRT_malloc(sizeof(short[257]));
- if(!locinfo->ctype1_refcount || !locinfo->ctype1) {
- free_locinfo(locinfo);
- return NULL;
- }
+ if(!locinfo->ctype1_refcount || !locinfo->ctype1)
+ goto failed;
*locinfo->ctype1_refcount = 1;
locinfo->ctype1[0] = 0;
@@ -1143,10 +1125,8 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
for(j=cp_info.LeadByte[i]; j<=cp_info.LeadByte[i+1]; j++)
locinfo->ctype1[j+1] |= MSVCRT__LEADBYTE;
- if(!set_lc_locale_name(locinfo, MSVCRT_LC_CTYPE)) {
- free_locinfo(locinfo);
- return NULL;
- }
+ if(!set_lc_locale_name(locinfo, MSVCRT_LC_CTYPE))
+ goto failed;
for(i=0; i<256; i++) {
if(locinfo->pctype[i] & MSVCRT__LEADBYTE)
@@ -1180,10 +1160,8 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
if(locale_name[MSVCRT_LC_MONETARY] &&
!init_category_name(locale_name[MSVCRT_LC_MONETARY],
- locale_len[MSVCRT_LC_MONETARY], locinfo, MSVCRT_LC_MONETARY)) {
- free_locinfo(locinfo);
- return NULL;
- }
+ locale_len[MSVCRT_LC_MONETARY], locinfo, MSVCRT_LC_MONETARY))
+ goto failed;
if(!category_needs_update(MSVCRT_LC_MONETARY, category, old_locinfo,
lcid[MSVCRT_LC_MONETARY], cp[MSVCRT_LC_MONETARY])) {
@@ -1191,17 +1169,13 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
locinfo->lc_id[MSVCRT_LC_MONETARY].wCodePage = old_locinfo->lc_id[MSVCRT_LC_MONETARY].wCodePage;
} else if(lcid[MSVCRT_LC_MONETARY] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_MONETARY)) {
if(!update_threadlocinfo_category(lcid[MSVCRT_LC_MONETARY],
- cp[MSVCRT_LC_MONETARY], locinfo, MSVCRT_LC_MONETARY)) {
- free_locinfo(locinfo);
- return NULL;
- }
+ cp[MSVCRT_LC_MONETARY], locinfo, MSVCRT_LC_MONETARY))
+ goto failed;
locinfo->lconv_intl_refcount = MSVCRT_malloc(sizeof(int));
locinfo->lconv_mon_refcount = MSVCRT_malloc(sizeof(int));
- if(!locinfo->lconv_intl_refcount || !locinfo->lconv_mon_refcount) {
- free_locinfo(locinfo);
- return NULL;
- }
+ if(!locinfo->lconv_intl_refcount || !locinfo->lconv_mon_refcount)
+ goto failed;
*locinfo->lconv_intl_refcount = 1;
*locinfo->lconv_mon_refcount = 1;
@@ -1210,37 +1184,29 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
|LOCALE_NOUSEROVERRIDE, buf, 256);
if(i && (locinfo->lconv->int_curr_symbol = MSVCRT_malloc(i)))
memcpy(locinfo->lconv->int_curr_symbol, buf, i);
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
i = GetLocaleInfoA(lcid[MSVCRT_LC_MONETARY], LOCALE_SCURRENCY
|LOCALE_NOUSEROVERRIDE, buf, 256);
if(i && (locinfo->lconv->currency_symbol = MSVCRT_malloc(i)))
memcpy(locinfo->lconv->currency_symbol, buf, i);
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
i = GetLocaleInfoA(lcid[MSVCRT_LC_MONETARY], LOCALE_SMONDECIMALSEP
|LOCALE_NOUSEROVERRIDE, buf, 256);
if(i && (locinfo->lconv->mon_decimal_point = MSVCRT_malloc(i)))
memcpy(locinfo->lconv->mon_decimal_point, buf, i);
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
i = GetLocaleInfoA(lcid[MSVCRT_LC_MONETARY], LOCALE_SMONTHOUSANDSEP
|LOCALE_NOUSEROVERRIDE, buf, 256);
if(i && (locinfo->lconv->mon_thousands_sep = MSVCRT_malloc(i)))
memcpy(locinfo->lconv->mon_thousands_sep, buf, i);
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
i = GetLocaleInfoA(lcid[MSVCRT_LC_MONETARY], LOCALE_SMONGROUPING
|LOCALE_NOUSEROVERRIDE, buf, 256);
@@ -1252,153 +1218,117 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
locinfo->lconv->mon_grouping[i/2] = buf[i]-'0';
if(buf[i] != '0')
locinfo->lconv->mon_grouping[i/2+1] = 127;
- } else {
- free_locinfo(locinfo);
- return NULL;
- }
+ } else
+ goto failed;
i = GetLocaleInfoA(lcid[MSVCRT_LC_MONETARY], LOCALE_SPOSITIVESIGN
|LOCALE_NOUSEROVERRIDE, buf, 256);
if(i && (locinfo->lconv->positive_sign = MSVCRT_malloc(i)))
memcpy(locinfo->lconv->positive_sign, buf, i);
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
i = GetLocaleInfoA(lcid[MSVCRT_LC_MONETARY], LOCALE_SNEGATIVESIGN
|LOCALE_NOUSEROVERRIDE, buf, 256);
if(i && (locinfo->lconv->negative_sign = MSVCRT_malloc(i)))
memcpy(locinfo->lconv->negative_sign, buf, i);
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
if(GetLocaleInfoA(lcid[MSVCRT_LC_MONETARY], LOCALE_IINTLCURRDIGITS
|LOCALE_NOUSEROVERRIDE, buf, 256))
locinfo->lconv->int_frac_digits = atoi(buf);
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
if(GetLocaleInfoA(lcid[MSVCRT_LC_MONETARY], LOCALE_ICURRDIGITS
|LOCALE_NOUSEROVERRIDE, buf, 256))
locinfo->lconv->frac_digits = atoi(buf);
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
if(GetLocaleInfoA(lcid[MSVCRT_LC_MONETARY], LOCALE_IPOSSYMPRECEDES
|LOCALE_NOUSEROVERRIDE, buf, 256))
locinfo->lconv->p_cs_precedes = atoi(buf);
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
if(GetLocaleInfoA(lcid[MSVCRT_LC_MONETARY], LOCALE_IPOSSEPBYSPACE
|LOCALE_NOUSEROVERRIDE, buf, 256))
locinfo->lconv->p_sep_by_space = atoi(buf);
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
if(GetLocaleInfoA(lcid[MSVCRT_LC_MONETARY], LOCALE_INEGSYMPRECEDES
|LOCALE_NOUSEROVERRIDE, buf, 256))
locinfo->lconv->n_cs_precedes = atoi(buf);
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
if(GetLocaleInfoA(lcid[MSVCRT_LC_MONETARY], LOCALE_INEGSEPBYSPACE
|LOCALE_NOUSEROVERRIDE, buf, 256))
locinfo->lconv->n_sep_by_space = atoi(buf);
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
if(GetLocaleInfoA(lcid[MSVCRT_LC_MONETARY], LOCALE_IPOSSIGNPOSN
|LOCALE_NOUSEROVERRIDE, buf, 256))
locinfo->lconv->p_sign_posn = atoi(buf);
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
if(GetLocaleInfoA(lcid[MSVCRT_LC_MONETARY], LOCALE_INEGSIGNPOSN
|LOCALE_NOUSEROVERRIDE, buf, 256))
locinfo->lconv->n_sign_posn = atoi(buf);
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
#if _MSVCR_VER >= 100
i = GetLocaleInfoW(lcid[MSVCRT_LC_MONETARY], LOCALE_SINTLSYMBOL
|LOCALE_NOUSEROVERRIDE, wbuf, 256);
if(i && (locinfo->lconv->_W_int_curr_symbol = MSVCRT_malloc(i * sizeof(MSVCRT_wchar_t))))
memcpy(locinfo->lconv->_W_int_curr_symbol, wbuf, i * sizeof(MSVCRT_wchar_t));
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
i = GetLocaleInfoW(lcid[MSVCRT_LC_MONETARY], LOCALE_SCURRENCY
|LOCALE_NOUSEROVERRIDE, wbuf, 256);
if(i && (locinfo->lconv->_W_currency_symbol = MSVCRT_malloc(i * sizeof(MSVCRT_wchar_t))))
memcpy(locinfo->lconv->_W_currency_symbol, wbuf, i * sizeof(MSVCRT_wchar_t));
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
i = GetLocaleInfoW(lcid[MSVCRT_LC_MONETARY], LOCALE_SMONDECIMALSEP
|LOCALE_NOUSEROVERRIDE, wbuf, 256);
if(i && (locinfo->lconv->_W_mon_decimal_point = MSVCRT_malloc(i * sizeof(MSVCRT_wchar_t))))
memcpy(locinfo->lconv->_W_mon_decimal_point, wbuf, i * sizeof(MSVCRT_wchar_t));
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
i = GetLocaleInfoW(lcid[MSVCRT_LC_MONETARY], LOCALE_SMONTHOUSANDSEP
|LOCALE_NOUSEROVERRIDE, wbuf, 256);
if(i && (locinfo->lconv->_W_mon_thousands_sep = MSVCRT_malloc(i * sizeof(MSVCRT_wchar_t))))
memcpy(locinfo->lconv->_W_mon_thousands_sep, wbuf, i * sizeof(MSVCRT_wchar_t));
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
i = GetLocaleInfoW(lcid[MSVCRT_LC_MONETARY], LOCALE_SPOSITIVESIGN
|LOCALE_NOUSEROVERRIDE, wbuf, 256);
if(i && (locinfo->lconv->_W_positive_sign = MSVCRT_malloc(i * sizeof(MSVCRT_wchar_t))))
memcpy(locinfo->lconv->_W_positive_sign, wbuf, i * sizeof(MSVCRT_wchar_t));
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
i = GetLocaleInfoW(lcid[MSVCRT_LC_MONETARY], LOCALE_SNEGATIVESIGN
|LOCALE_NOUSEROVERRIDE, wbuf, 256);
if(i && (locinfo->lconv->_W_negative_sign = MSVCRT_malloc(i * sizeof(MSVCRT_wchar_t))))
memcpy(locinfo->lconv->_W_negative_sign, wbuf, i * sizeof(MSVCRT_wchar_t));
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
#endif
- if(!set_lc_locale_name(locinfo, MSVCRT_LC_MONETARY)) {
- free_locinfo(locinfo);
- return NULL;
- }
+ if(!set_lc_locale_name(locinfo, MSVCRT_LC_MONETARY))
+ goto failed;
} else {
locinfo->lconv->int_curr_symbol = MSVCRT_malloc(sizeof(char));
locinfo->lconv->currency_symbol = MSVCRT_malloc(sizeof(char));
@@ -1411,10 +1341,8 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
if(!locinfo->lconv->int_curr_symbol || !locinfo->lconv->currency_symbol
|| !locinfo->lconv->mon_decimal_point || !locinfo->lconv->mon_thousands_sep
|| !locinfo->lconv->mon_grouping || !locinfo->lconv->positive_sign
- || !locinfo->lconv->negative_sign) {
- free_locinfo(locinfo);
- return NULL;
- }
+ || !locinfo->lconv->negative_sign)
+ goto failed;
locinfo->lconv->int_curr_symbol[0] = '\0';
locinfo->lconv->currency_symbol[0] = '\0';
@@ -1442,10 +1370,8 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
if(!locinfo->lconv->_W_int_curr_symbol || !locinfo->lconv->_W_currency_symbol
|| !locinfo->lconv->_W_mon_decimal_point || !locinfo->lconv->_W_mon_thousands_sep
- || !locinfo->lconv->positive_sign || !locinfo->lconv->negative_sign) {
- free_locinfo(locinfo);
- return NULL;
- }
+ || !locinfo->lconv->positive_sign || !locinfo->lconv->negative_sign)
+ goto failed;
locinfo->lconv->_W_int_curr_symbol[0] = '\0';
locinfo->lconv->_W_currency_symbol[0] = '\0';
@@ -1460,10 +1386,8 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
if(locale_name[MSVCRT_LC_NUMERIC] &&
!init_category_name(locale_name[MSVCRT_LC_NUMERIC],
- locale_len[MSVCRT_LC_NUMERIC], locinfo, MSVCRT_LC_NUMERIC)) {
- free_locinfo(locinfo);
- return NULL;
- }
+ locale_len[MSVCRT_LC_NUMERIC], locinfo, MSVCRT_LC_NUMERIC))
+ goto failed;
if(!category_needs_update(MSVCRT_LC_NUMERIC, category, old_locinfo,
lcid[MSVCRT_LC_NUMERIC], cp[MSVCRT_LC_NUMERIC])) {
@@ -1471,18 +1395,14 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
locinfo->lc_id[MSVCRT_LC_NUMERIC].wCodePage = old_locinfo->lc_id[MSVCRT_LC_NUMERIC].wCodePage;
} else if(lcid[MSVCRT_LC_NUMERIC] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_NUMERIC)) {
if(!update_threadlocinfo_category(lcid[MSVCRT_LC_NUMERIC],
- cp[MSVCRT_LC_NUMERIC], locinfo, MSVCRT_LC_NUMERIC)) {
- free_locinfo(locinfo);
- return NULL;
- }
+ cp[MSVCRT_LC_NUMERIC], locinfo, MSVCRT_LC_NUMERIC))
+ goto failed;
if(!locinfo->lconv_intl_refcount)
locinfo->lconv_intl_refcount = MSVCRT_malloc(sizeof(int));
locinfo->lconv_num_refcount = MSVCRT_malloc(sizeof(int));
- if(!locinfo->lconv_intl_refcount || !locinfo->lconv_num_refcount) {
- free_locinfo(locinfo);
- return NULL;
- }
+ if(!locinfo->lconv_intl_refcount || !locinfo->lconv_num_refcount)
+ goto failed;
*locinfo->lconv_intl_refcount = 1;
*locinfo->lconv_num_refcount = 1;
@@ -1491,19 +1411,15 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
|LOCALE_NOUSEROVERRIDE, buf, 256);
if(i && (locinfo->lconv->decimal_point = MSVCRT_malloc(i)))
memcpy(locinfo->lconv->decimal_point, buf, i);
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
i = GetLocaleInfoA(lcid[MSVCRT_LC_NUMERIC], LOCALE_STHOUSAND
|LOCALE_NOUSEROVERRIDE, buf, 256);
if(i && (locinfo->lconv->thousands_sep = MSVCRT_malloc(i)))
memcpy(locinfo->lconv->thousands_sep, buf, i);
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
i = GetLocaleInfoA(lcid[MSVCRT_LC_NUMERIC], LOCALE_SGROUPING
|LOCALE_NOUSEROVERRIDE, buf, 256);
@@ -1515,44 +1431,34 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
locinfo->lconv->grouping[i/2] = buf[i]-'0';
if(buf[i] != '0')
locinfo->lconv->grouping[i/2+1] = 127;
- } else {
- free_locinfo(locinfo);
- return NULL;
- }
+ } else
+ goto failed;
#if _MSVCR_VER >= 100
i = GetLocaleInfoW(lcid[MSVCRT_LC_NUMERIC], LOCALE_SDECIMAL
|LOCALE_NOUSEROVERRIDE, wbuf, 256);
if(i && (locinfo->lconv->_W_decimal_point = MSVCRT_malloc(i * sizeof(MSVCRT_wchar_t))))
memcpy(locinfo->lconv->_W_decimal_point, wbuf, i * sizeof(MSVCRT_wchar_t));
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
i = GetLocaleInfoW(lcid[MSVCRT_LC_NUMERIC], LOCALE_STHOUSAND
|LOCALE_NOUSEROVERRIDE, wbuf, 256);
if(i && (locinfo->lconv->_W_thousands_sep = MSVCRT_malloc(i * sizeof(MSVCRT_wchar_t))))
memcpy(locinfo->lconv->_W_thousands_sep, wbuf, i * sizeof(MSVCRT_wchar_t));
- else {
- free_locinfo(locinfo);
- return NULL;
- }
+ else
+ goto failed;
#endif
- if(!set_lc_locale_name(locinfo, MSVCRT_LC_NUMERIC)) {
- free_locinfo(locinfo);
- return NULL;
- }
+ if(!set_lc_locale_name(locinfo, MSVCRT_LC_NUMERIC))
+ goto failed;
} else {
locinfo->lconv->decimal_point = MSVCRT_malloc(sizeof(char[2]));
locinfo->lconv->thousands_sep = MSVCRT_malloc(sizeof(char));
locinfo->lconv->grouping = MSVCRT_malloc(sizeof(char));
if(!locinfo->lconv->decimal_point || !locinfo->lconv->thousands_sep
- || !locinfo->lconv->grouping) {
- free_locinfo(locinfo);
- return NULL;
- }
+ || !locinfo->lconv->grouping)
+ goto failed;
locinfo->lconv->decimal_point[0] = '.';
locinfo->lconv->decimal_point[1] = '\0';
@@ -1563,10 +1469,8 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
locinfo->lconv->_W_decimal_point = MSVCRT_malloc(sizeof(MSVCRT_wchar_t[2]));
locinfo->lconv->_W_thousands_sep = MSVCRT_malloc(sizeof(MSVCRT_wchar_t));
- if(!locinfo->lconv->_W_decimal_point || !locinfo->lconv->_W_thousands_sep) {
- free_locinfo(locinfo);
- return NULL;
- }
+ if(!locinfo->lconv->_W_decimal_point || !locinfo->lconv->_W_thousands_sep)
+ goto failed;
locinfo->lconv->_W_decimal_point[0] = '.';
locinfo->lconv->_W_decimal_point[1] = '\0';
@@ -1578,10 +1482,8 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
if(locale_name[MSVCRT_LC_TIME] &&
!init_category_name(locale_name[MSVCRT_LC_TIME],
- locale_len[MSVCRT_LC_TIME], locinfo, MSVCRT_LC_TIME)) {
- free_locinfo(locinfo);
- return NULL;
- }
+ locale_len[MSVCRT_LC_TIME], locinfo, MSVCRT_LC_TIME))
+ goto failed;
if(!category_needs_update(MSVCRT_LC_TIME, category, old_locinfo,
lcid[MSVCRT_LC_TIME], cp[MSVCRT_LC_TIME])) {
@@ -1592,15 +1494,11 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
if(lcid[MSVCRT_LC_TIME] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_TIME)) {
if(!update_threadlocinfo_category(lcid[MSVCRT_LC_TIME],
- cp[MSVCRT_LC_TIME], locinfo, MSVCRT_LC_TIME)) {
- free_locinfo(locinfo);
- return NULL;
- }
+ cp[MSVCRT_LC_TIME], locinfo, MSVCRT_LC_TIME))
+ goto failed;
- if(!set_lc_locale_name(locinfo, MSVCRT_LC_TIME)) {
- free_locinfo(locinfo);
- return NULL;
- }
+ if(!set_lc_locale_name(locinfo, MSVCRT_LC_TIME))
+ goto failed;
} else
locinfo->lc_category[MSVCRT_LC_TIME].locale = MSVCRT__strdup("C");
@@ -1613,17 +1511,13 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
size += sizeof(cloc_long_date) + sizeof(cloc_long_dateW);
}else {
ret = GetLocaleInfoA(lcid_tmp, time_data[i]|flags, NULL, 0);
- if(!ret) {
- free_locinfo(locinfo);
- return NULL;
- }
+ if(!ret)
+ goto failed;
size += ret;
ret = GetLocaleInfoW(lcid_tmp, time_data[i]|flags, NULL, 0);
- if(!ret) {
- free_locinfo(locinfo);
- return NULL;
- }
+ if(!ret)
+ goto failed;
size += ret*sizeof(MSVCRT_wchar_t);
}
}
@@ -1632,10 +1526,8 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
#endif
locinfo->lc_time_curr = MSVCRT_malloc(size);
- if(!locinfo->lc_time_curr) {
- free_locinfo(locinfo);
- return NULL;
- }
+ if(!locinfo->lc_time_curr)
+ goto failed;
ret = 0;
for(i=0; i<ARRAY_SIZE(time_data); i++) {
@@ -1680,6 +1572,10 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
}
return locinfo;
+
+failed:
+ free_locinfo(locinfo);
+ return NULL;
}
/*********************************************************************
--
2.23.0
Dec. 2, 2019
[PATCH 1/5] ucrtbase: Improve strftime special test cases for %c %r formats.
by Jeff Smith
Signed-off-by: Jeff Smith <whydoubt(a)gmail.com>
---
dlls/ucrtbase/tests/misc.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/dlls/ucrtbase/tests/misc.c b/dlls/ucrtbase/tests/misc.c
index 083be42f42..606e74b524 100644
--- a/dlls/ucrtbase/tests/misc.c
+++ b/dlls/ucrtbase/tests/misc.c
@@ -29,6 +29,7 @@
#include <fcntl.h>
#include <time.h>
#include <direct.h>
+#include <locale.h>
#include <windef.h>
#include <winbase.h>
@@ -162,6 +163,7 @@ static int* (CDECL *p_errno)(void);
static char* (CDECL *p_asctime)(const struct tm *);
static size_t (__cdecl *p_strftime)(char *, size_t, const char *, const struct tm *);
static size_t (__cdecl *p__Strftime)(char*, size_t, const char*, const struct tm*, void*);
+static char* (__cdecl *p_setlocale)(int, const char*);
static struct tm* (__cdecl *p__gmtime32)(const __time32_t*);
static void (CDECL *p_exit)(int);
static int (CDECL *p__crt_atexit)(void (CDECL*)(void));
@@ -538,6 +540,7 @@ static BOOL init(void)
p_asctime = (void*)GetProcAddress(module, "asctime");
p_strftime = (void*)GetProcAddress(module, "strftime");
p__Strftime = (void*)GetProcAddress(module, "_Strftime");
+ p_setlocale = (void*)GetProcAddress(module, "setlocale");
p__gmtime32 = (void*)GetProcAddress(module, "_gmtime32");
p__crt_atexit = (void*)GetProcAddress(module, "_crt_atexit");
p_exit = (void*)GetProcAddress(module, "exit");
@@ -1135,6 +1138,8 @@ static void test_strftime(void)
struct tm tm_yweek = { 0, 0, 0, 1, 0, 70, 0, 0, 0 };
char buf[256];
int i, ret=0;
+ char expected[] = "01/01/1970 00:00:00";
+ const char *locale;
for (i=0; i<ARRAY_SIZE(tests); i++)
{
@@ -1185,6 +1190,16 @@ static void test_strftime(void)
i, j, buf, tests_yweek[i].ret[j]);
}
}
+
+ locale = p_setlocale(LC_ALL, NULL);
+ p_setlocale(LC_ALL, "fr-FR");
+ ret = p_strftime(buf, sizeof(buf), "%c", &epoch);
+ ok(ret == strlen(expected), "ret = %d\n", ret);
+ ok(!strcmp(buf, expected), "buf = \"%s\", expected \"%s\"\n", buf, expected);
+ ret = p_strftime(buf, sizeof(buf), "%x %r", &epoch);
+ todo_wine ok(ret == strlen(expected), "ret = %d\n", ret);
+ todo_wine ok(!strcmp(buf, expected), "buf = \"%s\", expected \"%s\"\n", buf, expected);
+ p_setlocale(LC_ALL, locale);
}
static LONG* get_failures_counter(HANDLE *map)
--
2.23.0
Dec. 2, 2019
Re: [PATCH v2 0/3] Update USER_SHARED_DATA timestamps continuously.
by Rémi Bernon
On 12/2/19 6:04 PM, Stefan Dösinger wrote:
> Am 02.12.19 um 14:32 schrieb Rémi Bernon:
>> If the service is not yet started - which can happen for the initial
>> processes and other services, then the process uses the current user
>> shared data implementation, where no timestamp update is done > Wouldn't that mean things fail if I run wine Starcraft.exe? I know it is
> modern that all games are started from launchers, but having the initial
> process behave differently is a bigger issue than you make it seem.
>
As far as I can tell, no. Services are started before the main process
startup completes, but some services may be started before this service
is. I don't have a very clear understanding of the process startup order
though to be honest.
--
Rémi Bernon <rbernon(a)codeweavers.com>
Dec. 2, 2019
Re: [PATCH v2 0/3] Update USER_SHARED_DATA timestamps continuously.
by Stefan Dösinger
Am 02.12.19 um 14:32 schrieb Rémi Bernon:
> If the service is not yet started - which can happen for the initial
> processes and other services, then the process uses the current user
> shared data implementation, where no timestamp update is doneWouldn't that mean things fail if I run wine Starcraft.exe? I know it is
modern that all games are started from launchers, but having the initial
process behave differently is a bigger issue than you make it seem.
Dec. 2, 2019
[PATCH v2 6/6] wined3d: Store the blend factor in the stateblock as a render state.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
This supersedes 174719.
dlls/d3d9/device.c | 33 ++++++++------------------
dlls/wined3d/stateblock.c | 42 ++++++++--------------------------
dlls/wined3d/wined3d.spec | 1 -
dlls/wined3d/wined3d_private.h | 3 +--
include/wine/wined3d.h | 4 +---
5 files changed, 21 insertions(+), 62 deletions(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 51b7f4d6f59..174cdc5bf49 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -2304,22 +2304,18 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_SetRenderState(IDirect3DDevi
TRACE("iface %p, state %#x, value %#x.\n", iface, state, value);
- if (state == D3DRS_BLENDFACTOR)
- {
- wined3d_color_from_d3dcolor(&factor, value);
- wined3d_mutex_lock();
- wined3d_stateblock_set_blend_factor(device->update_state, &factor);
- if (!device->recording)
- wined3d_device_set_blend_state(device->wined3d_device, NULL, &factor);
- wined3d_mutex_unlock();
-
- return D3D_OK;
- }
-
wined3d_mutex_lock();
wined3d_stateblock_set_render_state(device->update_state, state, value);
if (!device->recording)
- wined3d_device_set_render_state(device->wined3d_device, state, value);
+ {
+ if (state == D3DRS_BLENDFACTOR)
+ {
+ wined3d_color_from_d3dcolor(&factor, value);
+ wined3d_device_set_blend_state(device->wined3d_device, NULL, &factor);
+ }
+ else
+ wined3d_device_set_render_state(device->wined3d_device, state, value);
+ }
wined3d_mutex_unlock();
return D3D_OK;
@@ -2330,20 +2326,9 @@ static HRESULT WINAPI d3d9_device_GetRenderState(IDirect3DDevice9Ex *iface,
{
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
const struct wined3d_stateblock_state *device_state;
- struct wined3d_color factor;
TRACE("iface %p, state %#x, value %p.\n", iface, state, value);
- if (state == D3DRS_BLENDFACTOR)
- {
- wined3d_mutex_lock();
- wined3d_device_get_blend_state(device->wined3d_device, &factor);
- wined3d_mutex_unlock();
- *value = D3DCOLOR_COLORVALUE(factor.r, factor.g, factor.b, factor.a);
-
- return D3D_OK;
- }
-
wined3d_mutex_lock();
device_state = wined3d_stateblock_get_state(device->state);
*value = device_state->rs[state];
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 1a0ba0a3d59..24134b8f3ef 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -35,6 +35,7 @@ static const DWORD pixel_states_render[] =
WINED3D_RS_ALPHAREF,
WINED3D_RS_ALPHATESTENABLE,
WINED3D_RS_ANTIALIASEDLINEENABLE,
+ WINED3D_RS_BLENDFACTOR,
WINED3D_RS_BLENDOP,
WINED3D_RS_BLENDOPALPHA,
WINED3D_RS_BACK_STENCILFAIL,
@@ -208,7 +209,6 @@ static void stateblock_savedstates_set_all(struct wined3d_saved_states *states,
states->pixelShader = 1;
states->vertexShader = 1;
states->scissorRect = 1;
- states->blend_state = 1;
/* Fixed size arrays */
states->streamSource = 0xffff;
@@ -236,7 +236,6 @@ static void stateblock_savedstates_set_pixel(struct wined3d_saved_states *states
unsigned int i;
states->pixelShader = 1;
- states->blend_state = 1;
for (i = 0; i < ARRAY_SIZE(pixel_states_render); ++i)
{
@@ -903,15 +902,6 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock,
stateblock->stateblock_state.scissor_rect = state->scissor_rect;
}
- if (stateblock->changed.blend_state
- && memcmp(&state->blend_factor, &stateblock->stateblock_state.blend_factor,
- sizeof(stateblock->stateblock_state.blend_factor)))
- {
- TRACE("Updating blend factor.\n");
-
- stateblock->stateblock_state.blend_factor = state->blend_factor;
- }
-
map = stateblock->changed.streamSource;
for (i = 0; map; map >>= 1, ++i)
{
@@ -1129,7 +1119,14 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock,
enum wined3d_render_state rs = stateblock->contained_render_states[i];
state->rs[rs] = stateblock->stateblock_state.rs[rs];
- wined3d_device_set_render_state(device, rs, stateblock->stateblock_state.rs[rs]);
+ if (rs == WINED3D_RS_BLENDFACTOR)
+ {
+ struct wined3d_color color;
+ wined3d_color_from_d3dcolor(&color, stateblock->stateblock_state.rs[rs]);
+ wined3d_device_set_blend_state(device, NULL, &color);
+ }
+ else
+ wined3d_device_set_render_state(device, rs, stateblock->stateblock_state.rs[rs]);
}
/* Texture states. */
@@ -1209,12 +1206,6 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock,
wined3d_device_set_scissor_rects(device, 1, &stateblock->stateblock_state.scissor_rect);
}
- if (stateblock->changed.blend_state)
- {
- state->blend_factor = stateblock->stateblock_state.blend_factor;
- wined3d_device_set_blend_state(device, NULL, &stateblock->stateblock_state.blend_factor);
- }
-
map = stateblock->changed.streamSource;
for (i = 0; map; map >>= 1, ++i)
{
@@ -1437,15 +1428,6 @@ void CDECL wined3d_stateblock_set_render_state(struct wined3d_stateblock *stateb
stateblock->changed.renderState[state >> 5] |= 1u << (state & 0x1f);
}
-void CDECL wined3d_stateblock_set_blend_factor(struct wined3d_stateblock *stateblock,
- const struct wined3d_color *blend_factor)
-{
- TRACE("stateblock %p, blend_factor %p.\n", stateblock, blend_factor);
-
- stateblock->stateblock_state.blend_factor = *blend_factor;
- stateblock->changed.blend_state = TRUE;
-}
-
void CDECL wined3d_stateblock_set_sampler_state(struct wined3d_stateblock *stateblock,
UINT sampler_idx, enum wined3d_sampler_state state, DWORD value)
{
@@ -1827,6 +1809,7 @@ static void init_default_render_states(DWORD rs[WINEHIGHEST_RENDER_STATE + 1], c
rs[WINED3D_RS_COLORWRITEENABLE1] = 0x0000000f;
rs[WINED3D_RS_COLORWRITEENABLE2] = 0x0000000f;
rs[WINED3D_RS_COLORWRITEENABLE3] = 0x0000000f;
+ rs[WINED3D_RS_BLENDFACTOR] = 0xffffffff;
rs[WINED3D_RS_SRGBWRITEENABLE] = 0;
rs[WINED3D_RS_DEPTHBIAS] = 0;
rs[WINED3D_RS_WRAP8] = 0;
@@ -1971,11 +1954,6 @@ static void stateblock_state_init_default(struct wined3d_stateblock_state *state
init_default_sampler_states(state->sampler_states);
- state->blend_factor.r = 1.0f;
- state->blend_factor.g = 1.0f;
- state->blend_factor.b = 1.0f;
- state->blend_factor.a = 1.0f;
-
for (i = 0; i < WINED3D_MAX_STREAMS; ++i)
state->streams[i].frequency = 1;
}
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index bec84b5979c..716b902f313 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -264,7 +264,6 @@
@ cdecl wined3d_stateblock_init_contained_states(ptr)
@ cdecl wined3d_stateblock_reset(ptr)
@ cdecl wined3d_stateblock_set_base_vertex_index(ptr long)
-@ cdecl wined3d_stateblock_set_blend_factor(ptr ptr)
@ cdecl wined3d_stateblock_set_clip_plane(ptr long ptr)
@ cdecl wined3d_stateblock_set_index_buffer(ptr ptr long)
@ cdecl wined3d_stateblock_set_light(ptr long ptr)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 2a7dffb26a9..34bef2c10fc 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3874,9 +3874,8 @@ struct wined3d_saved_states
DWORD pixelShader : 1;
DWORD vertexShader : 1;
DWORD scissorRect : 1;
- DWORD blend_state : 1;
DWORD store_stream_offset : 1;
- DWORD padding : 3;
+ DWORD padding : 4;
};
struct StageState {
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 8b64bf66c23..fd8c56bf781 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -384,6 +384,7 @@ enum wined3d_render_state
WINED3D_RS_COLORWRITEENABLE1 = 190,
WINED3D_RS_COLORWRITEENABLE2 = 191,
WINED3D_RS_COLORWRITEENABLE3 = 192,
+ WINED3D_RS_BLENDFACTOR = 193,
WINED3D_RS_SRGBWRITEENABLE = 194,
WINED3D_RS_DEPTHBIAS = 195,
WINED3D_RS_WRAP8 = 198,
@@ -2151,7 +2152,6 @@ struct wined3d_stateblock_state
BOOL ps_consts_b[WINED3D_MAX_CONSTS_B];
DWORD rs[WINEHIGHEST_RENDER_STATE + 1];
- struct wined3d_color blend_factor;
struct wined3d_texture *textures[WINED3D_MAX_COMBINED_SAMPLERS];
DWORD sampler_states[WINED3D_MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1];
@@ -2726,8 +2726,6 @@ ULONG __cdecl wined3d_stateblock_incref(struct wined3d_stateblock *stateblock);
void __cdecl wined3d_stateblock_init_contained_states(struct wined3d_stateblock *stateblock);
void __cdecl wined3d_stateblock_reset(struct wined3d_stateblock *stateblock);
void __cdecl wined3d_stateblock_set_base_vertex_index(struct wined3d_stateblock *stateblock, INT base_index);
-void __cdecl wined3d_stateblock_set_blend_factor(struct wined3d_stateblock *stateblock,
- const struct wined3d_color *blend_factor);
HRESULT __cdecl wined3d_stateblock_set_clip_plane(struct wined3d_stateblock *stateblock,
UINT plane_idx, const struct wined3d_vec4 *plane);
void __cdecl wined3d_stateblock_set_index_buffer(struct wined3d_stateblock *stateblock,
--
2.23.0
Dec. 2, 2019
Re: [PATCH v2 6/6] wined3d: Store the blend factor in the stateblock as a render state.
by Zebediah Figura
On 12/2/19 6:59 AM, Henri Verbeet wrote:
> On Thu, 28 Nov 2019 at 09:24, Zebediah Figura <z.figura12(a)gmail.com> wrote:
>> @@ -1921,11 +1904,6 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d
>>
>> init_default_sampler_states(state->sampler_states);
>>
>> - state->blend_factor.r = 1.0f;
>> - state->blend_factor.g = 1.0f;
>> - state->blend_factor.b = 1.0f;
>> - state->blend_factor.a = 1.0f;
>> -
> This one should stay, right?
>
Yep, thanks for catching that. I swear I looked over this several times
to make sure I was only touching the stateblock_state, and I still
missed this :-/
Dec. 2, 2019
[PATCH vkd3d v2] vkd3d-shader: Print more info about skipped dxbc chunks.
by Conor McCarthy
Instead of a hex number, print the type of chunk, or at least the
four tag chars. This makes it easier to check if skipping a chunk is
a problem.
Signed-off-by: Conor McCarthy <cmccarthy(a)codeweavers.com>
---
Supersedes 174669.
---
libs/vkd3d-shader/dxbc.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c
index 98c51e4..866853b 100644
--- a/libs/vkd3d-shader/dxbc.c
+++ b/libs/vkd3d-shader/dxbc.c
@@ -1862,6 +1862,11 @@ bool shader_sm4_is_end(void *data, const DWORD **ptr)
#define TAG_SHEX MAKE_TAG('S', 'H', 'E', 'X')
#define TAG_AON9 MAKE_TAG('A', 'o', 'n', '9')
#define TAG_RTS0 MAKE_TAG('R', 'T', 'S', '0')
+#define TAG_IFCE MAKE_TAG('I', 'F', 'C', 'E')
+#define TAG_RDEF MAKE_TAG('R', 'D', 'E', 'F')
+#define TAG_SFI0 MAKE_TAG('S', 'F', 'I', '0')
+#define TAG_SPDB MAKE_TAG('S', 'P', 'D', 'B')
+#define TAG_STAT MAKE_TAG('S', 'T', 'A', 'T')
static bool require_space(size_t offset, size_t count, size_t size, size_t data_size)
{
@@ -2092,6 +2097,7 @@ int shader_parse_input_signature(const void *dxbc, size_t dxbc_length,
static int shdr_handler(const char *data, DWORD data_size, DWORD tag, void *context)
{
struct vkd3d_shader_desc *desc = context;
+ char tag_chars[sizeof(tag) + 1];
int ret;
switch (tag)
@@ -2142,8 +2148,33 @@ static int shdr_handler(const char *data, DWORD data_size, DWORD tag, void *cont
TRACE("Skipping AON9 shader code chunk.\n");
break;
+ case TAG_IFCE:
+ TRACE("Skipping interface/class reflection chunk.\n");
+ break;
+
+ case TAG_RDEF:
+ TRACE("Skipping resource reflection chunk.\n");
+ break;
+
+ case TAG_SFI0:
+ if (data_size >= sizeof(DWORD))
+ TRACE("Ignoring flag chunk, value %#x.\n", *(const DWORD *)data);
+ else
+ TRACE("Ignoring flag chunk.\n");
+ break;
+
+ case TAG_SPDB:
+ TRACE("Skipping debug info chunk.\n");
+ break;
+
+ case TAG_STAT:
+ TRACE("Skipping statistics chunk.\n");
+ break;
+
default:
- TRACE("Skipping chunk %#x.\n", tag);
+ memcpy(tag_chars, &tag, sizeof(tag));
+ tag_chars[sizeof(tag)] = 0;
+ TRACE("Skipping chunk %s.\n", debugstr_a(tag_chars));
break;
}
--
2.24.0
Dec. 2, 2019
[PATCH 3/3] wined3d: Validate dirty regions in wined3d_texture_add_dirty_region().
by Henri Verbeet
From: Akihiro Sagawa <sagawa.aki(a)gmail.com>
Signed-off-by: Akihiro Sagawa <sagawa.aki(a)gmail.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
This supersedes patch 174852.
dlls/d3d8/tests/visual.c | 2 +-
dlls/d3d9/tests/visual.c | 2 +-
dlls/wined3d/texture.c | 7 +++++++
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c
index 96ab4596a76..4477184b573 100644
--- a/dlls/d3d8/tests/visual.c
+++ b/dlls/d3d8/tests/visual.c
@@ -5797,7 +5797,7 @@ static void add_dirty_rect_test(void)
for (i = 0; i < ARRAY_SIZE(oob_rect); ++i)
{
hr = IDirect3DTexture8_AddDirtyRect(tex_src_red, &oob_rect[i]);
- todo_wine ok(hr == D3DERR_INVALIDCALL, "[%u] Got unexpected hr %#x.\n", i, hr);
+ ok(hr == D3DERR_INVALIDCALL, "[%u] Got unexpected hr %#x.\n", i, hr);
hr = IDirect3DTexture8_LockRect(tex_src_red, 0, &locked_rect, &oob_rect[i], 0);
ok(SUCCEEDED(hr), "[%u] Got unexpected hr %#x.\n", i, hr);
hr = IDirect3DTexture8_UnlockRect(tex_src_red, 0);
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index f19bd11607a..0a9fb0acc29 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -19608,7 +19608,7 @@ static void add_dirty_rect_test(void)
for (i = 0; i < ARRAY_SIZE(oob_rect); ++i)
{
hr = IDirect3DTexture9_AddDirtyRect(tex_src_red, &oob_rect[i]);
- todo_wine ok(hr == D3DERR_INVALIDCALL, "[%u] Got unexpected hr %#x.\n", i, hr);
+ ok(hr == D3DERR_INVALIDCALL, "[%u] Got unexpected hr %#x.\n", i, hr);
hr = IDirect3DTexture9_LockRect(tex_src_red, 0, &locked_rect, &oob_rect[i], 0);
ok(SUCCEEDED(hr), "[%u] Got unexpected hr %#x.\n", i, hr);
hr = IDirect3DTexture9_UnlockRect(tex_src_red, 0);
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index d4d90c280a1..976235bf60f 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1838,7 +1838,14 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
}
if (dirty_region)
+ {
+ if (FAILED(wined3d_texture_check_box_dimensions(texture, 0, dirty_region)))
+ {
+ WARN("Invalid dirty_region %s specified.\n", debug_box(dirty_region));
+ return WINED3DERR_INVALIDCALL;
+ }
FIXME("Ignoring dirty_region %s.\n", debug_box(dirty_region));
+ }
wined3d_cs_emit_add_dirty_texture_region(texture->resource.device->cs, texture, layer);
--
2.11.0
Dec. 2, 2019