]> git.donarmstrong.com Git - bamtools.git/commitdiff
Fixed output of tag types c & C. Removed atoi() call. Simply casting the single byte...
authorDerek <derekwbarnett@gmail.com>
Tue, 8 Jun 2010 16:32:02 +0000 (12:32 -0400)
committerDerek <derekwbarnett@gmail.com>
Tue, 8 Jun 2010 16:32:02 +0000 (12:32 -0400)
bamtools_convert.cpp

index e881d43c89a1d9dcff8685062902940b35a1f6b5..607c38000d1932a54e81eec6bf6bda159bcdc051 100644 (file)
@@ -238,12 +238,12 @@ void BamTools::PrintJSON(ostream& out, const BamAlignment& a) {
                     break;
                 
                 case('C') : 
-                    out << atoi(&tagData[index])
+                    out << (int)tagData[index]
                     ++index; 
                     break;
                 
                 case('c') : 
-                    out << atoi(&tagData[index]);
+                    out << (int)tagData[index];
                     ++index; 
                     break;
                 
@@ -347,6 +347,7 @@ void BamTools::PrintSAM(ostream& out, const BamAlignment& a) {
     // write tag data
     const char* tagData = a.TagData.c_str();
     const size_t tagDataLength = a.TagData.length();
+    
     size_t index = 0;
     while ( index < tagDataLength ) {
 
@@ -365,12 +366,12 @@ void BamTools::PrintSAM(ostream& out, const BamAlignment& a) {
                 break;
             
             case('C') : 
-                out << "i:" << atoi(&tagData[index])
+                out << "i:" << (int)tagData[index]
                 ++index; 
                 break;
             
             case('c') : 
-                out << "i:" << atoi(&tagData[index]);
+                out << "i:" << (int)tagData[index];
                 ++index; 
                 break;
             
@@ -384,7 +385,7 @@ void BamTools::PrintSAM(ostream& out, const BamAlignment& a) {
                 index += 2; 
                 break;
             
-            case('I') : 
+            case('I') :
                 out << "i:" << BgzfData::UnpackUnsignedInt(&tagData[index]);
                 index += 4; 
                 break;
@@ -414,7 +415,7 @@ void BamTools::PrintSAM(ostream& out, const BamAlignment& a) {
                 ++index; 
                 break;      
         }
-        
+
         if ( tagData[index] == '\0') break;
     }