Reviewers: Kasper Lund,

Description:
Fix warning from Windows about loss of data in cast-less assignment.

Please review this at http://codereview.chromium.org/7865

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
   M     src/utils.h


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++);
    }
  }




--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to