szaszm commented on a change in pull request #955:
URL: https://github.com/apache/nifi-minifi-cpp/pull/955#discussion_r556545707



##########
File path: libminifi/include/core/TypedValues.h
##########
@@ -128,72 +130,35 @@ class DataSizeValue : public TransformableValue, public 
state::response::UInt64V
   }
 
 
-// Convert String to Integer
+  // Convert String to Integer
   template<typename T, typename std::enable_if<
       std::is_integral<T>::value>::type* = nullptr>
   static bool StringToInt(const std::string &input, T &output) {
-    if (input.size() == 0) {
+    static std::map<std::string, int64_t> unit_map{
+      {"B", 1},
+      {"K", 1_KB}, {"M", 1_MB}, {"G", 1_GB}, {"T", 1_TB}, {"P", 1_PB},
+      {"KB", 1_KiB}, {"MB", 1_MiB}, {"GB", 1_GiB}, {"TB", 1_TiB}, {"PB", 
1_PiB},

Review comment:
       Consistency with nifi is more important than correct unit conversion 
IMHO. That doesn't mean we shouldn't change units to proper SI, but I'm a bit 
more worried as nifi is a larger project with more users and therefore more 
backwards compatibility obligations.




----------------------------------------------------------------
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]


Reply via email to