diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-31 16:00:02 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-02 11:07:55 +0200 |
commit | 2f3684b2289a8c46dc6144064a452cc529400f28 (patch) | |
tree | fc460328cc6963b9a156c23395ce8f15c70e878d /include/rtl/string.h | |
parent | 4804a1474ccba8df57f0a0151bd69237e82eb618 (diff) |
[API CHANGE] add some more asserts to the string functions
rtl_[u]String_alloc now requires that the length be >= 0.
Since this function is only @since Libreoffice 4.1, it is unlikely
to be widely used externally.
Removed some unit tests that were testing invalid or out of
range paramers, which are already not allowed according to the
documented contract of those functions.
The change in writerfilter is because the new asserts triggered
when running testFdo74745
The change in SwTextNode::EraseText is because testFdo60842
triggered the assert in replaceAt.
The change in SwFieldSlot::SwFieldSlot is because
testMoveRange::Import_Export_Import triggered the assert in
replaceAt.
The changes in SwFieldSlot::SwFieldSlot and TabControl::ImplGetItemSize
are due to failures in the uitests.
Change-Id: Ib317261067649b0de96df12873ce31360cd24681
Reviewed-on: https://gerrit.libreoffice.org/58390
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/rtl/string.h')
-rw-r--r-- | include/rtl/string.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/rtl/string.h b/include/rtl/string.h index ecf4704b0999..17ab629005b3 100644 --- a/include/rtl/string.h +++ b/include/rtl/string.h @@ -886,7 +886,7 @@ SAL_DLLPUBLIC void SAL_CALL rtl_string_new( rtl_String ** newStr ) SAL_THROW_EXT The reference count of the new string will be 1. The length of the string will be nLen. This function does not handle out-of-memory conditions. - For nLen < 0 or failed allocation this method returns NULL. + For failed allocation this method returns NULL. The characters of the capacity are not cleared, and the length is set to nLen, unlike the similar method of rtl_String_new_WithLength which @@ -897,7 +897,8 @@ SAL_DLLPUBLIC void SAL_CALL rtl_string_new( rtl_String ** newStr ) SAL_THROW_EXT alternatively pass ownership to an OUString with rtl::OUString(newStr, SAL_NO_ACQUIRE); - @param[out] nLen the number of characters. + @param[out] nLen the number of characters. Must be >= 0. + @return pointer to the new string. @since LibreOffice 4.1 |