]> granicus.if.org Git - icu/commitdiff
Merge branch 'units-staging' into units_constants
authorHugo van der Merwe <17109322+hugovdm@users.noreply.github.com>
Wed, 15 Jul 2020 15:30:16 +0000 (17:30 +0200)
committerHugo van der Merwe <17109322+hugovdm@users.noreply.github.com>
Wed, 15 Jul 2020 15:30:16 +0000 (17:30 +0200)
1  2 
icu4c/source/i18n/unitconverter.cpp
icu4c/source/i18n/unitconverter.h

index 8614a5e5b1c7fbff89a399931f0aa659548abd0d,e03e7c6174537664e8407b2f1293fb985fa18d10..97a5e3d5a73112e11d06967be08eef2a2a7ae89a
@@@ -322,20 -322,17 +326,20 @@@ void loadConversionRate(ConversionRate 
  
  } // namespace
  
- void U_I18N_API addSingleFactorConstant(StringPiece baseStr, int32_t power, SigNum sigNum,
 +// Conceptually, this modifies factor: factor *= baseStr^(signum*power).
 +//
 +// baseStr must be a known constant or a value that strToDouble() is able to
 +// parse.
+ void U_I18N_API addSingleFactorConstant(StringPiece baseStr, int32_t power, Signum signum,
                                          Factor &factor, UErrorCode &status) {
 -
      if (baseStr == "ft_to_m") {
-         factor.constants[CONSTANT_FT2M] += power * sigNum;
+         factor.constants[CONSTANT_FT2M] += power * signum;
      } else if (baseStr == "ft2_to_m2") {
-         factor.constants[CONSTANT_FT2M] += 2 * power * sigNum;
+         factor.constants[CONSTANT_FT2M] += 2 * power * signum;
      } else if (baseStr == "ft3_to_m3") {
-         factor.constants[CONSTANT_FT2M] += 3 * power * sigNum;
+         factor.constants[CONSTANT_FT2M] += 3 * power * signum;
      } else if (baseStr == "in3_to_m3") {
-         factor.constants[CONSTANT_FT2M] += 3 * power * sigNum;
+         factor.constants[CONSTANT_FT2M] += 3 * power * signum;
          factor.factorDen *= 12 * 12 * 12;
      } else if (baseStr == "gal_to_m3") {
          factor.factorNum *= 231;
index 25967887e3d54ce4e8663e69958463ca166f2be3,92a7e6ee0079df94207e0939f3c3408a87d5eeb4..7d0eb9d5cbbd2b7c952a3dc1890dec85fdd68d1e
@@@ -30,13 -29,13 +29,13 @@@ enum Constants 
      CONSTANTS_COUNT
  };
  
- typedef enum SigNum {
+ typedef enum Signum {
      NEGATIVE = -1,
      POSITIVE = 1,
- } SigNum;
+ } Signum;
  
  /* Represents a conversion factor */
 -struct Factor {
 +struct U_I18N_API Factor {
      double factorNum = 1;
      double factorDen = 1;
      double offset = 0;