usp10: Fix dead code in ScriptItemize (Coverity)

Jeff L lats at yless4u.com.au
Fri Oct 13 22:30:09 CDT 2006


Changelog:
Fix dead code in ScriptItemize found by Coverity CID-13

Jeff Latimer
-------------- next part --------------
>From f775319d7edad5557409f8532cdb748f12bb90f2 Mon Sep 17 00:00:00 2001
From: Jeff Latimer <lats at yless4u.com.au>
Date: Sat, 14 Oct 2006 13:23:27 +1000
Subject: [PATCH] usp10: Fix dead code in ScriptItemize
To: wine-patches <wine-patches at winehq.org>
---
 dlls/usp10/tests/usp10.c |   13 ++++++++++++-
 dlls/usp10/usp10.c       |    2 +-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c
index 378bf68..31df9c7 100644
--- a/dlls/usp10/tests/usp10.c
+++ b/dlls/usp10/tests/usp10.c
@@ -46,7 +46,8 @@ static void test_ScriptItemIzeShapePlace
     WCHAR           TestItem1[] = {'T', 'e', 's', 't', 'a', 0}; 
     WCHAR           TestItem2[] = {'T', 'e', 's', 't', 'b', 0}; 
     WCHAR           TestItem3[] = {'T', 'e', 's', 't', 'c',' ','1','2','3',' ',' ','e','n','d',0}; 
-    WCHAR           TestItem4[] = {'T', 'e', 's', 't', 'c',' ',0x0684,0x0694,0x06a4,' ',' ','e','n','d',0}; 
+    WCHAR           TestItem4[] = {'T', 'e', 's', 't', 'c',' ',0x0684,0x0694,0x06a4,' ',' ','e','n','d',0};
+    WCHAR           TestItem5[] = {0x0684,'T','e','s','t','c',' ',0x0684,0x0694,0x06a4,' ',' ','e','n','d',0}; 
 
     SCRIPT_CACHE    psc;
     int             cChars;
@@ -243,6 +244,16 @@ static void test_ScriptItemIzeShapePlace
         hr = ScriptFreeCache( &psc);
         ok (!psc, "psc is not null after ScriptFreeCache\n");
     }
+
+    /*
+     * This test is for when the first unicode character requires bidi support
+     */ 
+    cInChars = (sizeof(TestItem5)-1)/sizeof(WCHAR);
+    hr = ScriptItemize(TestItem5, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems);
+    ok (hr == 0, "ScriptItemize should return 0, returned %08x\n", hr);
+    ok (pcItems == 4, "There should have been 4 items, found %d\n", pcItems);
+    ok (pItem[0].a.s.uBidiLevel == 1, "The first character should have been bidi=1 not %d\n", 
+                                       pItem[0].a.s.uBidiLevel);
 }
 
 void test_ScriptGetCMap(HDC hdc, unsigned short pwOutGlyphs[256])
diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index 6a52933..9fd6c1e 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -326,7 +326,7 @@ #define Script_Numeric 5
     pItems[index].a.fLogicalOrder = 0;
     pItems[index].a.fNoGlyphIndex = 0;
     /*  set the SCRIPT_STATE                                */
-    if  (New_Script == Script_Arabic)
+    if  (pItems[index].a.eScript  == Script_Arabic)
         pItems[index].a.s.uBidiLevel = 1;
     else
         pItems[index].a.s.uBidiLevel = 0;
-- 
1.4.1



More information about the wine-patches mailing list