/**
* Size for I/O buffers.
- */
+ */
#define BIO_BUFFER_SIZE 65536
/**
* @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
*/
int
-GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h,
+GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h,
const char *what,
void *result, size_t len)
{
if (0 == ret)
{
GNUNET_asprintf (&h->emsg,
- _("Error reading `%s': %s"),
+ _("Error reading `%s': %s"),
what,
_("End of file"));
return GNUNET_SYSERR;
* @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
*/
int
-GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h,
- const char *file,
+GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h,
+ const char *file,
int line,
- void *result,
+ void *result,
size_t len)
{
char what[1024];
* @param what describes what is being read (for error message creation)
* @param result the buffer to store a pointer to the (allocated) string to
* (note that *result could be set to NULL as well)
- * @param maxLen maximum allowed length for the string
+ * @param max_length maximum allowed length for the string
* @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
*/
int
-GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, const char *what,
- char **result, size_t maxLen)
+GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h,
+ const char *what,
+ char **result,
+ size_t max_length)
{
char *buf;
uint32_t big;
*result = NULL;
return GNUNET_OK;
}
- if (big > maxLen)
+ if (big > max_length)
{
GNUNET_asprintf (&h->emsg, _("String `%s' longer than allowed (%u > %u)"),
- what, big, maxLen);
+ what, big, max_length);
return GNUNET_SYSERR;
}
buf = GNUNET_malloc (big);
* @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
*/
int
-GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, const char *what,
+GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h,
+ const char *what,
struct GNUNET_CONTAINER_MetaData **result)
{
uint32_t size;
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
int
-GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h,
+GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h,
const char *file,
- int line, int64_t * i)
+ int line,
+ int64_t *i)
{
int64_t big;
* Underlying file handle.
*/
struct GNUNET_DISK_FileHandle *fd;
-
+
/**
* I/O buffer. Do not free, allocated at the end of the struct.
*/
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
int
-GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h,
+GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h,
const char *s)
{
uint32_t slen;
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
int
-GNUNET_BIO_write_int32 (struct GNUNET_BIO_WriteHandle *h,
+GNUNET_BIO_write_int32 (struct GNUNET_BIO_WriteHandle *h,
int32_t i)
{
int32_t big;
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
int
-GNUNET_BIO_write_int64 (struct GNUNET_BIO_WriteHandle *h,
+GNUNET_BIO_write_int64 (struct GNUNET_BIO_WriteHandle *h,
int64_t i)
{
int64_t big;