From cc77397461f7124998db67b4bd65112a431eb67c Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Wed, 21 Aug 2013 17:01:36 +0300 Subject: [PATCH] Converted const wchar_t* to string. Signed-off-by: Dimitar Dobrev --- src/Generator/Generators/CSharp/CSharpTypePrinter.cs | 8 +++----- tests/Basic/Basic.cpp | 5 +++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs index a222a94e..9c43d37b 100644 --- a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs +++ b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs @@ -140,11 +140,9 @@ namespace CppSharp.Generators.CSharp { var pointee = pointer.Pointee.Desugar(); - if (pointee.IsPrimitiveType(PrimitiveType.Char) && - pointer.QualifiedPointee.Qualifiers.IsConst) - return true; - - return false; + return (pointee.IsPrimitiveType(PrimitiveType.Char) || + pointee.IsPrimitiveType(PrimitiveType.WideChar)) && + pointer.QualifiedPointee.Qualifiers.IsConst; } public static bool IsConstCharString(QualifiedType qualType) diff --git a/tests/Basic/Basic.cpp b/tests/Basic/Basic.cpp index a45acbed..4650dc56 100644 --- a/tests/Basic/Basic.cpp +++ b/tests/Basic/Basic.cpp @@ -76,6 +76,11 @@ int unsafeFunction(const Bar& ret, char* testForString, void (*foo)(int)) return ret.A; } +const wchar_t* wcharFunction(const wchar_t* constWideChar) +{ + return constWideChar; +} + Bar operator+(const Bar& b1, const Bar& b2) { Bar b;