ReactOS.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
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
List overview
Download
Ros-diffs
January 2019
----- 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
ros-diffs@reactos.org
31 participants
300 discussions
Start a n
N
ew thread
[reactos] 01/01: [MSXML3] Sync with Wine Staging 4.0. CORE-15682
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9f0f6adfb04f5f987217d…
commit 9f0f6adfb04f5f987217de85703a2ab741e23166 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Tue Jan 29 13:11:02 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Tue Jan 29 13:11:02 2019 +0100 [MSXML3] Sync with Wine Staging 4.0. CORE-15682 --- dll/win32/msxml3/attribute.c | 18 +++++++++-- dll/win32/msxml3/domdoc.c | 19 ++++++++--- dll/win32/msxml3/element.c | 70 ++++++++++++++++++++++++++++++---------- dll/win32/msxml3/msxml_private.h | 3 +- dll/win32/msxml3/node.c | 2 +- media/doc/README.WINE | 2 +- 6 files changed, 88 insertions(+), 26 deletions(-) diff --git a/dll/win32/msxml3/attribute.c b/dll/win32/msxml3/attribute.c index 637615b341..c303969bc3 100644 --- a/dll/win32/msxml3/attribute.c +++ b/dll/win32/msxml3/attribute.c @@ -50,6 +50,7 @@ typedef struct _domattr xmlnode node; IXMLDOMAttribute IXMLDOMAttribute_iface; LONG ref; + BOOL floating; } domattr; static const tid_t domattr_se_tids[] = { @@ -116,6 +117,11 @@ static ULONG WINAPI domattr_Release( if ( ref == 0 ) { destroy_xmlnode(&This->node); + if ( This->floating ) + { + xmlFreeNs( This->node.node->ns ); + xmlFreeNode( This->node.node ); + } heap_free( This ); } @@ -543,6 +549,8 @@ static HRESULT WINAPI domattr_get_namespaceURI( IXMLDOMAttribute *iface, BSTR* p) { + static const WCHAR w3xmlns[] = { 'h','t','t','p',':','/','/', 'w','w','w','.','w','3','.', + 'o','r','g','/','2','0','0','0','/','x','m','l','n','s','/',0 }; domattr *This = impl_from_IXMLDOMAttribute( iface ); xmlNsPtr ns = This->node.node->ns; @@ -559,7 +567,12 @@ static HRESULT WINAPI domattr_get_namespaceURI( if (xmlStrEqual(This->node.node->name, xmlns)) *p = bstr_from_xmlChar(xmlns); else if (xmlStrEqual(ns->prefix, xmlns)) - *p = SysAllocStringLen(NULL, 0); + { + if (xmldoc_version(This->node.node->doc) == MSXML6) + *p = SysAllocString(w3xmlns); + else + *p = SysAllocStringLen(NULL, 0); + } else if (ns->href) *p = bstr_from_xmlChar(ns->href); } @@ -709,7 +722,7 @@ static dispex_static_data_t domattr_dispex = { domattr_iface_tids }; -IUnknown* create_attribute( xmlNodePtr attribute ) +IUnknown* create_attribute( xmlNodePtr attribute, BOOL floating ) { domattr *This; @@ -719,6 +732,7 @@ IUnknown* create_attribute( xmlNodePtr attribute ) This->IXMLDOMAttribute_iface.lpVtbl = &domattr_vtbl; This->ref = 1; + This->floating = floating; init_xmlnode(&This->node, attribute, (IXMLDOMNode*)&This->IXMLDOMAttribute_iface, &domattr_dispex); diff --git a/dll/win32/msxml3/domdoc.c b/dll/win32/msxml3/domdoc.c index ddd756582b..76d3fdb601 100644 --- a/dll/win32/msxml3/domdoc.c +++ b/dll/win32/msxml3/domdoc.c @@ -73,6 +73,7 @@ static const WCHAR PropValueXSLPatternW[] = {'X','S','L','P','a','t','t','e','r' static const WCHAR PropertyResolveExternalsW[] = {'R','e','s','o','l','v','e','E','x','t','e','r','n','a','l','s',0}; static const WCHAR PropertyAllowXsltScriptW[] = {'A','l','l','o','w','X','s','l','t','S','c','r','i','p','t',0}; static const WCHAR PropertyAllowDocumentFunctionW[] = {'A','l','l','o','w','D','o','c','u','m','e','n','t','F','u','n','c','t','i','o','n',0}; +static const WCHAR PropertyNormalizeAttributeValuesW[] = {'N','o','r','m','a','l','i','z','e','A','t','t','r','i','b','u','t','e','V','a','l','u','e','s',0}; /* Anything that passes the test_get_ownerDocument() * tests can go here (data shared between all instances). @@ -395,6 +396,11 @@ xmlNodePtr xmldoc_unlink_xmldecl(xmlDocPtr doc) return node; } +MSXML_VERSION xmldoc_version(xmlDocPtr doc) +{ + return properties_from_xmlDocPtr(doc)->version; +} + BOOL is_preserving_whitespace(xmlNodePtr node) { domdoc_properties* properties = NULL; @@ -2286,8 +2292,8 @@ static HRESULT WINAPI domdoc_load( if ( filename ) { + IUri *uri = NULL; IMoniker *mon; - IUri *uri; if (This->properties->uri) { @@ -2304,15 +2310,19 @@ static HRESULT WINAPI domdoc_load( IMoniker_Release(mon); } - if ( FAILED(hr) ) - This->error = E_FAIL; - else + if (SUCCEEDED(hr)) { get_doc(This)->name = (char *)xmlchar_from_wcharn(filename, -1, TRUE); This->properties->uri = uri; hr = This->error = S_OK; *isSuccessful = VARIANT_TRUE; } + else + { + if (uri) + IUri_Release(uri); + This->error = E_FAIL; + } } if(!filename || FAILED(hr)) { @@ -3108,6 +3118,7 @@ static HRESULT WINAPI domdoc_setProperty( lstrcmpiW(p, PropertyNewParserW) == 0 || lstrcmpiW(p, PropertyResolveExternalsW) == 0 || lstrcmpiW(p, PropertyAllowXsltScriptW) == 0 || + lstrcmpiW(p, PropertyNormalizeAttributeValuesW) == 0 || lstrcmpiW(p, PropertyAllowDocumentFunctionW) == 0) { /* Ignore */ diff --git a/dll/win32/msxml3/element.c b/dll/win32/msxml3/element.c index 6e00aa0116..0ff26e4fb7 100644 --- a/dll/win32/msxml3/element.c +++ b/dll/win32/msxml3/element.c @@ -1398,7 +1398,7 @@ static HRESULT WINAPI domelem_getAttributeNode( if (attr) { - IUnknown *unk = create_attribute((xmlNodePtr)attr); + IUnknown *unk = create_attribute((xmlNodePtr)attr, FALSE); hr = IUnknown_QueryInterface(unk, &IID_IXMLDOMAttribute, (void**)attributeNode); IUnknown_Release(unk); } @@ -1754,8 +1754,11 @@ static HRESULT domelem_remove_named_item(xmlNodePtr node, BSTR name, IXMLDOMNode static HRESULT domelem_get_item(const xmlNodePtr node, LONG index, IXMLDOMNode **item) { + xmlNsPtr ns, xmlns; xmlAttrPtr curr; LONG attrIndex; + IUnknown *unk; + HRESULT hr; TRACE("(%p)->(%d %p)\n", node, index, item); @@ -1764,42 +1767,75 @@ static HRESULT domelem_get_item(const xmlNodePtr node, LONG index, IXMLDOMNode * if (index < 0) return S_FALSE; + attrIndex = 0; curr = node->properties; - - for (attrIndex = 0; attrIndex < index; attrIndex++) { - if (curr->next == NULL) - return S_FALSE; - else + if (curr) { + for (; attrIndex < index && curr->next != NULL; attrIndex++) curr = curr->next; + + if (attrIndex == index) { + *item = create_node( (xmlNodePtr) curr ); + return S_OK; + } } - *item = create_node( (xmlNodePtr) curr ); + if (!node->nsDef) + return S_FALSE; - return S_OK; + attrIndex++; + ns = node->nsDef; + for (; attrIndex < index && ns->next != NULL; attrIndex++) + ns = ns->next; + + if (attrIndex < index) + return S_FALSE; + + xmlns = xmlNewNs(NULL, BAD_CAST "
http://www.w3.org/2000/xmlns/
", BAD_CAST "xmlns"); + if (!xmlns) + return E_OUTOFMEMORY; + + curr = xmlNewNsProp(NULL, xmlns, ns->prefix, ns->href); + if (!curr) { + xmlFreeNs(xmlns); + return E_OUTOFMEMORY; + } + curr->doc = node->doc; + + unk = create_attribute((xmlNodePtr)curr, TRUE); + if (!unk) { + xmlFreeNs(xmlns); + xmlFreeProp(curr); + return E_OUTOFMEMORY; + } + + hr = IUnknown_QueryInterface(unk, &IID_IXMLDOMNode, (void**)item); + IUnknown_Release(unk); + + return hr; } static HRESULT domelem_get_length(const xmlNodePtr node, LONG *length) { - xmlAttrPtr first; xmlAttrPtr curr; LONG attrCount; + xmlNsPtr ns; TRACE("(%p)->(%p)\n", node, length); if( !length ) return E_INVALIDARG; - first = node->properties; - if (first == NULL) { - *length = 0; - return S_OK; + attrCount = 0; + curr = node->properties; + while (curr) { + attrCount++; + curr = curr->next; } - curr = first; - attrCount = 1; - while (curr->next) { + ns = node->nsDef; + while (ns) { attrCount++; - curr = curr->next; + ns = ns->next; } *length = attrCount; diff --git a/dll/win32/msxml3/msxml_private.h b/dll/win32/msxml3/msxml_private.h index 94ef66b23d..08f944ab1b 100644 --- a/dll/win32/msxml3/msxml_private.h +++ b/dll/win32/msxml3/msxml_private.h @@ -252,7 +252,7 @@ extern IUnknown *create_domdoc( xmlNodePtr ) DECLSPEC_HIDDEN; extern IUnknown *create_xmldoc( void ) DECLSPEC_HIDDEN; extern IXMLDOMNode *create_node( xmlNodePtr ) DECLSPEC_HIDDEN; extern IUnknown *create_element( xmlNodePtr ) DECLSPEC_HIDDEN; -extern IUnknown *create_attribute( xmlNodePtr ) DECLSPEC_HIDDEN; +extern IUnknown *create_attribute( xmlNodePtr, BOOL ) DECLSPEC_HIDDEN; extern IUnknown *create_text( xmlNodePtr ) DECLSPEC_HIDDEN; extern IUnknown *create_pi( xmlNodePtr ) DECLSPEC_HIDDEN; extern IUnknown *create_comment( xmlNodePtr ) DECLSPEC_HIDDEN; @@ -284,6 +284,7 @@ extern HRESULT xmldoc_add_orphan( xmlDocPtr doc, xmlNodePtr node ) DECLSPEC_HIDD extern HRESULT xmldoc_remove_orphan( xmlDocPtr doc, xmlNodePtr node ) DECLSPEC_HIDDEN; extern void xmldoc_link_xmldecl(xmlDocPtr doc, xmlNodePtr node) DECLSPEC_HIDDEN; extern xmlNodePtr xmldoc_unlink_xmldecl(xmlDocPtr doc) DECLSPEC_HIDDEN; +extern MSXML_VERSION xmldoc_version( xmlDocPtr doc ) DECLSPEC_HIDDEN; extern HRESULT XMLElement_create( xmlNodePtr node, LPVOID *ppObj, BOOL own ) DECLSPEC_HIDDEN; diff --git a/dll/win32/msxml3/node.c b/dll/win32/msxml3/node.c index bcb4181374..fc18935b69 100644 --- a/dll/win32/msxml3/node.c +++ b/dll/win32/msxml3/node.c @@ -2271,7 +2271,7 @@ IXMLDOMNode *create_node( xmlNodePtr node ) pUnk = create_element( node ); break; case XML_ATTRIBUTE_NODE: - pUnk = create_attribute( node ); + pUnk = create_attribute( node, FALSE ); break; case XML_TEXT_NODE: pUnk = create_text( node ); diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 2946ca0ac1..0fb8d24785 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -129,7 +129,7 @@ reactos/dll/win32/msvfw32 # Synced to WineStaging-4.0 reactos/dll/win32/msvidc32 # Synced to WineStaging-4.0 reactos/dll/win32/msxml # Synced to WineStaging-3.3 reactos/dll/win32/msxml2 # Synced to WineStaging-3.3 -reactos/dll/win32/msxml3 # Synced to WineStaging-3.3 +reactos/dll/win32/msxml3 # Synced to WineStaging-4.0 reactos/dll/win32/msxml4 # Synced to WineStaging-3.3 reactos/dll/win32/msxml6 # Synced to WineStaging-3.3 reactos/dll/win32/nddeapi # Synced to WineStaging-3.3
5 years, 12 months
1
0
0
0
[reactos] 01/01: [MSVIDC32] Sync with Wine Staging 4.0. CORE-15682
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9ab78df104f15acf66ff8…
commit 9ab78df104f15acf66ff8844e088e1d502a78e80 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Tue Jan 29 13:10:20 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Tue Jan 29 13:10:20 2019 +0100 [MSVIDC32] Sync with Wine Staging 4.0. CORE-15682 --- dll/win32/msvidc32/msvideo1.c | 4 ++-- media/doc/README.WINE | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dll/win32/msvidc32/msvideo1.c b/dll/win32/msvidc32/msvideo1.c index b999b52e07..7b866d04ca 100644 --- a/dll/win32/msvidc32/msvideo1.c +++ b/dll/win32/msvidc32/msvideo1.c @@ -543,8 +543,8 @@ static LRESULT CRAM_GetInfo( const Msvideo1Context *info, ICINFO *icinfo, DWORD icinfo->dwVersion = ICVERSION; icinfo->dwVersionICM = ICVERSION; - LoadStringW(MSVIDC32_hModule, IDS_NAME, icinfo->szName, sizeof(icinfo->szName)/sizeof(WCHAR)); - LoadStringW(MSVIDC32_hModule, IDS_DESCRIPTION, icinfo->szDescription, sizeof(icinfo->szDescription)/sizeof(WCHAR)); + LoadStringW(MSVIDC32_hModule, IDS_NAME, icinfo->szName, ARRAY_SIZE(icinfo->szName)); + LoadStringW(MSVIDC32_hModule, IDS_DESCRIPTION, icinfo->szDescription, ARRAY_SIZE(icinfo->szDescription)); /* msvfw32 will fill icinfo->szDriver for us */ return sizeof(ICINFO); diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 77a1638632..2946ca0ac1 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -126,7 +126,7 @@ reactos/dll/win32/mstask # Synced to WineStaging-3.3 reactos/dll/win32/msvcrt20 # Out of sync reactos/dll/win32/msvcrt40 # Out of sync reactos/dll/win32/msvfw32 # Synced to WineStaging-4.0 -reactos/dll/win32/msvidc32 # Synced to WineStaging-3.3 +reactos/dll/win32/msvidc32 # Synced to WineStaging-4.0 reactos/dll/win32/msxml # Synced to WineStaging-3.3 reactos/dll/win32/msxml2 # Synced to WineStaging-3.3 reactos/dll/win32/msxml3 # Synced to WineStaging-3.3
5 years, 12 months
1
0
0
0
[reactos] 01/01: [MSVFW32_WINETEST] Sync with Wine Staging 4.0. CORE-15682
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f04935d8f23cd940551e6…
commit f04935d8f23cd940551e673911c892c5083ebbaf Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Tue Jan 29 13:09:42 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Tue Jan 29 13:09:42 2019 +0100 [MSVFW32_WINETEST] Sync with Wine Staging 4.0. CORE-15682 --- modules/rostests/winetests/msvfw32/drawdib.c | 2 +- modules/rostests/winetests/msvfw32/msvfw.c | 537 +++++++++++++-------------- 2 files changed, 253 insertions(+), 286 deletions(-) diff --git a/modules/rostests/winetests/msvfw32/drawdib.c b/modules/rostests/winetests/msvfw32/drawdib.c index 0a59d82621..92e60df264 100644 --- a/modules/rostests/winetests/msvfw32/drawdib.c +++ b/modules/rostests/winetests/msvfw32/drawdib.c @@ -138,7 +138,7 @@ static void test_DrawDib_sizeimage(void) hdd = DrawDibOpen(); ok(hdd != NULL, "DrawDibOpen failed\n"); - for (i = 0; i < sizeof(test_data)/sizeof(test_data[0]); i++) { + for (i = 0; i < ARRAY_SIZE(test_data); i++) { char *hash; memset(dst_bits, 0xff, dst_dib_size); init_bmi(&src_info, test_data[i].width, test_data[i].height, test_data[i].size); diff --git a/modules/rostests/winetests/msvfw32/msvfw.c b/modules/rostests/winetests/msvfw32/msvfw.c index c63039a092..fbc0afd456 100644 --- a/modules/rostests/winetests/msvfw32/msvfw.c +++ b/modules/rostests/winetests/msvfw32/msvfw.c @@ -374,290 +374,6 @@ static void test_ICSeqCompress(void) ok(err == ICERR_BADHANDLE, "Expected -8, got %d\n", err); } -struct msg_result -{ - int msg_index; - UINT msg; - BOOL output_format; - int width; - int height; - int bits; - int compression; - LRESULT result; - BOOL todo; -}; - -static struct msg_result expected_msgs[] = -{ - /* Wine bug - shouldn't be called */ - { 0, DRV_LOAD, FALSE, 0, 0, 0, 0, TRUE, TRUE}, - { 0, DRV_ENABLE, FALSE, 0, 0, 0, 0, 0, TRUE}, - - { 0, DRV_OPEN, FALSE, 0, 0, 0, 0, 0xdeadbeef, FALSE}, - - /* test 1 */ - { 1, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE}, - { 2, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_BADFORMAT, FALSE}, - { 3, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 8, BI_RGB, ICERR_BADFORMAT, FALSE}, - { 4, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 16, BI_RGB, ICERR_BADFORMAT, FALSE}, - { 5, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 16, BI_BITFIELDS, ICERR_BADFORMAT, FALSE}, - { 6, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 24, BI_RGB, ICERR_BADFORMAT, FALSE}, - { 7, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 32, BI_RGB, ICERR_BADFORMAT, FALSE}, - { 8, ICM_DECOMPRESS_GET_FORMAT, TRUE, 640, 480, 32, BI_RGB, ICERR_OK, FALSE}, - - /* test 2 */ - { 9, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE}, - {10, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_BADFORMAT, FALSE}, - {11, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 8, BI_RGB, ICERR_BADFORMAT, FALSE}, - {12, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 16, BI_RGB, ICERR_OK, FALSE}, - - /* test 3 */ - {13, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE}, - {14, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE}, - {15, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 8, BI_RGB, ICERR_BADFORMAT, FALSE}, - {16, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 16, BI_RGB, ICERR_OK, FALSE}, - - /* test 4 */ - {17, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE}, - {18, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_BADFORMAT, FALSE}, - {19, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 24, BI_RGB, ICERR_BADFORMAT, FALSE}, - {20, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 32, BI_RGB, ICERR_BADFORMAT, FALSE}, - {21, ICM_DECOMPRESS_GET_FORMAT, TRUE, 640, 480, 32, BI_RGB, ICERR_OK, FALSE}, - - /* test 5 */ - {22, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE}, - {23, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE}, - {24, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 32, BI_RGB, ICERR_OK, FALSE}, - - /* test 6 */ - {25, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE}, - {26, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE}, - {27, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 32, BI_RGB, ICERR_OK, FALSE}, - - /* test 7 */ - {28, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE}, - {29, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE}, - {30, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 9, BI_RGB, ICERR_BADFORMAT, FALSE}, - {31, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 32, BI_RGB, ICERR_BADFORMAT, FALSE}, - {32, ICM_DECOMPRESS_GET_FORMAT, TRUE, 640, 480, 32, BI_RGB, ICERR_OK, FALSE}, - - /* test 8 */ - {33, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE}, - {34, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE}, - {35, ICM_DECOMPRESS_QUERY, TRUE, 800, 600, 32, BI_RGB, ICERR_OK, FALSE}, - - /* test 9 */ - {36, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE}, - {37, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE}, - {38, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 32, BI_RGB, ICERR_OK, FALSE}, - - /* test 10 */ - {39, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE}, - {40, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE}, - {41, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 32, BI_RGB, ICERR_OK, FALSE}, - - /* test 11 */ - {42, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE}, - {43, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE}, - {44, ICM_DECOMPRESS_QUERY, TRUE, 270, 270, 8, BI_RGB, ICERR_OK, FALSE}, - {45, ICM_DECOMPRESS_GET_PALETTE, FALSE, 0, 0, 0, 0, ICERR_UNSUPPORTED, FALSE}, - - /* test 12 */ - {46, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE}, - {47, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE}, - {48, ICM_DECOMPRESS_QUERY, TRUE, 270, 270, 16, BI_RGB, ICERR_OK, FALSE}, - - /* test 13 */ - {49, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE}, - {50, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE}, - {51, ICM_DECOMPRESS_QUERY, TRUE, 270, 270, 24, BI_RGB, ICERR_OK, FALSE}, - - /* test 14 */ - {52, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE}, - {53, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE}, - {54, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 4, BI_RGB, ICERR_OK, FALSE}, - - /* Wine bug - shouldn't be called */ - {55, DRV_DISABLE, FALSE, 0, 0, 0, 0, ICERR_OK, TRUE}, - {55, DRV_FREE, FALSE, 0, 0, 0, 0, ICERR_OK, TRUE}, -}; - -static int msg_index = 0; - -static struct msg_result *get_expected_msg(UINT msg) -{ - int i = 0; - for(; i < sizeof(expected_msgs) / sizeof(expected_msgs[0]); i++) - { - if (expected_msgs[i].msg_index == msg_index && expected_msgs[i].msg == msg) - return &expected_msgs[i]; - } - return NULL; -} - -LRESULT WINAPI driver_proc_test(DWORD_PTR dwDriverId, HDRVR hdrvr, UINT msg, - LPARAM lParam1, LPARAM lParam2) -{ - struct msg_result *expected = get_expected_msg(msg); - LRESULT res = expected ? expected->result : ICERR_UNSUPPORTED; - - if (msg == DRV_CLOSE) - return ICERR_OK; - - if (!expected) - { - ok(0, "unexpected message: %04x %ld %ld at msg index %d\n", - msg, lParam1, lParam2, msg_index); - return ICERR_UNSUPPORTED; - } - else if (expected->todo) - { - todo_wine ok(0, "unexpected message: %04x %ld %ld at msg index %d\n", - msg, lParam1, lParam2, msg_index); - return res; - } - - switch (msg) - { - case ICM_DECOMPRESS_QUERY: - { - BITMAPINFOHEADER *out = (BITMAPINFOHEADER *)lParam2; - - if (!lParam2) - { - trace("query -> without format\n"); - ok(!expected->output_format, "Expected no output format pointer\n"); - break; - } - - ok(expected->output_format, "Expected output format pointer\n"); - ok(out->biWidth == expected->width, - "Expected width %d, got %d\n", expected->width, out->biWidth); - ok(out->biHeight == expected->height, - "Expected height %d, got %d\n", expected->height, out->biHeight); - ok(out->biBitCount == expected->bits, - "Expected biBitCount %d, got %d\n", expected->bits, out->biBitCount); - ok(out->biCompression == expected->compression, - "Expected compression %d, got %d\n", expected->compression, out->biCompression); - ok(out->biSizeImage == get_stride(out->biWidth, out->biBitCount) * out->biHeight, - "Expected biSizeImage %d, got %d\n", get_stride(out->biWidth, out->biBitCount) * out->biHeight, - out->biSizeImage); - - trace("query -> width: %d, height: %d, bit: %d, compression: %d, size: %d\n", - out->biWidth, out->biHeight, out->biBitCount, out->biCompression, out->biSizeImage); - break; - } - - case ICM_DECOMPRESS_GET_FORMAT: - { - BITMAPINFOHEADER *out = (BITMAPINFOHEADER *)lParam2; - - if (!lParam2) - { - trace("format -> without format\n"); - ok(!expected->output_format, "Expected no output format pointer\n"); - break; - } - - ok(expected->output_format, "Expected output format pointer\n"); - ok(out->biWidth == expected->width, - "Expected width %d, got %d\n", expected->width, out->biWidth); - ok(out->biHeight == expected->height, - "Expected height %d, got %d\n", expected->height, out->biHeight); - ok(out->biBitCount == expected->bits, - "Expected biBitCount %d, got %d\n", expected->bits, out->biBitCount); - ok(out->biCompression == expected->compression, - "Expected compression %d, got %d\n", expected->compression, out->biCompression); - - trace("format -> width: %d, height: %d, bit: %d, compression: %d, size: %d\n", - out->biWidth, out->biHeight, out->biBitCount, out->biCompression, out->biSizeImage); - - out->biBitCount = 64; - break; - } - } - - msg_index++; - return res; -} - - -void test_ICGetDisplayFormat(void) -{ - static const struct - { - int bits_wanted; - int bits_expected; - int dx; - int width_expected; - int dy; - int height_expected; - int msg_index; - } - tests[] = - { - { 8, 64, 0, 640, 0, 480, 9}, - { 8, 16, 0, 640, 0, 480, 13}, - { 8, 16, 0, 640, 0, 480, 17}, - {24, 64, 0, 640, 0, 480, 22}, - {32, 32, 0, 640, 0, 480, 25}, - { 0, 32, 0, 640, 0, 480, 28}, - { 9, 64, 0, 640, 0, 480, 33}, - {32, 32, 800, 800, 600, 600, 36}, - {32, 32, -1, 640, -1, 480, 39}, - {32, 32, -90, 640, -60, 480, 42}, - { 8, 8, 270, 270, 270, 270, 46}, - {16, 16, 270, 270, 270, 270, 49}, - {24, 24, 270, 270, 270, 270, 52}, - { 4, 4, 0, 640, 0, 480, 55}, - }; - - HIC ic, ic2; - BITMAPINFOHEADER in; - BITMAPINFOHEADER out; - int real_depth; - int i; - - ic = ICOpenFunction(ICTYPE_VIDEO, 0xdeadbeef, ICMODE_DECOMPRESS, driver_proc_test); - ok(!!ic, "Opening driver failed\n"); - - for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) - { - memset(&in, 0, sizeof(in)); - memset(&out, 0, sizeof(out)); - - in.biSize = sizeof(in); - in.biWidth = 640; - in.biHeight = 480; - in.biPlanes = 1; - in.biBitCount = 32; - in.biCompression = BI_PNG; - in.biSizeImage = 1024; - - out.biBitCount = 16; - out.biWidth = 320; - out.biHeight = 240; - - ic2 = ICGetDisplayFormat(ic, &in, &out, tests[i].bits_wanted, tests[i].dx, tests[i].dy); - ok(!!ic2, "Expected ICGetDisplayFormat to succeeded\n"); - - ok(out.biBitCount == tests[i].bits_expected, - "Expected biBitCount %d, got %d\n", tests[i].bits_expected, out.biBitCount); - ok(out.biWidth == tests[i].width_expected, - "Expected biWidth %d, got %d\n", tests[i].width_expected, out.biWidth); - ok(out.biHeight == tests[i].height_expected, - "Expected biHeight %d, got %d\n", tests[i].height_expected, out.biHeight); - real_depth = (out.biBitCount > 32) ? 32 : out.biBitCount; - ok(out.biSizeImage == get_stride(out.biWidth, real_depth) * out.biHeight, - "Expected biSizeImage %d, got %d\n", get_stride(out.biWidth, real_depth) * out.biHeight, - out.biSizeImage); - ok(msg_index == tests[i].msg_index, - "Expected msg_index %d, got %d\n", tests[i].msg_index, msg_index); - } - - ICClose(ic); -} - static void test_ICInfo(void) { ICINFO info, info2; @@ -689,11 +405,262 @@ static void test_ICInfo(void) ok(info.fccHandler == mmioFOURCC('f','a','k','e'), "got 0x%08x\n", info.fccHandler); } +static int get_display_format_test; + +static DWORD get_size_image(LONG width, LONG height, WORD depth) +{ + DWORD ret = width * depth; + ret = (ret + 7) / 8; /* divide by byte size, rounding up */ + ret = (ret + 3) & ~3; /* align to 4 bytes */ + ret *= abs(height); + return ret; +} + +static const RGBQUAD color_yellow = {0x00, 0xff, 0xff, 0x00}; + +static BITMAPINFOHEADER gdf_in, *gdf_out; + +static LRESULT CALLBACK gdf_driver_proc(DWORD_PTR id, HDRVR driver, UINT msg, + LPARAM lparam1, LPARAM lparam2) +{ + LRESULT ret = 0; + + if (winetest_debug > 1) + trace("(%#lx, %p, %#x, %#lx, %#lx)\n", id, driver, msg, lparam1, lparam2); + + switch(msg) + { + case DRV_LOAD: + case DRV_OPEN: + case DRV_CLOSE: + case DRV_FREE: + return 1; + case ICM_DECOMPRESS_QUERY: + { + BITMAPINFOHEADER *out = (BITMAPINFOHEADER *)lparam2; + DWORD expected_size; + + ok(lparam1 == (LPARAM)&gdf_in, "got input %#lx\n", lparam1); + + if (!out) + return ICERR_OK; + + ok(out == gdf_out, "got output %p\n", out); + + ok(out->biSize == sizeof(*out), "got size %d\n", out->biSize); + expected_size = get_size_image(out->biWidth, out->biHeight, out->biBitCount); + ok(out->biSizeImage == expected_size, "expected image size %d, got %d\n", + expected_size, out->biSizeImage); + + ok(out->biPlanes == 0xcccc, "got planes %d\n", out->biPlanes); + ok(out->biXPelsPerMeter == 0xcccccccc && out->biYPelsPerMeter == 0xcccccccc, + "got resolution %dx%d\n", out->biXPelsPerMeter, out->biYPelsPerMeter); + ok(out->biClrUsed == 0xcccccccc, "got biClrUsed %u\n", out->biClrUsed); + ok(out->biClrImportant == 0xcccccccc, "got biClrImportant %u\n", out->biClrImportant); + + switch (get_display_format_test) + { + case 0: + return ICERR_OK; + case 1: + if (out->biWidth == 30 && out->biHeight == 40 && out->biCompression == BI_RGB && out->biBitCount == 16) + return ICERR_OK; + break; + case 2: + if (out->biWidth == 30 && out->biHeight == 40 && out->biCompression == BI_BITFIELDS && out->biBitCount == 16) + return ICERR_OK; + break; + case 3: + if (out->biWidth == 30 && out->biHeight == 40 && out->biCompression == BI_RGB && out->biBitCount == 24) + return ICERR_OK; + break; + case 4: + if (out->biWidth == 30 && out->biHeight == 40 && out->biCompression == BI_RGB && out->biBitCount == 32) + return ICERR_OK; + break; + case 5: + if (out->biWidth == 10 && out->biHeight == 20 && out->biCompression == BI_RGB && out->biBitCount == 32) + return ICERR_OK; + break; + case 6: + break; + } + + return ICERR_BADFORMAT; + } + case ICM_DECOMPRESS_GET_FORMAT: + { + BITMAPINFOHEADER *out = (BITMAPINFOHEADER *)lparam2; + + ok(lparam1 == (LPARAM)&gdf_in, "got input %#lx\n", lparam1); + if (out) + { + ok(out == gdf_out, "got output %p\n", out); + + memset(out, 0x55, sizeof(*out)); + out->biWidth = 50; + out->biHeight = 60; + out->biBitCount = 0xdead; + out->biCompression = 0xbeef; + out->biSizeImage = 0; + + return ICERR_OK; + } + } + case ICM_DECOMPRESS_GET_PALETTE: + { + BITMAPINFO *out = (BITMAPINFO *)lparam2; + + ok(lparam1 == (LPARAM)&gdf_in, "got input %#lx\n", lparam1); + if (out) + { + ok(out == (BITMAPINFO *)gdf_out, "got output %p\n", out); + + out->bmiHeader.biClrUsed = 1; + out->bmiColors[0] = color_yellow; + + return 0xdeadbeef; + } + } + } + + return ret; +} + +static void check_bitmap_header_(int line, BITMAPINFOHEADER *header, LONG width, LONG height, WORD depth, DWORD compression) +{ + ok_(__FILE__, line)(header->biWidth == width, "expected %d, got %d\n", width, header->biWidth); + ok_(__FILE__, line)(header->biHeight == height, "expected %d, got %d\n", height, header->biHeight); + ok_(__FILE__, line)(header->biBitCount == depth, "expected %d, got %d\n", depth, header->biBitCount); + ok_(__FILE__, line)(header->biCompression == compression, "expected %#x, got %#x\n", compression, header->biCompression); +} +#define check_bitmap_header(a,b,c,d,e) check_bitmap_header_(__LINE__,a,b,c,d,e) + +static void test_ICGetDisplayFormat(void) +{ + static const DWORD testcc = mmioFOURCC('t','e','s','t'); +#ifdef __REACTOS__ + char outbuf[FIELD_OFFSET(BITMAPINFO, bmiColors) + 256 * sizeof(RGBQUAD)]; +#else + char outbuf[FIELD_OFFSET(BITMAPINFO, bmiColors[256])]; +#endif + BITMAPINFO *out_bmi; + LRESULT lres; + BOOL ret; + HIC hic; + + memset(&gdf_in, 0xcc, sizeof(gdf_in)); + gdf_in.biSize = sizeof(gdf_in); + gdf_in.biWidth = 10; + gdf_in.biHeight = 20; + gdf_in.biBitCount = 1; + gdf_in.biCompression = testcc; + + ret = ICInstall(ICTYPE_VIDEO, testcc, (LPARAM)gdf_driver_proc, NULL, ICINSTALL_FUNCTION); + ok(ret, "ICInstall failed\n"); + + hic = ICOpen(ICTYPE_VIDEO, testcc, ICMODE_DECOMPRESS); + ok(ret, "ICOpen failed\n"); + + memset(outbuf, 0, sizeof(outbuf)); + gdf_out = (BITMAPINFOHEADER *)outbuf; + + /* ICGetDisplayFormat tries several default formats; make sure those work */ + get_display_format_test = 0; + hic = ICGetDisplayFormat(hic, &gdf_in, gdf_out, 1, 30, 40); + ok(hic != NULL, "ICGetDisplayFormat failed\n"); + check_bitmap_header(gdf_out, 30, 40, 1, BI_RGB); + + get_display_format_test = 1; + hic = ICGetDisplayFormat(hic, &gdf_in, gdf_out, 1, 30, 40); + ok(hic != NULL, "ICGetDisplayFormat failed\n"); + check_bitmap_header(gdf_out, 30, 40, 16, BI_RGB); + + get_display_format_test = 2; + hic = ICGetDisplayFormat(hic, &gdf_in, gdf_out, 1, 30, 40); + ok(hic != NULL, "ICGetDisplayFormat failed\n"); + check_bitmap_header(gdf_out, 30, 40, 16, BI_BITFIELDS); + + get_display_format_test = 3; + hic = ICGetDisplayFormat(hic, &gdf_in, gdf_out, 1, 30, 40); + ok(hic != NULL, "ICGetDisplayFormat failed\n"); + check_bitmap_header(gdf_out, 30, 40, 24, BI_RGB); + + get_display_format_test = 4; + hic = ICGetDisplayFormat(hic, &gdf_in, gdf_out, 1, 30, 40); + ok(hic != NULL, "ICGetDisplayFormat failed\n"); + check_bitmap_header(gdf_out, 30, 40, 32, BI_RGB); + + get_display_format_test = 5; + hic = ICGetDisplayFormat(hic, &gdf_in, gdf_out, 1, 30, 40); + ok(hic != NULL, "ICGetDisplayFormat failed\n"); + check_bitmap_header(gdf_out, 10, 20, 32, BI_RGB); + + /* if every default format is rejected, the output of + * ICM_DECOMPRESS_GET_FORMAT is returned */ + get_display_format_test = 6; + hic = ICGetDisplayFormat(hic, &gdf_in, gdf_out, 1, 30, 40); + ok(hic != NULL, "ICGetDisplayFormat failed\n"); + check_bitmap_header(gdf_out, 50, 60, 0xdead, 0xbeef); + + /* given bpp is treated as a lower bound */ + get_display_format_test = 1; + hic = ICGetDisplayFormat(hic, &gdf_in, gdf_out, 24, 30, 40); + ok(hic != NULL, "ICGetDisplayFormat failed\n"); + check_bitmap_header(gdf_out, 50, 60, 0xdead, 0xbeef); + + get_display_format_test = 3; + hic = ICGetDisplayFormat(hic, &gdf_in, gdf_out, 24, 30, 40); + ok(hic != NULL, "ICGetDisplayFormat failed\n"); + check_bitmap_header(gdf_out, 30, 40, 24, BI_RGB); + + get_display_format_test = 0; + + /* width or height <= 0 causes the input width and height to be supplied */ + hic = ICGetDisplayFormat(hic, &gdf_in, gdf_out, 1, 0, 40); + ok(hic != NULL, "ICGetDisplayFormat failed\n"); + check_bitmap_header(gdf_out, 10, 20, 1, BI_RGB); + + hic = ICGetDisplayFormat(hic, &gdf_in, gdf_out, 1, 30, 0); + ok(hic != NULL, "ICGetDisplayFormat failed\n"); + check_bitmap_header(gdf_out, 10, 20, 1, BI_RGB); + + hic = ICGetDisplayFormat(hic, &gdf_in, gdf_out, 1, -10, 40); + ok(hic != NULL, "ICGetDisplayFormat failed\n"); + check_bitmap_header(gdf_out, 10, 20, 1, BI_RGB); + + hic = ICGetDisplayFormat(hic, &gdf_in, gdf_out, 1, 30, -10); + ok(hic != NULL, "ICGetDisplayFormat failed\n"); + check_bitmap_header(gdf_out, 10, 20, 1, BI_RGB); + + /* zero bpp causes 32 bpp to be supplied */ + hic = ICGetDisplayFormat(hic, &gdf_in, gdf_out, 0, 30, 40); + ok(hic != NULL, "ICGetDisplayFormat failed\n"); + ok(gdf_out->biBitCount == 32 || gdf_out->biBitCount == 24, + "got %d\n", gdf_out->biBitCount); + ok(gdf_out->biCompression == BI_RGB, "got %#x\n", gdf_out->biCompression); + + /* specifying 8 bpp yields a request for palette colours */ + hic = ICGetDisplayFormat(hic, &gdf_in, gdf_out, 8, 30, 40); + ok(hic != NULL, "ICGetDisplayFormat failed\n"); + check_bitmap_header(gdf_out, 30, 40, 8, BI_RGB); + ok(gdf_out->biClrUsed == 1, "got biClrUsed %u\n", gdf_out->biClrUsed); + out_bmi = (BITMAPINFO *)gdf_out; + ok(!memcmp(&out_bmi->bmiColors[0], &color_yellow, sizeof(color_yellow)), + "got wrong colour\n"); + + lres = ICClose(hic); + ok(lres == ICERR_OK, "got %ld\n", lres); + + ret = ICRemove(ICTYPE_VIDEO, testcc, 0); + ok(ret, "ICRemove failed\n"); +} + START_TEST(msvfw) { test_OpenCase(); test_Locate(); test_ICSeqCompress(); - test_ICGetDisplayFormat(); test_ICInfo(); + test_ICGetDisplayFormat(); }
5 years, 12 months
1
0
0
0
[reactos] 01/01: [MSVFW32] Sync with Wine Staging 4.0. CORE-15682
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cbf79d98c67b53322df8d…
commit cbf79d98c67b53322df8d6ab26bf25472747562d Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Tue Jan 29 13:09:12 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Tue Jan 29 13:09:12 2019 +0100 [MSVFW32] Sync with Wine Staging 4.0. CORE-15682 --- dll/win32/msvfw32/mciwnd.c | 3 +- dll/win32/msvfw32/msvideo_main.c | 176 +++++++++++++++++++-------------------- media/doc/README.WINE | 2 +- 3 files changed, 86 insertions(+), 95 deletions(-) diff --git a/dll/win32/msvfw32/mciwnd.c b/dll/win32/msvfw32/mciwnd.c index fc499732ef..50899e1fbd 100644 --- a/dll/win32/msvfw32/mciwnd.c +++ b/dll/win32/msvfw32/mciwnd.c @@ -1006,8 +1006,7 @@ end_of_mci_open: cmdW = (LPWSTR)lParam; mwi->lasterror = mciSendStringW(cmdW, mwi->return_string, - sizeof(mwi->return_string)/sizeof(mwi->return_string[0]), - 0); + ARRAY_SIZE(mwi->return_string), 0); if (mwi->lasterror) MCIWND_notify_error(mwi); diff --git a/dll/win32/msvfw32/msvideo_main.c b/dll/win32/msvfw32/msvideo_main.c index 1c7dad1700..4b09913667 100644 --- a/dll/win32/msvfw32/msvideo_main.c +++ b/dll/win32/msvfw32/msvideo_main.c @@ -98,11 +98,6 @@ static const char *wine_dbgstr_icerr( int ret ) return str; } -static inline int get_stride(int width, int depth) -{ - return ((depth * width + 31) >> 3) & ~3; -} - static WINE_HIC* MSVIDEO_FirstHic /* = NULL */; typedef struct _reg_driver reg_driver; @@ -228,6 +223,15 @@ static int compare_fourcc(DWORD fcc1, DWORD fcc2) return strncasecmp(fcc_str1, fcc_str2, 4); } +static DWORD get_size_image(LONG width, LONG height, WORD depth) +{ + DWORD ret = width * depth; + ret = (ret + 7) / 8; /* divide by byte size, rounding up */ + ret = (ret + 3) & ~3; /* align to 4 bytes */ + ret *= abs(height); + return ret; +} + typedef BOOL (*enum_handler_t)(const char *name, const char *driver, unsigned int index, void *param); static BOOL enum_drivers(DWORD fccType, enum_handler_t handler, void* param) @@ -315,8 +319,7 @@ static BOOL ICInfo_enum_handler(const char *name, const char *driver, unsigned i lpicinfo->dwVersionICM = ICVERSION; lpicinfo->szName[0] = 0; lpicinfo->szDescription[0] = 0; - MultiByteToWideChar(CP_ACP, 0, driver, -1, lpicinfo->szDriver, - sizeof(lpicinfo->szDriver)/sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, driver, -1, lpicinfo->szDriver, ARRAY_SIZE(lpicinfo->szDriver)); return TRUE; } @@ -720,109 +723,98 @@ HIC VFWAPI ICLocate(DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn, /*********************************************************************** * ICGetDisplayFormat [MSVFW32.@] */ -HIC VFWAPI ICGetDisplayFormat( - HIC hic,LPBITMAPINFOHEADER lpbiIn,LPBITMAPINFOHEADER lpbiOut, - INT depth,INT dx,INT dy) +HIC VFWAPI ICGetDisplayFormat(HIC hic, BITMAPINFOHEADER *in, BITMAPINFOHEADER *out, + int depth, int width, int height) { - static const struct - { - int depth; - int compression; - } - try_depths[] = - { - { 8, BI_RGB}, - {16, BI_RGB}, - {16, BI_BITFIELDS}, - {24, BI_RGB}, - {32, BI_RGB}, - }; - - int screen_depth, i; - BOOL found = FALSE; - HIC tmphic; - HDC hdc; + HIC tmphic = hic; - TRACE("(%p,%p,%p,%d,%d,%d)!\n", hic, lpbiIn, lpbiOut, depth, dx, dy); + TRACE("(%p, %p, %p, %d, %d, %d)\n", hic, in, out, depth, width, height); - tmphic = hic ? hic : ICLocate(ICTYPE_VIDEO, 0, lpbiIn, NULL, ICMODE_DECOMPRESS); - if (!tmphic) return tmphic; - - hdc = GetDC(0); - screen_depth = GetDeviceCaps(hdc, BITSPIXEL) * GetDeviceCaps(hdc, PLANES); - ReleaseDC(0, hdc); + if (!tmphic) + { + tmphic = ICLocate(ICTYPE_VIDEO, 0, in, NULL, ICMODE_DECOMPRESS); + if (!tmphic) + return NULL; + } - if (dx <= 0) dx = lpbiIn->biWidth; - if (dy <= 0) dy = lpbiIn->biHeight; - if (!depth) depth = screen_depth; + if (ICDecompressQuery(tmphic, in, NULL)) + goto err; - /* Can we decompress it ? */ - if (ICDecompressQuery(tmphic, lpbiIn, NULL) != ICERR_OK) - goto errout; /* no, sorry */ + if (width <= 0 || height <= 0) + { + width = in->biWidth; + height = in->biHeight; + } - ICSendMessage(tmphic, ICM_DECOMPRESS_GET_FORMAT, (DWORD_PTR)lpbiIn, (DWORD_PTR)lpbiOut); + if (!depth) + depth = 32; - lpbiOut->biSize = sizeof(BITMAPINFOHEADER); - lpbiOut->biWidth = dx; - lpbiOut->biHeight = dy; - lpbiOut->biPlanes = 1; + *out = *in; + out->biSize = sizeof(*out); + out->biWidth = width; + out->biHeight = height; + out->biCompression = BI_RGB; + out->biSizeImage = get_size_image(width, height, depth); - for (i = 0; i < sizeof(try_depths) / sizeof(try_depths[0]); i++) + /* first try the given depth */ + out->biBitCount = depth; + out->biSizeImage = get_size_image(width, height, out->biBitCount); + if (!ICDecompressQuery(tmphic, in, out)) { - if (!found && try_depths[i].depth != depth) - continue; - - found = TRUE; - lpbiOut->biBitCount = try_depths[i].depth; - lpbiOut->biCompression = try_depths[i].compression; - lpbiOut->biSizeImage = dx * get_stride(dy, lpbiOut->biBitCount); + if (depth == 8) + ICDecompressGetPalette(tmphic, in, out); + return tmphic; + } - if (ICDecompressQuery(tmphic, lpbiIn, lpbiOut) == ICERR_OK) - { - if (try_depths[i].depth == 8) - ICDecompressGetPalette(tmphic, lpbiIn, lpbiOut); - goto success; - } + /* then try 16, both with BI_RGB and BI_BITFIELDS */ + if (depth <= 16) + { + out->biBitCount = 16; + out->biSizeImage = get_size_image(width, height, out->biBitCount); + if (!ICDecompressQuery(tmphic, in, out)) + return tmphic; + + out->biCompression = BI_BITFIELDS; + if (!ICDecompressQuery(tmphic, in, out)) + return tmphic; + out->biCompression = BI_RGB; } - if (!found) + /* then try 24 */ + if (depth <= 24) { - lpbiOut->biBitCount = depth; - lpbiOut->biCompression = BI_RGB; - lpbiOut->biSizeImage = dx * get_stride(dy, lpbiOut->biBitCount); - if (ICDecompressQuery(tmphic, lpbiIn, lpbiOut) == ICERR_OK) - goto success; - - lpbiOut->biBitCount = screen_depth; - lpbiOut->biCompression = BI_RGB; - lpbiOut->biSizeImage = dx * get_stride(dy, lpbiOut->biBitCount); - if (ICDecompressQuery(tmphic, lpbiIn, lpbiOut) == ICERR_OK) - goto success; + out->biBitCount = 24; + out->biSizeImage = get_size_image(width, height, out->biBitCount); + if (!ICDecompressQuery(tmphic, in, out)) + return tmphic; } - if (ICSendMessage(tmphic, ICM_DECOMPRESS_GET_FORMAT, (DWORD_PTR)lpbiIn, (DWORD_PTR)lpbiOut)) - goto errout; + /* then try 32 */ + if (depth <= 32) + { + out->biBitCount = 32; + out->biSizeImage = get_size_image(width, height, out->biBitCount); + if (!ICDecompressQuery(tmphic, in, out)) + return tmphic; + } - if (lpbiOut->biCompression != 0) { - FIXME("Ooch, how come decompressor outputs compressed data (%d)??\n", - lpbiOut->biCompression); - } - if (lpbiOut->biSize < sizeof(*lpbiOut)) { - FIXME("Ooch, size of output BIH is too small (%d)\n", - lpbiOut->biSize); - lpbiOut->biSize = sizeof(*lpbiOut); - } + /* as a last resort, try 32 bpp with the original width and height */ + out->biWidth = in->biWidth; + out->biHeight = in->biHeight; + out->biBitCount = 32; + out->biSizeImage = get_size_image(out->biWidth, out->biHeight, out->biBitCount); + if (!ICDecompressQuery(tmphic, in, out)) + return tmphic; -success: - TRACE("=> %p\n", tmphic); - return tmphic; + /* finally, ask the compressor for its default output format */ + if (!ICSendMessage(tmphic, ICM_DECOMPRESS_GET_FORMAT, (DWORD_PTR)in, (DWORD_PTR)out)) + return tmphic; -errout: - if (hic!=tmphic) - ICClose(tmphic); +err: + if (hic != tmphic) + ICClose(tmphic); - TRACE("=> 0\n"); - return 0; + return NULL; } /*********************************************************************** @@ -1415,7 +1407,7 @@ HANDLE VFWAPI ICImageDecompress( biSizeImage = lpbiOut->bmiHeader.biSizeImage; if ( biSizeImage == 0 ) - biSizeImage = ((((lpbiOut->bmiHeader.biWidth * lpbiOut->bmiHeader.biBitCount + 7) >> 3) + 3) & (~3)) * abs(lpbiOut->bmiHeader.biHeight); + biSizeImage = get_size_image(lpbiOut->bmiHeader.biWidth, lpbiOut->bmiHeader.biHeight, lpbiOut->bmiHeader.biBitCount); TRACE( "call ICDecompressBegin\n" ); diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 7444ffb993..77a1638632 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -125,7 +125,7 @@ reactos/dll/win32/mssip32 # Synced to WineStaging-3.3 reactos/dll/win32/mstask # Synced to WineStaging-3.3 reactos/dll/win32/msvcrt20 # Out of sync reactos/dll/win32/msvcrt40 # Out of sync -reactos/dll/win32/msvfw32 # Synced to WineStaging-3.3 +reactos/dll/win32/msvfw32 # Synced to WineStaging-4.0 reactos/dll/win32/msvidc32 # Synced to WineStaging-3.3 reactos/dll/win32/msxml # Synced to WineStaging-3.3 reactos/dll/win32/msxml2 # Synced to WineStaging-3.3
5 years, 12 months
1
0
0
0
[reactos] 01/01: [MSVCRTD_WINETEST] Sync with Wine Staging 4.0. CORE-15682
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3f6b395cc10f65d5ab1e3…
commit 3f6b395cc10f65d5ab1e3642f5406b7f4deba78e Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Tue Jan 29 13:08:43 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Tue Jan 29 13:08:43 2019 +0100 [MSVCRTD_WINETEST] Sync with Wine Staging 4.0. CORE-15682 --- modules/rostests/winetests/msvcrtd/debug.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/rostests/winetests/msvcrtd/debug.c b/modules/rostests/winetests/msvcrtd/debug.c index 9055db1382..4af4c815b3 100644 --- a/modules/rostests/winetests/msvcrtd/debug.c +++ b/modules/rostests/winetests/msvcrtd/debug.c @@ -31,6 +31,7 @@ /**********************************************************************/ static void * (__cdecl *pMSVCRTD_operator_new_dbg)(size_t, int, const char *, int) = NULL; +static void * (__cdecl *pMSVCRTD_operator_delete)(void *) = NULL; /* Some exports are only available in later versions */ #define SETNOFAIL(x,y) x = (void*)GetProcAddress(hModule,y) @@ -46,9 +47,15 @@ static BOOL init_functions(void) } if (sizeof(void *) > sizeof(int)) /* 64-bit has a different mangled name */ + { SET(pMSVCRTD_operator_new_dbg, "??2@YAPEAX_KHPEBDH@Z"); + SET(pMSVCRTD_operator_delete, "??3@YAXPEAX@Z"); + } else + { SET(pMSVCRTD_operator_new_dbg, "??2@YAPAXIHPBDH@Z"); + SET(pMSVCRTD_operator_delete, "??3@YAXPAX@Z"); + } if (pMSVCRTD_operator_new_dbg == NULL) return FALSE; @@ -64,7 +71,11 @@ static void test_new(void) mem = pMSVCRTD_operator_new_dbg(42, _NORMAL_BLOCK, __FILE__, __LINE__); ok(mem != NULL, "memory not allocated\n"); - HeapFree(GetProcessHeap(), 0, mem); + pMSVCRTD_operator_delete(mem); + + mem = pMSVCRTD_operator_new_dbg(42, _CRT_BLOCK, __FILE__, __LINE__); + ok(mem != NULL, "memory not allocated\n"); + pMSVCRTD_operator_delete(mem); } /**********************************************************************/
5 years, 12 months
1
0
0
0
[reactos] 01/01: [MSVCRT_WINETEST] Sync with Wine Staging 4.0. CORE-15682
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f446a50f76032af9b0e1f…
commit f446a50f76032af9b0e1fe3d66c2b9d087772a93 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Tue Jan 29 13:08:13 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Tue Jan 29 13:08:13 2019 +0100 [MSVCRT_WINETEST] Sync with Wine Staging 4.0. CORE-15682 --- modules/rostests/winetests/msvcrt/cpp.c | 6 +- modules/rostests/winetests/msvcrt/dir.c | 16 +- modules/rostests/winetests/msvcrt/file.c | 23 +- modules/rostests/winetests/msvcrt/locale.c | 17 +- modules/rostests/winetests/msvcrt/misc.c | 4 +- modules/rostests/winetests/msvcrt/printf.c | 4 +- modules/rostests/winetests/msvcrt/scanf.c | 9 +- modules/rostests/winetests/msvcrt/string.c | 422 ++++++++++++++++++++++++++--- 8 files changed, 426 insertions(+), 75 deletions(-) diff --git a/modules/rostests/winetests/msvcrt/cpp.c b/modules/rostests/winetests/msvcrt/cpp.c index cf5e4c7d60..07b49ae755 100644 --- a/modules/rostests/winetests/msvcrt/cpp.c +++ b/modules/rostests/winetests/msvcrt/cpp.c @@ -1108,8 +1108,8 @@ static void test_demangle_datatype(void) { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$01@@@", "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$01@@@", FALSE}, /* { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$011@@@", "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$011@@@",FALSE}, */ }; - int i, num_test = (sizeof(demangle)/sizeof(struct _demangle)); - + int i, num_test = ARRAY_SIZE(demangle); + for (i = 0; i < num_test; i++) { name = p__unDName(0, demangle[i].mangled, 0, pmalloc, pfree, 0x2800); @@ -1326,7 +1326,7 @@ static void test_demangle(void) /* 130 */ {"??_E?$TStrArray@$$BY0BAA@D$0BA@@@UAEPAXI@Z", "public: virtual void * __thiscall TStrArray<char [256],16>::`vector deleting destructor'(unsigned int)"}, }; - int i, num_test = (sizeof(test)/sizeof(test[0])); + int i, num_test = ARRAY_SIZE(test); char* name; for (i = 0; i < num_test; i++) diff --git a/modules/rostests/winetests/msvcrt/dir.c b/modules/rostests/winetests/msvcrt/dir.c index a29d32b9d3..210cf3983c 100644 --- a/modules/rostests/winetests/msvcrt/dir.c +++ b/modules/rostests/winetests/msvcrt/dir.c @@ -97,7 +97,7 @@ static void test_makepath(void) unsigned int i, n; - for (i = 0; i < sizeof(makepath_cases)/sizeof(makepath_cases[0]); ++i) + for (i = 0; i < ARRAY_SIZE(makepath_cases); ++i) { const makepath_case* p = &makepath_cases[i]; @@ -253,7 +253,7 @@ static void test_makepath_s(void) ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno); /* Test with the normal _makepath cases. */ - for (i = 0; i < sizeof(makepath_cases)/sizeof(makepath_cases[0]); i++) + for (i = 0; i < ARRAY_SIZE(makepath_cases); i++) { const makepath_case *p = makepath_cases + i; @@ -296,7 +296,7 @@ static void test_makepath_s(void) } /* Try insufficient length cases. */ - for (i = 0; i < sizeof(makepath_s_cases)/sizeof(makepath_s_cases[0]); i++) + for (i = 0; i < ARRAY_SIZE(makepath_s_cases); i++) { const makepath_s_case *p = makepath_s_cases + i; @@ -457,12 +457,12 @@ static void test_searchenv(void) ok(path_len, "GetTempPath failed\n"); memcpy(path, tmppath, path_len); - for(i=0; i<sizeof(dirs)/sizeof(*dirs); i++) { + for (i=0; i<ARRAY_SIZE(dirs); i++) { strcpy(path+path_len, dirs[i]); ok(!mkdir(path), "mkdir failed (dir = %s)\n", path); } - for(i=0; i<sizeof(files)/sizeof(*files); i++) { + for (i=0; i<ARRAY_SIZE(files); i++) { strcpy(path+path_len, files[i]); tmp_file = fopen(path, "wb"); ok(tmp_file != NULL, "fopen failed (file = %s)\n", path); @@ -471,7 +471,7 @@ static void test_searchenv(void) strcpy(env1, "TEST_PATH="); strcpy(env2, "TEST_PATH=;"); - for(i=1; i<sizeof(dirs)/sizeof(*dirs); i++) { + for (i=1; i<ARRAY_SIZE(dirs); i++) { strcat(env1, tmppath); strcat(env1, dirs[i]); strcat(env1, ";"); @@ -599,12 +599,12 @@ static void test_searchenv(void) putenv("TEST_PATH="); - for(i=sizeof(files)/sizeof(*files)-1; i>=0; i--) { + for (i=ARRAY_SIZE(files)-1; i>=0; i--) { strcpy(path+path_len, files[i]); ok(!remove(path), "remove failed (file = %s)\n", path); } - for(i=sizeof(dirs)/sizeof(*dirs)-1; i>=0; i--) { + for (i=ARRAY_SIZE(dirs)-1; i>=0; i--) { strcpy(path+path_len, dirs[i]); ok(!rmdir(path), "rmdir failed (dir = %s)\n", path); } diff --git a/modules/rostests/winetests/msvcrt/file.c b/modules/rostests/winetests/msvcrt/file.c index 136ee1563e..fe62d5c385 100644 --- a/modules/rostests/winetests/msvcrt/file.c +++ b/modules/rostests/winetests/msvcrt/file.c @@ -144,7 +144,7 @@ static void test_fileops( void ) write (fd, outbuffer, sizeof (outbuffer)); close (fd); - for (bufmode=0; bufmode < sizeof(bufmodes)/sizeof(bufmodes[0]); bufmode++) + for (bufmode=0; bufmode < ARRAY_SIZE(bufmodes); bufmode++) { fd = open ("fdopen.tst", O_RDONLY | O_BINARY); file = fdopen (fd, "rb"); @@ -195,13 +195,13 @@ static void test_fileops( void ) } fd = open ("fdopen.tst", O_RDONLY | O_TEXT); file = fdopen (fd, "rt"); /* open in TEXT mode */ - ok(fgetws(wbuffer,sizeof(wbuffer)/sizeof(wbuffer[0]),file) !=0,"fgetws failed unexpected\n"); - ok(fgetws(wbuffer,sizeof(wbuffer)/sizeof(wbuffer[0]),file) ==0,"fgetws didn't signal EOF\n"); + ok(fgetws(wbuffer,ARRAY_SIZE(wbuffer),file) !=0,"fgetws failed unexpected\n"); + ok(fgetws(wbuffer,ARRAY_SIZE(wbuffer),file) ==0,"fgetws didn't signal EOF\n"); ok(feof(file) !=0,"feof doesn't signal EOF\n"); rewind(file); ok(fgetws(wbuffer,strlen(outbuffer),file) !=0,"fgetws failed unexpected\n"); ok(lstrlenW(wbuffer) == (lstrlenA(outbuffer) -1),"fgetws didn't read right size\n"); - ok(fgetws(wbuffer,sizeof(outbuffer)/sizeof(outbuffer[0]),file) !=0,"fgets failed unexpected\n"); + ok(fgetws(wbuffer,ARRAY_SIZE(outbuffer),file) !=0,"fgets failed unexpected\n"); ok(lstrlenW(wbuffer) == 1,"fgets dropped chars\n"); fclose (file); @@ -624,7 +624,7 @@ static void test_flsbuf( void ) static const int bufmodes[] = {_IOFBF,_IONBF}; tempf=_tempnam(".","wne"); - for (bufmode=0; bufmode < sizeof(bufmodes)/sizeof(bufmodes[0]); bufmode++) + for (bufmode=0; bufmode < ARRAY_SIZE(bufmodes); bufmode++) { tempfh = fopen(tempf,"wb"); setvbuf(tempfh,NULL,bufmodes[bufmode],2048); @@ -878,8 +878,7 @@ static void test_fgetwc_locale(const char* text, const char* locale, int codepag { /* mbstowcs rejects invalid multibyte sequence, so we use MultiByteToWideChar here. */ - ret = MultiByteToWideChar(codepage, 0, text, -1, - wtextW, sizeof(wtextW)/sizeof(wtextW[0])); + ret = MultiByteToWideChar(codepage, 0, text, -1, wtextW, ARRAY_SIZE(wtextW)); ok(ret > 0, "MultiByteToWideChar failed\n"); } else @@ -910,7 +909,7 @@ static void test_fgetwc_locale(const char* text, const char* locale, int codepag tempfh = fopen(tempfile, "rb"); ok(tempfh != NULL, "can't open tempfile\n"); - for (i = 0; i < sizeof(wchar_text)/sizeof(wchar_text[0]); i++) + for (i = 0; i < ARRAY_SIZE(wchar_text); i++) { ch = fgetwc(tempfh); ok(ch == wchar_text[i], "got %04hx, expected %04x (cp%d[%d])\n", ch, wchar_text[i], codepage, i); @@ -946,7 +945,7 @@ static void test_fgetwc_unicode(void) tempfh = fopen(tempfile, "rt,ccs=unicode"); ok(tempfh != NULL, "can't open tempfile\n"); - for (i = 1; i < sizeof(wchar_text)/sizeof(wchar_text[0]); i++) + for (i = 1; i < ARRAY_SIZE(wchar_text); i++) { ch = fgetwc(tempfh); ok(ch == wchar_text[i], @@ -958,7 +957,7 @@ static void test_fgetwc_unicode(void) tempfh = fopen(tempfile, "wb"); ok(tempfh != NULL, "can't open tempfile\n"); - ret = WideCharToMultiByte(CP_UTF8, 0, wchar_text, sizeof(wchar_text)/sizeof(wchar_text[0]), + ret = WideCharToMultiByte(CP_UTF8, 0, wchar_text, ARRAY_SIZE(wchar_text), utf8_text, sizeof(utf8_text), NULL, NULL); ok(ret > 0, "utf-8 conversion failed\n"); fwrite(utf8_text, sizeof(char), ret, tempfh); @@ -966,7 +965,7 @@ static void test_fgetwc_unicode(void) tempfh = fopen(tempfile, "rt, ccs=UTF-8"); ok(tempfh != NULL, "can't open tempfile\n"); - for (i = 1; i < sizeof(wchar_text)/sizeof(wchar_text[0]); i++) + for (i = 1; i < ARRAY_SIZE(wchar_text); i++) { ch = fgetwc(tempfh); ok(ch == wchar_text[i], @@ -2659,5 +2658,5 @@ START_TEST(file) /* Wait for the (_P_NOWAIT) spawned processes to finish to make sure the report * file contains lines in the correct order */ - WaitForMultipleObjects(sizeof(proc_handles)/sizeof(proc_handles[0]), proc_handles, TRUE, 5000); + WaitForMultipleObjects(ARRAY_SIZE(proc_handles), proc_handles, TRUE, 5000); } diff --git a/modules/rostests/winetests/msvcrt/locale.c b/modules/rostests/winetests/msvcrt/locale.c index f87a7914d0..ff777599aa 100644 --- a/modules/rostests/winetests/msvcrt/locale.c +++ b/modules/rostests/winetests/msvcrt/locale.c @@ -144,12 +144,10 @@ static void test_setlocale(void) || broken(!strcmp(ret, "Chinese_Taiwan.950")), "ret = %s\n", ret); ret = setlocale(LC_ALL, "Chinese_China.936"); -todo_wine ok(ret != NULL || broken (ret == NULL), "ret == NULL\n"); if(ret) { trace("Chinese_China.936=%s\n", ret); -todo_wine ok(!strcmp(ret, "Chinese (Simplified)_People's Republic of China.936") /* Vista - Win7 */ || !strcmp(ret, "Chinese (Simplified)_China.936") /* Win8 - Win10 */ || broken(!strcmp(ret, "Chinese_People's Republic of China.936")), "ret = %s\n", ret); @@ -158,12 +156,14 @@ todo_wine ret = setlocale(LC_ALL, "csy"); ok(ret != NULL || broken (ret == NULL), "ret == NULL\n"); if(ret) - ok(!strcmp(ret, "Czech_Czech Republic.1250"), "ret = %s\n", ret); + ok(!strcmp(ret, "Czech_Czech Republic.1250") + || !strcmp(ret, "Czech_Czechia.1250"), "ret = %s\n", ret); ret = setlocale(LC_ALL, "czech"); ok(ret != NULL || broken (ret == NULL), "ret == NULL\n"); if(ret) - ok(!strcmp(ret, "Czech_Czech Republic.1250"), "ret = %s\n", ret); + ok(!strcmp(ret, "Czech_Czech Republic.1250") + || !strcmp(ret, "Czech_Czechia.1250"), "ret = %s\n", ret); ret = setlocale(LC_ALL, "dan"); ok(ret != NULL || broken (ret == NULL), "ret == NULL\n"); @@ -614,6 +614,9 @@ todo_wine ret = setlocale(LC_ALL, "English_United States.UTF8"); ok(ret == NULL, "ret != NULL\n"); + + ret = setlocale(LC_ALL, "en-US"); + ok(ret == NULL || broken (ret != NULL), "ret != NULL\n"); /* XP & 2003 */ } static void test_crtGetStringTypeW(void) @@ -640,7 +643,7 @@ static void test_crtGetStringTypeW(void) return; } - for(i=0; i<sizeof(str)/sizeof(*str); i++) { + for(i=0; i<ARRAY_SIZE(str); i++) { ret_crt = p__crtGetStringTypeW(0, CT_CTYPE1, str[i], 1, &out_crt); ret = GetStringTypeW(CT_CTYPE1, str[i], 1, &out); ok(ret == ret_crt, "%d) ret_crt = %d\n", i, (int)ret_crt); @@ -705,7 +708,7 @@ static void test__Gettnames(void) else ok(size==0x164 || broken(size==0xb8), "structure size: %x\n", size); - for (i = 0; i < sizeof(time_data)/sizeof(time_data[0]); i++) + for (i = 0; i < ARRAY_SIZE(time_data); i++) { size = GetLocaleInfoA(MAKELCID(LANG_ENGLISH, SORT_DEFAULT), time_data[i], buf, sizeof(buf)); @@ -719,7 +722,7 @@ static void test__Gettnames(void) return; ret = _Gettnames(); - for (i = 0; i < sizeof(time_data)/sizeof(time_data[0]); i++) + for (i = 0; i < ARRAY_SIZE(time_data); i++) { size = GetLocaleInfoA(MAKELCID(LANG_GERMAN, SORT_DEFAULT), time_data[i], buf, sizeof(buf)); diff --git a/modules/rostests/winetests/msvcrt/misc.c b/modules/rostests/winetests/msvcrt/misc.c index 20253342d9..4a0330a2e2 100644 --- a/modules/rostests/winetests/msvcrt/misc.c +++ b/modules/rostests/winetests/msvcrt/misc.c @@ -170,7 +170,7 @@ static void test_I10_OUTPUT(void) if (j != 12) trace("sizeof(long double) = %d on this machine\n", j); - for(i=0; i<sizeof(I10_OUTPUT_tests)/sizeof(I10_OUTPUT_test); i++) { + for(i=0; i<ARRAY_SIZE(I10_OUTPUT_tests); i++) { memset(out.str, '#', sizeof(out.str)); if (sizeof(long double) == 12) @@ -627,7 +627,7 @@ static void test__lfind_s(void) } key = 1234; - num = sizeof(tests)/sizeof(tests[0]); + num = ARRAY_SIZE(tests); errno = 0xdeadbeef; found = p_lfind_s(NULL, tests, &num, sizeof(int), _lfind_s_comp, NULL); diff --git a/modules/rostests/winetests/msvcrt/printf.c b/modules/rostests/winetests/msvcrt/printf.c index 64658ce25f..80180ff8b2 100644 --- a/modules/rostests/winetests/msvcrt/printf.c +++ b/modules/rostests/winetests/msvcrt/printf.c @@ -841,7 +841,7 @@ static void test_snprintf (void) const int bufsiz = sizeof buffer; unsigned int i; - for (i = 0; i < sizeof tests / sizeof tests[0]; i++) { + for (i = 0; i < ARRAY_SIZE(tests); i++) { const char *fmt = tests[i].format; const int expect = tests[i].expected; const int n = _snprintf (buffer, bufsiz, fmt); @@ -1215,7 +1215,7 @@ static void test_vsnwprintf(void) wchar_t str[32]; char buf[32]; - ret = _vsnwprintf_wrapper( str, sizeof(str)/sizeof(str[0]), format, one, two, three ); + ret = _vsnwprintf_wrapper( str, ARRAY_SIZE(str), format, one, two, three ); ok( ret == 11, "got %d expected 11\n", ret ); WideCharToMultiByte( CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL ); diff --git a/modules/rostests/winetests/msvcrt/scanf.c b/modules/rostests/winetests/msvcrt/scanf.c index 359b07937a..b7244835ac 100644 --- a/modules/rostests/winetests/msvcrt/scanf.c +++ b/modules/rostests/winetests/msvcrt/scanf.c @@ -282,10 +282,17 @@ static void test_sscanf_s(void) ok(ret == 0, "Wrong number of arguments read: %d\n", ret); ok(buf[0]=='\0', "buf = %s\n", buf); - buf[0] = 'a'; + memset(buf, 'a', sizeof(buf)); ret = psscanf_s("123", "%3c", buf, 2); ok(ret == 0, "Wrong number of arguments read: %d\n", ret); ok(buf[0]=='\0', "buf = %s\n", buf); + ok(buf[1]=='2', "buf[1] = %d\n", buf[1]); + ok(buf[2]=='a', "buf[2] = %d\n", buf[2]); + + buf[3] = 'a'; + buf[4] = 0; + ret = psscanf_s("123", "%3c", buf, 3); + ok(!strcmp("123a", buf), "buf = %s\n", buf); i = 1; ret = psscanf_s("123 123", "%s %d", buf, 2, &i); diff --git a/modules/rostests/winetests/msvcrt/string.c b/modules/rostests/winetests/msvcrt/string.c index b270366599..e80a51824b 100644 --- a/modules/rostests/winetests/msvcrt/string.c +++ b/modules/rostests/winetests/msvcrt/string.c @@ -89,6 +89,12 @@ static errno_t (__cdecl *p_mbslwr_s)(unsigned char *str, size_t numberOfElements static int (__cdecl *p_wctob)(wint_t); static size_t (__cdecl *p_wcrtomb)(char*, wchar_t, mbstate_t*); static int (__cdecl *p_tolower)(int); +static int (__cdecl *p_towlower)(wint_t); +static int (__cdecl *p__towlower_l)(wint_t, _locale_t); +static int (__cdecl *p_towupper)(wint_t); +static int (__cdecl *p__towupper_l)(wint_t, _locale_t); +static _locale_t(__cdecl *p__create_locale)(int, const char*); +static void(__cdecl *p__free_locale)(_locale_t); static size_t (__cdecl *p_mbrlen)(const char*, size_t, mbstate_t*); static size_t (__cdecl *p_mbrtowc)(wchar_t*, const char*, size_t, mbstate_t*); static int (__cdecl *p__atodbl_l)(_CRT_DOUBLE*,char*,_locale_t); @@ -100,6 +106,7 @@ static size_t (__cdecl *p__mbsnlen)(const unsigned char*, size_t); static int (__cdecl *p__mbccpy_s)(unsigned char*, size_t, int*, const unsigned char*); static int (__cdecl *p__memicmp)(const char*, const char*, size_t); static int (__cdecl *p__memicmp_l)(const char*, const char*, size_t, _locale_t); +static size_t (__cdecl *p___strncnt)(const char*, size_t); #define SETNOFAIL(x,y) x = (void*)GetProcAddress(hMsvcrt,y) #define SET(x,y) SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y) @@ -607,8 +614,6 @@ static void test_strcpy_s(void) dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]); } -#define NUMELMS(array) (sizeof(array)/sizeof((array)[0])) - #define okchars(dst, b0, b1, b2, b3, b4, b5, b6, b7) \ ok(dst[0] == b0 && dst[1] == b1 && dst[2] == b2 && dst[3] == b3 && \ dst[4] == b4 && dst[5] == b5 && dst[6] == b6 && dst[7] == b7, \ @@ -617,7 +622,7 @@ static void test_strcpy_s(void) static void test_memcpy_s(void) { - static char dest[8]; + static char dest[8], buf[32]; static const char tiny[] = {'T',0,'I','N','Y',0}; static const char big[] = {'a','t','o','o','l','o','n','g','s','t','r','i','n','g',0}; int ret; @@ -628,14 +633,14 @@ static void test_memcpy_s(void) /* Normal */ memset(dest, 'X', sizeof(dest)); - ret = p_memcpy_s(dest, NUMELMS(dest), tiny, NUMELMS(tiny)); + ret = p_memcpy_s(dest, ARRAY_SIZE(dest), tiny, ARRAY_SIZE(tiny)); ok(ret == 0, "Copying a buffer into a big enough destination returned %d, expected 0\n", ret); okchars(dest, tiny[0], tiny[1], tiny[2], tiny[3], tiny[4], tiny[5], 'X', 'X'); /* Vary source size */ errno = 0xdeadbeef; memset(dest, 'X', sizeof(dest)); - ret = p_memcpy_s(dest, NUMELMS(dest), big, NUMELMS(big)); + ret = p_memcpy_s(dest, ARRAY_SIZE(dest), big, ARRAY_SIZE(big)); ok(ret == ERANGE, "Copying a big buffer to a small destination returned %d, expected ERANGE\n", ret); ok(errno == ERANGE, "errno is %d, expected ERANGE\n", errno); okchars(dest, 0, 0, 0, 0, 0, 0, 0, 0); @@ -643,7 +648,7 @@ static void test_memcpy_s(void) /* Replace source with NULL */ errno = 0xdeadbeef; memset(dest, 'X', sizeof(dest)); - ret = p_memcpy_s(dest, NUMELMS(dest), NULL, NUMELMS(tiny)); + ret = p_memcpy_s(dest, ARRAY_SIZE(dest), NULL, ARRAY_SIZE(tiny)); ok(ret == EINVAL, "Copying a NULL source buffer returned %d, expected EINVAL\n", ret); ok(errno == EINVAL, "errno is %d, expected EINVAL\n", errno); okchars(dest, 0, 0, 0, 0, 0, 0, 0, 0); @@ -651,24 +656,36 @@ static void test_memcpy_s(void) /* Vary dest size */ errno = 0xdeadbeef; memset(dest, 'X', sizeof(dest)); - ret = p_memcpy_s(dest, 0, tiny, NUMELMS(tiny)); + ret = p_memcpy_s(dest, 0, tiny, ARRAY_SIZE(tiny)); ok(ret == ERANGE, "Copying into a destination of size 0 returned %d, expected ERANGE\n", ret); ok(errno == ERANGE, "errno is %d, expected ERANGE\n", errno); okchars(dest, 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X'); /* Replace dest with NULL */ errno = 0xdeadbeef; - ret = p_memcpy_s(NULL, NUMELMS(dest), tiny, NUMELMS(tiny)); + ret = p_memcpy_s(NULL, ARRAY_SIZE(dest), tiny, ARRAY_SIZE(tiny)); ok(ret == EINVAL, "Copying a tiny buffer to a big NULL destination returned %d, expected EINVAL\n", ret); ok(errno == EINVAL, "errno is %d, expected EINVAL\n", errno); /* Combinations */ errno = 0xdeadbeef; memset(dest, 'X', sizeof(dest)); - ret = p_memcpy_s(dest, 0, NULL, NUMELMS(tiny)); + ret = p_memcpy_s(dest, 0, NULL, ARRAY_SIZE(tiny)); ok(ret == EINVAL, "Copying a NULL buffer into a destination of size 0 returned %d, expected EINVAL\n", ret); ok(errno == EINVAL, "errno is %d, expected EINVAL\n", errno); okchars(dest, 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X'); + + ret = p_memcpy_s(buf, ARRAY_SIZE(buf), big, ARRAY_SIZE(big)); + ok(!ret, "memcpy_s returned %d\n", ret); + ok(!memcmp(buf, big, sizeof(big)), "unexpected buf\n"); + + ret = p_memcpy_s(buf + 1, ARRAY_SIZE(buf) - 1, buf, ARRAY_SIZE(big)); + ok(!ret, "memcpy_s returned %d\n", ret); + ok(!memcmp(buf + 1, big, sizeof(big)), "unexpected buf\n"); + + ret = p_memcpy_s(buf, ARRAY_SIZE(buf), buf + 1, ARRAY_SIZE(big)); + ok(!ret, "memcpy_s returned %d\n", ret); + ok(!memcmp(buf, big, sizeof(big)), "unexpected buf\n"); } static void test_memmove_s(void) @@ -684,20 +701,20 @@ static void test_memmove_s(void) /* Normal */ memset(dest, 'X', sizeof(dest)); - ret = p_memmove_s(dest, NUMELMS(dest), tiny, NUMELMS(tiny)); + ret = p_memmove_s(dest, ARRAY_SIZE(dest), tiny, ARRAY_SIZE(tiny)); ok(ret == 0, "Moving a buffer into a big enough destination returned %d, expected 0\n", ret); okchars(dest, tiny[0], tiny[1], tiny[2], tiny[3], tiny[4], tiny[5], 'X', 'X'); /* Overlapping */ memcpy(dest, big, sizeof(dest)); - ret = p_memmove_s(dest+1, NUMELMS(dest)-1, dest, NUMELMS(dest)-1); + ret = p_memmove_s(dest+1, ARRAY_SIZE(dest)-1, dest, ARRAY_SIZE(dest)-1); ok(ret == 0, "Moving a buffer up one char returned %d, expected 0\n", ret); okchars(dest, big[0], big[0], big[1], big[2], big[3], big[4], big[5], big[6]); /* Vary source size */ errno = 0xdeadbeef; memset(dest, 'X', sizeof(dest)); - ret = p_memmove_s(dest, NUMELMS(dest), big, NUMELMS(big)); + ret = p_memmove_s(dest, ARRAY_SIZE(dest), big, ARRAY_SIZE(big)); ok(ret == ERANGE, "Moving a big buffer to a small destination returned %d, expected ERANGE\n", ret); ok(errno == ERANGE, "errno is %d, expected ERANGE\n", errno); okchars(dest, 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X'); @@ -705,7 +722,7 @@ static void test_memmove_s(void) /* Replace source with NULL */ errno = 0xdeadbeef; memset(dest, 'X', sizeof(dest)); - ret = p_memmove_s(dest, NUMELMS(dest), NULL, NUMELMS(tiny)); + ret = p_memmove_s(dest, ARRAY_SIZE(dest), NULL, ARRAY_SIZE(tiny)); ok(ret == EINVAL, "Moving a NULL source buffer returned %d, expected EINVAL\n", ret); ok(errno == EINVAL, "errno is %d, expected EINVAL\n", errno); okchars(dest, 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X'); @@ -713,21 +730,21 @@ static void test_memmove_s(void) /* Vary dest size */ errno = 0xdeadbeef; memset(dest, 'X', sizeof(dest)); - ret = p_memmove_s(dest, 0, tiny, NUMELMS(tiny)); + ret = p_memmove_s(dest, 0, tiny, ARRAY_SIZE(tiny)); ok(ret == ERANGE, "Moving into a destination of size 0 returned %d, expected ERANGE\n", ret); ok(errno == ERANGE, "errno is %d, expected ERANGE\n", errno); okchars(dest, 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X'); /* Replace dest with NULL */ errno = 0xdeadbeef; - ret = p_memmove_s(NULL, NUMELMS(dest), tiny, NUMELMS(tiny)); + ret = p_memmove_s(NULL, ARRAY_SIZE(dest), tiny, ARRAY_SIZE(tiny)); ok(ret == EINVAL, "Moving a tiny buffer to a big NULL destination returned %d, expected EINVAL\n", ret); ok(errno == EINVAL, "errno is %d, expected EINVAL\n", errno); /* Combinations */ errno = 0xdeadbeef; memset(dest, 'X', sizeof(dest)); - ret = p_memmove_s(dest, 0, NULL, NUMELMS(tiny)); + ret = p_memmove_s(dest, 0, NULL, ARRAY_SIZE(tiny)); ok(ret == EINVAL, "Moving a NULL buffer into a destination of size 0 returned %d, expected EINVAL\n", ret); ok(errno == EINVAL, "errno is %d, expected EINVAL\n", errno); okchars(dest, 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X'); @@ -1016,7 +1033,7 @@ static void test_wcscpy_s(void) return; } - ret = p_wcsncpy_s(NULL, 18, szLongText, sizeof(szLongText)/sizeof(WCHAR)); + ret = p_wcsncpy_s(NULL, 18, szLongText, ARRAY_SIZE(szLongText)); ok(ret == EINVAL, "p_wcsncpy_s expect EINVAL got %d\n", ret); szDest[0] = 'A'; @@ -1030,16 +1047,16 @@ static void test_wcscpy_s(void) ok(szDest[0] == 0, "szDest[0] not 0\n"); szDest[0] = 'A'; - ret = p_wcsncpy_s(szDest, 0, szLongText, sizeof(szLongText)/sizeof(WCHAR)); + ret = p_wcsncpy_s(szDest, 0, szLongText, ARRAY_SIZE(szLongText)); ok(ret == ERANGE || ret == EINVAL, "expected ERANGE/EINVAL got %d\n", ret); ok(szDest[0] == 0 || ret == EINVAL, "szDest[0] not 0\n"); - ret = p_wcsncpy_s(szDest, 18, szLongText, sizeof(szLongText)/sizeof(WCHAR)); + ret = p_wcsncpy_s(szDest, 18, szLongText, ARRAY_SIZE(szLongText)); ok(ret == 0, "expected 0 got %d\n", ret); ok(lstrcmpW(szDest, szLongText) == 0, "szDest != szLongText\n"); szDest[0] = 'A'; - ret = p_wcsncpy_s(szDestShort, 8, szLongText, sizeof(szLongText)/sizeof(WCHAR)); + ret = p_wcsncpy_s(szDestShort, 8, szLongText, ARRAY_SIZE(szLongText)); ok(ret == ERANGE || ret == EINVAL, "expected ERANGE/EINVAL got %d\n", ret); ok(szDestShort[0] == 0, "szDestShort[0] not 0\n"); @@ -1067,7 +1084,7 @@ static void test__wcsupr_s(void) static const WCHAR expectedString[] = {'M', 'I', 'X', 'E', 'D', 'L', 'O', 'W', 'E', 'R', 'U', 'P', 'P', 'E', 'R', 0}; - WCHAR testBuffer[2*sizeof(mixedString)/sizeof(WCHAR)]; + WCHAR testBuffer[2*ARRAY_SIZE(mixedString)]; int ret; if (!p_wcsupr_s) @@ -1084,7 +1101,7 @@ static void test__wcsupr_s(void) /* Test NULL input string and valid size. */ errno = EBADF; - ret = p_wcsupr_s(NULL, sizeof(testBuffer)/sizeof(WCHAR)); + ret = p_wcsupr_s(NULL, ARRAY_SIZE(testBuffer)); ok(ret == EINVAL, "Expected _wcsupr_s to fail with EINVAL, got %d\n", ret); ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno); @@ -1128,21 +1145,21 @@ static void test__wcsupr_s(void) /* Test normal string uppercasing. */ wcscpy(testBuffer, mixedString); - ret = p_wcsupr_s(testBuffer, sizeof(mixedString)/sizeof(WCHAR)); + ret = p_wcsupr_s(testBuffer, ARRAY_SIZE(mixedString)); ok(ret == 0, "Expected _wcsupr_s to succeed, got %d\n", ret); ok(!wcscmp(testBuffer, expectedString), "Expected the string to be fully upper-case\n"); /* Test uppercasing with a shorter buffer size count. */ wcscpy(testBuffer, mixedString); errno = EBADF; - ret = p_wcsupr_s(testBuffer, sizeof(mixedString)/sizeof(WCHAR) - 1); + ret = p_wcsupr_s(testBuffer, ARRAY_SIZE(mixedString) - 1); ok(ret == EINVAL, "Expected _wcsupr_s to fail with EINVAL, got %d\n", ret); ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno); ok(testBuffer[0] == '\0', "Expected the first buffer character to be null\n"); /* Test uppercasing with a longer buffer size count. */ wcscpy(testBuffer, mixedString); - ret = p_wcsupr_s(testBuffer, sizeof(testBuffer)/sizeof(WCHAR)); + ret = p_wcsupr_s(testBuffer, ARRAY_SIZE(testBuffer)); ok(ret == 0, "Expected _wcsupr_s to succeed, got %d\n", ret); ok(!wcscmp(testBuffer, expectedString), "Expected the string to be fully upper-case\n"); } @@ -1154,7 +1171,7 @@ static void test__wcslwr_s(void) static const WCHAR expectedString[] = {'m', 'i', 'x', 'e', 'd', 'l', 'o', 'w', 'e', 'r', 'u', 'p', 'p', 'e', 'r', 0}; - WCHAR buffer[2*sizeof(mixedString)/sizeof(WCHAR)]; + WCHAR buffer[2*ARRAY_SIZE(mixedString)]; int ret; if (!p_wcslwr_s) @@ -1171,7 +1188,7 @@ static void test__wcslwr_s(void) /* Test NULL input string and valid size. */ errno = EBADF; - ret = p_wcslwr_s(NULL, sizeof(buffer)/sizeof(buffer[0])); + ret = p_wcslwr_s(NULL, ARRAY_SIZE(buffer)); ok(ret == EINVAL, "expected EINVAL, got %d\n", ret); ok(errno == EINVAL, "expected errno EINVAL, got %d\n", errno); @@ -1215,21 +1232,21 @@ static void test__wcslwr_s(void) /* Test normal string uppercasing. */ wcscpy(buffer, mixedString); - ret = p_wcslwr_s(buffer, sizeof(mixedString)/sizeof(WCHAR)); + ret = p_wcslwr_s(buffer, ARRAY_SIZE(mixedString)); ok(ret == 0, "expected 0, got %d\n", ret); ok(!wcscmp(buffer, expectedString), "expected lowercase\n"); /* Test uppercasing with a shorter buffer size count. */ wcscpy(buffer, mixedString); errno = EBADF; - ret = p_wcslwr_s(buffer, sizeof(mixedString)/sizeof(WCHAR) - 1); + ret = p_wcslwr_s(buffer, ARRAY_SIZE(mixedString) - 1); ok(ret == EINVAL, "expected EINVAL, got %d\n", ret); ok(errno == EINVAL, "expected errno to be EINVAL, got %d\n", errno); ok(buffer[0] == '\0', "expected empty string\n"); /* Test uppercasing with a longer buffer size count. */ wcscpy(buffer, mixedString); - ret = p_wcslwr_s(buffer, sizeof(buffer)/sizeof(WCHAR)); + ret = p_wcslwr_s(buffer, ARRAY_SIZE(buffer)); ok(ret == 0, "expected 0, got %d\n", ret); ok(!wcscmp(buffer, expectedString), "expected lowercase\n"); } @@ -1245,7 +1262,7 @@ static void test_mbcjisjms(void) unsigned int i, j; int prev_cp = _getmbcp(); - for (i = 0; i < sizeof(cp)/sizeof(cp[0]); i++) + for (i = 0; i < ARRAY_SIZE(cp); i++) { _setmbcp(cp[i]); for (j = 0; jisjms[j][0] != 0; j++) @@ -1273,7 +1290,7 @@ static void test_mbcjmsjis(void) unsigned int i, j; int prev_cp = _getmbcp(); - for (i = 0; i < sizeof(cp)/sizeof(cp[0]); i++) + for (i = 0; i < ARRAY_SIZE(cp); i++) { _setmbcp(cp[i]); for (j = 0; jmsjis[j][0] != 0; j++) @@ -1300,7 +1317,7 @@ static void test_mbctohira(void) unsigned int prev_cp = _getmbcp(); _setmbcp(_MB_CP_SBCS); - for (i = 0; i < sizeof(mbchira_932)/sizeof(mbchira_932[0]); i++) + for (i = 0; i < ARRAY_SIZE(mbchira_932); i++) { int ret, exp = mbchira_932[i][0]; ret = _mbctohira(mbchira_932[i][0]); @@ -1308,7 +1325,7 @@ static void test_mbctohira(void) } _setmbcp(932); - for (i = 0; i < sizeof(mbchira_932)/sizeof(mbchira_932[0]); i++) + for (i = 0; i < ARRAY_SIZE(mbchira_932); i++) { unsigned int ret, exp; ret = _mbctohira(mbchira_932[i][0]); @@ -1329,7 +1346,7 @@ static void test_mbctokata(void) unsigned int prev_cp = _getmbcp(); _setmbcp(_MB_CP_SBCS); - for (i = 0; i < sizeof(mbckata_932)/sizeof(mbckata_932[0]); i++) + for (i = 0; i < ARRAY_SIZE(mbckata_932); i++) { int ret, exp = mbckata_932[i][0]; ret = _mbctokata(mbckata_932[i][0]); @@ -1337,7 +1354,7 @@ static void test_mbctokata(void) } _setmbcp(932); - for (i = 0; i < sizeof(mbckata_932)/sizeof(mbckata_932[0]); i++) + for (i = 0; i < ARRAY_SIZE(mbckata_932); i++) { unsigned int ret, exp; ret = _mbctokata(mbckata_932[i][0]); @@ -1358,7 +1375,7 @@ static void test_mbbtombc(void) int i, j; int prev_cp = _getmbcp(); - for (i = 0; i < sizeof(cp)/sizeof(cp[0]); i++) + for (i = 0; i < ARRAY_SIZE(cp); i++) { _setmbcp(cp[i]); for (j = 0; mbbmbc[j][0] != 0; j++) @@ -1411,13 +1428,13 @@ static void test_ismbckata(void) { unsigned int i; _setmbcp(_MB_CP_SBCS); - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) { + for (i = 0; i < ARRAY_SIZE(tests); i++) { ret = _ismbckata(tests[i].c); ok(!ret, "expected 0, got %d for %04x\n", ret, tests[i].c); } _setmbcp(932); - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) { + for (i = 0; i < ARRAY_SIZE(tests); i++) { ret = _ismbckata(tests[i].c); ok(!!ret == tests[i].exp, "expected %d, got %d for %04x\n", tests[i].exp, !!ret, tests[i].c); @@ -2995,7 +3012,7 @@ static void test__wcstoi64(void) ok(ures == 071, "ures != 071\n"); /* Test various unicode digits */ - for (i = 0; i < sizeof(zeros) / sizeof(zeros[0]); ++i) { + for (i = 0; i < ARRAY_SIZE(zeros); ++i) { WCHAR tmp[] = {zeros[i] + 4, zeros[i], zeros[i] + 5, 0}; res = p_wcstoi64(tmp, NULL, 0); ok(res == 405, "with zero = U+%04X: got %d, expected 405\n", zeros[i], (int)res); @@ -3346,6 +3363,319 @@ static void test__memicmp_l(void) ok(errno == 0xdeadbeef, "errno is %d, expected 0xdeadbeef\n", errno); } +static void test__strupr(void) +{ + const char str[] = "123"; + char str2[4]; + char *mem, *p; + DWORD prot; + + mem = VirtualAlloc(NULL, sizeof(str), MEM_COMMIT, PAGE_READWRITE); + ok(mem != NULL, "VirtualAlloc failed\n"); + memcpy(mem, str, sizeof(str)); + ok(VirtualProtect(mem, sizeof(str), PAGE_READONLY, &prot), "VirtualProtect failed\n"); + + strcpy(str2, "aBc"); + p = _strupr(str2); + ok(p == str2, "_strupr returned %p\n", p); + ok(!strcmp(str2, "ABC"), "str2 = %s\n", str2); + + p = _strupr(mem); + ok(p == mem, "_strupr returned %p\n", p); + ok(!strcmp(mem, "123"), "mem = %s\n", mem); + + if(!setlocale(LC_ALL, "english")) { + VirtualFree(mem, sizeof(str), MEM_RELEASE); + win_skip("English locale _strupr tests\n"); + return; + } + + strcpy(str2, "aBc"); + p = _strupr(str2); + ok(p == str2, "_strupr returned %p\n", p); + ok(!strcmp(str2, "ABC"), "str2 = %s\n", str2); + + if (0) /* crashes on Windows */ + { + p = _strupr(mem); + ok(p == mem, "_strupr returned %p\n", p); + ok(!strcmp(mem, "123"), "mem = %s\n", mem); + } + + setlocale(LC_ALL, "C"); + VirtualFree(mem, sizeof(str), MEM_RELEASE); +} + +static void test__tcsncoll(void) +{ + struct test { + const char *locale; + const char *str1; + const char *str2; + size_t count; + int exp; + }; + static const struct test tests[] = { + { "English", "ABCD", "ABCD", 4, 0 }, + { "English", "ABCD", "ABCD", 10, 0 }, + + { "English", "ABC", "ABCD", 3, 0 }, + { "English", "ABC", "ABCD", 4, -1 }, + { "English", "ABC", "ABCD", 10, -1 }, + + { "English", "ABCD", "ABC", 3, 0 }, + { "English", "ABCD", "ABC", 4, 1 }, + { "English", "ABCD", "ABC", 10, 1 }, + + { "English", "ABCe", "ABCf", 3, 0 }, + { "English", "abcd", "ABCD", 10, -1 }, + + { "C", "ABCD", "ABCD", 4, 0 }, + { "C", "ABCD", "ABCD", 10, 0 }, + + { "C", "ABC", "ABCD", 3, 0 }, + { "C", "ABC", "ABCD", 10, -1 }, + + { "C", "ABCD", "ABC", 3, 0 }, + { "C", "ABCD", "ABC", 10, 1 }, + + { "C", "ABCe", "ABCf", 3, 0 }, + { "C", "abcd", "ABCD", 10, 1 }, + }; + WCHAR str1W[16]; + WCHAR str2W[16]; + char str1[16]; + char str2[16]; + size_t len; + int i, ret; + + for (i = 0; i < ARRAY_SIZE(tests); i++) + { + if (!setlocale(LC_ALL, tests[i].locale)) + { + win_skip("%s locale _tcsncoll tests\n", tests[i].locale); + for (; i+1 < ARRAY_SIZE(tests); i++) + if (strcmp(tests[i].locale, tests[i+1].locale)) break; + continue; + } + + memset(str1, 0xee, sizeof(str1)); + strcpy(str1, tests[i].str1); + + memset(str2, 0xff, sizeof(str2)); + strcpy(str2, tests[i].str2); + + ret = _strncoll(str1, str2, tests[i].count); + if (!tests[i].exp) + ok(!ret, "expected 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count); + else if (tests[i].exp < 0) + ok(ret < 0, "expected < 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count); + else + ok(ret > 0, "expected > 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count); + + memset(str1W, 0xee, sizeof(str1W)); + len = mbstowcs(str1W, str1, ARRAY_SIZE(str1W)); + str1W[len] = 0; + + memset(str2W, 0xff, sizeof(str2W)); + len = mbstowcs(str2W, str2, ARRAY_SIZE(str2W)); + str2W[len] = 0; + + ret = _wcsncoll(str1W, str2W, tests[i].count); + if (!tests[i].exp) + ok(!ret, "expected 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count); + else if (tests[i].exp < 0) + ok(ret < 0, "expected < 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count); + else + ok(ret > 0, "expected > 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count); + } +} + +static void test__tcsnicoll(void) +{ + struct test { + const char *locale; + const char *str1; + const char *str2; + size_t count; + int exp; + }; + static const struct test tests[] = { + { "English", "abcd", "ABCD", 4, 0 }, + { "English", "abcd", "ABCD", 10, 0 }, + + { "English", "abc", "ABCD", 3, 0 }, + { "English", "abc", "ABCD", 4, -1 }, + { "English", "abc", "ABCD", 10, -1 }, + + { "English", "abcd", "ABC", 3, 0 }, + { "English", "abcd", "ABC", 4, 1 }, + { "English", "abcd", "ABC", 10, 1 }, + + { "English", "abcE", "ABCF", 3, 0 }, + + { "C", "abcd", "ABCD", 4, 0 }, + { "C", "abcd", "ABCD", 10, 0 }, + + { "C", "abc", "ABCD", 3, 0 }, + { "C", "abc", "ABCD", 10, -1 }, + + { "C", "abcd", "ABC", 3, 0 }, + { "C", "abcd", "ABC", 10, 1 }, + + { "C", "abce", "ABCf", 3, 0 }, + }; + WCHAR str1W[16]; + WCHAR str2W[16]; + char str1[16]; + char str2[16]; + size_t len; + int i, ret; + + for (i = 0; i < ARRAY_SIZE(tests); i++) + { + if (!setlocale(LC_ALL, tests[i].locale)) + { + win_skip("%s locale _tcsnicoll tests\n", tests[i].locale); + for (; i+1 < ARRAY_SIZE(tests); i++) + if (strcmp(tests[i].locale, tests[i+1].locale)) break; + continue; + } + + memset(str1, 0xee, sizeof(str1)); + strcpy(str1, tests[i].str1); + + memset(str2, 0xff, sizeof(str2)); + strcpy(str2, tests[i].str2); + + ret = _strnicoll(str1, str2, tests[i].count); + if (!tests[i].exp) + ok(!ret, "expected 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count); + else if (tests[i].exp < 0) + ok(ret < 0, "expected < 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count); + else + ok(ret > 0, "expected > 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count); + + memset(str1W, 0xee, sizeof(str1W)); + len = mbstowcs(str1W, str1, ARRAY_SIZE(str1W)); + str1W[len] = 0; + + memset(str2W, 0xff, sizeof(str2W)); + len = mbstowcs(str2W, str2, ARRAY_SIZE(str2W)); + str2W[len] = 0; + + ret = _wcsnicoll(str1W, str2W, tests[i].count); + if (!tests[i].exp) + ok(!ret, "expected 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count); + else if (tests[i].exp < 0) + ok(ret < 0, "expected < 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count); + else + ok(ret > 0, "expected > 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count); + } +} + +static void test___strncnt(void) +{ + static const struct + { + const char *str; + size_t size; + size_t ret; + } + strncnt_tests[] = + { + { NULL, 0, 0 }, + { "a", 0, 0 }, + { "a", 1, 1 }, + { "a", 10, 1 }, + { "abc", 1, 1 }, + }; + unsigned int i; + size_t ret; + + if (!p___strncnt) + { + win_skip("__strncnt() is not available.\n"); + return; + } + + if (0) /* crashes */ + ret = p___strncnt(NULL, 1); + + for (i = 0; i < ARRAY_SIZE(strncnt_tests); ++i) + { + ret = p___strncnt(strncnt_tests[i].str, strncnt_tests[i].size); + ok(ret == strncnt_tests[i].ret, "%u: unexpected return value %u.\n", i, (int)ret); + } +} + +static void test_C_locale(void) +{ + int i, j; + wint_t ret, exp; + _locale_t locale; + static const char *locales[] = { NULL, "C" }; + + /* C locale only converts case for [a-zA-Z] */ + setlocale(LC_ALL, "C"); + for (i = 0; i <= 0xffff; i++) + { + ret = p_towlower(i); + if (i >= 'A' && i <= 'Z') + { + exp = i + 'a' - 'A'; + ok(ret == exp, "expected %x, got %x for C locale\n", exp, ret); + } + else + todo_wine_if(ret != i) + ok(ret == i, "expected self %x, got %x for C locale\n", i, ret); + + ret = p_towupper(i); + if (i >= 'a' && i <= 'z') + { + exp = i + 'A' - 'a'; + ok(ret == exp, "expected %x, got %x for C locale\n", exp, ret); + } + else + todo_wine_if(ret != i) + ok(ret == i, "expected self %x, got %x for C locale\n", i, ret); + } + + if (!p__towlower_l || !p__towupper_l || !p__create_locale) + { + win_skip("_towlower_l/_towupper_l/_create_locale not available\n"); + return; + } + + for (i = 0; i < ARRAY_SIZE(locales); i++) { + locale = locales[i] ? p__create_locale(LC_ALL, locales[i]) : NULL; + + for (j = 0; j <= 0xffff; j++) { + ret = p__towlower_l(j, locale); + if (j >= 'A' && j <= 'Z') + { + exp = j + 'a' - 'A'; + ok(ret == exp, "expected %x, got %x for C locale\n", exp, ret); + } + else + todo_wine_if(ret != j) + ok(ret == j, "expected self %x, got %x for C locale\n", j, ret); + + ret = p__towupper_l(j, locale); + if (j >= 'a' && j <= 'z') + { + exp = j + 'A' - 'a'; + ok(ret == exp, "expected %x, got %x for C locale\n", exp, ret); + } + else + todo_wine_if(ret != j) + ok(ret == j, "expected self %x, got %x for C locale\n", j, ret); + } + + p__free_locale(locale); + } +} + START_TEST(string) { char mem[100]; @@ -3391,6 +3721,12 @@ START_TEST(string) p_wctob = (void*)GetProcAddress(hMsvcrt, "wctob"); p_wcrtomb = (void*)GetProcAddress(hMsvcrt, "wcrtomb"); p_tolower = (void*)GetProcAddress(hMsvcrt, "tolower"); + p_towlower = (void*)GetProcAddress(hMsvcrt, "towlower"); + p__towlower_l = (void*)GetProcAddress(hMsvcrt, "_towlower_l"); + p_towupper = (void*)GetProcAddress(hMsvcrt, "towupper"); + p__towupper_l = (void*)GetProcAddress(hMsvcrt, "_towupper_l"); + p__create_locale = (void*)GetProcAddress(hMsvcrt, "_create_locale"); + p__free_locale = (void*)GetProcAddress(hMsvcrt, "_free_locale"); p_mbrlen = (void*)GetProcAddress(hMsvcrt, "mbrlen"); p_mbrtowc = (void*)GetProcAddress(hMsvcrt, "mbrtowc"); p_mbsrtowcs = (void*)GetProcAddress(hMsvcrt, "mbsrtowcs"); @@ -3404,6 +3740,7 @@ START_TEST(string) p__mbccpy_s = (void*)GetProcAddress(hMsvcrt, "_mbccpy_s"); p__memicmp = (void*)GetProcAddress(hMsvcrt, "_memicmp"); p__memicmp_l = (void*)GetProcAddress(hMsvcrt, "_memicmp_l"); + p___strncnt = (void*)GetProcAddress(hMsvcrt, "__strncnt"); /* MSVCRT memcpy behaves like memmove for overlapping moves, MFC42 CString::Insert seems to rely on that behaviour */ @@ -3468,4 +3805,9 @@ START_TEST(string) test__ismbclx(); test__memicmp(); test__memicmp_l(); + test__strupr(); + test__tcsncoll(); + test__tcsnicoll(); + test___strncnt(); + test_C_locale(); }
5 years, 12 months
1
0
0
0
[reactos] 01/01: [MSRLE32_WINETEST] Sync with Wine Staging 4.0. CORE-15682
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e430a46061e5b1d9c938c…
commit e430a46061e5b1d9c938c6de544eafb5591f6c05 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Tue Jan 29 13:07:39 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Tue Jan 29 13:07:39 2019 +0100 [MSRLE32_WINETEST] Sync with Wine Staging 4.0. CORE-15682 --- modules/rostests/winetests/msrle32/msrle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/rostests/winetests/msrle32/msrle.c b/modules/rostests/winetests/msrle32/msrle.c index 14ddddb342..4a442a0b90 100644 --- a/modules/rostests/winetests/msrle32/msrle.c +++ b/modules/rostests/winetests/msrle32/msrle.c @@ -129,7 +129,7 @@ static void test_raw_decompress(void) outbits = HeapAlloc(GetProcessHeap(), 0, bih->biSizeImage); ok(outbits != NULL, "Expected non-NULL value\n"); - for (i = 0; i < sizeof(codecs) / sizeof(codecs[0]); i++) + for (i = 0; i < ARRAY_SIZE(codecs); i++) { memset(bits, i + 0xAF, bih->biSizeImage);
5 years, 12 months
1
0
0
0
[reactos] 01/01: [MSRLE32] Sync with Wine Staging 4.0. CORE-15682
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6c5ec3ddffcbdea6ad36c…
commit 6c5ec3ddffcbdea6ad36c814bd14992b290d37df Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Tue Jan 29 13:07:09 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Tue Jan 29 13:07:09 2019 +0100 [MSRLE32] Sync with Wine Staging 4.0. CORE-15682 --- dll/win32/msrle32/msrle32.c | 8 ++++---- media/doc/README.WINE | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dll/win32/msrle32/msrle32.c b/dll/win32/msrle32/msrle32.c index 66880408d4..5bcfa86f97 100644 --- a/dll/win32/msrle32/msrle32.c +++ b/dll/win32/msrle32/msrle32.c @@ -1183,8 +1183,8 @@ static LRESULT GetInfo(const CodecInfo *pi, ICINFO *icinfo, DWORD dwSize) icinfo->dwVersion = ICVERSION; icinfo->dwVersionICM = ICVERSION; - LoadStringW(MSRLE32_hModule, IDS_NAME, icinfo->szName, sizeof(icinfo->szName)/sizeof(WCHAR)); - LoadStringW(MSRLE32_hModule, IDS_DESCRIPTION, icinfo->szDescription, sizeof(icinfo->szDescription)/sizeof(WCHAR)); + LoadStringW(MSRLE32_hModule, IDS_NAME, icinfo->szName, ARRAY_SIZE(icinfo->szName)); + LoadStringW(MSRLE32_hModule, IDS_DESCRIPTION, icinfo->szDescription, ARRAY_SIZE(icinfo->szDescription)); return sizeof(ICINFO); } @@ -1206,8 +1206,8 @@ static LRESULT About(CodecInfo *pi, HWND hWnd) /* pre-condition */ assert(MSRLE32_hModule != 0); - LoadStringW(MSRLE32_hModule, IDS_NAME, szTitle, sizeof(szTitle)/sizeof(szTitle[0])); - LoadStringW(MSRLE32_hModule, IDS_ABOUT, szAbout, sizeof(szAbout)/sizeof(szAbout[0])); + LoadStringW(MSRLE32_hModule, IDS_NAME, szTitle, ARRAY_SIZE(szTitle)); + LoadStringW(MSRLE32_hModule, IDS_ABOUT, szAbout, ARRAY_SIZE(szAbout)); MessageBoxW(hWnd, szAbout, szTitle, MB_OK|MB_ICONINFORMATION); diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 831ffb7575..7444ffb993 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -119,7 +119,7 @@ reactos/dll/win32/msisip # Synced to WineStaging-3.3 reactos/dll/win32/msisys.ocx # Synced to WineStaging-3.3 reactos/dll/win32/msnet32 # Synced to WineStaging-2.9 reactos/dll/win32/mspatcha # Forked at WineStaging-3.3 -reactos/dll/win32/msrle32 # Synced to WineStaging-3.3 +reactos/dll/win32/msrle32 # Synced to WineStaging-4.0 reactos/dll/win32/mssign32 # Synced to WineStaging-3.3 reactos/dll/win32/mssip32 # Synced to WineStaging-3.3 reactos/dll/win32/mstask # Synced to WineStaging-3.3
5 years, 12 months
1
0
0
0
[reactos] 01/01: [MSGSM32.ACM] Sync with Wine Staging 4.0. CORE-15682
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=606f6cab10558110502ba…
commit 606f6cab10558110502ba777db50a94256d58141 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Tue Jan 29 13:06:38 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Tue Jan 29 13:06:38 2019 +0100 [MSGSM32.ACM] Sync with Wine Staging 4.0. CORE-15682 --- dll/win32/msgsm32.acm/msgsm32.c | 17 ++++++++--------- media/doc/README.WINE | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/dll/win32/msgsm32.acm/msgsm32.c b/dll/win32/msgsm32.acm/msgsm32.c index cce1303455..cbf396f3b4 100644 --- a/dll/win32/msgsm32.acm/msgsm32.c +++ b/dll/win32/msgsm32.acm/msgsm32.c @@ -125,13 +125,13 @@ static LRESULT GSM_DriverDetails(PACMDRIVERDETAILSW add) add->cFilterTags = 0; add->hicon = NULL; MultiByteToWideChar( CP_ACP, 0, "Microsoft GSM 6.10", -1, - add->szShortName, sizeof(add->szShortName)/sizeof(WCHAR) ); + add->szShortName, ARRAY_SIZE( add->szShortName )); MultiByteToWideChar( CP_ACP, 0, "Wine GSM 6.10 libgsm codec", -1, - add->szLongName, sizeof(add->szLongName)/sizeof(WCHAR) ); + add->szLongName, ARRAY_SIZE( add->szLongName )); MultiByteToWideChar( CP_ACP, 0, "Brought to you by the Wine team...", -1, - add->szCopyright, sizeof(add->szCopyright)/sizeof(WCHAR) ); + add->szCopyright, ARRAY_SIZE( add->szCopyright )); MultiByteToWideChar( CP_ACP, 0, "Refer to LICENSE file", -1, - add->szLicensing, sizeof(add->szLicensing)/sizeof(WCHAR) ); + add->szLicensing, ARRAY_SIZE( add->szLicensing )); add->szFeatures[0] = 0; return MMSYSERR_NOERROR; } @@ -199,7 +199,6 @@ static BOOL GSM_FormatValidate(const WAVEFORMATEX *wfx) } static const DWORD gsm_rates[] = { 8000, 11025, 22050, 44100, 48000, 96000 }; -#define NUM_RATES (sizeof(gsm_rates)/sizeof(*gsm_rates)) /*********************************************************************** * GSM_FormatTagDetails @@ -241,13 +240,13 @@ static LRESULT GSM_FormatTagDetails(PACMFORMATTAGDETAILSW aftd, DWORD dwQuery) case 0: aftd->dwFormatTag = WAVE_FORMAT_PCM; aftd->cbFormatSize = sizeof(PCMWAVEFORMAT); - aftd->cStandardFormats = NUM_RATES; + aftd->cStandardFormats = ARRAY_SIZE(gsm_rates); lstrcpyW(aftd->szFormatTag, szPcm); break; case 1: aftd->dwFormatTag = WAVE_FORMAT_GSM610; aftd->cbFormatSize = sizeof(GSM610WAVEFORMAT); - aftd->cStandardFormats = NUM_RATES; + aftd->cStandardFormats = ARRAY_SIZE(gsm_rates); lstrcpyW(aftd->szFormatTag, szGsm); break; } @@ -270,7 +269,7 @@ static LRESULT GSM_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery) switch (afd->dwFormatTag) { case WAVE_FORMAT_PCM: - if (afd->dwFormatIndex >= NUM_RATES) return ACMERR_NOTPOSSIBLE; + if (afd->dwFormatIndex >= ARRAY_SIZE(gsm_rates)) return ACMERR_NOTPOSSIBLE; afd->pwfx->nChannels = 1; afd->pwfx->nSamplesPerSec = gsm_rates[afd->dwFormatIndex]; afd->pwfx->wBitsPerSample = 16; @@ -278,7 +277,7 @@ static LRESULT GSM_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery) afd->pwfx->nAvgBytesPerSec = afd->pwfx->nSamplesPerSec * afd->pwfx->nBlockAlign; break; case WAVE_FORMAT_GSM610: - if (afd->dwFormatIndex >= NUM_RATES) return ACMERR_NOTPOSSIBLE; + if (afd->dwFormatIndex >= ARRAY_SIZE(gsm_rates)) return ACMERR_NOTPOSSIBLE; afd->pwfx->nChannels = 1; afd->pwfx->nSamplesPerSec = gsm_rates[afd->dwFormatIndex]; afd->pwfx->wBitsPerSample = 0; diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 23e50e9b4e..831ffb7575 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -109,7 +109,7 @@ reactos/dll/win32/mscoree # Synced to Wine-1.5.4 reactos/dll/win32/msctf # Synced to WineStaging-4.0 reactos/dll/win32/msftedit # Synced to WineStaging-3.3 reactos/dll/win32/msg711.acm # Synced to WineStaging-4.0 -reactos/dll/win32/msgsm32.acm # Synced to WineStaging-3.3 +reactos/dll/win32/msgsm32.acm # Synced to WineStaging-4.0 reactos/dll/win32/mshtml # Synced to WineStaging-1.7.55 reactos/dll/win32/mshtml.tlb # Synced to WineStaging-1.7.55 reactos/dll/win32/msi # Synced to WineStaging-3.3
5 years, 12 months
1
0
0
0
[reactos] 01/01: [MSG711.ACM] Sync with Wine Staging 4.0. CORE-15682
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3d3499acfa69648164cf2…
commit 3d3499acfa69648164cf24e608ce7089b56ec88c Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Tue Jan 29 13:06:10 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Tue Jan 29 13:06:10 2019 +0100 [MSG711.ACM] Sync with Wine Staging 4.0. CORE-15682 --- dll/win32/msg711.acm/msg711.c | 30 +++++++++++++----------------- media/doc/README.WINE | 2 +- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/dll/win32/msg711.acm/msg711.c b/dll/win32/msg711.acm/msg711.c index dc1661c7db..d20c89bfaf 100644 --- a/dll/win32/msg711.acm/msg711.c +++ b/dll/win32/msg711.acm/msg711.c @@ -87,10 +87,6 @@ static const Format ULaw_Formats[] = {1, 8, 22050}, {2, 8, 22050}, {1, 8, 44100}, {2, 8, 44100}, }; -#define NUM_PCM_FORMATS (sizeof(PCM_Formats) / sizeof(PCM_Formats[0])) -#define NUM_ALAW_FORMATS (sizeof(ALaw_Formats) / sizeof(ALaw_Formats[0])) -#define NUM_ULAW_FORMATS (sizeof(ULaw_Formats) / sizeof(ULaw_Formats[0])) - /*********************************************************************** * G711_GetFormatIndex */ @@ -102,15 +98,15 @@ static DWORD G711_GetFormatIndex(const WAVEFORMATEX *wfx) switch (wfx->wFormatTag) { case WAVE_FORMAT_PCM: - hi = NUM_PCM_FORMATS; + hi = ARRAY_SIZE(PCM_Formats); fmts = PCM_Formats; break; case WAVE_FORMAT_ALAW: - hi = NUM_ALAW_FORMATS; + hi = ARRAY_SIZE(ALaw_Formats); fmts = ALaw_Formats; break; case WAVE_FORMAT_MULAW: - hi = NUM_ULAW_FORMATS; + hi = ARRAY_SIZE(ULaw_Formats); fmts = ULaw_Formats; break; default: @@ -662,13 +658,13 @@ static LRESULT G711_DriverDetails(PACMDRIVERDETAILSW add) add->cFilterTags = 0; add->hicon = NULL; MultiByteToWideChar( CP_ACP, 0, "Microsoft CCITT G.711", -1, - add->szShortName, sizeof(add->szShortName)/sizeof(WCHAR) ); + add->szShortName, ARRAY_SIZE( add->szShortName )); MultiByteToWideChar( CP_ACP, 0, "Wine G711 converter", -1, - add->szLongName, sizeof(add->szLongName)/sizeof(WCHAR) ); + add->szLongName, ARRAY_SIZE( add->szLongName )); MultiByteToWideChar( CP_ACP, 0, "Brought to you by the Wine team...", -1, - add->szCopyright, sizeof(add->szCopyright)/sizeof(WCHAR) ); + add->szCopyright, ARRAY_SIZE( add->szCopyright )); MultiByteToWideChar( CP_ACP, 0, "Refer to LICENSE file", -1, - add->szLicensing, sizeof(add->szLicensing)/sizeof(WCHAR) ); + add->szLicensing, ARRAY_SIZE( add->szLicensing )); add->szFeatures[0] = 0; return MMSYSERR_NOERROR; @@ -716,19 +712,19 @@ static LRESULT G711_FormatTagDetails(PACMFORMATTAGDETAILSW aftd, DWORD dwQuery) case 0: aftd->dwFormatTag = WAVE_FORMAT_PCM; aftd->cbFormatSize = sizeof(PCMWAVEFORMAT); - aftd->cStandardFormats = NUM_PCM_FORMATS; + aftd->cStandardFormats = ARRAY_SIZE(PCM_Formats); lstrcpyW(aftd->szFormatTag, szPcm); break; case 1: aftd->dwFormatTag = WAVE_FORMAT_ALAW; aftd->cbFormatSize = sizeof(WAVEFORMATEX); - aftd->cStandardFormats = NUM_ALAW_FORMATS; + aftd->cStandardFormats = ARRAY_SIZE(ALaw_Formats); lstrcpyW(aftd->szFormatTag, szALaw); break; case 2: aftd->dwFormatTag = WAVE_FORMAT_MULAW; aftd->cbFormatSize = sizeof(WAVEFORMATEX); - aftd->cStandardFormats = NUM_ULAW_FORMATS; + aftd->cStandardFormats = ARRAY_SIZE(ULaw_Formats); lstrcpyW(aftd->szFormatTag, szULaw); break; } @@ -751,7 +747,7 @@ static LRESULT G711_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery) switch (afd->dwFormatTag) { case WAVE_FORMAT_PCM: - if (afd->dwFormatIndex >= NUM_PCM_FORMATS) return ACMERR_NOTPOSSIBLE; + if (afd->dwFormatIndex >= ARRAY_SIZE(PCM_Formats)) return ACMERR_NOTPOSSIBLE; afd->pwfx->nChannels = PCM_Formats[afd->dwFormatIndex].nChannels; afd->pwfx->nSamplesPerSec = PCM_Formats[afd->dwFormatIndex].rate; afd->pwfx->wBitsPerSample = PCM_Formats[afd->dwFormatIndex].nBits; @@ -759,7 +755,7 @@ static LRESULT G711_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery) afd->pwfx->nAvgBytesPerSec = afd->pwfx->nSamplesPerSec * afd->pwfx->nBlockAlign; break; case WAVE_FORMAT_ALAW: - if (afd->dwFormatIndex >= NUM_ALAW_FORMATS) return ACMERR_NOTPOSSIBLE; + if (afd->dwFormatIndex >= ARRAY_SIZE(ALaw_Formats)) return ACMERR_NOTPOSSIBLE; afd->pwfx->nChannels = ALaw_Formats[afd->dwFormatIndex].nChannels; afd->pwfx->nSamplesPerSec = ALaw_Formats[afd->dwFormatIndex].rate; afd->pwfx->wBitsPerSample = ALaw_Formats[afd->dwFormatIndex].nBits; @@ -768,7 +764,7 @@ static LRESULT G711_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery) afd->pwfx->cbSize = 0; break; case WAVE_FORMAT_MULAW: - if (afd->dwFormatIndex >= NUM_ULAW_FORMATS) return ACMERR_NOTPOSSIBLE; + if (afd->dwFormatIndex >= ARRAY_SIZE(ULaw_Formats)) return ACMERR_NOTPOSSIBLE; afd->pwfx->nChannels = ULaw_Formats[afd->dwFormatIndex].nChannels; afd->pwfx->nSamplesPerSec = ULaw_Formats[afd->dwFormatIndex].rate; afd->pwfx->wBitsPerSample = ULaw_Formats[afd->dwFormatIndex].nBits; diff --git a/media/doc/README.WINE b/media/doc/README.WINE index fb1db00c8b..23e50e9b4e 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -108,7 +108,7 @@ reactos/dll/win32/mscms # Synced to WineStaging-4.0 reactos/dll/win32/mscoree # Synced to Wine-1.5.4 reactos/dll/win32/msctf # Synced to WineStaging-4.0 reactos/dll/win32/msftedit # Synced to WineStaging-3.3 -reactos/dll/win32/msg711.acm # Synced to WineStaging-3.3 +reactos/dll/win32/msg711.acm # Synced to WineStaging-4.0 reactos/dll/win32/msgsm32.acm # Synced to WineStaging-3.3 reactos/dll/win32/mshtml # Synced to WineStaging-1.7.55 reactos/dll/win32/mshtml.tlb # Synced to WineStaging-1.7.55
5 years, 12 months
1
0
0
0
← Newer
1
2
3
4
5
6
7
...
30
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
Results per page:
10
25
50
100
200