Changeset 17865 in webkit
- Timestamp:
- Nov 20, 2006 3:27:46 PM (17 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r17864 r17865 1 2006-11-20 Anders Carlsson <acarlsson@apple.com> 2 3 Reviewed by Maciej. 4 5 * loader/TextResourceDecoder.cpp: 6 (WebCore::findXMLEncoding): 7 Use CString instead of DeprecatedCString. 8 9 * platform/CString.cpp: 10 (WebCore::CString::find): 11 * platform/CString.h: 12 (WebCore::CString::data): 13 Add find method, make data method inline. 14 15 * platform/TextStream.cpp: 16 * platform/TextStream.h: 17 Remove DeprecatedCString functions. 18 1 19 2006-11-20 Anders Carlsson <acarlsson@apple.com> 2 20 -
trunk/WebCore/loader/TextResourceDecoder.cpp
r17652 r17865 297 297 298 298 // Returns the position of the encoding string. 299 static int findXMLEncoding(const DeprecatedCString &str, int &encodingLength)299 static int findXMLEncoding(const CString& str, int &encodingLength) 300 300 { 301 301 int len = str.length(); -
trunk/WebCore/platform/CString.cpp
r16385 r17865 56 56 } 57 57 58 const char* CString::data() const59 {60 return m_buffer ? m_buffer->data() : 0;61 }62 63 58 char* CString::mutableData() 64 59 { … … 100 95 } 101 96 97 int CString::find(const char* substring, int index) const 98 { 99 const char* str = data(); 100 101 if(str && str[0] && substring && index >=0) { // don't search empty strings 102 // advance until we get to index 103 int pos = 0; 104 while(pos < index) 105 if(str[pos++] == 0) 106 return -1; // index is beyond end of str 107 108 // now search from index onward 109 while(str[index] != 0) { 110 char a, b; 111 112 // compare until we reach the end or a mismatch 113 pos = 0; 114 115 while((a = substring[pos]) && (b = str[index]) && a == b) 116 pos++, index++; 117 118 // reached the end of our compare string without a mismatch? 119 if(substring[pos] == 0) 120 return index - pos; 121 122 index ++; 123 } 124 } 125 126 return -1; 102 127 } 128 129 } -
trunk/WebCore/platform/CString.h
r16385 r17865 52 52 static CString newUninitialized(size_t length, char*& characterBuffer); 53 53 54 const char* data() const ;54 const char* data() const { return m_buffer ? m_buffer->data() : 0; } 55 55 char* mutableData(); 56 56 unsigned length() const; 57 57 58 58 operator const char*() const { return data(); } 59 59 60 60 bool isNull() const { return !m_buffer; } 61 61 62 62 CString(const DeprecatedCString&); 63 63 DeprecatedCString deprecatedCString() const; 64 65 int find(const char*, int index=0) const; 64 66 65 67 private: -
trunk/WebCore/platform/TextStream.cpp
r15286 r17865 123 123 } 124 124 125 TextStream& TextStream::operator<<(const DeprecatedCString& qcs)126 {127 const char *s = qcs;128 return *this << s;129 }130 131 125 TextStream& TextStream::operator<<(const DeprecatedString& s) 132 126 { -
trunk/WebCore/platform/TextStream.h
r15286 r17865 32 32 33 33 class DeprecatedChar; 34 class DeprecatedCString;35 34 class DeprecatedString; 36 35 class String; … … 58 57 TextStream& operator<<(const String&); 59 58 TextStream& operator<<(const DeprecatedString&); 60 TextStream& operator<<(const DeprecatedCString&);61 59 TextStream& operator<<(void*); 62 60
Note: See TracChangeset
for help on using the changeset viewer.