]> git.donarmstrong.com Git - bamtools.git/commitdiff
Regression fixed: error in BamAlignment tag access methods
authorderek <derekwbarnett@gmail.com>
Mon, 17 Oct 2011 03:30:34 +0000 (23:30 -0400)
committerderek <derekwbarnett@gmail.com>
Mon, 17 Oct 2011 03:30:34 +0000 (23:30 -0400)
CMakeLists.txt
docs/Doxyfile
src/api/BamAlignment.cpp
src/api/BamAlignment.h
src/api/BamConstants.h
src/api/CMakeLists.txt

index bc61435f95b39105786210f94f398e3ae022aae6..70f606ff237fb4c1428fe93c03fe4811b200575a 100644 (file)
@@ -32,7 +32,7 @@ ensure_out_of_source_build ("
 # set BamTools version information
 set (BamTools_VERSION_MAJOR 2)
 set (BamTools_VERSION_MINOR 0)
-set (BamTools_VERSION_BUILD 4)
+set (BamTools_VERSION_BUILD 5)
 
 # set our library and executable destination dirs
 set (EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin")
index b50929b5e550094107cbd16b55b8745182555559..c99c055e2a73a510418862ff6291a30945517825 100644 (file)
@@ -31,7 +31,7 @@ PROJECT_NAME           = BamTools
 # This could be handy for archiving the generated documentation or 
 # if some version control system is used.
 
-PROJECT_NUMBER         = 2.0.4
+PROJECT_NUMBER         = 2.0.5
 
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
 # base path where the generated documentation will be put. 
index 013937a99e7bd96fb44e1249d7c7fe4d2a1966ff..c95e896c7333d527d726c953a7fcd660f7f42ffc 100644 (file)
@@ -365,9 +365,18 @@ bool BamAlignment::FindTag(const std::string& tag,
             return true;
 
         // get the storage class and find the next tag
-        if ( *pTagStorageType == '\0' ) return false;
-        if ( !SkipToNextTag(*pTagStorageType, pTagData, numBytesParsed) ) return false;
-        if ( *pTagData == '\0' ) return false;
+        if ( *pTagStorageType == '\0' ) {
+            ErrorString = "unexpected null found - 1";
+            return false;
+        }
+        if ( !SkipToNextTag(*pTagStorageType, pTagData, numBytesParsed) ) {
+            ErrorString = "could not skip to next tag";
+            return false;
+        }
+        if ( *pTagData == '\0' ) {
+            ErrorString = "unexpected null found - 2";
+            return false;
+        }
     }
 
     // checked all tags, none match
index 22535c981a648a0b7f81b7cfc8b19b7b84effbe2..a2349ea9ce9b254066450dc953b99925a8f03b56 100644 (file)
@@ -2,7 +2,7 @@
 // BamAlignment.h (c) 2009 Derek Barnett
 // Marth Lab, Department of Biology, Boston College
 // ---------------------------------------------------------------------------
-// Last modified: 12 October 2011 (DB)
+// Last modified: 16 October 2011 (DB)
 // ---------------------------------------------------------------------------
 // Provides the BamAlignment data structure
 // ***************************************************************************
@@ -427,7 +427,7 @@ inline bool BamAlignment::GetTag(const std::string& tag, T& destination) const {
     unsigned int numBytesParsed = 0;
 
     // return failure if tag not found
-    if ( FindTag(tag, pTagData, tagDataLength, numBytesParsed) ) {
+    if ( !FindTag(tag, pTagData, tagDataLength, numBytesParsed) ) {
         // TODO: set error string?
         return false;
     }
@@ -508,7 +508,7 @@ inline bool BamAlignment::GetTag<std::string>(const std::string& tag,
     unsigned int numBytesParsed = 0;
 
     // return failure if tag not found
-    if ( FindTag(tag, pTagData, tagDataLength, numBytesParsed) ) {
+    if ( !FindTag(tag, pTagData, tagDataLength, numBytesParsed) ) {
         // TODO: set error string?
         return false;
     }
index a94409680085a06ade138ceca8b78bfec431e609..47f73a9baf3161db336dbe0dc66343f3ef147cee 100644 (file)
@@ -2,7 +2,7 @@
 // BamConstants.h (c) 2011 Derek Barnett
 // Marth Lab, Department of Biology, Boston College
 // ---------------------------------------------------------------------------
-// Last modified: 10 October 2011 (DB)
+// Last modified: 16 October 2011 (DB)
 // ---------------------------------------------------------------------------
 // Provides basic constants for handling BAM files.
 // ***************************************************************************
@@ -71,12 +71,12 @@ const int BAM_CIGAR_MASK  = ((1 << BAM_CIGAR_SHIFT) - 1);
 
 // BAM tag types & sizes
 const char BAM_TAG_TYPE_ASCII  = 'A';
-const char BAM_TAG_TYPE_UINT8  = 'c';
-const char BAM_TAG_TYPE_INT8   = 'C';
-const char BAM_TAG_TYPE_UINT16 = 's';
-const char BAM_TAG_TYPE_INT16  = 'S';
-const char BAM_TAG_TYPE_UINT32 = 'i';
-const char BAM_TAG_TYPE_INT32  = 'I';
+const char BAM_TAG_TYPE_INT8   = 'c';
+const char BAM_TAG_TYPE_UINT8  = 'C';
+const char BAM_TAG_TYPE_INT16  = 's';
+const char BAM_TAG_TYPE_UINT16 = 'S';
+const char BAM_TAG_TYPE_INT32  = 'i';
+const char BAM_TAG_TYPE_UINT32 = 'I';
 const char BAM_TAG_TYPE_FLOAT  = 'f';
 const char BAM_TAG_TYPE_STRING = 'Z';
 const char BAM_TAG_TYPE_HEX    = 'H';
@@ -190,7 +190,7 @@ struct TagTypeHelper<int8_t> {
 
 template<>
 struct TagTypeHelper<uint16_t> {
-    static bool CanCovnertFrom(const char c) {
+    static bool CanConvertFrom(const char c) {
         return ( c == Constants::BAM_TAG_TYPE_ASCII ||
                  c == Constants::BAM_TAG_TYPE_UINT8 ||
                  c == Constants::BAM_TAG_TYPE_UINT16 );
index 8278f66bac7a03752c27522cae574f2b65529a66..55f256025c00834a4c0df3c98bcc88649324dc75 100644 (file)
@@ -49,7 +49,7 @@ set( BamToolsAPISources
 
 # create main BamTools API shared library
 add_library( BamTools SHARED ${BamToolsAPISources} )
-set_target_properties( BamTools PROPERTIES SOVERSION "2.0.4" )
+set_target_properties( BamTools PROPERTIES SOVERSION "2.0.5" )
 set_target_properties( BamTools PROPERTIES OUTPUT_NAME "bamtools" )
 
 # create main BamTools API static library