This repository has been archived by the owner on Dec 16, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Modified operator == in IndividualFieldValue to use iterators which
take care of bcf_*_vector_end values implicitly A more serious bug in the previous implementation of the == operator was in the way string fields were handled. Points to remember for string fields: a. The size() function returns the number of characters allocated for the string. b. The variable m_num_bytes also stores the number of characters allocated for the string (same as size()) c. When operator[i] is called for string fields, the address that is accessed is m_format_ptr->p + i*m_num_bytes (not m_format_ptr->p + i). The address accessed is outside the original allocated memory. Moral of the story: use iterators always, or remember the intricacies of string v/s other types of fields. Similar fix for SharedField also 2. Use references to avoid copies where possible as per David's suggestions 3. Specialized operator[] for IndividualFieldValue<string> and SharedField<string> so that if the original VCF field type is of type String, the index argument for operator [] cannot be greater than 0. If it is greater than 0, then an out_of_range exception is thrown. 3. Added extra out of bounds test cases (by catching exceptions) 4. Fixed a memory leak in file_utils.h
- Loading branch information
Showing
7 changed files
with
136 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters