Bug 6288

Summary: HEAD build broken 12/29/2005
Product: WebKit Reporter: Mark Dalrymple <markd>
Component: WebKit APIAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Blocker    
Priority: P1    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
Fetch previous character from the buffer instead of using uninitialized ch eric: review+

Description Mark Dalrymple 2005-12-29 12:50:33 PST
MacDome on IRC suggested I submit this as a bug.

I did a fresh webkit checkout and build.  I received these errors:

cc1obj: warnings being treated as errors
/Users/mdalrymple/Projects/webkit/WebKit/WebCoreSupport.subproj/WebTextRenderer.m: In function 
'overrideLayoutOperation':
/Users/mdalrymple/Projects/webkit/WebKit/WebCoreSupport.subproj/WebTextRenderer.m:242: 
warning: 'ch' may be used uninitialized \
in this function
{standard input}:4536:non-relocatable subtraction expression, "_overrideLayoutOperation" minus 
"L00000000015$pb"
{standard input}:4536:symbol: "_overrideLayoutOperation" can't be undefined in a subtraction 
expression
{standard input}:4530:non-relocatable subtraction expression, "_overrideLayoutOperation" minus 
"L00000000015$pb"
{standard input}:4530:symbol: "_overrideLayoutOperation" can't be undefined in a subtraction 
expression
** BUILD FAILED **

By hacking the file locally and setting 'ch = 0' on line 242 lets the compile progress past this point.
Comment 1 Eric Seidel (no email) 2005-12-29 12:51:27 PST
Caused by:
http://bugzilla.opendarwin.org/show_bug.cgi?id=3922
Comment 2 mitz 2005-12-29 13:10:03 PST
Sorry!

I think ch shouldn't be used there, but rather the check should be
                    if (offset != 0 && !isSpace(*(UniChar *)(((char *)characters) + offset - 1)) && style-
>wordSpacing)

I'm going to compile and test this change right away.
Comment 3 mitz 2005-12-29 13:48:05 PST
Created attachment 5356 [details]
Fetch previous character from the buffer instead of using uninitialized ch

The funny pointer math is required because offset is given in bytes, and I
think it's neater to use "-1" rather than "-2" since it's 1 UniChar behind.
Comment 4 Eric Seidel (no email) 2005-12-29 14:11:34 PST
Comment on attachment 5356 [details]
Fetch previous character from the buffer instead of using uninitialized ch

Yes, this fixes the bug.  And I'll trust mitz on the correctness of the logic
here.  r=me.