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

Unified Diff: runtime/bin/file.cc

Issue 206263005: Add debug-printing to file, and remove from test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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/docgen/test/generate_json_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file.cc
diff --git a/runtime/bin/file.cc b/runtime/bin/file.cc
index 9b9906a875c9967711fa36095de1fca25fb8c337..528b287695b89cf64efbfd16027a61e68713b074 100644
--- a/runtime/bin/file.cc
+++ b/runtime/bin/file.cc
@@ -256,12 +256,27 @@ void FUNCTION_NAME(File_WriteFrom)(Dart_NativeArguments args) {
Dart_TypedDataAcquireData(buffer_obj, &type, &buffer, &buffer_len);
if (Dart_IsError(result)) Dart_PropagateError(result);
+#ifdef DEBUG
+ // TODO(ajohnsen): Remove once issue 17602 is fixed.
+ bool print_debug = true;
+ for (int i = 0; i < length; i++) {
+ if (reinterpret_cast<uint8_t*>(buffer)[i] != 0xf3) {
+ print_debug = false;
+ break;
+ }
+ }
+ if (print_debug) {
+ fprintf(stderr, "WARNING: Data is purely 0x3f in File_WriteFrom\n");
+ fflush(stderr);
+ }
+#endif
+
ASSERT(type == Dart_TypedData_kUint8 || type == Dart_TypedData_kInt8);
ASSERT(end <= buffer_len);
ASSERT(buffer != NULL);
// Write the data out into the file.
- int64_t bytes_written = file->Write(reinterpret_cast<void*>(buffer), length);
+ int64_t bytes_written = file->Write(buffer, length);
// Release the direct pointer acquired above.
result = Dart_TypedDataReleaseData(buffer_obj);
if (Dart_IsError(result)) Dart_PropagateError(result);
« no previous file with comments | « pkg/docgen/test/generate_json_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698