diff options
author | sra@chromium.org <sra@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-08 23:00:29 +0000 |
---|---|---|
committer | sra@chromium.org <sra@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-08 23:00:29 +0000 |
commit | 04ca1bc65afb76ea30698c25f24599d20119e3d2 (patch) | |
tree | 2bb65e974d478f4d607b83f6a84a56c01f501ac0 /courgette/courgette_minimal_tool.cc | |
parent | 9adf1dcf3281408560267787eddcc767566b425f (diff) | |
download | chromium_src-04ca1bc65afb76ea30698c25f24599d20119e3d2.zip chromium_src-04ca1bc65afb76ea30698c25f24599d20119e3d2.tar.gz chromium_src-04ca1bc65afb76ea30698c25f24599d20119e3d2.tar.bz2 |
Move Courgette
from src\third_party\courgette
to src\courgette and src\courgette\third_party
Fixed #includes
Added properties to ignore generated files:
C:\c5\src>svn pg svn:ignore courgette
courgette.xcodeproj
courgette.sln
courgette_fuzz.vcproj
courgette_lib.vcproj
courgette_minimal_tool.vcproj
courgette_tool.vcproj
courgette.vcproj
courgette_unittests.vcproj
SConstruct
courgette_fuzz.scons
courgette_lib.scons
courgette_main.scons
courgette_minimal_tool.scons
courgette.scons
courgette_tool.scons
courgette_unittests.scons
Review URL: http://codereview.chromium.org/115062
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15692 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'courgette/courgette_minimal_tool.cc')
-rw-r--r-- | courgette/courgette_minimal_tool.cc | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/courgette/courgette_minimal_tool.cc b/courgette/courgette_minimal_tool.cc new file mode 100644 index 0000000..84de068 --- /dev/null +++ b/courgette/courgette_minimal_tool.cc @@ -0,0 +1,50 @@ +// Copyright (c) 2009 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. + +// 'courgette_minimal_tool' is not meant to be a serious command-line tool. It +// has the minimum logic to apply a Courgette patch to a file. The main purpose +// is to monitor the code size of the patcher. + +#include <string> + +#include "base/file_util.h" + +#include "courgette/third_party/bsdiff.h" +#include "courgette/courgette.h" +#include "courgette/streams.h" + +void PrintHelp() { + fprintf(stderr, + "Usage:\n" + " courgette_minimal_tool <old-file-input> <patch-file-input>" + " <new-file-output>\n" + "\n"); +} + +void UsageProblem(const char* message) { + fprintf(stderr, "%s\n", message); + PrintHelp(); + exit(1); +} + +void Problem(const char* message) { + fprintf(stderr, "%s\n", message); + exit(1); +} + +int wmain(int argc, const wchar_t* argv[]) { + if (argc != 4) + UsageProblem("bad args"); + + courgette::Status status = + courgette::ApplyEnsemblePatch(argv[1], argv[2], argv[3]); + + if (status != courgette::C_OK) { + if (status == courgette::C_READ_OPEN_ERROR) Problem("Can't open file."); + if (status == courgette::C_WRITE_OPEN_ERROR) Problem("Can't open file."); + if (status == courgette::C_READ_ERROR) Problem("Can't read from file."); + if (status == courgette::C_WRITE_ERROR) Problem("Can't write to file."); + Problem("patch failed."); + } +} |