diff --git a/utils/src/hdf_block_buffer.c b/utils/src/hdf_block_buffer.c index 1c61c57b495776b0c7846edf337df034d22342c6..2aea8f22be27b129689a1a98870b815c25110aa7 100644 --- a/utils/src/hdf_block_buffer.c +++ b/utils/src/hdf_block_buffer.c @@ -7,9 +7,9 @@ */ #include "hdf_block_buffer.h" -#include "osal_mem.h" +#include -static const unsigned int OFFSET = 8; +#define NUM 8 struct HdfHdfBlockBuffer *HdfHdfBlockBufferNew(const uint8_t *data, uint16_t size) { @@ -38,14 +38,14 @@ void HdfBlockBufferFree(const struct HdfBlockBuffer *buffer) } } -uint16_t HdfBlockBufferGetDataSize(struct HdfBlockBuffer *buffer) +uint16_t HdfBlockBufferGetDataSize(const struct HdfBlockBuffer *buffer) { return (buffer == NULL) ? 0 : buffer->dataSize; } uint16_t HdfBlockBufferGetAvailableSize(struct HdfBlockBuffer *buffer) { - return (buffer == NULL) ? 0 : (buffer->dataSize - buffer->position); + return (buffer == NULL) ? 0 : ((buffer->dataSize) - (buffer->position)); } uint8_t *HdfBlockBufferRead(struct HdfBlockBuffer *buffer, uint16_t size) @@ -158,8 +158,8 @@ bool HdfBlockBufferWriteUint16(struct HdfBlockBuffer *buffer, uint16_t inValue) return false; } if (buffer->position + BYTES_UINT16 <= buffer->dataSize) { - buffer->data[buffer->position++] = (uint8_t) (inValue >> OFFSET); - buffer->data[buffer->position++] = (uint8_t) (inValue & 0xFF); + buffer->data[buffer->position++] = (uint8_t) (in_value >> NUM); + buffer->data[buffer->position++] = (uint8_t) (in_value & 0xFF); return true; } return false; diff --git a/utils/src/hdf_object_alloc.c b/utils/src/hdf_object_alloc.c index c923d4936f6bf418b7068eb639ac2d3cedcbf0e2..560a3bb36a2b03b08a04c5caa37824c1ebb318a4 100644 --- a/utils/src/hdf_object_alloc.c +++ b/utils/src/hdf_object_alloc.c @@ -6,9 +6,8 @@ * See the LICENSE file in the root of this repository for complete details. */ -#include "hdf_base.h" -#include "hdf_object_alloc.h" #include "hdf_slist.h" +#include "object_alloc.h" #include "osal_mutex.h" struct HdfChunkLink { @@ -30,8 +29,7 @@ struct HdfObjectAlloc { bool isConstructed; }; static const unsigned int ALIGN_MASK = 3; -#define ALIGN4(x) (uint32_t)(((uintptr_t)(x) + ALIGN_MASK) & (~ALIGN_MASK)) - +#define ALIGN4(x) (uint32_t)((((uintptr_t)(x)) + ALIGN_MASK) & (~ALIGN_MASK)) #define OBJECT_NODE_SIZE sizeof(struct ObjectNode) #define OBJECT_CHUNK_COOKIE_SIZE (sizeof(struct ChunkLink) + sizeof(void *)) diff --git a/utils/src/hdf_ordered_list.c b/utils/src/hdf_ordered_list.c index 3f45ac33b4cad3f717a2b9a1d8cbc6685bb0503e..8cf6dbeee582a0f231d0aa1445d8c6f02f23faab 100644 --- a/utils/src/hdf_ordered_list.c +++ b/utils/src/hdf_ordered_list.c @@ -84,8 +84,8 @@ long HdfOrderedListPeekKey(struct HdfOrderedList *list) return orderedKey; } -struct HdfOrderedListEntity *HdfOrderedListFetch( - struct HdfOrderedList *list, long matchKey, HdfOrderedListComparer comparer) +struct HdfOrderedListEntity *HdfOrderedListFetch(const struct HdfOrderedList *list, long matchKey, + HdfOrderedListComparer comparer) { struct HdfSListIterator it; struct HdfOrderedListEntity *matchEntity = NULL;