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

Unified Diff: sdk/lib/convert/base64.dart

Issue 1381033002: Add data-URI support class to dart:core (next to Uri). (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Remove VM assertion that appears to be incorrect. Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/convert/base64.dart
diff --git a/sdk/lib/convert/base64.dart b/sdk/lib/convert/base64.dart
index 77f7158008902eced9c39244400b72a4209e6166..66c1f0ce951e281e9e022ed2d61b6cbdac2a2e48 100644
--- a/sdk/lib/convert/base64.dart
+++ b/sdk/lib/convert/base64.dart
@@ -307,12 +307,12 @@ class _Utf8Base64EncoderSink extends _Base64EncoderSink {
class Base64Decoder extends Converter<String, List<int>> {
const Base64Decoder();
- List<int> convert(String input) {
- if (input.isEmpty) return new Uint8List(0);
- int length = input.length;
+ List<int> convert(String input, [int start = 0, int end]) {
+ end = RangeError.checkValidRange(start, end, input.length);
+ if (start == end) return new Uint8List(0);
var decoder = new _Base64Decoder();
- Uint8List buffer = decoder.decode(input, 0, input.length);
- decoder.close(input, input.length);
+ Uint8List buffer = decoder.decode(input, start, end);
+ decoder.close(input, end);
return buffer;
}

Powered by Google App Engine
This is Rietveld 408576698