| OLD | NEW |
| 1 /** | 1 /** |
| 2 * Copyright (C) 2011 Nokia Inc. All rights reserved. | 2 * Copyright (C) 2011 Nokia Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 void QuotesData::addPair(std::pair<String, String> quotePair) | 42 void QuotesData::addPair(std::pair<String, String> quotePair) |
| 43 { | 43 { |
| 44 m_quotePairs.append(quotePair); | 44 m_quotePairs.append(quotePair); |
| 45 } | 45 } |
| 46 | 46 |
| 47 const String QuotesData::getOpenQuote(int index) const | 47 const String QuotesData::getOpenQuote(int index) const |
| 48 { | 48 { |
| 49 ASSERT(index >= 0); | 49 ASSERT(index >= 0); |
| 50 if (!m_quotePairs.size()) | 50 if (!m_quotePairs.size() || index < 0) |
| 51 return emptyString(); | 51 return emptyString(); |
| 52 if ((size_t)index >= m_quotePairs.size()) | 52 if ((size_t)index >= m_quotePairs.size()) |
| 53 return m_quotePairs.last().first; | 53 return m_quotePairs.last().first; |
| 54 return m_quotePairs.at(index).first; | 54 return m_quotePairs.at(index).first; |
| 55 } | 55 } |
| 56 | 56 |
| 57 const String QuotesData::getCloseQuote(int index) const | 57 const String QuotesData::getCloseQuote(int index) const |
| 58 { | 58 { |
| 59 ASSERT(index >= 0); | 59 ASSERT(index >= -1); |
| 60 if (!m_quotePairs.size()) | 60 if (!m_quotePairs.size() || index < 0) |
| 61 return emptyString(); | 61 return emptyString(); |
| 62 if ((size_t)index >= m_quotePairs.size()) | 62 if ((size_t)index >= m_quotePairs.size()) |
| 63 return m_quotePairs.last().second; | 63 return m_quotePairs.last().second; |
| 64 return m_quotePairs.at(index).second; | 64 return m_quotePairs.at(index).second; |
| 65 } | 65 } |
| 66 | 66 |
| 67 bool QuotesData::equals(const QuotesData* a, const QuotesData* b) | 67 bool QuotesData::equals(const QuotesData* a, const QuotesData* b) |
| 68 { | 68 { |
| 69 if (a == b) | 69 if (a == b) |
| 70 return true; | 70 return true; |
| 71 if (!a || !b) | 71 if (!a || !b) |
| 72 return false; | 72 return false; |
| 73 return a->m_quotePairs == b->m_quotePairs; | 73 return a->m_quotePairs == b->m_quotePairs; |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace WebCore | 76 } // namespace WebCore |
| OLD | NEW |