File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
src/Confluent.SchemaRegistry.Serdes.Protobuf
test/Confluent.SchemaRegistry.Serdes.UnitTests Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -35,8 +35,10 @@ public static Decimal ToProtobufDecimal(this decimal value)
35
35
{
36
36
var bytes = GetBytesFromDecimal ( value ) ;
37
37
38
- var unscaledValueBytes = new byte [ 12 ] ;
39
- Array . Copy ( bytes , unscaledValueBytes , unscaledValueBytes . Length ) ;
38
+ // Copy the 12 bytes into an array of size 13 so that the last byte is 0,
39
+ // which will ensure that the unscaled value is positive.
40
+ var unscaledValueBytes = new byte [ 13 ] ;
41
+ Array . Copy ( bytes , unscaledValueBytes , 12 ) ;
40
42
41
43
var unscaledValue = new BigInteger ( unscaledValueBytes ) ;
42
44
var scale = bytes [ 14 ] ;
Original file line number Diff line number Diff line change @@ -19,7 +19,9 @@ public void ConvertDecimals()
19
19
- 123456789123456789.56m ,
20
20
- 1234m ,
21
21
- 1234.5m ,
22
- - 1234.56m
22
+ - 1234.56m ,
23
+ 4.1748330066797328106875724500m ,
24
+ - 4.1748330066797328106875724500m
23
25
} ;
24
26
25
27
foreach ( var input in inputs )
You can’t perform that action at this time.
0 commit comments