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

Unified Diff: courgette/courgette_tool.cc

Issue 6677141: Switch out use of std::string and std::vector for large allocations for a buffer class that doesn... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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
Index: courgette/courgette_tool.cc
===================================================================
--- courgette/courgette_tool.cc (revision 80344)
+++ courgette/courgette_tool.cc (working copy)
@@ -303,20 +303,39 @@
#endif
courgette::Status status =
- courgette::ApplyEnsemblePatch(old_path.value().c_str(),
- patch_path.value().c_str(),
- new_path.value().c_str());
+ courgette::ApplyEnsemblePatch(old_path.value().c_str(),
+ patch_path.value().c_str(),
+ new_path.value().c_str());
if (status == courgette::C_OK)
return;
// Diagnose the error.
- if (status == courgette::C_BAD_ENSEMBLE_MAGIC)
- Problem("Not a courgette patch");
- if (status == courgette::C_BAD_ENSEMBLE_VERSION)
- Problem("Wrong version patch");
- if (status == courgette::C_BAD_ENSEMBLE_HEADER)
- Problem("Corrupt patch");
+ switch (status) {
+ case courgette::C_BAD_ENSEMBLE_MAGIC:
+ Problem("Not a courgette patch");
+ break;
+
+ case courgette::C_BAD_ENSEMBLE_VERSION:
+ Problem("Wrong version patch");
+ break;
+
+ case courgette::C_BAD_ENSEMBLE_HEADER:
+ Problem("Corrupt patch");
+ break;
+
+ case courgette::C_DISASSEMBLY_FAILED:
+ Problem("Disassembly failed (could be because of memory issues)");
+ break;
+
+ case courgette::C_STREAM_ERROR:
+ Problem("Stream error (likely out of memory or disk space)");
+ break;
+
+ default:
+ break;
+ }
+
// If we failed due to a missing input file, this will
// print the message.
std::string old_buffer = ReadOrFail(old_file, "'old' input");

Powered by Google App Engine
This is Rietveld 408576698