X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Futil%2Fbio.c;h=62f4904f7d19367ab973161cbbaaf6e56551f045;hb=82e765caeb53a1de54676738169dab98ca76c47e;hp=0ac588c3a97fb1d6703f405468e6510619cf9369;hpb=f27338992f0a5915ee974faea05f764c2df6f584;p=oweals%2Fgnunet.git diff --git a/src/util/bio.c b/src/util/bio.c index 0ac588c3a..62f4904f7 100644 --- a/src/util/bio.c +++ b/src/util/bio.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2006, 2009, 2013 Christian Grothoff (and other contributing authors) + Copyright (C) 2006, 2009, 2013 GNUnet e.V. GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -23,11 +23,18 @@ * @author Christian Grothoff */ #include "platform.h" -#include "gnunet_bio_lib.h" -#include "gnunet_disk_lib.h" +#include "gnunet_util_lib.h" #define LOG(kind,...) GNUNET_log_from (kind, "util",__VA_ARGS__) +#ifndef PATH_MAX +/** + * Assumed maximum path length (for source file names). + */ +#define PATH_MAX 4096 +#endif + + /** * Size for I/O buffers. */ @@ -155,7 +162,7 @@ GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, { if (min > len - pos) min = len - pos; - memcpy (&dst[pos], &h->buffer[h->pos], min); + GNUNET_memcpy (&dst[pos], &h->buffer[h->pos], min); h->pos += min; pos += min; } @@ -205,7 +212,7 @@ GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, void *result, size_t len) { - char what[1024]; + char what[PATH_MAX + 1024]; GNUNET_snprintf (what, sizeof (what), "%s:%d", file, line); return GNUNET_BIO_read (h, what, result, len); @@ -481,7 +488,7 @@ GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, const void *buffer, min = h->size - h->have; if (min > n - pos) min = n - pos; - memcpy (&h->buffer[h->have], &src[pos], min); + GNUNET_memcpy (&h->buffer[h->have], &src[pos], min); pos += min; h->have += min; if (pos == n)