Fix various lint issues

This commit is contained in:
Teddy Reed 2016-02-26 10:58:36 -08:00
parent 03d0d7e835
commit 26c8b5640f
15 changed files with 47 additions and 28 deletions

View File

@ -8,6 +8,8 @@
*
*/
#pragma once
#include <boost/noncopyable.hpp>
#include <string>

View File

@ -105,7 +105,7 @@ class Status {
* }
* @endcode
*/
operator bool() const { return ok(); }
/* explicit */ operator bool() const { return ok(); }
// Below operator implementations useful for testing with gtest

View File

@ -72,7 +72,7 @@ Status writeTextFile(const fs::path& path,
struct OpenReadableFile {
public:
OpenReadableFile(const fs::path& path) {
explicit OpenReadableFile(const fs::path& path) {
dropper_ = DropPrivileges::get();
if (dropper_->dropToParent(path)) {
// Open the file descriptor and allow caller to perform error checking.

View File

@ -64,7 +64,8 @@ class SQLiteDBInstance : private boost::noncopyable {
private:
/// An opaque constructor only used by the DBManager.
SQLiteDBInstance(sqlite3* db) : primary_(true), managed_(true), db_(db) {}
explicit SQLiteDBInstance(sqlite3* db)
: primary_(true), managed_(true), db_(db) {}
private:
/// Introspection into the database pointer, primary means managed.

View File

@ -8,6 +8,8 @@
*
*/
#pragma once
#include <boost/property_tree/json_parser.hpp>
#include <osquery/filesystem.h>

View File

@ -8,6 +8,8 @@
*
*/
#pragma once
#include <set>
#include <string>

View File

@ -29,18 +29,15 @@ namespace osquery {
namespace tables {
const std::map<TSK_FS_META_TYPE_ENUM, std::string> kTSKTypeNames{
{TSK_FS_META_TYPE_REG, "regular"},
{TSK_FS_META_TYPE_DIR, "directory"},
{TSK_FS_META_TYPE_LNK, "symlink"},
{TSK_FS_META_TYPE_BLK, "block"},
{TSK_FS_META_TYPE_CHR, "character"},
{TSK_FS_META_TYPE_FIFO, "fifo"},
{TSK_FS_META_TYPE_REG, "regular"}, {TSK_FS_META_TYPE_DIR, "directory"},
{TSK_FS_META_TYPE_LNK, "symlink"}, {TSK_FS_META_TYPE_BLK, "block"},
{TSK_FS_META_TYPE_CHR, "character"}, {TSK_FS_META_TYPE_FIFO, "fifo"},
{TSK_FS_META_TYPE_SOCK, "socket"},
};
class DeviceHelper : private boost::noncopyable {
public:
DeviceHelper(const std::string& device_path)
explicit DeviceHelper(const std::string& device_path)
: image_(std::make_shared<TskImgInfo>()),
volume_(std::make_shared<TskVsInfo>()),
device_path_(device_path) {}

View File

@ -11,20 +11,19 @@
#include <iomanip>
#include <sstream>
#if defined(__linux__) || defined(__FreeBSD__)
#include <net/if.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
#include <unistd.h>
#endif
#if defined(__APPLE__) || defined(__FreeBSD__)
#include <net/if_dl.h>
#endif
#if defined(__linux__)
#include <net/if.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
#include <unistd.h>
#define AF_LINK AF_PACKET
#elif defined(__FreeBSD__)
#include <net/if.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <net/if_dl.h>
#elif defined(__APPLE__)
#include <net/if_dl.h>
#endif
#include <boost/algorithm/string/trim.hpp>

View File

@ -8,6 +8,8 @@
*
*/
#pragma once
#include <iomanip>
#include <sstream>
@ -34,7 +36,7 @@ struct IOKitPCIProperties {
std::string driver;
/// Populate IOKit PCI device properties from the "compatible" property.
IOKitPCIProperties(const std::string& compatible);
explicit IOKitPCIProperties(const std::string& compatible);
};
inline void idToHex(std::string& id) {

View File

@ -8,6 +8,8 @@
*
*/
#pragma once
#include <map>
#include <set>
#include <vector>

View File

@ -9,6 +9,8 @@
*
*/
#pragma once
/**
* @brief EFI DevicePath GUIDs, structs, and macros.
*/

View File

@ -8,6 +8,8 @@
*
*/
#pragma once
#include <osquery/tables.h>
namespace osquery {
@ -43,9 +45,10 @@ constexpr uint8_t kSMBIOSTypeSystem = 1;
class SMBIOSParser : private boost::noncopyable {
public:
/// Walk the tables and apply a predicate.
virtual void tables(std::function<void(
size_t index, const SMBStructHeader* hdr, uint8_t* address, size_t size)>
predicate);
virtual void tables(std::function<void(size_t index,
const SMBStructHeader* hdr,
uint8_t* address,
size_t size)> predicate);
public:
virtual ~SMBIOSParser() {}

View File

@ -8,6 +8,8 @@
*
*/
#pragma once
#include <sys/sysctl.h>
#include <osquery/tables.h>
@ -35,7 +37,8 @@ void genControlInfo(int* oid,
const std::map<std::string, std::string>& config);
/// Must be implemented by the platform.
void genControlInfoFromName(const std::string& name, QueryData& results,
const std::map<std::string, std::string>& config);
void genControlInfoFromName(const std::string& name,
QueryData& results,
const std::map<std::string, std::string>& config);
}
}

View File

@ -8,6 +8,8 @@
*
*/
#pragma once
#include <osquery/tables.h>
namespace osquery {

View File

@ -8,6 +8,8 @@
*
*/
#pragma once
#include <vector>
#include <string>