Compare unsigned values instead of subtracting them.
Unsigned values do not return signed values when subtracted and the right operand is larger then the left operand. Signed-off-by: Dan Dennedy <dan@dennedy.org>
This commit is contained in:
parent
709d8791ce
commit
8ad324c971
1 changed files with 3 additions and 2 deletions
5
src/fw.c
5
src/fw.c
|
@ -1310,9 +1310,10 @@ fw_bandwidth_modify (raw1394handle_t handle,
|
|||
compare = ntohl (buffer);
|
||||
switch (mode) {
|
||||
case RAW1394_MODIFY_ALLOC:
|
||||
swap = compare - bandwidth;
|
||||
if (swap < 0)
|
||||
if (compare < bandwidth)
|
||||
return -1;
|
||||
|
||||
swap = compare - bandwidth;
|
||||
break;
|
||||
|
||||
case RAW1394_MODIFY_FREE:
|
||||
|
|
Reference in a new issue