Changeset 25078 in webkit for trunk/JavaScriptCore/kjs/ustring.cpp
- Timestamp:
- Aug 14, 2007, 3:19:04 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/ustring.cpp
r24919 r25078 55 55 extern const double Inf; 56 56 57 static const size_t overflowIndicator = std::numeric_limits<size_t>::max();58 static const size_t maxUChars = std::numeric_limits<size_t>::max() / sizeof(UChar);57 static inline const size_t overflowIndicator() { return std::numeric_limits<size_t>::max(); } 58 static inline const size_t maxUChars() { return std::numeric_limits<size_t>::max() / sizeof(UChar); } 59 59 60 60 static inline UChar* allocChars(size_t length) 61 61 { 62 62 ASSERT(length); 63 if (length > maxUChars )63 if (length > maxUChars()) 64 64 return 0; 65 65 return static_cast<UChar*>(fastMalloc(sizeof(UChar) * length)); … … 69 69 { 70 70 ASSERT(length); 71 if (length > maxUChars )71 if (length > maxUChars()) 72 72 return 0; 73 73 return static_cast<UChar*>(fastRealloc(buffer, sizeof(UChar) * length)); … … 351 351 // we overflow the maximum value that we can handle. 352 352 353 if (size > maxUChars )354 return overflowIndicator ;353 if (size > maxUChars()) 354 return overflowIndicator(); 355 355 356 356 size_t expandedSize = ((size + 10) / 10 * 11) + 1; 357 if (maxUChars - expandedSize < otherSize)358 return overflowIndicator ;357 if (maxUChars() - expandedSize < otherSize) 358 return overflowIndicator(); 359 359 360 360 return expandedSize + otherSize;
Note:
See TracChangeset
for help on using the changeset viewer.