[Libreoffice-commits] .: sal/inc

Lubos Lunak llunak at kemper.freedesktop.org
Wed Mar 28 22:42:37 PDT 2012


 sal/inc/rtl/stringutils.hxx |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit dbf238ba0a76c64643a28fc3fd9d0d3ede848dd7
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Thu Mar 29 07:39:03 2012 +0200

    (const) char[] is a plain C string type too
    
    and it's size is not known, so it cannot be taken as a string literal

diff --git a/sal/inc/rtl/stringutils.hxx b/sal/inc/rtl/stringutils.hxx
index 3bf72c5..19c1bf4 100644
--- a/sal/inc/rtl/stringutils.hxx
+++ b/sal/inc/rtl/stringutils.hxx
@@ -50,7 +50,8 @@ namespace internal
 {
 /*
 These templates use SFINAE (Substitution failure is not an error) to help distinguish the various
-plain C string types: char*, const char*, char[N] and const char[N]. There are 2 cases:
+plain C string types: char*, const char*, char[N], const char[N], char[] and const char[].
+There are 2 cases:
 1) Only string literal (i.e. const char[N]) is wanted, not any of the others.
     In this case it is necessary to distinguish between const char[N] and char[N], as the latter
     would be automatically converted to the const variant, which is not wanted (not a string literal
@@ -90,6 +91,16 @@ struct NonConstCharArrayDetector< char[ N ], T >
 {
     typedef T Type;
 };
+template< typename T >
+struct NonConstCharArrayDetector< char[], T >
+{
+    typedef T Type;
+};
+template< typename T >
+struct NonConstCharArrayDetector< const char[], T >
+{
+    typedef T Type;
+};
 
 template< typename T1, typename T2 >
 struct ConstCharArrayDetector


More information about the Libreoffice-commits mailing list