Bug 58172

Summary: Fix -Wcast-align warning in WebBasePluginPackage.mm
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: WebKit Misc.Assignee: David Kilzer (:ddkilzer) <ddkilzer>
Severity: Normal CC: andersca, darin, webkit.review.bot, zwarich
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: OS X 10.5   
Description Flags
ddkilzer: review-
Patch v2 andersca: review+

Description David Kilzer (:ddkilzer) 2011-04-08 16:10:58 PDT
Created attachment 88891 [details]

Reviewed by NOBODY (OOPS!).

Fixes the following warning with -Wcast-align enabled:

Source/WebKit/mac/Plugins/WebBasePluginPackage.mm:402:21:{402:21-402:93}{402:39-402:93}: error: cast from 'uint8_t *' (aka 'unsigned char *') to 'struct fat_arch *' increases required alignment from 1 to 4 [-Werror,-Wcast-align,3]
archs = (struct fat_arch*)((uint8_t*)rawData.data() + sizeof(struct fat_header));

* Plugins/WebBasePluginPackage.mm:
(-[WebBasePluginPackage isNativeLibraryData:]): Remove cast to
(uint8_t*).  The rawData Vector uses a type of uint32_t, and
struct fat_header contains two uint32_t data members, so there
is no need to cast to uint8_t* here.
 2 files changed, 19 insertions(+), 1 deletions(-)
Comment 1 WebKit Review Bot 2011-04-08 16:13:46 PDT
Attachment 88891 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit/mac/ChangeLog', u'Source/Web..." exit_code: 1

Source/WebKit/mac/ChangeLog:1:  ChangeLog entry has no bug number  [changelog/bugnumber] [5]
Total errors found: 1 in 2 files

If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 2 David Kilzer (:ddkilzer) 2011-04-08 16:40:17 PDT
Comment on attachment 88891 [details]

Cameron pointed out that my pointer math is incorrect.  New patch forthcoming.
Comment 3 David Kilzer (:ddkilzer) 2011-04-08 17:31:22 PDT
Created attachment 88907 [details]
Patch v2
Comment 4 David Kilzer (:ddkilzer) 2011-04-13 12:31:10 PDT
Committed r83755: <http://trac.webkit.org/changeset/83755>