summaryrefslogtreecommitdiff
path: root/lzo/src/lzo1a.c
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-07-02 17:28:05 +0200
committerArne Schwabe <arne@rfc2549.org>2012-07-02 17:28:05 +0200
commit6a4ba5d3976f6d219400a46c634dd479bc5981a5 (patch)
treeb9514fea0817906859843475fe8455070de25064 /lzo/src/lzo1a.c
parent73d3b9c032eae2074726cd3668546af1c44a8323 (diff)
Update lzo version
Diffstat (limited to 'lzo/src/lzo1a.c')
-rw-r--r--lzo/src/lzo1a.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/lzo/src/lzo1a.c b/lzo/src/lzo1a.c
index c5713591..37020dd6 100644
--- a/lzo/src/lzo1a.c
+++ b/lzo/src/lzo1a.c
@@ -2,6 +2,9 @@
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
@@ -63,7 +66,7 @@
/* Collect statistics */
#if 0 && !defined(LZO_COLLECT_STATS)
-# define LZO_COLLECT_STATS
+# define LZO_COLLECT_STATS 1
#endif
@@ -102,7 +105,7 @@
#endif
-#if defined(LZO_COLLECT_STATS)
+#if (LZO_COLLECT_STATS)
static lzo1a_stats_t lzo_statistics;
lzo1a_stats_t *lzo1a_stats = &lzo_statistics;
# define lzo_stats lzo1a_stats
@@ -194,9 +197,9 @@ literal:
m_pos = op - MIN_OFFSET;
m_pos -= t | (((lzo_uint) *ip++) << OBITS);
assert(m_pos >= out); assert(m_pos < op);
- *op++ = *m_pos++;
- *op++ = *m_pos++;
- *op++ = *m_pos++;
+ *op++ = m_pos[0];
+ *op++ = m_pos[1];
+ *op++ = m_pos[2];
*op++ = *ip++;
}
}
@@ -283,7 +286,7 @@ do_compress ( const lzo_bytep in , lzo_uint in_len,
ii = ip; /* point to start of current literal run */
/* init dictionary */
-#if defined(LZO_DETERMINISTIC)
+#if (LZO_DETERMINISTIC)
BZERO8_PTR(wrkmem,sizeof(lzo_dict_t),D_SIZE);
#endif
@@ -291,7 +294,7 @@ do_compress ( const lzo_bytep in , lzo_uint in_len,
DVAL_NEXT(dv,ip);
do {
- lzo_uint m_off;
+ LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0);
lzo_uint dindex;
DINDEX1(dindex,ip);
@@ -316,7 +319,7 @@ literal:
match:
UPDATE_I(dict,0,dindex,ip,in);
-#if !defined(NDEBUG) && defined(LZO_DICT_USE_PTR)
+#if !defined(NDEBUG) && (LZO_DICT_USE_PTR)
assert(m_pos == NULL || m_pos >= in);
m_pos_sav = m_pos;
#endif
@@ -324,7 +327,7 @@ match:
{
/* we have found a match (of at least length 3) */
-#if !defined(NDEBUG) && !defined(LZO_DICT_USE_PTR)
+#if !defined(NDEBUG) && !(LZO_DICT_USE_PTR)
assert((m_pos_sav = ip - m_off) == (m_pos - 3));
#endif
@@ -452,7 +455,7 @@ match:
*op++ = LZO_BYTE(m_off >> OBITS);
-#if defined(LZO_COLLECT_STATS)
+#if (LZO_COLLECT_STATS)
lzo_stats->short_matches++;
lzo_stats->short_match[m_len]++;
if (m_off < OSIZE)
@@ -530,7 +533,7 @@ match:
*op++ = LZO_BYTE(m_len - MIN_MATCH_LONG);
-#if defined(LZO_COLLECT_STATS)
+#if (LZO_COLLECT_STATS)
lzo_stats->long_matches++;
lzo_stats->long_match[m_len]++;
#endif
@@ -608,7 +611,7 @@ lzo1a_compress ( const lzo_bytep in , lzo_uint in_len,
int r = LZO_E_OK;
-#if defined(LZO_COLLECT_STATS)
+#if (LZO_COLLECT_STATS)
lzo_memset(lzo_stats,0,sizeof(*lzo_stats));
lzo_stats->rbits = RBITS;
lzo_stats->clevel = CLEVEL;
@@ -628,7 +631,7 @@ lzo1a_compress ( const lzo_bytep in , lzo_uint in_len,
/* don't try to compress a block that's too short */
- if (in_len <= 0)
+ if (in_len == 0)
*out_len = 0;
else if (in_len <= MIN_MATCH_LONG + DVAL_LEN + 1)
{
@@ -642,7 +645,7 @@ lzo1a_compress ( const lzo_bytep in , lzo_uint in_len,
r = do_compress(in,in_len,out,out_len,wrkmem);
-#if defined(LZO_COLLECT_STATS)
+#if (LZO_COLLECT_STATS)
lzo_stats->short_matches -= lzo_stats->r1_matches;
lzo_stats->short_match[MIN_MATCH] -= lzo_stats->r1_matches;
lzo_stats->out_len = *out_len;