]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/spirit/home/support/utree/detail/utree_detail2.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / spirit / home / support / utree / detail / utree_detail2.hpp
index cc3cb2fd4334797ef3cb07c9d6ee189fffe80747..ef309d343be9a44c581331e82ac1413b1a23bbe9 100644 (file)
@@ -19,6 +19,7 @@
 #include <boost/utility/enable_if.hpp>
 #include <boost/throw_exception.hpp>
 #include <boost/iterator/iterator_traits.hpp>
+#include <cstring> // for std::memcpy
 
 namespace boost { namespace spirit { namespace detail
 {
@@ -44,13 +45,15 @@ namespace boost { namespace spirit { namespace detail
 
     inline short fast_string::tag() const
     {
-        return (int(buff[small_string_size-2]) << 8) + (unsigned char)buff[small_string_size-1];
+        boost::int16_t tmp;
+        std::memcpy(&tmp, &buff[small_string_size-2], sizeof(tmp));
+        return tmp;
     }
 
     inline void fast_string::tag(short tag)
     {
-        buff[small_string_size-2] = tag >> 8;
-        buff[small_string_size-1] = tag & 0xff;
+        boost::int16_t tmp = tag;
+        std::memcpy(&buff[small_string_size-2], &tmp, sizeof(tmp));
     }
 
     inline bool fast_string::is_heap_allocated() const
@@ -931,11 +934,11 @@ namespace boost { namespace spirit
         return *this;
     }
 
-    inline utree& utree::operator=(any_ptr const& p)
+    inline utree& utree::operator=(any_ptr const& p_)
     {
         free();
-        v.p = p.p;
-        v.i = p.i;
+        v.p = p_.p;
+        v.i = p_.i;
         set_type(type::any_type);
         return *this;
     }