winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
April 2012
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
718 discussions
Start a n
N
ew thread
Christian Costa : dmusic: Add trace to DMUSIC_CreateReferenceClockImpl and rename some variables.
by Alexandre Julliard
11 Apr '12
11 Apr '12
Module: wine Branch: master Commit: eb03e83348122a9100403a850a7665b42100f249 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=eb03e83348122a9100403a850…
Author: Christian Costa <titan.costa(a)gmail.com> Date: Tue Apr 10 22:30:45 2012 +0200 dmusic: Add trace to DMUSIC_CreateReferenceClockImpl and rename some variables. --- dlls/dmusic/clock.c | 30 +++++++++++++++++------------- 1 files changed, 17 insertions(+), 13 deletions(-) diff --git a/dlls/dmusic/clock.c b/dlls/dmusic/clock.c index 53f7715..4505876 100644 --- a/dlls/dmusic/clock.c +++ b/dlls/dmusic/clock.c @@ -99,18 +99,22 @@ static const IReferenceClockVtbl ReferenceClock_Vtbl = { }; /* for ClassFactory */ -HRESULT WINAPI DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) { - IReferenceClockImpl* clock; +HRESULT WINAPI DMUSIC_CreateReferenceClockImpl(LPCGUID riid, LPVOID* ret_iface, LPUNKNOWN unkouter) +{ + IReferenceClockImpl* clock; - clock = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IReferenceClockImpl)); - if (NULL == clock) { - *ppobj = NULL; - return E_OUTOFMEMORY; - } - clock->lpVtbl = &ReferenceClock_Vtbl; - clock->ref = 0; /* will be inited by QueryInterface */ - clock->rtTime = 0; - clock->pClockInfo.dwSize = sizeof (DMUS_CLOCKINFO); - - return IReferenceClockImpl_QueryInterface ((IReferenceClock *)clock, lpcGUID, ppobj); + TRACE("(%p,%p,%p)\n", riid, ret_iface, unkouter); + + clock = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IReferenceClockImpl)); + if (!clock) { + *ret_iface = NULL; + return E_OUTOFMEMORY; + } + + clock->lpVtbl = &ReferenceClock_Vtbl; + clock->ref = 0; /* will be inited by QueryInterface */ + clock->rtTime = 0; + clock->pClockInfo.dwSize = sizeof (DMUS_CLOCKINFO); + + return IReferenceClockImpl_QueryInterface((IReferenceClock*)clock, riid, ret_iface); }
1
0
0
0
Christian Costa : dmusic: Check wrong params when creating a port + tests.
by Alexandre Julliard
11 Apr '12
11 Apr '12
Module: wine Branch: master Commit: c05c04952e5c283e6149bd3bf71ac3c3875f928d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c05c04952e5c283e6149bd3bf…
Author: Christian Costa <titan.costa(a)gmail.com> Date: Tue Apr 10 22:30:38 2012 +0200 dmusic: Check wrong params when creating a port + tests. --- dlls/dmusic/dmusic.c | 14 ++++++++++++-- dlls/dmusic/tests/dmusic.c | 10 ++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/dlls/dmusic/dmusic.c b/dlls/dmusic/dmusic.c index eab3770..253ef1a 100644 --- a/dlls/dmusic/dmusic.c +++ b/dlls/dmusic/dmusic.c @@ -167,7 +167,8 @@ static HRESULT WINAPI IDirectMusic8Impl_CreateMusicBuffer (LPDIRECTMUSIC8 iface, return DMUSIC_CreateDirectMusicBufferImpl(&IID_IDirectMusicBuffer, (LPVOID)ppBuffer, NULL); } -static HRESULT WINAPI IDirectMusic8Impl_CreatePort (LPDIRECTMUSIC8 iface, REFCLSID rclsidPort, LPDMUS_PORTPARAMS pPortParams, LPDIRECTMUSICPORT* ppPort, LPUNKNOWN pUnkOuter) { +static HRESULT WINAPI IDirectMusic8Impl_CreatePort(LPDIRECTMUSIC8 iface, REFCLSID rclsidPort, LPDMUS_PORTPARAMS pPortParams, LPDIRECTMUSICPORT* ppPort, LPUNKNOWN pUnkOuter) +{ IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface; int i; DMUS_PORTCAPS PortCaps; @@ -181,8 +182,17 @@ static HRESULT WINAPI IDirectMusic8Impl_CreatePort (LPDIRECTMUSIC8 iface, REFCLS if (TRACE_ON(dmusic)) dump_DMUS_PORTPARAMS(pPortParams); - if(!rclsidPort) + if (!rclsidPort) + return E_POINTER; + if (!pPortParams) + return E_INVALIDARG; + if (!ppPort) return E_POINTER; + if (pUnkOuter) + return CLASS_E_NOAGGREGATION; + + if (TRACE_ON(dmusic)) + dump_DMUS_PORTPARAMS(pPortParams); ZeroMemory(&PortCaps, sizeof(DMUS_PORTCAPS)); PortCaps.dwSize = sizeof(DMUS_PORTCAPS); diff --git a/dlls/dmusic/tests/dmusic.c b/dlls/dmusic/tests/dmusic.c index 6853ad9..29ad642 100644 --- a/dlls/dmusic/tests/dmusic.c +++ b/dlls/dmusic/tests/dmusic.c @@ -66,6 +66,16 @@ static void test_dmusic(void) hr = IDirectMusic_SetDirectSound(dmusic, NULL, NULL); ok(hr == S_OK, "IDirectMusic_SetDirectSound returned: %x\n", hr); + /* Check wrong params */ + hr = IDirectMusic_CreatePort(dmusic, &GUID_NULL, &port_params, &port, (IUnknown*)dmusic); + ok(hr == CLASS_E_NOAGGREGATION, "IDirectMusic_CreatePort returned: %x\n", hr); + hr = IDirectMusic_CreatePort(dmusic, NULL, &port_params, &port, NULL); + ok(hr == E_POINTER, "IDirectMusic_CreatePort returned: %x\n", hr); + hr = IDirectMusic_CreatePort(dmusic, &GUID_NULL, NULL, &port, NULL); + ok(hr == E_INVALIDARG, "IDirectMusic_CreatePort returned: %x\n", hr); + hr = IDirectMusic_CreatePort(dmusic, &GUID_NULL, &port_params, NULL, NULL); + ok(hr == E_POINTER, "IDirectMusic_CreatePort returned: %x\n", hr); + /* Test creation of default port with GUID_NULL */ hr = IDirectMusic_CreatePort(dmusic, &GUID_NULL, &port_params, &port, NULL); ok(hr == S_OK, "IDirectMusic_CreatePort returned: %x\n", hr);
1
0
0
0
Christian Costa : dmusic: Add dump function for DMUS_PORTPARAMS struct.
by Alexandre Julliard
11 Apr '12
11 Apr '12
Module: wine Branch: master Commit: 7776591ff43e9a98f1d3d6412ffe3e282670d894 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7776591ff43e9a98f1d3d6412…
Author: Christian Costa <titan.costa(a)gmail.com> Date: Tue Apr 10 22:30:29 2012 +0200 dmusic: Add dump function for DMUS_PORTPARAMS struct. --- dlls/dmusic/dmusic.c | 3 +++ dlls/dmusic/dmusic_main.c | 28 ++++++++++++++++++++++++++++ dlls/dmusic/dmusic_private.h | 2 ++ 3 files changed, 33 insertions(+), 0 deletions(-) diff --git a/dlls/dmusic/dmusic.c b/dlls/dmusic/dmusic.c index ef3143f..eab3770 100644 --- a/dlls/dmusic/dmusic.c +++ b/dlls/dmusic/dmusic.c @@ -178,6 +178,9 @@ static HRESULT WINAPI IDirectMusic8Impl_CreatePort (LPDIRECTMUSIC8 iface, REFCLS TRACE("(%p, %s, %p, %p, %p)\n", This, debugstr_dmguid(rclsidPort), pPortParams, ppPort, pUnkOuter); + if (TRACE_ON(dmusic)) + dump_DMUS_PORTPARAMS(pPortParams); + if(!rclsidPort) return E_POINTER; diff --git a/dlls/dmusic/dmusic_main.c b/dlls/dmusic/dmusic_main.c index be6fb56..66080a7 100644 --- a/dlls/dmusic/dmusic_main.c +++ b/dlls/dmusic/dmusic_main.c @@ -463,3 +463,31 @@ void dump_DMUS_OBJECTDESC(LPDMUS_OBJECTDESC desc) wine_dbgstr_longlong(desc->llMemLength), desc->pbMemData); if (desc->dwValidData & DMUS_OBJ_STREAM) TRACE(" - pStream = %p\n", desc->pStream); } + +/* Dump DMUS_PORTPARAMS flags */ +static const char* debugstr_DMUS_PORTPARAMS_FLAGS(DWORD flagmask) +{ + static const flag_info flags[] = { + FE(DMUS_PORTPARAMS_VOICES), + FE(DMUS_PORTPARAMS_CHANNELGROUPS), + FE(DMUS_PORTPARAMS_AUDIOCHANNELS), + FE(DMUS_PORTPARAMS_SAMPLERATE), + FE(DMUS_PORTPARAMS_EFFECTS), + FE(DMUS_PORTPARAMS_SHARE) + }; + return debugstr_flags(flagmask, flags, sizeof(flags)/sizeof(flags[0])); +} + +/* Dump whole DMUS_PORTPARAMS struct */ +void dump_DMUS_PORTPARAMS(LPDMUS_PORTPARAMS params) +{ + TRACE("DMUS_PORTPARAMS (%p):\n", params); + TRACE(" - dwSize = %d\n", params->dwSize); + TRACE(" - dwValidParams = %s\n", debugstr_DMUS_PORTPARAMS_FLAGS(params->dwValidParams)); + if (params->dwValidParams & DMUS_PORTPARAMS_VOICES) TRACE(" - dwVoices = %u\n", params->dwVoices); + if (params->dwValidParams & DMUS_PORTPARAMS_CHANNELGROUPS) TRACE(" - dwChannelGroup = %u\n", params->dwChannelGroups); + if (params->dwValidParams & DMUS_PORTPARAMS_AUDIOCHANNELS) TRACE(" - dwAudioChannels = %u\n", params->dwAudioChannels); + if (params->dwValidParams & DMUS_PORTPARAMS_SAMPLERATE) TRACE(" - dwSampleRate = %u\n", params->dwSampleRate); + if (params->dwValidParams & DMUS_PORTPARAMS_EFFECTS) TRACE(" - dwEffectFlags = %x\n", params->dwEffectFlags); + if (params->dwValidParams & DMUS_PORTPARAMS_SHARE) TRACE(" - fShare = %u\n", params->fShare); +} diff --git a/dlls/dmusic/dmusic_private.h b/dlls/dmusic/dmusic_private.h index 498df9e..cffea34 100644 --- a/dlls/dmusic/dmusic_private.h +++ b/dlls/dmusic/dmusic_private.h @@ -276,5 +276,7 @@ extern const char *debugstr_fourcc (DWORD fourcc) DECLSPEC_HIDDEN; extern const char *debugstr_dmguid (const GUID *id) DECLSPEC_HIDDEN; /* Dump whole DMUS_OBJECTDESC struct */ extern void dump_DMUS_OBJECTDESC(LPDMUS_OBJECTDESC desc) DECLSPEC_HIDDEN; +/* Dump whole DMUS_PORTPARAMS struct */ +extern void dump_DMUS_PORTPARAMS(LPDMUS_PORTPARAMS params) DECLSPEC_HIDDEN; #endif /* __WINE_DMUSIC_PRIVATE_H */
1
0
0
0
Christian Costa : dmusic: Replace debugstr_DMUS_OBJECTDESC by a specific dump function to avoid debug buffer overflow .
by Alexandre Julliard
11 Apr '12
11 Apr '12
Module: wine Branch: master Commit: 7a772ed83a99c5b516e6500d544885dda6deedbf URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7a772ed83a99c5b516e6500d5…
Author: Christian Costa <titan.costa(a)gmail.com> Date: Tue Apr 10 22:30:21 2012 +0200 dmusic: Replace debugstr_DMUS_OBJECTDESC by a specific dump function to avoid debug buffer overflow. --- dlls/dmusic/collection.c | 30 +++++++++++++++++++++++------- dlls/dmusic/dmusic_main.c | 39 ++++++++++++++++----------------------- dlls/dmusic/dmusic_private.h | 6 +++--- 3 files changed, 42 insertions(+), 33 deletions(-) diff --git a/dlls/dmusic/collection.c b/dlls/dmusic/collection.c index faafd64..3d9dc18 100644 --- a/dlls/dmusic/collection.c +++ b/dlls/dmusic/collection.c @@ -189,9 +189,20 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_GetDescripto return S_OK; } -static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) { +static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_SetDescriptor(LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) +{ ICOM_THIS_MULTI(IDirectMusicCollectionImpl, ObjectVtbl, iface); - TRACE("(%p, %p): setting descriptor:\n%s\n", This, pDesc, debugstr_DMUS_OBJECTDESC (pDesc)); + + TRACE("(%p, %p)\n", iface, pDesc); + + if (!pDesc) + return E_POINTER; + + if (TRACE_ON(dmusic)) + { + TRACE("Setting descriptor:\n"); + dump_DMUS_OBJECTDESC(pDesc); + } /* According to MSDN, we should copy only given values, not whole struct */ if (pDesc->dwValidData & DMUS_OBJ_OBJECT) @@ -223,7 +234,8 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_SetDescripto return S_OK; } -static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) { +static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_ParseDescriptor(LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) +{ ICOM_THIS_MULTI(IDirectMusicCollectionImpl, ObjectVtbl, iface); DMUS_PRIVATE_CHUNK Chunk; DWORD StreamSize, StreamCount, ListSize[1], ListCount[1]; @@ -384,10 +396,14 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_ParseDescrip IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */ return DMUS_E_INVALIDFILE; } - } - - TRACE(": returning descriptor:\n%s\n", debugstr_DMUS_OBJECTDESC (pDesc)); - + } + + if (TRACE_ON(dmusic)) + { + TRACE("Returning descriptor:\n"); + dump_DMUS_OBJECTDESC(pDesc); + } + return S_OK; } diff --git a/dlls/dmusic/dmusic_main.c b/dlls/dmusic/dmusic_main.c index 723b90a..be6fb56 100644 --- a/dlls/dmusic/dmusic_main.c +++ b/dlls/dmusic/dmusic_main.c @@ -446,27 +446,20 @@ static const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask) { return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0])); } -/* dump whole DMUS_OBJECTDESC struct */ -const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) { - if (pDesc) { - char buffer[1024] = "", *ptr = &buffer[0]; - - ptr += sprintf(ptr, "DMUS_OBJECTDESC (%p):\n", pDesc); - ptr += sprintf(ptr, " - dwSize = %d\n", pDesc->dwSize); - ptr += sprintf(ptr, " - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (pDesc->dwValidData)); - if (pDesc->dwValidData & DMUS_OBJ_CLASS) ptr += sprintf(ptr, " - guidClass = %s\n", debugstr_dmguid(&pDesc->guidClass)); - if (pDesc->dwValidData & DMUS_OBJ_OBJECT) ptr += sprintf(ptr, " - guidObject = %s\n", debugstr_guid(&pDesc->guidObject)); - if (pDesc->dwValidData & DMUS_OBJ_DATE) ptr += sprintf(ptr, " - ftDate = FIXME\n"); - if (pDesc->dwValidData & DMUS_OBJ_VERSION) ptr += sprintf(ptr, " - vVersion = %s\n", debugstr_dmversion(&pDesc->vVersion)); - if (pDesc->dwValidData & DMUS_OBJ_NAME) ptr += sprintf(ptr, " - wszName = %s\n", debugstr_w(pDesc->wszName)); - if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) ptr += sprintf(ptr, " - wszCategory = %s\n", debugstr_w(pDesc->wszCategory)); - if (pDesc->dwValidData & DMUS_OBJ_FILENAME) ptr += sprintf(ptr, " - wszFileName = %s\n", debugstr_w(pDesc->wszFileName)); - if (pDesc->dwValidData & DMUS_OBJ_MEMORY) ptr += sprintf(ptr, " - llMemLength = 0x%s\n - pbMemData = %p\n", - wine_dbgstr_longlong(pDesc->llMemLength), pDesc->pbMemData); - if (pDesc->dwValidData & DMUS_OBJ_STREAM) ptr += sprintf(ptr, " - pStream = %p", pDesc->pStream); - - return wine_dbg_sprintf("%s", buffer); - } else { - return wine_dbg_sprintf("(NULL)"); - } +/* Dump whole DMUS_OBJECTDESC struct */ +void dump_DMUS_OBJECTDESC(LPDMUS_OBJECTDESC desc) +{ + TRACE("DMUS_OBJECTDESC (%p):\n", desc); + TRACE(" - dwSize = %d\n", desc->dwSize); + TRACE(" - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (desc->dwValidData)); + if (desc->dwValidData & DMUS_OBJ_CLASS) TRACE(" - guidClass = %s\n", debugstr_dmguid(&desc->guidClass)); + if (desc->dwValidData & DMUS_OBJ_OBJECT) TRACE(" - guidObject = %s\n", debugstr_guid(&desc->guidObject)); + if (desc->dwValidData & DMUS_OBJ_DATE) TRACE(" - ftDate = FIXME\n"); + if (desc->dwValidData & DMUS_OBJ_VERSION) TRACE(" - vVersion = %s\n", debugstr_dmversion(&desc->vVersion)); + if (desc->dwValidData & DMUS_OBJ_NAME) TRACE(" - wszName = %s\n", debugstr_w(desc->wszName)); + if (desc->dwValidData & DMUS_OBJ_CATEGORY) TRACE(" - wszCategory = %s\n", debugstr_w(desc->wszCategory)); + if (desc->dwValidData & DMUS_OBJ_FILENAME) TRACE(" - wszFileName = %s\n", debugstr_w(desc->wszFileName)); + if (desc->dwValidData & DMUS_OBJ_MEMORY) TRACE(" - llMemLength = 0x%s\n - pbMemData = %p\n", + wine_dbgstr_longlong(desc->llMemLength), desc->pbMemData); + if (desc->dwValidData & DMUS_OBJ_STREAM) TRACE(" - pStream = %p\n", desc->pStream); } diff --git a/dlls/dmusic/dmusic_private.h b/dlls/dmusic/dmusic_private.h index c05adf0..498df9e 100644 --- a/dlls/dmusic/dmusic_private.h +++ b/dlls/dmusic/dmusic_private.h @@ -274,7 +274,7 @@ extern int even_or_odd (DWORD number) DECLSPEC_HIDDEN; extern const char *debugstr_fourcc (DWORD fourcc) DECLSPEC_HIDDEN; /* returns name of given GUID */ extern const char *debugstr_dmguid (const GUID *id) DECLSPEC_HIDDEN; -/* dump whole DMUS_OBJECTDESC struct */ -extern const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) DECLSPEC_HIDDEN; +/* Dump whole DMUS_OBJECTDESC struct */ +extern void dump_DMUS_OBJECTDESC(LPDMUS_OBJECTDESC desc) DECLSPEC_HIDDEN; -#endif /* __WINE_DMUSIC_PRIVATE_H */ +#endif /* __WINE_DMUSIC_PRIVATE_H */
1
0
0
0
Christian Costa : kernel32: Limit dwTotalPageFile in GlobalMemoryStatus to 4Gb minus 512kb for apps that do not expect so much memory .
by Alexandre Julliard
11 Apr '12
11 Apr '12
Module: wine Branch: master Commit: d8822cf3d2708dccb3e04d72ddf73662e7992f85 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d8822cf3d2708dccb3e04d72d…
Author: Christian Costa <titan.costa(a)gmail.com> Date: Tue Apr 10 22:04:30 2012 +0200 kernel32: Limit dwTotalPageFile in GlobalMemoryStatus to 4Gb minus 512kb for apps that do not expect so much memory. --- dlls/kernel32/heap.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dlls/kernel32/heap.c b/dlls/kernel32/heap.c index db21b7a..d730a8a 100644 --- a/dlls/kernel32/heap.c +++ b/dlls/kernel32/heap.c @@ -1305,7 +1305,7 @@ BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpmemex ) * roughly how much they are able to allocate * * RETURNS - * None + * None */ VOID WINAPI GlobalMemoryStatus( LPMEMORYSTATUS lpBuffer ) { @@ -1333,13 +1333,14 @@ VOID WINAPI GlobalMemoryStatus( LPMEMORYSTATUS lpBuffer ) { lpBuffer->dwTotalPhys = min( memstatus.ullTotalPhys, MAXDWORD ); lpBuffer->dwAvailPhys = min( memstatus.ullAvailPhys, MAXDWORD ); - lpBuffer->dwTotalPageFile = min( memstatus.ullTotalPageFile, MAXDWORD ); + /* Limit value for apps that do not expect so much memory. Remove last 512 kb to make Sacrifice demo happy. */ + lpBuffer->dwTotalPageFile = min( memstatus.ullTotalPageFile, 0xfff7ffff ); lpBuffer->dwAvailPageFile = min( memstatus.ullAvailPageFile, MAXDWORD ); lpBuffer->dwTotalVirtual = min( memstatus.ullTotalVirtual, MAXDWORD ); lpBuffer->dwAvailVirtual = min( memstatus.ullAvailVirtual, MAXDWORD ); } - else /* duplicate NT bug */ + else /* duplicate NT bug */ { lpBuffer->dwTotalPhys = memstatus.ullTotalPhys; lpBuffer->dwAvailPhys = memstatus.ullAvailPhys;
1
0
0
0
Piotr Caban : msvcrt/tests: Added more strftime tests.
by Alexandre Julliard
11 Apr '12
11 Apr '12
Module: wine Branch: master Commit: 43d208d215fa1a344fddbd7d9c4eebd9b716f23e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=43d208d215fa1a344fddbd7d9…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Wed Apr 11 15:22:44 2012 +0200 msvcrt/tests: Added more strftime tests. --- dlls/msvcrt/tests/time.c | 102 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 102 insertions(+), 0 deletions(-) diff --git a/dlls/msvcrt/tests/time.c b/dlls/msvcrt/tests/time.c index 36ef8eb..6fb7491 100644 --- a/dlls/msvcrt/tests/time.c +++ b/dlls/msvcrt/tests/time.c @@ -599,9 +599,47 @@ static void test_strftime(void) gmt_tm = p_gmtime(&gmt); ok(gmt_tm != NULL, "gmtime failed\n"); + errno = 0xdeadbeef; + retA = strftime(NULL, 0, "copy", gmt_tm); + ok(retA == 0, "expected 0, got %ld\n", retA); + ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno); + + retA = strftime(bufA, 256, "copy", NULL); + ok(retA == 4, "expected 4, got %ld\n", retA); + ok(!strcmp(bufA, "copy"), "got %s\n", bufA); + + retA = strftime(bufA, 256, "copy it", gmt_tm); + ok(retA == 7, "expected 7, got %ld\n", retA); + ok(!strcmp(bufA, "copy it"), "got %s\n", bufA); + + errno = 0xdeadbeef; + retA = strftime(bufA, 2, "copy", gmt_tm); + ok(retA == 0, "expected 0, got %ld\n", retA); + ok(!strcmp(bufA, "") || broken(!strcmp(bufA, "copy it")), "got %s\n", bufA); + ok(errno==ERANGE || errno==0xdeadbeef, "errno = %d\n", errno); + + errno = 0xdeadbeef; + retA = strftime(bufA, 256, "a%e", gmt_tm); + ok(retA==0 || broken(retA==1), "expected 0, got %ld\n", retA); + ok(!strcmp(bufA, "") || broken(!strcmp(bufA, "a")), "got %s\n", bufA); + ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno); + + if(0) { /* crashes on Win2k */ + errno = 0xdeadbeef; + retA = strftime(bufA, 256, "%c", NULL); + ok(retA == 0, "expected 0, got %ld\n", retA); + ok(!strcmp(bufA, ""), "got %s\n", bufA); + ok(errno == EINVAL, "errno = %d\n", errno); + } + + retA = strftime(bufA, 256, "e%#%e", gmt_tm); + ok(retA == 3, "expected 3, got %ld\n", retA); + ok(!strcmp(bufA, "e%e"), "got %s\n", bufA); + retA = strftime(bufA, 256, "%c", gmt_tm); ok(retA == 17, "expected 17, got %ld\n", retA); ok(strcmp(bufA, expected) == 0, "expected %s, got %s\n", expected, bufA); + retW = wcsftime(bufW, 256, cW, gmt_tm); ok(retW == 17, "expected 17, got %ld\n", retW); ok(retA == retW, "expected %ld, got %ld\n", retA, retW); @@ -609,6 +647,70 @@ static void test_strftime(void) retA = WideCharToMultiByte(CP_ACP, 0, bufW, retW, buf, 256, NULL, NULL); buf[retA] = 0; ok(strcmp(bufA, buf) == 0, "expected %s, got %s\n", bufA, buf); + + retA = strftime(bufA, 256, "%x", gmt_tm); + ok(retA == 8, "expected 8, got %ld\n", retA); + ok(!strcmp(bufA, "01/01/70"), "got %s\n", bufA); + + retA = strftime(bufA, 256, "%X", gmt_tm); + ok(retA == 8, "expected 8, got %ld\n", retA); + ok(!strcmp(bufA, "00:00:00"), "got %s\n", bufA); + + retA = strftime(bufA, 256, "%a", gmt_tm); + ok(retA == 3, "expected 3, got %ld\n", retA); + ok(!strcmp(bufA, "Thu"), "got %s\n", bufA); + + retA = strftime(bufA, 256, "%A", gmt_tm); + ok(retA == 8, "expected 8, got %ld\n", retA); + ok(!strcmp(bufA, "Thursday"), "got %s\n", bufA); + + retA = strftime(bufA, 256, "%b", gmt_tm); + ok(retA == 3, "expected 3, got %ld\n", retA); + ok(!strcmp(bufA, "Jan"), "got %s\n", bufA); + + retA = strftime(bufA, 256, "%B", gmt_tm); + ok(retA == 7, "expected 7, got %ld\n", retA); + ok(!strcmp(bufA, "January"), "got %s\n", bufA); + + retA = strftime(bufA, 256, "%d", gmt_tm); + ok(retA == 2, "expected 2, got %ld\n", retA); + ok(!strcmp(bufA, "01"), "got %s\n", bufA); + + retA = strftime(bufA, 256, "%#d", gmt_tm); + ok(retA == 1, "expected 1, got %ld\n", retA); + ok(!strcmp(bufA, "1"), "got %s\n", bufA); + + retA = strftime(bufA, 256, "%H", gmt_tm); + ok(retA == 2, "expected 2, got %ld\n", retA); + ok(!strcmp(bufA, "00"), "got %s\n", bufA); + + retA = strftime(bufA, 256, "%I", gmt_tm); + ok(retA == 2, "expected 2, got %ld\n", retA); + ok(!strcmp(bufA, "12"), "got %s\n", bufA); + + retA = strftime(bufA, 256, "%j", gmt_tm); + ok(retA == 3, "expected 3, got %ld\n", retA); + ok(!strcmp(bufA, "001"), "got %s\n", bufA); + + retA = strftime(bufA, 256, "%m", gmt_tm); + ok(retA == 2, "expected 2, got %ld\n", retA); + ok(!strcmp(bufA, "01"), "got %s\n", bufA); + + retA = strftime(bufA, 256, "%#M", gmt_tm); + ok(retA == 1, "expected 1, got %ld\n", retA); + ok(!strcmp(bufA, "0"), "got %s\n", bufA); + + retA = strftime(bufA, 256, "%p", gmt_tm); + ok(retA == 2, "expected 2, got %ld\n", retA); + ok(!strcmp(bufA, "AM"), "got %s\n", bufA); + + gmt_tm->tm_mon = 1; + gmt_tm->tm_mday = 30; + retA = strftime(bufA, 256, "%c", gmt_tm); + todo_wine { + ok(retA == 17, "expected 17, got %ld\n", retA); + ok(!strcmp(bufA, "02/30/70 00:00:00"), "got %s\n", bufA); + } } static void test_asctime(void)
1
0
0
0
Piotr Caban : msvcrt: Added _Strftime implementation.
by Alexandre Julliard
11 Apr '12
11 Apr '12
Module: wine Branch: master Commit: ef08e807651bcb7687e1a68660fc83e3931dc30e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ef08e807651bcb7687e1a6866…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Wed Apr 11 15:22:25 2012 +0200 msvcrt: Added _Strftime implementation. --- dlls/msvcrt/locale.c | 11 -- dlls/msvcrt/tests/time.c | 3 - dlls/msvcrt/time.c | 279 ++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 272 insertions(+), 21 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=ef08e807651bcb7687e1a…
1
0
0
0
Piotr Caban : msvcrt: Added field names to MSVCRT___lc_time_data structure.
by Alexandre Julliard
11 Apr '12
11 Apr '12
Module: wine Branch: master Commit: b58cfb40b9ca4dccac459d2a184ff5cd2e1d3895 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b58cfb40b9ca4dccac459d2a1…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Wed Apr 11 15:22:12 2012 +0200 msvcrt: Added field names to MSVCRT___lc_time_data structure. --- dlls/msvcrt/locale.c | 32 +++++++++++++++----------------- dlls/msvcrt/msvcrt.h | 26 ++++++++++++++------------ 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c index 678550a..a24a5b9 100644 --- a/dlls/msvcrt/locale.c +++ b/dlls/msvcrt/locale.c @@ -427,7 +427,7 @@ char* CDECL _Getdays(void) TRACE("\n"); - size = cur->str[2*7]-cur->str[0]; + size = cur->str.names.short_mon[0]-cur->str.names.short_wday[0]; out = MSVCRT_malloc(size+1); if(!out) return NULL; @@ -435,13 +435,13 @@ char* CDECL _Getdays(void) size = 0; for(i=0; i<7; i++) { out[size++] = ':'; - len = strlen(cur->str[i]); - memcpy(&out[size], cur->str[i], len); + len = strlen(cur->str.names.short_wday[i]); + memcpy(&out[size], cur->str.names.short_wday[i], len); size += len; out[size++] = ':'; - len = strlen(cur->str[7+i]); - memcpy(&out[size], cur->str[7+i], len); + len = strlen(cur->str.names.wday[i]); + memcpy(&out[size], cur->str.names.wday[i], len); size += len; } out[size] = '\0'; @@ -454,15 +454,13 @@ char* CDECL _Getdays(void) */ char* CDECL _Getmonths(void) { - static const int months_offset = 14; - MSVCRT___lc_time_data *cur = get_locinfo()->lc_time_curr; int i, len, size; char *out; TRACE("\n"); - size = cur->str[months_offset+2*12]-cur->str[months_offset]; + size = cur->str.names.am-cur->str.names.short_mon[0]; out = MSVCRT_malloc(size+1); if(!out) return NULL; @@ -470,13 +468,13 @@ char* CDECL _Getmonths(void) size = 0; for(i=0; i<12; i++) { out[size++] = ':'; - len = strlen(cur->str[months_offset+i]); - memcpy(&out[size], cur->str[months_offset+i], len); + len = strlen(cur->str.names.short_mon[i]); + memcpy(&out[size], cur->str.names.short_mon[i], len); size += len; out[size++] = ':'; - len = strlen(cur->str[months_offset+12+i]); - memcpy(&out[size], cur->str[months_offset+12+i], len); + len = strlen(cur->str.names.mon[i]); + memcpy(&out[size], cur->str.names.mon[i], len); size += len; } out[size] = '\0'; @@ -494,8 +492,8 @@ void* CDECL _Gettnames(void) TRACE("\n"); - for(i=0; i<sizeof(cur->str)/sizeof(cur->str[0]); i++) - size += strlen(cur->str[i])+1; + for(i=0; i<sizeof(cur->str.str)/sizeof(cur->str.str[0]); i++) + size += strlen(cur->str.str[i])+1; ret = MSVCRT_malloc(size); if(!ret) @@ -503,8 +501,8 @@ void* CDECL _Gettnames(void) memcpy(ret, cur, size); size = 0; - for(i=0; i<sizeof(cur->str)/sizeof(cur->str[0]); i++) { - ret->str[i] = &ret->data[size]; + for(i=0; i<sizeof(cur->str.str)/sizeof(cur->str.str[0]); i++) { + ret->str.str[i] = &ret->data[size]; size += strlen(&ret->data[size])+1; } @@ -1244,7 +1242,7 @@ MSVCRT__locale_t CDECL MSVCRT__create_locale(int category, const char *locale) ret = 0; for(i=0; i<sizeof(time_data)/sizeof(time_data[0]); i++) { - loc->locinfo->lc_time_curr->str[i] = &loc->locinfo->lc_time_curr->data[ret]; + loc->locinfo->lc_time_curr->str.str[i] = &loc->locinfo->lc_time_curr->data[ret]; if(time_data[i]==LOCALE_SSHORTDATE && !lcid[MSVCRT_LC_TIME]) { memcpy(&loc->locinfo->lc_time_curr->data[ret], cloc_short_date, sizeof(cloc_short_date)); ret += sizeof(cloc_short_date); diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index 26a1177..0fd3410 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -109,18 +109,20 @@ typedef struct MSVCRT_tagLC_ID { } MSVCRT_LC_ID, *MSVCRT_LPLC_ID; typedef struct { - /* str table contains following strings: - * short weekday names [7]; - * weekday names [7]; - * short month names [12]; - * month names [12]; - * s1159 (AM); - * s2359 (PM); - * short date format; - * date format; - * time format; - */ - char *str[43]; + union { + char *str[43]; + struct { + char *short_wday[7]; + char *wday[7]; + char *short_mon[12]; + char *mon[12]; + char *am; + char *pm; + char *short_date; + char *date; + char *time; + } names; + } str; LCID lcid; int unk[2]; MSVCRT_wchar_t *wstr[43];
1
0
0
0
Piotr Caban : msvcrt: Set correct date and time format for C locale.
by Alexandre Julliard
11 Apr '12
11 Apr '12
Module: wine Branch: master Commit: 426e58be698e818ee06ae2b1eebaf51a9aa83245 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=426e58be698e818ee06ae2b1e…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Wed Apr 11 15:22:02 2012 +0200 msvcrt: Set correct date and time format for C locale. --- dlls/msvcrt/locale.c | 70 +++++++++++++++++++++++++++++++++++++------------ 1 files changed, 53 insertions(+), 17 deletions(-) diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c index 699b028..678550a 100644 --- a/dlls/msvcrt/locale.c +++ b/dlls/msvcrt/locale.c @@ -761,6 +761,12 @@ MSVCRT__locale_t CDECL MSVCRT__create_locale(int category, const char *locale) 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"; + static const MSVCRT_wchar_t cloc_long_dateW[] = {'d','d','d','d',',',' ','M','M','M','M',' ','d','d',',',' ','y','y','y','y',0}; + static const char cloc_time[] = "HH:mm:ss"; + static const MSVCRT_wchar_t cloc_timeW[] = {'H','H',':','m','m',':','s','s',0}; MSVCRT__locale_t loc; LCID lcid[6] = { 0 }; @@ -1205,21 +1211,29 @@ MSVCRT__locale_t CDECL MSVCRT__create_locale(int category, const char *locale) size = sizeof(MSVCRT___lc_time_data); for(i=0; i<sizeof(time_data)/sizeof(time_data[0]); i++) { - ret = GetLocaleInfoA(lcid[MSVCRT_LC_TIME], time_data[i] - |LOCALE_NOUSEROVERRIDE, NULL, 0); - if(!ret) { - MSVCRT__free_locale(loc); - return NULL; - } - size += ret; + 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_SSHORTDATE && !lcid[MSVCRT_LC_TIME]) { + size += sizeof(cloc_long_date) + sizeof(cloc_long_dateW); + }else if(time_data[i]==LOCALE_STIMEFORMAT && !lcid[MSVCRT_LC_TIME]) { + size += sizeof(cloc_time) + sizeof(cloc_timeW); + }else { + ret = GetLocaleInfoA(lcid[MSVCRT_LC_TIME], time_data[i] + |LOCALE_NOUSEROVERRIDE, NULL, 0); + if(!ret) { + MSVCRT__free_locale(loc); + return NULL; + } + size += ret; - ret = GetLocaleInfoW(lcid[MSVCRT_LC_TIME], time_data[i] - |LOCALE_NOUSEROVERRIDE, NULL, 0); - if(!ret) { - MSVCRT__free_locale(loc); - return NULL; + ret = GetLocaleInfoW(lcid[MSVCRT_LC_TIME], time_data[i] + |LOCALE_NOUSEROVERRIDE, NULL, 0); + if(!ret) { + MSVCRT__free_locale(loc); + return NULL; + } + size += ret*sizeof(MSVCRT_wchar_t); } - size += ret*sizeof(MSVCRT_wchar_t); } loc->locinfo->lc_time_curr = MSVCRT_malloc(size); @@ -1231,13 +1245,35 @@ MSVCRT__locale_t CDECL MSVCRT__create_locale(int category, const char *locale) ret = 0; for(i=0; i<sizeof(time_data)/sizeof(time_data[0]); i++) { loc->locinfo->lc_time_curr->str[i] = &loc->locinfo->lc_time_curr->data[ret]; - ret += GetLocaleInfoA(lcid[MSVCRT_LC_TIME], time_data[i]|LOCALE_NOUSEROVERRIDE, - &loc->locinfo->lc_time_curr->data[ret], size-ret); + if(time_data[i]==LOCALE_SSHORTDATE && !lcid[MSVCRT_LC_TIME]) { + memcpy(&loc->locinfo->lc_time_curr->data[ret], cloc_short_date, sizeof(cloc_short_date)); + ret += sizeof(cloc_short_date); + }else if(time_data[i]==LOCALE_SSHORTDATE && !lcid[MSVCRT_LC_TIME]) { + memcpy(&loc->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(&loc->locinfo->lc_time_curr->data[ret], cloc_time, sizeof(cloc_time)); + ret += sizeof(cloc_time); + }else { + ret += GetLocaleInfoA(lcid[MSVCRT_LC_TIME], time_data[i]|LOCALE_NOUSEROVERRIDE, + &loc->locinfo->lc_time_curr->data[ret], size-ret); + } } for(i=0; i<sizeof(time_data)/sizeof(time_data[0]); i++) { loc->locinfo->lc_time_curr->wstr[i] = (MSVCRT_wchar_t*)&loc->locinfo->lc_time_curr->data[ret]; - ret += GetLocaleInfoW(lcid[MSVCRT_LC_TIME], time_data[i]|LOCALE_NOUSEROVERRIDE, - (MSVCRT_wchar_t*)&loc->locinfo->lc_time_curr->data[ret], size-ret)*sizeof(MSVCRT_wchar_t); + if(time_data[i]==LOCALE_SSHORTDATE && !lcid[MSVCRT_LC_TIME]) { + memcpy(&loc->locinfo->lc_time_curr->data[ret], cloc_short_dateW, sizeof(cloc_short_dateW)); + ret += sizeof(cloc_short_dateW); + }else if(time_data[i]==LOCALE_SSHORTDATE && !lcid[MSVCRT_LC_TIME]) { + memcpy(&loc->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(&loc->locinfo->lc_time_curr->data[ret], cloc_timeW, sizeof(cloc_timeW)); + ret += sizeof(cloc_timeW); + }else { + ret += GetLocaleInfoW(lcid[MSVCRT_LC_TIME], time_data[i]|LOCALE_NOUSEROVERRIDE, + (MSVCRT_wchar_t*)&loc->locinfo->lc_time_curr->data[ret], size-ret)*sizeof(MSVCRT_wchar_t); + } } loc->locinfo->lc_time_curr->lcid = lcid[MSVCRT_LC_TIME];
1
0
0
0
Piotr Caban : msvcrt: Rewrite wasctime function.
by Alexandre Julliard
11 Apr '12
11 Apr '12
Module: wine Branch: master Commit: 2ca9a73a319585f71d8b09657ffd8d0affeeac0f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2ca9a73a319585f71d8b09657…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Wed Apr 11 15:21:48 2012 +0200 msvcrt: Rewrite wasctime function. --- dlls/msvcrt/time.c | 46 +++++++++++++++++++++++----------------------- 1 files changed, 23 insertions(+), 23 deletions(-) diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c index 90dc790..882b7bb 100644 --- a/dlls/msvcrt/time.c +++ b/dlls/msvcrt/time.c @@ -954,19 +954,20 @@ int CDECL MSVCRT_asctime_s(char* time, MSVCRT_size_t size, const struct MSVCRT_t MSVCRT_wchar_t * CDECL MSVCRT__wasctime(const struct MSVCRT_tm *mstm) { thread_data_t *data = msvcrt_get_thread_data(); - struct tm tm; - char buffer[30]; + char buffer[26]; - msvcrt_tm_to_unix( &tm, mstm ); + if(!data->wasctime_buffer) { + data->wasctime_buffer = MSVCRT_malloc(26*sizeof(MSVCRT_wchar_t)); + if(!data->wasctime_buffer) { + *MSVCRT__errno() = MSVCRT_ENOMEM; + return NULL; + } + } - if (!data->wasctime_buffer) - data->wasctime_buffer = MSVCRT_malloc( 30*sizeof(MSVCRT_wchar_t) ); /* ought to be enough */ -#ifdef HAVE_ASCTIME_R - asctime_r( &tm, buffer ); -#else - strcpy( buffer, asctime(&tm) ); -#endif - MultiByteToWideChar( CP_UNIXCP, 0, buffer, -1, data->wasctime_buffer, 30 ); + if(!asctime_buf(buffer, mstm)) + return NULL; + + MultiByteToWideChar(CP_ACP, 0, buffer, -1, data->wasctime_buffer, 26); return data->wasctime_buffer; } @@ -975,23 +976,22 @@ MSVCRT_wchar_t * CDECL MSVCRT__wasctime(const struct MSVCRT_tm *mstm) */ int CDECL MSVCRT__wasctime_s(MSVCRT_wchar_t* time, MSVCRT_size_t size, const struct MSVCRT_tm *mstm) { - WCHAR* asc; - unsigned int len; + char buffer[26]; + int ret; - if (!MSVCRT_CHECK_PMT(time != NULL) || !MSVCRT_CHECK_PMT(mstm != NULL)) { + if(!MSVCRT_CHECK_PMT(time != NULL) + || !MSVCRT_CHECK_PMT(mstm != NULL) + || !MSVCRT_CHECK_PMT(size >= 26)) { + if(time && size) + time[0] = 0; *MSVCRT__errno() = MSVCRT_EINVAL; return MSVCRT_EINVAL; } - asc = MSVCRT__wasctime(mstm); - len = (strlenW(asc) + 1) * sizeof(WCHAR); - - if(!MSVCRT_CHECK_PMT(size >= len)) { - *MSVCRT__errno() = MSVCRT_ERANGE; - return MSVCRT_ERANGE; - } - - strcpyW(time, asc); + ret = MSVCRT_asctime_s(buffer, sizeof(buffer), mstm); + if(!ret) + return ret; + MultiByteToWideChar(CP_ACP, 0, buffer, -1, time, size); return 0; }
1
0
0
0
← Newer
1
...
42
43
44
45
46
47
48
...
72
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Results per page:
10
25
50
100
200