diff options
-rw-r--r-- | client/wrapper.cc | 5 | ||||
-rw-r--r-- | daemon/i2c_driver_i2cdev.cc | 2 | ||||
-rw-r--r-- | example/pio_mcp9808.cc | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/client/wrapper.cc b/client/wrapper.cc index f9cc3dc..cf396ca 100644 --- a/client/wrapper.cc +++ b/client/wrapper.cc @@ -28,9 +28,10 @@ namespace { // This is horrible. Get rid of it!!! static char** ConvertStringVectorToC(const std::vector<std::string>& strings) { - char** c_strings = (char**)malloc(strings.size() * sizeof(*c_strings)); + char** c_strings = + static_cast<char**>(malloc(strings.size() * sizeof(*c_strings))); for (size_t i = 0; i < strings.size(); i++) { - c_strings[i] = (char*)malloc(strings[i].size() + 1); + c_strings[i] = static_cast<char*>(malloc(strings[i].size() + 1)); memset(c_strings[i], 0, strings[i].size() + 1); strcpy(c_strings[i], strings[i].c_str()); } diff --git a/daemon/i2c_driver_i2cdev.cc b/daemon/i2c_driver_i2cdev.cc index b4f2280..acc02ac 100644 --- a/daemon/i2c_driver_i2cdev.cc +++ b/daemon/i2c_driver_i2cdev.cc @@ -59,7 +59,7 @@ bool I2cDriverI2cDev::Init(uint32_t bus_id, uint32_t address) { if (fd < 0) return false; uintptr_t tmp_addr = address; - if (char_interface_->Ioctl(fd, I2C_SLAVE, (void*)tmp_addr) < 0) { + if (char_interface_->Ioctl(fd, I2C_SLAVE, reinterpret_cast<void*>(tmp_addr)) < 0) { LOG(ERROR) << "Failed to set I2C slave"; char_interface_->Close(fd); return false; diff --git a/example/pio_mcp9808.cc b/example/pio_mcp9808.cc index 446afbf..cad8990 100644 --- a/example/pio_mcp9808.cc +++ b/example/pio_mcp9808.cc @@ -50,7 +50,7 @@ int main(int argc, char* argv[]) { val = ntohs(val); float temp = (val >> 4) & 0xFF; - temp += (float)(val & 0xF) / 16; + temp += static_cast<float>(val & 0xF) / 16; printf("Temp: %f\n", temp); BI2cDevice_delete(i2c_device); |