Исправлена сереиализация, и десериализация.
This commit is contained in:
parent
2f2ad992c2
commit
dcd0f80dbf
3 changed files with 8 additions and 7 deletions
|
|
@ -1,4 +1,4 @@
|
|||
cmake_minimum_required(VERSION 3.0)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(webdisk_c LANGUAGES C)
|
||||
|
||||
|
|
|
|||
11
file.h
11
file.h
|
|
@ -58,7 +58,7 @@ void name_file_w(char* name, FILE * f_names, uint64_t *names_offset){
|
|||
uint16_t len = strlen(name);
|
||||
fwrite(&len, sizeof(uint16_t), 1, f_names);
|
||||
fwrite(name, 1, len, f_names);
|
||||
names_offset += len + sizeof(uint16_t);
|
||||
*names_offset += len + sizeof(uint16_t);
|
||||
}
|
||||
void nodes_file_w(struct metadata* meta, FILE * f_nodes, uint64_t *nodes_offset, uint64_t names_offset){
|
||||
struct metadata_file file;
|
||||
|
|
@ -66,7 +66,7 @@ void nodes_file_w(struct metadata* meta, FILE * f_nodes, uint64_t *nodes_offset,
|
|||
file.size = meta->size;
|
||||
file.tipe_dir = meta->tipe_dir;
|
||||
fwrite(&file, 1, sizeof(struct metadata_file), f_nodes);
|
||||
nodes_offset += sizeof(struct metadata_file);
|
||||
*nodes_offset += sizeof(struct metadata_file);
|
||||
}
|
||||
|
||||
void aaasss(struct dir_list_struct* dir_list, struct metadata* mata_local, struct metadata* mata_local_top, FILE *f_nodes, FILE *f_names, int* marker, uint16_t* len){
|
||||
|
|
@ -120,8 +120,9 @@ void nanaaa_2(struct metadata* mata){
|
|||
mata_local = mata_local->top;
|
||||
}
|
||||
dir_list = mata_local->jamp->next;
|
||||
//if (dir_list == NULL) printf("ПИЗДЕЦ\n");
|
||||
//dir_list = je_malloc(sizeof(struct dir_list_struct));
|
||||
if (dir_list == NULL){
|
||||
dir_list = je_malloc(sizeof(struct dir_list_struct));
|
||||
}
|
||||
//aaasss(dir_list, mata_local, mata_local_top, f_nodes, f_names, &marker, &len);
|
||||
dir_list->file = mata_local;
|
||||
mata_local = dir_list->file;
|
||||
|
|
@ -150,7 +151,7 @@ void nanaaa_2(struct metadata* mata){
|
|||
|
||||
fread(&file, 1, sizeof(struct metadata_file), f_nodes);
|
||||
fread(&len, 1, sizeof(uint16_t), f_names);
|
||||
fread(&file_2, 1, len, f_names);
|
||||
//fread(&file_2, 1, len, f_names); ///xxxxx
|
||||
file.name_offset;
|
||||
char* name;
|
||||
//printf("Файл: %s\n", name);
|
||||
|
|
|
|||
2
main.c
2
main.c
|
|
@ -477,7 +477,7 @@ int main(int argc, char *argv[]){
|
|||
printf("tipe_dir: %i\n", mata->dir_list->file->tipe_dir);
|
||||
printf("size: %li\n", mata->dir_list->file->size);
|
||||
if (mata->dir_list->next == NULL) printf("SUKA\n");
|
||||
printf("AAAA2: %s\n", mata->dir_list->next->file->name);
|
||||
//printf("AAAA2: %s\n", mata->dir_list->next->file->name);
|
||||
//printf("AAAA2: %s\n", mata->dir_list->file->dir_list->file->name);
|
||||
*/
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue