Hans Leidekker : usp10:
Reduce multiple assignments to a single memset in ScriptItemize.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Dec 26 06:49:31 CST 2006
Module: wine
Branch: master
Commit: d2f213013ec382da2bae32ee6dc324c4177e7786
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d2f213013ec382da2bae32ee6dc324c4177e7786
Author: Hans Leidekker <hans at it.vu.nl>
Date: Sun Dec 24 12:37:36 2006 +0100
usp10: Reduce multiple assignments to a single memset in ScriptItemize.
---
dlls/usp10/usp10.c | 76 ++++++++-------------------------------------------
1 files changed, 12 insertions(+), 64 deletions(-)
diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index 99b057e..a630622 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -412,6 +412,9 @@ HRESULT WINAPI ScriptItemize(const WCHAR
if (!pwcInChars || !cInChars || !pItems || cMaxItems < 2)
return E_INVALIDARG;
+ pItems[index].iCharPos = 0;
+ memset(&pItems[index].a, 0, sizeof(SCRIPT_ANALYSIS));
+
if (pwcInChars[cnt] >= Numeric_start && pwcInChars[cnt] <= Numeric_stop)
pItems[index].a.eScript = Script_Numeric;
else
@@ -420,31 +423,10 @@ HRESULT WINAPI ScriptItemize(const WCHAR
else
if (pwcInChars[cnt] >= Latin_start && pwcInChars[cnt] <= Latin_stop)
pItems[index].a.eScript = Script_Latin;
- else
- pItems[index].a.eScript = SCRIPT_UNDEFINED;
- pItems[index].iCharPos = 0;
- /* Set the SCRIPT_ANALYSIS */
- pItems[index].a.fRTL = 0;
- pItems[index].a.fLayoutRTL = 0;
- pItems[index].a.fLinkBefore = 0;
- pItems[index].a.fLinkAfter = 0;
- pItems[index].a.fLogicalOrder = 0;
- pItems[index].a.fNoGlyphIndex = 0;
- /* set the SCRIPT_STATE */
+
if (pItems[index].a.eScript == Script_Arabic)
pItems[index].a.s.uBidiLevel = 1;
- else
- pItems[index].a.s.uBidiLevel = 0;
- pItems[index].a.s.fOverrideDirection = 0;
- pItems[index].a.s.fInhibitSymSwap = FALSE;
- pItems[index].a.s.fCharShape = 0;
- pItems[index].a.s.fDigitSubstitute = 0;
- pItems[index].a.s.fInhibitLigate = 0;
- pItems[index].a.s.fDisplayZWG = 0;
- pItems[index].a.s.fArabicNumContext = 0;
- pItems[index].a.s.fGcpClusters = 0;
- pItems[index].a.s.fReserved = 0;
- pItems[index].a.s.fEngineReserved = 0;
+
TRACE("New_Script=%d, eScript=%d index=%d cnt=%d iCharPos=%d\n",
New_Script, pItems[index].a.eScript, index, cnt,
pItems[index].iCharPos = cnt);
@@ -470,34 +452,17 @@ HRESULT WINAPI ScriptItemize(const WCHAR
index++;
if (index+1 > cMaxItems)
return E_OUTOFMEMORY;
+
pItems[index].iCharPos = cnt;
+ memset(&pItems[index].a, 0, sizeof(SCRIPT_ANALYSIS));
+
if (New_Script == Script_Arabic)
pItems[index].a.s.uBidiLevel = 1;
- /* Set SCRIPT_ITEM */
- pItems[index].iCharPos = cnt;
- /* Set the SCRIPT_ANALYSIS */
+
pItems[index].a.eScript = New_Script;
- pItems[index].a.fRTL = 0;
- pItems[index].a.fLayoutRTL = 0;
- pItems[index].a.fLinkBefore = 0;
- pItems[index].a.fLinkAfter = 0;
- pItems[index].a.fLogicalOrder = 0;
- pItems[index].a.fNoGlyphIndex = 0;
- /* set the SCRIPT_STATE */
if (New_Script == Script_Arabic)
pItems[index].a.s.uBidiLevel = 1;
- else
- pItems[index].a.s.uBidiLevel = 0;
- pItems[index].a.s.fOverrideDirection = 0;
- pItems[index].a.s.fInhibitSymSwap = FALSE;
- pItems[index].a.s.fCharShape = 0;
- pItems[index].a.s.fDigitSubstitute = 0;
- pItems[index].a.s.fInhibitLigate = 0;
- pItems[index].a.s.fDisplayZWG = 0;
- pItems[index].a.s.fArabicNumContext = 0;
- pItems[index].a.s.fGcpClusters = 0;
- pItems[index].a.s.fReserved = 0;
- pItems[index].a.s.fEngineReserved = 0;
+
TRACE("index=%d cnt=%d iCharPos=%d\n", index, cnt, pItems[index].iCharPos = cnt);
}
}
@@ -505,25 +470,8 @@ HRESULT WINAPI ScriptItemize(const WCHAR
/* While not strictly necessary according to the spec, make sure the n+1
* item is set up to prevent random behaviour if the caller erroneously
* checks the n+1 structure */
- pItems[index+1].a.eScript = 0;
- pItems[index+1].a.fRTL = 0;
- pItems[index+1].a.fLayoutRTL = 0;
- pItems[index+1].a.fLinkBefore = 0;
- pItems[index+1].a.fLinkAfter = 0;
- pItems[index+1].a.fLogicalOrder = 0;
- pItems[index+1].a.fNoGlyphIndex = 0;
- /* set the SCRIPT_STATE */
- pItems[index+1].a.s.uBidiLevel = 0;
- pItems[index+1].a.s.fOverrideDirection = 0;
- pItems[index+1].a.s.fInhibitSymSwap = FALSE;
- pItems[index+1].a.s.fCharShape = 0;
- pItems[index+1].a.s.fDigitSubstitute = 0;
- pItems[index+1].a.s.fInhibitLigate = 0;
- pItems[index+1].a.s.fDisplayZWG = 0;
- pItems[index+1].a.s.fArabicNumContext = 0;
- pItems[index+1].a.s.fGcpClusters = 0;
- pItems[index+1].a.s.fReserved = 0;
- pItems[index+1].a.s.fEngineReserved = 0;
+ memset(&pItems[index+1].a, 0, sizeof(SCRIPT_ANALYSIS));
+
TRACE("index=%d cnt=%d iCharPos=%d\n", index+1, cnt, pItems[index+1].iCharPos = cnt);
/* Set one SCRIPT_STATE item being returned */
More information about the wine-cvs
mailing list