aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/src/hal_buffers.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/src/hal_buffers.c')
-rw-r--r--os/hal/src/hal_buffers.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/os/hal/src/hal_buffers.c b/os/hal/src/hal_buffers.c
index a01de2793..68c30c5a4 100644
--- a/os/hal/src/hal_buffers.c
+++ b/os/hal/src/hal_buffers.c
@@ -76,7 +76,7 @@ void ibqObjectInit(input_buffers_queue_t *ibqp, uint8_t *bp,
size_t size, size_t n,
bqnotify_t infy, void *link) {
- osalDbgCheck((ibqp != NULL) && (bp != NULL) && (size >= 2));
+ osalDbgCheck((ibqp != NULL) && (bp != NULL) && (size >= 2U));
osalThreadQueueObjectInit(&ibqp->waiting);
ibqp->bcounter = 0;
@@ -148,7 +148,7 @@ void ibqPostFullBufferI(input_buffers_queue_t *ibqp, size_t size) {
osalDbgCheckClassI();
- osalDbgCheck((size > 0) && (size <= ibqp->bsize - sizeof (size_t)));
+ osalDbgCheck((size > 0U) && (size <= (ibqp->bsize - sizeof (size_t))));
osalDbgAssert(!ibqIsFullI(ibqp), "buffers queue full");
/* Writing size field in the buffer.*/
@@ -314,7 +314,7 @@ msg_t ibqGetTimeout(input_buffers_queue_t *ibqp, systime_t timeout) {
}
/* Next byte from the buffer.*/
- msg = *ibqp->ptr;
+ msg = (msg_t)*ibqp->ptr;
ibqp->ptr++;
/* If the current buffer has been fully read then it is returned as
@@ -396,19 +396,19 @@ size_t ibqReadTimeout(input_buffers_queue_t *ibqp, uint8_t *bp,
}
/* Size of the data chunk present in the current buffer.*/
- size = ibqp->top - ibqp->ptr;
- if (size > n - r) {
+ size = (size_t)ibqp->top - (size_t)ibqp->ptr;
+ if (size > (n - r)) {
size = n - r;
}
/* Smaller chunks in order to not make the critical zone too long,
this impacts throughput however.*/
- if (size > 64) {
+ if (size > 64U) {
/* Giving the compiler a chance to optimize for a fixed size move.*/
- memcpy(bp, ibqp->ptr, 64);
- bp += 64;
- ibqp->ptr += 64;
- r += 64;
+ memcpy(bp, ibqp->ptr, 64U);
+ bp += 64U;
+ ibqp->ptr += 64U;
+ r += 64U;
}
else {
memcpy(bp, ibqp->ptr, size);
@@ -447,7 +447,7 @@ void obqObjectInit(output_buffers_queue_t *obqp, uint8_t *bp,
size_t size, size_t n,
bqnotify_t onfy, void *link) {
- osalDbgCheck((obqp != NULL) && (bp != NULL) && (size >= 2));
+ osalDbgCheck((obqp != NULL) && (bp != NULL) && (size >= 2U));
osalThreadQueueObjectInit(&obqp->waiting);
obqp->bcounter = n;
@@ -635,7 +635,7 @@ void obqPostFullBuffer(output_buffers_queue_t *obqp, size_t size) {
void obqPostFullBufferS(output_buffers_queue_t *obqp, size_t size) {
osalDbgCheckClassS();
- osalDbgCheck((size > 0) && (size <= obqp->bsize - sizeof (size_t)));
+ osalDbgCheck((size > 0U) && (size <= (obqp->bsize - sizeof (size_t))));
osalDbgAssert(!obqIsFullI(obqp), "buffers queue full");
/* Writing size field in the buffer.*/
@@ -774,19 +774,19 @@ size_t obqWriteTimeout(output_buffers_queue_t *obqp, const uint8_t *bp,
}
/* Size of the space available in the current buffer.*/
- size = obqp->top - obqp->ptr;
- if (size > n - w) {
+ size = (size_t)obqp->top - (size_t)obqp->ptr;
+ if (size > (n - w)) {
size = n - w;
}
/* Smaller chunks in order to not make the critical zone too long,
this impacts throughput however.*/
- if (size > 64) {
+ if (size > 64U) {
/* Giving the compiler a chance to optimize for a fixed size move.*/
- memcpy(obqp->ptr, bp, 64);
- bp += 64;
- obqp->ptr += 64;
- w += 64;
+ memcpy(obqp->ptr, bp, 64U);
+ bp += 64U;
+ obqp->ptr += 64U;
+ w += 64U;
}
else {
memcpy(obqp->ptr, bp, size);
@@ -829,7 +829,7 @@ bool obqTryFlushI(output_buffers_queue_t *obqp) {
/* If queue is empty and there is a buffer partially filled and
it is not being written.*/
if (obqIsEmptyI(obqp) && (obqp->ptr != NULL)) {
- size_t size = (size_t)(obqp->ptr - (obqp->bwrptr + sizeof (size_t)));
+ size_t size = (size_t)obqp->ptr - ((size_t)obqp->bwrptr + sizeof (size_t));
if (size > 0U) {
@@ -865,7 +865,7 @@ void obqFlush(output_buffers_queue_t *obqp) {
/* If there is a buffer partially filled and not being written.*/
if (obqp->ptr != NULL) {
- size_t size = (size_t)(obqp->ptr - obqp->bwrptr);
+ size_t size = (size_t)obqp->ptr - (size_t)obqp->bwrptr;
if (size > 0U) {
obqPostFullBufferS(obqp, size);