aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/compr_rubin.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2005-11-07 06:16:07 -0500
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-11-07 08:18:56 -0500
commit182ec4eee397543101a6db8906ed88727d3f7e53 (patch)
tree0f6dd2c52697123702bdf0c3a7143537f947b060 /fs/jffs2/compr_rubin.c
parent97894cda5773e59bd13e87b72077751099419a9f (diff)
[JFFS2] Clean up trailing white spaces
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs/jffs2/compr_rubin.c')
-rw-r--r--fs/jffs2/compr_rubin.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/fs/jffs2/compr_rubin.c b/fs/jffs2/compr_rubin.c
index 09422388fb96..e792e675d624 100644
--- a/fs/jffs2/compr_rubin.c
+++ b/fs/jffs2/compr_rubin.c
@@ -11,7 +11,6 @@
11 * 11 *
12 */ 12 */
13 13
14
15#include <linux/string.h> 14#include <linux/string.h>
16#include <linux/types.h> 15#include <linux/types.h>
17#include <linux/jffs2.h> 16#include <linux/jffs2.h>
@@ -20,7 +19,7 @@
20#include "compr.h" 19#include "compr.h"
21 20
22static void init_rubin(struct rubin_state *rs, int div, int *bits) 21static void init_rubin(struct rubin_state *rs, int div, int *bits)
23{ 22{
24 int c; 23 int c;
25 24
26 rs->q = 0; 25 rs->q = 0;
@@ -40,7 +39,7 @@ static int encode(struct rubin_state *rs, long A, long B, int symbol)
40 39
41 while ((rs->q >= UPPER_BIT_RUBIN) || ((rs->p + rs->q) <= UPPER_BIT_RUBIN)) { 40 while ((rs->q >= UPPER_BIT_RUBIN) || ((rs->p + rs->q) <= UPPER_BIT_RUBIN)) {
42 rs->bit_number++; 41 rs->bit_number++;
43 42
44 ret = pushbit(&rs->pp, (rs->q & UPPER_BIT_RUBIN) ? 1 : 0, 0); 43 ret = pushbit(&rs->pp, (rs->q & UPPER_BIT_RUBIN) ? 1 : 0, 0);
45 if (ret) 44 if (ret)
46 return ret; 45 return ret;
@@ -68,7 +67,7 @@ static int encode(struct rubin_state *rs, long A, long B, int symbol)
68 67
69 68
70static void end_rubin(struct rubin_state *rs) 69static void end_rubin(struct rubin_state *rs)
71{ 70{
72 71
73 int i; 72 int i;
74 73
@@ -82,7 +81,7 @@ static void end_rubin(struct rubin_state *rs)
82 81
83static void init_decode(struct rubin_state *rs, int div, int *bits) 82static void init_decode(struct rubin_state *rs, int div, int *bits)
84{ 83{
85 init_rubin(rs, div, bits); 84 init_rubin(rs, div, bits);
86 85
87 /* behalve lower */ 86 /* behalve lower */
88 rs->rec_q = 0; 87 rs->rec_q = 0;
@@ -188,7 +187,7 @@ static int in_byte(struct rubin_state *rs)
188 187
189 188
190 189
191static int rubin_do_compress(int bit_divider, int *bits, unsigned char *data_in, 190static int rubin_do_compress(int bit_divider, int *bits, unsigned char *data_in,
192 unsigned char *cpage_out, uint32_t *sourcelen, uint32_t *dstlen) 191 unsigned char *cpage_out, uint32_t *sourcelen, uint32_t *dstlen)
193 { 192 {
194 int outpos = 0; 193 int outpos = 0;
@@ -198,31 +197,31 @@ static int rubin_do_compress(int bit_divider, int *bits, unsigned char *data_in,
198 init_pushpull(&rs.pp, cpage_out, *dstlen * 8, 0, 32); 197 init_pushpull(&rs.pp, cpage_out, *dstlen * 8, 0, 32);
199 198
200 init_rubin(&rs, bit_divider, bits); 199 init_rubin(&rs, bit_divider, bits);
201 200
202 while (pos < (*sourcelen) && !out_byte(&rs, data_in[pos])) 201 while (pos < (*sourcelen) && !out_byte(&rs, data_in[pos]))
203 pos++; 202 pos++;
204 203
205 end_rubin(&rs); 204 end_rubin(&rs);
206 205
207 if (outpos > pos) { 206 if (outpos > pos) {
208 /* We failed */ 207 /* We failed */
209 return -1; 208 return -1;
210 } 209 }
211 210
212 /* Tell the caller how much we managed to compress, 211 /* Tell the caller how much we managed to compress,
213 * and how much space it took */ 212 * and how much space it took */
214 213
215 outpos = (pushedbits(&rs.pp)+7)/8; 214 outpos = (pushedbits(&rs.pp)+7)/8;
216 215
217 if (outpos >= pos) 216 if (outpos >= pos)
218 return -1; /* We didn't actually compress */ 217 return -1; /* We didn't actually compress */
219 *sourcelen = pos; 218 *sourcelen = pos;
220 *dstlen = outpos; 219 *dstlen = outpos;
221 return 0; 220 return 0;
222} 221}
223#if 0 222#if 0
224/* _compress returns the compressed size, -1 if bigger */ 223/* _compress returns the compressed size, -1 if bigger */
225int jffs2_rubinmips_compress(unsigned char *data_in, unsigned char *cpage_out, 224int jffs2_rubinmips_compress(unsigned char *data_in, unsigned char *cpage_out,
226 uint32_t *sourcelen, uint32_t *dstlen, void *model) 225 uint32_t *sourcelen, uint32_t *dstlen, void *model)
227{ 226{
228 return rubin_do_compress(BIT_DIVIDER_MIPS, bits_mips, data_in, cpage_out, sourcelen, dstlen); 227 return rubin_do_compress(BIT_DIVIDER_MIPS, bits_mips, data_in, cpage_out, sourcelen, dstlen);
@@ -277,7 +276,7 @@ static int jffs2_dynrubin_compress(unsigned char *data_in,
277 } 276 }
278 277
279 ret = rubin_do_compress(256, bits, data_in, cpage_out+8, &mysrclen, &mydstlen); 278 ret = rubin_do_compress(256, bits, data_in, cpage_out+8, &mysrclen, &mydstlen);
280 if (ret) 279 if (ret)
281 return ret; 280 return ret;
282 281
283 /* Add back the 8 bytes we took for the probabilities */ 282 /* Add back the 8 bytes we took for the probabilities */
@@ -293,19 +292,19 @@ static int jffs2_dynrubin_compress(unsigned char *data_in,
293 return 0; 292 return 0;
294} 293}
295 294
296static void rubin_do_decompress(int bit_divider, int *bits, unsigned char *cdata_in, 295static void rubin_do_decompress(int bit_divider, int *bits, unsigned char *cdata_in,
297 unsigned char *page_out, uint32_t srclen, uint32_t destlen) 296 unsigned char *page_out, uint32_t srclen, uint32_t destlen)
298{ 297{
299 int outpos = 0; 298 int outpos = 0;
300 struct rubin_state rs; 299 struct rubin_state rs;
301 300
302 init_pushpull(&rs.pp, cdata_in, srclen, 0, 0); 301 init_pushpull(&rs.pp, cdata_in, srclen, 0, 0);
303 init_decode(&rs, bit_divider, bits); 302 init_decode(&rs, bit_divider, bits);
304 303
305 while (outpos < destlen) { 304 while (outpos < destlen) {
306 page_out[outpos++] = in_byte(&rs); 305 page_out[outpos++] = in_byte(&rs);
307 } 306 }
308} 307}
309 308
310 309
311static int jffs2_rubinmips_decompress(unsigned char *data_in, 310static int jffs2_rubinmips_decompress(unsigned char *data_in,