summaryrefslogtreecommitdiff
path: root/app/lzo/examples
diff options
context:
space:
mode:
Diffstat (limited to 'app/lzo/examples')
-rw-r--r--app/lzo/examples/dict.c71
-rw-r--r--app/lzo/examples/lzopack.c75
-rw-r--r--app/lzo/examples/overlap.c74
-rw-r--r--app/lzo/examples/portab.h82
-rw-r--r--app/lzo/examples/portab_a.h113
-rw-r--r--app/lzo/examples/precomp.c39
-rw-r--r--app/lzo/examples/precomp2.c45
-rw-r--r--app/lzo/examples/simple.c31
8 files changed, 153 insertions, 377 deletions
diff --git a/app/lzo/examples/dict.c b/app/lzo/examples/dict.c
index 04db2453..3ccc9a53 100644
--- a/app/lzo/examples/dict.c
+++ b/app/lzo/examples/dict.c
@@ -2,22 +2,7 @@
This file is part of the LZO real-time data compression library.
- Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The LZO library is free software; you can redistribute it and/or
@@ -62,7 +47,7 @@ static const char *progname = NULL;
#define DICT_LEN 0xbfff
static lzo_bytep dict;
static lzo_uint dict_len = 0;
-static lzo_uint32 dict_adler32;
+static lzo_uint32_t dict_adler32;
/*************************************************************************
@@ -73,11 +58,11 @@ static lzo_uint total_n = 0;
static lzo_uint total_c_len = 0;
static lzo_uint total_d_len = 0;
-static void print_file ( const char *name, lzo_uint d_len, lzo_uint c_len )
+static void print_info(const char *name, lzo_uint d_len, lzo_uint c_len)
{
double perc;
- perc = (d_len > 0) ? c_len * 100.0 / d_len : 0;
+ perc = (d_len > 0) ? c_len * 100.0 / d_len : 0.0;
printf(" | %-30s %9ld -> %9ld %7.2f%% |\n",
name, (long) d_len, (long) c_len, perc);
@@ -91,7 +76,7 @@ static void print_file ( const char *name, lzo_uint d_len, lzo_uint c_len )
//
**************************************************************************/
-int do_file ( const char *in_name, int compression_level )
+static int do_file(const char *in_name, int compression_level)
{
int r;
lzo_bytep in;
@@ -108,9 +93,9 @@ int do_file ( const char *in_name, int compression_level )
* Step 1: open the input file
*/
fp = fopen(in_name,"rb");
- if (fp == 0)
+ if (fp == NULL)
{
- printf("%s: cannot open file %s\n", progname, in_name);
+ printf("%s: %s: cannot open file\n", progname, in_name);
return 0; /* no error */
}
fseek(fp, 0, SEEK_END);
@@ -120,9 +105,15 @@ int do_file ( const char *in_name, int compression_level )
{
printf("%s: %s: empty file -- skipping\n", progname, in_name);
fclose(fp); fp = NULL;
- return 0;
+ return 0; /* no error */
}
in_len = (lzo_uint) l;
+ if ((long) in_len != l || l > 256L * 1024L * 1024L)
+ {
+ printf("%s: %s: file is too big -- skipping\n", progname, in_name);
+ fclose(fp); fp = NULL;
+ return 0; /* no error */
+ }
/*
* Step 2: allocate compression buffers and read the file
@@ -151,13 +142,13 @@ int do_file ( const char *in_name, int compression_level )
return 1;
}
- print_file(in_name,in_len,out_len);
+ print_info(in_name, in_len, out_len);
/*
* Step 4: decompress again, now going from 'out' to 'newb'
*/
new_len = in_len;
- r = lzo1x_decompress_dict_safe(out,out_len,newb,&new_len,NULL,dict,dict_len);
+ r = lzo1x_decompress_dict_safe(out, out_len, newb, &new_len, NULL, dict, dict_len);
if (r != LZO_E_OK)
{
/* this should NEVER happen */
@@ -168,7 +159,7 @@ int do_file ( const char *in_name, int compression_level )
/*
* Step 5: verify decompression
*/
- if (new_len != in_len || lzo_memcmp(in,newb,in_len) != 0)
+ if (new_len != in_len || lzo_memcmp(in, newb, in_len) != 0)
{
/* this should NEVER happen */
printf("internal error - decompression data error\n");
@@ -191,7 +182,7 @@ int do_file ( const char *in_name, int compression_level )
int __lzo_cdecl_main main(int argc, char *argv[])
{
int i = 1;
- int r;
+ int r = 0;
const char *dict_name;
FILE *fp;
time_t t_total;
@@ -201,7 +192,7 @@ int __lzo_cdecl_main main(int argc, char *argv[])
printf("\nLZO real-time data compression library (v%s, %s).\n",
lzo_version_string(), lzo_version_date());
- printf("Copyright (C) 1996-2011 Markus Franz Xaver Johannes Oberhumer\nAll Rights Reserved.\n\n");
+ printf("Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer\nAll Rights Reserved.\n\n");
progname = argv[0];
@@ -243,7 +234,7 @@ int __lzo_cdecl_main main(int argc, char *argv[])
else
{
fp = fopen(dict_name,"rb");
- if (!fp)
+ if (fp == NULL)
{
printf("%s: cannot open dictionary file %s\n", progname, dict_name);
exit(1);
@@ -252,30 +243,32 @@ int __lzo_cdecl_main main(int argc, char *argv[])
fclose(fp); fp = NULL;
}
- dict_adler32 = lzo_adler32(0,NULL,0);
- dict_adler32 = lzo_adler32(dict_adler32,dict,dict_len);
+ dict_adler32 = lzo_adler32(0, NULL, 0);
+ dict_adler32 = lzo_adler32(dict_adler32, dict, dict_len);
printf("Using dictionary '%s', %ld bytes, ID 0x%08lx.\n",
- dict_name, (long) dict_len, (long) dict_adler32);
+ dict_name, (long) dict_len, (unsigned long) dict_adler32);
/*
* Step 3: process files
*/
t_total = time(NULL);
- for (r = 0; r == 0 && i < argc; i++)
- r = do_file(argv[i], compression_level);
+ for ( ; i < argc; i++) {
+ if (do_file(argv[i], compression_level) != 0) {
+ r = 1;
+ break;
+ }
+ }
t_total = time(NULL) - t_total;
lzo_free(dict);
if (total_n > 1)
- print_file("***TOTALS***",total_d_len,total_c_len);
+ print_info("***TOTALS***", total_d_len, total_c_len);
printf("Dictionary compression test %s, execution time %lu seconds.\n",
- r == 0 ? "passed" : "FAILED", (unsigned long) t_total);
+ r == 0 ? "passed" : "FAILED", (unsigned long) t_total);
return r;
}
-/*
-vi:ts=4:et
-*/
+/* vim:set ts=4 sw=4 et: */
diff --git a/app/lzo/examples/lzopack.c b/app/lzo/examples/lzopack.c
index e4e745df..10e2c1dc 100644
--- a/app/lzo/examples/lzopack.c
+++ b/app/lzo/examples/lzopack.c
@@ -2,22 +2,7 @@
This file is part of the LZO real-time data compression library.
- Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The LZO library is free software; you can redistribute it and/or
@@ -76,7 +61,7 @@ static const unsigned char magic[7] =
// file IO
**************************************************************************/
-lzo_uint xread(FILE *fp, lzo_voidp buf, lzo_uint len, lzo_bool allow_eof)
+static lzo_uint xread(FILE *fp, lzo_voidp buf, lzo_uint len, lzo_bool allow_eof)
{
lzo_uint l;
@@ -95,7 +80,7 @@ lzo_uint xread(FILE *fp, lzo_voidp buf, lzo_uint len, lzo_bool allow_eof)
return l;
}
-lzo_uint xwrite(FILE *fp, const lzo_voidp buf, lzo_uint len)
+static lzo_uint xwrite(FILE *fp, const lzo_voidp buf, lzo_uint len)
{
if (fp != NULL && lzo_fwrite(fp, buf, len) != len)
{
@@ -107,14 +92,14 @@ lzo_uint xwrite(FILE *fp, const lzo_voidp buf, lzo_uint len)
}
-int xgetc(FILE *fp)
+static int xgetc(FILE *fp)
{
unsigned char c;
xread(fp, (lzo_voidp) &c, 1, 0);
return c;
}
-void xputc(FILE *fp, int c)
+static void xputc(FILE *fp, int c)
{
unsigned char cc = (unsigned char) (c & 0xff);
xwrite(fp, (const lzo_voidp) &cc, 1);
@@ -122,20 +107,20 @@ void xputc(FILE *fp, int c)
/* read and write portable 32-bit integers */
-lzo_uint32 xread32(FILE *fp)
+static lzo_uint32_t xread32(FILE *fp)
{
unsigned char b[4];
- lzo_uint32 v;
+ lzo_uint32_t v;
xread(fp, b, 4, 0);
- v = (lzo_uint32) b[3] << 0;
- v |= (lzo_uint32) b[2] << 8;
- v |= (lzo_uint32) b[1] << 16;
- v |= (lzo_uint32) b[0] << 24;
+ v = (lzo_uint32_t) b[3] << 0;
+ v |= (lzo_uint32_t) b[2] << 8;
+ v |= (lzo_uint32_t) b[1] << 16;
+ v |= (lzo_uint32_t) b[0] << 24;
return v;
}
-void xwrite32(FILE *fp, lzo_xint v)
+static void xwrite32(FILE *fp, lzo_xint v)
{
unsigned char b[4];
@@ -159,7 +144,7 @@ void xwrite32(FILE *fp, lzo_xint v)
// compression.
**************************************************************************/
-int do_compress(FILE *fi, FILE *fo, int compression_level, lzo_uint block_size)
+static int do_compress(FILE *fi, FILE *fo, int compression_level, lzo_uint block_size)
{
int r = 0;
lzo_bytep in = NULL;
@@ -167,10 +152,10 @@ int do_compress(FILE *fi, FILE *fo, int compression_level, lzo_uint block_size)
lzo_voidp wrkmem = NULL;
lzo_uint in_len;
lzo_uint out_len;
- lzo_uint32 wrk_len = 0;
- lzo_uint32 flags = 1; /* do compute a checksum */
+ lzo_uint wrkmem_size;
+ lzo_uint32_t flags = 1; /* do compute a checksum */
int method = 1; /* compression method: LZO1X */
- lzo_uint32 checksum;
+ lzo_uint32_t checksum;
total_in = total_out = 0;
@@ -190,10 +175,10 @@ int do_compress(FILE *fi, FILE *fo, int compression_level, lzo_uint block_size)
in = (lzo_bytep) xmalloc(block_size);
out = (lzo_bytep) xmalloc(block_size + block_size / 16 + 64 + 3);
if (compression_level == 9)
- wrk_len = LZO1X_999_MEM_COMPRESS;
+ wrkmem_size = LZO1X_999_MEM_COMPRESS;
else
- wrk_len = LZO1X_1_MEM_COMPRESS;
- wrkmem = (lzo_voidp) xmalloc(wrk_len);
+ wrkmem_size = LZO1X_1_MEM_COMPRESS;
+ wrkmem = (lzo_voidp) xmalloc(wrkmem_size);
if (in == NULL || out == NULL || wrkmem == NULL)
{
printf("%s: out of memory\n", progname);
@@ -217,7 +202,7 @@ int do_compress(FILE *fi, FILE *fo, int compression_level, lzo_uint block_size)
/* clear wrkmem (not needed, only for debug/benchmark purposes) */
if (opt_debug)
- lzo_memset(wrkmem, 0xff, wrk_len);
+ lzo_memset(wrkmem, 0xff, wrkmem_size);
/* compress block */
if (compression_level == 9)
@@ -272,17 +257,17 @@ err:
// memory - see overlap.c.
**************************************************************************/
-int do_decompress(FILE *fi, FILE *fo)
+static int do_decompress(FILE *fi, FILE *fo)
{
int r = 0;
lzo_bytep buf = NULL;
lzo_uint buf_len;
unsigned char m [ sizeof(magic) ];
- lzo_uint32 flags;
+ lzo_uint32_t flags;
int method;
int compression_level;
lzo_uint block_size;
- lzo_uint32 checksum;
+ lzo_uint32_t checksum;
total_in = total_out = 0;
@@ -307,7 +292,7 @@ int do_decompress(FILE *fi, FILE *fo)
goto err;
}
block_size = xread32(fi);
- if (block_size < 1024 || block_size > 8*1024*1024L)
+ if (block_size < 1024 || block_size > 8L * 1024L * 1024L)
{
printf("%s: header error - invalid block size %ld\n",
progname, (long) block_size);
@@ -396,7 +381,7 @@ int do_decompress(FILE *fi, FILE *fo)
/* read and verify checksum */
if (flags & 1)
{
- lzo_uint32 c = xread32(fi);
+ lzo_uint32_t c = xread32(fi);
if (c != checksum)
{
printf("%s: checksum error - data corrupted\n", progname);
@@ -524,7 +509,7 @@ int __lzo_cdecl_main main(int argc, char *argv[])
printf("\nLZO real-time data compression library (v%s, %s).\n",
lzo_version_string(), lzo_version_date());
- printf("Copyright (C) 1996-2011 Markus Franz Xaver Johannes Oberhumer\nAll Rights Reserved.\n\n");
+ printf("Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer\nAll Rights Reserved.\n\n");
#if 0
printf(
@@ -552,9 +537,9 @@ int __lzo_cdecl_main main(int argc, char *argv[])
*/
opt_block_size = 256 * 1024L;
-#if defined(ACC_MM_AHSHIFT)
+#if defined(LZO_MM_AHSHIFT)
/* reduce memory requirements for ancient 16-bit DOS 640kB real-mode */
- if (ACC_MM_AHSHIFT != 3)
+ if (LZO_MM_AHSHIFT != 3)
opt_block_size = 16 * 1024L;
#endif
@@ -639,7 +624,5 @@ int __lzo_cdecl_main main(int argc, char *argv[])
return r;
}
-/*
-vi:ts=4:et
-*/
+/* vim:set ts=4 sw=4 et: */
diff --git a/app/lzo/examples/overlap.c b/app/lzo/examples/overlap.c
index b2337680..114fe3b4 100644
--- a/app/lzo/examples/overlap.c
+++ b/app/lzo/examples/overlap.c
@@ -2,22 +2,7 @@
This file is part of the LZO real-time data compression library.
- Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The LZO library is free software; you can redistribute it and/or
@@ -71,15 +56,7 @@ static const char *progname = NULL;
* will be needed. See step 4a) below.
*/
-static lzo_uint opt_overhead = 0; /* assume worst case */
-
-
-#if 0 && defined(LZO_USE_ASM)
- /* just for testing */
-# include <lzo_asm.h>
-# define lzo1x_decompress lzo1x_decompress_asm_fast
-#endif
-
+static long opt_overhead = 0; /* assume worst case */
static unsigned long total_files = 0;
static unsigned long total_in = 0;
@@ -89,7 +66,7 @@ static unsigned long total_in = 0;
//
**************************************************************************/
-int do_file ( const char *in_name )
+static int do_file(const char *in_name)
{
int r;
FILE *fp = NULL;
@@ -127,6 +104,11 @@ int do_file ( const char *in_name )
goto next_file;
}
in_len = (lzo_uint) l;
+ if ((long) in_len != l || l > 256L * 1024L * 1024L)
+ {
+ printf("%s: %s: file is too big -- skipping\n", progname, in_name);
+ goto next_file;
+ }
/*
* Step 2: allocate compression buffers and read the file
@@ -144,14 +126,14 @@ int do_file ( const char *in_name )
/*
* Step 3: compress from 'in' to 'out' with LZO1X-1
*/
- r = lzo1x_1_compress(in,in_len,out,&out_len,wrkmem);
+ r = lzo1x_1_compress(in, in_len, out, &out_len, wrkmem);
if (r != LZO_E_OK || out_len > in_len + in_len / 16 + 64 + 3)
{
/* this should NEVER happen */
printf("internal error - compression failed: %d\n", r);
exit(1);
}
- printf("%-26s %8lu -> %8lu\n", "LZO1X-1:", (unsigned long) in_len, (unsigned long) out_len);
+ printf("%-25s %8lu -> %8lu\n", "LZO1X-1:", (unsigned long) in_len, (unsigned long) out_len);
/***** Step 4: overlapping compression *****/
@@ -174,18 +156,18 @@ int do_file ( const char *in_name )
/*
* Step 4c: do an in-place compression within the 'overlap' buffer
*/
- r = lzo1x_1_compress(overlap+offset,in_len,overlap,&new_len,wrkmem);
+ r = lzo1x_1_compress(overlap + offset, in_len, overlap, &new_len, wrkmem);
if (r != LZO_E_OK)
{
/* this should NEVER happen */
- printf("overlapping compression failed: %d\n", r);
+ printf("in-place compression failed: %d\n", r);
exit(1);
}
/*
* Step 4d: verify overlapping compression
*/
- if (new_len != out_len || lzo_memcmp(out,overlap,out_len) != 0)
+ if (new_len != out_len || lzo_memcmp(out, overlap, out_len) != 0)
{
/* As compression is non-deterministic there can be a difference
* in the representation of the compressed data (but this usually
@@ -198,18 +180,18 @@ int do_file ( const char *in_name )
if (r != LZO_E_OK || ll != in_len || lzo_memcmp(in, tmp, ll) != 0)
{
/* this should NEVER happen */
- printf("overlapping compression data error\n");
+ printf("in-place compression data error\n");
exit(1);
}
lzo_free(tmp);
}
- printf("overlapping compression: %8lu -> %8lu overhead: %7lu\n",
+ printf(" in-place compression: %8lu -> %8lu overhead: %7lu\n",
(unsigned long) in_len, (unsigned long) new_len, (unsigned long) overhead);
lzo_free(overlap); overlap = NULL;
-/***** Step 5: overlapping decompression *****/
+/***** Step 5: in-place decompression *****/
/*
* Step 5a: allocate the 'overlap' buffer for in-place decompression
@@ -217,7 +199,7 @@ int do_file ( const char *in_name )
if (opt_overhead == 0 || out_len >= in_len)
overhead = in_len / 16 + 64 + 3;
else
- overhead = opt_overhead;
+ overhead = (lzo_uint) opt_overhead;
overlap = (lzo_bytep) xmalloc(in_len + overhead);
/*
@@ -231,24 +213,24 @@ int do_file ( const char *in_name )
* Step 5c: do an in-place decompression within the 'overlap' buffer
*/
new_len = in_len;
- r = lzo1x_decompress(overlap+offset,out_len,overlap,&new_len,NULL);
+ r = lzo1x_decompress_safe(overlap + offset, out_len, overlap, &new_len, NULL);
if (r != LZO_E_OK)
{
/* this may happen if overhead is too small */
- printf("overlapping decompression failed: %d - increase 'opt_overhead'\n", r);
+ printf("in-place decompression failed: %d - increase 'opt_overhead'\n", r);
exit(1);
}
/*
* Step 5d: verify decompression
*/
- if (new_len != in_len || lzo_memcmp(in,overlap,in_len) != 0)
+ if (new_len != in_len || lzo_memcmp(in, overlap, in_len) != 0)
{
/* this may happen if overhead is too small */
- printf("overlapping decompression data error - increase 'opt_overhead'\n");
+ printf("in-place decompression data error - increase 'opt_overhead'\n");
exit(1);
}
- printf("overlapping decompression: %8lu -> %8lu overhead: %7lu\n",
+ printf(" in-place decompression: %8lu -> %8lu overhead: %7lu\n",
(unsigned long) out_len, (unsigned long) new_len, (unsigned long) overhead);
lzo_free(overlap); overlap = NULL;
@@ -277,15 +259,15 @@ int __lzo_cdecl_main main(int argc, char *argv[])
printf("\nLZO real-time data compression library (v%s, %s).\n",
lzo_version_string(), lzo_version_date());
- printf("Copyright (C) 1996-2011 Markus Franz Xaver Johannes Oberhumer\nAll Rights Reserved.\n\n");
+ printf("Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer\nAll Rights Reserved.\n\n");
progname = argv[0];
if (i < argc && argv[i][0] == '-')
- opt_overhead = atoi(&argv[i++][1]);
+ opt_overhead = atol(&argv[i++][1]);
#if 1
- if (opt_overhead != 0 && opt_overhead < 8)
+ if (opt_overhead != 0 && opt_overhead < 4)
{
- printf("%s: invalid overhead value %ld\n", progname, (long)opt_overhead);
+ printf("%s: invalid overhead value %ld\n", progname, opt_overhead);
exit(1);
}
#endif
@@ -316,7 +298,5 @@ int __lzo_cdecl_main main(int argc, char *argv[])
return r;
}
-/*
-vi:ts=4:et
-*/
+/* vim:set ts=4 sw=4 et: */
diff --git a/app/lzo/examples/portab.h b/app/lzo/examples/portab.h
index b4b5a21a..d8217ed3 100644
--- a/app/lzo/examples/portab.h
+++ b/app/lzo/examples/portab.h
@@ -2,22 +2,7 @@
This file is part of the LZO real-time data compression library.
- Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The LZO library is free software; you can redistribute it and/or
@@ -53,8 +38,12 @@
/* avoid warnings about inlining */
# pragma warning(disable: 4710 4711)
#endif
-#if (LZO_CC_MSC && (_MSC_VER >= 1400))
- /* avoid warnings when using "deprecated" POSIX functions */
+/* disable silly warnings about using "deprecated" POSIX functions like "fopen" */
+#if (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 1100))
+# pragma warning(disable: 1786)
+#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 1000))
+# pragma warning(disable: 1478)
+#elif (LZO_CC_MSC && (_MSC_VER >= 1400))
# pragma warning(disable: 4996)
#endif
#if (LZO_CC_PELLESC && (__POCC__ >= 290))
@@ -66,19 +55,13 @@
//
**************************************************************************/
-#if defined(__LZO_MMODEL_HUGE) || defined(ACC_WANT_ACCLIB_GETOPT) || !(defined(LZO_LIBC_ISOC90) || defined(LZO_LIBC_ISOC99))
+#if defined(LZO_WANT_ACCLIB_GETOPT) || !(defined(LZO_LIBC_ISOC90) || defined(LZO_LIBC_ISOC99))
#include "examples/portab_a.h"
#else
-/* INFO:
- * The "portab_a.h" version above uses the ACC library to add
- * support for ancient systems (like 16-bit DOS) and to provide
- * some gimmicks like Windows high-resolution timers.
- * Still, on any halfway modern machine you can also use the
- * following pure ANSI-C code instead.
- */
+/* On any halfway modern machine we can use the following pure ANSI-C code. */
#include <stddef.h>
#include <stdlib.h>
@@ -98,13 +81,14 @@
# define lzo_fread(f,b,s) (fread(b,1,s,f))
# define lzo_fwrite(f,b,s) (fwrite(b,1,s,f))
#endif
-#if defined(WANT_LZO_UCLOCK)
-# define lzo_uclock_handle_t int
-# define lzo_uclock_t double
-# define lzo_uclock_open(a) ((void)(a))
-# define lzo_uclock_close(a) ((void)(a))
-# define lzo_uclock_read(a,b) *(b) = (clock() / (double)(CLOCKS_PER_SEC))
-# define lzo_uclock_get_elapsed(a,b,c) (*(c) - *(b))
+#if defined(WANT_LZO_PCLOCK)
+# define lzo_pclock_handle_t int
+# define lzo_pclock_t double
+# define lzo_pclock_open_default(a) ((void)(a))
+# define lzo_pclock_close(a) ((void)(a))
+# define lzo_pclock_read(a,b) *(b) = (clock() / (double)(CLOCKS_PER_SEC))
+# define lzo_pclock_get_elapsed(a,b,c) (*(c) - *(b))
+# define lzo_pclock_flush_cpu_cache(a,b) ((void)(a))
#endif
#if defined(WANT_LZO_WILDARGV)
# define lzo_wildargv(a,b) ((void)0)
@@ -154,34 +138,4 @@ static lzo_voidp xmalloc(lzo_uint len)
#endif
-#if defined(WANT_LZO_UCLOCK)
-
-/* High quality benchmarking.
- *
- * Flush the CPU cache to get more accurate benchmark values.
- * This needs custom kernel patches. As a result - in combination with
- * the perfctr Linux kernel patches - accurate high-quality benchmarking
- * is possible.
- *
- * All other methods (rdtsc, QueryPerformanceCounter, gettimeofday, ...)
- * are completely unreliable for our purposes, and the only other
- * option is to boot into a legacy single-task operating system
- * like plain MSDOS and to directly reprogram the hardware clock.
- * [The djgpp2 port of the gcc compiler has support functions for this.]
- *
- * Also, for embedded systems it's best to benchmark by using a
- * CPU emulator/simulator software that can exactly count all
- * virtual clock ticks.
- */
-
-#if !defined(lzo_uclock_flush_cpu_cache)
-# define lzo_uclock_flush_cpu_cache(h,flags) ((void)(h))
-#endif
-
-#endif
-
-
-/*
-vi:ts=4:et
-*/
-
+/* vim:set ts=4 sw=4 et: */
diff --git a/app/lzo/examples/portab_a.h b/app/lzo/examples/portab_a.h
index 2706022d..a3fbec90 100644
--- a/app/lzo/examples/portab_a.h
+++ b/app/lzo/examples/portab_a.h
@@ -2,22 +2,7 @@
This file is part of the LZO real-time data compression library.
- Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The LZO library is free software; you can redistribute it and/or
@@ -42,99 +27,35 @@
/*************************************************************************
-// use the ACC library for the hard work
+//
**************************************************************************/
#if defined(LZO_HAVE_CONFIG_H)
-# define ACC_CONFIG_NO_HEADER 1
+# define LZO_CFG_NO_CONFIG_HEADER 1
#endif
-#define ACC_WANT_ACC_INCD_H 1
-#define ACC_WANT_ACC_INCE_H 1
-#if defined(__LZO_MMODEL_HUGE) || defined(ACC_WANT_ACCLIB_GETOPT) || defined(WANT_LZO_UCLOCK) || defined(WANT_LZO_WILDARGV)
-# define ACC_WANT_ACC_INCI_H 1
-# define ACC_WANT_ACC_LIB_H 1
+#define LZO_WANT_ACC_INCD_H 1
+#define LZO_WANT_ACC_INCE_H 1
+#if defined(LZO_WANT_ACCLIB_GETOPT) || defined(WANT_LZO_PCLOCK) || defined(WANT_LZO_WILDARGV)
+# define LZO_WANT_ACC_INCI_H 1
+# define LZO_WANT_ACC_LIB_H 1
#endif
-#include "src/miniacc.h"
-
-#if defined(WANT_LZO_MALLOC)
-# if defined(__LZO_MMODEL_HUGE)
-# define ACC_WANT_ACCLIB_HALLOC 1
-# else
-# define acc_halloc(a) (malloc(a))
-# define acc_hfree(a) (free(a))
-# endif
-#endif
-#if defined(WANT_LZO_FREAD)
-# if defined(__LZO_MMODEL_HUGE)
-# define ACC_WANT_ACCLIB_HFREAD 1
-# else
-# define acc_hfread(f,b,s) (fread(b,1,s,f))
-# define acc_hfwrite(f,b,s) (fwrite(b,1,s,f))
-# endif
-#endif
-#if defined(WANT_LZO_UCLOCK)
-# define ACC_WANT_ACCLIB_PCLOCK 1
-# if 0 && (LZO_ARCH_AMD64 || LZO_ARCH_I386)
-# define __ACCLIB_PCLOCK_USE_RDTSC 1
-# define ACC_WANT_ACCLIB_RDTSC 1
-# endif
+#if defined(WANT_LZO_PCLOCK)
+# define LZO_WANT_ACCLIB_PCLOCK 1
#endif
#if defined(WANT_LZO_WILDARGV)
-# define ACC_WANT_ACCLIB_WILDARGV 1
-#endif
-#if (__ACCLIB_REQUIRE_HMEMCPY_CH) && !defined(__ACCLIB_HMEMCPY_CH_INCLUDED)
-# define ACC_WANT_ACCLIB_HMEMCPY 1
+# define LZO_WANT_ACCLIB_WILDARGV 1
#endif
-#include "src/miniacc.h"
-
+#include "src/lzo_supp.h"
-/*************************************************************************
-// finally pull into the LZO namespace
-**************************************************************************/
-
-#undef lzo_malloc
-#undef lzo_free
-#undef lzo_fread
-#undef lzo_fwrite
#if defined(WANT_LZO_MALLOC)
-# if defined(acc_halloc)
-# define lzo_malloc(a) acc_halloc(a)
-# else
-# define lzo_malloc(a) __ACCLIB_FUNCNAME(acc_halloc)(a)
-# endif
-# if defined(acc_hfree)
-# define lzo_free(a) acc_hfree(a)
-# else
-# define lzo_free(a) __ACCLIB_FUNCNAME(acc_hfree)(a)
-# endif
+# define lzo_malloc(a) (malloc(a))
+# define lzo_free(a) (free(a))
#endif
#if defined(WANT_LZO_FREAD)
-# if defined(acc_hfread)
-# define lzo_fread(f,b,s) acc_hfread(f,b,s)
-# else
-# define lzo_fread(f,b,s) __ACCLIB_FUNCNAME(acc_hfread)(f,b,s)
-# endif
-# if defined(acc_hfwrite)
-# define lzo_fwrite(f,b,s) acc_hfwrite(f,b,s)
-# else
-# define lzo_fwrite(f,b,s) __ACCLIB_FUNCNAME(acc_hfwrite)(f,b,s)
-# endif
-#endif
-#if defined(WANT_LZO_UCLOCK)
-# define lzo_uclock_handle_t acc_pclock_handle_t
-# define lzo_uclock_t acc_pclock_t
-# define lzo_uclock_open(a) __ACCLIB_FUNCNAME(acc_pclock_open_default)(a)
-# define lzo_uclock_close(a) __ACCLIB_FUNCNAME(acc_pclock_close)(a)
-# define lzo_uclock_read(a,b) __ACCLIB_FUNCNAME(acc_pclock_read)(a,b)
-# define lzo_uclock_get_elapsed(a,b,c) __ACCLIB_FUNCNAME(acc_pclock_get_elapsed)(a,b,c)
+# define lzo_fread(f,b,s) (fread(b,1,s,f))
+# define lzo_fwrite(f,b,s) (fwrite(b,1,s,f))
#endif
-#if defined(WANT_LZO_WILDARGV)
-# define lzo_wildargv(a,b) __ACCLIB_FUNCNAME(acc_wildargv)(a,b)
-#endif
-
-/*
-vi:ts=4:et
-*/
+/* vim:set ts=4 sw=4 et: */
diff --git a/app/lzo/examples/precomp.c b/app/lzo/examples/precomp.c
index a953827b..01b1e77f 100644
--- a/app/lzo/examples/precomp.c
+++ b/app/lzo/examples/precomp.c
@@ -2,22 +2,7 @@
This file is part of the LZO real-time data compression library.
- Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The LZO library is free software; you can redistribute it and/or
@@ -85,14 +70,14 @@ int __lzo_cdecl_main main(int argc, char *argv[])
lzo_uint out_len = 0;
lzo_voidp wrkmem;
- lzo_uint wrk_len;
+ lzo_uint wrkmem_size;
lzo_uint best_len;
int best_compress = -1;
lzo_uint orig_len;
- lzo_uint32 uncompressed_checksum;
- lzo_uint32 compressed_checksum;
+ lzo_uint32_t uncompressed_checksum;
+ lzo_uint32_t compressed_checksum;
FILE *fp;
const char *in_name = NULL;
@@ -104,7 +89,7 @@ int __lzo_cdecl_main main(int argc, char *argv[])
printf("\nLZO real-time data compression library (v%s, %s).\n",
lzo_version_string(), lzo_version_date());
- printf("Copyright (C) 1996-2011 Markus Franz Xaver Johannes Oberhumer\nAll Rights Reserved.\n\n");
+ printf("Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer\nAll Rights Reserved.\n\n");
progname = argv[0];
if (argc < 2 || argc > 3)
@@ -128,16 +113,14 @@ int __lzo_cdecl_main main(int argc, char *argv[])
/*
* Step 2: allocate the work-memory
*/
- wrk_len = 1;
+ wrkmem_size = 1;
#ifdef USE_LZO1X
- if (wrk_len < LZO1X_999_MEM_COMPRESS)
- wrk_len = LZO1X_999_MEM_COMPRESS;
+ wrkmem_size = (LZO1X_999_MEM_COMPRESS > wrkmem_size) ? LZO1X_999_MEM_COMPRESS : wrkmem_size;
#endif
#ifdef USE_LZO1Y
- if (wrk_len < LZO1Y_999_MEM_COMPRESS)
- wrk_len = LZO1Y_999_MEM_COMPRESS;
+ wrkmem_size = (LZO1Y_999_MEM_COMPRESS > wrkmem_size) ? LZO1Y_999_MEM_COMPRESS : wrkmem_size;
#endif
- wrkmem = (lzo_voidp) xmalloc(wrk_len);
+ wrkmem = (lzo_voidp) xmalloc(wrkmem_size);
if (wrkmem == NULL)
{
printf("%s: out of memory\n", progname);
@@ -343,7 +326,5 @@ int __lzo_cdecl_main main(int argc, char *argv[])
return 0;
}
-/*
-vi:ts=4:et
-*/
+/* vim:set ts=4 sw=4 et: */
diff --git a/app/lzo/examples/precomp2.c b/app/lzo/examples/precomp2.c
index d9e1b47b..93dd8b55 100644
--- a/app/lzo/examples/precomp2.c
+++ b/app/lzo/examples/precomp2.c
@@ -2,22 +2,7 @@
This file is part of the LZO real-time data compression library.
- Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The LZO library is free software; you can redistribute it and/or
@@ -68,7 +53,7 @@ lzo1x_999_compress_internal ( const lzo_bytep in , lzo_uint in_len,
lzo_uint max_lazy,
lzo_uint nice_length,
lzo_uint max_chain,
- lzo_uint32 flags );
+ lzo_uint32_t flags );
LZO_EXTERN(int)
lzo1y_999_compress_internal ( const lzo_bytep in , lzo_uint in_len,
@@ -81,7 +66,7 @@ lzo1y_999_compress_internal ( const lzo_bytep in , lzo_uint in_len,
lzo_uint max_lazy,
lzo_uint nice_length,
lzo_uint max_chain,
- lzo_uint32 flags );
+ lzo_uint32_t flags );
#define USE_LZO1X 1
#define USE_LZO1Y 1
@@ -108,7 +93,7 @@ int __lzo_cdecl_main main(int argc, char *argv[])
int lazy;
const int max_try_lazy = 5;
const lzo_uint big = 65536L; /* can result in very slow compression */
- const lzo_uint32 flags = 0x1;
+ const lzo_uint32_t flags = 0x1;
lzo_bytep in;
lzo_uint in_len;
@@ -118,15 +103,15 @@ int __lzo_cdecl_main main(int argc, char *argv[])
lzo_uint out_len = 0;
lzo_voidp wrkmem;
- lzo_uint wrk_len;
+ lzo_uint wrkmem_size;
lzo_uint best_len;
int best_compress = -1;
int best_lazy = -1;
lzo_uint orig_len;
- lzo_uint32 uncompressed_checksum;
- lzo_uint32 compressed_checksum;
+ lzo_uint32_t uncompressed_checksum;
+ lzo_uint32_t compressed_checksum;
FILE *fp;
const char *in_name = NULL;
@@ -138,7 +123,7 @@ int __lzo_cdecl_main main(int argc, char *argv[])
printf("\nLZO real-time data compression library (v%s, %s).\n",
lzo_version_string(), lzo_version_date());
- printf("Copyright (C) 1996-2011 Markus Franz Xaver Johannes Oberhumer\nAll Rights Reserved.\n\n");
+ printf("Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer\nAll Rights Reserved.\n\n");
progname = argv[0];
if (argc < 2 || argc > 3)
@@ -162,16 +147,14 @@ int __lzo_cdecl_main main(int argc, char *argv[])
/*
* Step 2: allocate the work-memory
*/
- wrk_len = 1;
+ wrkmem_size = 1;
#ifdef USE_LZO1X
- if (wrk_len < LZO1X_999_MEM_COMPRESS)
- wrk_len = LZO1X_999_MEM_COMPRESS;
+ wrkmem_size = (LZO1X_999_MEM_COMPRESS > wrkmem_size) ? LZO1X_999_MEM_COMPRESS : wrkmem_size;
#endif
#ifdef USE_LZO1Y
- if (wrk_len < LZO1Y_999_MEM_COMPRESS)
- wrk_len = LZO1Y_999_MEM_COMPRESS;
+ wrkmem_size = (LZO1Y_999_MEM_COMPRESS > wrkmem_size) ? LZO1Y_999_MEM_COMPRESS : wrkmem_size;
#endif
- wrkmem = (lzo_voidp) xmalloc(wrk_len);
+ wrkmem = (lzo_voidp) xmalloc(wrkmem_size);
if (wrkmem == NULL)
{
printf("%s: out of memory\n", progname);
@@ -395,7 +378,5 @@ int __lzo_cdecl_main main(int argc, char *argv[])
return 0;
}
-/*
-vi:ts=4:et
-*/
+/* vim:set ts=4 sw=4 et: */
diff --git a/app/lzo/examples/simple.c b/app/lzo/examples/simple.c
index 9d06cb5c..42f814a7 100644
--- a/app/lzo/examples/simple.c
+++ b/app/lzo/examples/simple.c
@@ -2,22 +2,7 @@
This file is part of the LZO real-time data compression library.
- Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The LZO library is free software; you can redistribute it and/or
@@ -93,7 +78,7 @@ int __lzo_cdecl_main main(int argc, char *argv[])
printf("\nLZO real-time data compression library (v%s, %s).\n",
lzo_version_string(), lzo_version_date());
- printf("Copyright (C) 1996-2011 Markus Franz Xaver Johannes Oberhumer\nAll Rights Reserved.\n\n");
+ printf("Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer\nAll Rights Reserved.\n\n");
/*
* Step 1: initialize the LZO library
@@ -128,10 +113,10 @@ int __lzo_cdecl_main main(int argc, char *argv[])
/*
* Step 4: compress from 'in' to 'out' with LZO1X-1
*/
- r = lzo1x_1_compress(in,in_len,out,&out_len,wrkmem);
+ r = lzo1x_1_compress(in, in_len, out, &out_len, wrkmem);
if (r == LZO_E_OK)
printf("compressed %lu bytes into %lu bytes\n",
- (unsigned long) in_len, (unsigned long) out_len);
+ (unsigned long) in_len, (unsigned long) out_len);
else
{
/* this should NEVER happen */
@@ -149,10 +134,10 @@ int __lzo_cdecl_main main(int argc, char *argv[])
* Step 5: decompress again, now going from 'out' to 'in'
*/
new_len = in_len;
- r = lzo1x_decompress(out,out_len,in,&new_len,NULL);
+ r = lzo1x_decompress(out, out_len, in, &new_len, NULL);
if (r == LZO_E_OK && new_len == in_len)
printf("decompressed %lu bytes back into %lu bytes\n",
- (unsigned long) out_len, (unsigned long) in_len);
+ (unsigned long) out_len, (unsigned long) in_len);
else
{
/* this should NEVER happen */
@@ -167,7 +152,5 @@ int __lzo_cdecl_main main(int argc, char *argv[])
return 0;
}
-/*
-vi:ts=4:et
-*/
+/* vim:set ts=4 sw=4 et: */