memcache/command.c
changeset 48 1c67f512779b
parent 46 8a832c0e01ee
--- a/memcache/command.c	Thu Aug 28 03:14:07 2008 +0300
+++ b/memcache/command.c	Fri Aug 29 23:31:17 2008 +0300
@@ -62,7 +62,7 @@
     return -1;
 }
 
-int memcache_cmd_format_header (struct evbuffer *buf, enum memcache_command cmd_type, struct memcache_key *key, struct memcache_obj *obj) {
+int memcache_cmd_format_header (struct evbuffer *buf, enum memcache_command cmd_type, const struct memcache_key *key, const struct memcache_obj *obj) {
     char *cmd_name;
 
     // valid command
@@ -80,7 +80,7 @@
             assert(key != NULL && obj == NULL);
             assert(key->len > 0 && key->buf != NULL);
 
-            if (evbuffer_add_printf(buf, "%s %*s\r\n", cmd_name, (int) key->len, key->buf) == -1)
+            if (evbuffer_add_printf(buf, "%s %.*s\r\n", cmd_name, (int) key->len, key->buf) == -1)
                 ERROR("evbuffer_add_printf");
 
             break;
@@ -94,7 +94,7 @@
             assert(key->len > 0 && key->buf != NULL);
             // XXX: ensure that we have a valid buf
 
-            if (evbuffer_add_printf(buf, "%s %*s %u %lu %zu\r\n", cmd_name, (int) key->len, key->buf, obj->flags, obj->exptime, obj->bytes) == -1)
+            if (evbuffer_add_printf(buf, "%s %.*s %u %lu %zu\r\n", cmd_name, (int) key->len, key->buf, obj->flags, obj->exptime, obj->bytes) == -1)
                 ERROR("evbuffer_add_printf");
 
             break;