adamdebreceni commented on a change in pull request #917:
URL: https://github.com/apache/nifi-minifi-cpp/pull/917#discussion_r502398968
##########
File path: extensions/libarchive/BinFiles.h
##########
@@ -146,36 +146,23 @@ class Bin {
// BinManager Class
class BinManager {
public:
- // Constructor
- /*!
- * Create a new BinManager
- */
- BinManager()
- : minSize_(0),
- maxSize_(ULLONG_MAX),
- maxEntries_(INT_MAX),
- minEntries_(1),
- binAge_(ULLONG_MAX),
- binCount_(0),
- logger_(logging::LoggerFactory<BinManager>::getLogger()) {
- }
virtual ~BinManager() {
purge();
}
void setMinSize(const uint64_t &size) {
- minSize_ = size;
+ minSize_ = {size};
}
void setMaxSize(const uint64_t &size) {
- maxSize_ = size;
+ maxSize_ = {size};
}
- void setMaxEntries(const int &entries) {
- maxEntries_ = entries;
+ void setMaxEntries(const uint32_t &entries) {
+ maxEntries_ = {entries};
}
- void setMinEntries(const int &entries) {
- minEntries_ = entries;
+ void setMinEntries(const uint32_t &entries) {
+ minEntries_ = {entries};
}
void setBinAge(const uint64_t &age) {
- binAge_ = age;
+ binAge_ = {age};
Review comment:
braces are added to prevent implicit narrowing, so we get a compile
error for the following:
```
int a = 0;
long b = 3;
a = {b};
```
+1 for passig by values
##########
File path: extensions/libarchive/BinFiles.h
##########
@@ -146,36 +146,23 @@ class Bin {
// BinManager Class
class BinManager {
public:
- // Constructor
- /*!
- * Create a new BinManager
- */
- BinManager()
- : minSize_(0),
- maxSize_(ULLONG_MAX),
- maxEntries_(INT_MAX),
- minEntries_(1),
- binAge_(ULLONG_MAX),
- binCount_(0),
- logger_(logging::LoggerFactory<BinManager>::getLogger()) {
- }
virtual ~BinManager() {
purge();
}
void setMinSize(const uint64_t &size) {
- minSize_ = size;
+ minSize_ = {size};
}
void setMaxSize(const uint64_t &size) {
- maxSize_ = size;
+ maxSize_ = {size};
}
- void setMaxEntries(const int &entries) {
- maxEntries_ = entries;
+ void setMaxEntries(const uint32_t &entries) {
+ maxEntries_ = {entries};
}
- void setMinEntries(const int &entries) {
- minEntries_ = entries;
+ void setMinEntries(const uint32_t &entries) {
+ minEntries_ = {entries};
}
void setBinAge(const uint64_t &age) {
- binAge_ = age;
+ binAge_ = {age};
Review comment:
braces are added to prevent implicit narrowing, so we get a compile
error for the following:
```
int a = 0;
long b = 3;
a = {b};
```
+1 for passing by values
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]