From 85999c7e5ff702be9e0c983bf3f5307426031d44 Mon Sep 17 00:00:00 2001 From: David Raynor Date: Thu, 3 Oct 2013 15:05:40 -0400 Subject: [PATCH] bb #1570: replacing void * type in ADC, fewer casts --- libclamav/adc.c | 20 ++++++++++---------- libclamav/adc.h | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libclamav/adc.c b/libclamav/adc.c index 915704076..06290db84 100644 --- a/libclamav/adc.c +++ b/libclamav/adc.c @@ -52,7 +52,7 @@ int adc_decompressInit(adc_stream *strm) } /* Have to buffer maximum backward lookup */ - strm->buffer = calloc(ADC_BUFF_SIZE, 1); + strm->buffer = (uint8_t *)calloc(ADC_BUFF_SIZE, 1); if (strm->buffer == NULL) { return ADC_MEM_ERROR; } @@ -110,7 +110,7 @@ int adc_decompress(adc_stream *strm) switch (strm->state) { case ADC_STATE_GETTYPE: { /* Grab action code */ - bData = *(uint8_t *)(strm->next_in); + bData = *(strm->next_in); strm->next_in++; strm->avail_in--; if (bData & 0x80) { @@ -134,7 +134,7 @@ int adc_decompress(adc_stream *strm) } case ADC_STATE_LONGOP2: { /* Grab first offset byte */ - bData = *(uint8_t *)(strm->next_in); + bData = *(strm->next_in); strm->next_in++; strm->avail_in--; strm->offset = bData * 0x100; @@ -145,7 +145,7 @@ int adc_decompress(adc_stream *strm) } case ADC_STATE_LONGOP1: { /* Grab second offset byte */ - bData = *(uint8_t *)(strm->next_in); + bData = *(strm->next_in); strm->next_in++; strm->avail_in--; strm->offset += bData + 1; @@ -156,7 +156,7 @@ int adc_decompress(adc_stream *strm) } case ADC_STATE_SHORTOP: { /* Grab offset byte */ - bData = *(uint8_t *)(strm->next_in); + bData = *(strm->next_in); strm->next_in++; strm->avail_in--; strm->offset += bData + 1; @@ -170,18 +170,18 @@ int adc_decompress(adc_stream *strm) /* Grab data */ adc_dbgmsg("adc_decompress: RAWDATA offset %u length %u\n", strm->offset, strm->length); while ((strm->avail_in > 0) && (strm->avail_out > 0) && (strm->length > 0)) { - bData = *(uint8_t *)(strm->next_in); + bData = *(strm->next_in); strm->next_in++; strm->avail_in--; /* store to output */ - *(uint8_t *)(strm->next_out) = bData; + *(strm->next_out) = bData; strm->next_out++; strm->avail_out--; /* store to buffer */ if (strm->curr >= (strm->buffer + ADC_BUFF_SIZE)) { strm->curr = strm->buffer; } - *(uint8_t *)strm->curr = bData; + *(strm->curr) = bData; strm->curr++; if (strm->buffered < ADC_BUFF_SIZE) { strm->buffered++; @@ -226,11 +226,11 @@ int adc_decompress(adc_stream *strm) bData = *(uint8_t *)(strm->curr + ADC_BUFF_SIZE - strm->offset); } /* store to output */ - *(uint8_t *)(strm->next_out) = bData; + *(strm->next_out) = bData; strm->next_out++; strm->avail_out--; /* store to buffer */ - *(uint8_t *)strm->curr = bData; + *(strm->curr) = bData; strm->curr++; if (strm->buffered < ADC_BUFF_SIZE) { strm->buffered++; diff --git a/libclamav/adc.h b/libclamav/adc.h index 2a0eda104..f63b74a8f 100644 --- a/libclamav/adc.h +++ b/libclamav/adc.h @@ -4,11 +4,11 @@ #define CLAM_ADC_H struct adc_stream { - void *next_in; + uint8_t *next_in; size_t avail_in; size_t total_in; - void *next_out; + uint8_t *next_out; size_t avail_out; size_t total_out;