diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-05-25 11:47:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-05-26 10:35:30 +0200 |
commit | 24b2c636a230c04ab4b9c6ed7d041f6420f959f1 (patch) | |
tree | 400edf162c26e51817c2ade75bbd259ae320d99f /xmlsecurity | |
parent | 59793d67d4c0324730e30d71d94ba5173643d79c (diff) |
create SAL_RETURNS_NONNULL annotation
and apply it to some methods in OString and OUString
Change-Id: I30e91f961b6d310799d3641f68b7ed54b3080f3a
Reviewed-on: https://gerrit.libreoffice.org/38020
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/source/xmlsec/biginteger.cxx | 67 |
1 files changed, 31 insertions, 36 deletions
diff --git a/xmlsecurity/source/xmlsec/biginteger.cxx b/xmlsecurity/source/xmlsec/biginteger.cxx index 4f1004be1a97..3981754cb776 100644 --- a/xmlsecurity/source/xmlsec/biginteger.cxx +++ b/xmlsecurity/source/xmlsec/biginteger.cxx @@ -29,53 +29,48 @@ namespace xmlsecurity { Sequence< sal_Int8 > numericStringToBigInteger ( const OUString& numeral ) { - if( numeral.getStr() != nullptr ) - { - xmlChar* chNumeral ; - const xmlSecByte* bnInteger ; - xmlSecSize length ; - xmlSecBn bn ; + xmlChar* chNumeral ; + const xmlSecByte* bnInteger ; + xmlSecSize length ; + xmlSecBn bn ; - OString onumeral = OUStringToOString( numeral , RTL_TEXTENCODING_ASCII_US ) ; + OString onumeral = OUStringToOString( numeral , RTL_TEXTENCODING_ASCII_US ) ; - chNumeral = xmlStrndup( reinterpret_cast<const xmlChar*>(onumeral.getStr()), ( int )onumeral.getLength() ) ; - - if( xmlSecBnInitialize( &bn, 0 ) < 0 ) { - xmlFree( chNumeral ) ; - return Sequence< sal_Int8 >(); - } - - if( xmlSecBnFromDecString( &bn, chNumeral ) < 0 ) { - xmlFree( chNumeral ) ; - xmlSecBnFinalize( &bn ) ; - return Sequence< sal_Int8 >(); - } + chNumeral = xmlStrndup( reinterpret_cast<const xmlChar*>(onumeral.getStr()), ( int )onumeral.getLength() ) ; + if( xmlSecBnInitialize( &bn, 0 ) < 0 ) { xmlFree( chNumeral ) ; + return Sequence< sal_Int8 >(); + } - length = xmlSecBnGetSize( &bn ) ; - if( length <= 0 ) { - xmlSecBnFinalize( &bn ) ; - return Sequence< sal_Int8 >(); - } + if( xmlSecBnFromDecString( &bn, chNumeral ) < 0 ) { + xmlFree( chNumeral ) ; + xmlSecBnFinalize( &bn ) ; + return Sequence< sal_Int8 >(); + } - bnInteger = xmlSecBnGetData( &bn ) ; - if( bnInteger == nullptr ) { - xmlSecBnFinalize( &bn ) ; - return Sequence< sal_Int8 >(); - } + xmlFree( chNumeral ) ; - Sequence< sal_Int8 > integer( length ) ; - for( xmlSecSize i = 0 ; i < length ; i ++ ) - { - integer[i] = *( bnInteger + i ) ; - } + length = xmlSecBnGetSize( &bn ) ; + if( length <= 0 ) { + xmlSecBnFinalize( &bn ) ; + return Sequence< sal_Int8 >(); + } + bnInteger = xmlSecBnGetData( &bn ) ; + if( bnInteger == nullptr ) { xmlSecBnFinalize( &bn ) ; - return integer ; + return Sequence< sal_Int8 >(); + } + + Sequence< sal_Int8 > integer( length ) ; + for( xmlSecSize i = 0 ; i < length ; i ++ ) + { + integer[i] = *( bnInteger + i ) ; } - return Sequence< sal_Int8 >(); + xmlSecBnFinalize( &bn ) ; + return integer ; } OUString bigIntegerToNumericString ( const Sequence< sal_Int8 >& integer ) |