kopia lustrzana https://github.com/f4exb/sdrangel
				
				
				
			qrtplib: fixed compiler warning
							rodzic
							
								
									f1f7a0058c
								
							
						
					
					
						commit
						bf58108ac3
					
				|  | @ -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
 | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 f4exb
						f4exb