https://git.reactos.org/?p=reactos.git;a=commitdiff;h=92666dbaa6ee3038d2c82…
commit 92666dbaa6ee3038d2c82177bb869140c5dac3df
Author: Amine Khaldi <amine.khaldi(a)reactos.org>
AuthorDate: Sat Mar 24 13:07:16 2018 +0100
Commit: Amine Khaldi <amine.khaldi(a)reactos.org>
CommitDate: Sat Mar 24 13:07:16 2018 +0100
[USP10] Sync with Wine Staging 3.3. CORE-14434
---
dll/win32/usp10/CMakeLists.txt | 4 +-
dll/win32/usp10/bidi.c | 99 ++++++++++++++++++++++------------------
dll/win32/usp10/bracket.c | 4 +-
dll/win32/usp10/breaking.c | 14 ++++++
dll/win32/usp10/indic.c | 16 ++++++-
dll/win32/usp10/indicsyllable.c | 4 +-
dll/win32/usp10/linebreak.c | 4 +-
dll/win32/usp10/mirror.c | 3 +-
dll/win32/usp10/opentype.c | 13 +++++-
dll/win32/usp10/precomp.h | 23 ++++++++++
dll/win32/usp10/shape.c | 13 ++++++
dll/win32/usp10/shaping.c | 6 ++-
dll/win32/usp10/usp10.c | 30 ++++++++----
dll/win32/usp10/usp10_internal.h | 37 +--------------
media/doc/README.WINE | 2 +-
15 files changed, 171 insertions(+), 101 deletions(-)
diff --git a/dll/win32/usp10/CMakeLists.txt b/dll/win32/usp10/CMakeLists.txt
index ff58b7ef42..25b76c5642 100644
--- a/dll/win32/usp10/CMakeLists.txt
+++ b/dll/win32/usp10/CMakeLists.txt
@@ -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)
diff --git a/dll/win32/usp10/bidi.c b/dll/win32/usp10/bidi.c
index a06ff8c65b..b0df781c82 100644
--- a/dll/win32/usp10/bidi.c
+++ b/dll/win32/usp10/bidi.c
@@ -41,9 +41,19 @@
* has been modified.
*/
-#include <windef.h>
-
-#include <wine/list.h>
+#include "config.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 (!ubv)
+ continue;
+
+ if ((ubv >> 8) == 0)
{
- if (!out)
- {
- out = heap_alloc(sizeof(*out));
- out[0].start = -1;
- }
+ --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)
+ open_stack[stack_top] = 0x3009;
+ stack_index[stack_top] = i;
+ }
+ else if ((ubv >> 8) == 1)
+ {
+ unsigned int j;
- if ((ubv >> 8) == 0)
- {
- 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)
- open_stack[stack_top] = 0x3009;
- stack_index[stack_top] = i;
- }
- else if ((ubv >> 8) == 1)
+ for (j = stack_top; j < iso_run->length; ++j)
{
- int j;
- if (stack_top == iso_run->length) continue;
- 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])
- {
- out[pair_count].start = stack_index[j];
- out[pair_count].end = i;
- pair_count++;
- out = HeapReAlloc(GetProcessHeap(), 0, out, sizeof(BracketPair) *
(pair_count+1));
- out[pair_count].start = -1;
- stack_top = j+1;
- break;
- }
- }
+ WCHAR c = iso_run->item[i].ch;
+
+ 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[pair_count].start = -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;
}
diff --git a/dll/win32/usp10/bracket.c b/dll/win32/usp10/bracket.c
index 6905464990..1509d572c9 100644
--- a/dll/win32/usp10/bracket.c
+++ b/dll/win32/usp10/bracket.c
@@ -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,
diff --git a/dll/win32/usp10/breaking.c b/dll/win32/usp10/breaking.c
index b6e3151744..9b12d9e63d 100644
--- a/dll/win32/usp10/breaking.c
+++ b/dll/win32/usp10/breaking.c
@@ -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);
diff --git a/dll/win32/usp10/indic.c b/dll/win32/usp10/indic.c
index fae5f43c61..5a228e88de 100644
--- a/dll/win32/usp10/indic.c
+++ b/dll/win32/usp10/indic.c
@@ -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);
diff --git a/dll/win32/usp10/indicsyllable.c b/dll/win32/usp10/indicsyllable.c
index ead8735b9b..dbdac5d4ae 100644
--- a/dll/win32/usp10/indicsyllable.c
+++ b/dll/win32/usp10/indicsyllable.c
@@ -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,
diff --git a/dll/win32/usp10/linebreak.c b/dll/win32/usp10/linebreak.c
index 0c03e334c0..56bde66e9e 100644
--- a/dll/win32/usp10/linebreak.c
+++ b/dll/win32/usp10/linebreak.c
@@ -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,
diff --git a/dll/win32/usp10/mirror.c b/dll/win32/usp10/mirror.c
index c8f3468165..23dab536c4 100644
--- a/dll/win32/usp10/mirror.c
+++ b/dll/win32/usp10/mirror.c
@@ -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] =
{
diff --git a/dll/win32/usp10/opentype.c b/dll/win32/usp10/opentype.c
index 9b7827af65..2d708a8c40 100644
--- a/dll/win32/usp10/opentype.c
+++ b/dll/win32/usp10/opentype.c
@@ -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);
diff --git a/dll/win32/usp10/precomp.h b/dll/win32/usp10/precomp.h
new file mode 100644
index 0000000000..00da1b9083
--- /dev/null
+++ b/dll/win32/usp10/precomp.h
@@ -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_ */
diff --git a/dll/win32/usp10/shape.c b/dll/win32/usp10/shape.c
index 946eba31bd..ca084e7285 100644
--- a/dll/win32/usp10/shape.c
+++ b/dll/win32/usp10/shape.c
@@ -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
diff --git a/dll/win32/usp10/shaping.c b/dll/win32/usp10/shaping.c
index 4a5d4c9469..82435ff2c3 100644
--- a/dll/win32/usp10/shaping.c
+++ b/dll/win32/usp10/shaping.c
@@ -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 },
diff --git a/dll/win32/usp10/usp10.c b/dll/win32/usp10/usp10.c
index abc40fc891..fe83722053 100644
--- a/dll/win32/usp10/usp10.c
+++ b/dll/win32/usp10/usp10.c
@@ -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)
diff --git a/dll/win32/usp10/usp10_internal.h b/dll/win32/usp10/usp10_internal.h
index c0e28d542c..22295132bb 100644
--- a/dll/win32/usp10/usp10_internal.h
+++ b/dll/win32/usp10/usp10_internal.h
@@ -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_ */
diff --git a/media/doc/README.WINE b/media/doc/README.WINE
index 48f62c6a60..d9e9e13644 100644
--- a/media/doc/README.WINE
+++ b/media/doc/README.WINE
@@ -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