| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2008, 2011 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 } | 324 } |
| 325 *destination++ = *source++; | 325 *destination++ = *source++; |
| 326 continue; | 326 continue; |
| 327 } | 327 } |
| 328 int count = nonASCIISequenceLength(*source); | 328 int count = nonASCIISequenceLength(*source); |
| 329 int character; | 329 int character; |
| 330 if (count == 0) { | 330 if (count == 0) { |
| 331 character = nonCharacter; | 331 character = nonCharacter; |
| 332 } else { | 332 } else { |
| 333 if (count > end - source) { | 333 if (count > end - source) { |
| 334 ASSERT_WITH_SECURITY_IMPLICATION( | 334 SECURITY_DCHECK(end - source < |
| 335 end - source < static_cast<ptrdiff_t>(sizeof(m_partialSequence))); | 335 static_cast<ptrdiff_t>(sizeof(m_partialSequence))); |
| 336 ASSERT(!m_partialSequenceSize); | 336 ASSERT(!m_partialSequenceSize); |
| 337 m_partialSequenceSize = end - source; | 337 m_partialSequenceSize = end - source; |
| 338 memcpy(m_partialSequence, source, m_partialSequenceSize); | 338 memcpy(m_partialSequence, source, m_partialSequenceSize); |
| 339 source = end; | 339 source = end; |
| 340 break; | 340 break; |
| 341 } | 341 } |
| 342 character = decodeNonASCIISequence(source, count); | 342 character = decodeNonASCIISequence(source, count); |
| 343 } | 343 } |
| 344 if (character == nonCharacter) { | 344 if (character == nonCharacter) { |
| 345 sawError = true; | 345 sawError = true; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 } | 405 } |
| 406 *destination16++ = *source++; | 406 *destination16++ = *source++; |
| 407 continue; | 407 continue; |
| 408 } | 408 } |
| 409 int count = nonASCIISequenceLength(*source); | 409 int count = nonASCIISequenceLength(*source); |
| 410 int character; | 410 int character; |
| 411 if (count == 0) { | 411 if (count == 0) { |
| 412 character = nonCharacter; | 412 character = nonCharacter; |
| 413 } else { | 413 } else { |
| 414 if (count > end - source) { | 414 if (count > end - source) { |
| 415 ASSERT_WITH_SECURITY_IMPLICATION( | 415 SECURITY_DCHECK(end - source < |
| 416 end - source < static_cast<ptrdiff_t>(sizeof(m_partialSequence))); | 416 static_cast<ptrdiff_t>(sizeof(m_partialSequence))); |
| 417 ASSERT(!m_partialSequenceSize); | 417 ASSERT(!m_partialSequenceSize); |
| 418 m_partialSequenceSize = end - source; | 418 m_partialSequenceSize = end - source; |
| 419 memcpy(m_partialSequence, source, m_partialSequenceSize); | 419 memcpy(m_partialSequence, source, m_partialSequenceSize); |
| 420 source = end; | 420 source = end; |
| 421 break; | 421 break; |
| 422 } | 422 } |
| 423 character = decodeNonASCIISequence(source, count); | 423 character = decodeNonASCIISequence(source, count); |
| 424 } | 424 } |
| 425 if (character == nonCharacter) { | 425 if (character == nonCharacter) { |
| 426 sawError = true; | 426 sawError = true; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 return encodeCommon(characters, length); | 474 return encodeCommon(characters, length); |
| 475 } | 475 } |
| 476 | 476 |
| 477 CString TextCodecUTF8::encode(const LChar* characters, | 477 CString TextCodecUTF8::encode(const LChar* characters, |
| 478 size_t length, | 478 size_t length, |
| 479 UnencodableHandling) { | 479 UnencodableHandling) { |
| 480 return encodeCommon(characters, length); | 480 return encodeCommon(characters, length); |
| 481 } | 481 } |
| 482 | 482 |
| 483 } // namespace WTF | 483 } // namespace WTF |
| OLD | NEW |