Skip to content

Commit a0db04a

Browse files
Don't check unsigned for negative value. cppcheck.
1 parent 94f10fd commit a0db04a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

mythtv/programs/mythtranscode/replex/ringbuffer.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ int ring_peek(ringbuffer *rbuf, uint8_t *data, unsigned int count, uint32_t off)
125125

126126
unsigned int avail, pos, rest;
127127

128-
if (count <=0 || off+count > rbuf->size || off+count >ring_avail(rbuf)) return -1;
128+
if (off+count > rbuf->size || off+count >ring_avail(rbuf))
129+
return -1;
129130
pos = (rbuf->read_pos+off)%rbuf->size;
130131
rest = rbuf->size - pos ;
131132
avail = ring_avail(rbuf);
@@ -157,7 +158,8 @@ int ring_poke(ringbuffer *rbuf, uint8_t *data, unsigned int count, uint32_t off)
157158

158159
unsigned int avail, pos, rest;
159160

160-
if (count <=0 || off+count > rbuf->size || off+count >ring_avail(rbuf)) return -1;
161+
if (off+count > rbuf->size || off+count >ring_avail(rbuf))
162+
return -1;
161163
pos = (rbuf->read_pos+off)%rbuf->size;
162164
rest = rbuf->size - pos ;
163165
avail = ring_avail(rbuf);
@@ -376,7 +378,8 @@ void ring_show(ringbuffer *rbuf, unsigned int count, uint32_t off)
376378

377379
unsigned int avail, pos, rest;
378380

379-
if (count <=0 || off+count > rbuf->size || off+count >ring_avail(rbuf)) return;
381+
if (off+count > rbuf->size || off+count >ring_avail(rbuf))
382+
return;
380383
pos = (rbuf->read_pos+off)%rbuf->size;
381384
rest = rbuf->size - pos ;
382385
avail = ring_avail(rbuf);

0 commit comments

Comments
 (0)