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

Unified Diff: xz/debug/repeat.c

Issue 2869016: Add an unpatched version of xz, XZ Utils, to /trunk/deps/third_party (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/
Patch Set: Created 10 years, 6 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 | « xz/debug/memusage.c ('k') | xz/debug/sync_flush.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xz/debug/repeat.c
===================================================================
--- xz/debug/repeat.c (revision 0)
+++ xz/debug/repeat.c (revision 0)
@@ -0,0 +1,36 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+/// \file repeat.c
+/// \brief Repeats given string given times
+///
+/// This program can be useful when debugging run-length encoder in
+/// the Subblock filter, especially the condition when repeat count
+/// doesn't fit into 28-bit integer.
+//
+// Author: Lasse Collin
+//
+// This file has been put into the public domain.
+// You can do whatever you want with this file.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "sysdefs.h"
+#include <stdio.h>
+
+
+int
+main(int argc, char **argv)
+{
+ if (argc != 3) {
+ fprintf(stderr, "Usage: %s COUNT STRING\n", argv[0]);
+ exit(1);
+ }
+
+ unsigned long long count = strtoull(argv[1], NULL, 10);
+ const size_t size = strlen(argv[2]);
+
+ while (count-- != 0)
+ fwrite(argv[2], 1, size, stdout);
+
+ return !!(ferror(stdout) || fclose(stdout));
+}
Property changes on: xz/debug/repeat.c
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « xz/debug/memusage.c ('k') | xz/debug/sync_flush.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698