You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by mg...@apache.org on 2022/01/30 20:27:18 UTC
[avro] branch branch-1.11 updated: AVRO-3324 Styling - Added braces for if statements (#1475)
This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch branch-1.11
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/branch-1.11 by this push:
new ef3fb50 AVRO-3324 Styling - Added braces for if statements (#1475)
ef3fb50 is described below
commit ef3fb50465f4f44859a40b665f5ca23870299905
Author: Kyle Schoonover <ky...@minmaxcorp.com>
AuthorDate: Sun Jan 30 12:26:48 2022 -0800
AVRO-3324 Styling - Added braces for if statements (#1475)
Co-authored-by: Kyle T. Schoonover <Ky...@nordstrom.com>
(cherry picked from commit f7188bed2888d72a91c27e3ff0e7da63fe4ecc35)
---
lang/csharp/src/apache/main/AvroDecimal.cs | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/lang/csharp/src/apache/main/AvroDecimal.cs b/lang/csharp/src/apache/main/AvroDecimal.cs
index 81b6755..b7c4d47 100644
--- a/lang/csharp/src/apache/main/AvroDecimal.cs
+++ b/lang/csharp/src/apache/main/AvroDecimal.cs
@@ -61,7 +61,9 @@ namespace Avro
var scale = bytes[14];
if (bytes[15] == 128)
+ {
unscaledValue *= BigInteger.MinusOne;
+ }
UnscaledValue = unscaledValue;
Scale = scale;
@@ -142,7 +144,9 @@ namespace Avro
var number = UnscaledValue.ToString($"D{Scale + 1}", CultureInfo.CurrentCulture);
if (Scale > 0)
+ {
return number.Insert(number.Length - Scale, CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator);
+ }
return number;
}
@@ -717,10 +721,14 @@ namespace Avro
public int CompareTo(object obj)
{
if (obj == null)
+ {
return 1;
+ }
if (!(obj is AvroDecimal))
+ {
throw new ArgumentException("Compare to object must be a BigDecimal", nameof(obj));
+ }
return CompareTo((AvroDecimal)obj);
}
@@ -739,11 +747,15 @@ namespace Avro
// if both are the same value, return the value
if (unscaledValueCompare == scaleCompare)
+ {
return unscaledValueCompare;
+ }
// if the scales are both the same return unscaled value
if (scaleCompare == 0)
+ {
return unscaledValueCompare;
+ }
var scaledValue = BigInteger.Divide(UnscaledValue, BigInteger.Pow(new BigInteger(10), Scale));
var otherScaledValue = BigInteger.Divide(other.UnscaledValue, BigInteger.Pow(new BigInteger(10), other.Scale));