32#include "../../port/port.h"
46#include "../lzx_compress/lzx_config.h"
47#include "../lzx_compress/lzx_compress.h"
49#define PACKAGE_STRING "hhpcomp development version"
63 const char *metaname,
int sect_id,
95static int _entry_cmp(
const void *pva,
const void *pvb);
129 0x7b, 0x37, 0x46, 0x43, 0x32, 0x38, 0x39,
130 0x34, 0x30, 0x2d, 0x39, 0x44, 0x33, 0x31,
131 0x2d, 0x31, 0x31, 0x44, 0x30 };
369 BUG_ON(
"FIXME: %s: %d\n", __FILE__, __LINE__);
379 int i,
j,
k, name_len;
382 namelist[
k++] =
len >> 1;
388 namelist[
k++] = name_len;
389 for(
j=0;
j < name_len;
j++ )
456 BUG_ON(
"FIXME: %s: %d\n", __FILE__, __LINE__);
564 if (!
s || *
s ==
'\0')
580 BUG_ON(
"FIXME: %s: %d: handle more chunk for strings\n",
632 return (
char *)
d +
len;
674 const char *entry_val;
689 entry_val = chm->
config->deftopic;
691 entry_val =
"index.htm";
696 entry_val = chm->
config->title;
698 entry_val =
"untitled";
703 strlen(
"siec_lcasefile")+1);
705 "MsdnHelp",
strlen(
"MsdnHelp")+1);
717 system->_size = (
char *)
p - (
char *)sysp;
782 chm->
idxhdr.num_of_topic++;
786 BUG_ON(
"FIXME: %s: %d\n", __FILE__, __LINE__);
841 BUG_ON(
"FIXME: %s: %d\n", __FILE__, __LINE__);
875 BUG_ON(
"FIXME: %s: %d\n", __FILE__, __LINE__);
943 if ((wsize_code < 15) || (wsize_code > 21)) {
944 fprintf(
stderr,
"window size must be between 15 and 21 inclusive\n");
953 lzx_info.
pos =
chm->entries_list.next;
961 lzx_info.
section->reset_table_header.block_count++;
994 return lzx_info->
error || lzx_info->
done >= lzx_info->
todo || lzx_info->
eof;
1019 chmc_dump(
"Aligned data at %d(in compressed stream, %d) (%lu/%lu)\n",
1020 uncomp, comp, (
unsigned long)lzx_info->
done, (
unsigned long)lzx_info->
todo );
1024 section->reset_table_header.block_count++;
1028 section->reset_table_header.uncompressed_len = uncomp;
1029 section->reset_table_header.compressed_len = comp;
1062 lzx_info->
pos = lzx_info->
pos->next;
1070 if (lzx_info->
fd == -1) {
1073 if (lzx_info->
fd < 0) {
1077 lzx_info->
error = 1;
1101 lzx_info->
error = 2;
1109 lzx_info->
done += rx;
1113 if (lzx_info->
fd > -1)
1117 lzx_info->
pos = lzx_info->
pos->next;
1188 chmc_add_dir(chm,
"::DataSpace/Storage/MSCompressed/Transform/"
1189 "{7FC28940-9D31-11D0-9B27-00A0C91E9C7C}/InstanceData/");
1190 chmc_add_meta(chm,
"::DataSpace/Storage/MSCompressed/Transform/"
1191 "{7FC28940-9D31-11D0-9B27-00A0C91E9C7C}"
1192 "/InstanceData/ResetTable",
1197 if (uncompressed_len) {
1198 *uncompressed_len = reset_table->uncompressed_len;
1199 chmc_add_meta(chm,
"::DataSpace/Storage/MSCompressed/SpanInfo",
1200 0, (
UChar *)uncompressed_len, 8);
1237 return strcmp( &
a->name[
a->prefixlen], &
b->name[
b->prefixlen] );
1253 if ((
node->buf) && (
node->len > 0)) {
1286 int should_idx, idx_intlv;
1323 should_idx = ( (
chunk->entries_count > 0 )
1324 && ! ( (
chunk->entries_count + 1 ) % idx_intlv )
1331 if (outlen + should_idx >
free) {
1346 *
idx = (
char *)
p - (
char *)&
chunk->data;
1359 chunk->entries_count++;
1360 chunk->header.free_space -= outlen;
1405 node->index_len = 0;
1413 chunk->header.unknown_0008 = 0;
1414 chunk->header.block_prev = -1;
1415 chunk->header.block_next = -1;
1427 node->index_len = 0;
1518 if (name_len <= 255) {
1520 name[name_len] =
'\0';
1524 BUG_ON(
"name_len >= 255(%lu) %.*s\n", (
unsigned long)name_len, 255,
1542 int should_idx, idx_intlv;
1570 should_idx = ( (
chunk->entries_count > 0 )
1571 && ! ( (
chunk->entries_count + 1 ) % idx_intlv )
1578 if (outlen + should_idx >
free) {
1592 *
idx = (
char *)
p - (
char *)&
chunk->data;
1603 chunk->entries_count++;
1604 chunk->header.free_space -= outlen;
1665 struct stat statbuf;
char * strcat(char *DstString, const char *SrcString)
int strcmp(const char *String1, const char *String2)
ACPI_SIZE strlen(const char *String)
#define list_for_each(entry, head)
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
#define _CHMC_ITSP_V1_LEN
#define _CHMC_LZXC_RESETTABLE_V1_LEN
#define _CHMC_LZXC_V2_LEN
#define _CHMC_ITSF_V3_LEN
int chmc_appendfile(struct chmcFile *chm, const char *filename, void *buf, size_t size)
struct chmcTreeNode * chmc_add_dir(struct chmcFile *chm, const char *dir)
int chmc_namelist_create(struct chmcFile *chm, int len)
int chmc_add_tree(struct chmcFile *chm, const char *dir)
void chmc_reset_table_init(struct chmcLzxcResetTable *reset_table)
static void _lzx_mark_frame(void *arg, uint32_t uncomp, uint32_t comp)
void chmc_pmgi_destroy(struct chmcPmgiChunkNode *node)
void chmc_term(struct chmcFile *chm)
static int _lzx_get_bytes(void *arg, int n, void *buf)
void chmc_pmgl_add(struct chmcFile *chm, struct chmcPmglChunkNode *pmgl)
int chmc_compressed_add_mark(struct chmcFile *chm, UInt64 at)
int chmc_write(struct chmcFile *chm)
static void * chmc_syscat_mem(void *d, void *s, unsigned long len)
int chmc_crunch_lzx(struct chmcFile *chm, int sect_id)
void chmc_string_init(struct chmcStringChunk *node)
int chmc_reset_table_done(struct chmcFile *chm)
void chmc_pmgl_free(struct chmcFile *chm)
void chmc_sections_free(struct chmcFile *chm)
void chmc_pmgl_destroy(struct chmcPmglChunkNode *node)
int chmc_tree_done(struct chmcFile *chm)
void chmc_control_data_init(struct chmcLzxcControlData *control_data)
struct chmcTreeNode * chmc_add_empty(struct chmcFile *chm, const char *file)
static int _lzx_put_bytes(void *arg, int n, void *buf)
void chmc_pmgl_init(struct chmcPmglChunkNode *node)
static int _entry_cmp(const void *pva, const void *pvb)
struct chmcPmglChunkNode * chmc_pmgl_create(void)
void chmc_pmgi_init(struct chmcPmgiChunkNode *node)
int chmc_init(struct chmcFile *chm, const char *filename, struct chmcConfig *config)
struct chmcTreeNode * chmc_add_meta(struct chmcFile *chm, const char *metaname, int sect_id, UChar *buf, UInt64 len)
void chmc_pmgi_add(struct chmcFile *chm, struct chmcPmgiChunkNode *pmgi)
int chmc_pmgi_add_entry(struct chmcFile *chm, const char *name, int pmgl_id)
struct chmcPmgiChunkNode * chmc_pmgi_create(void)
int chmc_uncompressed_done(struct chmcFile *chm)
static const short chmc_transform_list[]
void chmc_entries_qsort(struct chmcFile *chm)
void chmc_entries_free(struct chmcFile *chm)
struct chmcTreeNode * chmc_add_file(struct chmcFile *chm, const char *filename, UInt16 prefixlen, int sect_id, UChar *buf, UInt64 len)
void chmc_sections_done(struct chmcFile *chm)
int chmc_pmgi_done(struct chmcFile *chm)
int chmc_pmgl_add_entry(struct chmcFile *chm, struct chmcTreeNode *entry)
void chmc_entry_destroy(struct chmcTreeNode *node)
int chmc_section_add(struct chmcFile *chm, const char *name)
int chmc_control_data_done(struct chmcFile *chm)
struct chmcSection * chmc_section_create(struct chmcFile *chm, const char *name)
int chmc_system_done(struct chmcFile *chm)
struct chmcSection * chmc_section_lookup(struct chmcFile *chm, int id)
static void * chmc_syscat_entry(Int16 code, void *d, void *s, Int16 len)
void chmc_pmgi_free(struct chmcFile *chm)
UInt32 chmc_strings_add(struct chmcFile *chm, const char *s)
struct chmcTreeNode * chmc_add_entry(struct chmcFile *chm, const char *name, UInt16 prefixlen, int sect_id, UChar *buf, UInt64 offset, UInt64 len)
void chmc_pmgl_done(struct chmcFile *chm)
void chmc_section_destroy(struct chmcSection *section)
static int _lzx_at_eof(void *arg)
#define _CHMC_RSTTBL_MARK
#define _CHMC_SYSTEM_HDR_LEN
#define CHMC_MS_LCID_EN_US
#define CHMC_PMGL_DATA_LEN
#define CHMC_PMGI_DATA_LEN
#define chmc_dump(fmt,...)
#define INIT_LIST_HEAD(ptr)
#define list_entry(ptr, type, member)
#define list_for_each_safe(pos, n, head)
static void list_del(struct list_head *entry)
static int chmc_encint(const UInt32 val, UChar *out)
static int chmc_decint(const UChar *in, UInt32 *value)
static int chmc_encint_len(const UInt32 val)
GLdouble GLdouble GLdouble GLdouble q
GLboolean GLboolean GLboolean b
GLenum GLuint GLenum GLsizei const GLchar * buf
GLboolean GLboolean GLboolean GLboolean a
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static DWORD block_size(DWORD block)
int lzx_finish(struct lzx_data *lzxd, struct lzx_results *lzxr)
int lzx_init(struct lzx_data **lzxdp, int wsize_code, lzx_get_bytes_t get_bytes, void *get_bytes_arg, lzx_at_eof_t at_eof, lzx_put_bytes_t put_bytes, void *put_bytes_arg, lzx_mark_frame_t mark_frame, void *mark_frame_arg)
int lzx_compress_block(lzx_data *lzxd, int block_size, int subdivide)
void lzx_reset(lzx_data *lzxd)
#define memcpy(s1, s2, n)
struct task_struct * current
#define sprintf(buf, format,...)
int mkstemps(char *template, int suffix_len)
const char * strerror(int err)
int __cdecl system(_In_opt_z_ const char *_Command)
_Check_return_ _CRTIMP char *__cdecl strdup(_In_opt_z_ const char *_Src)
void __cdecl qsort(_Inout_updates_bytes_(_NumOfElements *_SizeOfElements) void *_Base, _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(const void *, const void *))
static char tmpdir[MAX_PATH]
struct list_head entries_list
struct chmcSection ** sections
struct chmcItsfHeader itsf
struct chmcConfig * config
struct chmcPmglChunkNode * pmgl_last
struct chmcTreeNode ** sort_entries
struct list_head pmgl_list
struct chmcIndexHeader idxhdr
struct chmcPmgiChunkNode * pmgi_last
struct chmcItspHeader itsp
struct list_head sections_list
struct list_head pmgi_list
struct chmcSection * section
struct chmcPmgiChunk chunk
struct chmcPmglChunk chunk
struct chmcLzxcControlData control_data