winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
October 2016
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
451 discussions
Start a n
N
ew thread
Hans Leidekker : webservices: Determine field size from write options and type size.
by Alexandre Julliard
12 Oct '16
12 Oct '16
Module: wine Branch: master Commit: ad57c7c72ad278dca2b3575bb6e4015f21d62abf URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ad57c7c72ad278dca2b3575bb…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Oct 12 15:30:23 2016 +0200 webservices: Determine field size from write options and type size. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/webservices/reader.c | 8 ++++++ dlls/webservices/writer.c | 68 ++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 72 insertions(+), 4 deletions(-) diff --git a/dlls/webservices/reader.c b/dlls/webservices/reader.c index c0710de..c364cff 100644 --- a/dlls/webservices/reader.c +++ b/dlls/webservices/reader.c @@ -3775,12 +3775,18 @@ ULONG get_type_size( WS_TYPE type, const WS_STRUCT_DESCRIPTION *desc ) case WS_GUID_TYPE: return sizeof(GUID); + case WS_STRING_TYPE: + return sizeof(WS_STRING); + case WS_WSZ_TYPE: return sizeof(WCHAR *); case WS_BYTES_TYPE: return sizeof(WS_BYTES); + case WS_XML_STRING_TYPE: + return sizeof(WS_XML_STRING); + case WS_STRUCT_TYPE: return desc->size; @@ -3813,7 +3819,9 @@ static WS_READ_OPTION get_field_read_option( WS_TYPE type, ULONG options ) case WS_DOUBLE_TYPE: case WS_DATETIME_TYPE: case WS_GUID_TYPE: + case WS_STRING_TYPE: case WS_BYTES_TYPE: + case WS_XML_STRING_TYPE: case WS_STRUCT_TYPE: case WS_ENUM_TYPE: if (options & (WS_FIELD_OPTIONAL|WS_FIELD_NILLABLE)) return WS_READ_NILLABLE_VALUE; diff --git a/dlls/webservices/writer.c b/dlls/webservices/writer.c index b59e903..26ab726 100644 --- a/dlls/webservices/writer.c +++ b/dlls/webservices/writer.c @@ -2023,10 +2023,70 @@ static HRESULT write_type_struct_field( struct writer *writer, const WS_FIELD_DE return S_OK; } -static ULONG get_field_size( const WS_STRUCT_DESCRIPTION *desc, ULONG index ) +static WS_WRITE_OPTION get_field_write_option( WS_TYPE type, ULONG options ) { - if (index < desc->fieldCount - 1) return desc->fields[index + 1]->offset - desc->fields[index]->offset; - return desc->size - desc->fields[index]->offset; + if (options & WS_FIELD_POINTER) + { + if (options & (WS_FIELD_OPTIONAL|WS_FIELD_NILLABLE)) return WS_WRITE_NILLABLE_POINTER; + return WS_WRITE_REQUIRED_POINTER; + } + + switch (type) + { + case WS_BOOL_TYPE: + case WS_INT8_TYPE: + case WS_INT16_TYPE: + case WS_INT32_TYPE: + case WS_INT64_TYPE: + case WS_UINT8_TYPE: + case WS_UINT16_TYPE: + case WS_UINT32_TYPE: + case WS_UINT64_TYPE: + case WS_DOUBLE_TYPE: + case WS_DATETIME_TYPE: + case WS_GUID_TYPE: + case WS_STRING_TYPE: + case WS_BYTES_TYPE: + case WS_XML_STRING_TYPE: + case WS_STRUCT_TYPE: + case WS_ENUM_TYPE: + if (options & (WS_FIELD_OPTIONAL|WS_FIELD_NILLABLE)) return WS_WRITE_NILLABLE_VALUE; + return WS_WRITE_REQUIRED_VALUE; + + case WS_WSZ_TYPE: + case WS_DESCRIPTION_TYPE: + if (options & (WS_FIELD_OPTIONAL|WS_FIELD_NILLABLE)) return WS_WRITE_NILLABLE_POINTER; + return WS_WRITE_REQUIRED_POINTER; + + default: + FIXME( "unhandled type %u\n", type ); + return 0; + } +} + +static ULONG get_field_size( const WS_FIELD_DESCRIPTION *desc ) +{ + WS_WRITE_OPTION option; + ULONG size; + + switch ((option = get_field_write_option( desc->type, desc->options ))) + { + case WS_WRITE_REQUIRED_POINTER: + case WS_WRITE_NILLABLE_POINTER: + size = sizeof(const void *); + break; + + case WS_WRITE_REQUIRED_VALUE: + case WS_WRITE_NILLABLE_VALUE: + size = get_type_size( desc->type, desc->typeDescription ); + break; + + default: + WARN( "unhandled option %u\n", option ); + return 0; + } + + return size; } static HRESULT write_type_struct( struct writer *writer, WS_TYPE_MAPPING mapping, @@ -2045,7 +2105,7 @@ static HRESULT write_type_struct( struct writer *writer, WS_TYPE_MAPPING mapping for (i = 0; i < desc->fieldCount; i++) { field_ptr = (const char *)ptr + desc->fields[i]->offset; - field_size = get_field_size( desc, i ); + field_size = get_field_size( desc->fields[i] ); if ((hr = write_type_struct_field( writer, desc->fields[i], field_ptr, field_size )) != S_OK) return hr; }
1
0
0
0
Hans Leidekker : webservices: WS_FIELD_OPTIONAL takes precedence over WS_FIELD_NILLABLE.
by Alexandre Julliard
12 Oct '16
12 Oct '16
Module: wine Branch: master Commit: b26b2655618e2907219908f80c0aa912ccf58b0f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b26b2655618e2907219908f80…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Oct 12 15:30:22 2016 +0200 webservices: WS_FIELD_OPTIONAL takes precedence over WS_FIELD_NILLABLE. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/webservices/tests/writer.c | 20 +++++++++++++++----- dlls/webservices/writer.c | 7 ++----- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/dlls/webservices/tests/writer.c b/dlls/webservices/tests/writer.c index 465bc5a..912e944 100644 --- a/dlls/webservices/tests/writer.c +++ b/dlls/webservices/tests/writer.c @@ -2122,7 +2122,7 @@ static void test_double(void) WsFreeWriter( writer ); } -static void test_field_flags(void) +static void test_field_options(void) { static const char expected[] = "<t><bool a:nil=\"true\" xmlns:a=\"
http://www.w3.org/2001/XMLSchema-instance\
"/><int32>-1</int32>" @@ -2130,10 +2130,10 @@ static void test_field_flags(void) HRESULT hr; WS_XML_WRITER *writer; WS_STRUCT_DESCRIPTION s; - WS_FIELD_DESCRIPTION f, f2, f3, f4, *fields[4]; + WS_FIELD_DESCRIPTION f, f2, f3, f4, f5, *fields[5]; WS_XML_STRING localname = {1, (BYTE *)"t"}, ns = {0, NULL}, str_guid = {4, (BYTE *)"guid"}; WS_XML_STRING str_int32 = {5, (BYTE *)"int32"}, str_bool = {4, (BYTE *)"bool"}; - WS_XML_STRING str_xmlstr = {6, (BYTE *)"xmlstr"}; + WS_XML_STRING str_xmlstr = {6, (BYTE *)"xmlstr"}, str_str = {3, (BYTE *)"str"}; INT32 val = -1; struct test { @@ -2141,6 +2141,7 @@ static void test_field_flags(void) BOOL *bool_ptr; INT32 *int32_ptr; WS_XML_STRING xmlstr; + WCHAR *str; } test; hr = WsCreateWriter( NULL, 0, &writer, NULL ); @@ -2187,11 +2188,20 @@ static void test_field_flags(void) f4.options = WS_FIELD_NILLABLE; fields[3] = &f4; + memset( &f5, 0, sizeof(f5) ); + f5.mapping = WS_ELEMENT_FIELD_MAPPING; + f5.localName = &str_str; + f5.offset = FIELD_OFFSET(struct test, str); + f5.ns = &ns; + f5.type = WS_WSZ_TYPE; + f5.options = WS_FIELD_OPTIONAL|WS_FIELD_NILLABLE; + fields[4] = &f5; + memset( &s, 0, sizeof(s) ); s.size = sizeof(struct test); s.alignment = TYPE_ALIGNMENT(struct test); s.fields = fields; - s.fieldCount = 4; + s.fieldCount = 5; memset( &test, 0, sizeof(test) ); test.int32_ptr = &val; @@ -2679,7 +2689,7 @@ START_TEST(writer) test_WsCopyNode(); test_text_types(); test_double(); - test_field_flags(); + test_field_options(); test_WsWriteText(); test_WsWriteArray(); test_escapes(); diff --git a/dlls/webservices/writer.c b/dlls/webservices/writer.c index 36bf65b..b59e903 100644 --- a/dlls/webservices/writer.c +++ b/dlls/webservices/writer.c @@ -1952,16 +1952,13 @@ static HRESULT write_type_struct_field( struct writer *writer, const WS_FIELD_DE if (is_nil_value( value, size )) { + if (field_options & WS_FIELD_OPTIONAL) return S_OK; if (field_options & WS_FIELD_NILLABLE) { if (field_options & WS_FIELD_POINTER) option = WS_WRITE_NILLABLE_POINTER; else option = WS_WRITE_NILLABLE_VALUE; } - else - { - if (field_options & WS_FIELD_OPTIONAL) return S_OK; - return E_INVALIDARG; - } + else return E_INVALIDARG; } else {
1
0
0
0
Hans Leidekker : webservices: Handle nil elements in the reader.
by Alexandre Julliard
12 Oct '16
12 Oct '16
Module: wine Branch: master Commit: b2fe675791b0ad0aa462da85ad99fbecdc06be28 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b2fe675791b0ad0aa462da85a…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Oct 12 15:30:21 2016 +0200 webservices: Handle nil elements in the reader. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/webservices/reader.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/dlls/webservices/reader.c b/dlls/webservices/reader.c index a6f5d6b..c0710de 100644 --- a/dlls/webservices/reader.c +++ b/dlls/webservices/reader.c @@ -4052,6 +4052,24 @@ static HRESULT read_type_struct( struct reader *reader, WS_TYPE_MAPPING mapping, } } +static HRESULT is_nil_element( const WS_XML_ELEMENT_NODE *elem ) +{ + static const WS_XML_STRING localname = {3, (BYTE *)"nil"}; + static const WS_XML_STRING ns = {41, (BYTE *)"
http://www.w3.org/2001/XMLSchema-instance
"}; + ULONG i; + + for (i = 0; i < elem->attributeCount; i++) + { + const WS_XML_UTF8_TEXT *text = (WS_XML_UTF8_TEXT *)elem->attributes[i]->value; + + if (elem->attributes[i]->isXmlNs) continue; + if (WsXmlStringEquals( elem->attributes[i]->localName, &localname, NULL ) == S_OK && + WsXmlStringEquals( elem->attributes[i]->ns, &ns, NULL ) == S_OK && + text->value.length == 4 && !memcmp( text->value.bytes, "true", 4 )) return TRUE; + } + return FALSE; +} + static HRESULT read_type( struct reader *reader, WS_TYPE_MAPPING mapping, WS_TYPE type, const WS_XML_STRING *localname, const WS_XML_STRING *ns, const void *desc, WS_READ_OPTION option, WS_HEAP *heap, @@ -4064,6 +4082,8 @@ static HRESULT read_type( struct reader *reader, WS_TYPE_MAPPING mapping, WS_TYP case WS_ELEMENT_TYPE_MAPPING: case WS_ELEMENT_CONTENT_TYPE_MAPPING: if ((hr = read_type_next_element_node( reader, localname, ns )) != S_OK) return hr; + if ((option == WS_READ_NILLABLE_POINTER || option == WS_READ_NILLABLE_VALUE) && + is_nil_element( &reader->current->hdr )) return read_type_next_node( reader ); break; case WS_ANY_ELEMENT_TYPE_MAPPING:
1
0
0
0
Hans Leidekker : webservices/tests: Add more text type tests.
by Alexandre Julliard
12 Oct '16
12 Oct '16
Module: wine Branch: master Commit: 9599479ed338616f3e7c16df5e5ddaacdc8f92fb URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9599479ed338616f3e7c16df5…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Oct 12 15:30:20 2016 +0200 webservices/tests: Add more text type tests. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/webservices/tests/writer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/webservices/tests/writer.c b/dlls/webservices/tests/writer.c index 7e65da3..465bc5a 100644 --- a/dlls/webservices/tests/writer.c +++ b/dlls/webservices/tests/writer.c @@ -1980,6 +1980,9 @@ static void test_text_types(void) static const WS_XML_INT32_TEXT val_int32 = { {WS_XML_TEXT_TYPE_INT32}, -2147483647 - 1 }; static const WS_XML_INT64_TEXT val_int64 = { {WS_XML_TEXT_TYPE_INT64}, -9223372036854775807 - 1 }; static const WS_XML_UINT64_TEXT val_uint64 = { {WS_XML_TEXT_TYPE_UINT64}, ~0 }; + static const WS_XML_DATETIME_TEXT val_datetime = { {WS_XML_TEXT_TYPE_DATETIME}, {0, WS_DATETIME_FORMAT_UTC} }; + static const WS_XML_DOUBLE_TEXT val_double = { {WS_XML_TEXT_TYPE_DOUBLE}, 1.1 }; + static const WS_XML_BASE64_TEXT val_base64 = { {WS_XML_TEXT_TYPE_BASE64}, (BYTE *)"test", 4 }; static const struct { const WS_XML_TEXT *text; @@ -1995,6 +1998,9 @@ static void test_text_types(void) { &val_int32.text, "<t>-2147483648</t>" }, { &val_int64.text, "<t>-9223372036854775808</t>" }, { &val_uint64.text, "<t>18446744073709551615</t>" }, + { &val_datetime.text, "<t>0001-01-01T00:00:00Z</t>" }, + { &val_double.text, "<t>1.1</t>" }, + { &val_base64.text, "<t>dGVzdA==</t>" }, }; HRESULT hr; ULONG i;
1
0
0
0
Hans Leidekker : webservices: Strip trailing zeros from time fraction.
by Alexandre Julliard
12 Oct '16
12 Oct '16
Module: wine Branch: master Commit: 6cd80610c871ce1fbcd0e9b0fede9fac66dd1669 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6cd80610c871ce1fbcd0e9b0f…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Oct 12 15:30:19 2016 +0200 webservices: Strip trailing zeros from time fraction. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/webservices/tests/writer.c | 5 ++++- dlls/webservices/writer.c | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/webservices/tests/writer.c b/dlls/webservices/tests/writer.c index 3bed673..7e65da3 100644 --- a/dlls/webservices/tests/writer.c +++ b/dlls/webservices/tests/writer.c @@ -2588,6 +2588,8 @@ static void test_datetime(void) { 1, WS_DATETIME_FORMAT_UTC, S_OK, "<t>0001-01-01T00:00:00.0000001Z</t>" }, { 1, WS_DATETIME_FORMAT_LOCAL, S_OK, "<t>0001-01-01T00:00:00.0000001+00:00</t>" }, { 1, WS_DATETIME_FORMAT_NONE, S_OK, "<t>0001-01-01T00:00:00.0000001</t>" }, + { 10, WS_DATETIME_FORMAT_NONE, S_OK, "<t>0001-01-01T00:00:00.000001</t>" }, + { 1000000, WS_DATETIME_FORMAT_NONE, S_OK, "<t>0001-01-01T00:00:00.1</t>" }, { 0x23c34600, WS_DATETIME_FORMAT_LOCAL, S_OK, "<t>0001-01-01T00:01:00+00:00</t>" }, { 0x861c46800, WS_DATETIME_FORMAT_LOCAL, S_OK, "<t>0001-01-01T01:00:00+00:00</t>" }, { 0x430e234000, WS_DATETIME_FORMAT_LOCAL, S_OK, "<t>0001-01-01T08:00:00+00:00</t>" }, @@ -2636,7 +2638,8 @@ static void test_datetime(void) ok( hr == tests[i].hr, "%u: got %08x\n", i, hr ); if (hr == S_OK) { - ok( check_result( writer, tests[i].result ) || broken(check_result( writer, tests[i].result2 )), + ok( check_result( writer, tests[i].result ) || + (tests[i].result2 && broken(check_result( writer, tests[i].result2 ))), "%u: wrong result\n", i ); } } diff --git a/dlls/webservices/writer.c b/dlls/webservices/writer.c index 619ec2b..36bf65b 100644 --- a/dlls/webservices/writer.c +++ b/dlls/webservices/writer.c @@ -1235,6 +1235,7 @@ static ULONG format_datetime( const WS_DATETIME *ptr, unsigned char *buf ) { static const char fmt_frac[] = ".%07u"; len += sprintf( (char *)buf + len, fmt_frac, sec_frac ); + while (buf[len - 1] == '0') len--; } if (ptr->format == WS_DATETIME_FORMAT_UTC) {
1
0
0
0
Huw Davies : riched20: Draw the paragraph numbering text in the correct colour.
by Alexandre Julliard
12 Oct '16
12 Oct '16
Module: wine Branch: master Commit: 9d248938ed0f88f408f86250769c0119d6d45632 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9d248938ed0f88f408f862507…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Oct 12 12:58:53 2016 +0100 riched20: Draw the paragraph numbering text in the correct colour. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/riched20/paint.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c index 7c17513..b76f533 100644 --- a/dlls/riched20/paint.c +++ b/dlls/riched20/paint.c @@ -903,16 +903,19 @@ static void draw_para_number( ME_Context *c, ME_DisplayItem *p ) ME_Paragraph *para = &p->member.para; HFONT old_font; int x, y; + COLORREF old_text; if (para->fmt.wNumbering) { old_font = ME_SelectStyleFont( c, para->para_num.style ); + old_text = SetTextColor( c->hDC, get_text_color( c, para->para_num.style, FALSE ) ); x = c->pt.x + para->para_num.pt.x; y = c->pt.y + para->pt.y + para->para_num.pt.y; ExtTextOutW( c->hDC, x, y, 0, NULL, para->para_num.text->szData, para->para_num.text->nLen, NULL ); + SetTextColor( c->hDC, old_text ); ME_UnselectStyleFont( c, para->para_num.style, old_font ); } }
1
0
0
0
Huw Davies : riched20: Emit RTF for paragraph numbering.
by Alexandre Julliard
12 Oct '16
12 Oct '16
Module: wine Branch: master Commit: c69e60efbcb8746dafa668d26728941a35f017dc URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c69e60efbcb8746dafa668d26…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Oct 12 12:58:52 2016 +0100 riched20: Emit RTF for paragraph numbering. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/riched20/writer.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/dlls/riched20/writer.c b/dlls/riched20/writer.c index e7d340a..77f50e3 100644 --- a/dlls/riched20/writer.c +++ b/dlls/riched20/writer.c @@ -456,6 +456,76 @@ ME_StreamOutRTFTableProps(ME_TextEditor *editor, ME_OutStream *pStream, return TRUE; } +static BOOL stream_out_para_num( ME_OutStream *stream, ME_Paragraph *para, BOOL pn_dest ) +{ + static const char fmt_label[] = "{\\*\\pn\\pnlvlbody\\pnf%u\\pnindent%d\\pnstart%d%s%s}"; + static const char fmt_bullet[] = "{\\*\\pn\\pnlvlblt\\pnf%u\\pnindent%d{\\pntxtb\\'b7}}"; + static const char dec[] = "\\pndec"; + static const char lcltr[] = "\\pnlcltr"; + static const char ucltr[] = "\\pnucltr"; + static const char lcrm[] = "\\pnlcrm"; + static const char ucrm[] = "\\pnucrm"; + static const char period[] = "{\\pntxta.}"; + static const char paren[] = "{\\pntxta)}"; + static const char parens[] = "{\\pntxtb(}{\\pntxta)}"; + const char *type, *style = ""; + unsigned int idx; + + find_font_in_fonttbl( stream, ¶->para_num.style->fmt, &idx ); + + if (!ME_StreamOutPrint( stream, "{\\pntext\\f%u ", idx )) return FALSE; + if (!ME_StreamOutRTFText( stream, para->para_num.text->szData, para->para_num.text->nLen )) + return FALSE; + if (!ME_StreamOutPrint( stream, "\\tab}" )) return FALSE; + + if (!pn_dest) return TRUE; + + if (para->fmt.wNumbering == PFN_BULLET) + { + if (!ME_StreamOutPrint( stream, fmt_bullet, idx, para->fmt.wNumberingTab )) + return FALSE; + } + else + { + switch (para->fmt.wNumbering) + { + case PFN_ARABIC: + default: + type = dec; + break; + case PFN_LCLETTER: + type = lcltr; + break; + case PFN_UCLETTER: + type = ucltr; + break; + case PFN_LCROMAN: + type = lcrm; + break; + case PFN_UCROMAN: + type = ucrm; + break; + } + switch (para->fmt.wNumberingStyle & 0xf00) + { + case PFNS_PERIOD: + style = period; + break; + case PFNS_PAREN: + style = paren; + break; + case PFNS_PARENS: + style = parens; + break; + } + + if (!ME_StreamOutPrint( stream, fmt_label, idx, para->fmt.wNumberingTab, + para->fmt.wNumberingStart, type, style )) + return FALSE; + } + return TRUE; +} + static BOOL ME_StreamOutRTFParaProps(ME_TextEditor *editor, ME_OutStream *pStream, ME_DisplayItem *para) @@ -501,11 +571,18 @@ ME_StreamOutRTFParaProps(ME_TextEditor *editor, ME_OutStream *pStream, } if (prev_para && !memcmp( fmt, &prev_para->fmt, sizeof(*fmt) )) + { + if (fmt->wNumbering) + return stream_out_para_num( pStream, ¶->member.para, FALSE ); return TRUE; + } if (!ME_StreamOutPrint(pStream, "\\pard")) return FALSE; + if (fmt->wNumbering) + if (!stream_out_para_num( pStream, ¶->member.para, TRUE )) return FALSE; + if (!editor->bEmulateVersion10) { /* v4.1 */ if (pStream->nNestingLevel > 0) strcat(props, "\\intbl"); @@ -515,7 +592,7 @@ ME_StreamOutRTFParaProps(ME_TextEditor *editor, ME_OutStream *pStream, if (fmt->dwMask & PFM_TABLE && fmt->wEffects & PFE_TABLE) strcat(props, "\\intbl"); } - + /* TODO: PFM_BORDER. M$ does not emit any keywords for these properties, and * when streaming border keywords in, PFM_BORDER is set, but wBorder field is * set very different from the documentation.
1
0
0
0
Huw Davies : riched20: Add a helper to find a colour in the colour table.
by Alexandre Julliard
12 Oct '16
12 Oct '16
Module: wine Branch: master Commit: 3e9a31ed26c1dd82b5f2a25873ff94f023b1baea URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3e9a31ed26c1dd82b5f2a2587…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Oct 12 12:58:51 2016 +0100 riched20: Add a helper to find a colour in the colour table. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/riched20/writer.c | 62 ++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/dlls/riched20/writer.c b/dlls/riched20/writer.c index 838168e..e7d340a 100644 --- a/dlls/riched20/writer.c +++ b/dlls/riched20/writer.c @@ -277,6 +277,23 @@ static void add_color_to_colortbl( ME_OutStream *stream, COLORREF color ) } } +static BOOL find_color_in_colortbl( ME_OutStream *stream, COLORREF color, unsigned int *idx ) +{ + int i; + + *idx = 0; + for (i = 1; i < stream->nColorTblLen; i++) + { + if (stream->colortbl[i] == color) + { + *idx = i; + break; + } + } + + return i < stream->nFontTblLen; +} + static BOOL ME_StreamOutRTFFontAndColorTbl(ME_OutStream *pStream, ME_DisplayItem *pFirstRun, ME_DisplayItem *pLastRun) @@ -391,17 +408,13 @@ ME_StreamOutRTFTableProps(ME_TextEditor *editor, ME_OutStream *pStream, { if (borders[i]->width) { - unsigned int j; + unsigned int idx; COLORREF crColor = borders[i]->colorRef; sprintf(props + strlen(props), "\\clbrdr%c", sideChar[i]); sprintf(props + strlen(props), "\\brdrs"); sprintf(props + strlen(props), "\\brdrw%d", borders[i]->width); - for (j = 1; j < pStream->nColorTblLen; j++) { - if (pStream->colortbl[j] == crColor) { - sprintf(props + strlen(props), "\\brdrcf%u", j); - break; - } - } + if (find_color_in_colortbl( pStream, crColor, &idx )) + sprintf(props + strlen(props), "\\brdrcf%u", idx); } } sprintf(props + strlen(props), "\\cellx%d", cell->member.cell.nRightBoundary); @@ -423,17 +436,13 @@ ME_StreamOutRTFTableProps(ME_TextEditor *editor, ME_OutStream *pStream, { if (borders[i]->width) { - unsigned int j; + unsigned int idx; COLORREF crColor = borders[i]->colorRef; sprintf(props + strlen(props), "\\trbrdr%c", sideChar[i]); sprintf(props + strlen(props), "\\brdrs"); sprintf(props + strlen(props), "\\brdrw%d", borders[i]->width); - for (j = 1; j < pStream->nColorTblLen; j++) { - if (pStream->colortbl[j] == crColor) { - sprintf(props + strlen(props), "\\brdrcf%u", j); - break; - } - } + if (find_color_in_colortbl( pStream, crColor, &idx )) + sprintf(props + strlen(props), "\\brdrcf%u", idx); } } for (i = 0; i < pFmt->cTabCount; i++) @@ -642,26 +651,15 @@ ME_StreamOutRTFCharProps(ME_OutStream *pStream, CHARFORMAT2W *fmt) strcat(props, "\\caps"); if (fmt->dwMask & CFM_ANIMATION) sprintf(props + strlen(props), "\\animtext%u", fmt->bAnimation); - if (fmt->dwMask & CFM_BACKCOLOR) { - if (!(fmt->dwEffects & CFE_AUTOBACKCOLOR)) { - for (i = 1; i < pStream->nColorTblLen; i++) - if (pStream->colortbl[i] == fmt->crBackColor) { - sprintf(props + strlen(props), "\\cb%u", i); - break; - } - } - } + if ((fmt->dwMask & CFM_BACKCOLOR) && !(fmt->dwEffects & CFE_AUTOBACKCOLOR)) + if (find_color_in_colortbl( pStream, fmt->crBackColor, &i )) + sprintf(props + strlen(props), "\\cb%u", i); if (fmt->dwMask & CFM_BOLD && fmt->dwEffects & CFE_BOLD) strcat(props, "\\b"); - if (fmt->dwMask & CFM_COLOR) { - if (!(fmt->dwEffects & CFE_AUTOCOLOR)) { - for (i = 1; i < pStream->nColorTblLen; i++) - if (pStream->colortbl[i] == fmt->crTextColor) { - sprintf(props + strlen(props), "\\cf%u", i); - break; - } - } - } + if ((fmt->dwMask & CFM_COLOR) && !(fmt->dwEffects & CFE_AUTOCOLOR)) + if (find_color_in_colortbl( pStream, fmt->crTextColor, &i )) + sprintf(props + strlen(props), "\\cf%u", i); + /* TODO: CFM_DISABLED */ if (fmt->dwMask & CFM_EMBOSS && fmt->dwEffects & CFE_EMBOSS) strcat(props, "\\embo");
1
0
0
0
Huw Davies : riched20: Add a helper to find a font in the font table.
by Alexandre Julliard
12 Oct '16
12 Oct '16
Module: wine Branch: master Commit: 48c0c6648bc1657da3ac2b565b1efa313275bb60 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=48c0c6648bc1657da3ac2b565…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Oct 12 12:58:50 2016 +0100 riched20: Add a helper to find a font in the font table. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/riched20/writer.c | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/dlls/riched20/writer.c b/dlls/riched20/writer.c index c3359c1..838168e 100644 --- a/dlls/riched20/writer.c +++ b/dlls/riched20/writer.c @@ -237,6 +237,31 @@ static void add_font_to_fonttbl( ME_OutStream *stream, ME_Style *style ) } } +static BOOL find_font_in_fonttbl( ME_OutStream *stream, CHARFORMAT2W *fmt, unsigned int *idx ) +{ + WCHAR *facename; + int i; + + *idx = 0; + if (fmt->dwMask & CFM_FACE) + facename = fmt->szFaceName; + else + facename = stream->fonttbl[0].szFaceName; + for (i = 0; i < stream->nFontTblLen; i++) + { + if (facename == stream->fonttbl[i].szFaceName + || !lstrcmpW(facename, stream->fonttbl[i].szFaceName)) + if (!(fmt->dwMask & CFM_CHARSET) + || fmt->bCharSet == stream->fonttbl[i].bCharSet) + { + *idx = i; + break; + } + } + + return i < stream->nFontTblLen; +} + static void add_color_to_colortbl( ME_OutStream *stream, COLORREF color ) { int i; @@ -713,21 +738,9 @@ ME_StreamOutRTFCharProps(ME_OutStream *pStream, CHARFORMAT2W *fmt) } /* FIXME: How to emit CFM_WEIGHT? */ - if (fmt->dwMask & CFM_FACE || fmt->dwMask & CFM_CHARSET) { - WCHAR *szFaceName; - - if (fmt->dwMask & CFM_FACE) - szFaceName = fmt->szFaceName; - else - szFaceName = pStream->fonttbl[0].szFaceName; - for (i = 0; i < pStream->nFontTblLen; i++) { - if (szFaceName == pStream->fonttbl[i].szFaceName - || !lstrcmpW(szFaceName, pStream->fonttbl[i].szFaceName)) - if (!(fmt->dwMask & CFM_CHARSET) - || fmt->bCharSet == pStream->fonttbl[i].bCharSet) - break; - } - if (i < pStream->nFontTblLen) + if (fmt->dwMask & CFM_FACE || fmt->dwMask & CFM_CHARSET) + { + if (find_font_in_fonttbl( pStream, fmt, &i )) { if (i != pStream->nDefaultFont) sprintf(props + strlen(props), "\\f%u", i);
1
0
0
0
Huw Davies : riched20: Add any paragraph numbering fonts to the font table.
by Alexandre Julliard
12 Oct '16
12 Oct '16
Module: wine Branch: master Commit: 074fafab6577963cd74ed97f2c846d4d6a0c88ee URL:
http://source.winehq.org/git/wine.git/?a=commit;h=074fafab6577963cd74ed97f2…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Oct 12 12:58:49 2016 +0100 riched20: Add any paragraph numbering fonts to the font table. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/riched20/writer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/riched20/writer.c b/dlls/riched20/writer.c index fe8c797..c3359c1 100644 --- a/dlls/riched20/writer.c +++ b/dlls/riched20/writer.c @@ -274,6 +274,10 @@ ME_StreamOutRTFFontAndColorTbl(ME_OutStream *pStream, ME_DisplayItem *pFirstRun, if (item->member.run.para != prev_para) { + /* check for any para numbering text */ + if (item->member.run.para->fmt.wNumbering) + add_font_to_fonttbl( pStream, item->member.run.para->para_num.style ); + if ((pCell = item->member.para.pCell)) { ME_Border* borders[4] = { &pCell->member.cell.border.top,
1
0
0
0
← Newer
1
...
20
21
22
23
24
25
26
...
46
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Results per page:
10
25
50
100
200