summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2021-06-11 15:44:56 +0200
committerJulien Nabet <serval2412@yahoo.fr>2021-06-11 18:12:48 +0200
commitb49fce18d0b05a8b5f462ba9bf6c84f0bb107d93 (patch)
tree5467d582e25cba593d89f22835fe0f8f2f697c12 /sc
parent513b54df70b5b9cde8d6ca2304378949256eea1d (diff)
Simplify vector initializations
Change-Id: Icf8972be204799e9b3b3824ab18d8584911fe1c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117061 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/column3.cxx4
-rw-r--r--sc/source/filter/excel/xestream.cxx24
2 files changed, 15 insertions, 13 deletions
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 365cba4d8489..73a2ed613548 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -723,9 +723,7 @@ void ScColumn::AttachNewFormulaCells( const sc::CellStoreType::position_type& aP
{
// Merge into one span.
// The original two spans are ordered from top to bottom.
- std::vector<SCROW> aRows(2);
- aRows[0] = std::min( rNewSharedRows[0], nTopRow);
- aRows[1] = std::max( rNewSharedRows[3], nBotRow);
+ std::vector<SCROW> aRows { std::min( rNewSharedRows[0], nTopRow), std::max( rNewSharedRows[3], nBotRow) };
rNewSharedRows.swap( aRows);
}
else
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 6c79d99469f1..ac63d34414b5 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -22,6 +22,7 @@
#include <utility>
#include <filter/msfilter/util.hxx>
+#include <o3tl/safeint.hxx>
#include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/random.h>
@@ -490,26 +491,29 @@ void XclExpBiff8Encrypter::GetDocId( sal_uInt8 pnDocId[16] ) const
void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt8 nData )
{
- vector<sal_uInt8> aByte(1);
- aByte[0] = nData;
+ vector<sal_uInt8> aByte { nData };
EncryptBytes(rStrm, aByte);
}
void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt16 nData )
{
- ::std::vector<sal_uInt8> pnBytes(2);
- pnBytes[0] = nData & 0xFF;
- pnBytes[1] = (nData >> 8) & 0xFF;
+ ::std::vector<sal_uInt8> pnBytes
+ {
+ o3tl::narrowing<sal_uInt8>(nData & 0xFF),
+ o3tl::narrowing<sal_uInt8>((nData >> 8) & 0xFF)
+ };
EncryptBytes(rStrm, pnBytes);
}
void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt32 nData )
{
- ::std::vector<sal_uInt8> pnBytes(4);
- pnBytes[0] = nData & 0xFF;
- pnBytes[1] = (nData >> 8) & 0xFF;
- pnBytes[2] = (nData >> 16) & 0xFF;
- pnBytes[3] = (nData >> 24) & 0xFF;
+ ::std::vector<sal_uInt8> pnBytes
+ {
+ o3tl::narrowing<sal_uInt8>(nData & 0xFF),
+ o3tl::narrowing<sal_uInt8>((nData >> 8) & 0xFF),
+ o3tl::narrowing<sal_uInt8>((nData >> 16) & 0xFF),
+ o3tl::narrowing<sal_uInt8>((nData >> 24) & 0xFF)
+ };
EncryptBytes(rStrm, pnBytes);
}