📄 uclpack.dif
字号:
diff -u examples.old/uclpack.c examples/uclpack.c
--- examples.old/uclpack.c 2004-07-19 23:01:46.000000000 +0000
+++ examples/uclpack.c 2007-01-27 16:03:42.000000000 +0000
@@ -5,6 +5,8 @@
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
+ Modifications by Oleg O. Chukaev <oleg.chukaev@mail.ru>, 2007.
+
The UCL library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
@@ -73,6 +75,8 @@
* a checksum and always use the fast decompressor */
static ucl_bool opt_fast = 0;
+static ucl_bool opt_raw = 0;
+
/* magic file header for compressed files */
static const unsigned char magic[8] =
{ 0x00, 0xe9, 0x55, 0x43, 0x4c, 0xff, 0x01, 0x1a };
@@ -221,11 +225,14 @@
/*
* Step 1: write magic header, flags & block size, init checksum
*/
- xwrite(fo,magic,sizeof(magic));
- xwrite32(fo,flags);
- xputc(fo,method); /* compression method */
- xputc(fo,level); /* compression level */
- xwrite32(fo,block_size);
+ if (!opt_raw)
+ {
+ xwrite(fo,magic,sizeof(magic));
+ xwrite32(fo,flags);
+ xputc(fo,method); /* compression method */
+ xputc(fo,level); /* compression level */
+ xwrite32(fo,block_size);
+ }
checksum = ucl_adler32(0,NULL,0);
/*
@@ -288,29 +295,41 @@
benchmark_secs += ucl_uclock_get_elapsed(&uc, &t_start, &t_stop);
#endif
- /* write uncompressed block size */
- xwrite32(fo,in_len);
+ if (!opt_raw)
+ {
+ /* write uncompressed block size */
+ xwrite32(fo,in_len);
+ }
if (out_len < in_len)
{
/* write compressed block */
- xwrite32(fo,out_len);
+ if (!opt_raw)
+ {
+ xwrite32(fo,out_len);
+ }
xwrite(fo,out,out_len);
}
else
{
/* not compressible - write uncompressed block */
- xwrite32(fo,in_len);
+ if (!opt_raw)
+ {
+ xwrite32(fo,in_len);
+ }
xwrite(fo,in,in_len);
}
}
- /* write EOF marker */
- xwrite32(fo,0);
+ if (!opt_raw)
+ {
+ /* write EOF marker */
+ xwrite32(fo,0);
- /* write checksum */
- if (flags & 1)
- xwrite32(fo,checksum);
+ /* write checksum */
+ if (flags & 1)
+ xwrite32(fo,checksum);
+ }
r = 0;
err:
@@ -569,6 +588,7 @@
printf("\nother options:\n");
printf(" -F do not store or verify a checksum (faster)\n");
printf(" -Bxxxx set block-size for compression [default 262144]\n");
+ printf(" -R do not store anything, except compressed data\n");
#if defined(WITH_TIMER)
printf(" -Dxxxx number of iterations for decompression benchmark\n");
#endif
@@ -665,6 +685,9 @@
printf("Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer\n");
printf("http://www.oberhumer.com/opensource/ucl/\n\n");
+ printf("NOTE: this is not the original code from UCL!\n");
+ printf(" modifications made by Oleg O. Chukaev <oleg.chukaev@mail.ru>\n\n");
+
#if 0
printf(
"*** WARNING ***\n"
@@ -708,6 +731,8 @@
opt_test = 1;
else if (strcmp(argv[i],"-F") == 0)
opt_fast = 1;
+ else if (strcmp(argv[i],"-R") == 0)
+ opt_raw = 1;
else if (strcmp(argv[i],"--2b") == 0)
opt_method = 0x2b;
else if (strcmp(argv[i],"--nrv2b") == 0)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -