[cfe-commits] r172272 - /cfe/trunk/tools/libclang/CXString.cpp
Dmitri Gribenko
gribozavr at gmail.com
Fri Jan 11 15:13:36 PST 2013
Author: gribozavr
Date: Fri Jan 11 17:13:36 2013
New Revision: 172272
URL: http://llvm.org/viewvc/llvm-project?rev=172272&view=rev
Log:
libclang: use C++ casts in CXString.cpp
Modified:
cfe/trunk/tools/libclang/CXString.cpp
Modified: cfe/trunk/tools/libclang/CXString.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXString.cpp?rev=172272&r1=172271&r2=172272&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CXString.cpp (original)
+++ cfe/trunk/tools/libclang/CXString.cpp Fri Jan 11 17:13:36 2013
@@ -44,7 +44,7 @@
CXString cxstring::createCXString(StringRef String, bool DupString) {
CXString Result;
if (DupString || (!String.empty() && String.data()[String.size()] != 0)) {
- char *Spelling = (char *)malloc(String.size() + 1);
+ char *Spelling = static_cast<char *>(malloc(String.size() + 1));
memmove(Spelling, String.data(), String.size());
Spelling[String.size()] = 0;
Result.data = Spelling;
@@ -112,9 +112,9 @@
extern "C" {
const char *clang_getCString(CXString string) {
if (string.private_flags == (unsigned) CXS_StringBuf) {
- return ((CXStringBuf*)string.data)->Data.data();
+ return static_cast<const CXStringBuf *>(string.data)->Data.data();
}
- return (const char*) string.data;
+ return static_cast<const char *>(string.data);
}
void clang_disposeString(CXString string) {
@@ -126,7 +126,8 @@
free(const_cast<void *>(string.data));
break;
case CXS_StringBuf:
- disposeCXStringBuf((CXStringBuf *) string.data);
+ disposeCXStringBuf(static_cast<CXStringBuf *>(
+ const_cast<void *>(string.data)));
break;
}
}
More information about the cfe-commits
mailing list