mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-22 17:45:48 -05:00
qrtplib: fixed compiler warning
This commit is contained in:
parent
f1f7a0058c
commit
bf58108ac3
@ -9,7 +9,7 @@
|
||||
|
||||
This library was developed at the Expertise Centre for Digital Media
|
||||
(http://www.edm.uhasselt.be), a research center of the Hasselt University
|
||||
(http://www.uhasselt.be). The library is based upon work done for
|
||||
(http://www.uhasselt.be). The library is based upon work done for
|
||||
my thesis at the School for Knowledge Technology (Belgium/The Netherlands).
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
@ -70,9 +70,11 @@ uint8_t RTPRandomURandom::GetRandom8()
|
||||
|
||||
uint8_t value;
|
||||
|
||||
fread(&value, sizeof(uint8_t), 1, device);
|
||||
|
||||
return value;
|
||||
if (fread(&value, sizeof(uint8_t), 1, device) == sizeof(uint8_t)) {
|
||||
return value;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t RTPRandomURandom::GetRandom16()
|
||||
@ -82,9 +84,11 @@ uint16_t RTPRandomURandom::GetRandom16()
|
||||
|
||||
uint16_t value;
|
||||
|
||||
fread(&value, sizeof(uint16_t), 1, device);
|
||||
|
||||
return value;
|
||||
if (fread(&value, sizeof(uint16_t), 1, device) == sizeof(uint16_t)) {
|
||||
return value;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t RTPRandomURandom::GetRandom32()
|
||||
@ -94,7 +98,11 @@ uint32_t RTPRandomURandom::GetRandom32()
|
||||
|
||||
uint32_t value;
|
||||
|
||||
fread(&value, sizeof(uint32_t), 1, device);
|
||||
if (fread(&value, sizeof(uint32_t), 1, device) == sizeof(uint32_t)) {
|
||||
return value;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
@ -106,15 +114,17 @@ double RTPRandomURandom::GetRandomDouble()
|
||||
|
||||
uint64_t value;
|
||||
|
||||
fread(&value, sizeof(uint64_t), 1, device);
|
||||
|
||||
value &= 0x7fffffffffffffffULL;
|
||||
|
||||
int64_t value2 = (int64_t)value;
|
||||
double x = RTPRANDOM_2POWMIN63*(double)value2;
|
||||
|
||||
return x;
|
||||
|
||||
if (fread(&value, sizeof(uint64_t), 1, device) == sizeof(uint64_t))
|
||||
{
|
||||
value &= 0x7fffffffffffffffULL;
|
||||
int64_t value2 = (int64_t)value;
|
||||
double x = RTPRANDOM_2POWMIN63*(double)value2;
|
||||
return x;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
} // end namespace
|
||||
|
Loading…
Reference in New Issue
Block a user