Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: third_party/WebKit/Source/wtf/text/StringBuffer.h

Issue 2458003002: Remove ASSERT_WITH_SECURITY_IMPLICATION. (Closed)
Patch Set: Minor formatting fix Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 void shrink(unsigned newLength); 54 void shrink(unsigned newLength);
55 55
56 unsigned length() const { return m_data ? m_data->length() : 0; } 56 unsigned length() const { return m_data ? m_data->length() : 0; }
57 CharType* characters() { 57 CharType* characters() {
58 return length() ? const_cast<CharType*>(m_data->getCharacters<CharType>()) 58 return length() ? const_cast<CharType*>(m_data->getCharacters<CharType>())
59 : 0; 59 : 0;
60 } 60 }
61 61
62 CharType& operator[](unsigned i) { 62 CharType& operator[](unsigned i) {
63 ASSERT_WITH_SECURITY_IMPLICATION(i < length()); 63 SECURITY_DCHECK(i < length());
64 return characters()[i]; 64 return characters()[i];
65 } 65 }
66 66
67 PassRefPtr<StringImpl> release() { return m_data.release(); } 67 PassRefPtr<StringImpl> release() { return m_data.release(); }
68 68
69 private: 69 private:
70 RefPtr<StringImpl> m_data; 70 RefPtr<StringImpl> m_data;
71 }; 71 };
72 72
73 template <typename CharType> 73 template <typename CharType>
74 void StringBuffer<CharType>::shrink(unsigned newLength) { 74 void StringBuffer<CharType>::shrink(unsigned newLength) {
75 ASSERT(m_data); 75 ASSERT(m_data);
76 if (m_data->length() == newLength) 76 if (m_data->length() == newLength)
77 return; 77 return;
78 m_data = m_data->substring(0, newLength); 78 m_data = m_data->substring(0, newLength);
79 } 79 }
80 80
81 } // namespace WTF 81 } // namespace WTF
82 82
83 using WTF::StringBuffer; 83 using WTF::StringBuffer;
84 84
85 #endif // StringBuffer_h 85 #endif // StringBuffer_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/dtoa/utils.h ('k') | third_party/WebKit/Source/wtf/text/StringBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698