From a7ecd644544b0913e1f5b37a7d6982a0734f25df Mon Sep 17 00:00:00 2001 From: Vasileios Vryniotis Date: Sat, 24 Oct 2020 23:45:19 +0100 Subject: [PATCH] Minor refactoring based on static analysis on the code of images: - Replace deprecated string.h with cstring. - Switch to nullptr. --- torchvision/csrc/cpu/image/read_image_cpu.cpp | 2 +- torchvision/csrc/cpu/image/read_write_file_cpu.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/torchvision/csrc/cpu/image/read_image_cpu.cpp b/torchvision/csrc/cpu/image/read_image_cpu.cpp index 0bd12d9c2e5..ad11ee666b9 100644 --- a/torchvision/csrc/cpu/image/read_image_cpu.cpp +++ b/torchvision/csrc/cpu/image/read_image_cpu.cpp @@ -1,5 +1,5 @@ #include "read_image_cpu.h" -#include +#include torch::Tensor decode_image(const torch::Tensor& data) { // Check that the input tensor dtype is uint8 diff --git a/torchvision/csrc/cpu/image/read_write_file_cpu.cpp b/torchvision/csrc/cpu/image/read_write_file_cpu.cpp index fd5ae1f0622..99f02d8247d 100644 --- a/torchvision/csrc/cpu/image/read_write_file_cpu.cpp +++ b/torchvision/csrc/cpu/image/read_write_file_cpu.cpp @@ -46,7 +46,7 @@ void write_file(std::string filename, torch::Tensor& data) { auto fileCStr = filename.c_str(); FILE* outfile = fopen(fileCStr, "wb"); - TORCH_CHECK(outfile != NULL, "Error opening output file"); + TORCH_CHECK(outfile != nullptr, "Error opening output file"); fwrite(fileBytes, sizeof(uint8_t), data.numel(), outfile); fclose(outfile);