Added the handling of errors with the functions to get a value in a

column
This commit is contained in:
Celine Mercier
2015-09-14 17:04:29 +02:00
parent 0e50fbf706
commit 5c3bc03bd2
12 changed files with 69 additions and 35 deletions

View File

@ -603,7 +603,18 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
new_column = NULL;
// TODO check that informations are not NULL/invalid?
// Check that the informations given are not NULL/invalid/greater than the allowed sizes
if (dms == NULL)
{
obidebug(1, "\nCan't create column because of invalid DMS");
return NULL;
}
if (column_name == NULL)
{
obidebug(1, "\nCan't create column because of empty column name");
return NULL;
}
//if (type < 1)
// Get the column directory structure associated to the column
column_directory = obi_column_directory(dms, column_name);
@ -731,7 +742,7 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
strncpy(header->name, column_name, OBIDMS_MAX_COLNAME);
// Fill the data with NA values
obi_ini_to_NA_values (new_column, 0, nb_lines);
obi_ini_to_NA_values(new_column, 0, nb_lines);
free(column_file_name);
close(column_file_descriptor);
@ -1146,7 +1157,7 @@ int obi_enlarge_column(OBIDMS_column_p column)
PROT_READ | PROT_WRITE,
MAP_SHARED,
column_file_descriptor,
(column->header)->header_size
header_size
);
if (column->data == MAP_FAILED)