Skip to content
Snippets Groups Projects
Commit 4bc7d979 authored by Jan Kadlec's avatar Jan Kadlec
Browse files

Changed RRSet serialization & deserializtion APIs (int -> size_t).

Refs #976 @15m
parent fe6f7984
No related branches found
No related tags found
No related merge requests found
......@@ -1317,7 +1317,7 @@ static crc_t dnslib_dump_crc; /*!< \brief Global CRC variable. */
* \brief Stream used in serialization - rdata, dname and rrset dump.
*/
static uint8_t *dnslib_dump_stream = NULL;
static int dnslib_dump_stream_size = 0;
static size_t dnslib_dump_stream_size = 0;
static inline int fwrite_to_file_crc(const void *src,
size_t size, size_t n, FILE *fp)
......@@ -1979,7 +1979,7 @@ int dnslib_zdump_binary(dnslib_zone_t *zone, const char *filename,
}
int dnslib_zdump_rrset_serialize(const dnslib_rrset_t *rrset, uint8_t **stream,
int *size)
size_t *size)
{
/*!< \todo LOCK? might not be thread safe. Probably isn't! */
fwrite_wrapper = fwrite_to_stream;
......
......@@ -51,7 +51,7 @@ int dnslib_zdump_binary(dnslib_zone_t *zone, const char *filename,
* \retval DNSLIB_ENOMEM on memory error.
*/
int dnslib_zdump_rrset_serialize(const dnslib_rrset_t *rrset, uint8_t **stream,
int *size);
size_t *size);
#endif /* _DNSLIB_ZONEDUMP_H_ */
......
......@@ -67,13 +67,13 @@ static inline int fread_safe_from_file(void *dst,
}
static uint8_t *dnslib_zload_stream = NULL;
static int dnslib_zload_stream_remaining = 0;
static int dnslib_zload_stream_size = 0;
static size_t dnslib_zload_stream_remaining = 0;
static size_t dnslib_zload_stream_size = 0;
static inline int read_from_stream(void *dst,
size_t size, size_t n, FILE *fp)
{
if (dnslib_zload_stream_remaining - (size * n) < 0) {
if (dnslib_zload_stream_remaining < (size * n)) {
return 0;
}
......@@ -1056,7 +1056,7 @@ void dnslib_zload_close(zloader_t *loader)
free(loader);
}
dnslib_rrset_t *dnslib_zload_rrset_deserialize(uint8_t *stream, int *size)
dnslib_rrset_t *dnslib_zload_rrset_deserialize(uint8_t *stream, size_t *size)
{
if (stream == NULL || size == 0) {
return NULL;
......
......@@ -77,7 +77,7 @@ void dnslib_zload_close(zloader_t *loader);
*
* \return Loaded RRSet on success, NULL otherwise.
*/
dnslib_rrset_t *dnslib_zload_rrset_deserialize(uint8_t *stream, int *size);
dnslib_rrset_t *dnslib_zload_rrset_deserialize(uint8_t *stream, size_t *size);
#endif /* _KNOT_ZONELOAD_H_ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment