"vscode:/vscode.git/clone" did not exist on "215e6804d3bb011faead6ddc8db00cdbe31b6e91"
Unverified Commit 2e23e477 authored by Vasilis Vryniotis's avatar Vasilis Vryniotis Committed by GitHub
Browse files

Minor refactoring based on static analysis on the code of images: (#2891)

- Replace deprecated string.h with cstring.
- Switch to nullptr.
parent 5cb77a20
#include "read_image_cpu.h" #include "read_image_cpu.h"
#include <string.h> #include <cstring>
torch::Tensor decode_image(const torch::Tensor& data) { torch::Tensor decode_image(const torch::Tensor& data) {
// Check that the input tensor dtype is uint8 // Check that the input tensor dtype is uint8
......
...@@ -46,7 +46,7 @@ void write_file(std::string filename, torch::Tensor& data) { ...@@ -46,7 +46,7 @@ void write_file(std::string filename, torch::Tensor& data) {
auto fileCStr = filename.c_str(); auto fileCStr = filename.c_str();
FILE* outfile = fopen(fileCStr, "wb"); 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); fwrite(fileBytes, sizeof(uint8_t), data.numel(), outfile);
fclose(outfile); fclose(outfile);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment