Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: include/opentype-sanitiser.h

Issue 9117014: Use memcpy() instead of violating strict-aliasing rules. (Closed) Base URL: http://ots.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/opentype-sanitiser.h
===================================================================
--- include/opentype-sanitiser.h (revision 79)
+++ include/opentype-sanitiser.h (working copy)
@@ -57,8 +57,9 @@
}
if (chksum_buffer_offset_ == 4) {
- // TODO(yusukes): This cast breaks the strict-aliasing rule.
- chksum_ += ntohl(*reinterpret_cast<const uint32_t*>(chksum_buffer_));
+ uint32_t chksum;
+ std::memcpy(&chksum, chksum_buffer_, 4);
+ chksum_ += ntohl(chksum);
chksum_buffer_offset_ = 0;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698