Skip to content

Commit 2e23e47

Browse files
authored
Minor refactoring based on static analysis on the code of images: (#2891)
- Replace deprecated string.h with cstring. - Switch to nullptr.
1 parent 5cb77a2 commit 2e23e47

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

torchvision/csrc/cpu/image/read_image_cpu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "read_image_cpu.h"
2-
#include <string.h>
2+
#include <cstring>
33

44
torch::Tensor decode_image(const torch::Tensor& data) {
55
// Check that the input tensor dtype is uint8

torchvision/csrc/cpu/image/read_write_file_cpu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void write_file(std::string filename, torch::Tensor& data) {
4646
auto fileCStr = filename.c_str();
4747
FILE* outfile = fopen(fileCStr, "wb");
4848

49-
TORCH_CHECK(outfile != NULL, "Error opening output file");
49+
TORCH_CHECK(outfile != nullptr, "Error opening output file");
5050

5151
fwrite(fileBytes, sizeof(uint8_t), data.numel(), outfile);
5252
fclose(outfile);

0 commit comments

Comments
 (0)