| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013, Opera Software ASA. All rights reserved. | 2 * Copyright (C) 2013, Opera Software ASA. 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // and fall through all the way down to the EOS check at the end of | 49 // and fall through all the way down to the EOS check at the end of |
| 50 // the method. | 50 // the method. |
| 51 } | 51 } |
| 52 | 52 |
| 53 bool shouldReturnLine = false; | 53 bool shouldReturnLine = false; |
| 54 bool checkForLF = false; | 54 bool checkForLF = false; |
| 55 while (!m_buffer.isEmpty()) { | 55 while (!m_buffer.isEmpty()) { |
| 56 UChar c = m_buffer.currentChar(); | 56 UChar c = m_buffer.currentChar(); |
| 57 m_buffer.advance(); | 57 m_buffer.advance(); |
| 58 | 58 |
| 59 if (c == newlineCharacter || c == carriageReturn) { | 59 if (c == newlineCharacter || c == carriageReturnCharacter) { |
| 60 // We found a line ending. Return the accumulated line. | 60 // We found a line ending. Return the accumulated line. |
| 61 shouldReturnLine = true; | 61 shouldReturnLine = true; |
| 62 checkForLF = (c == carriageReturn); | 62 checkForLF = (c == carriageReturnCharacter); |
| 63 break; | 63 break; |
| 64 } | 64 } |
| 65 | 65 |
| 66 // NULs are transformed into U+FFFD (REPLACEMENT CHAR.) in step 1 of | 66 // NULs are transformed into U+FFFD (REPLACEMENT CHAR.) in step 1 of |
| 67 // the WebVTT parser algorithm. | 67 // the WebVTT parser algorithm. |
| 68 if (c == '\0') | 68 if (c == '\0') |
| 69 c = replacementCharacter; | 69 c = replacementCharacter; |
| 70 | 70 |
| 71 m_lineBuffer.append(c); | 71 m_lineBuffer.append(c); |
| 72 } | 72 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 95 line = m_lineBuffer.toString(); | 95 line = m_lineBuffer.toString(); |
| 96 m_lineBuffer.clear(); | 96 m_lineBuffer.clear(); |
| 97 return true; | 97 return true; |
| 98 } | 98 } |
| 99 | 99 |
| 100 ASSERT(m_buffer.isEmpty()); | 100 ASSERT(m_buffer.isEmpty()); |
| 101 return false; | 101 return false; |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace blink | 104 } // namespace blink |
| OLD | NEW |