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

Unified Diff: src/utils.h

Issue 7865: Fix warning from Windows about loss of data in cast-less assignment. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 2 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: src/utils.h
===================================================================
--- src/utils.h (revision 549)
+++ src/utils.h (working copy)
@@ -448,7 +448,11 @@
template <typename sourcechar, typename sinkchar>
static inline void CopyChars(sinkchar* dest, const sourcechar* src, int chars) {
while (chars--) {
- *dest++ = *src++;
+ // We have to have a cast here, otherwise MSVC complains about a possible
+ // loss of data when sourcechar is 16 bit and sinkchar is 8 bit. But we
+ // can't have a reinterpret cast because gcc doesn't like a reinterpret_cast
+ // that doesn't change the type.
+ *dest++ = (sinkchar)(*src++);
}
}
« 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