103. [func] libisc buffer API changes for <isc/buffer.h>:

Added:
                                isc_buffer_base(b)          (pointer)
                                isc_buffer_current(b)       (pointer)
                                isc_buffer_active(b)        (pointer)
                                isc_buffer_used(b)          (pointer)
                                isc_buffer_length(b)            (int)
                                isc_buffer_usedlength(b)        (int)
                                isc_buffer_consumedlength(b)    (int)
                                isc_buffer_remaininglength(b)   (int)
                                isc_buffer_activelength(b)      (int)
                                isc_buffer_availablelength(b)   (int)
                        Removed:
                                ISC_BUFFER_USEDCOUNT(b)
                                ISC_BUFFER_AVAILABLECOUNT(b)
                                isc_buffer_type(b)
                        Changed names:
                                isc_buffer_used(b, r) ->
                                        isc_buffer_usedregion(b, r)
                                isc_buffer_available(b, r) ->
                                        isc_buffer_available_region(b, r)
                                isc_buffer_consumed(b, r) ->
                                        isc_buffer_consumedregion(b, r)
                                isc_buffer_active(b, r) ->
                                        isc_buffer_activeregion(b, r)
                                isc_buffer_remaining(b, r) ->
                                        isc_buffer_remainingregion(b, r)

                        Buffer types were removed, so the ISC_BUFFERTYPE_*
                        macros are no more, and the type argument to
                        isc_buffer_init and isc_buffer_allocate were removed.
                        isc_buffer_putstr is now void (instead of isc_result_t)
                        and requires that the caller ensure that there
                        is enough available buffer space for the string.
This commit is contained in:
David Lawrence
2000-04-27 00:03:12 +00:00
parent ace0c1b3f4
commit 6e49e91bd0
133 changed files with 1165 additions and 1400 deletions

View File

@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: auth.c,v 1.2 2000/03/14 20:00:37 tale Exp $ */
/* $Id: auth.c,v 1.3 2000/04/27 00:03:07 tale Exp $ */
/* Principal Author: DCL */
@@ -129,8 +129,7 @@ auth_makekey(const char *name, unsigned int algorithm, dst_key_t **key) {
secret_len = strlen(auth->secret);
isc_buffer_init(&secret, auth->secret, secret_len,
ISC_BUFFERTYPE_GENERIC);
isc_buffer_init(&secret, auth->secret, secret_len);
isc_buffer_add(&secret, secret_len);

View File

@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: connection.c,v 1.19 2000/04/17 19:22:43 explorer Exp $ */
/* $Id: connection.c,v 1.20 2000/04/27 00:03:08 tale Exp $ */
/* Principal Author: DCL */
@@ -522,13 +522,11 @@ connect_toserver(omapi_object_t *protocol, const char *server_name, int port) {
if (result != ISC_R_SUCCESS)
return (result);
result = isc_buffer_allocate(omapi_mctx, &ibuffer, OMAPI_BUFFER_SIZE,
ISC_BUFFERTYPE_BINARY);
result = isc_buffer_allocate(omapi_mctx, &ibuffer, OMAPI_BUFFER_SIZE);
if (result != ISC_R_SUCCESS)
goto free_task;
result = isc_buffer_allocate(omapi_mctx, &obuffer, OMAPI_BUFFER_SIZE,
ISC_BUFFERTYPE_BINARY);
result = isc_buffer_allocate(omapi_mctx, &obuffer, OMAPI_BUFFER_SIZE);
if (result != ISC_R_SUCCESS)
goto free_ibuffer;
@@ -654,8 +652,7 @@ omapi_connection_putmem(omapi_object_t *c, unsigned char *src,
*/
buffer = NULL;
result = isc_buffer_allocate(omapi_mctx, &buffer,
OMAPI_BUFFER_SIZE,
ISC_BUFFERTYPE_BINARY);
OMAPI_BUFFER_SIZE);
if (result != ISC_R_SUCCESS)
return (result);
@@ -672,7 +669,7 @@ omapi_connection_putmem(omapi_object_t *c, unsigned char *src,
for (buffer = ISC_LIST_HEAD(bufferlist); len > 0;
buffer = ISC_LIST_NEXT(buffer, link)) {
space_available = ISC_BUFFER_AVAILABLECOUNT(buffer);
space_available = isc_buffer_availablelength(buffer);
if (space_available > len)
space_available = len;
@@ -852,7 +849,7 @@ connection_require(omapi_connection_t *connection, unsigned int bytes) {
/*
* Lop off any completely used buffers, except the last one.
*/
while (ISC_BUFFER_AVAILABLECOUNT(buffer) == 0 &&
while (isc_buffer_availablelength(buffer) == 0 &&
buffer != ISC_LIST_TAIL(bufferlist)) {
ISC_LIST_UNLINK(bufferlist, buffer, link);
@@ -876,8 +873,7 @@ connection_require(omapi_connection_t *connection, unsigned int bytes) {
buffer = NULL;
result = isc_buffer_allocate(omapi_mctx, &buffer,
OMAPI_BUFFER_SIZE,
ISC_BUFFERTYPE_BINARY);
OMAPI_BUFFER_SIZE);
if (result != ISC_R_SUCCESS)
return (result);

View File

@@ -173,14 +173,12 @@ listener_accept(isc_task_t *task, isc_event_t *event) {
goto free_task;
ibuffer = NULL;
result = isc_buffer_allocate(omapi_mctx, &ibuffer, OMAPI_BUFFER_SIZE,
ISC_BUFFERTYPE_BINARY);
result = isc_buffer_allocate(omapi_mctx, &ibuffer, OMAPI_BUFFER_SIZE);
if (result != ISC_R_SUCCESS)
goto free_ibuffer;
obuffer = NULL;
result = isc_buffer_allocate(omapi_mctx, &obuffer, OMAPI_BUFFER_SIZE,
ISC_BUFFERTYPE_BINARY);
result = isc_buffer_allocate(omapi_mctx, &obuffer, OMAPI_BUFFER_SIZE);
if (result != ISC_R_SUCCESS)
goto free_obuffer;

View File

@@ -713,8 +713,7 @@ protocol_setvalue(omapi_object_t *h, omapi_string_t *name, omapi_data_t *value)
if (result == ISC_R_SUCCESS)
result = isc_buffer_allocate(omapi_mctx,
&p->signature_out,
sigsize,
ISC_BUFFERTYPE_GENERIC);
sigsize);
if (result != ISC_R_SUCCESS) {
if (p->key != NULL)