kolibrios/programs/network/netsurf/include/parserutils/utils/buffer.h
Dmitry Pereverzev (SoUrcerer) 370da47fa0 Netsurf initial port (still needs native ui and cURL)
git-svn-id: svn://kolibrios.org@3584 a494cfbc-eb01-0410-851d-a64ba20cac60
2013-06-01 17:14:14 +00:00

51 lines
1.2 KiB
C

/*
* This file is part of LibParserUtils.
* Licensed under the MIT License,
* http://www.opensource.org/licenses/mit-license.php
* Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org>
*/
#ifndef parserutils_utils_buffer_h_
#define parserutils_utils_buffer_h_
#ifdef __cplusplus
extern "C"
{
#endif
#include <parserutils/errors.h>
#include <parserutils/functypes.h>
struct parserutils_buffer
{
uint8_t *data;
size_t length;
size_t allocated;
parserutils_alloc alloc;
void *pw;
};
typedef struct parserutils_buffer parserutils_buffer;
parserutils_error parserutils_buffer_create(parserutils_alloc alloc,
void *pw, parserutils_buffer **buffer);
parserutils_error parserutils_buffer_destroy(parserutils_buffer *buffer);
parserutils_error parserutils_buffer_append(parserutils_buffer *buffer,
const uint8_t *data, size_t len);
parserutils_error parserutils_buffer_insert(parserutils_buffer *buffer,
size_t offset, const uint8_t *data, size_t len);
parserutils_error parserutils_buffer_discard(parserutils_buffer *buffer,
size_t offset, size_t len);
parserutils_error parserutils_buffer_grow(parserutils_buffer *buffer);
parserutils_error parserutils_buffer_randomise(parserutils_buffer *buffer);
#ifdef __cplusplus
}
#endif
#endif