This reverts commit ff909fb9e10d2f9fa494048c3767af2bdd74b2d8.
Shawn Webb authored on 2014/09/09 03:01:44... | ... |
@@ -31,7 +31,6 @@ |
31 | 31 |
#include <stdlib.h> |
32 | 32 |
#include <string.h> |
33 | 33 |
|
34 |
-#include "libclamav/clamav.h" |
|
35 | 34 |
#include "libclamunrar/unrar.h" |
36 | 35 |
#include "libclamunrar/unrarppm.h" |
37 | 36 |
#include "libclamunrar/unrarvm.h" |
... | ... |
@@ -44,7 +43,7 @@ |
44 | 44 |
#ifdef RAR_HIGH_DEBUG |
45 | 45 |
#define rar_dbgmsg printf |
46 | 46 |
#else |
47 |
-static void rar_dbgmsg(const char* fmt,...){ UNUSEDPARAM(fmt); } |
|
47 |
+static void rar_dbgmsg(const char* fmt,...){} |
|
48 | 48 |
#endif |
49 | 49 |
|
50 | 50 |
static void insert_old_dist(unpack_data_t *unpack_data, unsigned int distance) |
... | ... |
@@ -124,7 +123,7 @@ int rar_unp_read_buf(int fd, unpack_data_t *unpack_data) |
124 | 124 |
data_size = unpack_data->read_top; |
125 | 125 |
} |
126 | 126 |
/* RAR2 depends on us only reading upto the end of the current compressed file */ |
127 |
- if (unpack_data->pack_size < (unsigned int)(((MAX_BUF_SIZE-data_size)&~0xf))) { |
|
127 |
+ if (unpack_data->pack_size < ((MAX_BUF_SIZE-data_size)&~0xf)) { |
|
128 | 128 |
read_size = unpack_data->pack_size; |
129 | 129 |
} else { |
130 | 130 |
read_size = (MAX_BUF_SIZE-data_size)&~0xf; |
... | ... |
@@ -219,7 +218,7 @@ static void unp_write_buf(unpack_data_t *unpack_data) |
219 | 219 |
struct UnpackFilter *flt, *next_filter; |
220 | 220 |
struct rarvm_prepared_program *prg, *next_prg; |
221 | 221 |
uint8_t *filtered_data; |
222 |
- size_t i, j; |
|
222 |
+ int i, j; |
|
223 | 223 |
|
224 | 224 |
rar_dbgmsg("in unp_write_buf\n"); |
225 | 225 |
written_border = unpack_data->wr_ptr; |
... | ... |
@@ -396,9 +395,8 @@ static int read_tables(int fd, unpack_data_t *unpack_data) |
396 | 396 |
uint8_t bit_length[BC]; |
397 | 397 |
unsigned char table[HUFF_TABLE_SIZE]; |
398 | 398 |
unsigned int bit_field; |
399 |
- int length, zero_count, number, n; |
|
399 |
+ int i, length, zero_count, number, n; |
|
400 | 400 |
const int table_size=HUFF_TABLE_SIZE; |
401 |
- size_t i; |
|
402 | 401 |
|
403 | 402 |
rar_dbgmsg("in read_tables Offset=%ld in_addr=%d read_top=%d\n", lseek(fd, 0, SEEK_CUR), |
404 | 403 |
unpack_data->in_addr, unpack_data->read_top); |
... | ... |
@@ -541,11 +539,10 @@ static int add_vm_code(unpack_data_t *unpack_data, unsigned int first_byte, |
541 | 541 |
unsigned char *vmcode, int code_size) |
542 | 542 |
{ |
543 | 543 |
rarvm_input_t rarvm_input; |
544 |
- unsigned int filter_pos, new_filter, block_start, init_mask, cur_size, data_size; |
|
544 |
+ unsigned int filter_pos, new_filter, block_start, init_mask, cur_size; |
|
545 | 545 |
struct UnpackFilter *filter, *stack_filter; |
546 |
- int empty_count, stack_pos, vm_codesize, static_size; |
|
546 |
+ int i, empty_count, stack_pos, vm_codesize, static_size, data_size; |
|
547 | 547 |
unsigned char *vm_code, *global_data; |
548 |
- size_t i; |
|
549 | 548 |
|
550 | 549 |
rar_dbgmsg("in add_vm_code first_byte=0x%x code_size=%d\n", first_byte, code_size); |
551 | 550 |
rarvm_input.in_buf = vmcode; |
... | ... |
@@ -565,7 +562,7 @@ static int add_vm_code(unpack_data_t *unpack_data, unsigned int first_byte, |
565 | 565 |
} |
566 | 566 |
rar_dbgmsg("filter_pos = %u\n", filter_pos); |
567 | 567 |
if (filter_pos > unpack_data->Filters.num_items || |
568 |
- filter_pos > (unsigned int)(unpack_data->old_filter_lengths_size)) { |
|
568 |
+ filter_pos > unpack_data->old_filter_lengths_size) { |
|
569 | 569 |
rar_dbgmsg("filter_pos check failed\n"); |
570 | 570 |
return FALSE; |
571 | 571 |
} |
... | ... |
@@ -628,7 +625,7 @@ static int add_vm_code(unpack_data_t *unpack_data, unsigned int first_byte, |
628 | 628 |
if (first_byte & 0x20) { |
629 | 629 |
stack_filter->block_length = rarvm_read_data(&rarvm_input); |
630 | 630 |
} else { |
631 |
- stack_filter->block_length = filter_pos < (unsigned int)(unpack_data->old_filter_lengths_size) ? |
|
631 |
+ stack_filter->block_length = filter_pos < unpack_data->old_filter_lengths_size ? |
|
632 | 632 |
unpack_data->old_filter_lengths[filter_pos] : 0; |
633 | 633 |
} |
634 | 634 |
rar_dbgmsg("block_length=%u\n", stack_filter->block_length); |
... | ... |
@@ -663,7 +660,7 @@ static int add_vm_code(unpack_data_t *unpack_data, unsigned int first_byte, |
663 | 663 |
rar_dbgmsg("unrar: add_vm_code: rar_malloc failed for vm_code\n"); |
664 | 664 |
return FALSE; |
665 | 665 |
} |
666 |
- for (i=0 ; i < (size_t)vm_codesize ; i++) { |
|
666 |
+ for (i=0 ; i < vm_codesize ; i++) { |
|
667 | 667 |
vm_code[i] = rarvm_getbits(&rarvm_input) >> 8; |
668 | 668 |
rarvm_addbits(&rarvm_input, 8); |
669 | 669 |
} |
... | ... |
@@ -122,9 +122,9 @@ static void copy_string15(unpack_data_t *unpack_data, unsigned int distance, |
122 | 122 |
static unsigned int decode_num(unpack_data_t *unpack_data, int num, unsigned int start_pos, |
123 | 123 |
unsigned int *dec_tab, unsigned int *pos_tab) |
124 | 124 |
{ |
125 |
- unsigned int i; |
|
125 |
+ int i; |
|
126 | 126 |
|
127 |
- for (num&=0xfff0, i=0 ; dec_tab[i] <= (unsigned int)num ; i++) { |
|
127 |
+ for (num&=0xfff0, i=0 ; dec_tab[i] <= num ; i++) { |
|
128 | 128 |
start_pos++; |
129 | 129 |
} |
130 | 130 |
rar_addbits(unpack_data, start_pos); |
... | ... |
@@ -19,14 +19,13 @@ |
19 | 19 |
#include <stdio.h> |
20 | 20 |
#include <string.h> |
21 | 21 |
|
22 |
-#include "libclamav/clamav.h" |
|
23 | 22 |
#include "libclamunrar/unrar.h" |
24 | 23 |
#include "libclamunrar/unrar20.h" |
25 | 24 |
|
26 | 25 |
#ifdef RAR_HIGH_DEBUG |
27 | 26 |
#define rar_dbgmsg printf |
28 | 27 |
#else |
29 |
-static void rar_dbgmsg(const char* fmt,...){ UNUSEDPARAM(fmt); } |
|
28 |
+static void rar_dbgmsg(const char* fmt,...){} |
|
30 | 29 |
#endif |
31 | 30 |
|
32 | 31 |
void unpack_init_data20(int solid, unpack_data_t *unpack_data) |
... | ... |
@@ -13,13 +13,12 @@ |
13 | 13 |
#include <stdio.h> |
14 | 14 |
#include <stdlib.h> |
15 | 15 |
|
16 |
-#include "libclamav/clamav.h" |
|
17 | 16 |
#include "libclamunrar/unrarhlp.h" |
18 | 17 |
|
19 | 18 |
#ifdef RAR_HIGH_DEBUG |
20 | 19 |
#define rar_dbgmsg printf |
21 | 20 |
#else |
22 |
-static void rar_dbgmsg(const char* fmt,...){ UNUSEDPARAM(fmt); } |
|
21 |
+static void rar_dbgmsg(const char* fmt,...){} |
|
23 | 22 |
#endif |
24 | 23 |
|
25 | 24 |
#define RAR_MAX_ALLOCATION 184549376 |
... | ... |
@@ -21,14 +21,13 @@ |
21 | 21 |
#include <stdio.h> |
22 | 22 |
#include <string.h> |
23 | 23 |
|
24 |
-#include "libclamav/clamav.h" |
|
25 | 24 |
#include "libclamunrar/unrar.h" |
26 | 25 |
#include "libclamunrar/unrarppm.h" |
27 | 26 |
|
28 | 27 |
#ifdef RAR_HIGH_DEBUG |
29 | 28 |
#define rar_dbgmsg printf |
30 | 29 |
#else |
31 |
-static void rar_dbgmsg(const char* fmt,...){ UNUSEDPARAM(fmt); } |
|
30 |
+static void rar_dbgmsg(const char* fmt,...){} |
|
32 | 31 |
#endif |
33 | 32 |
|
34 | 33 |
#define MAX_O 64 |
... | ... |
@@ -755,7 +754,7 @@ static void update1(ppm_data_t *ppm_data, struct state_tag *p, struct ppm_contex |
755 | 755 |
static int ppm_decode_symbol1(ppm_data_t *ppm_data, struct ppm_context *context) |
756 | 756 |
{ |
757 | 757 |
struct state_tag *p; |
758 |
- unsigned int i, hi_cnt, count; |
|
758 |
+ int i, hi_cnt, count; |
|
759 | 759 |
|
760 | 760 |
rar_dbgmsg("in ppm_decode_symbol1\n"); |
761 | 761 |
ppm_data->coder.scale = context->con_ut.u.summ_freq; |
... | ... |
@@ -868,7 +867,7 @@ static struct see2_context_tag *make_esc_freq(ppm_data_t *ppm_data, |
868 | 868 |
|
869 | 869 |
static int ppm_decode_symbol2(ppm_data_t *ppm_data, struct ppm_context *context) |
870 | 870 |
{ |
871 |
- unsigned int count, hi_cnt, i; |
|
871 |
+ int count, hi_cnt, i; |
|
872 | 872 |
struct see2_context_tag *psee2c; |
873 | 873 |
struct state_tag *ps[256], **pps, *p; |
874 | 874 |
|
... | ... |
@@ -22,7 +22,6 @@ |
22 | 22 |
#include <stdio.h> |
23 | 23 |
#include <string.h> |
24 | 24 |
|
25 |
-#include "libclamav/clamav.h" |
|
26 | 25 |
#include "libclamunrar/unrar.h" |
27 | 26 |
#include "libclamunrar/unrarvm.h" |
28 | 27 |
#include "libclamunrar/unrarcmd.h" |
... | ... |
@@ -30,7 +29,7 @@ |
30 | 30 |
#ifdef RAR_HIGH_DEBUG |
31 | 31 |
#define rar_dbgmsg printf |
32 | 32 |
#else |
33 |
-static void rar_dbgmsg(const char* fmt,...){ UNUSEDPARAM(fmt); } |
|
33 |
+static void rar_dbgmsg(const char* fmt,...){} |
|
34 | 34 |
#endif |
35 | 35 |
|
36 | 36 |
#define VMCF_OP0 0 |
... | ... |
@@ -156,7 +155,7 @@ const uint32_t crc_tab[256]={ |
156 | 156 |
uint32_t rar_crc(uint32_t start_crc, void *addr, uint32_t size) |
157 | 157 |
{ |
158 | 158 |
unsigned char *data; |
159 |
- uint32_t i; |
|
159 |
+ int i; |
|
160 | 160 |
|
161 | 161 |
data = addr; |
162 | 162 |
#if WORDS_BIGENDIAN == 0 |
... | ... |
@@ -265,7 +264,7 @@ unsigned int rarvm_read_data(rarvm_input_t *rarvm_input) |
265 | 265 |
static rarvm_standard_filters_t is_standard_filter(unsigned char *code, int code_size) |
266 | 266 |
{ |
267 | 267 |
uint32_t code_crc; |
268 |
- uint32_t i; |
|
268 |
+ int i; |
|
269 | 269 |
|
270 | 270 |
struct standard_filter_signature |
271 | 271 |
{ |
... | ... |
@@ -341,12 +340,11 @@ static void filter_itanium_setbits(unsigned char *data, unsigned int bit_field, |
341 | 341 |
static void execute_standard_filter(rarvm_data_t *rarvm_data, rarvm_standard_filters_t filter_type) |
342 | 342 |
{ |
343 | 343 |
unsigned char *data, cmp_byte2, cur_byte, *src_data, *dest_data; |
344 |
- int channels, border, width, PosR; |
|
344 |
+ int i, j, data_size, channels, src_pos, dest_pos, border, width, PosR; |
|
345 | 345 |
int op_type, cur_channel, byte_count, start_pos, pa, pb, pc; |
346 |
- unsigned int file_offset, cur_pos, predicted, data_size, src_pos, dest_pos; |
|
346 |
+ unsigned int file_offset, cur_pos, predicted; |
|
347 | 347 |
int32_t offset, addr; |
348 | 348 |
const int file_size=0x1000000; |
349 |
- unsigned int i, j; |
|
350 | 349 |
|
351 | 350 |
switch(filter_type) { |
352 | 351 |
case VMSF_E8: |
... | ... |
@@ -433,7 +431,7 @@ static void execute_standard_filter(rarvm_data_t *rarvm_data, rarvm_standard_fil |
433 | 433 |
} |
434 | 434 |
for (cur_channel=0 ; cur_channel < channels ; cur_channel++) { |
435 | 435 |
unsigned char prev_byte = 0; |
436 |
- for (dest_pos=data_size+cur_channel ; dest_pos<(unsigned int)border ; dest_pos+=channels) { |
|
436 |
+ for (dest_pos=data_size+cur_channel ; dest_pos<border ; dest_pos+=channels) { |
|
437 | 437 |
rarvm_data->mem[dest_pos] = (prev_byte -= rarvm_data->mem[src_pos++]); |
438 | 438 |
} |
439 | 439 |
} |
... | ... |
@@ -477,7 +475,7 @@ static void execute_standard_filter(rarvm_data_t *rarvm_data, rarvm_standard_fil |
477 | 477 |
dest_data[i] = prev_byte = (unsigned char)(predicted-*(src_data++)); |
478 | 478 |
} |
479 | 479 |
} |
480 |
- for (i=PosR,border=data_size-2 ; i < (unsigned int)border ; i+=3) { |
|
480 |
+ for (i=PosR,border=data_size-2 ; i < border ; i+=3) { |
|
481 | 481 |
unsigned char g=dest_data[i+1]; |
482 | 482 |
dest_data[i] += g; |
483 | 483 |
dest_data[i+2] += g; |
... | ... |
@@ -651,13 +649,13 @@ static int rarvm_execute_code(rarvm_data_t *rarvm_data, |
651 | 651 |
break; |
652 | 652 |
case VM_JZ: |
653 | 653 |
if ((rarvm_data->Flags & VM_FZ) != 0) { |
654 |
- SET_IP((int)GET_VALUE(FALSE, op1)); |
|
654 |
+ SET_IP(GET_VALUE(FALSE, op1)); |
|
655 | 655 |
continue; |
656 | 656 |
} |
657 | 657 |
break; |
658 | 658 |
case VM_JNZ: |
659 | 659 |
if ((rarvm_data->Flags & VM_FZ) == 0) { |
660 |
- SET_IP((int)GET_VALUE(FALSE, op1)); |
|
660 |
+ SET_IP(GET_VALUE(FALSE, op1)); |
|
661 | 661 |
continue; |
662 | 662 |
} |
663 | 663 |
break; |
... | ... |
@@ -684,7 +682,7 @@ static int rarvm_execute_code(rarvm_data_t *rarvm_data, |
684 | 684 |
SET_VALUE(FALSE, op1, GET_VALUE(FALSE, op1)-1); |
685 | 685 |
break; |
686 | 686 |
case VM_JMP: |
687 |
- SET_IP((int)GET_VALUE(FALSE, op1)); |
|
687 |
+ SET_IP(GET_VALUE(FALSE, op1)); |
|
688 | 688 |
continue; |
689 | 689 |
case VM_XOR: |
690 | 690 |
result = UINT32(GET_VALUE(cmd->byte_mode, op1)^GET_VALUE(cmd->byte_mode, op2)); |
... | ... |
@@ -707,37 +705,37 @@ static int rarvm_execute_code(rarvm_data_t *rarvm_data, |
707 | 707 |
break; |
708 | 708 |
case VM_JS: |
709 | 709 |
if ((rarvm_data->Flags & VM_FS) != 0) { |
710 |
- SET_IP((int)GET_VALUE(FALSE, op1)); |
|
710 |
+ SET_IP(GET_VALUE(FALSE, op1)); |
|
711 | 711 |
continue; |
712 | 712 |
} |
713 | 713 |
break; |
714 | 714 |
case VM_JNS: |
715 | 715 |
if ((rarvm_data->Flags & VM_FS) == 0) { |
716 |
- SET_IP((int)GET_VALUE(FALSE, op1)); |
|
716 |
+ SET_IP(GET_VALUE(FALSE, op1)); |
|
717 | 717 |
continue; |
718 | 718 |
} |
719 | 719 |
break; |
720 | 720 |
case VM_JB: |
721 | 721 |
if ((rarvm_data->Flags & VM_FC) != 0) { |
722 |
- SET_IP((int)GET_VALUE(FALSE, op1)); |
|
722 |
+ SET_IP(GET_VALUE(FALSE, op1)); |
|
723 | 723 |
continue; |
724 | 724 |
} |
725 | 725 |
break; |
726 | 726 |
case VM_JBE: |
727 | 727 |
if ((rarvm_data->Flags & (VM_FC|VM_FZ)) != 0) { |
728 |
- SET_IP((int)GET_VALUE(FALSE, op1)); |
|
728 |
+ SET_IP(GET_VALUE(FALSE, op1)); |
|
729 | 729 |
continue; |
730 | 730 |
} |
731 | 731 |
break; |
732 | 732 |
case VM_JA: |
733 | 733 |
if ((rarvm_data->Flags & (VM_FC|VM_FZ)) == 0) { |
734 |
- SET_IP((int)GET_VALUE(FALSE, op1)); |
|
734 |
+ SET_IP(GET_VALUE(FALSE, op1)); |
|
735 | 735 |
continue; |
736 | 736 |
} |
737 | 737 |
break; |
738 | 738 |
case VM_JAE: |
739 | 739 |
if ((rarvm_data->Flags & VM_FC) == 0) { |
740 |
- SET_IP((int)GET_VALUE(FALSE, op1)); |
|
740 |
+ SET_IP(GET_VALUE(FALSE, op1)); |
|
741 | 741 |
continue; |
742 | 742 |
} |
743 | 743 |
break; |
... | ... |
@@ -755,7 +753,7 @@ static int rarvm_execute_code(rarvm_data_t *rarvm_data, |
755 | 755 |
rarvm_data->R[7] -= 4; |
756 | 756 |
SET_VALUE(FALSE, (unsigned int *)&rarvm_data->mem[rarvm_data->R[7] & |
757 | 757 |
RARVM_MEMMASK], cmd-prepared_code+1); |
758 |
- SET_IP((int)GET_VALUE(FALSE, op1)); |
|
758 |
+ SET_IP(GET_VALUE(FALSE, op1)); |
|
759 | 759 |
continue; |
760 | 760 |
case VM_NOT: |
761 | 761 |
SET_VALUE(cmd->byte_mode, op1, ~GET_VALUE(cmd->byte_mode, op1)); |
... | ... |
@@ -862,7 +860,7 @@ static int rarvm_execute_code(rarvm_data_t *rarvm_data, |
862 | 862 |
if (rarvm_data->R[7] >= RARVM_MEMSIZE) { |
863 | 863 |
return TRUE; |
864 | 864 |
} |
865 |
- SET_IP((int)GET_VALUE(FALSE, (unsigned int *)&rarvm_data->mem[rarvm_data->R[7] & |
|
865 |
+ SET_IP(GET_VALUE(FALSE, (unsigned int *)&rarvm_data->mem[rarvm_data->R[7] & |
|
866 | 866 |
RARVM_MEMMASK])); |
867 | 867 |
rarvm_data->R[7] += 4; |
868 | 868 |
continue; |
... | ... |
@@ -30,7 +30,6 @@ |
30 | 30 |
#include <unistd.h> |
31 | 31 |
#endif |
32 | 32 |
|
33 |
-#include "libclamav/clamav.h" |
|
34 | 33 |
#include "libclamunrar/unrar.h" |
35 | 34 |
|
36 | 35 |
#include "unrar_iface.h" |
... | ... |
@@ -53,7 +52,7 @@ static uint32_t unrar_endian_convert_32(uint32_t v) |
53 | 53 |
#ifdef RAR_DEBUG_MODE |
54 | 54 |
#define unrar_dbgmsg printf |
55 | 55 |
#else |
56 |
-static void unrar_dbgmsg(const char* fmt,...){ UNUSEDPARAM(fmt); } |
|
56 |
+static void unrar_dbgmsg(const char* fmt,...){} |
|
57 | 57 |
#endif |
58 | 58 |
|
59 | 59 |
static void *read_header(int fd, header_type hdr_type) |
... | ... |
@@ -396,7 +395,6 @@ int unrar_extract_next_prepare(unrar_state_t *state, const char *dirname) |
396 | 396 |
int ofd; |
397 | 397 |
unrar_metadata_t *new_metadata; |
398 | 398 |
|
399 |
- UNUSEDPARAM(dirname); |
|
400 | 399 |
|
401 | 400 |
state->file_header = read_block(state->fd, FILE_HEAD); |
402 | 401 |
if(!state->file_header) |