Changeset 26587 in vbox
- Timestamp:
- Feb 16, 2010 4:57:09 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 57775
- Location:
- trunk
- Files:
-
- 40 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/com/Guid.h
r26553 r26587 97 97 { 98 98 ::RTUuidClear (&uuid); 99 if (!that.is Null())99 if (!that.isEmpty()) 100 100 ::RTUuidFromUtf16(&uuid, that.raw()); 101 101 refresh(); … … 145 145 } 146 146 147 Bstr toUtf16 147 Bstr toUtf16() const 148 148 { 149 149 if (isEmpty()) -
trunk/include/VBox/com/string.h
r26553 r26587 3 3 /** @file 4 4 * MS COM / XPCOM Abstraction Layer: 5 * Smart string classes declaration5 * UTF-8 and UTF-16 string classes 6 6 */ 7 7 … … 59 59 60 60 /** 61 * Helper class that represents the |BSTR| type and hides platform-specific 62 * implementation details. 63 * 64 * This class uses COM/XPCOM-provided memory management routines to allocate 65 * and free string buffers. This makes it possible to: 66 * - use it as a type of member variables of COM/XPCOM components and pass 67 * their values to callers through component methods' output parameters 68 * using the #cloneTo() operation; 69 * - adopt (take ownership of) string buffers returned in output parameters 70 * of COM methods using the #asOutParam() operation and correctly free them 71 * afterwards. 61 * String class used universally in Main for COM-style Utf-16 strings. 62 * Unfortunately COM on Windows uses UTF-16 everywhere, requiring conversions 63 * back and forth since most of VirtualBox and our libraries use UTF-8. 64 * The Bstr class makes such conversions easier. 65 * 66 * Whereas the BSTR identifier is a typedef for a pointer to a wide character 67 * array (const char *uint_16 effectively, depending on the platform), 68 * the Bstr class is a fully featured string class with memory management 69 * for such strings. 70 * 71 * Bstr uses COM/XPCOM-provided memory management routines (SysAlloc* etc.) 72 * to allocate and free string buffers. This makes it possible to use it as 73 * a type of member variables of COM/XPCOM components and pass their values 74 * to callers through component methods' output parameters using the #cloneTo() 75 * operation. Also, the class can adopt (take ownership of) string buffers 76 * returned in output parameters of COM methods using the #asOutParam() 77 * operation and correctly free them afterwards. 78 * 79 * As opposed to the Ut8Str class, which is very efficient, Bstr does not 80 * cache the length of its member string. As a result, copying Bstr's is 81 * more expensive, and Bstr really should only be used to capture arguments 82 * from and return data to public COM methods. 83 * 84 * Starting with VirtualBox 3.2, like Utf8Str, Bstr no longer differentiates 85 * between NULL strings and empty strings. In other words, Bstr("") and 86 * Bstr(NULL) behave the same. In both cases, Bstr allocates no memory, 87 * reports a zero length and zero allocated bytes for both, and returns an 88 * empty C wide string from raw(). 72 89 */ 73 90 class Bstr … … 75 92 public: 76 93 77 typedef BSTR String; 78 typedef CBSTR ConstString; 79 80 Bstr() : bstr(NULL) {} 81 82 Bstr(const Bstr &that) : bstr(NULL) { raw_copy(bstr, that.bstr); } 83 Bstr(CBSTR that) : bstr(NULL) { raw_copy(bstr, that); } 94 /** 95 * Creates an empty string that has no memory allocated. 96 */ 97 Bstr() 98 : m_bstr(NULL) 99 { 100 } 101 102 /** 103 * Creates a copy of another Bstr. 104 * 105 * This allocates s.length() + 1 wide characters for the new instance, unless s is empty. 106 * 107 * @param s The source string. 108 * 109 * @throws std::bad_alloc 110 */ 111 Bstr(const Bstr &s) 112 { 113 copyFrom(s); 114 } 115 116 /** 117 * Creates a copy of a wide char string buffer. 118 * 119 * This allocates SysStringLen(pw) + 1 wide characters for the new instance, unless s is empty. 120 * 121 * @param pcsz The source string. 122 * 123 * @throws std::bad_alloc 124 */ 125 Bstr(CBSTR pw) 126 { 127 copyFrom(pw); 128 } 84 129 85 130 #if defined (VBOX_WITH_XPCOM) 86 Bstr(const wchar_t * that) : bstr(NULL)131 Bstr(const wchar_t *pw) 87 132 { 88 133 AssertCompile(sizeof(wchar_t) == sizeof(OLECHAR)); 89 raw_copy(bstr, (CBSTR)that);134 copyFrom((CBSTR)pw); 90 135 } 91 136 #endif 92 137 93 Bstr(const iprt::MiniString &that); 94 Bstr(const char *that); 95 96 /** Shortcut that calls #alloc(aSize) right after object creation. */ 97 Bstr(size_t aSize) : bstr(NULL) { alloc(aSize); } 98 99 ~Bstr() { setNull(); } 100 101 Bstr &operator=(const Bstr &that) { safe_assign(that.bstr); return *this; } 102 Bstr &operator=(CBSTR that) { safe_assign(that); return *this; } 103 104 Bstr &operator=(const Utf8Str &that); 105 Bstr &operator=(const char *that); 106 107 Bstr &setNull() 108 { 109 if (bstr) 110 { 111 ::SysFreeString(bstr); 112 bstr = NULL; 113 } 114 return *this; 115 } 116 117 Bstr &setNullIfEmpty() 118 { 119 if (bstr && *bstr == 0) 120 { 121 ::SysFreeString(bstr); 122 bstr = NULL; 123 } 124 return *this; 125 } 126 127 /** 128 * Allocates memory for a string capable to store \a aSize - 1 characters; 129 * in other words, aSize includes the terminating zero character. If \a aSize 130 * is zero, or if a memory allocation error occurs, this object will become null. 131 */ 132 Bstr &alloc(size_t aSize) 133 { 134 setNull(); 135 if (aSize) 136 { 137 unsigned int size = (unsigned int) aSize; Assert(size == aSize); 138 bstr = ::SysAllocStringLen(NULL, size - 1); 139 if (bstr) 140 bstr[0] = 0; 141 } 142 return *this; 143 } 144 145 int compare(CBSTR str) const 146 { 147 return ::RTUtf16Cmp((PRTUTF16) bstr, (PRTUTF16) str); 148 } 149 150 int compare(BSTR str) const 151 { 152 return ::RTUtf16Cmp((PRTUTF16) bstr, (PRTUTF16) str); 153 } 154 155 bool operator==(const Bstr &that) const { return !compare(that.bstr); } 156 bool operator!=(const Bstr &that) const { return !!compare(that.bstr); } 138 139 /** 140 * Creates a copy of an IPRT MiniString (which includes Utf8Str). 141 * 142 * This allocates s.length() + 1 wide characters for the new instance, unless s is empty. 143 * 144 * @param pcsz The source string. 145 * 146 * @throws std::bad_alloc 147 */ 148 Bstr(const iprt::MiniString &s) 149 { 150 copyFrom(s.c_str()); // @todo the source string length is know, we can probably speed this up 151 } 152 153 /** 154 * Creates a copy of a C string. 155 * 156 * This allocates strlen(pcsz) + 1 bytes for the new instance, unless s is empty. 157 * 158 * @param pcsz The source string. 159 * 160 * @throws std::bad_alloc 161 */ 162 Bstr(const char *pcsz) 163 { 164 copyFrom(pcsz); 165 } 166 167 /** 168 * String length in wide characters. 169 * 170 * Returns the length of the member string, which is equal to SysStringLen(raw()). 171 * In other words, this returns neither bytes nor the number of unicode codepoints. 172 * 173 * As opposed to Utf8Str::length(), this is _not_ cached and expensive. 174 */ 175 size_t length() const 176 { 177 return ::SysStringLen(m_bstr); 178 } 179 180 /** 181 * Deallocates all memory. 182 */ 183 inline void setNull() 184 { 185 cleanup(); 186 } 187 188 /** 189 * Returns a const pointer to the member string. If the member string is empty, 190 * returns a pointer to a static null character. 191 * @return 192 */ 193 CBSTR raw() const 194 { 195 return (m_bstr) ? m_bstr : (CBSTR)L""; 196 } 197 198 /** 199 * Empty string or not? 200 * 201 * Returns true if the member string has no length. 202 * 203 * @returns true if empty, false if not. 204 */ 205 bool isEmpty() const 206 { 207 return (m_bstr == NULL); 208 } 209 210 operator bool() const 211 { 212 return !isEmpty(); 213 } 214 215 bool operator!() const 216 { 217 return isEmpty(); 218 } 219 220 /** Case sensitivity selector. */ 221 enum CaseSensitivity 222 { 223 CaseSensitive, 224 CaseInsensitive 225 }; 226 227 int compare(CBSTR str, CaseSensitivity cs = CaseSensitive) const 228 { 229 if (m_bstr == str) 230 return 0; 231 if (m_bstr == NULL) 232 return -1; 233 if (str == NULL) 234 return 1; 235 236 if (cs == CaseSensitive) 237 return ::RTUtf16Cmp((PRTUTF16)m_bstr, (PRTUTF16)str); 238 else 239 return ::RTUtf16ICmp((PRTUTF16)m_bstr, (PRTUTF16)str); 240 } 241 242 int compare(const Bstr &bstr, CaseSensitivity cs = CaseSensitive) const 243 { 244 return compare(bstr.raw(), cs); 245 } 246 247 /** @name Comparison operators. 248 * @{ */ 249 bool operator==(const Bstr &that) const { return !compare(that.raw()); } 250 bool operator!=(const Bstr &that) const { return !!compare(that.raw()); } 251 bool operator<( const Bstr &that) const { return compare(that.raw()) < 0; } 252 bool operator>( const Bstr &that) const { return compare(that.raw()) > 0; } 253 157 254 bool operator==(CBSTR that) const { return !compare(that); } 158 bool operator==(BSTR that) const { return !compare(that); }159 160 #if defined (VBOX_WITH_XPCOM)161 bool operator!=(const wchar_t *that) const162 {163 AssertCompile(sizeof(wchar_t) == sizeof(OLECHAR));164 return !!compare((CBSTR) that);165 }166 bool operator==(const wchar_t *that) const167 {168 AssertCompile(sizeof(wchar_t) == sizeof(OLECHAR));169 return !compare((CBSTR) that);170 }171 #endif172 173 255 bool operator!=(CBSTR that) const { return !!compare(that); } 174 bool operator!=(BSTR that) const { return !!compare(that); } 175 bool operator<(const Bstr &that) const { return compare(that.bstr) < 0; } 176 bool operator<(CBSTR that) const { return compare(that) < 0; } 177 bool operator<(BSTR that) const { return compare(that) < 0; } 178 #if defined (VBOX_WITH_XPCOM) 179 bool operator<(const wchar_t *that) const 180 { 181 AssertCompile(sizeof(wchar_t) == sizeof(OLECHAR)); 182 return compare((CBSTR) that) < 0; 183 } 184 #endif 185 186 int compareIgnoreCase(CBSTR str) const 187 { 188 return ::RTUtf16LocaleICmp(bstr, str); 189 } 190 191 bool isNull() const { return bstr == NULL; } 192 operator bool() const { return !isNull(); } 193 194 bool isEmpty() const { return isNull() || *bstr == 0; } 195 196 size_t length() const { return isNull() ? 0 : ::RTUtf16Len((PRTUTF16) bstr); } 256 bool operator<( CBSTR that) const { return compare(that) < 0; } 257 bool operator>( CBSTR that) const { return compare(that) > 0; } 258 259 // the following two are necessary or stupid MSVC will complain with "ambiguous operator==" 260 bool operator==( BSTR that) const { return !compare(that); } 261 bool operator!=( BSTR that) const { return !!compare(that); } 262 263 /** @} */ 197 264 198 265 /** Intended to to pass instances as |CBSTR| input parameters to methods. */ 199 operator CBSTR() const { return bstr; }266 operator CBSTR() const { return raw(); } 200 267 201 268 /** … … 204 271 * input BSTR parameters of interface methods are not const. 205 272 */ 206 operator BSTR() { return bstr; } 207 208 /** 209 * The same as operator CBSTR(), but for situations where the compiler 210 * cannot typecast implicitly (for example, in printf() argument list). 211 */ 212 CBSTR raw() const { return bstr; } 213 214 /** 215 * Returns a non-const raw pointer that allows to modify the string directly. 216 * @warning 217 * Be sure not to modify data beyond the allocated memory! The 218 * guaranteed size of the allocated memory is at least #length() 219 * bytes after creation and after every assignment operation. 220 */ 221 BSTR mutableRaw() { return bstr; } 273 operator BSTR() { return (BSTR)raw(); } 222 274 223 275 /** … … 225 277 * within the interface method. Transfers the ownership of the duplicated 226 278 * string to the caller. 227 */ 228 const Bstr &cloneTo(BSTR *pstr) const 279 * 280 * This allocates a single 0 byte in the target if the member string is empty. 281 */ 282 const Bstr& cloneTo(BSTR *pstr) const 229 283 { 230 284 if (pstr) 231 { 232 *pstr = NULL; 233 raw_copy(*pstr, bstr); 234 } 285 *pstr = ::SysAllocString((const OLECHAR*)raw()); 286 // raw() never returns NULL, so we always allocate something here 235 287 return *this; 236 288 } … … 243 295 * As opposed to cloneTo(), this method doesn't create a copy of the 244 296 * string. 245 */ 246 Bstr &detachTo(BSTR *pstr) 247 { 248 *pstr = bstr; 249 bstr = NULL; 297 * 298 * This allocates a single 0 byte in the target if the member string is empty. 299 */ 300 Bstr& detachTo(BSTR *pstr) 301 { 302 *pstr = (m_bstr) ? m_bstr : ::SysAllocString((const OLECHAR*)""); 303 m_bstr = NULL; 250 304 return *this; 251 305 } 252 253 /**254 * Intended to assign copies of instances to |char *| out parameters from255 * within the interface method. Transfers the ownership of the duplicated256 * string to the caller.257 */258 const Bstr &cloneTo(char **pstr) const;259 306 260 307 /** … … 262 309 * Takes the ownership of the returned data. 263 310 */ 264 BSTR *asOutParam() { setNull(); return &bstr; } 311 BSTR* asOutParam() 312 { 313 cleanup(); 314 return &m_bstr; 315 } 265 316 266 317 /** … … 271 322 protected: 272 323 273 void safe_assign(CBSTR str) 274 { 275 if (bstr != str) 324 /** 325 * Destructor implementation, also used to clean up in operator=() before 326 * assigning a new string. 327 */ 328 void cleanup() 329 { 330 if (m_bstr) 276 331 { 277 setNull();278 raw_copy(bstr, str);332 ::SysFreeString(m_bstr); 333 m_bstr = NULL; 279 334 } 280 335 } 281 336 282 inline static void raw_copy(BSTR &ls, CBSTR rs) 283 { 284 if (rs) 285 ls = ::SysAllocString((const OLECHAR *) rs); 286 } 287 288 inline static void raw_copy(BSTR &ls, const char *rs) 289 { 290 if (rs) 337 /** 338 * Protected internal helper which allocates memory for a string capable of 339 * storing \a aSize - 1 characters (not bytes, not codepoints); in other words, 340 * aSize includes the terminating null character. 341 * 342 * Does NOT call cleanup() before allocating! 343 * 344 * @throws std::bad_alloc On allocation failure. The object is left describing 345 * a NULL string. 346 */ 347 void alloc(size_t cw) 348 { 349 if (cw) 291 350 { 351 m_bstr = ::SysAllocStringLen(NULL, (unsigned int)cw - 1); 352 #ifdef RT_EXCEPTIONS_ENABLED 353 if (!m_bstr) 354 throw std::bad_alloc(); 355 #endif 356 } 357 } 358 359 /** 360 * Protected internal helper to copy a string, ignoring the previous object state. 361 * 362 * copyFrom() unconditionally sets the members to a copy of the given other 363 * strings and makes no assumptions about previous contents. Can therefore be 364 * used both in copy constructors, when member variables have no defined value, 365 * and in assignments after having called cleanup(). 366 * 367 * This variant copies from another Bstr. Since Bstr does _not_ cache string lengths, 368 * this is not fast. 369 * 370 * @param s The source string. 371 * 372 * @throws std::bad_alloc On allocation failure. The object is left describing 373 * a NULL string. 374 */ 375 void copyFrom(const Bstr &s) 376 { 377 copyFrom(s.raw()); 378 } 379 380 /** 381 * Protected internal helper to copy a string, ignoring the previous object state. 382 * 383 * See copyFrom() above. 384 * 385 * This variant copies from a wide char C string. 386 * 387 * @param pcsz The source string. 388 * 389 * @throws std::bad_alloc On allocation failure. The object is left describing 390 * a NULL string. 391 */ 392 void copyFrom(CBSTR pw) 393 { 394 size_t cwLength; 395 if ( (pw) 396 && ((cwLength = ::SysStringLen((BSTR)pw))) 397 ) 398 { 399 size_t cwAllocated = cwLength + 1; 400 alloc(cwAllocated); 401 memcpy(m_bstr, pw, cwAllocated * sizeof(OLECHAR)); // include 0 terminator 402 } 403 else 404 m_bstr = NULL; 405 } 406 407 /** 408 * Protected internal helper to copy a string, ignoring the previous object state. 409 * 410 * See copyFrom() above. 411 * 412 * This variant converts from a Utf-8 C string. 413 * 414 * @param pcsz The source string. 415 * 416 * @throws std::bad_alloc On allocation failure. The object is left describing 417 * a NULL string. 418 */ 419 void copyFrom(const char *pcsz) 420 { 421 if (pcsz && *pcsz) 422 { 423 // @todo r=dj apparently this was copied twice in the original because our buffers 424 // use memory from SysAllocMem and IPRT doesn't, but check if this can be made faster 292 425 PRTUTF16 s = NULL; 293 ::RTStrToUtf16( rs, &s);294 raw_copy(ls, (BSTR)s);426 ::RTStrToUtf16(pcsz, &s); 427 copyFrom((BSTR)s); // @todo r=dj this is not exception safe 295 428 ::RTUtf16Free(s); 296 429 } 297 }298 299 BSTR bstr;300 301 friend class Utf8Str; /* to access our raw_copy()*/430 else 431 m_bstr = NULL; 432 } 433 434 BSTR m_bstr; /**< The string buffer. */ 302 435 }; 303 436 304 437 /* symmetric compare operators */ 305 inline bool operator==(CBSTR l, const Bstr &r) { return r.operator==(l); }306 inline bool operator!=(CBSTR l, const Bstr &r) { return r.operator!=(l); }307 inline bool operator==(BSTR l, const Bstr &r) { return r.operator==(l); }308 inline bool operator!=(BSTR l, const Bstr &r) { return r.operator!=(l); }438 // inline bool operator==(CBSTR l, const Bstr &r) { return r.operator==(l); } 439 // inline bool operator!=(CBSTR l, const Bstr &r) { return r.operator!=(l); } 440 // inline bool operator==(BSTR l, const Bstr &r) { return r.operator==(l); } 441 // inline bool operator!=(BSTR l, const Bstr &r) { return r.operator!=(l); } 309 442 310 443 //////////////////////////////////////////////////////////////////////////////// 311 444 312 445 /** 313 * Helper class that represents UTF8 (|char *|) strings. Useful in 314 * conjunction with Bstr to simplify conversions between UTF16 (|BSTR|) 315 * and UTF8. 316 * 317 * This class uses COM/XPCOM-provided memory management routines to allocate 318 * and free string buffers. This makes it possible to: 319 * - use it as a type of member variables of COM/XPCOM components and pass 320 * their values to callers through component methods' output parameters 321 * using the #cloneTo() operation; 322 * - adopt (take ownership of) string buffers returned in output parameters 323 * of COM methods using the #asOutParam() operation and correctly free them 324 * afterwards. 446 * String class used universally in Main for Utf-8 strings. 447 * 448 * This is based on iprt::MiniString, to which some functionality has been 449 * moved. Here we keep things that are specific to Main, such as conversions 450 * with UTF-16 strings (Bstr). 451 * 452 * Like iprt::MiniString, Utf8Str does not differentiate between NULL strings 453 * and empty strings. In other words, Utf8Str("") and Utf8Str(NULL) 454 * behave the same. In both cases, MiniString allocates no memory, reports 455 * a zero length and zero allocated bytes for both, and returns an empty 456 * C string from c_str(). 325 457 */ 326 458 class Utf8Str : public iprt::MiniString … … 340 472 Utf8Str(const Bstr &that) 341 473 { 342 copyFrom(that );474 copyFrom(that.raw()); 343 475 } 344 476 … … 361 493 362 494 Utf8Str& operator=(const Bstr &that) 495 { 496 cleanup(); 497 copyFrom(that.raw()); 498 return *this; 499 } 500 501 Utf8Str& operator=(CBSTR that) 363 502 { 364 503 cleanup(); … … 367 506 } 368 507 369 Utf8Str& operator=(CBSTR that)370 {371 cleanup();372 copyFrom(that);373 return *this;374 }375 376 508 /** 377 509 * Intended to assign instances to |char *| out parameters from within the … … 379 511 * caller. 380 512 * 513 * This allocates a single 0 byte in the target if the member string is empty. 514 * 381 515 * @remarks The returned string must be freed by RTStrFree, not RTMemFree. 382 516 */ 383 517 const Utf8Str& cloneTo(char **pstr) const 384 518 { 385 if (pstr) /** @todo r=bird: This needs to if m_psz is NULL. Shouldn't it also throw std::bad_alloc? */ 386 *pstr = RTStrDup(m_psz); 387 return *this; 388 } 389 390 /** 391 * Intended to assign instances to |char *| out parameters from within the 392 * interface method. Transfers the ownership of the original string to the 393 * caller and resets the instance to null. 394 * 395 * As opposed to cloneTo(), this method doesn't create a copy of the 396 * string. 397 */ 398 Utf8Str& detachTo(char **pstr) 399 { 400 *pstr = m_psz; 401 m_psz = NULL; 402 m_cbAllocated = 0; 403 m_cbLength = 0; 519 if (pstr) 520 { 521 *pstr = RTStrDup(raw()); 522 #ifdef RT_EXCEPTIONS_ENABLED 523 if (!*pstr) 524 throw std::bad_alloc(); 525 #endif 526 } 404 527 return *this; 405 528 } … … 409 532 * interface method. Transfers the ownership of the duplicated string to the 410 533 * caller. 534 * 535 * This allocates a single 0 byte in the target if the member string is empty. 411 536 */ 412 537 const Utf8Str& cloneTo(BSTR *pstr) const … … 414 539 if (pstr) 415 540 { 541 Bstr bstr(c_str()); 416 542 *pstr = NULL; 417 Bstr::raw_copy(*pstr, m_psz);543 bstr.detachTo(pstr); 418 544 } 419 545 return *this; … … 507 633 if (s) 508 634 { 509 RTUtf16ToUtf8((PRTUTF16)s, &m_psz); /** @todo r=bird: This isn't throwing std::bad_alloc / handling return codes. 510 * Also, this technically requires using RTStrFree, ministring::cleanup() uses RTMemFree. */ 635 RTUtf16ToUtf8((PRTUTF16)s, &m_psz); /** @todo r=bird: This technically requires using RTStrFree, ministring::cleanup() uses RTMemFree. */ 636 #ifdef RT_EXCEPTIONS_ENABLED 637 if (!m_psz) 638 throw std::bad_alloc(); 639 #endif 511 640 m_cbLength = strlen(m_psz); /** @todo optimize by using a different RTUtf* function */ 512 641 m_cbAllocated = m_cbLength + 1; … … 524 653 525 654 // work around error C2593 of the stupid MSVC 7.x ambiguity resolver 526 WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP(Bstr) 527 528 //////////////////////////////////////////////////////////////////////////////// 529 530 // inlined Bstr members that depend on Utf8Str 531 532 inline Bstr::Bstr(const iprt::MiniString &that) 533 : bstr(NULL) 534 { 535 raw_copy(bstr, that.c_str()); 536 } 537 538 inline Bstr::Bstr(const char *that) 539 : bstr(NULL) 540 { 541 raw_copy(bstr, that); 542 } 543 544 inline Bstr &Bstr::operator=(const Utf8Str &that) 545 { 546 setNull(); 547 raw_copy(bstr, that.c_str()); 548 return *this; 549 } 550 inline Bstr &Bstr::operator=(const char *that) 551 { 552 setNull(); 553 raw_copy(bstr, that); 554 return *this; 555 } 556 557 inline const Bstr& Bstr::cloneTo(char **pstr) const 558 { 559 if (pstr) 560 { 561 Utf8Str ustr(*this); 562 ustr.detachTo(pstr); 563 } 564 return *this; 565 } 655 // @todo r=dj if I enable this I get about five warnings every time this header 656 // is included, figure out what that is... for now I have modified the calling code instead 657 // WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP(Bstr) 566 658 567 659 //////////////////////////////////////////////////////////////////////////////// … … 654 746 va_list args; 655 747 va_start(args, aFormat); 656 raw_copy(bstr,Utf8StrFmtVA(aFormat, args).c_str());748 copyFrom(Utf8StrFmtVA(aFormat, args).c_str()); 657 749 va_end(args); 658 750 } … … 675 767 BstrFmtVA(const char *aFormat, va_list aArgs) 676 768 { 677 raw_copy(bstr,Utf8StrFmtVA(aFormat, aArgs).c_str());769 copyFrom(Utf8StrFmtVA(aFormat, aArgs).c_str()); 678 770 } 679 771 }; -
trunk/include/iprt/cdefs.h
r26226 r26587 1920 1920 #if defined(_MSC_VER) 1921 1921 # define WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP(Cls) \ 1922 inline bool operator! (const Cls &that) { return !bool 1923 inline bool operator&& (const Cls &that, bool b) { return bool 1924 inline bool operator|| (const Cls &that, bool b) { return bool 1925 inline bool operator&& (bool b, const Cls &that) { return b && bool 1926 inline bool operator|| (bool b, const Cls &that) { return b || bool 1922 inline bool operator! (const Cls &that) { return !bool(that); } \ 1923 inline bool operator&& (const Cls &that, bool b) { return bool(that) && b; } \ 1924 inline bool operator|| (const Cls &that, bool b) { return bool(that) || b; } \ 1925 inline bool operator&& (bool b, const Cls &that) { return b && bool(that); } \ 1926 inline bool operator|| (bool b, const Cls &that) { return b || bool(that); } 1927 1927 #else 1928 1928 # define WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP(Cls) -
trunk/include/iprt/cpp/ministring.h
r26553 r26587 45 45 * else except IPRT memory management functions. Semantics are like in 46 46 * std::string, except it can do a lot less. 47 * 48 * Note that MiniString does not differentiate between NULL strings and 49 * empty strings. In other words, MiniString("") and MiniString(NULL) 50 * behave the same. In both cases, MiniString allocates no memory, reports 51 * a zero length and zero allocated bytes for both, and returns an empty 52 * C string from c_str(). 47 53 */ 48 54 #ifdef VBOX … … 71 77 * Creates a copy of another MiniString. 72 78 * 73 * This allocates s.length() + 1 bytes for the new instance .79 * This allocates s.length() + 1 bytes for the new instance, unless s is empty. 74 80 * 75 81 * @param s The source string. … … 83 89 84 90 /** 85 * Creates a copy of a nother MiniString.86 * 87 * This allocates strlen(pcsz) + 1 bytes for the new instance .91 * Creates a copy of a C string. 92 * 93 * This allocates strlen(pcsz) + 1 bytes for the new instance, unless s is empty. 88 94 * 89 95 * @param pcsz The source string. … … 123 129 * 124 130 * Returns the number of bytes allocated in the internal string buffer, which is 125 * at least length() + 1 if length() > 0. 131 * at least length() + 1 if length() > 0. Returns 0 for an empty string. 126 132 * 127 133 * @returns m_cbAllocated. … … 275 281 * Returns the byte at the given index, or a null byte if the index is not 276 282 * smaller than length(). This does _not_ count codepoints but simply points 277 * into the member C string .283 * into the member C string; the result may not be a valid UTF-8 character. 278 284 * 279 285 * @param i The index into the string buffer. … … 289 295 /** 290 296 * Returns the contained string as a C-style const char* pointer. 297 * This never returns NULL; if the string is empty, returns a 298 * pointer to static null byte. 291 299 * 292 300 * @returns const pointer to C-style string. … … 294 302 inline const char *c_str() const 295 303 { 296 return m_psz;304 return (m_psz) ? m_psz : ""; 297 305 } 298 306 299 307 /** 300 308 * Like c_str(), for compatibility with lots of VirtualBox Main code. 309 * This never returns NULL; if the string is empty, returns a 310 * pointer to static null byte. 301 311 * 302 312 * @returns const pointer to C-style string. … … 304 314 inline const char *raw() const 305 315 { 306 return m_psz;307 } 308 309 /** 310 * Empt ry string or not?316 return (m_psz) ? m_psz : ""; 317 } 318 319 /** 320 * Empty string or not? 311 321 * 312 322 * Returns true if the member string has no length. This states nothing about … … 472 482 473 483 /** 474 * Hide operator bool() to force people to use isEmpty() explicitly.475 */476 operator bool() const { return false; }477 478 /**479 484 * Destructor implementation, also used to clean up in operator=() before 480 485 * assigning a new string. … … 492 497 493 498 /** 494 * Protected internal helper for copy a string that completely ignors the 495 * current object state. 499 * Protected internal helper to copy a string, ignoring the previous object state. 496 500 * 497 501 * copyFrom() unconditionally sets the members to a copy of the given other … … 501 505 * 502 506 * This variant copies from another MiniString and is fast since 503 * the length of source string is known.507 * the length of the source string is known. 504 508 * 505 509 * @param s The source string. … … 533 537 534 538 /** 535 * Protected internal helper for copy a string that completely ignors the 536 * current object state. 539 * Protected internal helper to copy a string, ignoring the previous object state. 537 540 * 538 541 * See copyFrom() above. … … 572 575 } 573 576 577 private: 578 579 /** 580 * Hide operator bool() to force people to use isEmpty() explicitly. 581 */ 582 operator bool() const; 583 584 protected: 585 574 586 char *m_psz; /**< The string buffer. */ 575 587 size_t m_cbLength; /**< strlen(m_psz) - i.e. no terminator included. */ -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDHCPServer.cpp
r26553 r26587 230 230 231 231 ComPtr<IHostNetworkInterface> hif; 232 CHECK_ERROR(host, FindHostNetworkInterfaceByName(Bstr(pIfName) .mutableRaw(), hif.asOutParam()));232 CHECK_ERROR(host, FindHostNetworkInterfaceByName(Bstr(pIfName), hif.asOutParam())); 233 233 if(FAILED(rc)) 234 234 return errorArgument("could not find interface '%s'", pIfName); … … 244 244 245 245 ComPtr<IDHCPServer> svr; 246 rc = a->virtualBox->FindDHCPServerByNetworkName(NetName .mutableRaw(), svr.asOutParam());246 rc = a->virtualBox->FindDHCPServerByNetworkName(NetName, svr.asOutParam()); 247 247 if(enmCode == OP_ADD) 248 248 { … … 250 250 return errorArgument("dhcp server already exists"); 251 251 252 CHECK_ERROR(a->virtualBox, CreateDHCPServer(NetName .mutableRaw(), svr.asOutParam()));252 CHECK_ERROR(a->virtualBox, CreateDHCPServer(NetName, svr.asOutParam())); 253 253 if(FAILED(rc)) 254 254 return errorArgument("failed to create server"); … … 263 263 if (pIp || pNetmask || pLowerIp || pUpperIp) 264 264 { 265 CHECK_ERROR(svr, SetConfiguration (Bstr(pIp).mutableRaw(), Bstr(pNetmask).mutableRaw(), Bstr(pLowerIp).mutableRaw(), Bstr(pUpperIp).mutableRaw()));265 CHECK_ERROR(svr, SetConfiguration(Bstr(pIp), Bstr(pNetmask), Bstr(pLowerIp), Bstr(pUpperIp))); 266 266 if(FAILED(rc)) 267 267 return errorArgument("failed to set configuration"); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp
r26553 r26587 255 255 256 256 /* check the outcome */ 257 if ( !filename257 if ( filename.isEmpty() 258 258 || sizeMB == 0) 259 259 return errorSyntax(USAGE_CREATEHD, "Parameters --filename and --size are required"); … … 281 281 bool doClose = false; 282 282 283 if (!comment.is Null())283 if (!comment.isEmpty()) 284 284 { 285 285 CHECK_ERROR(hardDisk,COMSETTER(Description)(comment)); … … 1012 1012 1013 1013 /* check for required options */ 1014 if ( !server || !target)1014 if (server.isEmpty() || target.isEmpty()) 1015 1015 return errorSyntax(USAGE_ADDISCSIDISK, "Parameters --server and --target are required"); 1016 1016 … … 1038 1038 if (FAILED(rc)) break; 1039 1039 1040 if (!port.is Null())1040 if (!port.isEmpty()) 1041 1041 server = BstrFmt ("%ls:%ls", server.raw(), port.raw()); 1042 1042 … … 1047 1047 server.detachTo (values.appendedRaw()); 1048 1048 Bstr ("TargetName").detachTo (names.appendedRaw()); 1049 target.detachTo 1050 1051 if (!lun.is Null())1049 target.detachTo(values.appendedRaw()); 1050 1051 if (!lun.isEmpty()) 1052 1052 { 1053 1053 Bstr ("LUN").detachTo (names.appendedRaw()); 1054 1054 lun.detachTo (values.appendedRaw()); 1055 1055 } 1056 if (!username.is Null())1056 if (!username.isEmpty()) 1057 1057 { 1058 1058 Bstr ("InitiatorUsername").detachTo (names.appendedRaw()); 1059 1059 username.detachTo (values.appendedRaw()); 1060 1060 } 1061 if (!password.is Null())1061 if (!password.isEmpty()) 1062 1062 { 1063 1063 Bstr ("InitiatorSecret").detachTo (names.appendedRaw()); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestProp.cpp
r24024 r26587 248 248 RTPrintf("No value set!\n"); 249 249 if (value) 250 { 250 251 RTPrintf("Value: %lS\n", value.raw()); 251 if (value && verbose) 252 { 253 RTPrintf("Timestamp: %lld\n", u64Timestamp); 254 RTPrintf("Flags: %lS\n", flags.raw()); 252 if (verbose) 253 { 254 RTPrintf("Timestamp: %lld\n", u64Timestamp); 255 RTPrintf("Flags: %lS\n", flags.raw()); 256 } 255 257 } 256 258 } -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageUSB.cpp
r26553 r26587 364 364 && !cmd.mMachine) 365 365 || ( cmd.mGlobal 366 && cmd.mFilter.mRemote)366 && !cmd.mFilter.mRemote.isEmpty()) 367 367 ) 368 368 { … … 441 441 if (!f.mActive.isNull()) 442 442 CHECK_ERROR_BREAK (flt, COMSETTER(Active) (f.mActive)); 443 if (!f.mVendorId.is Null())444 CHECK_ERROR_BREAK (flt, COMSETTER(VendorId) (f.mVendorId.setNullIfEmpty()));445 if (!f.mProductId.is Null())446 CHECK_ERROR_BREAK (flt, COMSETTER(ProductId) (f.mProductId .setNullIfEmpty()));447 if (!f.mRevision.is Null())448 CHECK_ERROR_BREAK (flt, COMSETTER(Revision) (f.mRevision .setNullIfEmpty()));449 if (!f.mManufacturer.is Null())450 CHECK_ERROR_BREAK (flt, COMSETTER(Manufacturer) (f.mManufacturer .setNullIfEmpty()));451 if (!f.mSerialNumber.is Null())452 CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber .setNullIfEmpty()));443 if (!f.mVendorId.isEmpty()) 444 CHECK_ERROR_BREAK (flt, COMSETTER(VendorId)(f.mVendorId)); 445 if (!f.mProductId.isEmpty()) 446 CHECK_ERROR_BREAK (flt, COMSETTER(ProductId) (f.mProductId)); 447 if (!f.mRevision.isEmpty()) 448 CHECK_ERROR_BREAK (flt, COMSETTER(Revision) (f.mRevision)); 449 if (!f.mManufacturer.isEmpty()) 450 CHECK_ERROR_BREAK (flt, COMSETTER(Manufacturer) (f.mManufacturer)); 451 if (!f.mSerialNumber.isEmpty()) 452 CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber)); 453 453 if (!f.mMaskedInterfaces.isNull()) 454 454 CHECK_ERROR_BREAK (flt, COMSETTER(MaskedInterfaces) (f.mMaskedInterfaces)); … … 466 466 if (!f.mActive.isNull()) 467 467 CHECK_ERROR_BREAK (flt, COMSETTER(Active) (f.mActive)); 468 if (!f.mVendorId.is Null())469 CHECK_ERROR_BREAK (flt, COMSETTER(VendorId) (f.mVendorId .setNullIfEmpty()));470 if (!f.mProductId.is Null())471 CHECK_ERROR_BREAK (flt, COMSETTER(ProductId) (f.mProductId .setNullIfEmpty()));472 if (!f.mRevision.is Null())473 CHECK_ERROR_BREAK (flt, COMSETTER(Revision) (f.mRevision .setNullIfEmpty()));474 if (!f.mManufacturer.is Null())475 CHECK_ERROR_BREAK (flt, COMSETTER(Manufacturer) (f.mManufacturer .setNullIfEmpty()));476 if (!f.mRemote.is Null())477 CHECK_ERROR_BREAK (flt, COMSETTER(Remote) (f.mRemote .setNullIfEmpty()));478 if (!f.mSerialNumber.is Null())479 CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber .setNullIfEmpty()));468 if (!f.mVendorId.isEmpty()) 469 CHECK_ERROR_BREAK (flt, COMSETTER(VendorId) (f.mVendorId)); 470 if (!f.mProductId.isEmpty()) 471 CHECK_ERROR_BREAK (flt, COMSETTER(ProductId) (f.mProductId)); 472 if (!f.mRevision.isEmpty()) 473 CHECK_ERROR_BREAK (flt, COMSETTER(Revision) (f.mRevision)); 474 if (!f.mManufacturer.isEmpty()) 475 CHECK_ERROR_BREAK (flt, COMSETTER(Manufacturer) (f.mManufacturer)); 476 if (!f.mRemote.isEmpty()) 477 CHECK_ERROR_BREAK (flt, COMSETTER(Remote) (f.mRemote)); 478 if (!f.mSerialNumber.isEmpty()) 479 CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber)); 480 480 if (!f.mMaskedInterfaces.isNull()) 481 481 CHECK_ERROR_BREAK (flt, COMSETTER(MaskedInterfaces) (f.mMaskedInterfaces)); … … 494 494 ComPtr <IHostUSBDeviceFilter> flt = coll[cmd.mIndex]; 495 495 496 if (!f.mName.is Null())497 CHECK_ERROR_BREAK (flt, COMSETTER(Name) (f.mName .setNullIfEmpty()));496 if (!f.mName.isEmpty()) 497 CHECK_ERROR_BREAK (flt, COMSETTER(Name) (f.mName)); 498 498 if (!f.mActive.isNull()) 499 499 CHECK_ERROR_BREAK (flt, COMSETTER(Active) (f.mActive)); 500 if (!f.mVendorId.is Null())501 CHECK_ERROR_BREAK (flt, COMSETTER(VendorId) (f.mVendorId .setNullIfEmpty()));502 if (!f.mProductId.is Null())503 CHECK_ERROR_BREAK (flt, COMSETTER(ProductId) (f.mProductId .setNullIfEmpty()));504 if (!f.mRevision.is Null())505 CHECK_ERROR_BREAK (flt, COMSETTER(Revision) (f.mRevision .setNullIfEmpty()));506 if (!f.mManufacturer.is Null())507 CHECK_ERROR_BREAK (flt, COMSETTER(Manufacturer) (f.mManufacturer .setNullIfEmpty()));508 if (!f.mSerialNumber.is Null())509 CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber .setNullIfEmpty()));500 if (!f.mVendorId.isEmpty()) 501 CHECK_ERROR_BREAK (flt, COMSETTER(VendorId) (f.mVendorId)); 502 if (!f.mProductId.isEmpty()) 503 CHECK_ERROR_BREAK (flt, COMSETTER(ProductId) (f.mProductId)); 504 if (!f.mRevision.isEmpty()) 505 CHECK_ERROR_BREAK (flt, COMSETTER(Revision) (f.mRevision)); 506 if (!f.mManufacturer.isEmpty()) 507 CHECK_ERROR_BREAK (flt, COMSETTER(Manufacturer) (f.mManufacturer)); 508 if (!f.mSerialNumber.isEmpty()) 509 CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber)); 510 510 if (!f.mMaskedInterfaces.isNull()) 511 511 CHECK_ERROR_BREAK (flt, COMSETTER(MaskedInterfaces) (f.mMaskedInterfaces)); … … 521 521 ComPtr <IUSBDeviceFilter> flt = coll[cmd.mIndex]; 522 522 523 if (!f.mName.is Null())524 CHECK_ERROR_BREAK (flt, COMSETTER(Name) (f.mName .setNullIfEmpty()));523 if (!f.mName.isEmpty()) 524 CHECK_ERROR_BREAK (flt, COMSETTER(Name) (f.mName)); 525 525 if (!f.mActive.isNull()) 526 526 CHECK_ERROR_BREAK (flt, COMSETTER(Active) (f.mActive)); 527 if (!f.mVendorId.is Null())528 CHECK_ERROR_BREAK (flt, COMSETTER(VendorId) (f.mVendorId .setNullIfEmpty()));529 if (!f.mProductId.is Null())530 CHECK_ERROR_BREAK (flt, COMSETTER(ProductId) (f.mProductId .setNullIfEmpty()));531 if (!f.mRevision.is Null())532 CHECK_ERROR_BREAK (flt, COMSETTER(Revision) (f.mRevision .setNullIfEmpty()));533 if (!f.mManufacturer.is Null())534 CHECK_ERROR_BREAK (flt, COMSETTER(Manufacturer) (f.mManufacturer .setNullIfEmpty()));535 if (!f.mRemote.is Null())536 CHECK_ERROR_BREAK (flt, COMSETTER(Remote) (f.mRemote .setNullIfEmpty()));537 if (!f.mSerialNumber.is Null())538 CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber .setNullIfEmpty()));527 if (!f.mVendorId.isEmpty()) 528 CHECK_ERROR_BREAK (flt, COMSETTER(VendorId) (f.mVendorId)); 529 if (!f.mProductId.isEmpty()) 530 CHECK_ERROR_BREAK (flt, COMSETTER(ProductId) (f.mProductId)); 531 if (!f.mRevision.isEmpty()) 532 CHECK_ERROR_BREAK (flt, COMSETTER(Revision) (f.mRevision)); 533 if (!f.mManufacturer.isEmpty()) 534 CHECK_ERROR_BREAK (flt, COMSETTER(Manufacturer) (f.mManufacturer)); 535 if (!f.mRemote.isEmpty()) 536 CHECK_ERROR_BREAK (flt, COMSETTER(Remote) (f.mRemote)); 537 if (!f.mSerialNumber.isEmpty()) 538 CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber)); 539 539 if (!f.mMaskedInterfaces.isNull()) 540 540 CHECK_ERROR_BREAK (flt, COMSETTER(MaskedInterfaces) (f.mMaskedInterfaces)); -
trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
r26445 r26587 311 311 { 312 312 Bstr keyString = key; 313 if (keyString && keyString== VBOXSDL_SECURELABEL_EXTRADATA)313 if (keyString == VBOXSDL_SECURELABEL_EXTRADATA) 314 314 { 315 315 /* -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r26581 r26587 228 228 return E_INVALIDARG; 229 229 230 if (com::asGuidStr(id).is Null())230 if (com::asGuidStr(id).isEmpty()) 231 231 { 232 232 /* it's a global extra data key someone wants to change */ … … 310 310 IN_BSTR key, IN_BSTR value) 311 311 { 312 if (com::asGuidStr(id).is Null())312 if (com::asGuidStr(id).isEmpty()) 313 313 { 314 314 QString sKey = QString::fromUtf16 (key); -
trunk/src/VBox/HostServices/GuestProperties/service.cpp
r26553 r26587 1158 1158 */ 1159 1159 /* static */ 1160 DECLCALLBACK(int) Service::reqNotify(PFNHGCMSVCEXT pfnCallback, void *pvData, 1161 char *pszName, char *pszValue, uint32_t u32TimeHigh, 1162 uint32_t u32TimeLow, char *pszFlags) 1160 DECLCALLBACK(int) Service::reqNotify(PFNHGCMSVCEXT pfnCallback, 1161 void *pvData, 1162 char *pszName, 1163 char *pszValue, 1164 uint32_t u32TimeHigh, 1165 uint32_t u32TimeLow, 1166 char *pszFlags) 1163 1167 { 1164 1168 LogFlowFunc (("pfnCallback=%p, pvData=%p, pszName=%p, pszValue=%p, u32TimeHigh=%u, u32TimeLow=%u, pszFlags=%p\n", pfnCallback, pvData, pszName, pszValue, u32TimeHigh, u32TimeLow, pszFlags)); -
trunk/src/VBox/Main/ApplianceImpl.cpp
r26553 r26587 501 501 } 502 502 503 HRESULT Appliance::setUpProgressFS(ComObjPtr<Progress> &pProgress, const Bstr &bstrDescription)503 HRESULT Appliance::setUpProgressFS(ComObjPtr<Progress> &pProgress, const Utf8Str &strDescription) 504 504 { 505 505 HRESULT rc; … … 532 532 533 533 rc = pProgress->init(mVirtualBox, static_cast<IAppliance*>(this), 534 bstrDescription,534 strDescription, 535 535 TRUE /* aCancelable */, 536 536 cOperations, // ULONG cOperations, 537 537 ulTotalOperationsWeight, // ULONG ulTotalOperationsWeight, 538 bstrDescription, // CBSTR bstrFirstOperationDescription,538 strDescription, // CBSTR bstrFirstOperationDescription, 539 539 m->ulWeightPerOperation); // ULONG ulFirstOperationWeight, 540 540 return rc; 541 541 } 542 542 543 HRESULT Appliance::setUpProgressImportS3(ComObjPtr<Progress> &pProgress, const Bstr &bstrDescription)543 HRESULT Appliance::setUpProgressImportS3(ComObjPtr<Progress> &pProgress, const Utf8Str &strDescription) 544 544 { 545 545 HRESULT rc; … … 572 572 573 573 rc = pProgress->init(mVirtualBox, static_cast<IAppliance*>(this), 574 bstrDescription,574 strDescription, 575 575 TRUE /* aCancelable */, 576 576 cOperations, // ULONG cOperations, 577 577 ulTotalOperationsWeight, // ULONG ulTotalOperationsWeight, 578 Bstr(tr("Init")), // CBSTR bstrFirstOperationDescription,578 tr("Init"), // CBSTR bstrFirstOperationDescription, 579 579 ulInitWeight); // ULONG ulFirstOperationWeight, 580 580 return rc; 581 581 } 582 582 583 HRESULT Appliance::setUpProgressWriteS3(ComObjPtr<Progress> &pProgress, const Bstr &bstrDescription)583 HRESULT Appliance::setUpProgressWriteS3(ComObjPtr<Progress> &pProgress, const Utf8Str &strDescription) 584 584 { 585 585 HRESULT rc; … … 614 614 615 615 rc = pProgress->init(mVirtualBox, static_cast<IAppliance*>(this), 616 bstrDescription,616 strDescription, 617 617 TRUE /* aCancelable */, 618 618 cOperations, // ULONG cOperations, 619 619 ulTotalOperationsWeight, // ULONG ulTotalOperationsWeight, 620 bstrDescription, // CBSTR bstrFirstOperationDescription,620 strDescription, // CBSTR bstrFirstOperationDescription, 621 621 ulOVFCreationWeight); // ULONG ulFirstOperationWeight, 622 622 return rc; … … 837 837 task->locInfo = aLocInfo; 838 838 839 Bstr progressDesc = BstrFmt(tr("Import appliance '%s'"),840 aLocInfo.strPath.c_str());839 Utf8Str progressDesc = Utf8StrFmt(tr("Import appliance '%s'"), 840 aLocInfo.strPath.c_str()); 841 841 842 842 HRESULT rc = S_OK; … … 1569 1569 mhda.lDevice, 1570 1570 DeviceType_Floppy, 1571 Bstr(""));1571 NULL); 1572 1572 if (FAILED(rc)) throw rc; 1573 1573 … … 1618 1618 mhda.lDevice, 1619 1619 DeviceType_DVD, 1620 Bstr(""));1620 NULL); 1621 1621 if (FAILED(rc)) throw rc; 1622 1622 … … 1744 1744 rc = mVirtualBox->OpenHardDisk(Bstr(strSrcFilePath), 1745 1745 AccessMode_ReadOnly, 1746 false, Bstr(""), false, Bstr(""),1746 false, NULL, false, NULL, 1747 1747 srcHdVBox.asOutParam()); 1748 1748 if (FAILED(rc)) throw rc; … … 4281 4281 IN_BSTR aExtraConfigValue) 4282 4282 { 4283 CheckComArgNotNull(aVboxValue);4284 CheckComArgNotNull(aExtraConfigValue);4285 4286 4283 AutoCaller autoCaller(this); 4287 4284 if (FAILED(autoCaller.rc())) return autoCaller.rc(); -
trunk/src/VBox/Main/ConsoleImpl.cpp
r26553 r26587 584 584 if (RT_SUCCESS(rc)) 585 585 { 586 mMachine->SetGuestProperty(Bstr(pszPropertyName), Bstr(""), Bstr("RDONLYGUEST"));586 mMachine->SetGuestProperty(Bstr(pszPropertyName), NULL, Bstr("RDONLYGUEST")); 587 587 RTStrFree(pszPropertyName); 588 588 } … … 591 591 if (RT_SUCCESS(rc)) 592 592 { 593 mMachine->SetGuestProperty(Bstr(pszPropertyName), Bstr(""), Bstr("RDONLYGUEST"));593 mMachine->SetGuestProperty(Bstr(pszPropertyName), NULL, Bstr("RDONLYGUEST")); 594 594 RTStrFree(pszPropertyName); 595 595 } … … 598 598 if (RT_SUCCESS(rc)) 599 599 { 600 mMachine->SetGuestProperty(Bstr(pszPropertyName), Bstr(""), Bstr("RDONLYGUEST"));600 mMachine->SetGuestProperty(Bstr(pszPropertyName), NULL, Bstr("RDONLYGUEST")); 601 601 RTStrFree(pszPropertyName); 602 602 } … … 1190 1190 1191 1191 // static 1192 DECLCALLBACK(int) 1193 Console::doGuestPropNotification(void *pvExtension,uint32_t u32Function,1194 void *pvParms, uint32_t cbParms)1192 DECLCALLBACK(int) Console::doGuestPropNotification(void *pvExtension, 1193 uint32_t u32Function, 1194 void *pvParms, uint32_t cbParms) 1195 1195 { 1196 1196 using namespace guestProp; … … 1212 1212 Bstr value(pCBData->pcszValue); 1213 1213 Bstr flags(pCBData->pcszFlags); 1214 if ( !name.isNull() 1215 && (!value.isNull() || pCBData->pcszValue == NULL) 1216 && (!flags.isNull() || pCBData->pcszFlags == NULL) 1217 ) 1218 { 1219 ComObjPtr<Console> ptrConsole = reinterpret_cast<Console *>(pvExtension); 1220 HRESULT hrc = ptrConsole->mControl->PushGuestProperty(name, 1221 value, 1222 pCBData->u64Timestamp, 1223 flags); 1224 if (SUCCEEDED(hrc)) 1225 rc = VINF_SUCCESS; 1226 else 1227 { 1228 LogFunc(("Console::doGuestPropNotification: hrc=%Rhrc pCBData={.pcszName=%s, .pcszValue=%s, .pcszFlags=%s}\n", 1229 pCBData->pcszName, pCBData->pcszValue, pCBData->pcszFlags)); 1230 rc = Global::vboxStatusCodeFromCOM(hrc); 1231 } 1232 } 1214 ComObjPtr<Console> ptrConsole = reinterpret_cast<Console *>(pvExtension); 1215 HRESULT hrc = ptrConsole->mControl->PushGuestProperty(name, 1216 value, 1217 pCBData->u64Timestamp, 1218 flags); 1219 if (SUCCEEDED(hrc)) 1220 rc = VINF_SUCCESS; 1233 1221 else 1234 rc = VERR_NO_MEMORY; 1222 { 1223 LogFunc(("Console::doGuestPropNotification: hrc=%Rhrc pCBData={.pcszName=%s, .pcszValue=%s, .pcszFlags=%s}\n", 1224 pCBData->pcszName, pCBData->pcszValue, pCBData->pcszFlags)); 1225 rc = Global::vboxStatusCodeFromCOM(hrc); 1226 } 1235 1227 return rc; 1236 1228 } … … 2594 2586 { 2595 2587 #ifdef VBOX_WITH_USB 2596 CheckComArg NotNull(aAddress);2588 CheckComArgStrNotEmptyOrNull(aAddress); 2597 2589 CheckComArgOutPointerValid(aDevice); 2598 2590 … … 2661 2653 } 2662 2654 2663 STDMETHODIMP 2664 Console::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable) 2665 { 2666 CheckComArgNotNull(aName); 2667 CheckComArgNotNull(aHostPath); 2655 STDMETHODIMP Console::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable) 2656 { 2657 CheckComArgStrNotEmptyOrNull(aName); 2658 CheckComArgStrNotEmptyOrNull(aHostPath); 2668 2659 2669 2660 AutoCaller autoCaller(this); … … 2732 2723 STDMETHODIMP Console::RemoveSharedFolder(IN_BSTR aName) 2733 2724 { 2734 CheckComArg NotNull(aName);2725 CheckComArgStrNotEmptyOrNull(aName); 2735 2726 2736 2727 AutoCaller autoCaller(this); … … 2798 2789 LogFlowThisFunc(("aName='%ls' mMachineState=%08X\n", aName, mMachineState)); 2799 2790 2800 CheckComArg NotNull(aName);2791 CheckComArgStrNotEmptyOrNull(aName); 2801 2792 CheckComArgOutPointerValid(aProgress); 2802 2793 … … 5034 5025 Bstr hostif; 5035 5026 adapter->COMGETTER(HostInterface)(hostif.asOutParam()); 5036 if ( !hostif)5027 if (hostif.isEmpty()) 5037 5028 { 5038 5029 return setError(VBOX_E_HOST_ERROR, … … 5090 5081 rc = mMachine->COMGETTER(StateFilePath)(savedStateFile.asOutParam()); 5091 5082 if (FAILED(rc)) return rc; 5092 ComAssertRet(! !savedStateFile, E_FAIL);5083 ComAssertRet(!savedStateFile.isEmpty(), E_FAIL); 5093 5084 int vrc = SSMR3ValidateFile(Utf8Str(savedStateFile).c_str(), false /* fChecksumIt */); 5094 5085 if (RT_FAILURE(vrc)) … … 5818 5809 { 5819 5810 ComAssertRet(aName && *aName, E_FAIL); 5820 ComAssertRet( aData.mHostPath, E_FAIL);5811 ComAssertRet(!aData.mHostPath.isEmpty(), E_FAIL); 5821 5812 5822 5813 /* sanity checks */ … … 7725 7716 * (i.e. creating a snapshot online) 7726 7717 */ 7727 ComAssertThrow( (!pTask->bstrSavedStateFile.is Null() && pTask->fTakingSnapshotOnline)7728 || (pTask->bstrSavedStateFile.is Null() && !pTask->fTakingSnapshotOnline),7718 ComAssertThrow( (!pTask->bstrSavedStateFile.isEmpty() && pTask->fTakingSnapshotOnline) 7719 || (pTask->bstrSavedStateFile.isEmpty() && !pTask->fTakingSnapshotOnline), 7729 7720 rc = E_FAIL); 7730 7721 -
trunk/src/VBox/Main/ConsoleImpl2.cpp
r26553 r26587 761 761 Bstr logoImagePath; 762 762 hrc = biosSettings->COMGETTER(LogoImagePath)(logoImagePath.asOutParam()); H(); 763 rc = CFGMR3InsertString(pCfg, "LogoFile", logoImagePath ? Utf8Str(logoImagePath).c_str() : "");RC_CHECK();763 rc = CFGMR3InsertString(pCfg, "LogoFile", Utf8Str(logoImagePath).c_str()); RC_CHECK(); 764 764 765 765 /* … … 1487 1487 Bstr macAddr; 1488 1488 hrc = networkAdapter->COMGETTER(MACAddress)(macAddr.asOutParam()); H(); 1489 Assert( macAddr);1489 Assert(!macAddr.isEmpty()); 1490 1490 Utf8Str macAddrUtf8 = macAddr; 1491 1491 char *macStr = (char*)macAddrUtf8.raw(); … … 3155 3155 } 3156 3156 3157 if (!networkName.is Null())3157 if (!networkName.isEmpty()) 3158 3158 { 3159 3159 /* … … 3162 3162 */ 3163 3163 ComPtr<IDHCPServer> dhcpServer; 3164 hrc = virtualBox->FindDHCPServerByNetworkName(networkName .mutableRaw(), dhcpServer.asOutParam());3164 hrc = virtualBox->FindDHCPServerByNetworkName(networkName, dhcpServer.asOutParam()); 3165 3165 if (SUCCEEDED(hrc)) 3166 3166 { -
trunk/src/VBox/Main/ConsoleImplTeleporter.cpp
r26553 r26587 894 894 * @param aProgress Where to return the progress object. 895 895 */ 896 STDMETHODIMP 897 Console::Teleport(IN_BSTR aHostname, ULONG aPort, IN_BSTR aPassword, ULONG aMaxDowntime, IProgress **aProgress) 896 STDMETHODIMP Console::Teleport(IN_BSTR aHostname, 897 ULONG aPort, 898 IN_BSTR aPassword, 899 ULONG aMaxDowntime, 900 IProgress **aProgress) 898 901 { 899 902 /* … … 903 906 CheckComArgOutPointerValid(aProgress); 904 907 CheckComArgStrNotEmptyOrNull(aHostname); 905 CheckComArgNotNull(aHostname);906 908 CheckComArgExprMsg(aPort, aPort > 0 && aPort <= 65535, ("is %u", aPort)); 907 909 CheckComArgExprMsg(aMaxDowntime, aMaxDowntime > 0, ("is %u", aMaxDowntime)); -
trunk/src/VBox/Main/GuestImpl.cpp
r26553 r26587 127 127 128 128 // redirect the call to IMachine if no additions are installed 129 if (mData.mAdditionsVersion.is Null())130 return mParent->machine()->COMGETTER(OSTypeId) 129 if (mData.mAdditionsVersion.isEmpty()) 130 return mParent->machine()->COMGETTER(OSTypeId)(aOSTypeId); 131 131 132 132 mData.mOSTypeId.cloneTo(aOSTypeId); … … 135 135 } 136 136 137 STDMETHODIMP Guest::COMGETTER(AdditionsActive) 137 STDMETHODIMP Guest::COMGETTER(AdditionsActive)(BOOL *aAdditionsActive) 138 138 { 139 139 CheckComArgOutPointerValid(aAdditionsActive); … … 262 262 IN_BSTR aDomain, BOOL aAllowInteractiveLogon) 263 263 { 264 CheckComArgNotNull(aUserName);265 CheckComArgNotNull(aPassword);266 CheckComArgNotNull(aDomain);267 268 264 AutoCaller autoCaller(this); 269 265 if (FAILED(autoCaller.rc())) return autoCaller.rc(); … … 278 274 279 275 vmmDev->getVMMDevPort()->pfnSetCredentials(vmmDev->getVMMDevPort(), 280 Utf8Str(aUserName).raw(), Utf8Str(aPassword).raw(), 281 Utf8Str(aDomain).raw(), u32Flags); 276 Utf8Str(aUserName).raw(), 277 Utf8Str(aPassword).raw(), 278 Utf8Str(aDomain).raw(), 279 u32Flags); 282 280 return S_OK; 283 281 } … … 317 315 void Guest::setAdditionsVersion (Bstr aVersion, VBOXOSTYPE aOsType) 318 316 { 319 Assert(aVersion.is Null() || !aVersion.isEmpty());317 Assert(aVersion.isEmpty() || !aVersion.isEmpty()); 320 318 321 319 AutoCaller autoCaller(this); … … 325 323 326 324 mData.mAdditionsVersion = aVersion; 327 mData.mAdditionsActive = !aVersion.is Null();328 329 mData.mOSTypeId = Global::OSTypeId 325 mData.mAdditionsActive = !aVersion.isEmpty(); 326 327 mData.mOSTypeId = Global::OSTypeId(aOsType); 330 328 } 331 329 -
trunk/src/VBox/Main/HostImpl.cpp
r26553 r26587 451 451 if(hr == S_OK) 452 452 { 453 size_t cUnicodeName = wcslen(lpszName) + 1; 454 size_t uniLen = (cUnicodeName * 2 + sizeof (OLECHAR) - 1) / sizeof (OLECHAR); 455 Bstr name (uniLen + 1 /* extra zero */); 456 wcscpy((wchar_t *) name.mutableRaw(), lpszName); 453 Bstr name(lpszName); 457 454 458 455 hr = pncc->GetInstanceGuid(&IfGuid); … … 464 461 iface.createObject(); 465 462 /* remove the curly bracket at the end */ 466 if (SUCCEEDED(iface->init 463 if (SUCCEEDED(iface->init(name, Guid (IfGuid), HostNetworkInterfaceType_Bridged))) 467 464 { 468 465 // iface->setVirtualBox(m->pParent); … … 1290 1287 STDMETHODIMP Host::FindHostDVDDrive(IN_BSTR aName, IMedium **aDrive) 1291 1288 { 1292 CheckComArg NotNull(aName);1289 CheckComArgStrNotEmptyOrNull(aName); 1293 1290 CheckComArgOutPointerValid(aDrive); 1294 1291 … … 1317 1314 STDMETHODIMP Host::FindHostFloppyDrive(IN_BSTR aName, IMedium **aDrive) 1318 1315 { 1319 CheckComArg NotNull(aName);1316 CheckComArgStrNotEmptyOrNull(aName); 1320 1317 CheckComArgOutPointerValid(aDrive); 1321 1318 … … 1451 1448 { 1452 1449 #ifdef VBOX_WITH_USB 1453 CheckComArg NotNull(aAddress);1450 CheckComArgStrNotEmptyOrNull(aAddress); 1454 1451 CheckComArgOutPointerValid(aDevice); 1455 1452 -
trunk/src/VBox/Main/HostNetworkInterfaceImpl.cpp
r26553 r26587 56 56 * @param aGuid GUID of the host network interface 57 57 */ 58 HRESULT HostNetworkInterface::init 58 HRESULT HostNetworkInterface::init(Bstr aInterfaceName, Guid aGuid, HostNetworkInterfaceType_T ifType) 59 59 { 60 60 LogFlowThisFunc(("aInterfaceName={%ls}, aGuid={%s}\n", 61 62 63 ComAssertRet( aInterfaceName, E_INVALIDARG);61 aInterfaceName.raw(), aGuid.toString().raw())); 62 63 ComAssertRet(!aInterfaceName.isEmpty(), E_INVALIDARG); 64 64 ComAssertRet(!aGuid.isEmpty(), E_INVALIDARG); 65 65 … … 423 423 { 424 424 m.realIPAddress = 0; 425 if (FAILED(mVBox->SetExtraData(Bstr(Utf8StrFmt("HostOnly/%ls/IPAddress", mInterfaceName.raw())), Bstr(""))))425 if (FAILED(mVBox->SetExtraData(Bstr(Utf8StrFmt("HostOnly/%ls/IPAddress", mInterfaceName.raw())), NULL))) 426 426 return E_FAIL; 427 if (FAILED(mVBox->SetExtraData(Bstr(Utf8StrFmt("HostOnly/%ls/IPNetMask", mInterfaceName.raw())), Bstr(""))))427 if (FAILED(mVBox->SetExtraData(Bstr(Utf8StrFmt("HostOnly/%ls/IPNetMask", mInterfaceName.raw())), NULL))) 428 428 return E_FAIL; 429 429 return S_OK; -
trunk/src/VBox/Main/MachineImpl.cpp
r26553 r26587 697 697 STDMETHODIMP Machine::COMSETTER(Name)(IN_BSTR aName) 698 698 { 699 CheckComArgNotNull(aName); 700 701 if (!*aName) 699 if (!aName || !*aName) 702 700 return setError(E_INVALIDARG, 703 701 tr("Machine name cannot be empty")); … … 779 777 STDMETHODIMP Machine::COMSETTER(OSTypeId)(IN_BSTR aOSTypeId) 780 778 { 781 CheckComArg NotNull(aOSTypeId);779 CheckComArgStrNotEmptyOrNull(aOSTypeId); 782 780 783 781 AutoCaller autoCaller(this); … … 1930 1928 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1931 1929 1932 if (mData->mSession.mType.isNull()) 1933 Bstr("").cloneTo(aSessionType); 1934 else 1935 mData->mSession.mType.cloneTo(aSessionType); 1930 mData->mSession.mType.cloneTo(aSessionType); 1936 1931 1937 1932 return S_OK; … … 1990 1985 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1991 1986 1992 if (mSSData->mStateFilePath.isEmpty()) 1993 Bstr("").cloneTo(aStateFilePath); 1994 else 1995 mSSData->mStateFilePath.cloneTo(aStateFilePath); 1987 mSSData->mStateFilePath.cloneTo(aStateFilePath); 1996 1988 1997 1989 return S_OK; … … 2134 2126 } 2135 2127 2136 STDMETHODIMP 2137 Machine::COMSETTER(GuestPropertyNotificationPatterns)(IN_BSTR aPatterns) 2138 { 2139 CheckComArgNotNull(aPatterns); 2128 STDMETHODIMP Machine::COMSETTER(GuestPropertyNotificationPatterns)(IN_BSTR aPatterns) 2129 { 2140 2130 AutoCaller autoCaller(this); 2141 2131 if (FAILED(autoCaller.rc())) return autoCaller.rc(); … … 2400 2390 IN_BSTR aId) 2401 2391 { 2392 CheckComArgStrNotEmptyOrNull(aControllerName); 2393 2402 2394 LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aType=%d aId=\"%ls\"\n", 2403 2395 aControllerName, aControllerPort, aDevice, aType, aId)); 2404 2405 CheckComArgNotNull(aControllerName);2406 CheckComArgNotNull(aId);2407 2396 2408 2397 AutoCaller autoCaller(this); … … 2826 2815 LONG aDevice) 2827 2816 { 2828 CheckComArg NotNull(aControllerName);2817 CheckComArgStrNotEmptyOrNull(aControllerName); 2829 2818 2830 2819 LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%ld aDevice=%ld\n", … … 2911 2900 LONG aDevice, BOOL aPassthrough) 2912 2901 { 2913 CheckComArg NotNull(aControllerName);2902 CheckComArgStrNotEmptyOrNull(aControllerName); 2914 2903 2915 2904 LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%ld aDevice=%ld aPassthrough=%d\n", … … 2965 2954 aControllerName, aControllerPort, aDevice, aForce)); 2966 2955 2967 CheckComArgNotNull(aControllerName); 2968 CheckComArgNotNull(aId); 2956 CheckComArgStrNotEmptyOrNull(aControllerName); 2969 2957 2970 2958 AutoCaller autoCaller(this); … … 3106 3094 aControllerName, aControllerPort, aDevice)); 3107 3095 3108 CheckComArg NotNull(aControllerName);3096 CheckComArgStrNotEmptyOrNull(aControllerName); 3109 3097 CheckComArgOutPointerValid(aMedium); 3110 3098 … … 3205 3193 BSTR *aValue) 3206 3194 { 3207 CheckComArg NotNull(aKey);3195 CheckComArgStrNotEmptyOrNull(aKey); 3208 3196 CheckComArgOutPointerValid(aValue); 3209 3197 … … 3212 3200 3213 3201 /* start with nothing found */ 3214 Bstr bstrResult ("");3202 Bstr bstrResult; 3215 3203 3216 3204 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 3232 3220 STDMETHODIMP Machine::SetExtraData(IN_BSTR aKey, IN_BSTR aValue) 3233 3221 { 3234 CheckComArg NotNull(aKey);3222 CheckComArgStrNotEmptyOrNull(aKey); 3235 3223 3236 3224 AutoCaller autoCaller(this); … … 3263 3251 // lock to copy the list of callbacks to invoke 3264 3252 Bstr error; 3265 Bstr bstrValue; 3266 if (aValue) 3267 bstrValue = aValue; 3268 else 3269 bstrValue = (const char *)""; 3253 Bstr bstrValue(aValue); 3270 3254 3271 3255 if (!mParent->onExtraDataCanChange(mData->mUuid, aKey, bstrValue, error)) 3272 3256 { 3273 3257 const char *sep = error.isEmpty() ? "" : ": "; 3274 CBSTR err = error. isNull() ? (CBSTR) L"" : error.raw();3258 CBSTR err = error.raw(); 3275 3259 LogWarningFunc(("Someone vetoed! Change refused%s%ls\n", 3276 3260 sep, err)); … … 3456 3440 STDMETHODIMP Machine::FindSnapshot(IN_BSTR aName, ISnapshot **aSnapshot) 3457 3441 { 3458 CheckComArg NotNull(aName);3442 CheckComArgStrNotEmptyOrNull(aName); 3459 3443 CheckComArgOutPointerValid(aSnapshot); 3460 3444 … … 3482 3466 STDMETHODIMP Machine::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable) 3483 3467 { 3484 CheckComArg NotNull(aName);3485 CheckComArg NotNull(aHostPath);3468 CheckComArgStrNotEmptyOrNull(aName); 3469 CheckComArgStrNotEmptyOrNull(aHostPath); 3486 3470 3487 3471 AutoCaller autoCaller(this); … … 3517 3501 STDMETHODIMP Machine::RemoveSharedFolder(IN_BSTR aName) 3518 3502 { 3519 CheckComArg NotNull(aName);3503 CheckComArgStrNotEmptyOrNull(aName); 3520 3504 3521 3505 AutoCaller autoCaller(this); … … 3607 3591 ReturnComNotImplemented(); 3608 3592 #else // VBOX_WITH_GUEST_PROPS 3609 CheckComArg NotNull(aName);3593 CheckComArgStrNotEmptyOrNull(aName); 3610 3594 CheckComArgOutPointerValid(aValue); 3611 3595 CheckComArgOutPointerValid(aTimestamp); … … 3686 3670 using namespace guestProp; 3687 3671 3688 CheckComArgNotNull(aName); 3689 CheckComArgNotNull(aValue); 3672 CheckComArgStrNotEmptyOrNull(aName); 3690 3673 if ((aFlags != NULL) && !VALID_PTR(aFlags)) 3691 3674 return E_INVALIDARG; … … 3696 3679 { 3697 3680 Utf8Str utf8Name(aName); 3681 Utf8Str utf8Value(aValue); 3698 3682 Utf8Str utf8Flags(aFlags); 3699 3683 … … 3751 3735 if (found && SUCCEEDED(rc)) 3752 3736 { 3753 if ( *aValue)3737 if (utf8Value.length()) 3754 3738 { 3755 3739 RTTIMESPEC time; 3756 property.strValue = aValue;3740 property.strValue = utf8Value; 3757 3741 property.mTimestamp = RTTimeSpecGetNano(RTTimeNow(&time)); 3758 3742 if (aFlags != NULL) … … 3761 3745 } 3762 3746 } 3763 else if (SUCCEEDED(rc) && *aValue)3747 else if (SUCCEEDED(rc) && utf8Value.length()) 3764 3748 { 3765 3749 RTTIMESPEC time; … … 3767 3751 mHWData.backup(); 3768 3752 property.strName = aName; 3769 property.strValue = aValue;3753 property.strValue = utf8Value; 3770 3754 property.mTimestamp = RTTimeSpecGetNano(RTTimeNow(&time)); 3771 3755 property.mFlags = fFlags; … … 3785 3769 else 3786 3770 { 3787 ComPtr<IInternalSessionControl> directControl = 3788 mData->mSession.mDirectControl; 3771 ComPtr<IInternalSessionControl> directControl = mData->mSession.mDirectControl; 3789 3772 3790 3773 /* just be on the safe side when calling another process */ … … 3797 3780 else 3798 3781 rc = directControl->AccessGuestProperty(aName, 3799 *aValue ? aValue : NULL, /** @todo Fix when adding DeleteGuestProperty(), see defect. */3782 aValue, 3800 3783 aFlags, 3801 3784 true /* isSetter */, … … 3931 3914 aControllerName, aControllerPort, aDevice)); 3932 3915 3933 CheckComArg NotNull(aControllerName);3916 CheckComArgStrNotEmptyOrNull(aControllerName); 3934 3917 CheckComArgOutPointerValid(aAttachment); 3935 3918 … … 7284 7267 7285 7268 data.cCPUs = mHWData->mCPUCount; 7286 data.fCpuHotPlug = mHWData->mCPUHotPlugEnabled;7269 data.fCpuHotPlug = !!mHWData->mCPUHotPlugEnabled; 7287 7270 7288 7271 data.llCpus.clear(); … … 7311 7294 7312 7295 // HPET 7313 data.fHpetEnabled = mHWData->mHpetEnabled;7296 data.fHpetEnabled = !!mHWData->mHpetEnabled; 7314 7297 7315 7298 // boot order … … 8947 8930 #endif /* VBOX_WITH_USB */ 8948 8931 8949 if (!mData->mSession.mType.is Null())8932 if (!mData->mSession.mType.isEmpty()) 8950 8933 { 8951 8934 /* mType is not null when this machine's process has been started by … … 9655 9638 using namespace guestProp; 9656 9639 9657 CheckComArg NotNull(aName);9658 if (aValue != NULL&& (!VALID_PTR(aValue) || !VALID_PTR(aFlags)))9640 CheckComArgStrNotEmptyOrNull(aName); 9641 if (aValue && *aValue && (!VALID_PTR(aValue) || !VALID_PTR(aFlags))) 9659 9642 return E_POINTER; /* aValue can be NULL to indicate deletion */ 9660 9643 -
trunk/src/VBox/Main/Matching.cpp
r26553 r26587 198 198 return 199 199 mSimple.isEmpty() || 200 (mIgnoreCase && mSimple.compare IgnoreCase (aValue) == 0) ||201 (!mIgnoreCase && mSimple.compare 200 (mIgnoreCase && mSimple.compare(aValue, Bstr::CaseInsensitive) == 0) || 201 (!mIgnoreCase && mSimple.compare(aValue) == 0); 202 202 } 203 203 -
trunk/src/VBox/Main/MediumImpl.cpp
r26553 r26587 1361 1361 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1362 1362 1363 if (m->strDescription.isEmpty()) 1364 Bstr("").cloneTo(aDescription); 1365 else 1366 m->strDescription.cloneTo(aDescription); 1363 m->strDescription.cloneTo(aDescription); 1367 1364 1368 1365 return S_OK; … … 1371 1368 STDMETHODIMP Medium::COMSETTER(Description)(IN_BSTR aDescription) 1372 1369 { 1373 CheckComArgNotNull(aDescription);1374 1375 1370 AutoCaller autoCaller(this); 1376 1371 if (FAILED(autoCaller.rc())) return autoCaller.rc(); … … 1415 1410 STDMETHODIMP Medium::COMSETTER(Location)(IN_BSTR aLocation) 1416 1411 { 1417 CheckComArg NotNull(aLocation);1412 CheckComArgStrNotEmptyOrNull(aLocation); 1418 1413 1419 1414 AutoCaller autoCaller(this); … … 1725 1720 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1726 1721 1727 if (m->strLastAccessError.isEmpty()) 1728 Bstr("").cloneTo(aLastAccessError); 1729 else 1730 m->strLastAccessError.cloneTo(aLastAccessError); 1722 m->strLastAccessError.cloneTo(aLastAccessError); 1731 1723 1732 1724 return S_OK; … … 2102 2094 tr("Property '%ls' does not exist"), aName); 2103 2095 2104 if (it->second.isEmpty()) 2105 Bstr("").cloneTo(aValue); 2106 else 2107 it->second.cloneTo(aValue); 2096 it->second.cloneTo(aValue); 2108 2097 2109 2098 return S_OK; … … 2169 2158 { 2170 2159 it->first.cloneTo(&names[i]); 2171 if (it->second.isEmpty()) 2172 Bstr("").cloneTo(&values[i]); 2173 else 2174 it->second.cloneTo(&values[i]); 2160 it->second.cloneTo(&values[i]); 2175 2161 ++ i; 2176 2162 } … … 2362 2348 2363 2349 STDMETHODIMP Medium::CloneTo(IMedium *aTarget, 2364 2365 2366 2350 MediumVariant_T aVariant, 2351 IMedium *aParent, 2352 IProgress **aProgress) 2367 2353 { 2368 2354 CheckComArgNotNull(aTarget); … … 3090 3076 { 3091 3077 /* only save properties that have non-default values */ 3092 if (!it->second.is Null())3078 if (!it->second.isEmpty()) 3093 3079 { 3094 3080 Utf8Str name = it->first; … … 4858 4844 4859 4845 /* we interpret null values as "no value" in Medium */ 4860 if (it->second.is Null())4846 if (it->second.isEmpty()) 4861 4847 return VERR_CFGM_VALUE_NOT_FOUND; 4862 4848 … … 4885 4871 4886 4872 /* we interpret null values as "no value" in Medium */ 4887 if (it->second.is Null())4873 if (it->second.isEmpty()) 4888 4874 return VERR_CFGM_VALUE_NOT_FOUND; 4889 4875 -
trunk/src/VBox/Main/NetworkAdapterImpl.cpp
r26553 r26587 312 312 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 313 313 314 ComAssertRet(! !mData->mMACAddress, E_FAIL);314 ComAssertRet(!mData->mMACAddress.isEmpty(), E_FAIL); 315 315 316 316 mData->mMACAddress.cloneTo(aMACAddress); … … 1026 1026 case NetworkAttachmentType_NAT: 1027 1027 mData->mNATNetwork = data.strName; 1028 if (mData->mNATNetwork.isNull())1029 mData->mNATNetwork = "";1030 1028 rc = AttachToNAT(); 1031 1029 if (FAILED(rc)) return rc; … … 1041 1039 case NetworkAttachmentType_Internal: 1042 1040 mData->mInternalNetwork = data.strName; 1043 Assert(!mData->mInternalNetwork.is Null());1041 Assert(!mData->mInternalNetwork.isEmpty()); 1044 1042 1045 1043 rc = AttachToInternalNetwork(); -
trunk/src/VBox/Main/ProgressImpl.cpp
r26553 r26587 97 97 * @return COM result indicator. 98 98 */ 99 HRESULT ProgressBase::protectedInit 99 HRESULT ProgressBase::protectedInit(AutoInitSpan &aAutoInitSpan, 100 100 #if !defined (VBOX_COM_INPROC) 101 VirtualBox *aParent,101 VirtualBox *aParent, 102 102 #endif 103 IUnknown *aInitiator, 104 CBSTR aDescription, OUT_GUID aId /* = NULL */) 103 IUnknown *aInitiator, 104 const Utf8Str &strDescription, 105 OUT_GUID aId /* = NULL */) 105 106 { 106 107 /* Guarantees subclasses call this method at the proper time */ … … 116 117 #endif 117 118 118 AssertReturn( aDescription, E_INVALIDARG);119 AssertReturn(!strDescription.isEmpty(), E_INVALIDARG); 119 120 120 121 #if !defined (VBOX_COM_INPROC) … … 143 144 #endif 144 145 145 unconst(m Description) = aDescription;146 unconst(m_strDescription) = strDescription; 146 147 147 148 return S_OK; … … 220 221 221 222 /* mDescription is constant during life time, no need to lock */ 222 m Description.cloneTo(aDescription);223 m_strDescription.cloneTo(aDescription); 223 224 224 225 return S_OK; … … 465 466 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 466 467 467 m_ bstrOperationDescription.cloneTo(aOperationDescription);468 m_strOperationDescription.cloneTo(aOperationDescription); 468 469 469 470 return S_OK; … … 663 664 #endif 664 665 IUnknown *aInitiator, 665 CBSTR aDescription,666 const Utf8Str &strDescription, 666 667 BOOL aCancelable, 667 668 ULONG cOperations, 668 669 ULONG ulTotalOperationsWeight, 669 CBSTR bstrFirstOperationDescription,670 const Utf8Str &strFirstOperationDescription, 670 671 ULONG ulFirstOperationWeight, 671 672 OUT_GUID aId /* = NULL */) 672 673 { 673 LogFlowThisFunc(("aDescription=\"% ls\", cOperations=%d, ulTotalOperationsWeight=%d, bstrFirstOperationDescription=\"%ls\", ulFirstOperationWeight=%d\n",674 aDescription,674 LogFlowThisFunc(("aDescription=\"%s\", cOperations=%d, ulTotalOperationsWeight=%d, strFirstOperationDescription=\"%s\", ulFirstOperationWeight=%d\n", 675 strDescription.c_str(), 675 676 cOperations, 676 677 ulTotalOperationsWeight, 677 bstrFirstOperationDescription,678 strFirstOperationDescription.c_str(), 678 679 ulFirstOperationWeight)); 679 680 680 AssertReturn( bstrFirstOperationDescription, E_INVALIDARG);681 AssertReturn(!strFirstOperationDescription.isEmpty(), E_INVALIDARG); 681 682 AssertReturn(ulTotalOperationsWeight >= 1, E_INVALIDARG); 682 683 … … 687 688 HRESULT rc = S_OK; 688 689 689 rc = ProgressBase::protectedInit 690 rc = ProgressBase::protectedInit(autoInitSpan, 690 691 #if !defined (VBOX_COM_INPROC) 691 692 aParent, 692 693 #endif 693 aInitiator, aDescription, aId); 694 aInitiator, 695 strDescription, 696 aId); 694 697 if (FAILED(rc)) return rc; 695 698 … … 700 703 m_ulOperationsCompletedWeight = 0; 701 704 m_ulCurrentOperation = 0; 702 m_ bstrOperationDescription = bstrFirstOperationDescription;705 m_strOperationDescription = strFirstOperationDescription; 703 706 m_ulCurrentOperationWeight = ulFirstOperationWeight; 704 707 m_ulOperationPercent = 0; … … 733 736 HRESULT Progress::init(BOOL aCancelable, 734 737 ULONG aOperationCount, 735 CBSTR aOperationDescription)736 { 737 LogFlowThisFunc(("aOperationDescription=\"% ls\"\n", aOperationDescription));738 const Utf8Str &strOperationDescription) 739 { 740 LogFlowThisFunc(("aOperationDescription=\"%s\"\n", strOperationDescription.c_str())); 738 741 739 742 /* Enclose the state transition NotReady->InInit->Ready */ … … 743 746 HRESULT rc = S_OK; 744 747 745 rc = ProgressBase::protectedInit 748 rc = ProgressBase::protectedInit(autoInitSpan); 746 749 if (FAILED(rc)) return rc; 747 750 … … 754 757 m_ulOperationsCompletedWeight = 0; 755 758 m_ulCurrentOperation = 0; 756 m_ bstrOperationDescription = aOperationDescription;759 m_strOperationDescription = strOperationDescription; 757 760 m_ulCurrentOperationWeight = 1; 758 761 m_ulOperationPercent = 0; 759 762 760 int vrc = RTSemEventMultiCreate 761 ComAssertRCRet 762 763 RTSemEventMultiReset 763 int vrc = RTSemEventMultiCreate(&mCompletedSem); 764 ComAssertRCRet(vrc, E_FAIL); 765 766 RTSemEventMultiReset(mCompletedSem); 764 767 765 768 /* Confirm a successful initialization when it's the case */ … … 787 790 if (mWaitersCount > 0) 788 791 { 789 LogFlow (("WARNING: There are still %d threads waiting for '% ls' completion!\n",790 mWaitersCount, m Description.raw()));791 RTSemEventMultiSignal 792 LogFlow (("WARNING: There are still %d threads waiting for '%s' completion!\n", 793 mWaitersCount, m_strDescription.c_str())); 794 RTSemEventMultiSignal(mCompletedSem); 792 795 } 793 796 794 RTSemEventMultiDestroy 795 796 ProgressBase::protectedUninit 797 RTSemEventMultiDestroy(mCompletedSem); 798 799 ProgressBase::protectedUninit(autoUninitSpan); 797 800 } 798 801 … … 1004 1007 m_ulOperationsCompletedWeight += m_ulCurrentOperationWeight; 1005 1008 1006 m_ bstrOperationDescription = bstrNextOperationDescription;1009 m_strOperationDescription = bstrNextOperationDescription; 1007 1010 m_ulCurrentOperationWeight = ulNextOperationsWeight; 1008 1011 m_ulOperationPercent = 0; 1009 1012 1010 Log(("Progress::setNextOperation(% ls): ulNextOperationsWeight = %d; m_ulCurrentOperation is now %d, m_ulOperationsCompletedWeight is now %d\n",1011 m_ bstrOperationDescription.raw(), ulNextOperationsWeight, m_ulCurrentOperation, m_ulOperationsCompletedWeight));1013 Log(("Progress::setNextOperation(%s): ulNextOperationsWeight = %d; m_ulCurrentOperation is now %d, m_ulOperationsCompletedWeight is now %d\n", 1014 m_strOperationDescription.c_str(), ulNextOperationsWeight, m_ulCurrentOperation, m_ulOperationsCompletedWeight)); 1012 1015 1013 1016 /* wake up all waiting threads */ … … 1286 1289 1287 1290 m_ulCurrentOperation = 0; 1288 rc = mProgresses[0]->COMGETTER(OperationDescription)(m_bstrOperationDescription.asOutParam()); 1291 Bstr bstrOperationDescription; 1292 rc = mProgresses[0]->COMGETTER(OperationDescription)(bstrOperationDescription.asOutParam()); 1293 m_strOperationDescription = bstrOperationDescription; 1289 1294 if (FAILED(rc)) return rc; 1290 1295 … … 1786 1791 { 1787 1792 m_ulCurrentOperation = mCompletedOperations + operation; 1788 rc = progress->COMGETTER(OperationDescription) ( 1789 m_bstrOperationDescription.asOutParam()); 1793 Bstr bstrOperationDescription; 1794 rc = progress->COMGETTER(OperationDescription)(bstrOperationDescription.asOutParam()); 1795 m_strOperationDescription = bstrOperationDescription; 1790 1796 } 1791 1797 } -
trunk/src/VBox/Main/RemoteUSBDeviceImpl.cpp
r26553 r26587 134 134 ///////////////////////////////////////////////////////////////////////////// 135 135 136 STDMETHODIMP RemoteUSBDevice::COMGETTER(Id) 136 STDMETHODIMP RemoteUSBDevice::COMGETTER(Id)(BSTR *aId) 137 137 { 138 138 CheckComArgOutPointerValid(aId); … … 142 142 143 143 /* this is const, no need to lock */ 144 Bstr(mData.id ).cloneTo(aId);144 Bstr(mData.id.toUtf16()).cloneTo(aId); 145 145 146 146 return S_OK; -
trunk/src/VBox/Main/SessionImpl.cpp
r26553 r26587 682 682 } 683 683 684 STDMETHODIMP Session::AccessGuestProperty(IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags, 685 BOOL aIsSetter, BSTR *aRetValue, ULONG64 *aRetTimestamp, BSTR *aRetFlags) 684 STDMETHODIMP Session::AccessGuestProperty(IN_BSTR aName, 685 IN_BSTR aValue, 686 IN_BSTR aFlags, 687 BOOL aIsSetter, 688 BSTR *aRetValue, 689 ULONG64 *aRetTimestamp, 690 BSTR *aRetFlags) 686 691 { 687 692 #ifdef VBOX_WITH_GUEST_PROPS … … 694 699 Global::stringifySessionState(mState)); 695 700 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 696 CheckComArg NotNull(aName);701 CheckComArgStrNotEmptyOrNull(aName); 697 702 if (!aIsSetter && !VALID_PTR(aRetValue)) 698 703 return E_POINTER; -
trunk/src/VBox/Main/SharedFolderImpl.cpp
r26553 r26587 333 333 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 334 334 335 if (m.lastAccessError.isEmpty()) 336 Bstr("").cloneTo(aLastAccessError); 337 else 338 m.lastAccessError.cloneTo(aLastAccessError); 335 m.lastAccessError.cloneTo(aLastAccessError); 339 336 340 337 return S_OK; -
trunk/src/VBox/Main/SnapshotImpl.cpp
r26553 r26587 342 342 STDMETHODIMP Snapshot::COMSETTER(Name)(IN_BSTR aName) 343 343 { 344 CheckComArg NotNull(aName);344 CheckComArgStrNotEmptyOrNull(aName); 345 345 346 346 AutoCaller autoCaller(this); … … 378 378 STDMETHODIMP Snapshot::COMSETTER(Description)(IN_BSTR aDescription) 379 379 { 380 CheckComArgNotNull(aDescription);381 382 380 AutoCaller autoCaller(this); 383 381 if (FAILED(autoCaller.rc())) return autoCaller.rc(); -
trunk/src/VBox/Main/SystemPropertiesImpl.cpp
r26553 r26587 814 814 * @return ComObjPtr<MediumFormat> 815 815 */ 816 ComObjPtr<MediumFormat> SystemProperties::mediumFormat 816 ComObjPtr<MediumFormat> SystemProperties::mediumFormat(CBSTR aFormat) 817 817 { 818 818 ComObjPtr<MediumFormat> format; … … 824 824 825 825 for (MediumFormatList::const_iterator it = mMediumFormats.begin(); 826 it != mMediumFormats.end(); ++ it) 826 it != mMediumFormats.end(); 827 ++it) 827 828 { 828 829 /* MediumFormat is all const, no need to lock */ 829 830 830 if ((*it)->id().compare IgnoreCase (aFormat) == 0)831 if ((*it)->id().compare(aFormat, Bstr::CaseInsensitive) == 0) 831 832 { 832 833 format = *it; -
trunk/src/VBox/Main/USBControllerImpl.cpp
r26553 r26587 1110 1110 rc = aUSBDevice->COMGETTER(Manufacturer) (manufacturer.asOutParam()); 1111 1111 ComAssertComRCRet(rc, false); 1112 if (!manufacturer.is Null())1112 if (!manufacturer.isEmpty()) 1113 1113 USBFilterSetStringExact (&dev, USBFILTERIDX_MANUFACTURER_STR, Utf8Str(manufacturer).c_str(), true); 1114 1114 … … 1116 1116 rc = aUSBDevice->COMGETTER(Product) (product.asOutParam()); 1117 1117 ComAssertComRCRet(rc, false); 1118 if (!product.is Null())1118 if (!product.isEmpty()) 1119 1119 USBFilterSetStringExact (&dev, USBFILTERIDX_PRODUCT_STR, Utf8Str(product).c_str(), true); 1120 1120 … … 1122 1122 rc = aUSBDevice->COMGETTER(SerialNumber) (serialNumber.asOutParam()); 1123 1123 ComAssertComRCRet(rc, false); 1124 if (!serialNumber.is Null())1124 if (!serialNumber.isEmpty()) 1125 1125 USBFilterSetStringExact (&dev, USBFILTERIDX_SERIAL_NUMBER_STR, Utf8Str(serialNumber).c_str(), true); 1126 1126 -
trunk/src/VBox/Main/USBDeviceImpl.cpp
r26553 r26587 155 155 156 156 /* this is const, no need to lock */ 157 Guid(mData.id).to String().cloneTo(aId);157 Guid(mData.id).toUtf16().cloneTo(aId); 158 158 159 159 return S_OK; -
trunk/src/VBox/Main/VirtualBoxBase.cpp
r26553 r26587 810 810 */ 811 811 /* static */ 812 HRESULT VirtualBoxSupportErrorInfoImplBase::setErrorInternal ( 813 HRESULT aResultCode, const GUID &aIID, 814 const Bstr &aComponent, const Bstr &aText, 815 bool aWarning, bool aLogIt) 812 HRESULT VirtualBoxSupportErrorInfoImplBase::setErrorInternal(HRESULT aResultCode, 813 const GUID &aIID, 814 const Bstr &aComponent, 815 const Bstr &aText, 816 bool aWarning, 817 bool aLogIt) 816 818 { 817 819 /* whether multi-error mode is turned on */ … … 825 827 826 828 /* these are mandatory, others -- not */ 827 AssertReturn( (!aWarning && FAILED(aResultCode)) ||828 (aWarning && aResultCode != S_OK),829 AssertReturn( (!aWarning && FAILED(aResultCode)) 830 || (aWarning && aResultCode != S_OK), 829 831 E_FAIL); 830 832 AssertReturn(!aText.isEmpty(), E_FAIL); … … 914 916 915 917 /* set the current error info and preserve the previous one if any */ 916 rc = info->init (aResultCode, aIID, aComponent, aText, curInfo);918 rc = info->init(aResultCode, aIID, aComponent.raw(), aText.raw(), curInfo); 917 919 if (FAILED(rc)) break; 918 920 -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r26553 r26587 302 302 LogFlowThisFuncEnter(); 303 303 304 if (sVersion.is Null())304 if (sVersion.isEmpty()) 305 305 sVersion = VBOX_VERSION_STRING; 306 306 sRevision = RTBldCfgRevision(); 307 if (sPackageType.is Null())307 if (sPackageType.isEmpty()) 308 308 sPackageType = VBOX_PACKAGE_STRING; 309 309 LogFlowThisFunc(("Version: %ls, Package: %ls\n", sVersion.raw(), sPackageType.raw())); … … 323 323 /* compose the VirtualBox.xml file name */ 324 324 unconst(m->strSettingsFilePath) = Utf8StrFmt("%s%c%s", 325 m->strHomeDir.raw(),326 RTPATH_DELIMITER,327 VBOX_GLOBAL_SETTINGS_FILE);325 m->strHomeDir.raw(), 326 RTPATH_DELIMITER, 327 VBOX_GLOBAL_SETTINGS_FILE); 328 328 HRESULT rc = S_OK; 329 329 bool fCreate = false; … … 979 979 firmwareDesc[i].fileName); 980 980 rc = calculateFullPath(shortName, fullName); AssertRCReturn(rc, rc); 981 if (RTFileExists(fullName. raw()))981 if (RTFileExists(fullName.c_str())) 982 982 { 983 983 *aResult = TRUE; 984 984 if (aFile) 985 Utf8Str(fullName).cloneTo(aFile);985 fullName.cloneTo(aFile); 986 986 break; 987 987 } … … 993 993 RTPATH_DELIMITER, 994 994 firmwareDesc[i].fileName); 995 if (RTFileExists(fullName. raw()))995 if (RTFileExists(fullName.c_str())) 996 996 { 997 997 *aResult = TRUE; 998 998 if (aFile) 999 Utf8Str(fullName).cloneTo(aFile);999 fullName.cloneTo(aFile); 1000 1000 break; 1001 1001 } … … 1225 1225 LogFlowThisFunc(("aName=\"%ls\", aMachine={%p}\n", aName, aMachine)); 1226 1226 1227 CheckComArg NotNull(aName);1227 CheckComArgStrNotEmptyOrNull(aName); 1228 1228 CheckComArgOutSafeArrayPointerValid(aMachine); 1229 1229 … … 1346 1346 IMedium **aHardDisk) 1347 1347 { 1348 CheckComArgNotNull(aLocation); 1349 CheckComArgNotNull(aImageId); 1350 CheckComArgNotNull(aParentId); 1348 CheckComArgStrNotEmptyOrNull(aLocation); 1351 1349 CheckComArgOutSafeArrayPointerValid(aHardDisk); 1352 1350 … … 1423 1421 IMedium **aHardDisk) 1424 1422 { 1425 CheckComArg NotNull(aLocation);1423 CheckComArgStrNotEmptyOrNull(aLocation); 1426 1424 CheckComArgOutSafeArrayPointerValid(aHardDisk); 1427 1425 … … 1430 1428 1431 1429 ComObjPtr<Medium> hardDisk; 1432 HRESULT rc = findHardDisk(NULL, aLocation, true /* setError */, &hardDisk); 1430 Utf8Str strLocation(aLocation); 1431 HRESULT rc = findHardDisk(NULL, &strLocation, true /* setError */, &hardDisk); 1433 1432 1434 1433 /* the below will set *aHardDisk to NULL if hardDisk is null */ … … 1479 1478 1480 1479 /** @note Locks objects! */ 1481 STDMETHODIMP VirtualBox::GetDVDImage 1480 STDMETHODIMP VirtualBox::GetDVDImage(IN_BSTR aId, IMedium **aDVDImage) 1482 1481 { 1483 1482 CheckComArgOutSafeArrayPointerValid(aDVDImage); … … 1497 1496 1498 1497 /** @note Locks objects! */ 1499 STDMETHODIMP VirtualBox::FindDVDImage 1500 { 1501 CheckComArg NotNull(aLocation);1498 STDMETHODIMP VirtualBox::FindDVDImage(IN_BSTR aLocation, IMedium **aDVDImage) 1499 { 1500 CheckComArgStrNotEmptyOrNull(aLocation); 1502 1501 CheckComArgOutSafeArrayPointerValid(aDVDImage); 1503 1502 … … 1506 1505 1507 1506 ComObjPtr<Medium> image; 1508 HRESULT rc = findDVDImage (NULL, aLocation, true /* setError */, &image); 1507 Utf8Str strLocation(aLocation); 1508 HRESULT rc = findDVDImage(NULL, &strLocation, true /* setError */, &image); 1509 1509 1510 1510 /* the below will set *aDVDImage to NULL if dvd is null */ … … 1515 1515 1516 1516 /** @note Doesn't lock anything. */ 1517 STDMETHODIMP VirtualBox::OpenFloppyImage 1518 1517 STDMETHODIMP VirtualBox::OpenFloppyImage(IN_BSTR aLocation, IN_BSTR aId, 1518 IMedium **aFloppyImage) 1519 1519 { 1520 1520 CheckComArgStrNotEmptyOrNull(aLocation); … … 1555 1555 1556 1556 /** @note Locks objects! */ 1557 STDMETHODIMP VirtualBox::GetFloppyImage 1558 1557 STDMETHODIMP VirtualBox::GetFloppyImage(IN_BSTR aId, 1558 IMedium **aFloppyImage) 1559 1559 1560 1560 { … … 1575 1575 1576 1576 /** @note Locks objects! */ 1577 STDMETHODIMP VirtualBox::FindFloppyImage 1578 1579 { 1580 CheckComArg NotNull(aLocation);1577 STDMETHODIMP VirtualBox::FindFloppyImage(IN_BSTR aLocation, 1578 IMedium **aFloppyImage) 1579 { 1580 CheckComArgStrNotEmptyOrNull(aLocation); 1581 1581 CheckComArgOutSafeArrayPointerValid(aFloppyImage); 1582 1582 … … 1585 1585 1586 1586 ComObjPtr<Medium> image; 1587 HRESULT rc = findFloppyImage(NULL, aLocation, true /* setError */, &image); 1587 Utf8Str strLocation(aLocation); 1588 HRESULT rc = findFloppyImage(NULL, &strLocation, true /* setError */, &image); 1588 1589 1589 1590 /* the below will set *aFloppyImage to NULL if img is null */ … … 1594 1595 1595 1596 /** @note Locks this object for reading. */ 1596 STDMETHODIMP VirtualBox::GetGuestOSType 1597 STDMETHODIMP VirtualBox::GetGuestOSType(IN_BSTR aId, IGuestOSType **aType) 1597 1598 { 1598 1599 /* Old ID to new ID conversion table. See r39691 for a source */ … … 1615 1616 }; 1616 1617 1617 CheckComArgNotNull 1618 CheckComArgNotNull(aType); 1618 1619 1619 1620 AutoCaller autoCaller(this); … … 1639 1640 { 1640 1641 const Bstr &typeId = (*it)->id(); 1641 AssertMsg (!!typeId, ("ID must not be NULL")); 1642 if (typeId.compareIgnoreCase (id) == 0) 1642 if (typeId.compare(id, Bstr::CaseInsensitive) == 0) 1643 1643 { 1644 1644 (*it).queryInterfaceTo(aType); … … 1709 1709 BSTR *aValue) 1710 1710 { 1711 CheckComArg NotNull(aKey);1711 CheckComArgStrNotEmptyOrNull(aKey); 1712 1712 CheckComArgNotNull(aValue); 1713 1713 … … 1716 1716 1717 1717 /* start with nothing found */ 1718 Bstr bstrResult ("");1718 Bstr bstrResult; 1719 1719 1720 1720 settings::ExtraDataItemsMap::const_iterator it = m->pMainConfigFile->mapExtraDataItems.find(Utf8Str(aKey)); … … 1735 1735 IN_BSTR aValue) 1736 1736 { 1737 CheckComArg NotNull(aKey);1737 CheckComArgStrNotEmptyOrNull(aKey); 1738 1738 1739 1739 AutoCaller autoCaller(this); … … 1766 1766 // lock to copy the list of callbacks to invoke 1767 1767 Bstr error; 1768 Bstr bstrValue; 1769 if (aValue) 1770 bstrValue = aValue; 1771 else 1772 bstrValue = (const char *)""; 1768 Bstr bstrValue(aValue); 1773 1769 1774 1770 if (!onExtraDataCanChange(Guid::Empty, aKey, bstrValue, error)) 1775 1771 { 1776 1772 const char *sep = error.isEmpty() ? "" : ": "; 1777 CBSTR err = error. isNull() ? (CBSTR) L"" : error.raw();1773 CBSTR err = error.raw(); 1778 1774 LogWarningFunc(("Someone vetoed! Change refused%s%ls\n", 1779 1775 sep, err)); … … 1866 1862 LogRel(("remotesession=%s\n", Utf8Str(aMachineId).c_str())); 1867 1863 1868 CheckComArg NotNull(aMachineId);1864 CheckComArgStrNotEmptyOrNull(aMachineId); 1869 1865 CheckComArgNotNull(aSession); 1870 CheckComArgNotNull(aType);1871 1866 CheckComArgOutSafeArrayPointerValid(aProgress); 1872 1867 … … 1897 1892 ComObjPtr<Progress> progress; 1898 1893 progress.createObject(); 1899 progress->init (this, static_cast <IMachine *> (machine), 1900 Bstr (tr ("Spawning session")), 1901 FALSE /* aCancelable */); 1894 progress->init(this, 1895 static_cast<IMachine*>(machine), 1896 tr("Spawning session"), 1897 FALSE /* aCancelable */); 1902 1898 1903 1899 rc = machine->openRemoteSession (control, aType, aEnvironment, progress); … … 2434 2430 case DataChanged: 2435 2431 LogFlow (("OnMachineDataChange: id={%RTuuid}\n", id.ptr())); 2436 aCallback->OnMachineDataChange 2432 aCallback->OnMachineDataChange(id.toUtf16()); 2437 2433 break; 2438 2434 … … 2440 2436 LogFlow (("OnMachineStateChange: id={%RTuuid}, state=%d\n", 2441 2437 id.ptr(), state)); 2442 aCallback->OnMachineStateChange 2438 aCallback->OnMachineStateChange(id.toUtf16(), state); 2443 2439 break; 2444 2440 … … 2446 2442 LogFlow (("OnMachineRegistered: id={%RTuuid}, registered=%d\n", 2447 2443 id.ptr(), registered)); 2448 aCallback->OnMachineRegistered 2444 aCallback->OnMachineRegistered(id.toUtf16(), registered); 2449 2445 break; 2450 2446 } … … 2497 2493 while ((it != list.end()) && allowChange) 2498 2494 { 2499 HRESULT rc = (*it++)->OnExtraDataCanChange (id, aKey, aValue, 2500 aError.asOutParam(), &allowChange); 2495 HRESULT rc = (*it++)->OnExtraDataCanChange(id, 2496 aKey, 2497 aValue, 2498 aError.asOutParam(), 2499 &allowChange); 2501 2500 if (FAILED(rc)) 2502 2501 { … … 2527 2526 LogFlow (("OnExtraDataChange: machineId={%RTuuid}, key='%ls', val='%ls'\n", 2528 2527 machineId.ptr(), key.raw(), val.raw())); 2529 aCallback->OnExtraDataChange 2528 aCallback->OnExtraDataChange(machineId.toUtf16(), key, val); 2530 2529 } 2531 2530 … … 2554 2553 { 2555 2554 SessionEvent (VirtualBox *aVB, const Guid &aMachineId, SessionState_T aState) 2556 : CallbackEvent (aVB), machineId 2555 : CallbackEvent (aVB), machineId(aMachineId), sessionState (aState) 2557 2556 {} 2558 2557 … … 2561 2560 LogFlow (("OnSessionStateChange: machineId={%RTuuid}, sessionState=%d\n", 2562 2561 machineId.ptr(), sessionState)); 2563 aCallback->OnSessionStateChange 2562 aCallback->OnSessionStateChange(machineId.toUtf16(), sessionState); 2564 2563 } 2565 2564 … … 2598 2597 LogFlow (("OnSnapshotTaken: machineId={%RTuuid}, snapshotId={%RTuuid}\n", 2599 2598 machineId.ptr(), snapshotId.ptr())); 2600 aCallback->OnSnapshotTaken 2599 aCallback->OnSnapshotTaken(mid, sid); 2601 2600 break; 2602 2601 … … 2604 2603 LogFlow (("OnSnapshotDiscarded: machineId={%RTuuid}, snapshotId={%RTuuid}\n", 2605 2604 machineId.ptr(), snapshotId.ptr())); 2606 aCallback->OnSnapshotDiscarded 2605 aCallback->OnSnapshotDiscarded(mid, sid); 2607 2606 break; 2608 2607 … … 2610 2609 LogFlow (("OnSnapshotChange: machineId={%RTuuid}, snapshotId={%RTuuid}\n", 2611 2610 machineId.ptr(), snapshotId.ptr())); 2612 aCallback->OnSnapshotChange 2611 aCallback->OnSnapshotChange(mid, sid); 2613 2612 break; 2614 2613 } … … 2661 2660 LogFlow(("OnGuestPropertyChange: machineId={%RTuuid}, name='%ls', value='%ls', flags='%ls'\n", 2662 2661 machineId.ptr(), name.raw(), value.raw(), flags.raw())); 2663 aCallback->OnGuestPropertyChange 2662 aCallback->OnGuestPropertyChange(machineId.toUtf16(), name, value, flags); 2664 2663 } 2665 2664 … … 2797 2796 * 2798 2797 * @param aId ID of the hard disk (unused when NULL). 2799 * @param aLocationFull location specification (unused NULL).2798 * @param pstrLocation Full location specification (unused NULL). 2800 2799 * @param aSetError If @c true , the appropriate error info is set in case 2801 2800 * when the hard disk is not found. … … 2807 2806 */ 2808 2807 HRESULT VirtualBox::findHardDisk(const Guid *aId, 2809 CBSTR aLocation,2808 const Utf8Str *pstrLocation, 2810 2809 bool aSetError, 2811 2810 ComObjPtr<Medium> *aHardDisk /*= NULL*/) 2812 2811 { 2813 AssertReturn(aId || aLocation, E_INVALIDARG);2812 AssertReturn(aId || pstrLocation, E_INVALIDARG); 2814 2813 2815 2814 // we use the hard disks map, but it is protected by the … … 2831 2830 /* then iterate and search by location */ 2832 2831 int result = -1; 2833 if (aLocation) 2834 { 2835 Utf8Str location = aLocation; 2836 2832 if (pstrLocation) 2833 { 2837 2834 for (HardDiskMap::const_iterator it = m->mapHardDisks.begin(); 2838 2835 it != m->mapHardDisks.end(); … … 2841 2838 const ComObjPtr<Medium> &hd = (*it).second; 2842 2839 2843 HRESULT rc = hd->compareLocationTo( location.c_str(), result);2840 HRESULT rc = hd->compareLocationTo(pstrLocation->c_str(), result); 2844 2841 if (FAILED(rc)) return rc; 2845 2842 … … 2864 2861 else 2865 2862 setError(rc, 2866 tr("Could not find a hard disk with location '% ls' in the media registry ('%s')"),2867 aLocation,2863 tr("Could not find a hard disk with location '%s' in the media registry ('%s')"), 2864 pstrLocation->c_str(), 2868 2865 m->strSettingsFilePath.raw()); 2869 2866 } … … 2888 2885 */ 2889 2886 HRESULT VirtualBox::findDVDImage(const Guid *aId, 2890 CBSTR aLocation,2887 const Utf8Str *pstrLocation, 2891 2888 bool aSetError, 2892 2889 ComObjPtr<Medium> *aImage /* = NULL */) 2893 2890 { 2894 AssertReturn(aId || aLocation, E_INVALIDARG);2891 AssertReturn(aId || pstrLocation, E_INVALIDARG); 2895 2892 2896 2893 Utf8Str location; 2897 2894 2898 if ( aLocation != NULL)2899 { 2900 int vrc = calculateFullPath( Utf8Str(aLocation), location);2895 if (pstrLocation != NULL) 2896 { 2897 int vrc = calculateFullPath(*pstrLocation, location); 2901 2898 if (RT_FAILURE(vrc)) 2902 2899 return setError(VBOX_E_FILE_ERROR, 2903 tr("Invalid image file location '% ls' (%Rrc)"),2904 aLocation,2900 tr("Invalid image file location '%s' (%Rrc)"), 2901 pstrLocation->c_str(), 2905 2902 vrc); 2906 2903 } … … 2917 2914 AutoReadLock imageLock(*it COMMA_LOCKVAL_SRC_POS); 2918 2915 2919 found = (aId && (*it)->getId() == *aId) ||2920 (aLocation != NULL &&2921 RTPathCompare(location.c_str(),2922 (*it)->getLocationFull().c_str()2923 ) == 0);2916 found = (aId && (*it)->getId() == *aId) 2917 || ( pstrLocation != NULL 2918 && RTPathCompare(location.c_str(), 2919 (*it)->getLocationFull().c_str() 2920 ) == 0); 2924 2921 if (found) 2925 2922 { … … 2941 2938 else 2942 2939 setError(rc, 2943 tr("Could not find a CD/DVD image with location '% ls' in the media registry ('%s')"),2944 aLocation,2940 tr("Could not find a CD/DVD image with location '%s' in the media registry ('%s')"), 2941 pstrLocation->c_str(), 2945 2942 m->strSettingsFilePath.raw()); 2946 2943 } … … 2966 2963 */ 2967 2964 HRESULT VirtualBox::findFloppyImage(const Guid *aId, 2968 CBSTR aLocation,2965 const Utf8Str *pstrLocation, 2969 2966 bool aSetError, 2970 2967 ComObjPtr<Medium> *aImage /* = NULL */) 2971 2968 { 2972 AssertReturn(aId || aLocation, E_INVALIDARG);2969 AssertReturn(aId || pstrLocation, E_INVALIDARG); 2973 2970 2974 2971 Utf8Str location; 2975 2972 2976 if ( aLocation != NULL)2977 { 2978 int vrc = calculateFullPath( Utf8Str(aLocation), location);2973 if (pstrLocation != NULL) 2974 { 2975 int vrc = calculateFullPath(*pstrLocation, location); 2979 2976 if (RT_FAILURE(vrc)) 2980 2977 return setError(VBOX_E_FILE_ERROR, 2981 tr("Invalid image file location '%ls' (%Rrc)"), 2982 aLocation, vrc); 2978 tr("Invalid image file location '%s' (%Rrc)"), 2979 pstrLocation->c_str(), 2980 vrc); 2983 2981 } 2984 2982 … … 2994 2992 AutoReadLock imageLock(*it COMMA_LOCKVAL_SRC_POS); 2995 2993 2996 found = (aId && (*it)->getId() == *aId) ||2997 (aLocation != NULL &&2998 RTPathCompare(location.c_str(),2999 (*it)->getLocationFull().c_str()3000 ) == 0);2994 found = (aId && (*it)->getId() == *aId) 2995 || ( pstrLocation != NULL 2996 && RTPathCompare(location.c_str(), 2997 (*it)->getLocationFull().c_str() 2998 ) == 0); 3001 2999 if (found) 3002 3000 { … … 3018 3016 else 3019 3017 setError(rc, 3020 tr("Could not find a floppy image with location '% ls' in the media registry ('%s')"),3021 aLocation,3018 tr("Could not find a floppy image with location '%s' in the media registry ('%s')"), 3019 pstrLocation->c_str(), 3022 3020 m->strSettingsFilePath.raw()); 3023 3021 } … … 3197 3195 HRESULT rc = S_OK; 3198 3196 3199 Bstr bstrLocation(aLocation);3200 3201 3197 { 3202 3198 ComObjPtr<Medium> hardDisk; 3203 rc = findHardDisk(&aId, bstrLocation, false /* aSetError */, &hardDisk);3199 rc = findHardDisk(&aId, &aLocation, false /* aSetError */, &hardDisk); 3204 3200 if (SUCCEEDED(rc)) 3205 3201 { … … 3215 3211 { 3216 3212 ComObjPtr<Medium> image; 3217 rc = findDVDImage(&aId, bstrLocation, false /* aSetError */, &image);3213 rc = findDVDImage(&aId, &aLocation, false /* aSetError */, &image); 3218 3214 if (SUCCEEDED(rc)) 3219 3215 { … … 3229 3225 { 3230 3226 ComObjPtr<Medium> image; 3231 rc = findFloppyImage(&aId, bstrLocation, false /* aSetError */, &image);3227 rc = findFloppyImage(&aId, &aLocation, false /* aSetError */, &image); 3232 3228 if (SUCCEEDED(rc)) 3233 3229 { … … 4359 4355 STDMETHODIMP VirtualBox::CreateDHCPServer (IN_BSTR aName, IDHCPServer ** aServer) 4360 4356 { 4361 CheckComArg NotNull(aName);4357 CheckComArgStrNotEmptyOrNull(aName); 4362 4358 CheckComArgNotNull(aServer); 4363 4359 … … 4380 4376 STDMETHODIMP VirtualBox::FindDHCPServerByNetworkName(IN_BSTR aName, IDHCPServer ** aServer) 4381 4377 { 4382 CheckComArg NotNull(aName);4378 CheckComArgStrNotEmptyOrNull(aName); 4383 4379 CheckComArgNotNull(aServer); 4384 4380 … … 4456 4452 4457 4453 ComPtr<IDHCPServer> existing; 4458 rc = FindDHCPServerByNetworkName(name .mutableRaw(), existing.asOutParam());4454 rc = FindDHCPServerByNetworkName(name, existing.asOutParam()); 4459 4455 if (SUCCEEDED(rc)) 4460 4456 { -
trunk/src/VBox/Main/generic/NetIf-generic.cpp
r26553 r26587 231 231 Bstr ifname; 232 232 ComPtr<IHostNetworkInterface> iface; 233 if (FAILED(host->FindHostNetworkInterfaceById 233 if (FAILED(host->FindHostNetworkInterfaceById(Guid(aId).toUtf16(), iface.asOutParam()))) 234 234 return VERR_INVALID_PARAMETER; 235 iface->COMGETTER(Name) 236 if (ifname.is Null())235 iface->COMGETTER(Name)(ifname.asOutParam()); 236 if (ifname.isEmpty()) 237 237 return VERR_INTERNAL_ERROR; 238 238 239 rc = progress->init (pVBox, host, 240 Bstr ("Removing host network interface"), 239 rc = progress->init(pVBox, 240 host, 241 Bstr("Removing host network interface"), 241 242 FALSE /* aCancelable */); 242 243 if(SUCCEEDED(rc)) -
trunk/src/VBox/Main/glue/ErrorInfo.cpp
r26553 r26587 170 170 { 171 171 mCalleeIID = aIID; 172 GetInterfaceNameByIID 172 GetInterfaceNameByIID(aIID, mCalleeName.asOutParam()); 173 173 } 174 174 } -
trunk/src/VBox/Main/include/ApplianceImpl.h
r26553 r26587 96 96 97 97 void disksWeight(uint32_t &ulTotalMB, uint32_t &cDisks) const; 98 HRESULT setUpProgressFS(ComObjPtr<Progress> &pProgress, const Bstr &bstrDescription);99 HRESULT setUpProgressImportS3(ComObjPtr<Progress> &pProgress, const Bstr &bstrDescription);100 HRESULT setUpProgressWriteS3(ComObjPtr<Progress> &pProgress, const Bstr &bstrDescription);98 HRESULT setUpProgressFS(ComObjPtr<Progress> &pProgress, const Utf8Str &strDescription); 99 HRESULT setUpProgressImportS3(ComObjPtr<Progress> &pProgress, const Utf8Str &strDescription); 100 HRESULT setUpProgressWriteS3(ComObjPtr<Progress> &pProgress, const Utf8Str &strDescription); 101 101 102 102 struct LocationInfo; -
trunk/src/VBox/Main/include/ProgressImpl.h
r26553 r26587 52 52 HRESULT protectedInit(AutoInitSpan &aAutoInitSpan, 53 53 #if !defined (VBOX_COM_INPROC) 54 VirtualBox *aParent, 55 #endif 56 IUnknown *aInitiator, 57 CBSTR aDescription, OUT_GUID aId = NULL); 54 VirtualBox *aParent, 55 #endif 56 IUnknown *aInitiator, 57 const Utf8Str &strDescription, 58 OUT_GUID aId = NULL); 58 59 HRESULT protectedInit(AutoInitSpan &aAutoInitSpan); 59 60 void protectedUninit(AutoUninitSpan &aAutoUninitSpan); … … 105 106 106 107 const Guid mId; 107 const Bstr mDescription;108 const Utf8Str m_strDescription; 108 109 109 110 uint64_t m_ullTimestamp; // progress object creation timestamp, for ETA computation … … 126 127 127 128 ULONG m_ulCurrentOperation; // operations counter, incremented with each setNextOperation() 128 Bstr m_bstrOperationDescription;// name of current operation; initially from constructor, changed with setNextOperation()129 Utf8Str m_strOperationDescription; // name of current operation; initially from constructor, changed with setNextOperation() 129 130 ULONG m_ulCurrentOperationWeight; // weight of current operation, given to setNextOperation() 130 131 ULONG m_ulOperationPercent; // percentage of current operation, set with setCurrentOperationProgress() … … 176 177 #endif 177 178 IUnknown *aInitiator, 178 CBSTR aDescription,179 const Utf8Str &strDescription, 179 180 BOOL aCancelable, 180 181 OUT_GUID aId = NULL) … … 185 186 #endif 186 187 aInitiator, 187 aDescription,188 strDescription, 188 189 aCancelable, 189 190 1, // cOperations 190 191 1, // ulTotalOperationsWeight 191 aDescription, // bstrFirstOperationDescription192 strDescription, // bstrFirstOperationDescription 192 193 1, // ulFirstOperationWeight 193 194 aId); … … 211 212 #endif 212 213 IUnknown *aInitiator, 213 CBSTR aDescription, BOOL aCancelable, 214 const Utf8Str &strDescription, 215 BOOL aCancelable, 214 216 ULONG cOperations, 215 CBSTR bstrFirstOperationDescription,217 const Utf8Str &strFirstOperationDescription, 216 218 OUT_GUID aId = NULL) 217 219 { … … 221 223 #endif 222 224 aInitiator, 223 aDescription,225 strDescription, 224 226 aCancelable, 225 227 cOperations, // cOperations 226 228 cOperations, // ulTotalOperationsWeight = cOperations 227 bstrFirstOperationDescription, // bstrFirstOperationDescription229 strFirstOperationDescription, // bstrFirstOperationDescription 228 230 1, // ulFirstOperationWeight: weigh them all the same 229 231 aId); … … 235 237 #endif 236 238 IUnknown *aInitiator, 237 CBSTR aDescription,239 const Utf8Str &strDescription, 238 240 BOOL aCancelable, 239 241 ULONG cOperations, 240 242 ULONG ulTotalOperationsWeight, 241 CBSTR bstrFirstOperationDescription,243 const Utf8Str &strFirstOperationDescription, 242 244 ULONG ulFirstOperationWeight, 243 245 OUT_GUID aId = NULL); … … 245 247 HRESULT init(BOOL aCancelable, 246 248 ULONG aOperationCount, 247 CBSTR aOperationDescription);249 const Utf8Str &strOperationDescription); 248 250 249 251 void uninit(); -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r26553 r26587 246 246 ComObjPtr<Machine> *machine = NULL); 247 247 248 HRESULT findHardDisk(const Guid *aId, CBSTR aLocation,248 HRESULT findHardDisk(const Guid *aId, const Utf8Str *pstrLocation, 249 249 bool aSetError, ComObjPtr<Medium> *aHardDisk = NULL); 250 HRESULT findDVDImage(const Guid *aId, CBSTR aLocation,250 HRESULT findDVDImage(const Guid *aId, const Utf8Str *pstrLocation, 251 251 bool aSetError, ComObjPtr<Medium> *aImage = NULL); 252 HRESULT findFloppyImage(const Guid *aId, CBSTR aLocation,252 HRESULT findFloppyImage(const Guid *aId, const Utf8Str *pstrLocation, 253 253 bool aSetError, ComObjPtr<Medium> *aImage = NULL); 254 254 -
trunk/src/VBox/Main/win/NetIf-win.cpp
r26186 r26587 908 908 if(hr == S_OK) 909 909 { 910 size_t cUnicodeName = wcslen(lpszName) + 1; 911 size_t uniLen = (cUnicodeName * 2 + sizeof (OLECHAR) - 1) / sizeof (OLECHAR); 912 Bstr name (uniLen + 1 /* extra zero */); 913 wcscpy((wchar_t *) name.mutableRaw(), lpszName); 910 Bstr name(lpszName); 914 911 915 912 hr = pncc->GetInstanceGuid(&IfGuid); -
trunk/src/VBox/Main/win/svcmain.cpp
r26186 r26587 231 231 232 232 if (*lpszToken != NULL) 233 {234 Bstr str (lpszToken);235 LPCTSTR lpszToken2 = FindOneOf(lpszToken, szTokens);236 if (lpszToken2)237 str.mutableRaw()[lpszToken2 - lpszToken] = '\0';238 233 pipeName = Utf8Str(lpszToken); 239 }240 234 } 241 235 -
trunk/src/VBox/Main/xml/Settings.cpp
r26553 r26587 195 195 strLine = Utf8StrFmt(" (line %RU32)", pNode->getLineNumber()); 196 196 197 const char *pcsz = strLine.c_str();198 197 Utf8StrFmt str(N_("Error in %s%s -- %s"), 199 198 file->m->strFilename.c_str(), 200 (pcsz) ? pcsz : "",199 strLine.c_str(), 201 200 strWhat.c_str()); 202 201
Note:
See TracChangeset
for help on using the changeset viewer.