(file) Return to String.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/String.cpp between version 1.124 and 1.125

version 1.124, 2007/01/02 19:41:23 version 1.125, 2007/01/11 16:21:54
Line 579 
Line 579 
     if (rep->size == size_t(-1))     if (rep->size == size_t(-1))
     {     {
         StringRep::free(rep);         StringRep::free(rep);
         _StringThrowBadUTF8(utf8_error_index);          _StringThrowBadUTF8((Uint32)utf8_error_index);
     }     }
  
     rep->data[rep->size] = '\0';     rep->data[rep->size] = '\0';
Line 596 
Line 596 
     while (*end++)     while (*end++)
         ;         ;
  
     return end - str - 1;      return (Uint32)(end - str - 1);
 } }
  
 //============================================================================== //==============================================================================
Line 669 
Line 669 
     {     {
         StringRep::free(_rep);         StringRep::free(_rep);
         _rep = &StringRep::_emptyRep;         _rep = &StringRep::_emptyRep;
         _StringThrowBadUTF8(utf8_error_index);          _StringThrowBadUTF8((Uint32)utf8_error_index);
     }     }
  
     _rep->size = n1 + tmp;     _rep->size = n1 + tmp;
Line 689 
Line 689 
     {     {
         StringRep::free(_rep);         StringRep::free(_rep);
         _rep = &StringRep::_emptyRep;         _rep = &StringRep::_emptyRep;
         _StringThrowBadUTF8(utf8_error_index);          _StringThrowBadUTF8((Uint32)utf8_error_index);
     }     }
  
     _rep->size = n2 + tmp;     _rep->size = n2 + tmp;
Line 742 
Line 742 
     {     {
         StringRep::free(_rep);         StringRep::free(_rep);
         _rep = &StringRep::_emptyRep;         _rep = &StringRep::_emptyRep;
         _StringThrowBadUTF8(utf8_error_index);          _StringThrowBadUTF8((Uint32)utf8_error_index);
     }     }
  
     _rep->data[_rep->size] = 0;     _rep->data[_rep->size] = 0;
Line 788 
Line 788 
     str[_rep->size] = '\0';     str[_rep->size] = '\0';
     return CString(str);     return CString(str);
 #else #else
     Uint32 n = 3 * _rep->size;      Uint32 n = (Uint32)(3 * _rep->size);
     char* str = (char*)operator new(n + 1);     char* str = (char*)operator new(n + 1);
     size_t size = _copyToUTF8(str, _rep->data, _rep->size);     size_t size = _copyToUTF8(str, _rep->data, _rep->size);
     str[size] = '\0';     str[size] = '\0';
Line 802 
Line 802 
  
     size_t oldSize = _rep->size;     size_t oldSize = _rep->size;
     size_t newSize = oldSize + n;     size_t newSize = oldSize + n;
     _reserve(_rep, newSize);      _reserve(_rep, (Uint32)newSize);
     _copy(_rep->data + oldSize, (Uint16*)str, n);     _copy(_rep->data + oldSize, (Uint16*)str, n);
     _rep->size = newSize;     _rep->size = newSize;
     _rep->data[newSize] = '\0';     _rep->data[newSize] = '\0';
Line 812 
Line 812 
  
 String& String::append(const String& str) String& String::append(const String& str)
 { {
     return append((Char16*)(&(str._rep->data[0])), str._rep->size);      return append((Char16*)(&(str._rep->data[0])), (Uint32)str._rep->size);
 } }
  
 String& String::append(const char* str, Uint32 size) String& String::append(const char* str, Uint32 size)
Line 822 
Line 822 
     size_t oldSize = _rep->size;     size_t oldSize = _rep->size;
     size_t cap = oldSize + size;     size_t cap = oldSize + size;
  
     _reserve(_rep, cap);      _reserve(_rep, (Uint32)cap);
     size_t utf8_error_index;     size_t utf8_error_index;
     size_t tmp = _convert(     size_t tmp = _convert(
         (Uint16*)_rep->data + oldSize, str, size, utf8_error_index);         (Uint16*)_rep->data + oldSize, str, size, utf8_error_index);
Line 831 
Line 831 
     {     {
         StringRep::free(_rep);         StringRep::free(_rep);
         _rep = &StringRep::_emptyRep;         _rep = &StringRep::_emptyRep;
         _StringThrowBadUTF8(utf8_error_index);          _StringThrowBadUTF8((Uint32)utf8_error_index);
     }     }
  
     _rep->size += tmp;     _rep->size += tmp;
Line 843 
Line 843 
 void String::remove(Uint32 index, Uint32 n) void String::remove(Uint32 index, Uint32 n)
 { {
     if (n == PEG_NOT_FOUND)     if (n == PEG_NOT_FOUND)
         n = _rep->size - index;          n = (Uint32)(_rep->size - index);
  
     _checkBounds(index + n, _rep->size);     _checkBounds(index + n, _rep->size);
  
Line 870 
Line 870 
     if (index < _rep->size)     if (index < _rep->size)
     {     {
         if (n == PEG_NOT_FOUND || n > _rep->size - index)         if (n == PEG_NOT_FOUND || n > _rep->size - index)
             n = _rep->size - index;              n = (Uint32)(_rep->size - index);
  
         return String((Char16*)(_rep->data + index), n);         return String((Char16*)(_rep->data + index), n);
     }     }


Legend:
Removed from v.1.124  
changed lines
  Added in v.1.125

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2