Fixed a critical bug where the elements names were not stored correctly
This commit is contained in:
@ -450,12 +450,6 @@ static int create_version_file(OBIDMS_column_directory_p column_directory)
|
||||
|
||||
int obi_column_set_elements_names(OBIDMS_column_p column, const char* elements_names)
|
||||
{
|
||||
(column->header)->elements_names = malloc(strlen(elements_names)*sizeof(char) + 1);
|
||||
if ((column->header)->elements_names == NULL)
|
||||
{
|
||||
obidebug(1, "\nError allocating the memory for elements names in an OBIDMS column");
|
||||
return -1;
|
||||
}
|
||||
strcpy((column->header)->elements_names, elements_names);
|
||||
return 0;
|
||||
}
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include "obilittlebigman.h"
|
||||
#include "obidmscolumndir.h"
|
||||
|
||||
#define ELEMENTS_NAMES_MAX (2048)
|
||||
|
||||
|
||||
typedef int32_t obiversion_t; /**< Used to store the column version number
|
||||
*/
|
||||
@ -43,7 +45,7 @@ typedef struct OBIDMS_column_header {
|
||||
size_t line_count; /**< number of lines of data */
|
||||
size_t lines_used; /**< number of lines of data used */
|
||||
size_t nb_elements_per_line; /**< number of elements per line (default : 1) */
|
||||
char* elements_names; /**< names of the line elements (default : "["column_name"]") */
|
||||
char elements_names[ELEMENTS_NAMES_MAX+1]; /**< names of the line elements (default : "["column_name"]") */
|
||||
OBIType_t data_type; /**< type of the data */
|
||||
time_t creation_date; /**< date of creation of the file */
|
||||
obiversion_t version; /**< version of the OBIColumn */
|
||||
|
Reference in New Issue
Block a user