fix-wshadow-warnings.patch 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. diff --git a/mfbt/decimal/Decimal.cpp b/mfbt/decimal/Decimal.cpp
  2. --- a/mfbt/decimal/Decimal.cpp
  3. +++ b/mfbt/decimal/Decimal.cpp
  4. @@ -118,18 +118,18 @@ Decimal SpecialValueHandler::value() con
  5. ASSERT_NOT_REACHED();
  6. return m_lhs;
  7. }
  8. }
  9. // This class is used for 128 bit unsigned integer arithmetic.
  10. class UInt128 {
  11. public:
  12. - UInt128(uint64_t low, uint64_t high)
  13. - : m_high(high), m_low(low)
  14. + UInt128(uint64_t aLow, uint64_t aHigh)
  15. + : m_high(aHigh), m_low(aLow)
  16. {
  17. }
  18. UInt128& operator/=(uint32_t);
  19. uint64_t high() const { return m_high; }
  20. uint64_t low() const { return m_low; }
  21. @@ -224,68 +224,68 @@ static uint64_t scaleUp(uint64_t x, int
  22. z = z * z;
  23. }
  24. }
  25. } // namespace DecimalPrivate
  26. using namespace DecimalPrivate;
  27. -Decimal::EncodedData::EncodedData(Sign sign, FormatClass formatClass)
  28. +Decimal::EncodedData::EncodedData(Sign aSign, FormatClass aFormatClass)
  29. : m_coefficient(0)
  30. , m_exponent(0)
  31. - , m_formatClass(formatClass)
  32. - , m_sign(sign)
  33. + , m_formatClass(aFormatClass)
  34. + , m_sign(aSign)
  35. {
  36. }
  37. -Decimal::EncodedData::EncodedData(Sign sign, int exponent, uint64_t coefficient)
  38. - : m_formatClass(coefficient ? ClassNormal : ClassZero)
  39. - , m_sign(sign)
  40. +Decimal::EncodedData::EncodedData(Sign aSign, int aExponent, uint64_t aCoefficient)
  41. + : m_formatClass(aCoefficient ? ClassNormal : ClassZero)
  42. + , m_sign(aSign)
  43. {
  44. - if (exponent >= ExponentMin && exponent <= ExponentMax) {
  45. - while (coefficient > MaxCoefficient) {
  46. - coefficient /= 10;
  47. - ++exponent;
  48. + if (aExponent >= ExponentMin && aExponent <= ExponentMax) {
  49. + while (aCoefficient > MaxCoefficient) {
  50. + aCoefficient /= 10;
  51. + ++aExponent;
  52. }
  53. }
  54. - if (exponent > ExponentMax) {
  55. + if (aExponent > ExponentMax) {
  56. m_coefficient = 0;
  57. m_exponent = 0;
  58. m_formatClass = ClassInfinity;
  59. return;
  60. }
  61. - if (exponent < ExponentMin) {
  62. + if (aExponent < ExponentMin) {
  63. m_coefficient = 0;
  64. m_exponent = 0;
  65. m_formatClass = ClassZero;
  66. return;
  67. }
  68. - m_coefficient = coefficient;
  69. - m_exponent = static_cast<int16_t>(exponent);
  70. + m_coefficient = aCoefficient;
  71. + m_exponent = static_cast<int16_t>(aExponent);
  72. }
  73. bool Decimal::EncodedData::operator==(const EncodedData& another) const
  74. {
  75. return m_sign == another.m_sign
  76. && m_formatClass == another.m_formatClass
  77. && m_exponent == another.m_exponent
  78. && m_coefficient == another.m_coefficient;
  79. }
  80. Decimal::Decimal(int32_t i32)
  81. : m_data(i32 < 0 ? Negative : Positive, 0, i32 < 0 ? static_cast<uint64_t>(-static_cast<int64_t>(i32)) : static_cast<uint64_t>(i32))
  82. {
  83. }
  84. -Decimal::Decimal(Sign sign, int exponent, uint64_t coefficient)
  85. - : m_data(sign, coefficient ? exponent : 0, coefficient)
  86. +Decimal::Decimal(Sign aSign, int aExponent, uint64_t aCoefficient)
  87. + : m_data(aSign, aCoefficient ? aExponent : 0, aCoefficient)
  88. {
  89. }
  90. Decimal::Decimal(const EncodedData& data)
  91. : m_data(data)
  92. {
  93. }
  94. @@ -479,32 +479,32 @@ Decimal Decimal::operator/(const Decimal
  95. if (rhs.isZero())
  96. return lhs.isZero() ? nan() : infinity(resultSign);
  97. int resultExponent = lhs.exponent() - rhs.exponent();
  98. if (lhs.isZero())
  99. return Decimal(resultSign, resultExponent, 0);
  100. - uint64_t remainder = lhs.m_data.coefficient();
  101. + uint64_t lhsRemainder = lhs.m_data.coefficient();
  102. const uint64_t divisor = rhs.m_data.coefficient();
  103. uint64_t result = 0;
  104. while (result < MaxCoefficient / 100) {
  105. - while (remainder < divisor) {
  106. - remainder *= 10;
  107. + while (lhsRemainder < divisor) {
  108. + lhsRemainder *= 10;
  109. result *= 10;
  110. --resultExponent;
  111. }
  112. - result += remainder / divisor;
  113. - remainder %= divisor;
  114. - if (!remainder)
  115. + result += lhsRemainder / divisor;
  116. + lhsRemainder %= divisor;
  117. + if (!lhsRemainder)
  118. break;
  119. }
  120. - if (remainder > divisor / 2)
  121. + if (lhsRemainder > divisor / 2)
  122. ++result;
  123. return Decimal(resultSign, resultExponent, result);
  124. }
  125. bool Decimal::operator==(const Decimal& rhs) const
  126. {
  127. if (isNaN() || rhs.isNaN())
  128. diff --git a/mfbt/decimal/Decimal.h b/mfbt/decimal/Decimal.h
  129. --- a/mfbt/decimal/Decimal.h
  130. +++ b/mfbt/decimal/Decimal.h
  131. @@ -88,17 +88,17 @@ public:
  132. int countDigits() const;
  133. int exponent() const { return m_exponent; }
  134. bool isFinite() const { return !isSpecial(); }
  135. bool isInfinity() const { return m_formatClass == ClassInfinity; }
  136. bool isNaN() const { return m_formatClass == ClassNaN; }
  137. bool isSpecial() const { return m_formatClass == ClassInfinity || m_formatClass == ClassNaN; }
  138. bool isZero() const { return m_formatClass == ClassZero; }
  139. Sign sign() const { return m_sign; }
  140. - void setSign(Sign sign) { m_sign = sign; }
  141. + void setSign(Sign aSign) { m_sign = aSign; }
  142. private:
  143. enum FormatClass {
  144. ClassInfinity,
  145. ClassNormal,
  146. ClassNaN,
  147. ClassZero,
  148. };