diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-10-04 11:34:57 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-10-27 13:59:09 +0100 |
commit | 7e89e2827489d0b3bbd488f6c9e5a9e7e404d732 (patch) | |
tree | ca34b4ec312dffbe8e71a8106a4c3d21478d64a1 /sw | |
parent | 99628775132143936fcd00ca9e18a853616418e4 (diff) |
sal_uIntPtr to sal_uInt64, sal_uLong to sal_Size for streams
Change-Id: I062f1f6c5b20ca47734a9a3cd1a229d51763a206
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/edit/edglss.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/unocore/unoobj.cxx | 22 | ||||
-rw-r--r-- | sw/source/filter/html/htmlplug.cxx | 3 |
3 files changed, 16 insertions, 14 deletions
diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx index 01d452287fa9..5ffbdfcfa1b2 100644 --- a/sw/source/core/edit/edglss.cxx +++ b/sw/source/core/edit/edglss.cxx @@ -325,8 +325,9 @@ bool SwEditShell::GetSelectedText( OUString &rBuf, int nHndlParaBrk ) rBuf = OUString(p); else { - sal_Size nLen = aStream.GetSize(); - rtl_uString *pStr = rtl_uString_alloc(nLen / sizeof( sal_Unicode )); + const sal_uInt64 nLen = aStream.GetSize(); + OSL_ENSURE( nLen/sizeof( sal_Unicode )<static_cast<sal_uInt64>(SAL_MAX_INT32), "Stream can't fit in OUString" ); + rtl_uString *pStr = rtl_uString_alloc(static_cast<sal_Int32>(nLen / sizeof( sal_Unicode ))); aStream.Seek( 0 ); aStream.ResetError(); //endian specific?, yipes! diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 6dc51fd6fc3f..5309a624c6e7 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -187,20 +187,20 @@ void SwUnoCursorHelper::GetTextFromPam(SwPaM & rPam, OUString & rBuffer) const bool bOldShowProgress = xWrt->bShowProgress; xWrt->bShowProgress = false; - long lLen; - if( !IsError( aWriter.Write( xWrt ) ) && - 0x7ffffff > (( lLen = aStream.GetSize() ) - / sizeof( sal_Unicode )) + 1 ) + if( !IsError( aWriter.Write( xWrt ) ) ) { - aStream.WriteUInt16( '\0' ); + const sal_uInt64 lUniLen = aStream.GetSize()/sizeof( sal_Unicode ); + if (lUniLen < static_cast<sal_uInt64>(SAL_MAX_INT32-1)) + { + aStream.WriteUInt16( '\0' ); - aStream.Seek( 0 ); - aStream.ResetError(); + aStream.Seek( 0 ); + aStream.ResetError(); - long lUniLen = (lLen / sizeof( sal_Unicode )); - rtl_uString *pStr = rtl_uString_alloc(lUniLen); - aStream.Read(pStr->buffer, lUniLen * sizeof(sal_Unicode)); - rBuffer = OUString(pStr, SAL_NO_ACQUIRE); + rtl_uString *pStr = rtl_uString_alloc(lUniLen); + aStream.Read(pStr->buffer, lUniLen * sizeof(sal_Unicode)); + rBuffer = OUString(pStr, SAL_NO_ACQUIRE); + } } xWrt->bShowProgress = bOldShowProgress; } diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index 95e8e57fd8ba..f189dd3f95e0 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -1299,7 +1299,8 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, const SwFrameFormat& rFrame aMediaDescriptor["FilterOptions"] <<= OUString("SkipHeaderFooter"); aMediaDescriptor["OutputStream"] <<= xOutputStream; xStorable->storeToURL("private:stream", aMediaDescriptor.getAsConstPropertyValueList()); - OString aData(static_cast<const char*>(aStream.GetData()), aStream.GetSize()); + SAL_WARN_IF(aStream.GetSize()>=static_cast<sal_uInt64>(SAL_MAX_INT32), "sw.html", "Stream can't fit in OString"); + OString aData(static_cast<const char*>(aStream.GetData()), static_cast<sal_Int32>(aStream.GetSize())); // Wrap output in a <span> tag to avoid 'HTML parser error: Unexpected end tag: p' HTMLOutFuncs::Out_AsciiTag(rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_span); rWrt.Strm().WriteCharPtr(aData.getStr()); |