| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 adapter1.WriteTo(destination); | 97 adapter1.WriteTo(destination); |
| 98 adapter2.WriteTo(destination + adapter1.length()); | 98 adapter2.WriteTo(destination + adapter1.length()); |
| 99 } | 99 } |
| 100 | 100 |
| 101 template <typename StringType1, typename StringType2> | 101 template <typename StringType1, typename StringType2> |
| 102 unsigned StringAppend<StringType1, StringType2>::length() const { | 102 unsigned StringAppend<StringType1, StringType2>::length() const { |
| 103 StringTypeAdapter<StringType1> adapter1(string1_); | 103 StringTypeAdapter<StringType1> adapter1(string1_); |
| 104 StringTypeAdapter<StringType2> adapter2(string2_); | 104 StringTypeAdapter<StringType2> adapter2(string2_); |
| 105 unsigned total = adapter1.length() + adapter2.length(); | 105 unsigned total = adapter1.length() + adapter2.length(); |
| 106 // Guard against overflow. | 106 // Guard against overflow. |
| 107 RELEASE_ASSERT(total >= adapter1.length() && total >= adapter2.length()); | 107 CHECK_GE(total, adapter1.length()); |
| 108 CHECK_GE(total, adapter2.length()); |
| 108 return total; | 109 return total; |
| 109 } | 110 } |
| 110 | 111 |
| 111 template <typename StringType1, typename StringType2> | 112 template <typename StringType1, typename StringType2> |
| 112 class StringTypeAdapter<StringAppend<StringType1, StringType2>> { | 113 class StringTypeAdapter<StringAppend<StringType1, StringType2>> { |
| 113 STACK_ALLOCATED(); | 114 STACK_ALLOCATED(); |
| 114 | 115 |
| 115 public: | 116 public: |
| 116 StringTypeAdapter<StringAppend<StringType1, StringType2>>( | 117 StringTypeAdapter<StringAppend<StringType1, StringType2>>( |
| 117 const StringAppend<StringType1, StringType2>& buffer) | 118 const StringAppend<StringType1, StringType2>& buffer) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 194 |
| 194 template <typename U, typename V, typename W> | 195 template <typename U, typename V, typename W> |
| 195 StringAppend<StringAppend<U, V>, W> operator+(const StringAppend<U, V>& string1, | 196 StringAppend<StringAppend<U, V>, W> operator+(const StringAppend<U, V>& string1, |
| 196 W string2) { | 197 W string2) { |
| 197 return StringAppend<StringAppend<U, V>, W>(string1, string2); | 198 return StringAppend<StringAppend<U, V>, W>(string1, string2); |
| 198 } | 199 } |
| 199 | 200 |
| 200 } // namespace WTF | 201 } // namespace WTF |
| 201 | 202 |
| 202 #endif // StringOperators_h | 203 #endif // StringOperators_h |
| OLD | NEW |