explicit cast to avoid compiler warning
This commit is contained in:
@ -40,10 +40,10 @@ parse(const StreamFormat& format, StreamBuffer&,
|
|||||||
if (!endian) {
|
if (!endian) {
|
||||||
union {long l; char c [sizeof(long)];} u;
|
union {long l; char c [sizeof(long)];} u;
|
||||||
u.l=1;
|
u.l=1;
|
||||||
if (u.c[0]) { endian = 1234;} // little endian
|
if (u.c[0]) { endian = 1234;} // little endian
|
||||||
else if (u.c[sizeof(long)-1]) { endian = 4321;} // big endian
|
else if (u.c[sizeof(long)-1]) { endian = 4321;} // big endian
|
||||||
else {
|
else {
|
||||||
error ("Cannot find out byte order for %%R format.\n");
|
error ("Cannot find out byte order for %%R format.\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,16 +64,16 @@ printDouble(const StreamFormat& format, StreamBuffer& output, double value)
|
|||||||
float fval;
|
float fval;
|
||||||
char bytes[8];
|
char bytes[8];
|
||||||
} buffer;
|
} buffer;
|
||||||
|
|
||||||
nbOfBytes = format.width;
|
nbOfBytes = format.width;
|
||||||
if (nbOfBytes == 0)
|
if (nbOfBytes == 0)
|
||||||
nbOfBytes = 4;
|
nbOfBytes = 4;
|
||||||
|
|
||||||
if (nbOfBytes == 4)
|
if (nbOfBytes == 4)
|
||||||
buffer.fval = value;
|
buffer.fval = (float)value;
|
||||||
else
|
else
|
||||||
buffer.dval = value;
|
buffer.dval = value;
|
||||||
|
|
||||||
if (!(format.flags & alt_flag) ^ (endian == 4321))
|
if (!(format.flags & alt_flag) ^ (endian == 4321))
|
||||||
{
|
{
|
||||||
// swap if byte orders differ
|
// swap if byte orders differ
|
||||||
@ -86,7 +86,7 @@ printDouble(const StreamFormat& format, StreamBuffer& output, double value)
|
|||||||
{
|
{
|
||||||
output.append(buffer.bytes[n]);
|
output.append(buffer.bytes[n]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ scanDouble(const StreamFormat& format, const char* input, double& value)
|
|||||||
float fval;
|
float fval;
|
||||||
char bytes[8];
|
char bytes[8];
|
||||||
} buffer;
|
} buffer;
|
||||||
|
|
||||||
nbOfBytes = format.width;
|
nbOfBytes = format.width;
|
||||||
if (nbOfBytes == 0)
|
if (nbOfBytes == 0)
|
||||||
nbOfBytes = 4;
|
nbOfBytes = 4;
|
||||||
@ -110,7 +110,7 @@ scanDouble(const StreamFormat& format, const char* input, double& value)
|
|||||||
{
|
{
|
||||||
return(nbOfBytes); // just skip input
|
return(nbOfBytes); // just skip input
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(format.flags & alt_flag) ^ (endian == 4321))
|
if (!(format.flags & alt_flag) ^ (endian == 4321))
|
||||||
{
|
{
|
||||||
// swap if byte orders differ
|
// swap if byte orders differ
|
||||||
@ -127,7 +127,7 @@ scanDouble(const StreamFormat& format, const char* input, double& value)
|
|||||||
|
|
||||||
if (nbOfBytes == 4)
|
if (nbOfBytes == 4)
|
||||||
value = buffer.fval;
|
value = buffer.fval;
|
||||||
else
|
else
|
||||||
value = buffer.dval;
|
value = buffer.dval;
|
||||||
|
|
||||||
return nbOfBytes;
|
return nbOfBytes;
|
||||||
|
Reference in New Issue
Block a user