Ajout d'une note pour gérer la fin inattendue du fichier
This commit is contained in:
parent
b9b9e35115
commit
ef8d547f6b
|
@ -2,6 +2,7 @@
|
|||
#include "huftree.h"
|
||||
#include "buffer.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -152,11 +153,14 @@ void writeTree(HufTree tree, WriteBuffer* buffer) {
|
|||
HufTree readTree(ReadBuffer* buffer) {
|
||||
HufTree tree = malloc(sizeof(*tree));
|
||||
|
||||
if (getBuffer(buffer) == 1) {
|
||||
char bit = getBuffer(buffer);
|
||||
// FIXME: gérer la fin inattendue du fichier
|
||||
|
||||
if (bit == 1) {
|
||||
// Sommet avec enfants
|
||||
tree->child_l = readTree(buffer);
|
||||
tree->child_r = readTree(buffer);
|
||||
} else {
|
||||
} else if (bit == 0) {
|
||||
// Feuille de l'arbre
|
||||
int name = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue