diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-01-22 14:33:23 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-01-23 14:04:25 +0100 |
commit | 853c2fc71a96755a9dee629fd5d0e1cff9a48034 (patch) | |
tree | d4e6429ade20f5cc1a701932e70708ddb6b2fbf6 /include | |
parent | ba68436e3fea34b4ae696f96f8048502865cdc79 (diff) |
sal: try to avoid abuse of OUStringBuffer(int) ctor
... to avoid bugs like commit f0d6e0e1e21afd0adf5bd01d771b2d83d8f13a48.
Change-Id: I1e41d421609e09bf62a7a04ba34f3a8e8d118fd3
Diffstat (limited to 'include')
-rw-r--r-- | include/rtl/strbuf.hxx | 17 | ||||
-rw-r--r-- | include/rtl/ustrbuf.hxx | 17 |
2 files changed, 34 insertions, 0 deletions
diff --git a/include/rtl/strbuf.hxx b/include/rtl/strbuf.hxx index 9352d54307c8..5450472c2fe1 100644 --- a/include/rtl/strbuf.hxx +++ b/include/rtl/strbuf.hxx @@ -96,6 +96,23 @@ public: { rtl_string_new_WithLength( &pData, length ); } +#if __cplusplus >= 201103L + explicit OStringBuffer(unsigned int length) + : OStringBuffer(static_cast<int>(length)) + { + } + explicit OStringBuffer(long length) + : OStringBuffer(static_cast<int>(length)) + { + } + explicit OStringBuffer(unsigned long length) + : OStringBuffer(static_cast<int>(length)) + { + } + // avoid obvious bugs + explicit OStringBuffer(char) = delete; + explicit OStringBuffer(sal_Unicode) = delete; +#endif /** Constructs a string buffer so that it represents the same diff --git a/include/rtl/ustrbuf.hxx b/include/rtl/ustrbuf.hxx index a9252b851ce1..0240557f65ba 100644 --- a/include/rtl/ustrbuf.hxx +++ b/include/rtl/ustrbuf.hxx @@ -91,6 +91,23 @@ public: { rtl_uString_new_WithLength( &pData, length ); } +#if __cplusplus >= 201103L + explicit OUStringBuffer(unsigned int length) + : OUStringBuffer(static_cast<int>(length)) + { + } + explicit OUStringBuffer(long length) + : OUStringBuffer(static_cast<int>(length)) + { + } + explicit OUStringBuffer(unsigned long length) + : OUStringBuffer(static_cast<int>(length)) + { + } + // avoid obvious bugs + explicit OUStringBuffer(char) = delete; + explicit OUStringBuffer(sal_Unicode) = delete; +#endif /** Constructs a string buffer so that it represents the same |