blob: d8072b027862b109be34be318a2ffd692e032851 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#ifndef __LZMA_H__
2#define __LZMA_H__
3
4#ifdef LING
5 //#include <linux/kernel.h>
6 //#include <linux/sched.h>
7 //#include <linux/slab.h>
8 //#include <linux/vmalloc.h>
9 //#include <linux/init.h>
10 #include <linux/types.h>
11 #include <errno.h>
12 #define LZMA_MALLOC vmalloc
13 #define LZMA_FREE vfree
14 #define PRINT_ERROR(msg) printk(msg)
15 #define INIT __init
16 #define STATIC static
17#else
18 #include <stdint.h>
19 //#include <stdlib.h>
20 //#include <stdio.h>
21 //#include <unistd.h>
22 //#include <string.h>
23 #include <asm/types.h>
24 #include <errno.h>
25 //#include <linux/jffs2.h>
26 #ifndef PAGE_SIZE
27 extern int page_size;
28 #define PAGE_SIZE page_size
29 #endif
30 #define LZMA_MALLOC malloc
31 #define LZMA_FREE free
32 #define PRINT_ERROR(msg) printf(msg)//fprintf(stderr, msg)
33 #define INIT
34 #define STATIC
35#endif
36
37#include "lzma/LzmaDec.h"
38#include "lzma/LzmaEnc.h"
39
40#define LZMA_BEST_LEVEL (9)
41#define LZMA_BEST_LC (0)
42#define LZMA_BEST_LP (0)
43#define LZMA_BEST_PB (0)
44#define LZMA_BEST_FB (273)
45
46#define LZMA_BEST_DICT(n) (((int)((n) / 2)) * 2)
47
48static void *p_lzma_malloc(void *p, size_t size)
49{
50 if (size == 0)
51 return NULL;
52
53 return LZMA_MALLOC(size);
54}
55
56static void p_lzma_free(void *p, void *address)
57{
58 if (address != NULL)
59 LZMA_FREE(address);
60}
61
62static ISzAlloc lzma_alloc = {p_lzma_malloc, p_lzma_free};
63
64#endif