From 578d0743979ac62b6e55f588b004d98be6cb4c73 Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Thu, 7 Sep 2006 22:49:26 +0000 Subject: [PATCH] remove commented out string conversion and prevet a possible shared_ptr dereference in c_str() --- alg/sequence.cpp | 21 +++++---------------- alg/sequence.hpp | 6 ++---- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/alg/sequence.cpp b/alg/sequence.cpp index e318207..787f2a9 100644 --- a/alg/sequence.cpp +++ b/alg/sequence.cpp @@ -126,20 +126,6 @@ Sequence &Sequence::operator=(const Sequence& s) return *this; } -/* -Sequence::operator std::string() -{ - std::string s(seq.begin(), seq.end()); - return s; -} - -Sequence::operator std::string() const -{ - std::string s(seq.begin(), seq.end()); - return s; -} -*/ - static void multiplatform_getline(std::istream& in, std::string& line) { line.clear(); @@ -247,7 +233,7 @@ Sequence::load_fasta(std::iostream& data_file, int seq_num, } void Sequence::set_filtered_sequence(const std::string &old_seq, - std::string::size_type start, + std::string::size_type start, std::string::size_type count) { char conversionTable[257]; @@ -612,7 +598,10 @@ Sequence::clear() const char *Sequence::c_str() const { - return seq->c_str(); + if (seq) + return seq->c_str(); + else + return 0; } Sequence::const_iterator Sequence::begin() const diff --git a/alg/sequence.hpp b/alg/sequence.hpp index 6c5b3b6..b335dcd 100644 --- a/alg/sequence.hpp +++ b/alg/sequence.hpp @@ -129,10 +129,6 @@ public: //! assignment to constant sequences Sequence &operator=(const Sequence&); - // dangerous since they create large copies - //operator std::string(); - //operator std::string() const; - friend std::ostream& operator<<(std::ostream&, const Sequence&); friend bool operator<(const Sequence&, const Sequence&); friend bool operator==(const Sequence&, const Sequence&); @@ -229,8 +225,10 @@ public: private: boost::shared_ptr seq; std::string header; + //! species name std::string species; + //! store our oldstyle annotations std::list annots; //! a seperate list for motifs since we're currently not saving them std::list motif_list; -- 2.30.2