input stringlengths 16 454k | output stringlengths 13 350k | function_name stringlengths 1 100 | repo_name stringlengths 6 43 | category stringclasses 76
values | sample_id stringlengths 22 88 | decompiler stringclasses 1
value | opt_level stringclasses 1
value |
|---|---|---|---|---|---|---|---|
void *tt_aligned_alloc(const ssize_t size) {
caddr_t a;
a = (caddr_t)mmap(0, size, 3, 34, -1, 0);
if (a == (caddr_t)-1LL) {
perror("Error mmap()ing anonymous memory chunk");
exit(-1);
}
return a;
} | static void *tt_aligned_alloc(const ssize_t size) {
caddr_t a;
a = TIO_mmap((caddr_t)0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON,
-1, (TIO_off_t)0);
if (a == MAP_FAILED) {
perror("Error " xstr(TIO_mmap) "()ing anonymous memory chunk");
exit(-1);
}
return a;
} | tt_aligned_alloc | tiobench-0.5.0 | app-benchmarks | O0/app-benchmarks/tiobench-0.5.0/tiotest | ida | O0 |
void tt_aligned_free(caddr_t a, const ssize_t size) { munmap(a, size); } | static void tt_aligned_free(caddr_t a, const ssize_t size) { munmap(a, size); } | tt_aligned_free | tiobench-0.5.0 | app-benchmarks | O0/app-benchmarks/tiobench-0.5.0/tiotest | ida | O0 |
unsigned long tv_to_usec(const timeval *v) {
return 1000000 * v->tv_sec + v->tv_usec;
} | static unsigned long long tv_to_usec(const struct timeval *v) {
return v->tv_sec * (1000 * 1000) + v->tv_usec;
} | tv_to_usec | tiobench-0.5.0 | app-benchmarks | O0/app-benchmarks/tiobench-0.5.0/tiotest | ida | O0 |
void update_latency_info(Latencies *lat, timeval tv_start, timeval tv_stop) {
double value;
value = (double)(LODWORD(tv_stop.tv_usec) - LODWORD(tv_start.tv_usec)) /
1000000.0 +
(double)(LODWORD(tv_stop.tv_sec) - LODWORD(tv_start.tv_sec));
if (value > lat->max)
lat->max = value;
lat-... | static void update_latency_info(Latencies *lat, struct timeval tv_start,
struct timeval tv_stop) {
double value;
value = tv_stop.tv_sec - tv_start.tv_sec;
value += (tv_stop.tv_usec - tv_start.tv_usec) / 1000000.0;
if (value > lat->max)
lat->max = value;
lat->avg += value;... | update_latency_info | tiobench-0.5.0 | app-benchmarks | O0/app-benchmarks/tiobench-0.5.0/tiotest | ida | O0 |
void wait_for_threads(ThreadTest *d) {
int i;
for (i = 0; i < d->numThreads; ++i)
pthread_join(d->threads[i].thread, 0);
} | static void wait_for_threads(ThreadTest *d) {
int i;
for (i = 0; i < d->numThreads; i++)
pthread_join(d->threads[i].thread, NULL);
} | wait_for_threads | tiobench-0.5.0 | app-benchmarks | O0/app-benchmarks/tiobench-0.5.0/tiotest | ida | O0 |
lzo_bool alloc_mem(unsigned int s1, unsigned int s2, unsigned int w) {
lzo_bool ra;
lzo_bool rb;
int r;
ra = mb_alloc(blocks, s1, 0x1000u) & 1;
rb = mb_alloc(&blocks[1], s2, 0x1000u) & ra;
r = mb_alloc(&wrkmem, w, 0x1000u) & rb;
if (!r)
free_mem();
return r;
} | static lzo_bool alloc_mem(lzo_uint32 s1, lzo_uint32 s2, lzo_uint32 w) {
lzo_bool r = 1;
r &= mb_alloc(&blocks[0], s1, ALIGN_SIZE);
r &= mb_alloc(&blocks[1], s2, ALIGN_SIZE);
r &= mb_alloc(&wrkmem, w, ALIGN_SIZE);
if (!r)
free_mem();
return r;
} | alloc_mem | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
lzo_bool can_restore_name(file_t *ft, const header_t *h) {
return h->name[0] && ft->opt_name && ft->opt_name > 0;
} | static lzo_bool can_restore_name(file_t *ft, const header_t *h) {
if (h->name[0] == 0 || ft->opt_name == 0)
return 0;
else if (ft->opt_name > 0)
return 1;
#ifdef OPT_NAME_DEFAULT
#if 1
else
return 1;
#else
else if ((h->flags & F_NAME_DEFAULT))
return 1;
else
return 0;
#endif
#else
else... | can_restore_name | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
int check_magic(const unsigned char *magic) {
const unsigned char *m;
if (!memcmp(magic, lzop_magic, 9u))
return 0;
if (memcmp(magic + 1, &lzop_magic[1], 3u) && memcmp(magic + 1, "LZO", 3u))
return 1;
if (magic[4])
return 1;
m = magic + 5;
if (!memcmp(magic + 5, &unk_10091, 3u))
return 7;
... | static int check_magic(const unsigned char *magic) {
const unsigned char *m;
if (memcmp(magic, lzop_magic, sizeof(lzop_magic)) == 0)
return 0;
if (memcmp(&magic[1], &lzop_magic[1], 3) != 0 &&
memcmp(&magic[1], "LZO", 3) != 0)
return 1;
if (magic[4] != lzop_magic[4])
return 1;
m = &magic[... | check_magic | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void check_not_both(lzo_bool e1, lzo_bool e2, int c1, int c2) {
if (e1) {
if (e2) {
fprintf(stderr, "%s: ", argv0);
fprintf(stderr, "cannot use both '-%c' and '-%c'\n", (unsigned int)c1,
(unsigned int)c2);
e_usage();
}
}
} | static void check_not_both(lzo_bool e1, lzo_bool e2, int c1, int c2) {
if (e1 && e2) {
fprintf(stderr, "%s: ", argv0);
fprintf(stderr, "cannot use both '-%c' and '-%c'\n", c1, c2);
e_usage();
}
} | check_not_both | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void check_options(int i, int argc) {
_BOOL4 v2;
if (i > argc)
__assert_fail("i <= argc", "src/lzop.c", 0x873u, "check_options");
if (opt_keep)
opt_unlink = 0;
if (opt_cmd != 1 && opt_cmd != 2)
opt_unlink = 0;
if (opt_stdin == 1)
opt_stdin = i == argc;
if (opt_stdin) {
opt_unlink = 0;
... | void check_options(int i, int argc) {
assert(i <= argc);
if (opt_keep)
opt_unlink = 0;
if (!(opt_cmd == CMD_COMPRESS || opt_cmd == CMD_DECOMPRESS))
opt_unlink = 0;
if (opt_stdin == OPT_STDIN_GUESSED && i != argc)
opt_stdin = 0;
if (opt_stdin) {
opt_unlink = 0;
#if 0
opt_stdo... | check_options | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
lzo_bool check_stdin(file_t *ft) {
if (opt_force || !acc_isatty(0))
return 1;
*(_QWORD *)ft->name = 0x3E6E696474733CLL;
if (opt_cmd == 1)
fatal(ft, "uncompressed data not read from a terminal");
else
fatal(ft, "compressed data not read from a terminal");
return 0;
} | static lzo_bool check_stdin(file_t *ft) {
if (!opt_force && acc_isatty(STDIN_FILENO)) {
strcpy(ft->name, STDIN_NAME);
if (opt_cmd == CMD_COMPRESS)
fatal(ft, "uncompressed data not read from a terminal");
else
fatal(ft, "compressed data not read from a terminal");
return 0;
}
return 1;
... | check_stdin | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
lzo_bool check_stdout(file_t *ft) {
if (opt_cmd != 1 && opt_cmd != 2)
return 1;
if (opt_force || !acc_isatty(1))
return 1;
strcpy(ft->name, "<stdout>");
if (opt_cmd == 1)
fatal(ft, "compressed data not written to a terminal");
else
fatal(ft, "uncompressed data not written to a terminal");
re... | static lzo_bool check_stdout(file_t *ft) {
if (!(opt_cmd == CMD_COMPRESS || opt_cmd == CMD_DECOMPRESS))
return 1;
if (!opt_force && acc_isatty(STDOUT_FILENO)) {
strcpy(ft->name, STDOUT_NAME);
if (opt_cmd == CMD_COMPRESS)
fatal(ft, "compressed data not written to a terminal");
else
fatal(... | check_stdout | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void con_fprintf(FILE *f, const char *format, ...) {
long v2;
long v3;
long v4;
long v5;
va_list args;
char s[2008];
unsigned long v8;
long v9;
long v10;
long v11;
long v12;
va_start(args, format);
v2 = va_arg(args, _QWORD);
v3 = va_arg(args, _QWORD);
v4 = va_arg(args, _QWORD);
v5 = va_... | void con_fprintf(FILE *f, const char *format, ...) {
va_list args;
char s[80 * 25];
va_start(args, format);
#if defined(HAVE_VSNPRINTF)
vsnprintf(s, sizeof(s), format, args);
#else
vsprintf(s, format, args);
#endif
s[sizeof(s) - 1] = 0;
va_end(args);
if (con == me)
init(f, -1, -1);
assert(con !=... | con_fprintf | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void copy_perms() {
utimbuf u;
unsigned long v1;
v1 = __readfsqword(0x28u);
u.actime = fi.st.st_atim.tv_sec;
u.modtime = fi.st.st_mtim.tv_sec;
if (utime(fo.name, &u))
p_warn(&fo, "can't copy file time");
fo.st.st_mode = fi.st.st_mode;
if (chmod(fo.name, fi.st.st_mode))
p_warn(&fo, "can't copy f... | static void copy_perms(void) {
#if defined(HAVE_UTIME)
struct utimbuf u;
u.actime = fi.st.st_atime;
u.modtime = fi.st.st_mtime;
if (utime(fo.name, &u) != 0)
p_warn(&fo, "can't copy file time");
#endif
#if defined(HAVE_CHMOD)
fo.st.st_mode = fi.st.st_mode;
if (chmod(fo.name, fo.st.st_mode) != 0)
p_... | copy_perms | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
lzo_bool do_compress(const char *name, lzo_bool handle_perms) {
lzo_bool ok;
header_t header;
unsigned long v5;
v5 = __readfsqword(0x28u);
if (!p_open_fi(name))
return 0;
if (p_open_fo(0)) {
ok = x_compress(&fi, &fo, &header);
if (!ok)
return 0;
if (handle_perms) {
if (!p_close(... | static lzo_bool do_compress(const char *name, lzo_bool handle_perms) {
lzo_bool ok = 1;
header_t header;
if (!p_open_fi(name))
return 0;
if (!p_open_fo(NULL)) {
if (opt_output_name || opt_stdout)
e_exit(EXIT_ERROR);
return 0;
}
ok = x_compress(&fi, &fo, &header);
if (!ok)
return 0;... | do_compress | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
lzo_bool do_decompress(const char *name, lzo_bool handle_perms) {
lzo_bool ok;
lzo_bool unlink_ok;
_BOOL4 skip;
int r;
header_t header;
unsigned long v8;
v8 = __readfsqword(0x28u);
ok = 1;
unlink_ok = 1;
skip = 0;
if (!p_open_fi(name))
return 0;
while (1) {
if (!ok)
return ok && u... | static lzo_bool do_decompress(const char *name, lzo_bool handle_perms) {
lzo_bool ok = 1;
lzo_bool unlink_ok = 1;
lzo_bool skip = 0;
header_t header;
int r;
if (!p_open_fi(name))
return 0;
for (; ok; fi.part++) {
r = p_magic(&fi);
if (r > 0)
return 0;
if (fi.part == 0)
total_... | do_decompress | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void do_error(file_t *ft, const char *n, const char *msg, int ec, int err) {
char *name;
char *errmsg;
fflush(con_term);
if (ec != 2 || !opt_nowarn && !opt_ignorewarn && opt_verbose) {
if (ft && ft->name[0])
name = ft->name;
else
name = "<unknown>";
fprintf(stderr, "%s%s: %s: ", n, prog... | static void do_error(file_t *ft, const char *n, const char *msg, int ec,
int err) {
const char *fn;
const char *errmsg;
fflush(con_term);
if (!(ec == EXIT_WARN &&
(opt_nowarn || opt_ignorewarn || opt_verbose == 0))) {
fn = ft && ft->name[0] ? ft->name : UNKNOWN_NAME;
fprint... | do_error | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void do_exit() {
if (in_exit_24)
exit(exit_code);
in_exit_24 = 1;
fflush(con_term);
fflush(stderr);
exit(exit_code);
} | static void do_exit(void) {
static lzo_bool in_exit = 0;
if (in_exit)
exit(exit_code);
in_exit = 1;
fflush(con_term);
fflush(stderr);
exit(exit_code);
} | do_exit | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void do_files(int i, int argc, char **argv) {
int ia;
lzo_bool handle_perms;
ia = i;
if (opt_cmd == 1)
handle_perms = opt_stdin == 0;
else
handle_perms = opt_cmd == 2;
if (!opt_stdin)
goto LABEL_15;
if (!opt_stdout && !opt_output_name && !opt_output_path)
__assert_fail("opt_stdout || opt_... | static void do_files(int i, int argc, char *argv[]) {
lzo_bool handle_perms;
if (opt_cmd == CMD_COMPRESS)
handle_perms = !opt_stdin;
else if (opt_cmd == CMD_DECOMPRESS)
handle_perms = 1;
else
handle_perms = 0;
if (opt_stdin) {
assert(opt_stdout || opt_output_name || opt_output_path);
ass... | do_files | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void do_info(const header_t *h, unsigned long d_len, unsigned long c_len) {
int v;
FILE *f;
v = opt_verbose;
f = stdout;
opt_verbose = 2;
++total_d_files;
do_list(h, d_len, c_len);
--total_d_files;
opt_verbose = v;
fwrite(" ", 1u, 3u, f);
print_version(f, h->version);
fputc(32, f);
print_ve... | void do_info(const header_t *h, lzop_ulong_t d_len, lzop_ulong_t c_len) {
int v = opt_verbose;
FILE *f;
f = stdout;
opt_verbose = 2;
++total_d_files;
do_list(h, d_len, c_len);
--total_d_files;
opt_verbose = v;
fprintf(f, " ");
print_version(f, h->version);
fprintf(f, " ");
print_version(f, h... | do_info | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void do_list(const header_t *h, unsigned long d_len, unsigned long c_len) {
char *v3;
time_t t;
FILE *f;
char s[40];
unsigned long v8;
v8 = __readfsqword(0x28u);
f = stdout;
s[0] = 0;
t = get_mtime(h);
if (!total_d_files && opt_verbose > 0) {
if (opt_verbose <= 2) {
if (opt_verbose <= 1) ... | void do_list(const header_t *h, lzop_ulong_t d_len, lzop_ulong_t c_len) {
FILE *f;
char s[40];
time_t t;
f = stdout;
s[0] = 0;
t = get_mtime(h);
if (total_d_files == 0 && opt_verbose > 0) {
if (opt_verbose >= 3)
((void)0);
else if (opt_verbose >= 2) {
fprintf(f, "Method Lengt... | do_list | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void do_list_total() {
FILE *f;
if (total_d_files > 1 && opt_verbose && opt_verbose <= 2) {
f = stdout;
if (opt_verbose <= 1) {
fprintf(stdout, "%-11s ", &n);
pr_size(f, total_c_len, total_d_len, 0);
fprintf(f, " (totals -- %lu files)\n", total_d_files);
} else {
fwrite(" ... | void do_list_total(void) {
FILE *f;
if (total_d_files < 2 || opt_verbose == 0)
return;
if (opt_verbose >= 3)
return;
f = stdout;
if (opt_verbose >= 2) {
fprintf(f, " ------- ------- ----- ");
fprintf(f, " ----\n");
fprintf(f, "%-11s ", "");
pr_size(f... | do_list_total | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void do_ls(const header_t *h, unsigned long d_len, unsigned long c_len) {
char *v3;
char *v4;
time_t t;
const char *name;
FILE *f;
char s[40];
unsigned long v9;
v9 = __readfsqword(0x28u);
if (fo.name[0])
v3 = fo.name;
else
v3 = "<unknown>";
name = v3;
f = stdout;
t = get_mtime(h);
i... | void do_ls(const header_t *h, lzop_ulong_t d_len, lzop_ulong_t c_len) {
FILE *f;
char s[40];
time_t t;
const char *name = fo.name[0] ? fo.name : UNKNOWN_NAME;
f = stdout;
t = get_mtime(h);
if (t == 0)
time(&t);
fprintf(f, "%-10s 1", modestr(h->mode));
if (opt_stdin)
fprintf(f, " %-8s", "use... | do_ls | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
lzo_bool do_one_file(const char *name, lzo_bool handle_perms) {
lzo_bool ok;
if (opt_cmd == 1)
ok = do_compress(name, handle_perms);
else
ok = do_decompress(name, handle_perms);
if (!p_close(1, 0))
ok = 0;
if (opt_file && !p_close(0, 1))
ok = 0;
if (ok) {
if (opt_unlink) {
chmod(f... | static lzo_bool do_one_file(const char *name, lzo_bool handle_perms) {
lzo_bool ok;
if (opt_cmd == CMD_COMPRESS)
ok = do_compress(name, handle_perms);
else
ok = do_decompress(name, handle_perms);
if (!p_close(1, 0))
ok = 0;
if (opt_file && !p_close(0, 1))
ok = 0;
if (ok && opt_unlink) {
#... | do_one_file | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
int do_option(acc_getopt_t *g, int optc) {
int v2;
int v3;
const char *v4;
int result;
int i;
if (optc > 527)
goto LABEL_87;
if (optc >= 512) {
switch (optc) {
case 512:
opt_console = 1;
break;
case 513:
opt_console = 2;
break;
case 514:
opt_console = 3;
... | static int do_option(acc_getopt_p g, int optc) {
#define mfx_optarg g->optarg
int i = 0;
int m = -1;
switch (optc) {
case 'c':
opt_stdout = 1;
break;
case 'C':
opt_checksum = (opt_checksum >= 1) ? opt_checksum + 1 : 1;
opt_decompress_safe = 1;
break;
case 'd':
set_cmd(CMD_DECOMPRESS... | do_option | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void do_test(const header_t *h, unsigned long d_len, unsigned long c_len) {
++total_d_files;
total_c_len += c_len;
total_d_len += d_len;
} | void do_test(const header_t *h, lzop_ulong_t d_len, lzop_ulong_t c_len) {
total_d_files++;
total_c_len += c_len;
total_d_len += d_len;
UNUSED(h);
} | do_test | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void do_test_total() {
const char *v0;
FILE *f;
if ((total_c_files > 1 || total_d_files > 1) && opt_verbose > 1) {
f = stderr;
if (total_c_files == 1)
v0 = " was";
else
v0 = "s were";
fprintf(stderr, "%lu file%s successfully tested", total_c_files, v0);
if (total_c_files != total_... | void do_test_total(void) {
FILE *f;
if ((total_c_files < 2 && total_d_files < 2) || opt_verbose < 2)
return;
f = stderr;
fprintf(f, "%lu file%s successfully tested", total_c_files,
total_c_files == 1 ? " was" : "s were");
if (total_c_files != total_d_files)
fprintf(f, " [containing %lu fil... | do_test_total | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void e_envopt(const char *n) {
fflush(con_term);
if (n)
fprintf(stderr, "%s: invalid string '%s' in environment variable '%s'\n",
argv0, n, "LZOP");
else
fprintf(stderr, "%s: illegal option in environment variable '%s'\n", argv0,
"LZOP");
e_exit(1);
} | void e_envopt(const char *n) {
fflush(con_term);
if (n)
fprintf(stderr, "%s: invalid string '%s' in environment variable '%s'\n",
argv0, n, OPTIONS_VAR);
else
fprintf(stderr, "%s: illegal option in environment variable '%s'\n", argv0,
OPTIONS_VAR);
e_exit(EXIT_USAGE);
} | e_envopt | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void e_exit(int ec) {
set_ec(ec);
do_exit();
} | void e_exit(int ec) {
(void)set_ec(ec);
do_exit();
} | e_exit | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void e_help() {
if (opt_pgm == 2) {
if (opt_stdin)
check_stdin(&fi);
if (opt_stdout)
check_stdout(&fo);
usage();
} else {
help();
}
e_exit(1);
} | void e_help(void) {
if (opt_pgm == PGM_LZOP)
help();
else if (opt_pgm == PGM_UNLZOP)
help();
else if (opt_pgm == PGM_OCAT) {
if (opt_stdin)
check_stdin(&fi);
if (opt_stdout)
check_stdout(&fo);
usage();
} else
help();
e_exit(EXIT_USAGE);
} | e_help | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void e_memory() {
head();
fflush(con_term);
fprintf(stderr, "%s: out of memory\n", argv0);
e_exit(1);
} | void e_memory(void) {
head();
fflush(con_term);
fprintf(stderr, "%s: out of memory\n", argv0);
e_exit(EXIT_MEMORY);
} | e_memory | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void e_method(int m) {
fflush(con_term);
fprintf(stderr, "%s: illegal method option -- %c\n", argv0, (unsigned char)m);
e_usage();
} | void e_method(int m) {
fflush(con_term);
#if (UINT_MAX < LZO_0xffffffffL)
fprintf(stderr, "%s: 16-bit versions are not officially supported\n", argv0);
#endif
fprintf(stderr, "%s: illegal method option -- %c\n", argv0, m & 255);
e_usage();
} | e_method | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void e_usage() {
usage();
e_exit(1);
} | void e_usage(void) {
usage();
e_exit(EXIT_USAGE);
} | e_usage | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void error(file_t *ft, const char *msg) { do_error(ft, err_nl, msg, 1, 0); } | void error(file_t *ft, const char *msg) {
do_error(ft, err_nl, msg, EXIT_ERROR, 0);
} | error | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
int f_close(file_t *ft) {
int result;
if (ft->fd < 0)
return 0;
if (ft->fd <= 2u)
return 0;
result = close(ft->fd);
ft->fd = -1;
return result;
} | int f_close(file_t *ft) {
int r;
if (ft->fd < 0)
return 0;
if (ft->fd == STDIN_FILENO || ft->fd == STDOUT_FILENO ||
ft->fd == STDERR_FILENO)
return 0;
#if defined(USE_FOPEN)
assert(ft->file != NULL);
r = fclose(ft->file);
ft->file = NULL;
#else
r = close(ft->fd);
#endif
ft->fd = -1;
ret... | f_close | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void f_init() {
memset(&fi, 0, sizeof(fi));
memset(&fo, 0, sizeof(fo));
fi.fd = -1;
fo.fd = -1;
f_reset(&fi);
f_reset(&fo);
} | void f_init(void) {
memset(&fi, 0, sizeof(file_t));
memset(&fo, 0, sizeof(file_t));
fi.fd = -1;
fo.fd = -1;
#if defined(USE_FOPEN)
fi.file = NULL;
fo.file = NULL;
#endif
f_reset(&fi);
f_reset(&fo);
} | f_init | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
int f_open(file_t *ft, lzo_bool r) {
int v2;
if (!ft->name[0])
__assert_fail("ft->name[0]", "src/lzop.c", 0x165u, "f_open");
ft->fd = -1;
if (r)
v2 = open(ft->name, ft->open_flags, 0);
else
v2 = open(ft->name, ft->open_flags, ft->st.st_mode);
ft->fd = v2;
if (ft->fd <= 2u) {
fatal(ft, "sa... | int f_open(file_t *ft, lzo_bool r) {
assert(ft->name[0]);
ft->fd = -1;
#if defined(O_BINARY)
ft->open_flags |= O_BINARY;
#endif
#if (ACC_OS_WIN32 || ACC_OS_WIN64) && defined(_O_SEQUENTIAL)
ft->open_flags |= _O_SEQUENTIAL;
#endif
#if defined(USE_FOPEN)
ft->file = NULL;
if (r)
ft->file = fopen(ft->name, "... | f_open | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
lzo_int f_read(file_t *ft, void *buf, lzo_int cnt) {
long cnta;
cnta = read_buf(ft, buf, cnt);
if (cnta > 0) {
ft->f_adler32 = lzo_adler32(ft->f_adler32, buf, cnta);
ft->f_crc32 = lzo_crc32(ft->f_crc32, buf, cnta);
}
return cnta;
} | static lzo_int f_read(file_t *ft, lzo_voidp buf, lzo_int cnt) {
cnt = read_buf(ft, buf, cnt);
if (cnt > 0) {
ft->f_adler32 = lzo_adler32(ft->f_adler32, (const lzo_bytep)buf, cnt);
ft->f_crc32 = lzo_crc32(ft->f_crc32, (const lzo_bytep)buf, cnt);
}
return cnt;
} | f_read | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void f_read16(file_t *ft, unsigned int *v) {
unsigned char b[2];
unsigned long v3;
v3 = __readfsqword(0x28u);
if (read_buf(ft, b, 2) != 2)
read_error(ft);
ft->f_adler32 = lzo_adler32(ft->f_adler32, b, 2);
ft->f_crc32 = lzo_crc32(ft->f_crc32, b, 2);
*v = get_be16(b);
} | static void f_read16(file_t *ft, unsigned *v) {
unsigned char b[2];
if (read_buf(ft, b, 2) != 2)
read_error(ft);
ft->f_adler32 = lzo_adler32(ft->f_adler32, b, 2);
ft->f_crc32 = lzo_crc32(ft->f_crc32, b, 2);
*v = get_be16(b);
} | f_read16 | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void f_read32(file_t *ft, unsigned int *v) {
unsigned char b[4];
unsigned long v3;
v3 = __readfsqword(0x28u);
if (read_buf(ft, b, 4) != 4)
read_error(ft);
ft->f_adler32 = lzo_adler32(ft->f_adler32, b, 4);
ft->f_crc32 = lzo_crc32(ft->f_crc32, b, 4);
*v = get_be32(b);
} | static void f_read32(file_t *ft, lzo_uint32 *v) {
unsigned char b[4];
if (read_buf(ft, b, 4) != 4)
read_error(ft);
ft->f_adler32 = lzo_adler32(ft->f_adler32, b, 4);
ft->f_crc32 = lzo_crc32(ft->f_crc32, b, 4);
*v = get_be32(b);
} | f_read32 | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
int f_read8(file_t *ft, unsigned char *b) {
unsigned char bb;
unsigned long v4;
v4 = __readfsqword(0x28u);
if (read_buf(ft, &bb, 1) != 1)
read_error(ft);
ft->f_adler32 = lzo_adler32(ft->f_adler32, &bb, 1);
ft->f_crc32 = lzo_crc32(ft->f_crc32, &bb, 1);
if (b)
*b = bb;
return bb;
} | static int f_read8(file_t *ft, unsigned char *b) {
unsigned char bb;
if (read_buf(ft, &bb, 1) != 1)
read_error(ft);
ft->f_adler32 = lzo_adler32(ft->f_adler32, &bb, 1);
ft->f_crc32 = lzo_crc32(ft->f_crc32, &bb, 1);
if (b)
*b = bb;
return bb;
} | f_read8 | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void f_reset(file_t *ft) {
ft->opt_name = opt_name;
ft->part = 0;
ft->bytes_read = 0;
ft->bytes_written = 0;
ft->warn_multipart = 0;
ft->warn_unknown_suffix = 0;
} | void f_reset(file_t *ft) {
ft->opt_name = opt_name;
ft->part = 0;
ft->bytes_read = 0;
ft->bytes_written = 0;
ft->warn_multipart = 0;
ft->warn_unknown_suffix = 0;
} | f_reset | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void f_write(file_t *ft, const void *buf, lzo_int cnt) {
if (cnt > 0) {
write_buf(ft, buf, cnt);
ft->f_adler32 = lzo_adler32(ft->f_adler32, buf, cnt);
ft->f_crc32 = lzo_crc32(ft->f_crc32, buf, cnt);
}
} | static void f_write(file_t *ft, const lzo_voidp buf, lzo_int cnt) {
if (cnt > 0) {
write_buf(ft, buf, cnt);
ft->f_adler32 = lzo_adler32(ft->f_adler32, (const lzo_bytep)buf, cnt);
ft->f_crc32 = lzo_crc32(ft->f_crc32, (const lzo_bytep)buf, cnt);
}
} | f_write | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void f_write16(file_t *ft, unsigned int v) {
unsigned char b[2];
unsigned long v3;
v3 = __readfsqword(0x28u);
set_be16(b, v);
write_buf(ft, b, 2);
ft->f_adler32 = lzo_adler32(ft->f_adler32, b, 2);
ft->f_crc32 = lzo_crc32(ft->f_crc32, b, 2);
} | static void f_write16(file_t *ft, unsigned v) {
unsigned char b[2];
set_be16(b, v);
write_buf(ft, b, 2);
ft->f_adler32 = lzo_adler32(ft->f_adler32, b, 2);
ft->f_crc32 = lzo_crc32(ft->f_crc32, b, 2);
} | f_write16 | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void f_write32(file_t *ft, unsigned int v) {
unsigned char b[4];
unsigned long v3;
v3 = __readfsqword(0x28u);
set_be32(b, v);
write_buf(ft, b, 4);
ft->f_adler32 = lzo_adler32(ft->f_adler32, b, 4);
ft->f_crc32 = lzo_crc32(ft->f_crc32, b, 4);
} | static void f_write32(file_t *ft, lzo_uint32 v) {
unsigned char b[4];
set_be32(b, v);
write_buf(ft, b, 4);
ft->f_adler32 = lzo_adler32(ft->f_adler32, b, 4);
ft->f_crc32 = lzo_crc32(ft->f_crc32, b, 4);
} | f_write32 | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void f_write8(file_t *ft, int v) {
unsigned char b;
unsigned long v3;
v3 = __readfsqword(0x28u);
b = v;
write_buf(ft, &b, 1);
ft->f_adler32 = lzo_adler32(ft->f_adler32, &b, 1);
ft->f_crc32 = lzo_crc32(ft->f_crc32, &b, 1);
} | static void f_write8(file_t *ft, int v) {
unsigned char b = (unsigned char)v;
write_buf(ft, &b, 1);
ft->f_adler32 = lzo_adler32(ft->f_adler32, &b, 1);
ft->f_crc32 = lzo_crc32(ft->f_crc32, &b, 1);
} | f_write8 | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void fatal(file_t *ft, const char *msg) { do_error(ft, err_nl, msg, 3, 0); } | void fatal(file_t *ft, const char *msg) {
do_error(ft, err_nl, msg, EXIT_FATAL, 0);
} | fatal | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
lzo_bool file_exists(const char *name) {
int fd;
stat st;
unsigned long v4;
v4 = __readfsqword(0x28u);
fd = open(name, 0, 0);
if (fd < 0) {
return stat(name, &st) != -1 || lstat(name, &st) != -1;
} else {
close(fd);
return 1;
}
} | lzo_bool file_exists(const char *name) {
int fd, r;
struct stat st;
fd = open(name, O_RDONLY, 0);
if (fd >= 0) {
(void)close(fd);
return 1;
}
r = stat(name, &st);
if (r != -1)
return 1;
#if defined(HAVE_LSTAT)
r = lstat(name, &st);
if (r != -1)
return 1;
#endif
return 0;
} | file_exists | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
mode_t fix_mode_for_chmod(unsigned int mode) {
unsigned int m;
m = mode & 0xFFF;
if ((mode & 0x1FF) == 0)
m |= ~(_WORD)u_mask & 0x1A4;
return m;
} | MODE_T fix_mode_for_chmod(lzo_uint32 mode) {
MODE_T m = (MODE_T)(mode & 07777);
if ((m & 0777) == 0)
m |= (MODE_T)(0644 & ~u_mask);
return m;
} | fix_mode_for_chmod | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
unsigned int fix_mode_for_header(unsigned int mode) {
unsigned int m;
if (!mode)
return 0;
if ((mode & 0xF000) != 0x8000 && (mode & 0xF000) != 0x4000)
__assert_fail("S_ISREG(mode) || S_ISDIR(mode)", "src/util.c", 0x152u,
"fix_mode_for_header");
m = mode & 0xFFF;
if ((mode & 0xF000) ... | lzo_uint32 fix_mode_for_header(lzo_uint32 mode) {
lzo_uint32 m = mode;
if (mode == 0)
return 0;
assert(S_ISREG(mode) || S_ISDIR(mode));
#if defined(ACC_OS_TOS) && defined(__PUREC__)
m = 0444;
if (mode & S_IWRITE)
m |= 0200;
if (mode & S_IEXEC)
m |= 0111;
if (S_ISREG(mode))
m |= 0100000 ... | fix_mode_for_header | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
mode_t fix_mode_for_ls(unsigned int mode) {
unsigned int m;
m = mode;
if ((mode & 0x1FF) == 0)
return ~(_WORD)u_mask & 0x1A4 | mode;
return m;
} | MODE_T fix_mode_for_ls(lzo_uint32 mode) {
MODE_T m = (MODE_T)mode;
if ((m & 0777) == 0)
m |= (MODE_T)(0644 & ~u_mask);
return m;
} | fix_mode_for_ls | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
mode_t fix_mode_for_open(mode_t mode) {
mode_t m;
m = mode & 0x1B6;
if ((mode & 0x1B6) == 0)
m |= ~(_WORD)u_mask & 0x1A4;
return m | 0x180;
} | MODE_T fix_mode_for_open(MODE_T mode) {
MODE_T m = (MODE_T)(mode & 0666);
#if defined(ACC_OS_TOS) && defined(__PUREC__)
m = S_IWRITE | S_IREAD;
#else
if ((m & 0777) == 0)
m |= (MODE_T)(0644 & ~u_mask);
m |= 0600;
#endif
return m;
} | fix_mode_for_open | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
time_t fix_time(time_t t) {
time_t ta;
ta = t;
if (t == -1)
return 0;
return ta;
} | time_t fix_time(time_t t) {
if (t == (time_t)-1)
t = 0;
return t;
} | fix_time | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void fn_addslash(char *name, lzo_bool slash) {
char *v2;
char *v3;
char *p;
for (p = &name[strlen(name)]; p > name && strchr("/", *(p - 1)); --p) {
v2 = p;
*v2 = 0;
}
if (p > name) {
if (slash) {
v3 = p++;
*v3 = 47;
}
*p = 0;
}
} | void fn_addslash(char *name, lzo_bool slash) {
char *p;
name = fn_skip_drive(name);
p = name + strlen(name);
while (p > name && fn_is_sep(p[-1]))
*p-- = 0;
if (p > name) {
if (slash)
*p++ = dir_sep[0];
*p = 0;
}
} | fn_addslash | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
unsigned int fn_baseindex(const char *name) {
int n;
const char *nn;
n = (int)name;
for (nn = name; *nn; ++nn) {
if (strchr("/", *nn))
n = (_DWORD)nn + 1;
}
return n - (_DWORD)name;
} | unsigned fn_baseindex(const char *name) {
const char *n, *nn;
n = fn_skip_drive(name);
for (nn = n; *nn; nn++)
if (fn_is_sep(*nn))
n = nn + 1;
return (unsigned)(n - name);
} | fn_baseindex | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
const char *fn_basename(const char *name) { return &name[fn_baseindex(name)]; } | const char *fn_basename(const char *name) { return name + fn_baseindex(name); } | fn_basename | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
int fn_cleanpath(const char *name, char *newname, size_t size, int flags) {
size_t v4;
size_t v6;
size_t v7;
char *v8;
size_t v9;
char flagsa;
int slashes;
size_t l;
size_t n;
size_t last_n;
flagsa = flags;
l = 0;
n = 0;
slashes = 0;
while (*name && strchr("/", *name))
++name;
while... | int fn_cleanpath(const char *name, char *newname, size_t size, int flags) {
size_t l = 0;
size_t n = 0;
int slashes = 0;
#define add(x) \
if (l >= size) \
return -1; ... | fn_cleanpath | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
int fn_has_suffix(const char *name) {
size_t l;
size_t s;
l = strlen(name);
if (l <= 4 || name[l - 4] != 46)
goto LABEL_24;
if (!strcasecmp(&name[l - 3], "lzo"))
return 1;
if (!strcasecmp(&name[l - 3], "nrv"))
return 3;
if (!strcasecmp(&name[l - 3], "tar"))
return 4;
if (!strcasecmp(&na... | int fn_has_suffix(const char *name) {
size_t l;
size_t s;
name = fn_skip_drive(name);
l = strlen(name);
if (l > 4 && name[l - 4] == '.') {
if (strcasecmp(&name[l - 3], "lzo") == 0)
return SUFF_LZO;
if (strcasecmp(&name[l - 3], "nrv") == 0)
return SUFF_NRV;
if (strcasecmp(&name[l - 3],... | fn_has_suffix | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
lzo_bool fn_is_same_file(const char *n1, const char *n2) {
return fn_strcmp(n1, n2) == 0;
} | lzo_bool fn_is_same_file(const char *n1, const char *n2) {
if (fn_strcmp(n1, n2) == 0)
return 1;
return 0;
} | fn_is_same_file | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
int fn_strcmp(const char *n1, const char *n2) {
while (1) {
if (*n1 != *n2 && *n1 != *n2)
return *n1 - *n2;
if (!*n1)
break;
++n1;
++n2;
}
return 0;
} | int fn_strcmp(const char *n1, const char *n2) {
for (;;) {
if (*n1 != *n2) {
int c = fn_tolower(*n1) - fn_tolower(*n2);
if (c)
return c;
}
if (*n1 == 0)
return 0;
n1++;
n2++;
}
} | fn_strcmp | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
char *fn_strlwr(char *n) {
char *p;
for (p = n; *p; ++p)
*p = *p;
return n;
} | char *fn_strlwr(char *n) {
char *p;
for (p = n; *p; p++)
*p = (char)fn_tolower(*p);
return n;
} | fn_strlwr | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void free_mem() {
mb_free(&wrkmem);
mb_free(&blocks[1]);
mb_free(blocks);
} | static void free_mem(void) {
mb_free(&wrkmem);
mb_free(&blocks[1]);
mb_free(&blocks[0]);
} | free_mem | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
char ftypelet(unsigned int mode) {
switch (mode & 0xF000) {
case 0x8000u:
return 45;
case 0x4000u:
return 100;
case 0x6000u:
return 98;
case 0x2000u:
return 99;
case 0x1000u:
return 112;
case 0xA000u:
return 108;
case 0xC000u:
return 115;
}
return 63;
} | static char ftypelet(unsigned mode) {
if (S_ISREG(mode))
return '-';
if (S_ISDIR(mode))
return 'd';
#ifdef S_ISBLK
if (S_ISBLK(mode))
return 'b';
#endif
#ifdef S_ISCHR
if (S_ISCHR(mode))
return 'c';
#endif
#ifdef S_ISFIFO
if (S_ISFIFO(mode))
return 'p';
#endif
#ifdef S_ISLNK
if (S_ISLNK(... | ftypelet | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
unsigned int get_be16(const unsigned char *b) { return (*b << 8) | b[1]; } | static unsigned get_be16(const unsigned char *b) {
unsigned v;
v = (unsigned)b[1] << 0;
v |= (unsigned)b[0] << 8;
return v;
} | get_be16 | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
unsigned int get_be32(const unsigned char *b) {
return _byteswap_ulong(*(_DWORD *)b);
} | static lzo_uint32 get_be32(const unsigned char *b) {
lzo_uint32 v;
v = (lzo_uint32)b[3] << 0;
v |= (lzo_uint32)b[2] << 8;
v |= (lzo_uint32)b[1] << 16;
v |= (lzo_uint32)b[0] << 24;
return v;
} | get_be32 | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void get_envoptions(int argc, char **argv) {
size_t v2;
int v3;
char *v4;
int i;
int nargc;
int nargca;
int optc;
char *p;
char *pa;
char **nargv;
const char *env;
char *enva;
acc_getopt_t mfx_getopt;
char shortopts[136];
unsigned long v16;
v16 = __readfsqword(0x28u);
nargv = 0;
env... | static void get_envoptions(int argc, char **argv) {
static const struct acc_getopt_longopt_t longopts[] = {
{"best", 0, 0, '9'},
{"checksum", 0, 0, 'C'},
{"crc32", 0x10, 0, 527},
{"delete", 0, 0, 'U'},
{"fast", 0, 0, '1'},
{"ignore-warn", 0, 0, 526},
{"keep", 0, 0, 'k'},
... | get_envoptions | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
time_t get_mtime(const header_t *h) { return *(_QWORD *)&h->mtime_low; } | time_t get_mtime(const header_t *h) {
lzop_ulong_t t;
t = h->mtime_high;
t <<= 16;
t <<= 16;
t |= h->mtime_low;
return t == (lzop_ulong_t)(time_t)t ? (time_t)t : (time_t)0;
} | get_mtime | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
int get_options(int argc, char **argv) {
int i;
int ia;
int optc;
acc_getopt_t mfx_getopt;
char shortopts[136];
unsigned long v8;
v8 = __readfsqword(0x28u);
prepare_shortopts(shortopts, "123456789hH?PVp::", longopts_4);
acc_getopt_init(&mfx_getopt, 1, argc, argv);
mfx_getopt.progname = argv0;
mfx... | static int get_options(int argc, char **argv) {
static const struct acc_getopt_longopt_t longopts[] = {
{"best", 0, 0, '9'},
{"decompress", 0, 0, 'd'},
{"fast", 0, 0, '1'},
{"help", 0, 0, 'h' + 256},
{"info", 0, 0, 'i' + 256},
{"license", 0, 0, 'L'},
{"list", 0, 0, 'l'},
... | get_options | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
unsigned long get_ratio(unsigned long d_len, unsigned long c_len) {
unsigned long n1;
unsigned long n2;
n1 = 1000000;
n2 = 1;
if (d_len) {
while (n1 > 1 && c_len > 0xFFFFFFFFFFFFFFFFLL / n1) {
n1 /= 0xAu;
n2 *= 10LL;
}
return n1 * c_len / (d_len / n2);
} else if (c_len) {
return... | static unsigned long get_ratio(lzop_ulong_t d_len, lzop_ulong_t c_len) {
unsigned long n1 = 1000L * 1000L;
unsigned long n2 = 1;
const lzop_ulong_t umax = ~((lzop_ulong_t)0);
if (d_len <= 0)
return c_len <= 0 ? 0ul : n1;
while (n1 > 1 && c_len > (umax / n1)) {
n1 /= 10;
n2 *= 10;
}
return (un... | get_ratio | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void handle_opterr(acc_getopt_t *g, const char *f, void *v) {
fprintf(stderr, "%s: ", g->progname);
if (v)
vfprintf(stderr, f, (__va_list_tag *)v);
else
fwrite("UNKNOWN GETOPT ERROR", 1u, 0x14u, stderr);
fputc(10, stderr);
} | static void handle_opterr(acc_getopt_p g, const char *f, void *v) {
struct A {
va_list ap;
};
struct A *a = (struct A *)v;
fprintf(stderr, "%s: ", g->progname);
if (a)
vfprintf(stderr, f, a->ap);
else
fprintf(stderr, "UNKNOWN GETOPT ERROR");
fprintf(stderr, "\n");
} | handle_opterr | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void head() {
int fg;
FILE *f;
f = con_term;
if (!head_done) {
head_done = 1;
fg = con->set_fg(con_term, 2);
con_fprintf(f,
" Lempel-Ziv-Oberhumer Packer\n"
" Copyright (C) 1996 - 2017\n"
"lzop v%-11s... | void head(void) {
FILE *f = con_term;
int fg;
if (head_done)
return;
head_done = 1;
fg = con_fg(f, FG_GREEN);
con_fprintf(f,
" Lempel-Ziv-Oberhumer Packer\n"
" Copyright (C) 1996 - 2017\n"
"lzop v%-11s Markus... | head | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void help() {
int fg;
int fga;
FILE *f;
f = con_term;
head();
usage();
con_fprintf(f, "\n");
fg = con->set_fg(f, 14);
con_fprintf(f, "Commands:\n");
con->set_fg(f, fg);
con_fprintf(
f, " -1 compress faster -9 compress better\n"
" -d decompress ... | void help(void) {
FILE *f = con_term;
int fg;
#ifdef OPT_NAME_DEFAULT
const char *dn = "";
const char *dN = " (default)";
#else
const char *dn = " (default)";
const char *dN = "";
#endif
head();
usage();
con_fprintf(f, "\n");
fg = con_fg(f, FG_YELLOW);
con_fprintf(f, "Commands:\n");
fg = con_... | help | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void info(file_t *ft, const char *msg) { do_error(ft, err_nl, msg, 0, 0); } | void info(file_t *ft, const char *msg) {
do_error(ft, err_nl, msg, EXIT_OK, 0);
} | info | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void init_compress_header(header_t *h, const file_t *fip, const file_t *fop) {
unsigned int v3;
unsigned int flags;
unsigned int v5;
unsigned int v6;
unsigned int v7;
int r;
const char *n;
char newname[264];
unsigned long v12;
v12 = __readfsqword(0x28u);
if (opt_method <= 0)
__assert_fail("op... | void init_compress_header(header_t *h, const file_t *fip, const file_t *fop) {
assert(opt_method > 0);
assert(opt_level > 0);
assert(fip->st.st_mode == 0 || S_ISREG(fip->st.st_mode));
memset(h, 0, sizeof(header_t));
h->version = LZOP_VERSION & 0xffff;
h->version_needed_to_extract = opt_filter ? 0x0950 : 0... | init_compress_header | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void license() {
FILE *f;
f = con_term;
head();
con_fprintf(
f,
" lzop and the LZO library are free software; you can redistribute "
"them\n"
" and/or modify them under the terms of the GNU General Public License "
"as\n"
" published by the Free Software Foundation; ei... | void license(void) {
FILE *f = con_term;
head();
con_fprintf(
f,
" lzop and the LZO library are free software; you can redistribute "
"them\n"
" and/or modify them under the terms of the GNU General Public License "
"as\n"
" published by the Free Software Foundation; ei... | license | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
lzo_bool lzo_compress(file_t *fip, file_t *fop, const header_t *h) {
unsigned int v3;
int r;
int d_adler32;
unsigned int d_crc32;
unsigned int src_len;
unsigned int c_adler32;
unsigned int c_crc32;
lzo_uint dst_len;
lzo_uint new_len;
unsigned char *b1;
unsigned char *b2;
lzo_int l;
unsigned lo... | lzo_bool lzo_compress(file_t *fip, file_t *fop, const header_t *h) {
int r = LZO_E_OK;
lzo_bytep const b1 = blocks[0].mb_mem;
lzo_bytep const b2 = blocks[1].mb_mem;
lzo_uint32 src_len = 0;
lzo_uint dst_len = 0;
lzo_uint32 c_adler32 = ADLER32_INIT_VALUE, d_adler32 = ADLER32_INIT_VALUE;
lzo_uint32 c_crc32 =... | lzo_compress | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
lzo_bool lzo_decompress(file_t *fip, file_t *fop, const header_t *h,
lzo_bool skip) {
lzo_bool v4;
lzo_int buf;
unsigned int src_len;
unsigned int dst_len;
unsigned int c_adler32;
unsigned int d_adler32;
unsigned int c_crc32;
unsigned int d_crc32;
int r;
lzo_bool ok;
lzo_bo... | lzo_bool lzo_decompress(file_t *fip, file_t *fop, const header_t *h,
lzo_bool skip) {
int r;
lzo_uint32 src_len, dst_len;
lzo_uint32 c_adler32 = ADLER32_INIT_VALUE, d_adler32 = ADLER32_INIT_VALUE;
lzo_uint32 c_crc32 = CRC32_INIT_VALUE, d_crc32 = CRC32_INIT_VALUE;
lzo_bool ok = 1;
lzo... | lzo_decompress | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
lzo_bool lzo_enter(const header_t *h) {
unsigned int wrk_len;
if (!h) {
if (opt_method == 1) {
wrk_len = 0x20000;
} else if (opt_method == 2) {
wrk_len = 0x40000;
} else if (opt_method == 3) {
wrk_len = 458752;
} else {
wrk_len = 0;
}
if (opt_method == 3) {
if ... | lzo_bool lzo_enter(const header_t *h) {
int r;
lzo_uint32 wrk_len;
#if defined(WITH_THREADS)
if (opt_num_threads > 1)
return lzo_threaded_enter(h);
#endif
if (h != NULL) {
r = 1;
if ((h->flags & F_ADLER32_C) && !(h->flags & F_ADLER32_D)) {
r = 0;
assert(h->flags & F_ADLER32_D);
}
... | lzo_enter | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
int lzo_get_method(header_t *h) {
switch (h->method) {
case 1u:
h->method_name = "LZO1X-1";
if (!h->level)
h->level = 3;
break;
case 2u:
h->method_name = "LZO1X-1(15)";
if (!h->level)
h->level = 1;
break;
case 3u:
s_3[9] = 0;
if (h->level) {
if (h->version > 0x9... | int lzo_get_method(header_t *h) {
if (h->method == M_LZO1X_1) {
h->method_name = "LZO1X-1";
if (h->level == 0)
h->level = 3;
} else if (h->method == M_LZO1X_1_15) {
h->method_name = "LZO1X-1(15)";
if (h->level == 0)
h->level = 1;
} else if (h->method == M_LZO1X_999) {
static char ... | lzo_get_method | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void lzo_init_compress_header(header_t *h) {
unsigned int flags;
unsigned int v2;
if (opt_checksum) {
if (opt_crc32) {
flags = h->flags;
BYTE1(flags) |= 1u;
h->flags = flags;
if (opt_checksum > 1) {
v2 = h->flags;
BYTE1(v2) |= 2u;
h->flags = v2;
}
} e... | void lzo_init_compress_header(header_t *h) {
if (opt_checksum) {
if (opt_crc32) {
h->flags |= F_CRC32_D;
if (opt_checksum >= 2)
h->flags |= F_CRC32_C;
} else {
h->flags |= F_ADLER32_D;
if (opt_checksum >= 2)
h->flags |= F_ADLER32_C;
}
}
} | lzo_init_compress_header | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void lzo_leave(const header_t *h) {
if (!h)
free_mem();
} | void lzo_leave(const header_t *h) {
#if defined(WITH_THREADS)
if (opt_num_threads > 1) {
lzo_threaded_leave(h);
return;
}
#endif
if (h == NULL)
free_mem();
} | lzo_leave | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
int lzo_set_method(int m, int level) {
int ma;
int l;
ma = m;
l = (unsigned char)level;
if (m || !(_BYTE)level || (unsigned char)level > 9u)
return -1;
if ((unsigned char)level == 1) {
ma = 2;
} else if ((unsigned char)level <= 6u) {
ma = 1;
l = 5;
}
if (l > 6)
ma = 3;
if (!ma)
... | int lzo_set_method(int m, int level) {
int l = level & 0xff;
if (m != 0 || l < 1 || l > 9)
return -1;
#if defined(USE_LZO1X_1_15)
if (l == 1)
m = M_LZO1X_1_15;
else
#endif
#if defined(USE_LZO1X_1)
if (l <= 6) {
m = M_LZO1X_1;
l = 5;
}
#endif
#if defined(USE_LZO1X_999)
if (l >= 7 && l... | lzo_set_method | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
int main(int argc, const char **argv, const char **envp) {
time_t v3;
__sighandler_t v4;
int v5;
int result;
char **argva;
int argca;
lzo_bool foreground;
int cmdline_cmd;
int i;
argca = argc;
argva = (char **)argv;
foreground = 0;
cmdline_cmd = 0;
acc_wildargv(&argca, &argva);
sanity_che... | int __acc_cdecl_main main(int argc, char *argv[]) {
int i;
lzo_bool foreground = 0;
static char default_argv0[] = "lzop";
int cmdline_cmd = CMD_NONE;
#if (ACC_OS_WIN32 || ACC_OS_WIN64) && (ACC_CC_MSC) && \
defined(_WRITE_ABORT_MSG) && defined(_CALL_REPORTFAULT)
_set_abort_behavio... | main | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
lzo_bool mb_alloc(mblock_t *m, unsigned int size, unsigned int align) {
unsigned char *mb_mem_alloc;
do_init_0(m, size, align);
if (!m->mb_size)
return 1;
m->mb_size_alloc = m->mb_size + m->mb_align - 1;
m->mb_mem_alloc = (unsigned char *)acc_halloc(m->mb_size_alloc);
if (!m->mb_mem_alloc)
return 0... | lzo_bool mb_alloc(mblock_p m, lzo_uint32 size, lzo_uint32 align) {
do_init(m, size, align);
if (m->mb_size == 0)
return 1;
m->mb_size_alloc = m->mb_size + m->mb_align - 1;
m->mb_mem_alloc = (lzo_bytep)acc_halloc(m->mb_size_alloc);
if (m->mb_mem_alloc == NULL)
return 0;
acc_hmemset(m->mb_mem_alloc, ... | mb_alloc | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void mb_free(mblock_t *m) {
acc_hfree(m->mb_mem_alloc);
memset(m, 0, sizeof(mblock_t));
} | void mb_free(mblock_p m) {
acc_hfree(m->mb_mem_alloc);
memset(m, 0, sizeof(*m));
} | mb_free | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void mode_string(mode_t m, char *str) {
*str = ftypelet(m);
set_rwx((m >> 6) & 7, str + 1);
set_rwx((m >> 3) & 7, str + 4);
set_rwx(m & 7, str + 7);
set_st(m, str);
} | void mode_string(MODE_T m, char *str) {
unsigned mode = (unsigned)m;
str[0] = ftypelet(mode);
set_rwx((mode & 0700) >> 6, &str[1]);
set_rwx((mode & 0070) >> 3, &str[4]);
set_rwx((mode & 0007) >> 0, &str[7]);
set_st(mode, str);
} | mode_string | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
char *modestr(unsigned int mode) {
mode_t fixed;
fixed = fix_mode_for_ls(mode);
mode_string(fixed, s_15);
s_15[0] = 45;
byte_1A7EA = 0;
return s_15;
} | static char *modestr(lzo_uint32 mode) {
static char s[10 + 1];
mode_string(fix_mode_for_ls(mode), s);
s[0] = '-';
s[10] = 0;
return s;
} | modestr | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
lzo_bool oname_error() {
if (opt_force > 1 || opt_cmd == 3) {
warn(&fi, "can't determine name of output file -- using default");
return 1;
} else {
if (opt_name == 1)
error(&fi, "can't determine name of output file (use option '-o')");
else
error(&fi, "can't determine name of output file... | static lzo_bool oname_error(void) {
if (opt_force >= 2 || opt_cmd == CMD_TEST) {
warn(&fi, "can't determine name of output file -- using default");
return 1;
}
if (opt_name != 1)
error(&fi, "can't determine name of output file (try option '-N')");
else
error(&fi, "can't determine name of output ... | oname_error | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
lzo_bool open_stdin(file_t *ft) {
__ino_t st_ino;
long v3;
__dev_t st_rdev;
__blksize_t st_blksize;
__time_t tv_sec;
__time_t v7;
__time_t v8;
__syscall_slong_t v9;
__syscall_slong_t v10;
stat st;
unsigned long v12;
v12 = __readfsqword(0x28u);
if (ft->fd != -1)
__assert_fail("ft->fd == -1... | static lzo_bool open_stdin(file_t *ft) {
#if !defined(NO_SETMODE)
static lzo_bool setmode_done = 0;
#endif
assert(ft->fd == -1);
f_reset(ft);
strcpy(ft->name, STDIN_NAME);
ft->fd = STDIN_FILENO;
#if !defined(NO_SETMODE)
if (!setmode_done) {
if (acc_set_binmode(ft->fd, 1) == -1) {
p_fatal(ft, "a... | open_stdin | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
lzo_bool open_stdout(file_t *ft) {
if (ft->fd != -1)
__assert_fail("ft->fd == -1", "src/lzop.c", 0x634u, "open_stdout");
f_reset(ft);
strcpy(ft->name, "<stdout>");
if (opt_cmd == 1 || opt_cmd == 2) {
ft->fd = 1;
if (setmode_done_10 || acc_set_binmode(ft->fd, 1) != -1) {
setmode_done_10 = 1;
... | static lzo_bool open_stdout(file_t *ft) {
#if !defined(NO_SETMODE)
static lzo_bool setmode_done = 0;
#endif
assert(ft->fd == -1);
f_reset(ft);
strcpy(ft->name, STDOUT_NAME);
if (!(opt_cmd == CMD_COMPRESS || opt_cmd == CMD_DECOMPRESS)) {
ft->fd = -2;
return 1;
}
ft->fd = STDOUT_FILENO;
#if !defi... | open_stdout | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
lzo_bool p_close(int i, int o) {
lzo_bool r;
r = 1;
if (i && f_close(&fi)) {
p_error(&fi, "can't close input file");
r = 0;
}
if (o && f_close(&fo)) {
p_error(&fo, "can't close output file");
return 0;
}
return r;
} | static lzo_bool p_close(int i, int o) {
int r = 1;
if (i && f_close(&fi) != 0) {
p_error(&fi, "can't close input file");
r = 0;
}
if (o && f_close(&fo) != 0) {
p_error(&fo, "can't close output file");
r = 0;
}
return r;
} | p_close | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void p_error(file_t *ft, const char *msg) {
int v2;
v2 = *__errno_location();
do_error(ft, err_nl, msg, 1, v2);
} | void p_error(file_t *ft, const char *msg) {
do_error(ft, err_nl, msg, EXIT_ERROR, errno);
} | p_error | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void p_fatal(file_t *ft, const char *msg) {
int v2;
v2 = *__errno_location();
do_error(ft, err_nl, msg, 3, v2);
} | void p_fatal(file_t *ft, const char *msg) {
do_error(ft, err_nl, msg, EXIT_FATAL, errno);
} | p_fatal | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
lzo_bool p_header(file_t *ft, header_t *h) {
int r;
int ra;
r = read_header(ft, h);
if (!r)
return 1;
if (r >= 0) {
if (r > 18)
__assert_fail("r > 0 && r <= 18", "src/lzop.c", 0x3E1u, "p_header");
error(ft, header_error[r]);
return 0;
} else {
ra = -r;
if (ra <= 0 || ra > 18)
... | static lzo_bool p_header(file_t *ft, header_t *h) {
int r;
r = read_header(ft, h);
if (r == 0)
return 1;
if (r < 0) {
r = -r;
assert(r > 0 && r <= 18);
error(ft, header_error[r]);
return 1;
} else {
assert(r > 0 && r <= 18);
error(ft, header_error[r]);
return 0;
}
} | p_header | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
int p_magic(file_t *ft) {
unsigned char b;
int r;
lzo_int l;
unsigned char magic[9];
unsigned long v6;
v6 = __readfsqword(0x28u);
l = read_buf(ft, magic, 9);
if (ft->part && l <= 0)
return -1;
if (l == 9)
r = check_magic(magic);
else
r = 1;
if (r < 0)
__assert_fail("r >= 0", "src/... | static int p_magic(file_t *ft) {
int r;
lzo_int l;
unsigned char magic[sizeof(lzop_magic)];
l = read_buf(ft, magic, sizeof(magic));
if (ft->part > 0 && l <= 0)
return -1;
if (l == (lzo_int)sizeof(magic))
r = check_magic(magic);
else
r = 1;
assert(r >= 0);
if (ft->part > 0 && r == 1) {
#if... | p_magic | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
lzo_bool p_open_fi(const char *name) {
int suff;
int r;
int saved_errno;
if (fi.fd != -1)
return 1;
f_reset(&fi);
if (!name)
__assert_fail("name != NULL", "src/lzop.c", 0x660u, "p_open_fi");
if (strlen(name) <= 0xFFF) {
strcpy(fi.name, name);
fn_strlwr(fi.name);
if (opt_cmd == 1) {
... | lzo_bool p_open_fi(const char *name) {
int r, saved_errno;
#if defined(HAVE_LSTAT) && defined(S_ISLNK)
int r2;
#endif
if (fi.fd != -1)
return 1;
f_reset(&fi);
assert(name != NULL);
if (strlen(name) >= PATH_MAX) {
if (strlen(name) >= sizeof(fi.name))
strcpy(fi.name, UNKNOWN_NAME);
else
... | p_open_fi | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
lzo_bool p_open_fo(const header_t *h) {
int v2;
int v3;
int n;
if (fo.fd != -1)
return 1;
f_reset(&fo);
if (!p_set_oname(h))
return 0;
fn_strlwr(fo.name);
if (opt_cmd == 1 || opt_cmd == 2) {
if (fn_is_same_file(fi.name, fo.name)) {
if (opt_cmd == 1)
error(&fi, "can't compress ... | lzo_bool p_open_fo(const header_t *h) {
if (fo.fd != -1)
return 1;
f_reset(&fo);
if (!p_set_oname(h))
return 0;
fn_strlwr(fo.name);
if (!(opt_cmd == CMD_COMPRESS || opt_cmd == CMD_DECOMPRESS)) {
fo.fd = opt_output_name ? -2 : -1;
return 1;
}
if (fn_is_same_file(fi.name, fo.name)) {
... | p_open_fo | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
lzo_bool p_set_oname(const header_t *h) {
const char *v2;
const char *v3;
const char *v4;
const char *v5;
lzo_bool u;
int suff;
const char *err_name;
const char *s;
size_t sl;
size_t l;
char *base;
char *ext;
fo.name[0] = 0;
if (opt_output_name) {
strcpy(fo.name, opt_output_name);
r... | static lzo_bool p_set_oname(const header_t *h) {
char *base;
char *ext;
int suff;
size_t l;
const char *err_name;
const char *s;
size_t sl;
fo.name[0] = 0;
if (opt_output_name) {
strcpy(fo.name, opt_output_name);
return 1;
}
assert(!opt_stdout);
assert(opt_file);
#if defined(NRVP)
... | p_set_oname | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void p_warn(file_t *ft, const char *msg) {
int v2;
v2 = *__errno_location();
do_error(ft, err_nl, msg, 2, v2);
} | void p_warn(file_t *ft, const char *msg) {
do_error(ft, err_nl, msg, EXIT_WARN, errno);
} | p_warn | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
void pr_size(FILE *f, unsigned long a, unsigned long b, int flags) {
unsigned long ratio;
if ((flags & 1) != 0)
ratio = get_ratio(a, b);
else
ratio = get_ratio(b, a);
fprintf(f, "%9lu %9lu %3lu.%01lu%%", a, b, (ratio + 500) / 0x2710,
(ratio + 500) % 0x2710 / 0x3E8);
} | static void pr_size(FILE *f, lzop_ulong_t a, lzop_ulong_t b, int flags) {
unsigned long ratio, r1, r2, al, bl;
ratio = (flags & 1) ? get_ratio(a, b) : get_ratio(b, a);
ratio += 500;
r1 = ratio / 10000;
r2 = (ratio % 10000) / 1000;
#if (SIZEOF_LONG >= 8) || !defined(acc_int64l_t)
al = (unsigned long)a;
b... | pr_size | lzop-1.04-r1 | app-arch | O0/app-arch/lzop-1.04-r1/lzop | ida | O0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.