Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
lz5_decoder_mt_z.c
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2* *
3* Licensa de Copia (C) <2022> <Aurora Boreal> *
4* *
5* Este programa e software livre: voce pode redistribuir isto e/ou *
6* modificar isto sobre os termos do GNU Licensa Geral Pública como 12
7* publicado pela Fundacao de Software Livre, tanto a versão 3 da *
8* Licensa, ou (dependendo da sua opcao) qualquer versao posterior. *
9* *
10* Este programa e distribuido na esperanca que isto vai ser util, *
11* mas SEM QUALQUER GARANTIA; sem ate mesmo a implicada garantia de *
12* COMERCIALIZAcaO ou CABIMENTO PARA UM FIM PARTICULAR. Veja a *
13* Licensa Geral Publica para mais detalhes. *
14* *
15* Você deve ter recebido uma cópia da LICENSA GERAL PUBLICA e a GNU *
16* Licensa Publica Menor junto com este programa *
17* Se não, veja <http://www.gnu.org/licenses/>. *
18* *
19* Suporte: sourceforge.net github.com *
20* *
21* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
22
23* Pereira: arsoftware25@gmail.com ricardo@arsoftware.net.br *
24* Koci: arsoftware10@gmail.com amanda@arsoftware.net. br *
25
26 pereira1001@users.sourceforge.net
27 */
28
29
31{
32 /*
33 ar_data ar = {
34 0,
35 };
36 */
37 // char signature_z[5] = "AR__";
38 char *buffer = malloc(CHUNK);
39 char *out = malloc(CHUNK);
40 int ret_arp;
41 // int ret_z;
42 int retvalue = 0;
43 // int64_t remaining_z;
44
45 pedro_dprintf(-1, "decoder multi-thread running\n");
46
47 assert(NULL == dest);
48
49 intcancel__6 = 0;
50 intpause__6 = 0;
51
52 // signature_z[3] = '_' - 9; //lz5 multi-thread
53
54 pedro_dprintf(0, "seek to %lld\n", amanda->offset_z);
55
56 // assert(0 <= (int64_t)amanda->offset_z - (int64_t)sizeof(int64_t) - (int64_t)sizeof(ar));
57
58 // amanda->size_of_input_file_copy_z += sizeof(int64_t) + sizeof(ar);
59
60 if (
61 0 != _fseeki64(
62 amanda->input_file,
63 amanda->offset_z,
64 SEEK_SET))
65 {
66 amanda->retvalue = 403; //File access error
67 goto saida_13_march_2021__21_02_12;
68 }
69/*
70 memset(&ar, 0, sizeof(ar));
71 ret_z = fread(&ar, 1, min(sizeof(ar), amanda->size_of_input_file_copy_z), amanda->input_file);
72
73 if (ret_z != sizeof(ar))
74 {
75
76 retvalue = 122;
77 goto saida_13_march_2021__21_02_12;
78 }
79 amanda->size_of_input_file_copy_z -= ret_z;
80 */
81 /*
82 if (0 != memcmp(ar.string, signature_z, 4))
83 {
84
85 retvalue = 199;
86 goto saida_13_march_2021__21_02_12;
87 }
88*/
89/*
90 ret_z = fread(&remaining_z, 1, min(sizeof(remaining_z), amanda->size_of_input_file_copy_z), amanda->input_file);
91
92 if (sizeof(remaining_z) != ret_z)
93 {
94 retvalue = 122;
95 goto saida_13_march_2021__21_02_12;
96 }
97*/
98/*
99 amanda->size_of_input_file_copy_z -=
100 ret_z;
101*/
102/*
103 if (0 > remaining_z)
104 {
105 retvalue = 500;
106 goto saida_13_march_2021__21_02_12;
107 }
108
109 if (amanda->size_of_input_file_copy_z != remaining_z)
110 {
111 pedro_dprintf(-1, "achou amor %lld %lld\n", amanda->size_of_input_file_copy_z, remaining_z);
112 retvalue = 500;
113 goto saida_13_march_2021__21_02_12;
114 }
115
116 amanda->size_of_input_file_copy_z = remaining_z;
117
118 pedro_dprintf(-1, "size internal %lld\n", amanda->size_of_input_file_copy_z);
119
120 //aqui...
121*/
122
123pedro_dprintf(0, "multi thread slice %lld", amanda->size_of_input_file_copy_z);
124
125amanda->dest_is_FILE_z = false;
126
127 pedro_dprintf(0, "multi thread slice %lld count %d offset %lld", (uint64_t)amanda->size_of_input_file_copy_z, (int)amanda->thread_id_z, _ftelli64(source));
128
129 amanda->bytes_saved_charli = 0;
130 ret_arp = decompress_file_19(source, amanda->dest, amanda);
131 pedro_dprintf(0, "depois da descompressao %lld saved %lld", amanda->size_of_input_file_copy_z, amanda->bytes_saved_charli);
132 if (119 == amanda->internal_error_arp)
133 {
134 retvalue = 119;
135 }
136 else if (6 == amanda->internal_error_arp)
137 {
138 retvalue = amanda->internal_error_arp;
139 }
140 else
141 {
142 if (ret_arp)
143 {
144 // assert(0);
145 pedro_dprintf(-1, "error 2 7 \n");
146 retvalue = 7; //It isnot a valid compressed file
147 }
148 }
149
150saida_13_march_2021__21_02_12:;
151
152 pedro_dprintf(-1, "pulou e erro %d\n", retvalue);
153
154 if (*(amanda->intcancel__6))
155 {
156 retvalue = 119;
157 }
158
159 *(amanda->bytes_read_z) = totalbytes_z__6;
160 free(buffer);
161 free(out);
162 if(amanda->dest)
163 {
164 fclose(amanda->dest);
165 }
166 pedro_dprintf(-1, "erro que deu interno %d\n", retvalue);
167
168 return retvalue;
169}
void pedro_dprintf(int amanda_level, char *format,...)
Definition pedro.c:43
#define CHUNK
Definition brotli2.c:163
#define assert(condition)
Definition lz4.c:273
const char * source
Definition lz4.h:808
char * dest
Definition lz4.h:806
int decompress_file_19(FILE *f_in, FILE *f_out, my_thread_struct_z *amanda)
Definition lz4_frame_arp.c:497
int intpause__6
Definition lz5dll.c:120
int intcancel__6
Definition lz5dll.c:121
int64_t totalbytes_z__6
Definition lz5.c:423
int zuncompress_sha512_k_mt_decoding_multi_thread_z__6(FILE *source, FILE *dest, my_thread_struct_z *amanda)
Definition lz5_decoder_mt_z.c:30
Definition stdio_v3.h:23
int * intcancel__6
Definition stdio_v3.h:33
int64_t offset_z
Definition stdio_v3.h:44
int64_t size_of_input_file_copy_z
Definition stdio_v3.h:46
int retvalue
Definition stdio_v3.h:39
int64_t * bytes_read_z
Definition stdio_v3.h:43
bool dest_is_FILE_z
Definition stdio_v3.h:32
int64_t bytes_saved_charli
Definition stdio_v3.h:40
FILE * dest
Definition stdio_v3.h:26
int thread_id_z
Definition stdio_v3.h:40
int internal_error_arp
Definition stdio_v3.h:36
FILE * input_file
Definition stdio_v3.h:35
#define SEEK_SET
Definition zconf.h:498
const lzma_allocator const uint8_t size_t uint8_t * out
Definition block.h:528
#define NULL
Definition getopt1.c:37