diff options
Diffstat (limited to 'courgette/courgette_tool.cc')
-rw-r--r-- | courgette/courgette_tool.cc | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/courgette/courgette_tool.cc b/courgette/courgette_tool.cc index 523a438..225906e 100644 --- a/courgette/courgette_tool.cc +++ b/courgette/courgette_tool.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -303,20 +303,39 @@ void ApplyEnsemblePatch(const std::wstring& old_file, #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"); |