| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. All rights | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. All rights |
| 4 * reserved. | 4 * reserved. |
| 5 * Copyright (C) 2007-2009 Torch Mobile, Inc. | 5 * Copyright (C) 2007-2009 Torch Mobile, Inc. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 | 622 |
| 623 char* buffer = bufferVector.data(); | 623 char* buffer = bufferVector.data(); |
| 624 | 624 |
| 625 if (is8Bit()) { | 625 if (is8Bit()) { |
| 626 const LChar* characters = this->characters8(); | 626 const LChar* characters = this->characters8(); |
| 627 | 627 |
| 628 ConversionResult result = | 628 ConversionResult result = |
| 629 convertLatin1ToUTF8(&characters, characters + length, &buffer, | 629 convertLatin1ToUTF8(&characters, characters + length, &buffer, |
| 630 buffer + bufferVector.size()); | 630 buffer + bufferVector.size()); |
| 631 // (length * 3) should be sufficient for any conversion | 631 // (length * 3) should be sufficient for any conversion |
| 632 ASSERT_UNUSED(result, result != targetExhausted); | 632 DCHECK_NE(result, targetExhausted); |
| 633 } else { | 633 } else { |
| 634 const UChar* characters = this->characters16(); | 634 const UChar* characters = this->characters16(); |
| 635 | 635 |
| 636 if (mode == StrictUTF8ConversionReplacingUnpairedSurrogatesWithFFFD) { | 636 if (mode == StrictUTF8ConversionReplacingUnpairedSurrogatesWithFFFD) { |
| 637 const UChar* charactersEnd = characters + length; | 637 const UChar* charactersEnd = characters + length; |
| 638 char* bufferEnd = buffer + bufferVector.size(); | 638 char* bufferEnd = buffer + bufferVector.size(); |
| 639 while (characters < charactersEnd) { | 639 while (characters < charactersEnd) { |
| 640 // Use strict conversion to detect unpaired surrogates. | 640 // Use strict conversion to detect unpaired surrogates. |
| 641 ConversionResult result = convertUTF16ToUTF8(&characters, charactersEnd, | 641 ConversionResult result = convertUTF16ToUTF8(&characters, charactersEnd, |
| 642 &buffer, bufferEnd, true); | 642 &buffer, bufferEnd, true); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 } | 844 } |
| 845 buffer.append('\0'); | 845 buffer.append('\0'); |
| 846 return buffer; | 846 return buffer; |
| 847 } | 847 } |
| 848 | 848 |
| 849 Vector<char> asciiDebug(String& string) { | 849 Vector<char> asciiDebug(String& string) { |
| 850 return asciiDebug(string.impl()); | 850 return asciiDebug(string.impl()); |
| 851 } | 851 } |
| 852 | 852 |
| 853 #endif | 853 #endif |
| OLD | NEW |