| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 bool includeSeparator) { | 72 bool includeSeparator) { |
| 73 if (m_reachedEndOfFile) | 73 if (m_reachedEndOfFile) |
| 74 return false; | 74 return false; |
| 75 | 75 |
| 76 chunk.clear(); | 76 chunk.clear(); |
| 77 while (true) { | 77 while (true) { |
| 78 while (m_segmentIndex < m_segmentLength) { | 78 while (m_segmentIndex < m_segmentLength) { |
| 79 char currentCharacter = m_segment[m_segmentIndex++]; | 79 char currentCharacter = m_segment[m_segmentIndex++]; |
| 80 if (currentCharacter != m_separator[m_separatorIndex]) { | 80 if (currentCharacter != m_separator[m_separatorIndex]) { |
| 81 if (m_separatorIndex > 0) { | 81 if (m_separatorIndex > 0) { |
| 82 ASSERT_WITH_SECURITY_IMPLICATION(m_separatorIndex <= | 82 SECURITY_DCHECK(m_separatorIndex <= m_separator.size()); |
| 83 m_separator.size()); | |
| 84 chunk.append(m_separator.data(), m_separatorIndex); | 83 chunk.append(m_separator.data(), m_separatorIndex); |
| 85 m_separatorIndex = 0; | 84 m_separatorIndex = 0; |
| 86 } | 85 } |
| 87 chunk.append(currentCharacter); | 86 chunk.append(currentCharacter); |
| 88 continue; | 87 continue; |
| 89 } | 88 } |
| 90 m_separatorIndex++; | 89 m_separatorIndex++; |
| 91 if (m_separatorIndex == m_separator.size()) { | 90 if (m_separatorIndex == m_separator.size()) { |
| 92 if (includeSeparator) | 91 if (includeSeparator) |
| 93 chunk.appendVector(m_separator); | 92 chunk.appendVector(m_separator); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 break; | 141 break; |
| 143 } | 142 } |
| 144 data.append(segment, segmentLength); | 143 data.append(segment, segmentLength); |
| 145 readBytesCount += segmentLength; | 144 readBytesCount += segmentLength; |
| 146 bufferPosition += segmentLength; | 145 bufferPosition += segmentLength; |
| 147 } | 146 } |
| 148 return readBytesCount; | 147 return readBytesCount; |
| 149 } | 148 } |
| 150 | 149 |
| 151 } // namespace blink | 150 } // namespace blink |
| OLD | NEW |