Skip to content

Commit

Permalink
MINIFICPP-1203 - Fix whitespace issues, comments, redundancies and on…
Browse files Browse the repository at this point in the history
…e API breaking explicit
  • Loading branch information
hunyadi-dev committed Jun 4, 2020
1 parent 256f5d4 commit 1ef4094
Show file tree
Hide file tree
Showing 17 changed files with 30 additions and 34 deletions.
1 change: 0 additions & 1 deletion libminifi/include/core/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
// can't include cxxabi
#else
#include <cxxabi.h>

#endif

#include "utils/Id.h"
Expand Down
6 changes: 3 additions & 3 deletions libminifi/include/core/ProcessSessionReadCallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ namespace minifi {
namespace core {
class ProcessSessionReadCallback : public InputStreamCallback {
public:
ProcessSessionReadCallback(const std::string &tmpFile, const std::string &destFile,
std::shared_ptr<logging::Logger> logger);
~ProcessSessionReadCallback();
ProcessSessionReadCallback(const std::string &tmpFile, const std::string &destFile,
std::shared_ptr<logging::Logger> logger);
~ProcessSessionReadCallback();
virtual int64_t process(std::shared_ptr<io::BaseStream> stream);
bool commit();

Expand Down
2 changes: 1 addition & 1 deletion libminifi/include/core/Processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class Processor : public Connectable, public ConfigurableComponent, public std::
// Set Processor Scheduling Period in Nano Second
void setSchedulingPeriodNano(uint64_t period) {
uint64_t minPeriod = MINIMUM_SCHEDULING_NANOS;
// std::max has some variances on c++11-c++14 and then c++14 onward.
// std::max has some variances on c++11-c++14 and then c++14 onward.
// to avoid macro conditional checks we can use this simple conditional expr.
scheduling_period_nano_ = period > minPeriod ? period : minPeriod;
}
Expand Down
2 changes: 1 addition & 1 deletion libminifi/include/core/PropertyValidation.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class ValidationResult {

class PropertyValidator {
public:
explicit PropertyValidator(std::string name)
PropertyValidator(std::string name) // NOLINT
: name_(std::move(name)) {
}
virtual ~PropertyValidator() = default;
Expand Down
2 changes: 1 addition & 1 deletion libminifi/include/core/Resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class StaticClassType {
static core::StaticClassType<CLASSNAME> \
CLASSNAME##_registrar(#NAME);

}/* namespace core */
} // namespace core
} // namespace minifi
} // namespace nifi
} // namespace apache
Expand Down
2 changes: 1 addition & 1 deletion libminifi/include/core/TypedValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class DataSizeValue : public TransformableValue, public state::response::UInt64V

// Convert String to Integer
template<typename T, typename std::enable_if<
std::is_integral<T>::value>::type* = nullptr>
std::is_integral<T>::value>::type* = nullptr>
static bool StringToInt(const std::string &input, T &output) {
if (input.size() == 0) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion libminifi/include/core/WeakReference.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class ReferenceContainer {
std::vector<std::shared_ptr<WeakReference> > references;
};

}/* namespace core */
} // namespace core
} // namespace minifi
} // namespace nifi
} // namespace apache
Expand Down
2 changes: 1 addition & 1 deletion libminifi/include/core/controller/ControllerService.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class ControllerService : public ConfigurableComponent, public Connectable {
return false;
}

void setLinkedControllerServices(const std::vector<std::shared_ptr<controller::ControllerService> > &services ) {
void setLinkedControllerServices(const std::vector<std::shared_ptr<controller::ControllerService>> &services) {
linked_services_ = services;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ class ControllerServiceProvider : public CoreComponent, public ConfigurableCompo
* @param id controller service identifier.
* @return shared pointer to the controller service node.
*/
virtual std::shared_ptr<ControllerServiceNode> createControllerService(const std::string &type, const std::string &longType, const std::string &id,
bool firstTimeAdded) = 0;
virtual std::shared_ptr<ControllerServiceNode> createControllerService(const std::string &type, const std::string &longType, const std::string &id, bool firstTimeAdded) = 0;

/**
* Gets a controller service node wrapping the controller service
Expand Down
2 changes: 1 addition & 1 deletion libminifi/include/core/logging/LoggerConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct LoggerNamespace {
children(std::map<std::string, std::shared_ptr<LoggerNamespace>>()) {
}
};
}; // namespace internal
} // namespace internal

class LoggerProperties : public Properties {
public:
Expand Down
2 changes: 1 addition & 1 deletion libminifi/include/core/state/nodes/DeviceInformation.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ class Device {
memcpy(mac, LLADDR(sdl), sdl->sdl_alen);
char mac_add[13];
snprintf(mac_add, 13, "%02X%02X%02X%02X%02X%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); // NOLINT
// /macs += mac_add;
// macs += mac_add;
macs.insert(mac_add);
}
}
Expand Down
3 changes: 1 addition & 2 deletions libminifi/include/core/state/nodes/SystemMetrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,11 @@ class SystemInformation : public DeviceInformation {
arch.value = std::string(buf.machine);
}

systemInfo.children.push_back(arch);
systemInfo.children.push_back(arch);
serialized.push_back(systemInfo);
#endif
serialized.push_back(identifier);


return serialized;
}

Expand Down
2 changes: 1 addition & 1 deletion libminifi/include/io/CRCStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class CRCStream : public BaseStream {
template<typename K>
int readBuffer(std::vector<uint8_t>& buf, const K& t) {
buf.resize(sizeof t);
return readData(reinterpret_cast<uint8_t*>(&buf[0]), sizeof(t));
return readData(reinterpret_cast<uint8_t*>(buf.data()), sizeof(t));
}

uint64_t crc_;
Expand Down
2 changes: 1 addition & 1 deletion libminifi/include/io/DataStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class DataStream {
* Constructor
**/
explicit DataStream(const uint8_t *buf, const uint32_t buflen) {
writeData(const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(buf)), buflen);
writeData(const_cast<uint8_t*>(buf), buflen);
}

virtual short initialize() { // NOLINT
Expand Down
7 changes: 2 additions & 5 deletions libminifi/include/utils/HTTPClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,7 @@ enum class SSLVersion : uint8_t {

struct HTTPHeaderResponse {
public:
HTTPHeaderResponse(int max) // NOLINT
: max_tokens_(max)
, parsed(false) {
}
HTTPHeaderResponse(int max) : max_tokens_(max) , parsed(false) {} // NOLINT

/* Deprecated, headers are stored internally and can be accessed by getHeaderLines or getHeaderMap */
DEPRECATED(/*deprecated in*/ 0.7.0, /*will remove in */ 2.0) void append(const std::string &header) {
Expand Down Expand Up @@ -143,7 +140,7 @@ struct HTTPHeaderResponse {
size_t separator_pos = header_line.find(':');
if (separator_pos == std::string::npos) {
if (!last_key.empty() && (header_line[0] == ' ' || header_line[0] == '\t')) {
// This is a "folded header", which is deprecated(https: // www.ietf.org/rfc/rfc7230.txt) but here we are
// This is a "folded header", which is deprecated (https://www.ietf.org/rfc/rfc7230.txt) but here we are
header_mapping_[last_key].append(" " + utils::StringUtils::trim(header_line));
}
continue;
Expand Down
2 changes: 1 addition & 1 deletion libminifi/include/utils/MinifiConcurrentQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class ConcurrentQueue {

private:
ConcurrentQueue(ConcurrentQueue&& other, std::lock_guard<std::mutex>&)
: queue_(std::move(other.queue_) ) {}
: queue_(std::move(other.queue_)) {}

protected:
void checkLock(std::unique_lock<std::mutex>& lck) const {
Expand Down
22 changes: 12 additions & 10 deletions libminifi/include/utils/file/FileManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,19 @@ class FileManager {
unique_files_.push_back(file_name);
return file_name;
} else {
std::string tmpDir = "/tmp";
#ifdef WIN32
std::string tmpDir = "/tmp";
#ifdef WIN32
TCHAR lpTempPathBuffer[MAX_PATH];
GetTempPath(MAX_PATH, lpTempPathBuffer);
tmpDir = lpTempPathBuffer;
#endif
#endif
std::string file_name = tmpDir + FILE_SEPARATOR + non_repeating_string_generator_.generate();
while (!verify_not_exist(file_name)) {
file_name = tmpDir + FILE_SEPARATOR + non_repeating_string_generator_.generate();
}
if (!keep)
if (!keep) {
unique_files_.push_back(file_name);
}
return file_name;
}
}
Expand All @@ -97,17 +98,18 @@ class FileManager {
return boost::filesystem::unique_path().native();
#else
std::string tmpDir = "/tmp";
#ifdef WIN32
TCHAR lpTempPathBuffer[MAX_PATH];
GetTempPath(MAX_PATH, lpTempPathBuffer);
tmpDir = lpTempPathBuffer;
#endif
#ifdef WIN32
TCHAR lpTempPathBuffer[MAX_PATH];
GetTempPath(MAX_PATH, lpTempPathBuffer);
tmpDir = lpTempPathBuffer;
#endif
std::string file_name = tmpDir + FILE_SEPARATOR + non_repeating_string_generator_.generate();
while (!verify_not_exist(file_name)) {
file_name = tmpDir + FILE_SEPARATOR + non_repeating_string_generator_.generate();
}
if (!keep)
if (!keep) {
unique_files_.push_back(file_name);
}
return file_name;
#endif
}
Expand Down

0 comments on commit 1ef4094

Please sign in to comment.