build: convert c-style cast to c++ style
This commit is contained in:
parent
a9bffcff08
commit
52eb957d4b
@ -56,7 +56,7 @@ extent<T>::operator= (const extent<T> &rhs) {
|
||||
template <typename T>
|
||||
T
|
||||
extent<T>::diameter (void) const {
|
||||
return (T)sqrt (w * w + h * h);
|
||||
return static_cast<T> (sqrt (w * w + h * h));
|
||||
}
|
||||
|
||||
|
||||
|
16
fourcc.cpp
16
fourcc.cpp
@ -43,10 +43,10 @@ fourcc
|
||||
fourcc::from_string (const char data[4]) {
|
||||
fourcc lhs;
|
||||
|
||||
lhs.data[0] = (uint8_t)data[0];
|
||||
lhs.data[1] = (uint8_t)data[1];
|
||||
lhs.data[2] = (uint8_t)data[2];
|
||||
lhs.data[3] = (uint8_t)data[3];
|
||||
lhs.data[0] = static_cast<uint8_t> (data[0]);
|
||||
lhs.data[1] = static_cast<uint8_t> (data[1]);
|
||||
lhs.data[2] = static_cast<uint8_t> (data[2]);
|
||||
lhs.data[3] = static_cast<uint8_t> (data[3]);
|
||||
|
||||
return lhs;
|
||||
}
|
||||
@ -62,10 +62,10 @@ fourcc::operator== (const char rhs[4]) const {
|
||||
|
||||
|
||||
fourcc::operator uint32_t (void) const {
|
||||
return (uint32_t)(data[0] << 24U |
|
||||
data[1] << 16U |
|
||||
data[2] << 8U |
|
||||
data[3]);
|
||||
return static_cast<uint32_t> (data[0] << 24U |
|
||||
data[1] << 16U |
|
||||
data[2] << 8U |
|
||||
data[3]);
|
||||
}
|
||||
|
||||
|
||||
|
16
guid.cpp
16
guid.cpp
@ -156,14 +156,14 @@ guid::operator== (const guid &rhs) const {
|
||||
|
||||
std::ostream&
|
||||
operator<< (std::ostream &os, const guid &g) {
|
||||
uint64_t data4_b = (uint64_t)g.data4[0] << 0 |
|
||||
(uint64_t)g.data4[1] << 8 |
|
||||
(uint64_t)g.data4[2] << 16 |
|
||||
(uint64_t)g.data4[3] << 24 |
|
||||
(uint64_t)g.data4[4] << 32 |
|
||||
(uint64_t)g.data4[5] << 40;
|
||||
uint16_t data4_a = (uint16_t)g.data4[6] << 0 |
|
||||
(uint16_t)g.data4[7] << 8;
|
||||
uint64_t data4_b = static_cast<uint64_t> (g.data4[0]) << 0u |
|
||||
static_cast<uint64_t> (g.data4[1]) << 8u |
|
||||
static_cast<uint64_t> (g.data4[2]) << 16u |
|
||||
static_cast<uint64_t> (g.data4[3]) << 24u |
|
||||
static_cast<uint64_t> (g.data4[4]) << 32u |
|
||||
static_cast<uint64_t> (g.data4[5]) << 40u;
|
||||
uint16_t data4_a = static_cast<uint16_t> (g.data4[6]) << 0u |
|
||||
static_cast<uint16_t> (g.data4[7]) << 8u;
|
||||
|
||||
os << hex << setfill ('0') << setw (2 * sizeof (g.data1)) << g.data1 << "-"
|
||||
<< setw (2 * sizeof (g.data2)) << g.data2 << "-"
|
||||
|
Loading…
Reference in New Issue
Block a user