made POSIX compliant
This commit is contained in:
@ -156,9 +156,12 @@ static index_t get_line_count_per_page(OBIType_t data_type, index_t nb_elements_
|
||||
static char* build_column_file_name(const char* column_name, obiversion_t version_number)
|
||||
{
|
||||
char* file_name;
|
||||
int version_number_length;
|
||||
|
||||
// Build the file name
|
||||
if (asprintf(&file_name,"%s@%d.odc", column_name, version_number) < 0)
|
||||
version_number_length = (version_number == 0 ? 1 : (int)(log10(version_number)+1));
|
||||
file_name = (char*) malloc((strlen(column_name) + version_number_length + 6)*sizeof(char)); // TODO check the mallocs...
|
||||
if (sprintf(file_name,"%s@%d.odc", column_name, version_number) < 0)
|
||||
{
|
||||
obi_set_errno(OBICOL_MEMORY_ERROR);
|
||||
obidebug(1, "\nError building a column file name");
|
||||
@ -174,7 +177,8 @@ static char* build_version_file_name(const char* column_name)
|
||||
char* file_name;
|
||||
|
||||
// Build the file name
|
||||
if (asprintf(&file_name,"%s.odv", column_name) < 0)
|
||||
file_name = (char*) malloc((strlen(column_name) + 5)*sizeof(char));
|
||||
if (sprintf(file_name,"%s.odv", column_name) < 0)
|
||||
{
|
||||
obi_set_errno(OBICOL_MEMORY_ERROR);
|
||||
obidebug(1, "\nError building a version file name");
|
||||
|
Reference in New Issue
Block a user