-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_info_decoder.c
57 lines (47 loc) · 1.77 KB
/
get_info_decoder.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_info_decoder.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fnacarel <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/15 02:44:43 by fnacarel #+# #+# */
/* Updated: 2023/01/15 02:56:48 by fnacarel ### ########.fr */
/* */
/* ************************************************************************** */
#include "./encoder.h"
#include <string.h>
void get_decompressed_data_bytes(t_decoder_info *info)
{
int *block;
block = attach_memory_block(FILENAME, sizeof(int), 5);
info->data_len = block[0];
}
void get_decompressed_data(t_decoder_info *info)
{
int size;
char *block;
size = info->data_len + 1;
info->data = calloc(sizeof(char), size);
block = attach_memory_block(FILENAME, size, 6);
memcpy(info->data, block, size);
}
void get_compressed_data_bytes(t_decoder_info *info)
{
int *block;
block = attach_memory_block(FILENAME, sizeof(int), 7);
info->compressed_len = block[0];
}
void get_runtime(t_decoder_info *info)
{
long int *block;
block = attach_memory_block(FILENAME, sizeof(long int), 8);
info->decoder_runtime = block[0];
}
void get_info(t_decoder_info *info)
{
get_decompressed_data_bytes(info);
get_decompressed_data(info);
get_compressed_data_bytes(info);
get_runtime(info);
}