aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-08-03 16:33:54 +0200
committerChristian Grothoff <christian@grothoff.org>2020-08-03 16:34:02 +0200
commita899a94dccabeae11ccef5565751a9ace2f6cd01 (patch)
treeae8df41fd302ecf9a68894e48e798a166505d8e1 /src
parentbb2d8ad5c542135e515252d20a235b166ae20d97 (diff)
downloadgnunet-a899a94dccabeae11ccef5565751a9ace2f6cd01.tar.gz
gnunet-a899a94dccabeae11ccef5565751a9ace2f6cd01.zip
fix type
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_buffer_lib.h6
-rw-r--r--src/util/buffer.c21
2 files changed, 14 insertions, 13 deletions
diff --git a/src/include/gnunet_buffer_lib.h b/src/include/gnunet_buffer_lib.h
index 046aee72b..0c566df75 100644
--- a/src/include/gnunet_buffer_lib.h
+++ b/src/include/gnunet_buffer_lib.h
@@ -116,12 +116,12 @@ GNUNET_buffer_write_str (struct GNUNET_Buffer *buf, const char *str);
116 * 116 *
117 * @param buf buffer to write to 117 * @param buf buffer to write to
118 * @param data data to read from 118 * @param data data to read from
119 * @param len number of bytes to copy from @a data to @a buf 119 * @param data_len number of bytes to copy from @a data to @a buf
120 */ 120 */
121void 121void
122GNUNET_buffer_write_data_encoded (struct GNUNET_Buffer *buf, 122GNUNET_buffer_write_data_encoded (struct GNUNET_Buffer *buf,
123 const char *data, 123 const void *data,
124 size_t len); 124 size_t data_len);
125 125
126 126
127/** 127/**
diff --git a/src/util/buffer.c b/src/util/buffer.c
index 8fb10c2a5..662e4d0f2 100644
--- a/src/util/buffer.c
+++ b/src/util/buffer.c
@@ -32,7 +32,8 @@
32 * @param capacity the capacity (in bytes) to allocate for @a buf 32 * @param capacity the capacity (in bytes) to allocate for @a buf
33 */ 33 */
34void 34void
35GNUNET_buffer_prealloc (struct GNUNET_Buffer *buf, size_t capacity) 35GNUNET_buffer_prealloc (struct GNUNET_Buffer *buf,
36 size_t capacity)
36{ 37{
37 /* Buffer should be zero-initialized */ 38 /* Buffer should be zero-initialized */
38 GNUNET_assert (0 == buf->mem); 39 GNUNET_assert (0 == buf->mem);
@@ -257,25 +258,25 @@ GNUNET_buffer_write_vfstr (struct GNUNET_Buffer *buf,
257 * 258 *
258 * @param buf buffer to write to 259 * @param buf buffer to write to
259 * @param data data to read from 260 * @param data data to read from
260 * @param len number of bytes to copy from @a data to @a buf 261 * @param data_len number of bytes to copy from @a data to @a buf
261 */ 262 */
262void 263void
263GNUNET_buffer_write_data_encoded (struct GNUNET_Buffer *buf, 264GNUNET_buffer_write_data_encoded (struct GNUNET_Buffer *buf,
264 const char *data, 265 const void *data,
265 size_t len) 266 size_t data_len)
266{ 267{
267 size_t outlen = len * 8; 268 size_t outlen = data_len * 8;
268 269
269 if (outlen % 5 > 0) 270 if (outlen % 5 > 0)
270 outlen += 5 - outlen % 5; 271 outlen += 5 - outlen % 5;
271 outlen /= 5; 272 outlen /= 5;
272 273 GNUNET_buffer_ensure_remaining (buf,
273 GNUNET_buffer_ensure_remaining (buf, outlen); 274 outlen);
274 GNUNET_assert (NULL != 275 GNUNET_assert (NULL !=
275 GNUNET_STRINGS_data_to_string (data, 276 GNUNET_STRINGS_data_to_string (data,
276 len, 277 data_len,
277 (buf->mem + 278 (buf->mem
278 buf->position), 279 + buf->position),
279 outlen)); 280 outlen));
280 buf->position += outlen; 281 buf->position += outlen;
281 GNUNET_assert (buf->position <= buf->capacity); 282 GNUNET_assert (buf->position <= buf->capacity);