diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2020-03-24 16:13:49 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-03-24 18:06:23 +0100 |
commit | 7b122710e8d0fad1fbd4d65b48f6bead09213a2c (patch) | |
tree | 82561875148d141e2987366a16a334dfb1065164 /basic/source | |
parent | 7de7512718ac192fcad441d5500d056316f72d72 (diff) |
Initialize buffer
Also assert that correct data type is passed to SbiStringPool::Add.
Change-Id: I774d983be82d702b31de1054d13661e1d0e9c1dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90983
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basic/source')
-rw-r--r-- | basic/source/comp/symtbl.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx index ac6f1ecd29da..8385a31a3fdd 100644 --- a/basic/source/comp/symtbl.cxx +++ b/basic/source/comp/symtbl.cxx @@ -63,7 +63,7 @@ short SbiStringPool::Add( const OUString& rVal ) short SbiStringPool::Add( double n, SbxDataType t ) { - char buf[ 40 ]; + char buf[40]{}; switch( t ) { // tdf#131296 - store numeric value including its type character @@ -73,7 +73,7 @@ short SbiStringPool::Add( double n, SbxDataType t ) case SbxSINGLE: snprintf( buf, sizeof(buf), "%.6g!", static_cast<float>(n) ); break; case SbxDOUBLE: snprintf( buf, sizeof(buf), "%.16g", n ); break; // default processing in SbiRuntime::StepLOADNC - no type character case SbxCURRENCY: snprintf(buf, sizeof(buf), "%.16g@", n); break; - default: break; + default: assert(false); break; // should not happen } return Add( OUString::createFromAscii( buf ) ); } |