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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 SECURITY_DCHECK(m_separatorIndex <= m_separator.size()); | 82 SECURITY_DCHECK(m_separatorIndex <= m_separator.size()); |
83 chunk.append(m_separator.data(), m_separatorIndex); | 83 chunk.append(m_separator.data(), m_separatorIndex); |
84 m_separatorIndex = 0; | 84 m_separatorIndex = 0; |
85 } | 85 } |
86 chunk.append(currentCharacter); | 86 chunk.push_back(currentCharacter); |
87 continue; | 87 continue; |
88 } | 88 } |
89 m_separatorIndex++; | 89 m_separatorIndex++; |
90 if (m_separatorIndex == m_separator.size()) { | 90 if (m_separatorIndex == m_separator.size()) { |
91 if (includeSeparator) | 91 if (includeSeparator) |
92 chunk.appendVector(m_separator); | 92 chunk.appendVector(m_separator); |
93 m_separatorIndex = 0; | 93 m_separatorIndex = 0; |
94 return true; | 94 return true; |
95 } | 95 } |
96 } | 96 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 break; | 141 break; |
142 } | 142 } |
143 data.append(segment, segmentLength); | 143 data.append(segment, segmentLength); |
144 readBytesCount += segmentLength; | 144 readBytesCount += segmentLength; |
145 bufferPosition += segmentLength; | 145 bufferPosition += segmentLength; |
146 } | 146 } |
147 return readBytesCount; | 147 return readBytesCount; |
148 } | 148 } |
149 | 149 |
150 } // namespace blink | 150 } // namespace blink |
OLD | NEW |