#include "idx.h"
#include "did.h"
+#include "error.h"
+#include "common.h"
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>
if ((f_idx = fopen(name_f_idx, "rb")) == NULL) {
PERR("No se puede abrir archivo");
- *err = 4; /* EMUFS_ERROR_CANT_OPEN_FILE */
+ *err = EMUFS_ERROR_CANT_OPEN_FILE;
return EMUFS_NOT_FOUND;
}
if ((f_idx = fopen(name_f_idx, "rb")) == NULL) {
PERR("No se puede abrir archivo");
- /* *err = 4; * EMUFS_ERROR_CANT_OPEN_FILE */
+ /* *err = EMUFS_ERROR_CANT_OPEN_FILE; */
return EMUFS_NOT_FOUND;
}
count = 0;
while (!feof(f_idx)) {
if (fread(®, sizeof(EMUFS_IDX), 1, f_idx) != 1) continue;
- count++;
- /* TODO : Verificar errores :-D */
- tmp = realloc(tmp, count*sizeof(EMUFS_REG_ID));
- tmp[count-1] = reg.id_reg;
+ if (reg.location != EMUFS_NOT_FOUND) {
+ count++;
+ tmp = realloc(tmp, count*sizeof(EMUFS_REG_ID));
+ tmp[count-1] = reg.id_reg;
+ }
}
fclose(f_idx);