Apply some auto-generated clang-tidy fixes to the C/C++ code.
This corresponds to Facebook diff D5588668.
| quark |
| Restricted Project |
Apply some auto-generated clang-tidy fixes to the C/C++ code.
This corresponds to Facebook diff D5588668.
Confirmed the code still builds and passes tests.
| Automatic diff as part of commit; lint not applicable. |
| Automatic diff as part of commit; unit tests not applicable. |
| Path | Packages | |||
|---|---|---|---|---|
| M | cstore/datapackstore.h (4 lines) | |||
| M | cstore/match.h (14 lines) | |||
| M | cstore/uniondatapackstore.h (9 lines) | |||
| M | ctreemanifest/treemanifest.cpp (9 lines) |
| class DeltaChainIterator { | class DeltaChainIterator { | ||||
| private: | private: | ||||
| size_t _index; | size_t _index; | ||||
| protected: | protected: | ||||
| std::vector<delta_chain_t> _chains; | std::vector<delta_chain_t> _chains; | ||||
| DeltaChainIterator() : | DeltaChainIterator() : | ||||
| _index(0) {} | _index(0) {} | ||||
| virtual delta_chain_t getNextChain(const Key &key) { | virtual delta_chain_t getNextChain(const Key& /*key*/) { | ||||
| return COMPOUND_LITERAL(delta_chain_t) { GET_DELTA_CHAIN_NOT_FOUND }; | return COMPOUND_LITERAL(delta_chain_t) { GET_DELTA_CHAIN_NOT_FOUND }; | ||||
| } | } | ||||
| public: | public: | ||||
| DeltaChainIterator(delta_chain_t chain) : | DeltaChainIterator(delta_chain_t chain) : | ||||
| _index(0) { | _index(0) { | ||||
| _chains.push_back(chain); | _chains.push_back(chain); | ||||
| } | } | ||||
| DatapackStore &_store; | DatapackStore &_store; | ||||
| KeyIterator &_missing; | KeyIterator &_missing; | ||||
| public: | public: | ||||
| DatapackStoreKeyIterator(DatapackStore &store, KeyIterator &missing) : | DatapackStoreKeyIterator(DatapackStore &store, KeyIterator &missing) : | ||||
| _store(store), | _store(store), | ||||
| _missing(missing) {} | _missing(missing) {} | ||||
| Key *next(); | Key *next() override; | ||||
| }; | }; | ||||
| /* Manages access to a directory of datapack files. */ | /* Manages access to a directory of datapack files. */ | ||||
| class DatapackStore { | class DatapackStore { | ||||
| private: | private: | ||||
| std::string _path; | std::string _path; | ||||
| clock_t _lastRefresh; | clock_t _lastRefresh; | ||||
| virtual bool matches(const std::string &path) = 0; | virtual bool matches(const std::string &path) = 0; | ||||
| virtual bool matches(const char *path, const size_t pathlen) = 0; | virtual bool matches(const char *path, const size_t pathlen) = 0; | ||||
| virtual bool visitdir(const std::string &path) = 0; | virtual bool visitdir(const std::string &path) = 0; | ||||
| }; | }; | ||||
| class AlwaysMatcher : public Matcher { | class AlwaysMatcher : public Matcher { | ||||
| public: | public: | ||||
| AlwaysMatcher() {} | AlwaysMatcher() {} | ||||
| virtual ~AlwaysMatcher() {} | ~AlwaysMatcher() override {} | ||||
| virtual bool matches(const std::string &path) { return true; } | bool matches(const std::string& /*path*/) override { | ||||
| virtual bool matches(const char *path, const size_t pathlen) { return true; } | return true; | ||||
| virtual bool visitdir(const std::string &path) { return true; } | } | ||||
| bool matches(const char* /*path*/, const size_t /*pathlen*/) override { | |||||
| return true; | |||||
| } | |||||
| bool visitdir(const std::string& /*path*/) override { | |||||
| return true; | |||||
| } | |||||
| }; | }; | ||||
| #endif // FBHGEXT_CSTORE_MATCH_H | #endif // FBHGEXT_CSTORE_MATCH_H | ||||
| UnionDatapackStore &_store; | UnionDatapackStore &_store; | ||||
| KeyIterator &_missing; | KeyIterator &_missing; | ||||
| public: | public: | ||||
| UnionDatapackStoreKeyIterator(UnionDatapackStore &store, KeyIterator &missing) : | UnionDatapackStoreKeyIterator(UnionDatapackStore &store, KeyIterator &missing) : | ||||
| _store(store), | _store(store), | ||||
| _missing(missing) {} | _missing(missing) {} | ||||
| Key *next(); | Key *next() override; | ||||
| }; | }; | ||||
| class UnionDeltaChainIterator: public DeltaChainIterator { | class UnionDeltaChainIterator: public DeltaChainIterator { | ||||
| private: | private: | ||||
| UnionDatapackStore &_store; | UnionDatapackStore &_store; | ||||
| protected: | protected: | ||||
| delta_chain_t getNextChain(const Key &key); | delta_chain_t getNextChain(const Key &key) override; | ||||
| public: | public: | ||||
| UnionDeltaChainIterator(UnionDatapackStore &store, const Key &key) : | UnionDeltaChainIterator(UnionDatapackStore &store, const Key &key) : | ||||
| DeltaChainIterator(), | DeltaChainIterator(), | ||||
| _store(store) { | _store(store) { | ||||
| _chains.push_back(this->getNextChain(key)); | _chains.push_back(this->getNextChain(key)); | ||||
| } | } | ||||
| }; | }; | ||||
| class UnionDatapackStore : public Store { | class UnionDatapackStore : public Store { | ||||
| public: | public: | ||||
| std::vector<DatapackStore*> _stores; | std::vector<DatapackStore*> _stores; | ||||
| UnionDatapackStore(std::vector<DatapackStore*> stores); | UnionDatapackStore(std::vector<DatapackStore*> stores); | ||||
| ~UnionDatapackStore(); | ~UnionDatapackStore() override; | ||||
| ConstantStringRef get(const Key &key); | ConstantStringRef get(const Key &key) override; | ||||
| UnionDeltaChainIterator getDeltaChain(const Key &key); | UnionDeltaChainIterator getDeltaChain(const Key &key); | ||||
| bool contains(const Key &key); | bool contains(const Key &key); | ||||
| UnionDatapackStoreKeyIterator getMissing(KeyIterator &missing); | UnionDatapackStoreKeyIterator getMissing(KeyIterator &missing); | ||||
| void markForRefresh(); | void markForRefresh(); | ||||
| }; | }; | ||||
| #endif // FBHGEXT_CSTORE_UNIONDATAPACKSTORE_H | #endif // FBHGEXT_CSTORE_UNIONDATAPACKSTORE_H | ||||
| struct GetResult { | struct GetResult { | ||||
| std::string *resultnode; | std::string *resultnode; | ||||
| const char **resultflag; | const char **resultflag; | ||||
| FindResultType resulttype; | FindResultType resulttype; | ||||
| }; | }; | ||||
| static FindResult get_callback( | static FindResult get_callback( | ||||
| Manifest *manifest, | Manifest* manifest, | ||||
| const char *filename, size_t filenamelen, | const char* filename, | ||||
| size_t filenamelen, | |||||
| FindContext *context, | FindContext* context, | ||||
| ManifestPtr *resultManifest) { | ManifestPtr* /*resultManifest*/) { | ||||
| GetResult *result = (GetResult *) context->extras; | GetResult *result = (GetResult *) context->extras; | ||||
| // position the iterator at the right location | // position the iterator at the right location | ||||
| bool exacthit; | bool exacthit; | ||||
| std::list<ManifestEntry>::iterator iterator = manifest->findChild( | std::list<ManifestEntry>::iterator iterator = manifest->findChild( | ||||
| filename, filenamelen, result->resulttype, &exacthit); | filename, filenamelen, result->resulttype, &exacthit); | ||||
| if (!exacthit) { | if (!exacthit) { | ||||