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 <unistd.h>
|
||||
#include <getopt.h>
|
||||
#define __USE_LARGEFILE64
|
||||
#define _LARGEFILE_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
#include <sys/stat.h>
|
||||
#include "lzma_c/LZMAEncoderApi.h"
|
||||
|
||||
@@ -91,8 +94,8 @@ unsigned preprocess_calltrick(unsigned char *infile, unsigned insize, unsigned c
|
||||
unsigned tmp;
|
||||
while (buf_ptr != buf) {
|
||||
buf_ptr -= 8;
|
||||
memcpy(&tmp, *buf_ptr, 4);
|
||||
memcpy(tmp - 4, cti, 1);
|
||||
memcpy(&tmp, buf_ptr, 4);
|
||||
memcpy((unsigned char*)(size_t)(tmp - 4), cti, 1);
|
||||
}
|
||||
free(buf);
|
||||
return tmp;
|
||||
@@ -235,6 +238,10 @@ int main(int argc, char *argv[])
|
||||
unsigned ctn;
|
||||
unsigned char cti;
|
||||
|
||||
unsigned prep_ct_res1 = preprocess_calltrick(infile_buf, infile_size, ct1, &ctn, &cti);
|
||||
|
||||
// if (....)
|
||||
|
||||
// TODO ...
|
||||
|
||||
return 0;
|
||||
|
@@ -1,6 +1,8 @@
|
||||
#ifndef LZMA_ENCODER_API_H_
|
||||
#define LZMA_ENCODER_API_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
void __stdcall lzma_set_dict_size(unsigned logdictsize);
|
||||
|
||||
unsigned __stdcall lzma_compress(
|
||||
|
@@ -17,6 +17,10 @@
|
||||
// #define true 1
|
||||
// #define false 0
|
||||
|
||||
#ifndef __stdcall
|
||||
#define __stdcall __attribute__((stdcall))
|
||||
#endif
|
||||
|
||||
typedef uint8_t byte;
|
||||
typedef uint16_t word;
|
||||
typedef uint64_t uint64;
|
||||
|
Reference in New Issue
Block a user