Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: Source/wtf/text/WTFString.cpp

Issue 531913002: Ensure that conversions from/to 8bit and 16bit never return null string. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@documentordered
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/fast/text/text-transform-quoted-turkish-azeri-lithuanian-and-greek-crash-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. All rights reserved.
4 * Copyright (C) 2007-2009 Torch Mobile, Inc. 4 * Copyright (C) 2007-2009 Torch Mobile, Inc.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 } 867 }
868 } 868 }
869 } 869 }
870 870
871 return CString(bufferVector.data(), buffer - bufferVector.data()); 871 return CString(bufferVector.data(), buffer - bufferVector.data());
872 } 872 }
873 873
874 String String::make8BitFrom16BitSource(const UChar* source, size_t length) 874 String String::make8BitFrom16BitSource(const UChar* source, size_t length)
875 { 875 {
876 if (!length) 876 if (!length)
877 return String(); 877 return emptyString();
878 878
879 LChar* destination; 879 LChar* destination;
880 String result = String::createUninitialized(length, destination); 880 String result = String::createUninitialized(length, destination);
881 881
882 copyLCharsFromUCharSource(destination, source, length); 882 copyLCharsFromUCharSource(destination, source, length);
883 883
884 return result; 884 return result;
885 } 885 }
886 886
887 String String::make16BitFrom8BitSource(const LChar* source, size_t length) 887 String String::make16BitFrom8BitSource(const LChar* source, size_t length)
888 { 888 {
889 if (!length) 889 if (!length)
890 return String(); 890 return emptyString();
891 891
892 UChar* destination; 892 UChar* destination;
893 String result = String::createUninitialized(length, destination); 893 String result = String::createUninitialized(length, destination);
894 894
895 StringImpl::copyChars(destination, source, length); 895 StringImpl::copyChars(destination, source, length);
896 896
897 return result; 897 return result;
898 } 898 }
899 899
900 String String::fromUTF8(const LChar* stringStart, size_t length) 900 String String::fromUTF8(const LChar* stringStart, size_t length)
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 buffer.append('\0'); 1266 buffer.append('\0');
1267 return buffer; 1267 return buffer;
1268 } 1268 }
1269 1269
1270 Vector<char> asciiDebug(String& string) 1270 Vector<char> asciiDebug(String& string)
1271 { 1271 {
1272 return asciiDebug(string.impl()); 1272 return asciiDebug(string.impl());
1273 } 1273 }
1274 1274
1275 #endif 1275 #endif
OLDNEW
« no previous file with comments | « LayoutTests/fast/text/text-transform-quoted-turkish-azeri-lithuanian-and-greek-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698