Fix clang-tidy warnings in Caffe2 code (#134935)

Fixes #ISSUE_NUMBER

Pull Request resolved: https://github.com/pytorch/pytorch/pull/134935
Approved by: https://github.com/ezyang
This commit is contained in:
cyy
2024-09-12 03:27:06 +00:00
committed by PyTorch MergeBot
parent 0d1d69fd25
commit 7cfd23636c
28 changed files with 112 additions and 150 deletions

View File

@ -1,10 +1,9 @@
#pragma once
#include <cstring>
#include <caffe2/serialize/read_adapter_interface.h>
#include <sys/types.h>
#include <cstring>
namespace caffe2 {
namespace serialize {
namespace caffe2::serialize {
class MemoryReadAdapter final : public caffe2::serialize::ReadAdapterInterface {
public:
@ -15,18 +14,18 @@ class MemoryReadAdapter final : public caffe2::serialize::ReadAdapterInterface {
return size_;
}
size_t read(uint64_t pos, void* buf, size_t n, const char* what = "")
const override {
(void) what;
size_t read(
uint64_t pos,
void* buf,
size_t n,
const char* what [[maybe_unused]] = "") const override {
memcpy(buf, (int8_t*)(data_) + pos, n);
return n;
}
private:
const void* data_;
off_t size_;
off_t size_{};
};
} // namespace serialize
} // namespace caffe2
} // namespace caffe2::serialize