diff options
author | Noel Grandin <noel@peralex.com> | 2015-01-05 08:47:31 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-01-05 12:57:18 +0200 |
commit | 8130714148d58dd2bf1ef12dcc6dd6d5838be0d1 (patch) | |
tree | bf8cf91d9837b9d03e1e3e336be7eb35667d4de9 /tools | |
parent | 54942f0d093e42b06c7a6c10e93d632bfe0c6519 (diff) |
fdo#84938: replace NUMBERFORMAT_INT_ constants with 'enum class'
Change-Id: I9c67de31f5571b282adc132d973b79bccb35fdc9
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qa/cppunit/test_stream.cxx | 4 | ||||
-rw-r--r-- | tools/source/generic/poly.cxx | 8 | ||||
-rw-r--r-- | tools/source/stream/stream.cxx | 20 |
3 files changed, 16 insertions, 16 deletions
diff --git a/tools/qa/cppunit/test_stream.cxx b/tools/qa/cppunit/test_stream.cxx index 57c30e506eae..5c9d8fdc6ac8 100644 --- a/tools/qa/cppunit/test_stream.cxx +++ b/tools/qa/cppunit/test_stream.cxx @@ -187,7 +187,7 @@ namespace CPPUNIT_ASSERT(!aMemStream.bad()); CPPUNIT_ASSERT(aMemStream.eof()); - aMemStream.SetNumberFormatInt(NUMBERFORMAT_INT_BIGENDIAN); + aMemStream.SetEndian(SvStreamEndian::BIG); aMemStream.Seek(0); foo[0] = 0; foo[1] = 3; @@ -197,7 +197,7 @@ namespace CPPUNIT_ASSERT(!aMemStream.bad()); CPPUNIT_ASSERT(!aMemStream.eof()); - aMemStream.SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); + aMemStream.SetEndian(SvStreamEndian::LITTLE); aMemStream.Seek(0); foo[0] = 3; foo[1] = 0; diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 5d8f88a0afc2..c1eb8b57efcb 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -1560,9 +1560,9 @@ SvStream& ReadPolygon( SvStream& rIStream, Polygon& rPoly ) } #if (SAL_TYPES_SIZEOFLONG) == 4 #ifdef OSL_BIGENDIAN - if ( rIStream.GetNumberFormatInt() == NUMBERFORMAT_INT_BIGENDIAN ) + if ( rIStream.GetEndian() == SvStreamEndian::BIG ) #else - if ( rIStream.GetNumberFormatInt() == NUMBERFORMAT_INT_LITTLEENDIAN ) + if ( rIStream.GetEndian() == SvStreamEndian::LITTLE ) #endif rIStream.Read( rPoly.mpImplPolygon->mpPointAry, nPoints*sizeof(Point) ); else @@ -1595,9 +1595,9 @@ SvStream& WritePolygon( SvStream& rOStream, const Polygon& rPoly ) // Determine whether we need to write through operators #if (SAL_TYPES_SIZEOFLONG) == 4 #ifdef OSL_BIGENDIAN - if ( rOStream.GetNumberFormatInt() == NUMBERFORMAT_INT_BIGENDIAN ) + if ( rOStream.GetEndian() == SvStreamEndian::BIG ) #else - if ( rOStream.GetNumberFormatInt() == NUMBERFORMAT_INT_LITTLEENDIAN ) + if ( rOStream.GetEndian() == SvStreamEndian::LITTLE ) #endif { if ( nPoints ) diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index 864876fc52e3..db4a39811671 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -388,7 +388,7 @@ void SvStream::ImpInit() eLineDelimiter = LINEEND_CRLF; // DOS-Format #endif - SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); + SetEndian( SvStreamEndian::LITTLE ); m_nBufFilePos = 0; nBufActualPos = 0; @@ -450,15 +450,15 @@ void SvStream::SetError( sal_uInt32 nErrorCode ) nError = nErrorCode; } -void SvStream::SetNumberFormatInt( sal_uInt16 nNewFormat ) +void SvStream::SetEndian( SvStreamEndian nNewFormat ) { - nNumberFormatInt = nNewFormat; + nEndian = nNewFormat; bSwap = false; #ifdef OSL_BIGENDIAN - if( nNumberFormatInt == NUMBERFORMAT_INT_LITTLEENDIAN ) + if( nEndian == SvStreamEndian::LITTLE ) bSwap = true; #else - if( nNumberFormatInt == NUMBERFORMAT_INT_BIGENDIAN ) + if( nEndian == SvStreamEndian::BIG ) bSwap = true; #endif } @@ -795,11 +795,11 @@ bool SvStream::WriteUniOrByteChar( sal_Unicode ch, rtl_TextEncoding eDestCharSet bool SvStream::StartWritingUnicodeText() { - SetEndianSwap( false ); // write native format // BOM, Byte Order Mark, U+FEFF, see // http://www.unicode.org/faq/utf_bom.html#BOM // Upon read: 0xfeff(-257) => no swap; 0xfffe(-2) => swap - WriteUInt16( 0xfeff ); + sal_uInt16 v = 0xfeff; + WRITENUMBER_WITHOUT_SWAP(sal_uInt16, v); // write native format return nError == SVSTREAM_OK; } @@ -827,18 +827,18 @@ bool SvStream::StartReadingUnicodeText( rtl_TextEncoding eReadBomCharSet ) if ( eReadBomCharSet == RTL_TEXTENCODING_DONTKNOW || eReadBomCharSet == RTL_TEXTENCODING_UNICODE) { - SetEndianSwap( !bSwap ); + SetEndian( nEndian == SvStreamEndian::BIG ? SvStreamEndian::LITTLE : SvStreamEndian::BIG ); nBack = 0; } break; case 0xefbb : - if (nNumberFormatInt == NUMBERFORMAT_INT_BIGENDIAN && + if (nEndian == SvStreamEndian::BIG && (eReadBomCharSet == RTL_TEXTENCODING_DONTKNOW || eReadBomCharSet == RTL_TEXTENCODING_UTF8)) bTryUtf8 = true; break; case 0xbbef : - if (nNumberFormatInt == NUMBERFORMAT_INT_LITTLEENDIAN && + if (nEndian == SvStreamEndian::LITTLE && (eReadBomCharSet == RTL_TEXTENCODING_DONTKNOW || eReadBomCharSet == RTL_TEXTENCODING_UTF8)) bTryUtf8 = true; |