Changeset 21079 in vbox for trunk/src/VBox/Main/glue
- Timestamp:
- Jun 30, 2009 3:59:22 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 49339
- Location:
- trunk/src/VBox/Main/glue
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/glue/ErrorInfo.cpp
r21077 r21079 118 118 119 119 Utf8Str message; 120 rc = ex->GetMessage (message.asOutParam()); 120 rc = ex->GetMessage(message.asOutParam()); 121 message.jolt(); 121 122 gotSomething |= NS_SUCCEEDED (rc); 122 123 if (NS_SUCCEEDED (rc)) -
trunk/src/VBox/Main/glue/VirtualBoxErrorInfo.cpp
r21077 r21079 179 179 AssertComRC (rc); 180 180 Utf8Str message; 181 rc = aInfo->GetMessage (message.asOutParam()); 181 rc = aInfo->GetMessage(message.asOutParam()); 182 message.jolt(); 182 183 AssertComRC (rc); 183 184 mText = message; -
trunk/src/VBox/Main/glue/string.cpp
r21077 r21079 26 26 27 27 #include <iprt/err.h> 28 #include <iprt/path.h> 28 29 29 30 namespace com … … 85 86 86 87 size_t cbCopy = psz - pFirst; 87 ret. alloc(cbCopy + 1);88 memcpy(ret. str, pFirst, cbCopy);89 ret. str[cbCopy] = '\0';88 ret.reserve(cbCopy + 1); 89 memcpy(ret.m_psz, pFirst, cbCopy); 90 ret.m_psz[cbCopy] = '\0'; 90 91 } 91 92 } … … 95 96 } 96 97 98 bool Utf8Str::endsWith(const Utf8Str &that, CaseSensitivity cs /*= CaseSensitive*/) const 99 { 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 else 112 return ::RTStrICmp(&m_psz[l], that.m_psz) == 0; 113 } 114 115 bool Utf8Str::startsWith(const Utf8Str &that, CaseSensitivity cs /*= CaseSensitive*/) const 116 { 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 else 128 return ::RTStrNICmp(m_psz, that.m_psz, l2) == 0; 129 } 130 131 bool Utf8Str::contains(const Utf8Str &that, CaseSensitivity cs /*= CaseSensitive*/) const 132 { 133 if (cs == CaseSensitive) 134 return ::RTStrStr(m_psz, that.m_psz) != NULL; 135 else 136 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 97 171 int Utf8Str::toInt(uint64_t &i) const 98 172 { 99 if (! str)173 if (!m_psz) 100 174 return VERR_NO_DIGITS; 101 return RTStrToUInt64Ex( str, NULL, 0, &i);175 return RTStrToUInt64Ex(m_psz, NULL, 0, &i); 102 176 } 103 177 104 178 int Utf8Str::toInt(uint32_t &i) const 105 179 { 106 if (! str)180 if (!m_psz) 107 181 return VERR_NO_DIGITS; 108 return RTStrToUInt32Ex( str, NULL, 0, &i);182 return RTStrToUInt32Ex(m_psz, NULL, 0, &i); 109 183 } 110 184
Note:
See TracChangeset
for help on using the changeset viewer.