mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
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:
@ -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
|
||||
|
Reference in New Issue
Block a user