* 59b80: 46335053 undefined
*/
-void fn_59788(const char *fname)
+void err_exit(const char *fname)
{
fprintf(stderr,"%s: error extracting...\n", fname);
exit(1);
r1 = r6_data->stop;
if (r1 < r0)
- fn_59788(__func__);
+ err_exit(__func__);
r5 = *r0;
r0++;
if (r1 > r2) {
printf("r1: 0x%08x, r2: 0x%08x\n", (unsigned int)r1, (unsigned int)r2);
- fn_59788(__func__);
+ err_exit(__func__);
}
*r1 = arg1 & 0xff;
return 4;
}
-void extract_lz_file(unsigned char *buf, unsigned char *name)
+void extract_lz_file(unsigned char *inbuf, unsigned char *name)
{
- unsigned char *r3;
- unsigned int r5;
- unsigned char *r7 = NULL; /* Arg1, mem start */
- unsigned char *r10 = NULL; /* Arg2, mem end */
- unsigned char *r11 = buf; /* Arg3 */
+ unsigned int len;
+ unsigned char *outbuf;
struct data_in_s data_in;
struct data_out_s data_out;
- if (*((unsigned int*)r11) != LZ_MAGIC)
- fn_59788(__func__);
+ if (*((unsigned int*)inbuf) != LZ_MAGIC)
+ err_exit(__func__);
- r3 = r11 + 4;
- r5 = *((unsigned int*)r3);
- printf(", length: %d", r5);
+ len = *((unsigned int*)(inbuf + 4));
+ printf(", length: %d", len);
- if ((r7 = malloc(r5)) == NULL) {
+ if ((outbuf = malloc(len)) == NULL) {
perror("malloc");
exit(1);
}
- r10 = r7 + r5;
- bzero(r7, r5);
- r3 = r7 + r5;
- if (r3 > r10)
- fn_59788(__func__);
-
- data_in.start = r11 + 8;
- data_in.stop = r5 + r11;
+ bzero(outbuf, len);
+
+ data_in.start = inbuf + 8;
+ data_in.stop = inbuf + len;
data_in.x = 0;
data_in.bit = 0x80;
- data_out.pos = r7;
- data_out.end = r7 + r5;
+ data_out.pos = outbuf;
+ data_out.end = outbuf + len;
lz_expand(&data_in, &data_out);
if ((ret = crc_check_59684(r7, r5, 0x46335053)) != 0) {
printf("crc_check return: %d\n", ret);
- fn_59788(__func__);
+ err_exit(__func__);
}
#endif
- write_file((char*)name, r7, r5);
+ write_file((char*)name, outbuf, len);
- free(r7);
+ free(outbuf);
}