MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rdbLoadDoubleValue

Function rdbLoadDoubleValue

app/redis-6.2.6/src/rdb.c:613–628  ·  view source on GitHub ↗

For information about double serialization check rdbSaveDoubleValue() */

Source from the content-addressed store, hash-verified

611
612/* For information about double serialization check rdbSaveDoubleValue() */
613int rdbLoadDoubleValue(rio *rdb, double *val) {
614 char buf[256];
615 unsigned char len;
616
617 if (rioRead(rdb,&len,1) == 0) return -1;
618 switch(len) {
619 case 255: *val = R_NegInf; return 0;
620 case 254: *val = R_PosInf; return 0;
621 case 253: *val = R_Nan; return 0;
622 default:
623 if (rioRead(rdb,buf,len) == 0) return -1;
624 buf[len] = '\0';
625 if (sscanf(buf, "%lg", val)!=1) return -1;
626 return 0;
627 }
628}
629
630/* Saves a double for RDB 8 or greater, where IE754 binary64 format is assumed.
631 * We just make sure the integer is always stored in little endian, otherwise

Callers 1

rdbLoadObjectFunction · 0.85

Calls 2

rioReadFunction · 0.85
sscanfFunction · 0.85

Tested by

no test coverage detected