(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.111.6.15 and 1.116.4.1

version 1.111.6.15, 2005/10/14 14:09:29 version 1.116.4.1, 2006/01/18 17:37:56
Line 32 
Line 32 
 // Modified By: // Modified By:
 //     Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) //     Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
 //     Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) for Bug#3297 //     Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) for Bug#3297
 //     David Dillard, VERITAS Software Corp. (david.dillard@veritas.com)  //     David Dillard, Symantec Corp. (david_dillard@symantec.com)
 //     Mike Brasher (mike-brasher@austin.rr.com) //     Mike Brasher (mike-brasher@austin.rr.com)
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 #include <cassert>  #include <Pegasus/Common/PegasusAssert.h>
   #include <cstring>
 #include "InternalException.h" #include "InternalException.h"
 #include "CommonUTF.h" #include "CommonUTF.h"
 #include "MessageLoader.h" #include "MessageLoader.h"
Line 319 
Line 320 
  
 inline void _checkNullPointer(const void* ptr) inline void _checkNullPointer(const void* ptr)
 { {
 #ifdef PEGASUS_STRING_NO_THROW  #ifndef PEGASUS_STRING_NO_THROW
  
     if (!ptr)     if (!ptr)
         throw NullPointer();         throw NullPointer();
Line 568 
Line 569 
  
 static inline void _reserve(StringRep*& rep, Uint32 cap) static inline void _reserve(StringRep*& rep, Uint32 cap)
 { {
     if (cap > rep->cap || rep->refs.value() != 1)      if (cap > rep->cap || rep->refs.get() != 1)
     {     {
         size_t n = _roundUpToPow2(cap);         size_t n = _roundUpToPow2(cap);
         StringRep* newRep = StringRep::alloc(n);         StringRep* newRep = StringRep::alloc(n);
Line 748 
Line 749 
 { {
     _checkNullPointer(str);     _checkNullPointer(str);
  
     if (n > _rep->cap || _rep->refs.value() != 1)      if (n > _rep->cap || _rep->refs.get() != 1)
     {     {
         StringRep::unref(_rep);         StringRep::unref(_rep);
         _rep = StringRep::alloc(n);         _rep = StringRep::alloc(n);
Line 765 
Line 766 
 { {
     _checkNullPointer(str);     _checkNullPointer(str);
  
     if (n > _rep->cap || _rep->refs.value() != 1)      if (n > _rep->cap || _rep->refs.get() != 1)
     {     {
         StringRep::unref(_rep);         StringRep::unref(_rep);
         _rep = StringRep::alloc(n);         _rep = StringRep::alloc(n);
Line 792 
Line 793 
 { {
     if (_rep->size)     if (_rep->size)
     {     {
         if (_rep->refs.value() == 1)          if (_rep->refs.get() == 1)
         {         {
             _rep->size = 0;             _rep->size = 0;
             _rep->data[0] = '\0';             _rep->data[0] = '\0';
Line 887 
Line 888 
  
     _checkBounds(index + n, _rep->size);     _checkBounds(index + n, _rep->size);
  
     if (_rep->refs.value() != 1)      if (_rep->refs.get() != 1)
         _rep = StringRep::copyOnWrite(_rep);         _rep = StringRep::copyOnWrite(_rep);
  
     assert(index + n <= _rep->size);      PEGASUS_ASSERT(index + n <= _rep->size);
  
     size_t rem = _rep->size - (index + n);     size_t rem = _rep->size - (index + n);
     Uint16* data = _rep->data;     Uint16* data = _rep->data;
Line 923 
Line 924 
     Uint16* p = (Uint16*)_find(_rep->data, _rep->size, c);     Uint16* p = (Uint16*)_find(_rep->data, _rep->size, c);
  
     if (p)     if (p)
         return p - _rep->data;          return static_cast<Uint32>(p - _rep->data);
  
     return PEG_NOT_FOUND;     return PEG_NOT_FOUND;
 } }
Line 938 
Line 939 
     Uint16* p = (Uint16*)_find(_rep->data + index, _rep->size - index, c);     Uint16* p = (Uint16*)_find(_rep->data + index, _rep->size - index, c);
  
     if (p)     if (p)
         return p - _rep->data;          return static_cast<Uint32>(p - _rep->data);
  
     return PEG_NOT_FOUND;     return PEG_NOT_FOUND;
 } }
Line 959 
Line 960 
             break;             break;
  
         if (memcmp(p, s, n * sizeof(Uint16)) == 0)         if (memcmp(p, s, n * sizeof(Uint16)) == 0)
             return p - _rep->data;              return static_cast<Uint32>(p - _rep->data);
  
         p++;         p++;
         rem -= p - data;         rem -= p - data;
Line 987 
Line 988 
     while (q != p)     while (q != p)
     {     {
         if (*--q == x)         if (*--q == x)
             return q - p;              return static_cast<Uint32>(q - p);
     }     }
  
     return PEG_NOT_FOUND;     return PEG_NOT_FOUND;
Line 999 
Line 1000 
  
     if (InitializeICU::initICUSuccessful())     if (InitializeICU::initICUSuccessful())
     {     {
         if (_rep->refs.value() != 1)          if (_rep->refs.get() != 1)
             _rep = StringRep::copyOnWrite(_rep);             _rep = StringRep::copyOnWrite(_rep);
  
         // This will do a locale-insensitive, but context-sensitive convert.         // This will do a locale-insensitive, but context-sensitive convert.
Line 1034 
Line 1035 
  
 #endif /* PEGASUS_HAS_ICU */ #endif /* PEGASUS_HAS_ICU */
  
     if (_rep->refs.value() != 1)      if (_rep->refs.get() != 1)
         _rep = StringRep::copyOnWrite(_rep);         _rep = StringRep::copyOnWrite(_rep);
  
     Uint16* p = _rep->data;     Uint16* p = _rep->data;
Line 1053 
Line 1054 
  
     if (InitializeICU::initICUSuccessful())     if (InitializeICU::initICUSuccessful())
     {     {
         if (_rep->refs.value() != 1)          if (_rep->refs.get() != 1)
             _rep = StringRep::copyOnWrite(_rep);             _rep = StringRep::copyOnWrite(_rep);
  
         // This will do a locale-insensitive, but context-sensitive convert.         // This will do a locale-insensitive, but context-sensitive convert.
Line 1089 
Line 1090 
  
 #endif /* PEGASUS_HAS_ICU */ #endif /* PEGASUS_HAS_ICU */
  
     if (_rep->refs.value() != 1)      if (_rep->refs.get() != 1)
         _rep = StringRep::copyOnWrite(_rep);         _rep = StringRep::copyOnWrite(_rep);
  
     Uint16* p = _rep->data;     Uint16* p = _rep->data;
Line 1101 
Line 1102 
  
 int String::compare(const String& s1, const String& s2, Uint32 n) int String::compare(const String& s1, const String& s2, Uint32 n)
 { {
     assert(n <= s1._rep->size);      PEGASUS_ASSERT(n <= s1._rep->size);
     assert(n <= s2._rep->size);      PEGASUS_ASSERT(n <= s2._rep->size);
  
     // Ignoring error in which n is greater than s1.size() or s2.size()     // Ignoring error in which n is greater than s1.size() or s2.size()
     return _compare(s1._rep->data, s2._rep->data, n);     return _compare(s1._rep->data, s2._rep->data, n);
Line 1515 
Line 1516 
  
     (+) [DONE] Look at PEP223 for coding security guidelines.     (+) [DONE] Look at PEP223 for coding security guidelines.
  
     (+) [DONE] Use old AtomicInt for now (split new AtomicInt into another      (+) [DONE] Use old AtomicInt for now (new AtomicInt part of bug #4250).
         bug.  
  
     (+) [DONE] Removed appendASCII() and the ASCII form of the constructor.     (+) [DONE] Removed appendASCII() and the ASCII form of the constructor.
  
     -----------      (+) DOC++ String.h - will open new bug?
  
     (+) DOC++ String.h      (+) Added PEGASUS_DISABLE_INTERNAL_INLINES macro (to permit suppression
           on certain platforms).
  
 ================================================================================ ================================================================================
 */ */


Legend:
Removed from v.1.111.6.15  
changed lines
  Added in v.1.116.4.1

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2