diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-04-02 11:37:42 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-04-02 15:23:26 +0200 |
commit | 711ec7b6c71410b850cdf6d1411d054ca34ec5a0 (patch) | |
tree | 3d65f3db6a414c04f741ebf513146c82c7aa6880 /tools/source/generic/fract.cxx | |
parent | d7d487875246ba00d5be7e4fb0fd82b78fea5205 (diff) |
vcl: move Fraction reading/writing to GenericTypeSerializer
Change-Id: Iccacaa7fd9cffe1d99f76def854c2150bb4d94f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113499
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'tools/source/generic/fract.cxx')
-rw-r--r-- | tools/source/generic/fract.cxx | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx index 448a70c5ea33..b525d1de9896 100644 --- a/tools/source/generic/fract.cxx +++ b/tools/source/generic/fract.cxx @@ -370,39 +370,6 @@ bool operator > ( const Fraction& rVal1, const Fraction& rVal2 ) return toRational(rVal1.mnNumerator, rVal1.mnDenominator) > toRational(rVal2.mnNumerator, rVal2.mnDenominator); } -SvStream& ReadFraction( SvStream& rIStream, Fraction & rFract ) -{ - sal_Int32 num(0), den(0); - rIStream.ReadInt32( num ); - rIStream.ReadInt32( den ); - if ( den <= 0 ) - { - SAL_WARN( "tools.fraction", "'ReadFraction()' read an invalid fraction" ); - rFract.mbValid = false; - } - else - { - rFract.mnNumerator = num; - rFract.mnDenominator = den; - rFract.mbValid = true; - } - return rIStream; -} - -SvStream& WriteFraction( SvStream& rOStream, const Fraction& rFract ) -{ - if ( !rFract.mbValid ) - { - SAL_WARN( "tools.fraction", "'WriteFraction()' write an invalid fraction" ); - rOStream.WriteInt32( 0 ); - rOStream.WriteInt32( -1 ); - } else { - rOStream.WriteInt32( rFract.mnNumerator ); - rOStream.WriteInt32( rFract.mnDenominator ); - } - return rOStream; -} - // If dVal > LONG_MAX or dVal < LONG_MIN, the rational throws a boost::bad_rational. // Otherwise, dVal and denominator are multiplied by 8, until one of them // is larger than (LONG_MAX / 8). |