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
5
src/fw.c
5
src/fw.c
|
@ -1310,9 +1310,10 @@ fw_bandwidth_modify (raw1394handle_t handle,
|
||||||
compare = ntohl (buffer);
|
compare = ntohl (buffer);
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case RAW1394_MODIFY_ALLOC:
|
case RAW1394_MODIFY_ALLOC:
|
||||||
swap = compare - bandwidth;
|
if (compare < bandwidth)
|
||||||
if (swap < 0)
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
swap = compare - bandwidth;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RAW1394_MODIFY_FREE:
|
case RAW1394_MODIFY_FREE:
|
||||||
|
|
Reference in New Issue