made it compile on gcc linux 64. segfault in preprocess calltrick todo fix
This commit is contained in:
11
kpack_c.c
11
kpack_c.c
@@ -5,6 +5,9 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
#define __USE_LARGEFILE64
|
||||||
|
#define _LARGEFILE_SOURCE
|
||||||
|
#define _LARGEFILE64_SOURCE
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include "lzma_c/LZMAEncoderApi.h"
|
#include "lzma_c/LZMAEncoderApi.h"
|
||||||
|
|
||||||
@@ -91,8 +94,8 @@ unsigned preprocess_calltrick(unsigned char *infile, unsigned insize, unsigned c
|
|||||||
unsigned tmp;
|
unsigned tmp;
|
||||||
while (buf_ptr != buf) {
|
while (buf_ptr != buf) {
|
||||||
buf_ptr -= 8;
|
buf_ptr -= 8;
|
||||||
memcpy(&tmp, *buf_ptr, 4);
|
memcpy(&tmp, buf_ptr, 4);
|
||||||
memcpy(tmp - 4, cti, 1);
|
memcpy((unsigned char*)(size_t)(tmp - 4), cti, 1);
|
||||||
}
|
}
|
||||||
free(buf);
|
free(buf);
|
||||||
return tmp;
|
return tmp;
|
||||||
@@ -235,6 +238,10 @@ int main(int argc, char *argv[])
|
|||||||
unsigned ctn;
|
unsigned ctn;
|
||||||
unsigned char cti;
|
unsigned char cti;
|
||||||
|
|
||||||
|
unsigned prep_ct_res1 = preprocess_calltrick(infile_buf, infile_size, ct1, &ctn, &cti);
|
||||||
|
|
||||||
|
// if (....)
|
||||||
|
|
||||||
// TODO ...
|
// TODO ...
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
#ifndef LZMA_ENCODER_API_H_
|
#ifndef LZMA_ENCODER_API_H_
|
||||||
#define LZMA_ENCODER_API_H_
|
#define LZMA_ENCODER_API_H_
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
void __stdcall lzma_set_dict_size(unsigned logdictsize);
|
void __stdcall lzma_set_dict_size(unsigned logdictsize);
|
||||||
|
|
||||||
unsigned __stdcall lzma_compress(
|
unsigned __stdcall lzma_compress(
|
||||||
|
@@ -17,6 +17,10 @@
|
|||||||
// #define true 1
|
// #define true 1
|
||||||
// #define false 0
|
// #define false 0
|
||||||
|
|
||||||
|
#ifndef __stdcall
|
||||||
|
#define __stdcall __attribute__((stdcall))
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef uint8_t byte;
|
typedef uint8_t byte;
|
||||||
typedef uint16_t word;
|
typedef uint16_t word;
|
||||||
typedef uint64_t uint64;
|
typedef uint64_t uint64;
|
||||||
|
Reference in New Issue
Block a user