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

Side by Side Diff: sdk/lib/convert/base64.dart

Issue 2975193002: Fix bug in test's /none version. Update status files. (Closed)
Patch Set: Created 3 years, 5 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.convert; 5 part of dart.convert;
6 6
7 /** 7 /**
8 * A [base64](https://tools.ietf.org/html/rfc4648) encoder and decoder. 8 * A [base64](https://tools.ietf.org/html/rfc4648) encoder and decoder.
9 * 9 *
10 * It encodes using the default base64 alphabet, 10 * It encodes using the default base64 alphabet,
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 "Invalid base64 encoding length ", source, end); 165 "Invalid base64 encoding length ", source, end);
166 } 166 }
167 if (endLength > 1) { 167 if (endLength > 1) {
168 // There is no "insertAt" on String, but this works as well. 168 // There is no "insertAt" on String, but this works as well.
169 source = source.replaceRange(end, end, (endLength == 2) ? "==" : "="); 169 source = source.replaceRange(end, end, (endLength == 2) ? "==" : "=");
170 } 170 }
171 } 171 }
172 return source; 172 return source;
173 } 173 }
174 174
175 static int _checkPadding(String source, int sourceIndex, int sourceEnd, 175 static void _checkPadding(String source, int sourceIndex, int sourceEnd,
176 int firstPadding, int paddingCount, int length) { 176 int firstPadding, int paddingCount, int length) {
177 if (length % 4 != 0) { 177 if (length % 4 != 0) {
178 throw new FormatException( 178 throw new FormatException(
179 "Invalid base64 padding, padded length must be multiple of four, " 179 "Invalid base64 padding, padded length must be multiple of four, "
180 "is $length", 180 "is $length",
181 source, 181 source,
182 sourceEnd); 182 sourceEnd);
183 } 183 }
184 if (firstPadding + paddingCount != length) { 184 if (firstPadding + paddingCount != length) {
185 throw new FormatException( 185 throw new FormatException(
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 end = RangeError.checkValidRange(start, end, string.length); 862 end = RangeError.checkValidRange(start, end, string.length);
863 if (start == end) return; 863 if (start == end) return;
864 Uint8List buffer = _decoder.decode(string, start, end); 864 Uint8List buffer = _decoder.decode(string, start, end);
865 if (buffer != null) _sink.add(buffer); 865 if (buffer != null) _sink.add(buffer);
866 if (isLast) { 866 if (isLast) {
867 _decoder.close(string, end); 867 _decoder.close(string, end);
868 _sink.close(); 868 _sink.close();
869 } 869 }
870 } 870 }
871 } 871 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698