[USP10] Sync with Wine Staging 3.3. CORE-14434

This commit is contained in:
Amine Khaldi 2018-03-24 13:07:16 +01:00
parent 2b6df67f0a
commit 92666dbaa6
15 changed files with 170 additions and 100 deletions

View file

@ -15,7 +15,7 @@ list(APPEND SOURCE
shape.c
shaping.c
usp10.c
usp10_internal.h
precomp.h
${CMAKE_CURRENT_BINARY_DIR}/usp10_stubs.c)
add_library(usp10 SHARED
@ -25,5 +25,5 @@ add_library(usp10 SHARED
set_module_type(usp10 win32dll)
target_link_libraries(usp10 wine)
add_importlibs(usp10 advapi32 user32 gdi32 msvcrt kernel32 ntdll)
add_pch(usp10 usp10_internal.h SOURCE)
add_pch(usp10 precomp.h SOURCE)
add_cd_file(TARGET usp10 DESTINATION reactos/system32 FOR all)

View file

@ -41,9 +41,19 @@
* has been modified.
*/
#include <windef.h>
#include "config.h"
#include <wine/list.h>
#include <stdarg.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winnls.h"
#include "usp10.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h"
#include "usp10_internal.h"
@ -682,8 +692,9 @@ static BracketPair *computeBracketPairs(IsolatedRun *iso_run)
WCHAR *open_stack;
int *stack_index;
int stack_top = iso_run->length;
unsigned int pair_count = 0;
BracketPair *out = NULL;
int pair_count = 0;
SIZE_T out_size = 0;
int i;
open_stack = heap_alloc(iso_run->length * sizeof(*open_stack));
@ -692,55 +703,55 @@ static BracketPair *computeBracketPairs(IsolatedRun *iso_run)
for (i = 0; i < iso_run->length; i++)
{
unsigned short ubv = get_table_entry(bidi_bracket_table, iso_run->item[i].ch);
if (ubv)
{
if (!out)
{
out = heap_alloc(sizeof(*out));
out[0].start = -1;
}
if (!ubv)
continue;
if ((ubv >> 8) == 0)
{
stack_top --;
--stack_top;
open_stack[stack_top] = iso_run->item[i].ch + (signed char)(ubv & 0xff);
/* deal with canonical equivalent U+2329/232A and U+3008/3009 */
if (open_stack[stack_top] == 0x232A)
/* Deal with canonical equivalent U+2329/232A and U+3008/3009. */
if (open_stack[stack_top] == 0x232a)
open_stack[stack_top] = 0x3009;
stack_index[stack_top] = i;
}
else if ((ubv >> 8) == 1)
{
int j;
if (stack_top == iso_run->length) continue;
for (j = stack_top; j < iso_run->length; j++)
unsigned int j;
for (j = stack_top; j < iso_run->length; ++j)
{
WCHAR c = iso_run->item[i].ch;
if (c == 0x232A) c = 0x3009;
if (c == open_stack[j])
{
if (c == 0x232a)
c = 0x3009;
if (c != open_stack[j])
continue;
if (!(usp10_array_reserve((void **)&out, &out_size, pair_count + 2, sizeof(*out))))
ERR("Failed to grow output array.\n");
out[pair_count].start = stack_index[j];
out[pair_count].end = i;
pair_count++;
out = HeapReAlloc(GetProcessHeap(), 0, out, sizeof(BracketPair) * (pair_count+1));
++pair_count;
out[pair_count].start = -1;
stack_top = j+1;
stack_top = j + 1;
break;
}
}
}
}
}
if (pair_count == 0)
{
heap_free(out);
out = NULL;
}
else if (pair_count > 1)
qsort(out, pair_count, sizeof(BracketPair), compr);
heap_free(open_stack);
heap_free(stack_index);
if (!pair_count)
return NULL;
qsort(out, pair_count, sizeof(*out), compr);
return out;
}

View file

@ -2,7 +2,9 @@
/* generated from http://www.unicode.org/Public/10.0.0/ucd/BidiBrackets.txt */
/* DO NOT EDIT!! */
const unsigned short /* DECLSPEC_HIDDEN */ bidi_bracket_table[768] =
#include "wine/unicode.h"
const unsigned short DECLSPEC_HIDDEN bidi_bracket_table[768] =
{
/* level 1 offsets */
0x0100, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110,

View file

@ -18,7 +18,21 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
#include "config.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "winnls.h"
#include "usp10.h"
#include "winternl.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "usp10_internal.h"
WINE_DEFAULT_DEBUG_CHANNEL(uniscribe);

View file

@ -18,7 +18,21 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
#include "config.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "winnls.h"
#include "usp10.h"
#include "winternl.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "usp10_internal.h"
WINE_DEFAULT_DEBUG_CHANNEL(uniscribe);

View file

@ -3,7 +3,9 @@
/* and from http://www.unicode.org/Public/10.0.0/ucd/IndicPositionalCategory.txt */
/* DO NOT EDIT!! */
const unsigned short /* DECLSPEC_HIDDEN */ indic_syllabic_table[3312] =
#include "wine/unicode.h"
const unsigned short DECLSPEC_HIDDEN indic_syllabic_table[3312] =
{
/* level 1 offsets */
0x0100, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110,

View file

@ -2,7 +2,9 @@
/* generated from http://www.unicode.org/Public/10.0.0/ucd/LineBreak.txt */
/* DO NOT EDIT!! */
const unsigned short /* DECLSPEC_HIDDEN */ wine_linebreak_table[7248] =
#include "wine/unicode.h"
const unsigned short DECLSPEC_HIDDEN wine_linebreak_table[7248] =
{
/* level 1 offsets */
0x0100, 0x0110, 0x0120, 0x0130, 0x0140, 0x0150, 0x0160, 0x0170,

View file

@ -2,8 +2,7 @@
/* generated from http://www.unicode.org/Public/10.0.0/ucd/BidiMirroring.txt */
/* DO NOT EDIT!! */
#include <windef.h>
#include <winnt.h>
#include "wine/unicode.h"
const WCHAR DECLSPEC_HIDDEN wine_mirror_map[3292] =
{

View file

@ -18,10 +18,21 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
#include <stdarg.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "usp10.h"
#include "winternl.h"
#include "usp10_internal.h"
#include <winternl.h>
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(uniscribe);

23
dll/win32/usp10/precomp.h Normal file
View file

@ -0,0 +1,23 @@
#ifndef _USP10_PRECOMP_H_
#define _USP10_PRECOMP_H_
#include <config.h>
#include <stdarg.h>
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#include <windef.h>
#include <winbase.h>
#include <wingdi.h>
#include <usp10.h>
#include <wine/debug.h>
#include <wine/unicode.h>
#include "usp10_internal.h"
#endif /* !_USP10_PRECOMP_H_ */

View file

@ -18,9 +18,22 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
#include <stdarg.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "usp10.h"
#include "winternl.h"
#include "usp10_internal.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(uniscribe);
#define FIRST_ARABIC_CHAR 0x0600

View file

@ -2,7 +2,9 @@
/* generated from http://www.unicode.org/Public/10.0.0/ucd/ArabicShaping.txt */
/* DO NOT EDIT!! */
const unsigned short /* DECLSPEC_HIDDEN */ wine_shaping_table[2912] =
#include "wine/unicode.h"
const unsigned short DECLSPEC_HIDDEN wine_shaping_table[2912] =
{
/* level 1 offsets */
0x0100, 0x0110, 0x0110, 0x0120, 0x0130, 0x0140, 0x0150, 0x0160,
@ -373,7 +375,7 @@ const unsigned short /* DECLSPEC_HIDDEN */ wine_shaping_table[2912] =
0x0000, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000
};
const unsigned short /* DECLSPEC_HIDDEN */ wine_shaping_forms[256][4] =
const unsigned short DECLSPEC_HIDDEN wine_shaping_forms[256][4] =
{
{ 0x0600, 0x0600, 0x0600, 0x0600 },
{ 0x0601, 0x0601, 0x0601, 0x0601 },

View file

@ -24,11 +24,23 @@
* and filtering characters and bi-directional text with custom line breaks.
*/
#include <stdarg.h>
#include <stdlib.h>
#include <math.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "winreg.h"
#include "usp10.h"
#include "usp10_internal.h"
#include <math.h>
#include <winuser.h>
#include <winreg.h>
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(uniscribe);
@ -1143,7 +1155,7 @@ HRESULT WINAPI ScriptGetProperties(const SCRIPT_PROPERTIES ***props, int *num)
if (!props && !num) return E_INVALIDARG;
if (num) *num = sizeof(script_props)/sizeof(script_props[0]);
if (num) *num = ARRAY_SIZE(script_props);
if (props) *props = script_props;
return S_OK;
@ -3597,14 +3609,13 @@ HRESULT WINAPI ScriptTextOut(const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UIN
if (!psa->fNoGlyphIndex) /* Have Glyphs? */
fuOptions |= ETO_GLYPH_INDEX; /* Say don't do translation to glyph */
lpDx = heap_alloc(cGlyphs * sizeof(INT) * 2);
if (!lpDx) return E_OUTOFMEMORY;
if (!(lpDx = heap_calloc(cGlyphs, 2 * sizeof(*lpDx))))
return E_OUTOFMEMORY;
fuOptions |= ETO_PDY;
if (psa->fRTL && psa->fLogicalOrder)
{
reordered_glyphs = heap_alloc( cGlyphs * sizeof(WORD) );
if (!reordered_glyphs)
if (!(reordered_glyphs = heap_calloc(cGlyphs, sizeof(*reordered_glyphs))))
{
heap_free( lpDx );
return E_OUTOFMEMORY;
@ -3743,8 +3754,7 @@ HRESULT WINAPI ScriptLayout(int runs, const BYTE *level, int *vistolog, int *log
if (!level || (!vistolog && !logtovis))
return E_INVALIDARG;
indexs = heap_alloc(sizeof(int) * runs);
if (!indexs)
if (!(indexs = heap_calloc(runs, sizeof(*indexs))))
return E_OUTOFMEMORY;
if (vistolog)

View file

@ -19,25 +19,9 @@
*
*/
#ifndef _USP10_INTERNAL_H_
#define _USP10_INTERNAL_H_
#pragma once
#include <config.h>
#include <stdarg.h>
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#include <windef.h>
#include <winbase.h>
#include <wingdi.h>
#include <usp10.h>
#include <wine/debug.h>
#include <wine/unicode.h>
#include <wine/list.h>
#include "wine/list.h"
#define MS_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
( ( (ULONG)_x4 << 24 ) | \
@ -237,21 +221,6 @@ typedef struct {
enum {lex_Halant, lex_Composed_Vowel, lex_Matra_post, lex_Matra_pre, lex_Matra_above, lex_Matra_below, lex_ZWJ, lex_ZWNJ, lex_NBSP, lex_Modifier, lex_Vowel, lex_Consonant, lex_Generic, lex_Ra, lex_Vedic, lex_Anudatta, lex_Nukta};
static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t size)
{
return HeapAlloc(GetProcessHeap(), 0, size);
}
static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t size)
{
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
}
static inline BOOL heap_free(void *mem)
{
return HeapFree(GetProcessHeap(), 0, mem);
}
static inline BOOL is_consonant( int type )
{
return (type == lex_Ra || type == lex_Consonant);
@ -307,5 +276,3 @@ unsigned int OpenType_apply_GPOS_lookup(const ScriptCache *psc, const OUTLINETEX
HRESULT OpenType_GetFontScriptTags(ScriptCache *psc, OPENTYPE_TAG searchingFor, int cMaxTags, OPENTYPE_TAG *pScriptTags, int *pcTags) DECLSPEC_HIDDEN;
HRESULT OpenType_GetFontLanguageTags(ScriptCache *psc, OPENTYPE_TAG script_tag, OPENTYPE_TAG searchingFor, int cMaxTags, OPENTYPE_TAG *pLanguageTags, int *pcTags) DECLSPEC_HIDDEN;
HRESULT OpenType_GetFontFeatureTags(ScriptCache *psc, OPENTYPE_TAG script_tag, OPENTYPE_TAG language_tag, BOOL filtered, OPENTYPE_TAG searchingFor, char tableType, int cMaxTags, OPENTYPE_TAG *pFeatureTags, int *pcTags, LoadedFeature** feature) DECLSPEC_HIDDEN;
#endif /* _USP10_INTERNAL_H_ */

View file

@ -189,7 +189,7 @@ reactos/dll/win32/twain_32 # Synced to WineStaging-3.3
reactos/dll/win32/updspapi # Synced to WineStaging-3.3
reactos/dll/win32/url # Synced to WineStaging-3.3
reactos/dll/win32/urlmon # Synced to WineStaging-3.3
reactos/dll/win32/usp10 # Synced to Wine-3.0
reactos/dll/win32/usp10 # Synced to WineStaging-3.3
reactos/dll/win32/uxtheme # Forked
reactos/dll/win32/vbscript # Synced to Wine-3.0
reactos/dll/win32/version # Synced to Wine-3.0