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

Unified Diff: pkg/front_end/lib/src/fasta/translate_uri.dart

Issue 2827543006: Make zero-termination optional. (Closed)
Patch Set: Minor problems found during testing. Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/io.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/translate_uri.dart
diff --git a/pkg/front_end/lib/src/fasta/translate_uri.dart b/pkg/front_end/lib/src/fasta/translate_uri.dart
index 37d98eeb3ca6998dac354f03a84c42f346f82848..d7c41836e1a700fb394256750cb2e797dffa8d42 100644
--- a/pkg/front_end/lib/src/fasta/translate_uri.dart
+++ b/pkg/front_end/lib/src/fasta/translate_uri.dart
@@ -12,8 +12,6 @@ import 'errors.dart' show inputError;
import 'io.dart' show readBytesFromFile;
-import 'scanner/characters.dart' show $LF;
-
class TranslateUri {
final Map<String, Uri> packages;
final Map<String, Uri> dartLibraries;
@@ -78,12 +76,10 @@ class TranslateUri {
};
}
uri ??= Uri.base.resolve(".packages");
- List<int> bytes = await readBytesFromFile(uri);
+ List<int> bytes =
+ await readBytesFromFile(uri, ensureZeroTermination: false);
Map<String, Uri> packages = const <String, Uri>{};
try {
- // We always add an extra zero byte at the end of files. We change that
- // to a newline to avoid a format error from `packages_file.parse`.
- bytes[bytes.length - 1] = $LF;
packages = packages_file.parse(bytes, uri);
} on FormatException catch (e) {
return inputError(uri, e.offset, e.message);
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/io.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698