rivers/rwbuffer: Fix some logic errors

This commit is contained in:
Juha Niskanen 2015-08-26 07:18:50 -06:00 committed by Gregory Nutt
parent 32de036490
commit 70620d3dd6
4 changed files with 9 additions and 7 deletions

View File

@ -10881,4 +10881,6 @@
device (2015-08-24).
* networking: Correct return value from psock_tcp_accept(). From
SaeHie Park (2015-08-25).
* drivers/rwbuffer.c: Fix some logic errors. From Dmitry Nikolaev
via Juha Niskanen (2015-08-26).

@ -1 +1 @@
Subproject commit ce750c0899c2138b37b52a48d020a3eceb92fd04
Subproject commit 8a30728ae9a64496f0c9a0ff5dd62bd3b022c145

@ -1 +1 @@
Subproject commit e3f37812a9a7595a7ddab1a625ebe857d104beb2
Subproject commit e1e1873700ffda7aeb632e2b1234333d88ce3457

View File

@ -96,7 +96,7 @@ static void rwb_semtake(sem_t *sem)
while (sem_wait(sem) != 0)
{
/* The only case that an error should occr here is if
/* The only case that an error should occur here is if
* the wait was awakened by a signal.
*/
@ -117,8 +117,8 @@ static void rwb_semtake(sem_t *sem)
static inline bool rwb_overlap(off_t blockstart1, size_t nblocks1,
off_t blockstart2, size_t nblocks2)
{
off_t blockend1 = blockstart1 + nblocks1;
off_t blockend2 = blockstart2 + nblocks2;
off_t blockend1 = blockstart1 + nblocks1 - 1;
off_t blockend2 = blockstart2 + nblocks2 - 1;
/* If the buffer 1 is wholly outside of buffer 2, return false */
@ -257,7 +257,7 @@ static ssize_t rwb_writebuffer(FAR struct rwbuffer_s *rwb,
/* Flush the write buffer */
ret = rwb->wrflush(rwb, rwb->wrbuffer, rwb->wrblockstart, rwb->wrnblocks);
ret = rwb->wrflush(rwb->dev, rwb->wrbuffer, rwb->wrblockstart, rwb->wrnblocks);
if (ret < 0)
{
fdbg("ERROR: Error writing multiple from cache: %d\n", -ret);
@ -842,7 +842,7 @@ int rwb_read(FAR struct rwbuffer_s *rwb, off_t startblock, uint32_t nblocks,
* the user buffer.
*/
ret = rwb->rhreload(rwb->dev, startblock, nblocks, rdbuffer);
ret = rwb->rhreload(rwb->dev, rdbuffer, startblock, nblocks);
}
#endif