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

Unified Diff: third_party/courgette/courgette_minimal_tool.cc

Issue 113009: Move Courgette from internal depot to third_party. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | « third_party/courgette/courgette.gyp ('k') | third_party/courgette/courgette_tool.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/courgette/courgette_minimal_tool.cc
===================================================================
--- third_party/courgette/courgette_minimal_tool.cc (revision 0)
+++ third_party/courgette/courgette_minimal_tool.cc (revision 0)
@@ -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 "third_party/courgette/bsdiff.h"
+#include "third_party/courgette/courgette.h"
+#include "third_party/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.");
+ }
+}
« no previous file with comments | « third_party/courgette/courgette.gyp ('k') | third_party/courgette/courgette_tool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698