This fixes lp:1010899, which showed a condition where we could end up with a bad...
[m6w6/libmemcached] / libmemcached / auto.cc
index df4ceb2fd2f1025f5415e05e3a05675a821570ee..adce334873fe69b15bc0abe8ec6abfe195d313ec 100644 (file)
@@ -83,7 +83,7 @@ static memcached_return_t text_incr_decr(memcached_server_write_instance_st inst
     { memcached_literal_param("incr ") },
     { memcached_array_string(instance->root->_namespace), memcached_array_size(instance->root->_namespace) },
     { key, key_length },
-    { buffer, send_length },
+    { buffer, size_t(send_length) },
     { " noreply", reply ? 0 : memcached_literal_param_size(" noreply") },
     { memcached_literal_param("\r\n") }
   };
@@ -118,7 +118,8 @@ static memcached_return_t binary_incr_decr(memcached_server_write_instance_st in
   }
   protocol_binary_request_incr request= {}; // = {.bytes= {0}};
 
-  request.message.header.request.magic= PROTOCOL_BINARY_REQ;
+  initialize_binary_request(instance, request.message.header);
+
   request.message.header.request.opcode= cmd;
   request.message.header.request.keylen= htons((uint16_t)(key_length + memcached_array_size(instance->root->_namespace)));
   request.message.header.request.extlen= 20;