brucem created this revision. brucem added reviewers: ki.stfu, abidh, domipheus. brucem added a subscriber: lldb-commits-list.
Fix type signature for CMIUtilString::IsAllValidAlphaAndNumeric. This passes the MI tests on Mac OS X. http://reviews.llvm.org/D10906 Files: tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp tools/lldb-mi/MIUtilString.cpp tools/lldb-mi/MIUtilString.h Index: tools/lldb-mi/MIUtilString.h =================================================================== --- tools/lldb-mi/MIUtilString.h +++ tools/lldb-mi/MIUtilString.h @@ -35,7 +35,7 @@ static CMIUtilString Format(const CMIUtilString vFormating, ...); static CMIUtilString FormatBinary(const MIuint64 vnDecimal); static CMIUtilString FormatValist(const CMIUtilString &vrFormating, va_list vArgs); - static bool IsAllValidAlphaAndNumeric(const MIchar &vrText); + static bool IsAllValidAlphaAndNumeric(const MIchar *vrText); static bool Compare(const CMIUtilString &vrLhs, const CMIUtilString &vrRhs); static CMIUtilString ConvertToPrintableASCII(const char vChar); static CMIUtilString ConvertToPrintableASCII(const char16_t vChar16); Index: tools/lldb-mi/MIUtilString.cpp =================================================================== --- tools/lldb-mi/MIUtilString.cpp +++ tools/lldb-mi/MIUtilString.cpp @@ -480,16 +480,15 @@ // Throws: None. //-- bool -CMIUtilString::IsAllValidAlphaAndNumeric(const MIchar &vrText) +CMIUtilString::IsAllValidAlphaAndNumeric(const MIchar *vrText) { - const MIuint len = ::strlen(&vrText); + const MIuint len = ::strlen(vrText); if (len == 0) return false; - MIchar *pPtr = const_cast<MIchar *>(&vrText); - for (MIuint i = 0; i < len; i++, pPtr++) + for (MIuint i = 0; i < len; i++, vrText++) { - const MIchar c = *pPtr; + const MIchar c = *vrText; if (::isalnum((int)c) == 0) return false; } Index: tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp =================================================================== --- tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp +++ tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp @@ -383,7 +383,7 @@ const MIchar *pThreadName = rThread.GetName(); const MIuint len = (pThreadName != nullptr) ? CMIUtilString(pThreadName).length() : 0; const bool bHaveName = ((pThreadName != nullptr) && (len > 0) && (len < 32) && - CMIUtilString::IsAllValidAlphaAndNumeric(*pThreadName)); // 32 is arbitary number + CMIUtilString::IsAllValidAlphaAndNumeric(pThreadName)); // 32 is arbitary number const MIchar *pThrdFmt = bHaveName ? "%s" : "Thread %d"; CMIUtilString strThread; if (bHaveName)
Index: tools/lldb-mi/MIUtilString.h =================================================================== --- tools/lldb-mi/MIUtilString.h +++ tools/lldb-mi/MIUtilString.h @@ -35,7 +35,7 @@ static CMIUtilString Format(const CMIUtilString vFormating, ...); static CMIUtilString FormatBinary(const MIuint64 vnDecimal); static CMIUtilString FormatValist(const CMIUtilString &vrFormating, va_list vArgs); - static bool IsAllValidAlphaAndNumeric(const MIchar &vrText); + static bool IsAllValidAlphaAndNumeric(const MIchar *vrText); static bool Compare(const CMIUtilString &vrLhs, const CMIUtilString &vrRhs); static CMIUtilString ConvertToPrintableASCII(const char vChar); static CMIUtilString ConvertToPrintableASCII(const char16_t vChar16); Index: tools/lldb-mi/MIUtilString.cpp =================================================================== --- tools/lldb-mi/MIUtilString.cpp +++ tools/lldb-mi/MIUtilString.cpp @@ -480,16 +480,15 @@ // Throws: None. //-- bool -CMIUtilString::IsAllValidAlphaAndNumeric(const MIchar &vrText) +CMIUtilString::IsAllValidAlphaAndNumeric(const MIchar *vrText) { - const MIuint len = ::strlen(&vrText); + const MIuint len = ::strlen(vrText); if (len == 0) return false; - MIchar *pPtr = const_cast<MIchar *>(&vrText); - for (MIuint i = 0; i < len; i++, pPtr++) + for (MIuint i = 0; i < len; i++, vrText++) { - const MIchar c = *pPtr; + const MIchar c = *vrText; if (::isalnum((int)c) == 0) return false; } Index: tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp =================================================================== --- tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp +++ tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp @@ -383,7 +383,7 @@ const MIchar *pThreadName = rThread.GetName(); const MIuint len = (pThreadName != nullptr) ? CMIUtilString(pThreadName).length() : 0; const bool bHaveName = ((pThreadName != nullptr) && (len > 0) && (len < 32) && - CMIUtilString::IsAllValidAlphaAndNumeric(*pThreadName)); // 32 is arbitary number + CMIUtilString::IsAllValidAlphaAndNumeric(pThreadName)); // 32 is arbitary number const MIchar *pThrdFmt = bHaveName ? "%s" : "Thread %d"; CMIUtilString strThread; if (bHaveName)
_______________________________________________ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits