Changeset 21077 in vbox for trunk/src/VBox/Main/glue
- Timestamp:
- Jun 30, 2009 3:19:12 PM (15 years ago)
- Location:
- trunk/src/VBox/Main/glue
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/glue/ErrorInfo.cpp
r21073 r21077 118 118 119 119 Utf8Str message; 120 rc = ex->GetMessage(message.asOutParam()); 121 message.jolt(); 120 rc = ex->GetMessage (message.asOutParam()); 122 121 gotSomething |= NS_SUCCEEDED (rc); 123 122 if (NS_SUCCEEDED (rc)) … … 183 182 LONG lrc; 184 183 185 rc = info->COMGETTER(ResultCode) (&lrc); mResultCode = lrc; 184 rc = info->COMGETTER(ResultCode) (&lrc); mResultCode = lrc; 186 185 gotSomething |= SUCCEEDED (rc); 187 186 gotAll &= SUCCEEDED (rc); -
trunk/src/VBox/Main/glue/VirtualBoxErrorInfo.cpp
r21073 r21077 179 179 AssertComRC (rc); 180 180 Utf8Str message; 181 rc = aInfo->GetMessage(message.asOutParam()); 182 message.jolt(); 181 rc = aInfo->GetMessage (message.asOutParam()); 183 182 AssertComRC (rc); 184 183 mText = message; -
trunk/src/VBox/Main/glue/string.cpp
r21073 r21077 26 26 27 27 #include <iprt/err.h> 28 #include <iprt/path.h>29 28 30 29 namespace com … … 86 85 87 86 size_t cbCopy = psz - pFirst; 88 ret. reserve(cbCopy + 1);89 memcpy(ret. m_psz, pFirst, cbCopy);90 ret. m_psz[cbCopy] = '\0';87 ret.alloc(cbCopy + 1); 88 memcpy(ret.str, pFirst, cbCopy); 89 ret.str[cbCopy] = '\0'; 91 90 } 92 91 } … … 96 95 } 97 96 98 bool Utf8Str::endsWith(const Utf8Str &that, CaseSensitivity cs /*= CaseSensitive*/) const99 {100 size_t l1 = length();101 if (l1 == 0)102 return false;103 104 size_t l2 = that.length();105 if (l1 < l2)106 return false;107 108 size_t l = l1 - l2;109 if (cs == CaseSensitive)110 return ::RTStrCmp(&m_psz[l], that.m_psz) == 0;111 else112 return ::RTStrICmp(&m_psz[l], that.m_psz) == 0;113 }114 115 bool Utf8Str::startsWith(const Utf8Str &that, CaseSensitivity cs /*= CaseSensitive*/) const116 {117 size_t l1 = length();118 size_t l2 = that.length();119 if (l1 == 0 || l2 == 0)120 return false;121 122 if (l1 < l2)123 return false;124 125 if (cs == CaseSensitive)126 return ::RTStrNCmp(m_psz, that.m_psz, l2) == 0;127 else128 return ::RTStrNICmp(m_psz, that.m_psz, l2) == 0;129 }130 131 bool Utf8Str::contains(const Utf8Str &that, CaseSensitivity cs /*= CaseSensitive*/) const132 {133 if (cs == CaseSensitive)134 return ::RTStrStr(m_psz, that.m_psz) != NULL;135 else136 return ::RTStrIStr(m_psz, that.m_psz) != NULL;137 }138 139 Utf8Str& Utf8Str::toLower()140 {141 if (!isEmpty())142 ::RTStrToLower(m_psz);143 return *this;144 }145 146 Utf8Str& Utf8Str::toUpper()147 {148 if (!isEmpty())149 ::RTStrToUpper(m_psz);150 return *this;151 }152 153 void Utf8Str::stripTrailingSlash()154 {155 RTPathStripTrailingSlash(m_psz);156 jolt();157 }158 159 void Utf8Str::stripFilename()160 {161 RTPathStripFilename(m_psz);162 jolt();163 }164 165 void Utf8Str::stripExt()166 {167 RTPathStripExt(m_psz);168 jolt();169 }170 171 97 int Utf8Str::toInt(uint64_t &i) const 172 98 { 173 if (! m_psz)99 if (!str) 174 100 return VERR_NO_DIGITS; 175 return RTStrToUInt64Ex( m_psz, NULL, 0, &i);101 return RTStrToUInt64Ex(str, NULL, 0, &i); 176 102 } 177 103 178 104 int Utf8Str::toInt(uint32_t &i) const 179 105 { 180 if (! m_psz)106 if (!str) 181 107 return VERR_NO_DIGITS; 182 return RTStrToUInt32Ex( m_psz, NULL, 0, &i);108 return RTStrToUInt32Ex(str, NULL, 0, &i); 183 109 } 184 110
Note:
See TracChangeset
for help on using the changeset viewer.