Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OBITools3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
23
Issues
23
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OBITools
OBITools3
Commits
f5e992ab
Commit
f5e992ab
authored
Jul 05, 2017
by
Celine Mercier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a check on the element when setting a value in a column
parent
1d2996c6
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
22 additions
and
14 deletions
+22
-14
src/obidmscolumn.c
src/obidmscolumn.c
+13
-5
src/obidmscolumn.h
src/obidmscolumn.h
+1
-1
src/obidmscolumn_bool.c
src/obidmscolumn_bool.c
+1
-1
src/obidmscolumn_char.c
src/obidmscolumn_char.c
+1
-1
src/obidmscolumn_float.c
src/obidmscolumn_float.c
+1
-1
src/obidmscolumn_idx.c
src/obidmscolumn_idx.c
+1
-1
src/obidmscolumn_int.c
src/obidmscolumn_int.c
+1
-1
src/obidmscolumn_qual.c
src/obidmscolumn_qual.c
+1
-1
src/obidmscolumn_seq.c
src/obidmscolumn_seq.c
+1
-1
src/obidmscolumn_str.c
src/obidmscolumn_str.c
+1
-1
No files found.
src/obidmscolumn.c
View file @
f5e992ab
...
...
@@ -1820,8 +1820,8 @@ index_t obi_column_get_element_index_from_name(OBIDMS_column_p column, const cha
if
(
elt_names_idx
!=
NULL
)
return
(
index_t
)(
*
elt_names_idx
);
obi_set_errno
(
OBI
COL_UNKNOWN
_ERROR
);
obidebug
(
1
,
"
\n
Error: could not find element name %s"
,
element_name
);
obi_set_errno
(
OBI
_ELT_IDX
_ERROR
);
obidebug
(
0
,
"
\n
Error: could not find element name %s"
,
element_name
);
return
OBIIdx_NA
;
}
...
...
@@ -1860,7 +1860,7 @@ char* obi_get_elements_names(OBIDMS_column_p column)
int
obi_column_prepare_to_set_value
(
OBIDMS_column_p
column
,
index_t
line_nb
)
int
obi_column_prepare_to_set_value
(
OBIDMS_column_p
column
,
index_t
line_nb
,
index_t
elt_idx
)
{
// Check if the column is read-only
if
(
!
(
column
->
writable
))
...
...
@@ -1878,6 +1878,14 @@ int obi_column_prepare_to_set_value(OBIDMS_column_p column, index_t line_nb)
return
-
1
;
}
// Check that the element index is not greater than the number of elements per line of the column
if
(
elt_idx
>=
(
column
->
header
)
->
nb_elements_per_line
)
{
obi_set_errno
(
OBI_ELT_IDX_ERROR
);
obidebug
(
0
,
"
\n
Error trying to set a value at an element index greater than the number of elements per line of the column"
);
return
-
1
;
}
// Check if the file needs to be enlarged
while
((
line_nb
+
1
)
>
(
column
->
header
)
->
line_count
)
{
...
...
@@ -1899,8 +1907,8 @@ int obi_column_prepare_to_get_value(OBIDMS_column_p column, index_t line_nb)
{
if
((
line_nb
+
1
)
>
((
column
->
header
)
->
line_count
))
{
obi_set_errno
(
OBI
COL_UNKNOWN
_ERROR
);
obidebug
(
1
,
"
\n
Error trying to get a value that is beyond the current number of lines of the column"
);
obi_set_errno
(
OBI
_LINE_IDX
_ERROR
);
obidebug
(
0
,
"
\n
Error trying to get a value that is beyond the current number of lines of the column"
);
return
-
1
;
}
return
0
;
...
...
src/obidmscolumn.h
View file @
f5e992ab
...
...
@@ -406,7 +406,7 @@ char* obi_get_elements_names(OBIDMS_column_p column);
* @since April 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
int
obi_column_prepare_to_set_value
(
OBIDMS_column_p
column
,
index_t
line_nb
);
int
obi_column_prepare_to_set_value
(
OBIDMS_column_p
column
,
index_t
line_nb
,
index_t
elt_idx
);
/**
...
...
src/obidmscolumn_bool.c
View file @
f5e992ab
...
...
@@ -26,7 +26,7 @@
int
obi_column_set_obibool_with_elt_idx
(
OBIDMS_column_p
column
,
index_t
line_nb
,
index_t
element_idx
,
obibool_t
value
)
{
if
(
obi_column_prepare_to_set_value
(
column
,
line_nb
)
<
0
)
if
(
obi_column_prepare_to_set_value
(
column
,
line_nb
,
element_idx
)
<
0
)
return
-
1
;
// Set the value
...
...
src/obidmscolumn_char.c
View file @
f5e992ab
...
...
@@ -26,7 +26,7 @@
int
obi_column_set_obichar_with_elt_idx
(
OBIDMS_column_p
column
,
index_t
line_nb
,
index_t
element_idx
,
obichar_t
value
)
{
if
(
obi_column_prepare_to_set_value
(
column
,
line_nb
)
<
0
)
if
(
obi_column_prepare_to_set_value
(
column
,
line_nb
,
element_idx
)
<
0
)
return
-
1
;
// Set the value
...
...
src/obidmscolumn_float.c
View file @
f5e992ab
...
...
@@ -25,7 +25,7 @@
int
obi_column_set_obifloat_with_elt_idx
(
OBIDMS_column_p
column
,
index_t
line_nb
,
index_t
element_idx
,
obifloat_t
value
)
{
if
(
obi_column_prepare_to_set_value
(
column
,
line_nb
)
<
0
)
if
(
obi_column_prepare_to_set_value
(
column
,
line_nb
,
element_idx
)
<
0
)
return
-
1
;
// Set the value
...
...
src/obidmscolumn_idx.c
View file @
f5e992ab
...
...
@@ -26,7 +26,7 @@
int
obi_column_set_index_with_elt_idx
(
OBIDMS_column_p
column
,
index_t
line_nb
,
index_t
element_idx
,
index_t
value
)
{
if
(
obi_column_prepare_to_set_value
(
column
,
line_nb
)
<
0
)
if
(
obi_column_prepare_to_set_value
(
column
,
line_nb
,
element_idx
)
<
0
)
return
-
1
;
// Set the value
...
...
src/obidmscolumn_int.c
View file @
f5e992ab
...
...
@@ -25,7 +25,7 @@
int
obi_column_set_obiint_with_elt_idx
(
OBIDMS_column_p
column
,
index_t
line_nb
,
index_t
element_idx
,
obiint_t
value
)
{
if
(
obi_column_prepare_to_set_value
(
column
,
line_nb
)
<
0
)
if
(
obi_column_prepare_to_set_value
(
column
,
line_nb
,
element_idx
)
<
0
)
return
-
1
;
// Set the value
...
...
src/obidmscolumn_qual.c
View file @
f5e992ab
...
...
@@ -59,7 +59,7 @@ int obi_column_set_obiqual_int_with_elt_idx(OBIDMS_column_p column, index_t line
index_t
idx
;
char
*
new_indexer_name
;
if
(
obi_column_prepare_to_set_value
(
column
,
line_nb
)
<
0
)
if
(
obi_column_prepare_to_set_value
(
column
,
line_nb
,
element_idx
)
<
0
)
return
-
1
;
if
(
value
==
OBIQual_int_NA
)
...
...
src/obidmscolumn_seq.c
View file @
f5e992ab
...
...
@@ -28,7 +28,7 @@ int obi_column_set_obiseq_with_elt_idx(OBIDMS_column_p column, index_t line_nb,
{
index_t
idx
;
if
(
obi_column_prepare_to_set_value
(
column
,
line_nb
)
<
0
)
if
(
obi_column_prepare_to_set_value
(
column
,
line_nb
,
element_idx
)
<
0
)
return
-
1
;
if
(
value
==
OBISeq_NA
)
...
...
src/obidmscolumn_str.c
View file @
f5e992ab
...
...
@@ -28,7 +28,7 @@ int obi_column_set_obistr_with_elt_idx(OBIDMS_column_p column, index_t line_nb,
{
index_t
idx
;
if
(
obi_column_prepare_to_set_value
(
column
,
line_nb
)
<
0
)
if
(
obi_column_prepare_to_set_value
(
column
,
line_nb
,
element_idx
)
<
0
)
return
-
1
;
if
(
value
==
OBIStr_NA
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment