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
December 2020
----- 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
1 participants
414 discussions
Start a n
N
ew thread
Gabriel Ivăncescu : include/icmpapi: Add missing function declarations.
by Alexandre Julliard
03 Dec '20
03 Dec '20
Module: wine Branch: master Commit: f5b0663c6f035dc7e2be5055c1bdbb703db81047 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f5b0663c6f035dc7e2be5055…
Author: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Date: Mon Nov 23 15:47:38 2020 +0200 include/icmpapi: Add missing function declarations. Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/icmpapi.h | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/include/icmpapi.h b/include/icmpapi.h index 102851a5c87..e27d0556c4f 100644 --- a/include/icmpapi.h +++ b/include/icmpapi.h @@ -30,10 +30,24 @@ HANDLE WINAPI IcmpCreateFile( VOID ); +HANDLE WINAPI Icmp6CreateFile( + VOID + ); + BOOL WINAPI IcmpCloseHandle( HANDLE IcmpHandle ); +DWORD WINAPI IcmpParseReplies( + LPVOID ReplyBuffer, + DWORD ReplySize + ); + +DWORD WINAPI Icmp6ParseReplies( + LPVOID ReplyBuffer, + DWORD ReplySize + ); + DWORD WINAPI IcmpSendEcho( HANDLE IcmpHandle, IPAddr DestinationAddress, @@ -45,6 +59,62 @@ DWORD WINAPI IcmpSendEcho( DWORD Timeout ); +DWORD WINAPI IcmpSendEcho2( + HANDLE IcmpHandle, + HANDLE Event, +#ifdef __WINE_WINTERNL_H + PIO_APC_ROUTINE ApcRoutine, +#else + FARPROC ApcRoutine, +#endif + PVOID ApcContext, + IPAddr DestinationAddress, + LPVOID RequestData, + WORD RequestSize, + PIP_OPTION_INFORMATION RequestOptions, + LPVOID ReplyBuffer, + DWORD ReplySize, + DWORD Timeout + ); + +DWORD WINAPI IcmpSendEcho2Ex( + HANDLE IcmpHandle, + HANDLE Event, +#ifdef __WINE_WINTERNL_H + PIO_APC_ROUTINE ApcRoutine, +#else + FARPROC ApcRoutine, +#endif + PVOID ApcContext, + IPAddr SourceAddress, + IPAddr DestinationAddress, + LPVOID RequestData, + WORD RequestSize, + PIP_OPTION_INFORMATION RequestOptions, + LPVOID ReplyBuffer, + DWORD ReplySize, + DWORD Timeout + ); + +DWORD WINAPI Icmp6SendEcho2( + HANDLE IcmpHandle, + HANDLE Event, +#ifdef __WINE_WINTERNL_H + PIO_APC_ROUTINE ApcRoutine, +#else + FARPROC ApcRoutine, +#endif + PVOID ApcContext, + struct sockaddr_in6* SourceAddress, + struct sockaddr_in6* DestinationAddress, + LPVOID RequestData, + WORD RequestSize, + PIP_OPTION_INFORMATION RequestOptions, + LPVOID ReplyBuffer, + DWORD ReplySize, + DWORD Timeout + ); + #ifdef __cplusplus }
1
0
0
0
Alexandre Julliard : wpp: Merge preproc.c into wpp.c.
by Alexandre Julliard
03 Dec '20
03 Dec '20
Module: wine Branch: master Commit: 9442c45c805479f02792691ebd51bc36b05aa4c7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9442c45c805479f02792691e…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Dec 3 15:01:54 2020 +0100 wpp: Merge preproc.c into wpp.c. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- libs/wpp/Makefile.in | 4 +- libs/wpp/preproc.c | 579 --------------------------------------------------- libs/wpp/wpp.c | 556 ++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 556 insertions(+), 583 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=9442c45c805479f02792…
1
0
0
0
Alexandre Julliard : wpp: Remove some dead code.
by Alexandre Julliard
03 Dec '20
03 Dec '20
Module: wine Branch: master Commit: 107103e2bd97bba41ddc5cb0f29da952db4ce11d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=107103e2bd97bba41ddc5cb0…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Dec 3 14:17:14 2020 +0100 wpp: Remove some dead code. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/wine/wpp.h | 1 - libs/wpp/ppl.l | 20 +++------------ libs/wpp/ppy.y | 35 ++++++++----------------- libs/wpp/preproc.c | 70 ++++++++------------------------------------------ libs/wpp/wpp.c | 27 +++---------------- libs/wpp/wpp_private.h | 46 ++++++--------------------------- tools/widl/widl.c | 13 +++------- 7 files changed, 39 insertions(+), 173 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=107103e2bd97bba41ddc…
1
0
0
0
Alexandre Julliard : wpp: Use standard Wine lists where possible.
by Alexandre Julliard
03 Dec '20
03 Dec '20
Module: wine Branch: master Commit: 506bdf4249025e6d786c976e88b06a66a442dfa5 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=506bdf4249025e6d786c976e…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Dec 3 13:27:15 2020 +0100 wpp: Use standard Wine lists where possible. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- libs/wpp/ppl.l | 10 +++---- libs/wpp/preproc.c | 72 ++++++++++++++++---------------------------------- libs/wpp/wpp.c | 15 +++++------ libs/wpp/wpp_private.h | 9 +++---- 4 files changed, 37 insertions(+), 69 deletions(-) diff --git a/libs/wpp/ppl.l b/libs/wpp/ppl.l index a1d54029c7c..4fc23384dff 100644 --- a/libs/wpp/ppl.l +++ b/libs/wpp/ppl.l @@ -302,7 +302,7 @@ include_state_t pp_incl_state = 0 /* seen_junk */ }; -includelogicentry_t *pp_includelogiclist = NULL; +struct list pp_includelogiclist = LIST_INIT( pp_includelogiclist ); #define YY_INPUT(buf,result,max_size) \ { \ @@ -1350,11 +1350,7 @@ static bufferstackentry_t *pop_buffer(void) iep->ppp = ppp; ppp->iep = iep; iep->filename = bufferstack[bufferstackidx].include_filename; - iep->prev = NULL; - iep->next = pp_includelogiclist; - if(iep->next) - iep->next->prev = iep; - pp_includelogiclist = iep; + list_add_head( &pp_includelogiclist, &iep->entry ); if(pp_status.debug) fprintf(stderr, "pop_buffer: %s:%d: includelogic added, include_ppp='%s', file='%s'\n", bufferstack[bufferstackidx].filename, bufferstack[bufferstackidx].line_number, pp_incl_state.ppp, iep->filename); @@ -1557,7 +1553,7 @@ void pp_do_include(char *fname, int type) if(!fname) return; - for(iep = pp_includelogiclist; iep; iep = iep->next) + LIST_FOR_EACH_ENTRY( iep, &pp_includelogiclist, includelogicentry_t, entry ) { if(!strcmp(iep->filename, fname)) { diff --git a/libs/wpp/preproc.c b/libs/wpp/preproc.c index 8b9b8b05375..2106b811e83 100644 --- a/libs/wpp/preproc.c +++ b/libs/wpp/preproc.c @@ -39,10 +39,11 @@ struct pp_status pp_status; typedef struct pp_def_state { - struct pp_def_state *next; - pp_entry_t *defines[HASHKEY]; + struct list entry; + struct list defines[HASHKEY]; } pp_def_state_t; +static struct list pp_states = LIST_INIT( pp_states ); static pp_def_state_t *pp_def_state; #define MAXIFSTACK 64 @@ -56,14 +57,11 @@ void pp_print_status(void) int i; int sum; int total = 0; - pp_entry_t *ppp; fprintf(stderr, "Defines statistics:\n"); for(i = 0; i < HASHKEY; i++) { - sum = 0; - for(ppp = pp_def_state->defines[i]; ppp; ppp = ppp->next) - sum++; + sum = list_count( &pp_def_state->defines[i] ); total += sum; if (sum) fprintf(stderr, "%4d, %3d\n", i, sum); } @@ -188,7 +186,7 @@ pp_entry_t *pplookup(const char *ident) if(!ident) return NULL; idx = pphash(ident); - for(ppp = pp_def_state->defines[idx]; ppp; ppp = ppp->next) + LIST_FOR_EACH_ENTRY( ppp, &pp_def_state->defines[idx], pp_entry_t, entry ) { if(!strcmp(ident, ppp->ident)) return ppp; @@ -200,35 +198,11 @@ static void free_pp_entry( pp_entry_t *ppp, int idx ) { if(ppp->iep) { - if(ppp->iep == pp_includelogiclist) - { - pp_includelogiclist = ppp->iep->next; - if(pp_includelogiclist) - pp_includelogiclist->prev = NULL; - } - else - { - ppp->iep->prev->next = ppp->iep->next; - if(ppp->iep->next) - ppp->iep->next->prev = ppp->iep->prev; - } + list_remove( &ppp->iep->entry ); free(ppp->iep->filename); free(ppp->iep); } - - if(pp_def_state->defines[idx] == ppp) - { - pp_def_state->defines[idx] = ppp->next; - if(pp_def_state->defines[idx]) - pp_def_state->defines[idx]->prev = NULL; - } - else - { - ppp->prev->next = ppp->next; - if(ppp->next) - ppp->next->prev = ppp->prev; - } - + list_remove( &ppp->entry ); free(ppp); } @@ -236,9 +210,10 @@ static void free_pp_entry( pp_entry_t *ppp, int idx ) void pp_push_define_state(void) { pp_def_state_t *state = pp_xmalloc( sizeof(*state) ); + int i; - memset( state->defines, 0, sizeof(state->defines) ); - state->next = pp_def_state; + for (i = 0; i < HASHKEY; i++) list_init( &state->defines[i] ); + list_add_head( &pp_states, &state->entry ); pp_def_state = state; } @@ -246,16 +221,22 @@ void pp_push_define_state(void) void pp_pop_define_state(void) { int i; - pp_entry_t *ppp; - pp_def_state_t *state; + pp_entry_t *ppp, *ppp2; + pp_def_state_t *state = pp_def_state; for (i = 0; i < HASHKEY; i++) { - while ((ppp = pp_def_state->defines[i]) != NULL) pp_del_define( ppp->ident ); + LIST_FOR_EACH_ENTRY_SAFE( ppp, ppp2, &state->defines[i], pp_entry_t, entry ) + { + free( ppp->ident ); + free( ppp->subst.text ); + free( ppp->filename ); + free_pp_entry( ppp, i ); + } } - state = pp_def_state; - pp_def_state = state->next; + list_remove( &state->entry ); free( state ); + pp_def_state = LIST_ENTRY( list_head( &pp_states ), pp_def_state_t, entry ); } void pp_del_define(const char *name) @@ -300,10 +281,7 @@ pp_entry_t *pp_add_define(const char *def, const char *text) ppp->subst.text = text ? pp_xstrdup(text) : NULL; ppp->filename = pp_xstrdup(pp_status.input ? pp_status.input : "<internal or cmdline>"); ppp->linenumber = pp_status.input ? pp_status.line_number : 0; - ppp->next = pp_def_state->defines[idx]; - pp_def_state->defines[idx] = ppp; - if(ppp->next) - ppp->next->prev = ppp; + list_add_head( &pp_def_state->defines[idx], &ppp->entry ); if(ppp->subst.text) { /* Strip trailing white space from subst text */ @@ -345,11 +323,7 @@ pp_entry_t *pp_add_macro(char *id, marg_t *args[], int nargs, mtext_t *exp) ppp->subst.mtext= exp; ppp->filename = pp_xstrdup(pp_status.input ? pp_status.input : "<internal or cmdline>"); ppp->linenumber = pp_status.input ? pp_status.line_number : 0; - ppp->next = pp_def_state->defines[idx]; - pp_def_state->defines[idx] = ppp; - if(ppp->next) - ppp->next->prev = ppp; - + list_add_head( &pp_def_state->defines[idx], &ppp->entry ); if(pp_status.debug) { fprintf(stderr, "Added macro (%s, %d) <%s(%d)> to <", pp_status.input, pp_status.line_number, ppp->ident, nargs); diff --git a/libs/wpp/wpp.c b/libs/wpp/wpp.c index c17289c8923..de7f7f761a2 100644 --- a/libs/wpp/wpp.c +++ b/libs/wpp/wpp.c @@ -32,18 +32,18 @@ int ppy_debug, pp_flex_debug; struct define { - struct define *next; + struct list entry; char *name; char *value; }; -static struct define *cmdline_defines; +static struct list cmdline_defines = LIST_INIT( cmdline_defines ); static void add_cmdline_defines(void) { struct define *def; - for (def = cmdline_defines; def; def = def->next) + LIST_FOR_EACH_ENTRY( def, &cmdline_defines, struct define, entry ) { if (def->value) pp_add_define( def->name, def->value ); } @@ -53,7 +53,7 @@ static void del_cmdline_defines(void) { struct define *def; - for (def = cmdline_defines; def; def = def->next) + LIST_FOR_EACH_ENTRY( def, &cmdline_defines, struct define, entry ) { if (def->value) pp_del_define( def->name ); } @@ -94,7 +94,7 @@ void wpp_add_define( const char *name, const char *value ) if (!value) value = ""; - for (def = cmdline_defines; def; def = def->next) + LIST_FOR_EACH_ENTRY( def, &cmdline_defines, struct define, entry ) { if (!strcmp( def->name, name )) { @@ -105,10 +105,9 @@ void wpp_add_define( const char *name, const char *value ) } def = pp_xmalloc( sizeof(*def) ); - def->next = cmdline_defines; def->name = pp_xstrdup(name); def->value = pp_xstrdup(value); - cmdline_defines = def; + list_add_head( &cmdline_defines, &def->entry ); } @@ -117,7 +116,7 @@ void wpp_del_define( const char *name ) { struct define *def; - for (def = cmdline_defines; def; def = def->next) + LIST_FOR_EACH_ENTRY( def, &cmdline_defines, struct define, entry ) { if (!strcmp( def->name, name )) { diff --git a/libs/wpp/wpp_private.h b/libs/wpp/wpp_private.h index 3f395e528bb..2598ad77223 100644 --- a/libs/wpp/wpp_private.h +++ b/libs/wpp/wpp_private.h @@ -22,6 +22,7 @@ #include <stdio.h> #include <string.h> +#include "wine/list.h" struct pp_entry; /* forward */ /* @@ -30,8 +31,7 @@ struct pp_entry; /* forward */ * are protected in the #ifndef/#endif way. */ typedef struct includelogicentry { - struct includelogicentry *next; - struct includelogicentry *prev; + struct list entry; struct pp_entry *ppp; /* The define which protects the file */ char *filename; /* The filename of the include */ } includelogicentry_t; @@ -81,8 +81,7 @@ typedef enum { } def_type_t; typedef struct pp_entry { - struct pp_entry *next; - struct pp_entry *prev; + struct list entry; def_type_t type; /* Define or macro */ char *ident; /* The key */ marg_t **margs; /* Macro arguments array or NULL if none */ @@ -217,7 +216,7 @@ struct pp_status extern struct pp_status pp_status; extern include_state_t pp_incl_state; -extern includelogicentry_t *pp_includelogiclist; +extern struct list pp_includelogiclist; /* * From ppl.l
1
0
0
0
Alexandre Julliard : wpp: Don't try to recover from memory allocation errors.
by Alexandre Julliard
03 Dec '20
03 Dec '20
Module: wine Branch: master Commit: de2f4ceeb82fa1f4376db97f94dd0c0169ba6fcd URL:
https://source.winehq.org/git/wine.git/?a=commit;h=de2f4ceeb82fa1f4376db97f…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Dec 3 13:23:45 2020 +0100 wpp: Don't try to recover from memory allocation errors. wpp is only used in short-lived tools. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/wine/wpp.h | 8 ++--- libs/wpp/ppl.l | 55 ++++++++++----------------------- libs/wpp/ppy.y | 55 ++++++++------------------------- libs/wpp/preproc.c | 83 ++++++-------------------------------------------- libs/wpp/wpp.c | 49 +++++------------------------ libs/wpp/wpp_private.h | 3 +- 6 files changed, 50 insertions(+), 203 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=de2f4ceeb82fa1f4376d…
1
0
0
0
Dmitry Timoshkov : crypt32: Add support for CRYPT_STRING_HEX to CryptBinaryToStringW.
by Alexandre Julliard
03 Dec '20
03 Dec '20
Module: wine Branch: master Commit: d3a4477bad90f37dab584af89e1baa07a989437e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d3a4477bad90f37dab584af8…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Thu Dec 3 09:57:21 2020 +0300 crypt32: Add support for CRYPT_STRING_HEX to CryptBinaryToStringW. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/crypt32/base64.c | 79 ++++++++++++++++++++++++++++++- dlls/crypt32/tests/base64.c | 113 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 189 insertions(+), 3 deletions(-) diff --git a/dlls/crypt32/base64.c b/dlls/crypt32/base64.c index 1fd4dc136ef..0e8bd2227eb 100644 --- a/dlls/crypt32/base64.c +++ b/dlls/crypt32/base64.c @@ -460,7 +460,7 @@ static BOOL BinaryToBase64W(const BYTE *pbBinary, return ret; } -static BOOL BinaryToHexW(const BYTE *bin, DWORD nbin, DWORD flags, LPWSTR str, DWORD *nstr) +static BOOL BinaryToHexRawW(const BYTE *bin, DWORD nbin, DWORD flags, LPWSTR str, DWORD *nstr) { static const WCHAR hex[] = L"0123456789abcdef"; DWORD needed; @@ -506,6 +506,79 @@ static BOOL BinaryToHexW(const BYTE *bin, DWORD nbin, DWORD flags, LPWSTR str, D return TRUE; } +static BOOL binary_to_hexW(const BYTE *bin, DWORD nbin, DWORD flags, LPWSTR str, DWORD *nstr) +{ + static const WCHAR hex[] = L"0123456789abcdef"; + DWORD needed, i; + + needed = nbin * 3; /* spaces + terminating \0 */ + + if (flags & CRYPT_STRING_NOCR) + { + needed += (nbin + 7) / 16; /* space every 16 characters */ + needed += 1; /* terminating \n */ + } + else if (!(flags & CRYPT_STRING_NOCRLF)) + { + needed += (nbin + 7) / 16; /* space every 16 characters */ + needed += nbin / 16 + 1; /* LF every 16 characters + terminating \r */ + + if (nbin % 16) + needed += 1; /* terminating \n */ + } + + if (!str) + { + *nstr = needed; + return TRUE; + } + + if (needed > *nstr) + { + SetLastError(ERROR_MORE_DATA); + return FALSE; + } + + for (i = 0; i < nbin; i++) + { + *str++ = hex[(bin[i] >> 4) & 0xf]; + *str++ = hex[bin[i] & 0xf]; + + if (i >= nbin - 1) break; + + if (i && !(flags & CRYPT_STRING_NOCRLF)) + { + if (!((i + 1) % 16)) + { + if (flags & CRYPT_STRING_NOCR) + *str++ = '\n'; + else + { + *str++ = '\r'; + *str++ = '\n'; + } + continue; + } + else if (!((i + 1) % 8)) + *str++ = ' '; + } + + *str++ = ' '; + } + + if (flags & CRYPT_STRING_NOCR) + *str++ = '\n'; + else if (!(flags & CRYPT_STRING_NOCRLF)) + { + *str++ = '\r'; + *str++ = '\n'; + } + + *str = 0; + *nstr = needed - 1; + return TRUE; +} + BOOL WINAPI CryptBinaryToStringW(const BYTE *pbBinary, DWORD cbBinary, DWORD dwFlags, LPWSTR pszString, DWORD *pcchString) { @@ -537,9 +610,11 @@ BOOL WINAPI CryptBinaryToStringW(const BYTE *pbBinary, encoder = BinaryToBase64W; break; case CRYPT_STRING_HEXRAW: - encoder = BinaryToHexW; + encoder = BinaryToHexRawW; break; case CRYPT_STRING_HEX: + encoder = binary_to_hexW; + break; case CRYPT_STRING_HEXASCII: case CRYPT_STRING_HEXADDR: case CRYPT_STRING_HEXASCIIADDR: diff --git a/dlls/crypt32/tests/base64.c b/dlls/crypt32/tests/base64.c index a48f0a5c440..64148342b2b 100644 --- a/dlls/crypt32/tests/base64.c +++ b/dlls/crypt32/tests/base64.c @@ -236,12 +236,36 @@ static void encode_compare_base64_W(const BYTE *toEncode, DWORD toEncodeLen, DWO heap_free(trailerW); } +static DWORD binary_to_hex_len(DWORD binary_len, DWORD flags) +{ + DWORD strLen2; + + strLen2 = binary_len * 3; /* spaces + terminating \0 */ + + if (flags & CRYPT_STRING_NOCR) + { + strLen2 += (binary_len + 7) / 16; /* space every 16 characters */ + strLen2 += 1; /* terminating \n */ + } + else if (!(flags & CRYPT_STRING_NOCRLF)) + { + strLen2 += (binary_len + 7) / 16; /* space every 16 characters */ + strLen2 += binary_len / 16 + 1; /* LF every 16 characters + terminating \r */ + + if (binary_len % 16) + strLen2 += 1; /* terminating \n */ + } + + return strLen2; +} + static void test_CryptBinaryToString(void) { static const DWORD flags[] = { 0, CRYPT_STRING_NOCR, CRYPT_STRING_NOCRLF }; + static const DWORD sizes[] = { 3, 4, 7, 8, 12, 15, 16, 17, 256 }; static const WCHAR hexdig[] = L"0123456789abcdef"; BYTE input[256 * sizeof(WCHAR)]; - DWORD strLen, strLen2, i, j; + DWORD strLen, strLen2, i, j, k; WCHAR *hex, *cmp, *ptr; BOOL ret; @@ -444,6 +468,93 @@ static void test_CryptBinaryToString(void) heap_free(hex); heap_free(cmp); } + + for (k = 0; k < ARRAY_SIZE(sizes); k++) + for (i = 0; i < ARRAY_SIZE(flags); i++) + { + strLen = 0; + ret = CryptBinaryToStringW(input, sizes[k], CRYPT_STRING_HEX | flags[i], NULL, &strLen); + ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError()); + ok(strLen > 0, "Unexpected string length.\n"); + + strLen = ~0; + ret = CryptBinaryToStringW(input, sizes[k], CRYPT_STRING_HEX | flags[i], NULL, &strLen); + ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError()); + strLen2 = binary_to_hex_len(sizes[k], CRYPT_STRING_HEX | flags[i]); + ok(strLen == strLen2, "%u: Expected length %d, got %d\n", i, strLen2, strLen); + + hex = heap_alloc(strLen * sizeof(WCHAR) + 256); + memset(hex, 0xcc, strLen * sizeof(WCHAR)); + + ptr = cmp = heap_alloc(strLen * sizeof(WCHAR) + 256); + for (j = 0; j < sizes[k]; j++) + { + *ptr++ = hexdig[(input[j] >> 4) & 0xf]; + *ptr++ = hexdig[input[j] & 0xf]; + + if (j >= sizes[k] - 1) break; + + if (j && !(flags[i] & CRYPT_STRING_NOCRLF)) + { + + if (!((j + 1) % 16)) + { + if (flags[i] & CRYPT_STRING_NOCR) + { + *ptr++ = '\n'; + } + else + { + *ptr++ = '\r'; + *ptr++ = '\n'; + } + continue; + } + else if (!((j + 1) % 8)) + *ptr++ = ' '; + } + + *ptr++ = ' '; + } + + if (flags[i] & CRYPT_STRING_NOCR) + { + *ptr++ = '\n'; + } + else if (!(flags[i] & CRYPT_STRING_NOCRLF)) + { + *ptr++ = '\r'; + *ptr++ = '\n'; + } + *ptr++ = 0; + + ret = CryptBinaryToStringW(input, sizes[k], CRYPT_STRING_HEX | flags[i], hex, &strLen); + ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError()); + strLen2--; + ok(strLen == strLen2, "%u: Expected length %d, got %d\n", i, strLen, strLen2); + ok(!memcmp(hex, cmp, strLen * sizeof(WCHAR)), "%u: got %s\n", i, wine_dbgstr_wn(hex, strLen)); + + /* adjusts size if buffer too big */ + strLen *= 2; + ret = CryptBinaryToStringW(input, sizes[k], CRYPT_STRING_HEX | flags[i], hex, &strLen); + ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError()); + ok(strLen == strLen2, "%u: Expected length %d, got %d\n", i, strLen, strLen2); + + /* no writes if buffer too small */ + strLen /= 2; + strLen2 /= 2; + memset(hex, 0xcc, strLen * sizeof(WCHAR)); + memset(cmp, 0xcc, strLen * sizeof(WCHAR)); + SetLastError(0xdeadbeef); + ret = CryptBinaryToStringW(input, sizes[k], CRYPT_STRING_HEX | flags[i], hex, &strLen); + ok(!ret && GetLastError() == ERROR_MORE_DATA,"Expected ERROR_MORE_DATA, got ret=%d le=%u\n", + ret, GetLastError()); + ok(strLen == strLen2, "%u: Expected length %d, got %d\n", i, strLen, strLen2); + ok(!memcmp(hex, cmp, strLen * sizeof(WCHAR)), "%u: got %s\n", i, wine_dbgstr_wn(hex, strLen)); + + heap_free(hex); + heap_free(cmp); + } } static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header,
1
0
0
0
Rémi Bernon : gdi32: Use FreeType as a fallback when loading font faces.
by Alexandre Julliard
03 Dec '20
03 Dec '20
Module: wine Branch: master Commit: 8aa404bba0f17db479ad2cf214b17cb6f1eae2f7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8aa404bba0f17db479ad2cf2…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Dec 1 15:54:51 2020 +0100 gdi32: Use FreeType as a fallback when loading font faces. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/freetype.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 364d58b4450..09c8251de8f 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -1218,15 +1218,10 @@ static struct unix_face *unix_face_create( const char *unix_name, void *data_ptr if (!(This = RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This) ))) goto done; - if (!(This->ft_face = new_ft_face( unix_name, data_ptr, data_size, face_index, flags & ADDFONT_ALLOW_BITMAP ))) - { - RtlFreeHeap( GetProcessHeap(), 0, This ); - This = NULL; - } - else if (opentype_get_ttc_sfnt_v1( data_ptr, data_size, face_index, &face_count, &ttc_sfnt_v1 ) && - opentype_get_tt_name_v0( data_ptr, data_size, ttc_sfnt_v1, &tt_name_v0 ) && - opentype_get_properties( data_ptr, data_size, ttc_sfnt_v1, &This->font_version, - &This->fs, &This->ntm_flags )) + if (opentype_get_ttc_sfnt_v1( data_ptr, data_size, face_index, &face_count, &ttc_sfnt_v1 ) && + opentype_get_tt_name_v0( data_ptr, data_size, ttc_sfnt_v1, &tt_name_v0 ) && + opentype_get_properties( data_ptr, data_size, ttc_sfnt_v1, &This->font_version, + &This->fs, &This->ntm_flags )) { struct family_names_data family_names; struct face_name_data style_name; @@ -1268,7 +1263,7 @@ static struct unix_face *unix_face_create( const char *unix_name, void *data_ptr WARN( "full name not found, using %s instead\n", debugstr_w(This->full_name) ); } } - else + else if ((This->ft_face = new_ft_face( unix_name, data_ptr, data_size, face_index, flags & ADDFONT_ALLOW_BITMAP ))) { WARN( "unable to parse font, falling back to FreeType\n" ); This->scalable = FT_IS_SCALABLE( This->ft_face ); @@ -1299,6 +1294,11 @@ static struct unix_face *unix_face_create( const char *unix_name, void *data_ptr if (!This->scalable) get_bitmap_size( This->ft_face, &This->size ); get_fontsig( This->ft_face, &This->fs ); } + else + { + RtlFreeHeap( GetProcessHeap(), 0, This ); + This = NULL; + } done: if (unix_name) munmap( data_ptr, data_size ); @@ -1307,7 +1307,7 @@ done: static void unix_face_destroy( struct unix_face *This ) { - pFT_Done_Face( This->ft_face ); + if (This->ft_face) pFT_Done_Face( This->ft_face ); RtlFreeHeap( GetProcessHeap(), 0, This->full_name ); RtlFreeHeap( GetProcessHeap(), 0, This->style_name ); RtlFreeHeap( GetProcessHeap(), 0, This->second_name );
1
0
0
0
Rémi Bernon : gdi32: Try to parse font props without FreeType.
by Alexandre Julliard
03 Dec '20
03 Dec '20
Module: wine Branch: master Commit: 3ea171dee542027a4497a17920c69315994526eb URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3ea171dee542027a4497a179…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Dec 1 15:54:50 2020 +0100 gdi32: Try to parse font props without FreeType. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/freetype.c | 7 ++-- dlls/gdi32/gdi_private.h | 3 ++ dlls/gdi32/opentype.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+), 4 deletions(-) diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 521bf054e43..364d58b4450 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -1224,7 +1224,9 @@ static struct unix_face *unix_face_create( const char *unix_name, void *data_ptr This = NULL; } else if (opentype_get_ttc_sfnt_v1( data_ptr, data_size, face_index, &face_count, &ttc_sfnt_v1 ) && - opentype_get_tt_name_v0( data_ptr, data_size, ttc_sfnt_v1, &tt_name_v0 )) + opentype_get_tt_name_v0( data_ptr, data_size, ttc_sfnt_v1, &tt_name_v0 ) && + opentype_get_properties( data_ptr, data_size, ttc_sfnt_v1, &This->font_version, + &This->fs, &This->ntm_flags )) { struct family_names_data family_names; struct face_name_data style_name; @@ -1291,10 +1293,7 @@ static struct unix_face *unix_face_create( const char *unix_name, void *data_ptr This->style_name = ft_face_get_style_name( This->ft_face, system_lcid ); This->full_name = ft_face_get_full_name( This->ft_face, system_lcid ); - } - if (This) - { This->ntm_flags = get_ntm_flags( This->ft_face ); This->font_version = get_font_version( This->ft_face ); if (!This->scalable) get_bitmap_size( This->ft_face, &This->size ); diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 9a988d08d7e..8d917a795c0 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -439,6 +439,9 @@ extern BOOL opentype_enum_style_names( const struct tt_name_v0 *tt_name_v0, extern BOOL opentype_enum_full_names( const struct tt_name_v0 *tt_name_v0, opentype_enum_names_cb callback, void *user ) DECLSPEC_HIDDEN; +extern BOOL opentype_get_properties( const void *data, size_t size, const struct ttc_sfnt_v1 *ttc_sfnt_v1, + DWORD *version, FONTSIGNATURE *fs, DWORD *ntm_flags ) DECLSPEC_HIDDEN; + /* gdiobj.c */ extern HGDIOBJ alloc_gdi_handle( void *obj, WORD type, const struct gdi_obj_funcs *funcs ) DECLSPEC_HIDDEN; extern void *free_gdi_handle( HGDIOBJ handle ) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/opentype.c b/dlls/gdi32/opentype.c index 4200b08d318..67af44dfe91 100644 --- a/dlls/gdi32/opentype.c +++ b/dlls/gdi32/opentype.c @@ -42,6 +42,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(font); #define MS_EBDT_TAG MS_MAKE_TAG('E','B','D','T') #define MS_CBDT_TAG MS_MAKE_TAG('C','B','D','T') #define MS_NAME_TAG MS_MAKE_TAG('n','a','m','e') +#define MS_CFF__TAG MS_MAKE_TAG('C','F','F',' ') #ifdef WORDS_BIGENDIAN #define GET_BE_WORD(x) (x) @@ -135,6 +136,28 @@ struct tt_name_v0 WORD stringOffset; struct tt_namerecord nameRecord[1]; }; + +struct tt_head +{ + USHORT majorVersion; + USHORT minorVersion; + ULONG revision; + ULONG checksumadj; + ULONG magic; + USHORT flags; + USHORT unitsPerEm; + ULONGLONG created; + ULONGLONG modified; + SHORT xMin; + SHORT yMin; + SHORT xMax; + SHORT yMax; + USHORT macStyle; + USHORT lowestRecPPEM; + SHORT direction_hint; + SHORT index_format; + SHORT glyphdata_format; +}; #include "poppack.h" enum OPENTYPE_PLATFORM_ID @@ -236,6 +259,20 @@ enum OPENTYPE_NAME_ID OPENTYPE_NAME_WWS_SUBFAMILY }; +enum OS2_FSSELECTION +{ + OS2_FSSELECTION_ITALIC = 1 << 0, + OS2_FSSELECTION_UNDERSCORE = 1 << 1, + OS2_FSSELECTION_NEGATIVE = 1 << 2, + OS2_FSSELECTION_OUTLINED = 1 << 3, + OS2_FSSELECTION_STRIKEOUT = 1 << 4, + OS2_FSSELECTION_BOLD = 1 << 5, + OS2_FSSELECTION_REGULAR = 1 << 6, + OS2_FSSELECTION_USE_TYPO_METRICS = 1 << 7, + OS2_FSSELECTION_WWS = 1 << 8, + OS2_FSSELECTION_OBLIQUE = 1 << 9 +}; + static BOOL opentype_get_table_ptr( const void *data, size_t size, const struct ttc_sfnt_v1 *ttc_sfnt_v1, UINT32 table_tag, const void **table_ptr, UINT32 *table_size ) { @@ -270,6 +307,13 @@ static BOOL opentype_get_tt_os2_v1( const void *data, size_t size, const struct return opentype_get_table_ptr( data, size, ttc_sfnt_v1, MS_OS_2_TAG, (const void **)tt_os2_v1, &table_size ); } +static BOOL opentype_get_tt_head( const void *data, size_t size, const struct ttc_sfnt_v1 *ttc_sfnt_v1, + const struct tt_head **tt_head ) +{ + UINT32 table_size = sizeof(**tt_head); + return opentype_get_table_ptr( data, size, ttc_sfnt_v1, MS_HEAD_TAG, (const void **)tt_head, &table_size ); +} + static UINT get_name_record_codepage( enum OPENTYPE_PLATFORM_ID platform, USHORT encoding ) { switch (platform) @@ -677,3 +721,50 @@ BOOL opentype_enum_full_names( const struct tt_name_v0 *header, opentype_enum_na return TRUE; return FALSE; } + +BOOL opentype_get_properties( const void *data, size_t size, const struct ttc_sfnt_v1 *ttc_sfnt_v1, + DWORD *version, FONTSIGNATURE *fs, DWORD *ntm_flags ) +{ + const struct tt_os2_v1 *tt_os2_v1; + const struct tt_head *tt_head; + const void *cff_header; + UINT32 table_size = 0; + USHORT idx, selection; + DWORD flags = 0; + + if (!opentype_get_tt_head( data, size, ttc_sfnt_v1, &tt_head )) return FALSE; + if (!opentype_get_tt_os2_v1( data, size, ttc_sfnt_v1, &tt_os2_v1 )) return FALSE; + + *version = GET_BE_DWORD( tt_head->revision ); + + fs->fsUsb[0] = GET_BE_DWORD( tt_os2_v1->ulUnicodeRange1 ); + fs->fsUsb[1] = GET_BE_DWORD( tt_os2_v1->ulUnicodeRange2 ); + fs->fsUsb[2] = GET_BE_DWORD( tt_os2_v1->ulUnicodeRange3 ); + fs->fsUsb[3] = GET_BE_DWORD( tt_os2_v1->ulUnicodeRange4 ); + + if (tt_os2_v1->version == 0) + { + idx = GET_BE_WORD( tt_os2_v1->usFirstCharIndex ); + if (idx >= 0xf000 && idx < 0xf100) fs->fsCsb[0] = FS_SYMBOL; + else fs->fsCsb[0] = FS_LATIN1; + fs->fsCsb[1] = 0; + } + else + { + fs->fsCsb[0] = GET_BE_DWORD( tt_os2_v1->ulCodePageRange1 ); + fs->fsCsb[1] = GET_BE_DWORD( tt_os2_v1->ulCodePageRange2 ); + } + + selection = GET_BE_WORD( tt_os2_v1->fsSelection ); + + if (selection & OS2_FSSELECTION_ITALIC) flags |= NTM_ITALIC; + if (selection & OS2_FSSELECTION_BOLD) flags |= NTM_BOLD; + if (selection & OS2_FSSELECTION_REGULAR) flags |= NTM_REGULAR; + if (flags == 0) flags = NTM_REGULAR; + + if (opentype_get_table_ptr( data, size, ttc_sfnt_v1, MS_CFF__TAG, &cff_header, &table_size )) + flags |= NTM_PS_OPENTYPE; + + *ntm_flags = flags; + return TRUE; +}
1
0
0
0
Rémi Bernon : gdi32: Try to parse font names without FreeType.
by Alexandre Julliard
03 Dec '20
03 Dec '20
Module: wine Branch: master Commit: 93ef83e903354e5d28a9a0b14dd2ff83504f2b0f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=93ef83e903354e5d28a9a0b1…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Dec 1 15:54:49 2020 +0100 gdi32: Try to parse font names without FreeType. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/freetype.c | 131 +++++++++++++- dlls/gdi32/gdi_private.h | 18 ++ dlls/gdi32/opentype.c | 459 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 603 insertions(+), 5 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=93ef83e903354e5d28a9…
1
0
0
0
Rémi Bernon : gdi32: Introduce new opentype font parsing helpers.
by Alexandre Julliard
03 Dec '20
03 Dec '20
Module: wine Branch: master Commit: e338d046976064d6f050591f1c99fa1ddd4077b7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e338d046976064d6f050591f…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Dec 1 15:54:48 2020 +0100 gdi32: Introduce new opentype font parsing helpers. Mostly taken from dwrite source, adapted to make it more flexible. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/Makefile.in | 1 + dlls/gdi32/freetype.c | 11 +++ dlls/gdi32/gdi_private.h | 7 ++ dlls/gdi32/opentype.c | 220 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 239 insertions(+) diff --git a/dlls/gdi32/Makefile.in b/dlls/gdi32/Makefile.in index a965e80001c..910450b9f64 100644 --- a/dlls/gdi32/Makefile.in +++ b/dlls/gdi32/Makefile.in @@ -42,6 +42,7 @@ C_SRCS = \ mfdrv/objects.c \ mfdrv/text.c \ opengl.c \ + opentype.c \ painting.c \ palette.c \ path.c \ diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index cb993034d09..686f2b54682 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -1110,8 +1110,10 @@ struct unix_face static struct unix_face *unix_face_create( const char *unix_name, void *data_ptr, DWORD data_size, UINT face_index, DWORD flags ) { + const struct ttc_sfnt_v1 *ttc_sfnt_v1; struct unix_face *This; struct stat st; + DWORD face_count; int fd; TRACE( "unix_name %s, face_index %u, data_ptr %p, data_size %u, flags %#x\n", @@ -1138,11 +1140,20 @@ static struct unix_face *unix_face_create( const char *unix_name, void *data_ptr RtlFreeHeap( GetProcessHeap(), 0, This ); This = NULL; } + else if (opentype_get_ttc_sfnt_v1( data_ptr, data_size, face_index, &face_count, &ttc_sfnt_v1 )) + { + This->scalable = TRUE; + This->num_faces = face_count; + } else { + WARN( "unable to parse font, falling back to FreeType\n" ); This->scalable = FT_IS_SCALABLE( This->ft_face ); This->num_faces = This->ft_face->num_faces; + } + if (This) + { This->family_name = ft_face_get_family_name( This->ft_face, system_lcid ); This->second_name = ft_face_get_family_name( This->ft_face, MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT) ); diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index b9a06415538..a529cb0890c 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -414,6 +414,13 @@ struct font_callback_funcs extern void font_init(void) DECLSPEC_HIDDEN; +/* opentype.c */ + +struct ttc_sfnt_v1; + +extern BOOL opentype_get_ttc_sfnt_v1( const void *data, size_t size, DWORD index, DWORD *count, + const struct ttc_sfnt_v1 **ttc_sfnt_v1 ) DECLSPEC_HIDDEN; + /* gdiobj.c */ extern HGDIOBJ alloc_gdi_handle( void *obj, WORD type, const struct gdi_obj_funcs *funcs ) DECLSPEC_HIDDEN; extern void *free_gdi_handle( HGDIOBJ handle ) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/opentype.c b/dlls/gdi32/opentype.c new file mode 100644 index 00000000000..2363439cdc5 --- /dev/null +++ b/dlls/gdi32/opentype.c @@ -0,0 +1,220 @@ +/* + * Copyright 2020 Rémi Bernon for CodeWeavers + * Copyright 2014 Aric Stewart for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep unix +#endif + +#include <stdarg.h> +#include <stdlib.h> + +#include "windef.h" +#include "winbase.h" + +#include "wine/debug.h" + +#include "gdi_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(font); + +#define MS_OTTO_TAG MS_MAKE_TAG('O','T','T','O') +#define MS_HEAD_TAG MS_MAKE_TAG('h','e','a','d') +#define MS_HHEA_TAG MS_MAKE_TAG('h','h','e','a') +#define MS_OS_2_TAG MS_MAKE_TAG('O','S','/','2') +#define MS_EBSC_TAG MS_MAKE_TAG('E','B','S','C') +#define MS_EBDT_TAG MS_MAKE_TAG('E','B','D','T') +#define MS_CBDT_TAG MS_MAKE_TAG('C','B','D','T') + +#ifdef WORDS_BIGENDIAN +#define GET_BE_WORD(x) (x) +#define GET_BE_DWORD(x) (x) +#else +#define GET_BE_WORD(x) RtlUshortByteSwap(x) +#define GET_BE_DWORD(x) RtlUlongByteSwap(x) +#endif + +#include "pshpack2.h" +struct ttc_header_v1 +{ + CHAR TTCTag[4]; + DWORD Version; + DWORD numFonts; + DWORD OffsetTable[1]; +}; + +struct ttc_sfnt_v1 +{ + DWORD version; + WORD numTables; + WORD searchRange; + WORD entrySelector; + WORD rangeShift; +}; + +struct tt_tablerecord +{ + DWORD tag; + DWORD checkSum; + DWORD offset; + DWORD length; +}; + +struct tt_os2_v1 +{ + USHORT version; + SHORT xAvgCharWidth; + USHORT usWeightClass; + USHORT usWidthClass; + SHORT fsType; + SHORT ySubscriptXSize; + SHORT ySubscriptYSize; + SHORT ySubscriptXOffset; + SHORT ySubscriptYOffset; + SHORT ySuperscriptXSize; + SHORT ySuperscriptYSize; + SHORT ySuperscriptXOffset; + SHORT ySuperscriptYOffset; + SHORT yStrikeoutSize; + SHORT yStrikeoutPosition; + SHORT sFamilyClass; + PANOSE panose; + ULONG ulUnicodeRange1; + ULONG ulUnicodeRange2; + ULONG ulUnicodeRange3; + ULONG ulUnicodeRange4; + CHAR achVendID[4]; + USHORT fsSelection; + USHORT usFirstCharIndex; + USHORT usLastCharIndex; + /* According to the Apple spec, original version didn't have the below fields, + * version numbers were taken from the OpenType spec. + */ + /* version 0 (TrueType 1.5) */ + USHORT sTypoAscender; + USHORT sTypoDescender; + USHORT sTypoLineGap; + USHORT usWinAscent; + USHORT usWinDescent; + /* version 1 (TrueType 1.66) */ + ULONG ulCodePageRange1; + ULONG ulCodePageRange2; +}; +#include "poppack.h" + +static BOOL opentype_get_table_ptr( const void *data, size_t size, const struct ttc_sfnt_v1 *ttc_sfnt_v1, + UINT32 table_tag, const void **table_ptr, UINT32 *table_size ) +{ + const struct tt_tablerecord *table_record; + UINT16 i, table_count; + UINT32 offset, length; + + if (!ttc_sfnt_v1) return FALSE; + + table_record = (const struct tt_tablerecord *)(ttc_sfnt_v1 + 1); + table_count = GET_BE_WORD( ttc_sfnt_v1->numTables ); + for (i = 0; i < table_count; i++, table_record++) + { + if (table_record->tag != table_tag) continue; + offset = GET_BE_DWORD( table_record->offset ); + length = GET_BE_DWORD( table_record->length ); + if (size < offset + length) return FALSE; + if (table_size && length < *table_size) return FALSE; + + if (table_ptr) *table_ptr = (const char *)data + offset; + if (table_size) *table_size = length; + return TRUE; + } + + return FALSE; +} + +static BOOL opentype_get_tt_os2_v1( const void *data, size_t size, const struct ttc_sfnt_v1 *ttc_sfnt_v1, + const struct tt_os2_v1 **tt_os2_v1 ) +{ + UINT32 table_size = sizeof(**tt_os2_v1); + return opentype_get_table_ptr( data, size, ttc_sfnt_v1, MS_OS_2_TAG, (const void **)tt_os2_v1, &table_size ); +} + +BOOL opentype_get_ttc_sfnt_v1( const void *data, size_t size, DWORD index, DWORD *count, const struct ttc_sfnt_v1 **ttc_sfnt_v1 ) +{ + const struct ttc_header_v1 *ttc_header_v1 = data; + const struct tt_os2_v1 *tt_os2_v1; + UINT32 offset, fourcc; + + *ttc_sfnt_v1 = NULL; + *count = 1; + + if (size < sizeof(fourcc)) return FALSE; + memcpy( &fourcc, data, sizeof(fourcc) ); + + switch (fourcc) + { + default: + WARN( "unsupported font format %x\n", fourcc ); + return FALSE; + case MS_TTCF_TAG: + if (size < sizeof(ttc_header_v1)) return FALSE; + if (index >= (*count = GET_BE_DWORD( ttc_header_v1->numFonts ))) return FALSE; + offset = GET_BE_DWORD( ttc_header_v1->OffsetTable[index] ); + break; + case 0x00000100: + case MS_OTTO_TAG: + offset = 0; + break; + } + + if (size < offset + sizeof(**ttc_sfnt_v1)) return FALSE; + *ttc_sfnt_v1 = (const struct ttc_sfnt_v1 *)((const char *)data + offset); + + if (!opentype_get_table_ptr( data, size, *ttc_sfnt_v1, MS_HEAD_TAG, NULL, NULL )) + { + WARN( "unsupported sfnt font: missing head table.\n" ); + return FALSE; + } + + if (!opentype_get_table_ptr( data, size, *ttc_sfnt_v1, MS_HHEA_TAG, NULL, NULL )) + { + WARN( "unsupported sfnt font: missing hhea table.\n" ); + return FALSE; + } + + if (!opentype_get_tt_os2_v1( data, size, *ttc_sfnt_v1, &tt_os2_v1 )) + { + WARN( "unsupported sfnt font: missing OS/2 table.\n" ); + return FALSE; + } + + /* Wine uses ttfs as an intermediate step in building its bitmap fonts; + we don't want to load these. */ + if (!memcmp( tt_os2_v1->achVendID, "Wine", sizeof(tt_os2_v1->achVendID) ) && + opentype_get_table_ptr( data, size, *ttc_sfnt_v1, MS_EBSC_TAG, NULL, NULL )) + { + TRACE( "ignoring wine bitmap-only sfnt font.\n" ); + return FALSE; + } + + if (opentype_get_table_ptr( data, size, *ttc_sfnt_v1, MS_EBDT_TAG, NULL, NULL ) || + opentype_get_table_ptr( data, size, *ttc_sfnt_v1, MS_CBDT_TAG, NULL, NULL )) + { + WARN( "unsupported sfnt font: embedded bitmap data.\n" ); + return FALSE; + } + + return TRUE; +}
1
0
0
0
← Newer
1
...
26
27
28
29
30
31
32
...
42
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
Results per page:
10
25
50
100
200